Add ceiling-mounted signal
This is the wall signal as ceiling variant. Because the trackdb can only save 4 rotation values, we need a ceiling version of this.master
parent
be1ac1e68e
commit
aa2ec0fc03
Binary file not shown.
|
@ -118,83 +118,45 @@ for r,f in pairs({on={as="off", ls="green", als="red"}, off={as="on", ls="red",
|
||||||
if r=="off" then crea=0 end
|
if r=="off" then crea=0 end
|
||||||
|
|
||||||
--tunnel signals. no rotations.
|
--tunnel signals. no rotations.
|
||||||
minetest.register_node("advtrains:signal_wall_l_"..r, {
|
for loc, sbox in pairs({l={-1/2, -1/2, -1/4, 0, 1/2, 1/4}, r={0, -1/2, -1/4, 1/2, 1/2, 1/4}, t={-1/2, 0, -1/4, 1/2, 1/2, 1/4}}) do
|
||||||
drawtype = "mesh",
|
minetest.register_node("advtrains:signal_wall_"..loc.."_"..r, {
|
||||||
paramtype="light",
|
drawtype = "mesh",
|
||||||
paramtype2="facedir",
|
paramtype="light",
|
||||||
walkable = false,
|
paramtype2="facedir",
|
||||||
selection_box = {
|
walkable = false,
|
||||||
type = "fixed",
|
selection_box = {
|
||||||
fixed = {-1/2, -1/2, -1/4, 0, 1/2, 1/4},
|
type = "fixed",
|
||||||
},
|
fixed = sbox,
|
||||||
mesh = "advtrains_signal_wall_l.b3d",
|
},
|
||||||
tiles = {"advtrains_signal_wall_"..r..".png"},
|
mesh = "advtrains_signal_wall_"..loc..".b3d",
|
||||||
drop="advtrains:signal_wall_l_off",
|
tiles = {"advtrains_signal_wall_"..r..".png"},
|
||||||
description=attrans("Wallmounted Signal, left"),
|
drop="advtrains:signal_wall_"..loc.."_off",
|
||||||
groups = {
|
description=attrans("Wallmounted Signal ("..loc..")"),
|
||||||
choppy=3,
|
groups = {
|
||||||
not_blocking_trains=1,
|
choppy=3,
|
||||||
not_in_creative_inventory=crea,
|
not_blocking_trains=1,
|
||||||
save_in_nodedb=1,
|
not_in_creative_inventory=crea,
|
||||||
},
|
save_in_nodedb=1,
|
||||||
light_source = 1,
|
},
|
||||||
sunlight_propagates=true,
|
light_source = 1,
|
||||||
mesecons = {effector = {
|
sunlight_propagates=true,
|
||||||
mrules_wallsignal_l,
|
mesecons = {effector = {
|
||||||
["action_"..f.as] = function (pos, node)
|
rules = mrules_wallsignal_r,
|
||||||
advtrains.ndb.swap_node(pos, {name = "advtrains:signal_wall_l_"..f.as, param2 = node.param2})
|
["action_"..f.as] = function (pos, node)
|
||||||
end
|
advtrains.ndb.swap_node(pos, {name = "advtrains:signal_wall_"..loc.."_"..f.as, param2 = node.param2})
|
||||||
}},
|
|
||||||
luaautomation = {
|
|
||||||
getstate = f.ls,
|
|
||||||
setstate = function(pos, node, newstate)
|
|
||||||
if newstate == f.als then
|
|
||||||
advtrains.ndb.swap_node(pos, {name = "advtrains:signal_wall_l_"..f.as, param2 = node.param2})
|
|
||||||
end
|
end
|
||||||
|
}},
|
||||||
|
luaautomation = {
|
||||||
|
getstate = f.ls,
|
||||||
|
setstate = function(pos, node, newstate)
|
||||||
|
if newstate == f.als then
|
||||||
|
advtrains.ndb.swap_node(pos, {name = "advtrains:signal_wall_"..loc.."_"..f.as, param2 = node.param2})
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
on_rightclick=function(pos, node, clicker)
|
||||||
|
advtrains.ndb.swap_node(pos, {name = "advtrains:signal_wall_"..loc.."_"..f.as, param2 = node.param2})
|
||||||
end,
|
end,
|
||||||
},
|
})
|
||||||
on_rightclick=function(pos, node, clicker)
|
end
|
||||||
advtrains.ndb.swap_node(pos, {name = "advtrains:signal_wall_l_"..f.as, param2 = node.param2})
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
minetest.register_node("advtrains:signal_wall_r_"..r, {
|
|
||||||
drawtype = "mesh",
|
|
||||||
paramtype="light",
|
|
||||||
paramtype2="facedir",
|
|
||||||
walkable = false,
|
|
||||||
selection_box = {
|
|
||||||
type = "fixed",
|
|
||||||
fixed = {0, -1/2, -1/4, 1/2, 1/2, 1/4},
|
|
||||||
},
|
|
||||||
mesh = "advtrains_signal_wall_r.b3d",
|
|
||||||
tiles = {"advtrains_signal_wall_"..r..".png"},
|
|
||||||
drop="advtrains:signal_wall_r_off",
|
|
||||||
description=attrans("Wallmounted Signal, right"),
|
|
||||||
groups = {
|
|
||||||
choppy=3,
|
|
||||||
not_blocking_trains=1,
|
|
||||||
not_in_creative_inventory=crea,
|
|
||||||
save_in_nodedb=1,
|
|
||||||
},
|
|
||||||
light_source = 1,
|
|
||||||
sunlight_propagates=true,
|
|
||||||
mesecons = {effector = {
|
|
||||||
rules = mrules_wallsignal_r,
|
|
||||||
["action_"..f.as] = function (pos, node)
|
|
||||||
advtrains.ndb.swap_node(pos, {name = "advtrains:signal_wall_r_"..f.as, param2 = node.param2})
|
|
||||||
end
|
|
||||||
}},
|
|
||||||
luaautomation = {
|
|
||||||
getstate = f.ls,
|
|
||||||
setstate = function(pos, node, newstate)
|
|
||||||
if newstate == f.als then
|
|
||||||
advtrains.ndb.swap_node(pos, {name = "advtrains:signal_wall_r_"..f.as, param2 = node.param2})
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
on_rightclick=function(pos, node, clicker)
|
|
||||||
advtrains.ndb.swap_node(pos, {name = "advtrains:signal_wall_r_"..f.as, param2 = node.param2})
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue