diff options
author | orwell96 <mono96.mml@gmail.com> | 2016-09-12 22:58:18 +0200 |
---|---|---|
committer | orwell96 <mono96.mml@gmail.com> | 2016-09-12 22:58:18 +0200 |
commit | d3af97b63e92c84f1857483aa49fb677acaff541 (patch) | |
tree | 54efd33e481d188aa2482ba3decbfc440f8765e2 /signals.lua | |
parent | bdfe260780bb318f3fdc9771de51786160ca1e57 (diff) | |
download | advtrains-d3af97b63e92c84f1857483aa49fb677acaff541.tar.gz advtrains-d3af97b63e92c84f1857483aa49fb677acaff541.tar.bz2 advtrains-d3af97b63e92c84f1857483aa49fb677acaff541.zip |
adding a signal.
it is controllable by mesecons and by right click. it does not influence trains
Diffstat (limited to 'signals.lua')
-rw-r--r-- | signals.lua | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/signals.lua b/signals.lua new file mode 100644 index 0000000..44fe621 --- /dev/null +++ b/signals.lua @@ -0,0 +1,31 @@ +--advtrains by orwell96 +--signals.lua + +for r,f in pairs({on="off", off="on"}) do + minetest.register_node("advtrains:retrosignal_"..r, { + drawtype = "mesh", + paramtype="light", + paramtype2="facedir", + walkable = false, + selection_box = { + type = "fixed", + fixed = {-1/4, -1/2, -1/4, 1/4, 2, 1/4}, + }, + mesh = "advtrains_retrosignal_"..r..".b3d", + tiles = {"advtrains_retrosignal.png"}, + description="Lampless Signal ("..r..")", + on_rightclick=switchfunc, + groups = { + choppy=3, + not_blocking_trains=1 + }, + mesecons = {effector = { + action_on = function (pos, node) + minetest.swap_node(pos, {name = "advtrains:retrosignal_"..f, param2 = node.param2}) + end + }}, + on_rightclick=function(pos, node, clicker) + minetest.swap_node(pos, {name = "advtrains:retrosignal_"..f, param2 = node.param2}) + end, + }) +end |