Skip to content

fixes for deployer and node breaker #139

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions mods/sbz_bio/plants.lua
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ sbz_api.register_plant("pyrograss", {
minetest.register_craftitem("sbz_bio:pyrograss", {
description = "Pyrograss",
inventory_image = "pyrograss_4.png",
groups = { burn = 30, eat = 1 },
groups = { burn = 30, eat = 1, nb_nouse = 1 },
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

really really small nitpick: it would be better named "nb_no_use" :D

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

im just following convention of nb_nodig. i'll change that too i guess

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure

on_place = sbz_api.plant_plant("sbz_bio:pyrograss_1", { "group:soil" })
})

Expand Down Expand Up @@ -304,7 +304,7 @@ core.register_craft {
minetest.register_craftitem("sbz_bio:razorgrass", {
description = "Razorgrass",
inventory_image = "razorgrass_4.png",
groups = { burn = 2, eat = -8 },
groups = { burn = 2, eat = -8, nb_nouse = 1 },
eat_fx = { "Poisoned", "Slowed" },
on_place = sbz_api.plant_plant("sbz_bio:razorgrass_1", { "group:soil" }),
on_use = function(stack, user, pointed)
Expand Down Expand Up @@ -347,7 +347,7 @@ sbz_api.register_plant("cleargrass", {
minetest.register_craftitem("sbz_bio:cleargrass", {
description = "Cleargrass",
inventory_image = "cleargrass_4.png",
groups = { burn = 0, eat = 0 },
groups = { burn = 0, eat = 0, nb_nouse = 1 },
eat_fx = { "Cleared" },
on_place = sbz_api.plant_plant("sbz_bio:cleargrass_1", { "group:soil" }),
on_use = function(stack, user, pointed)
Expand Down Expand Up @@ -375,7 +375,7 @@ sbz_api.register_plant("stemfruit_plant", {
minetest.register_craftitem("sbz_bio:stemfruit", {
description = "Stemfruit",
inventory_image = "stemfruit.png",
groups = { burn = 12, eat = 5 },
groups = { burn = 12, eat = 5, nb_nouse = 1 },
on_place = function(itemstack, user, pointed)
local use_pointed = "above"
if pointed.switched then
Expand Down Expand Up @@ -440,7 +440,7 @@ minetest.register_craftitem("sbz_bio:warpshroom", {
unlock_achievement(user:get_player_name(), "Not Chorus Fruit")
return eat(itemstack, user, pointed)
end,
groups = { ui_bio = 1, eat = 6 }
groups = { ui_bio = 1, eat = 6, nb_nouse = 1 }
})
--[[
minetest.register_craft({
Expand Down Expand Up @@ -505,7 +505,7 @@ minetest.register_craftitem("sbz_bio:shockshroom", {
description = "Shockshroom",
inventory_image = "shockshroom_4.png",
on_place = sbz_api.plant_plant("sbz_bio:shockshroom_1", { "group:soil" }),
groups = { ui_bio = 1, eat = -1 },
groups = { ui_bio = 1, eat = -1, nb_nouse = 1 },
on_use = function(stack, user, pointed)
if user.is_fake_player then return end
playereffects.apply_effect_type("shocked", 180 / 0.5, user, 0.5)
Expand Down
2 changes: 1 addition & 1 deletion mods/sbz_pipeworks/mod.conf
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
name = pipeworks
depends = fakelib, sbz_base, mesecons_mvps, unifieddyes
depends = fakelib, creative, sbz_base, mesecons_mvps, unifieddyes
6 changes: 5 additions & 1 deletion mods/sbz_pipeworks/wielder.lua
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,8 @@ pipeworks.register_wielder({
local stack = fakeplayer:get_wielded_item()
local old_stack = ItemStack(stack)
local item_def = minetest.registered_items[stack:get_name()]
if item_def.on_use then
-- use only items that's allowed to be used
if item_def.on_use and core.get_item_group(stack:get_name(), 'nb_nouse') == 0 then
stack = item_def.on_use(stack, fakeplayer, pointed) or stack
fakeplayer:set_wielded_item(stack)
else
Expand Down Expand Up @@ -293,6 +294,9 @@ pipeworks.register_wielder({
local def = minetest.registered_items[stack:get_name()]
if def and def.on_place then
local new_stack, placed_pos = def.on_place(stack, fakeplayer, pointed)
if new_stack and core.is_creative_enabled(fakeplayer:get_player_name()) then
new_stack:take_item() -- undoes creative's auto-add
Copy link
Contributor

@TheEt1234 TheEt1234 May 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not good, what if you are using a deployer with a tool
example: you use deployer with the replacer tool

The replacer tool will vanish

BTW: feel free to modify the creative mod, it's heavily modified in sbz anyway (feel free to modify any mod, just state that it has been modified in sbz)

end
fakeplayer:set_wielded_item(new_stack or stack)
-- minetest.item_place_node doesn't play sound to the placer
local sound = placed_pos and def.sounds and def.sounds.place
Expand Down