diff options
Diffstat (limited to 'advtrains')
-rw-r--r-- | advtrains/advtrains/models/advtrains_signal_wall_t.b3d | bin | 0 -> 40514 bytes | |||
-rw-r--r-- | advtrains/advtrains/signals.lua | 116 |
2 files changed, 39 insertions, 77 deletions
diff --git a/advtrains/advtrains/models/advtrains_signal_wall_t.b3d b/advtrains/advtrains/models/advtrains_signal_wall_t.b3d Binary files differnew file mode 100644 index 0000000..30e77f6 --- /dev/null +++ b/advtrains/advtrains/models/advtrains_signal_wall_t.b3d diff --git a/advtrains/advtrains/signals.lua b/advtrains/advtrains/signals.lua index cdf610e..3278c39 100644 --- a/advtrains/advtrains/signals.lua +++ b/advtrains/advtrains/signals.lua @@ -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}) - end - 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}) + 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_r_"..f.as, param2 = node.param2}) - end, - }) - + }) + end end |