aboutsummaryrefslogtreecommitdiff
path: root/advtrains_signals_ks/init_degrotate_nodes.lua
diff options
context:
space:
mode:
authororwell96 <orwell@bleipb.de>2018-10-26 18:41:24 +0200
committerorwell96 <orwell@bleipb.de>2018-10-26 18:41:24 +0200
commite194732596c8870cd0ca54953433358619c0a5b9 (patch)
tree507d3cd104b3f88f3f4eaa28c2769fe94f748287 /advtrains_signals_ks/init_degrotate_nodes.lua
parent6bb6c7d345ad285d0c5388b1daf83e67a7b466e6 (diff)
downloadadvtrains-e194732596c8870cd0ca54953433358619c0a5b9.tar.gz
advtrains-e194732596c8870cd0ca54953433358619c0a5b9.tar.bz2
advtrains-e194732596c8870cd0ca54953433358619c0a5b9.zip
Complete Ks Main signals
Diffstat (limited to 'advtrains_signals_ks/init_degrotate_nodes.lua')
-rw-r--r--advtrains_signals_ks/init_degrotate_nodes.lua94
1 files changed, 94 insertions, 0 deletions
diff --git a/advtrains_signals_ks/init_degrotate_nodes.lua b/advtrains_signals_ks/init_degrotate_nodes.lua
new file mode 100644
index 0000000..a4380d2
--- /dev/null
+++ b/advtrains_signals_ks/init_degrotate_nodes.lua
@@ -0,0 +1,94 @@
+-- Ks Signals for advtrains
+-- will implement the advtrains signal API (which does not exist yet)
+
+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,
+})