aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authororwell96 <mono96.mml@gmail.com>2017-02-28 13:39:38 +0100
committerorwell96 <mono96.mml@gmail.com>2017-02-28 13:39:38 +0100
commitaa2ec0fc0337de5facb7ebf9adb3dca4f9fefdaf (patch)
tree4920b3e5167162fc53109924b85ceaaf80222334
parentbe1ac1e68ed41945d0dfa68148186856497f2936 (diff)
downloadadvtrains-aa2ec0fc0337de5facb7ebf9adb3dca4f9fefdaf.tar.gz
advtrains-aa2ec0fc0337de5facb7ebf9adb3dca4f9fefdaf.tar.bz2
advtrains-aa2ec0fc0337de5facb7ebf9adb3dca4f9fefdaf.zip
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.
-rw-r--r--advtrains/advtrains/models/advtrains_signal_wall_t.b3dbin0 -> 40514 bytes
-rw-r--r--advtrains/advtrains/signals.lua116
-rw-r--r--assets/signal_wall_ceiling.blendbin0 -> 512620 bytes
-rw-r--r--assets/signal_wall_ceiling.blend1bin0 -> 512620 bytes
4 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
new file mode 100644
index 0000000..30e77f6
--- /dev/null
+++ b/advtrains/advtrains/models/advtrains_signal_wall_t.b3d
Binary files 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
--- /dev/null
+++ b/assets/signal_wall_ceiling.blend
Binary files differ
diff --git a/assets/signal_wall_ceiling.blend1 b/assets/signal_wall_ceiling.blend1
new file mode 100644
index 0000000..2269ae8
--- /dev/null
+++ b/assets/signal_wall_ceiling.blend1
Binary files differ