From aa2ec0fc0337de5facb7ebf9adb3dca4f9fefdaf Mon Sep 17 00:00:00 2001 From: orwell96 Date: Tue, 28 Feb 2017 13:39:38 +0100 Subject: 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. --- .../advtrains/models/advtrains_signal_wall_t.b3d | Bin 0 -> 40514 bytes advtrains/advtrains/signals.lua | 116 +++++++-------------- assets/signal_wall_ceiling.blend | Bin 0 -> 512620 bytes assets/signal_wall_ceiling.blend1 | Bin 0 -> 512620 bytes 4 files changed, 39 insertions(+), 77 deletions(-) create mode 100644 advtrains/advtrains/models/advtrains_signal_wall_t.b3d create mode 100644 assets/signal_wall_ceiling.blend create mode 100644 assets/signal_wall_ceiling.blend1 diff --git a/advtrains/advtrains/models/advtrains_signal_wall_t.b3d b/advtrains/advtrains/models/advtrains_signal_wall_t.b3d new file mode 100644 index 0000000..30e77f6 Binary files /dev/null and b/advtrains/advtrains/models/advtrains_signal_wall_t.b3d differ 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 diff --git a/assets/signal_wall_ceiling.blend b/assets/signal_wall_ceiling.blend new file mode 100644 index 0000000..6afd682 Binary files /dev/null and b/assets/signal_wall_ceiling.blend differ diff --git a/assets/signal_wall_ceiling.blend1 b/assets/signal_wall_ceiling.blend1 new file mode 100644 index 0000000..2269ae8 Binary files /dev/null and b/assets/signal_wall_ceiling.blend1 differ -- cgit v1.2.3