aboutsummaryrefslogtreecommitdiff
path: root/advtrains_signals_ks/init_degrotate_nodes.lua
blob: da1c980c7f7583bca045e5d72a85007e347ce8f7 (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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
-- Ks Signals for advtrains
-- will implement the advtrains signal API

local function place_degrotate(pos, placer, itemstack, pointed_thing)
	local yaw = placer:get_look_horizontal()
	local param = math.floor(yaw * 90 / math.pi + 0.5)
	local n = minetest.get_node(pos)
	n.param2 = param
	minetest.set_node(pos, n)
end

minetest.register_node("advtrains_signals_ks:mast", {
	drawtype = "mesh",
	paramtype="light",
	paramtype2="degrotate",
	walkable = false,
	selection_box = {
		type = "fixed",
		fixed = {-1/4, -1/2, -1/4, 1/4, 1/2, 1/4},
	},
	mesh = "advtrains_signals_ks_mast.obj",
	tiles = {"advtrains_signals_ks_mast.png"},
	description="Ks Signal Mast",
	sunlight_propagates=true,
	groups = {
		cracky=3,
		not_blocking_trains=1,
		--save_in_at_nodedb=2,
	},
	after_place_node = place_degrotate,
})

minetest.register_node("advtrains_signals_ks:head_main", {
	drawtype = "mesh",
	paramtype="light",
	paramtype2="degrotate",
	walkable = false,
	selection_box = {
		type = "fixed",
		fixed = {-1/4, -1/2, -1/4, 1/4, 1/2, 1/4},
	},
	mesh = "advtrains_signals_ks_head_main.obj",
	tiles = {"advtrains_signals_ks_mast.png", "advtrains_signals_ks_head.png"},
	description="Ks Main Signal Screen",
	sunlight_propagates=true,
	groups = {
		cracky=3,
		not_blocking_trains=1,
		--save_in_at_nodedb=2,
	},
	after_place_node = place_degrotate,
})

minetest.register_node("advtrains_signals_ks:zs_top", {
	drawtype = "mesh",
	paramtype="light",
	paramtype2="degrotate",
	walkable = false,
	selection_box = {
		type = "fixed",
		fixed = {-1/4, -1/2, -1/4, 1/4, 1/2, 1/4},
	},
	mesh = "advtrains_signals_ks_zs_top.obj",
	tiles = {"advtrains_signals_ks_mast.png", "advtrains_signals_ks_head.png"},
	description="Ks Speed Restriction Signal (top)",
	sunlight_propagates=true,
	groups = {
		cracky=3,
		not_blocking_trains=1,
		--save_in_at_nodedb=2,
	},
	after_place_node = place_degrotate,
})

minetest.register_node("advtrains_signals_ks:zs_bottom", {
	drawtype = "mesh",
	paramtype="light",
	paramtype2="degrotate",
	walkable = false,
	selection_box = {
		type = "fixed",
		fixed = {-1/4, -1/2, -1/4, 1/4, 1/2, 1/4},
	},
	mesh = "advtrains_signals_ks_zs_bottom.obj",
	tiles = {"advtrains_signals_ks_mast.png", "advtrains_signals_ks_head.png"},
	description="Ks Speed Restriction Signal (bottom)",
	sunlight_propagates=true,
	groups = {
		cracky=3,
		not_blocking_trains=1,
		--save_in_at_nodedb=2,
	},
	after_place_node = place_degrotate,
})