Allow torch placement on more nodes

This commit is contained in:
Wuzzy 2019-12-13 10:20:22 +01:00
parent 1a02ccd36f
commit b5133c0c4a

View File

@ -9,15 +9,14 @@ local function check_placement_allowed(node, wdir)
-- Torch placement rules: Disallow placement on some nodes. General rule: Solid, opaque, full cube collision box nodes are allowed. -- Torch placement rules: Disallow placement on some nodes. General rule: Solid, opaque, full cube collision box nodes are allowed.
-- Special allowed nodes: -- Special allowed nodes:
-- * soul sand -- * soul sand
-- * end portal frame (TODO)
-- * mob spawner -- * mob spawner
-- * Fence, wall, glass, hopper: Only on top -- * chorus flower
-- * Slab: Only on top if upside down -- * glass, barrier, ice
-- * Stairs: Only on top if upside down -- * Fence, wall, hopper, end portal frame with ender eye: Only on top
-- * Slab, stairs: Only on top if upside down
-- Special forbidden nodes: -- Special forbidden nodes:
-- * Piston -- * Piston, sticky piston
-- * Sticky piston
local def = minetest.registered_nodes[node.name] local def = minetest.registered_nodes[node.name]
if not def then if not def then
return false return false
@ -25,19 +24,17 @@ local function check_placement_allowed(node, wdir)
elseif wdir == 0 then elseif wdir == 0 then
return false return false
elseif not def.buildable_to then elseif not def.buildable_to then
if node.name ~= "mcl_nether:soul_sand" and node.name ~= "mcl_mobspawners:spawner" and if node.name ~= "mcl_core:ice" and node.name ~= "mcl_nether:soul_sand" and node.name ~= "mcl_mobspawners:spawner" and node.name ~= "mcl_core:barrier" and node.name ~= "mcl_end:chorus_flower" and node.name ~= "mcl_end:chorus_flower_dead" and (not def.groups.glass) and
((not def.groups.solid) or (not def.groups.opaque)) then ((not def.groups.solid) or (not def.groups.opaque)) then
-- Only allow top placement on these nodes -- Only allow top placement on these nodes
if def.groups.glass or node.name == "mcl_hoppers:hopper" or node.name == "mcl_hoppers:hopper_side" or node.name == "mcl_hoppers:hopper_disabled" or node.name == "mcl_hoppers:hopper_side_disabled" or def.groups.fence == 1 or def.groups.wall or def.groups.slab_top == 1 or (def.groups.stair == 1 and minetest.facedir_to_dir(node.param2).y ~= 0) then if node.name == "mcl_end:dragon_egg" or node.name == "mcl_portals:end_portal_frame_eye" or def.groups.hopper or def.groups.fence == 1 or def.groups.wall or def.groups.slab_top == 1 or def.groups.anvil or def.groups.pane or (def.groups.stair == 1 and minetest.facedir_to_dir(node.param2).y ~= 0) then
if wdir ~= 1 then if wdir ~= 1 then
return false return false
end end
else else
return false return false
end end
elseif node.name == "mesecons_pistons:piston_up_normal_off" or node.name == "mesecons_pistons:piston_up_sticky_off" or elseif minetest.get_item_group(node.name, "piston") >= 1 then
node.name == "mesecons_pistons:piston_normal_off" or node.name == "mesecons_pistons:piston_sticky_off" or
node.name == "mesecons_pistons:piston_down_normal_off" or node.name == "mesecons_pistons:piston_down_sticky_off" then
return false return false
end end
end end