aboutsummaryrefslogtreecommitdiff
path: root/signals.lua
blob: 118d16e61279ad217f80ac5d89e4210d9f7806fd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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_"..f] = 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