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
orwell96 2017-02-28 13:39:38 +01:00
parent be1ac1e68e
commit aa2ec0fc03
4 changed files with 39 additions and 77 deletions

Binary file not shown.

View File

@ -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
--tunnel signals. no rotations.
minetest.register_node("advtrains:signal_wall_l_"..r, {
drawtype = "mesh",
paramtype="light",
paramtype2="facedir",
walkable = false,
selection_box = {
type = "fixed",
fixed = {-1/2, -1/2, -1/4, 0, 1/2, 1/4},
},
mesh = "advtrains_signal_wall_l.b3d",
tiles = {"advtrains_signal_wall_"..r..".png"},
drop="advtrains:signal_wall_l_off",
description=attrans("Wallmounted Signal, left"),
groups = {
choppy=3,
not_blocking_trains=1,
not_in_creative_inventory=crea,
save_in_nodedb=1,
},
light_source = 1,
sunlight_propagates=true,
mesecons = {effector = {
mrules_wallsignal_l,
["action_"..f.as] = function (pos, node)
advtrains.ndb.swap_node(pos, {name = "advtrains:signal_wall_l_"..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_l_"..f.as, param2 = node.param2})
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
minetest.register_node("advtrains:signal_wall_"..loc.."_"..r, {
drawtype = "mesh",
paramtype="light",
paramtype2="facedir",
walkable = false,
selection_box = {
type = "fixed",
fixed = sbox,
},
mesh = "advtrains_signal_wall_"..loc..".b3d",
tiles = {"advtrains_signal_wall_"..r..".png"},
drop="advtrains:signal_wall_"..loc.."_off",
description=attrans("Wallmounted Signal ("..loc..")"),
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_"..loc.."_"..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_"..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,
},
on_rightclick=function(pos, node, clicker)
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.