adding a signal.

it is controllable by mesecons and by right click. it does not influence trains
master
orwell96 2016-09-12 22:58:18 +02:00
parent bdfe260780
commit d3af97b63e
8 changed files with 32 additions and 0 deletions

View File

@ -22,5 +22,6 @@ dofile(advtrains.modpath.."/pseudoload.lua");
dofile(advtrains.modpath.."/couple.lua");
dofile(advtrains.modpath.."/damage.lua");
dofile(advtrains.modpath.."/signals.lua");
dofile(advtrains.modpath.."/misc_nodes.lua");
dofile(advtrains.modpath.."/crafting.lua");

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

31
signals.lua Normal file
View File

@ -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

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB