make pistons not pull unsticky blocks

This commit is contained in:
goblin_mode 2024-10-31 12:32:03 +01:00 committed by cora
parent e3c19c1f46
commit 923b344282
2 changed files with 6 additions and 4 deletions

View File

@ -68,15 +68,17 @@ end
local function piston_off(pos, node)
local pistonspec = minetest.registered_nodes[node.name]._piston_spec
minetest.swap_node(pos, {param2 = node.param2, name = pistonspec.offname})
piston_remove_pusher (pos, node)
piston_remove_pusher(pos, node)
if not pistonspec.sticky then
return
end
local dir = -minetest.facedir_to_dir(node.param2)
local pullpos = vector.add(pos, vector.multiply(dir, 2))
local meta = minetest.get_meta(pos)
mcl_pistons.push(pullpos, vector.multiply(dir, -1), PISTON_MAXIMUM_PUSH, meta:get_string("owner"), pos)
if minetest.get_item_group(minetest.get_node(pullpos).name, "unsticky") == 0 then
local meta = minetest.get_meta(pos)
mcl_pistons.push(pullpos, vector.multiply(dir, -1), PISTON_MAXIMUM_PUSH, meta:get_string("owner"), pos)
end
end
local function piston_orientate(pos, placer)

View File

@ -99,7 +99,7 @@ minetest.register_node("mcl_farming:wheat", {
}
},
groups = {dig_immediate=3, not_in_creative_inventory=1, plant=1, attached_node=1,
dig_by_water=1,destroy_by_lava_flow=1, dig_by_piston=1},
dig_by_water=1,destroy_by_lava_flow=1, dig_by_piston=1, unsticky = 1},
sounds = mcl_sounds.node_sound_leaves_defaults(),
_mcl_blast_resistance = 0,
_mcl_fortune_drop = {