init.lua 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588
  1. mesecon.rules.flat2 =
  2. {{x = 2, y = 0, z = 0},
  3. {x =-2, y = 0, z = 0},
  4. {x = 0, y = 0, z = 2},
  5. {x = 0, y = 0, z =-2}
  6. }
  7. mesecon.rules.shunting_signal =
  8. {{x = 1, y = 0, z = 0},
  9. {x =-1, y = 0, z = 0},
  10. {x = 0, y = 0, z = 1},
  11. {x = 0, y = 0, z =-1},
  12. {x = 0, y = -1, z = 0}
  13. }
  14. mesecon.rules.switch = {
  15. p0 = {{x = 0, y = 0, z = 1}},
  16. p1 = {{x = 1, y = 0, z = 0}},
  17. p2 = {{x = 0, y = 0, z = -1}},
  18. p3 = {{x = -1, y = 0, z = 0}}
  19. }
  20. -- param = 2
  21. -- {{x = 0, y = 0, z = -1}}
  22. -- param = 0
  23. -- {{x = 0, y = 0, z = 1}}
  24. -- param = 3
  25. -- {{x = -1, y = 0, z = 0}}
  26. -- param = 1
  27. -- {{x = 1, y = 0, z = 0}}
  28. local function switch_get_rules(orientation)
  29. if orientation == 0 then
  30. return {{x = 0, y = 0, z = 1}}
  31. elseif orientation == 1 then
  32. return {{x = 1, y = 0, z = 0}}
  33. elseif orientation == 2 then
  34. return {{x = 0, y = 0, z = -1}}
  35. elseif orientation == 3 then
  36. return {{x = -1, y = 0, z = 0}}
  37. end
  38. return {{ x = 0, y = 0, z = 0 }}
  39. end
  40. -- POINT LEVERS WITH ARROW INDICATORS
  41. minetest.register_node("railroad_paraphernalia:switch_with_arrow", {
  42. description = 'Point lever w/arrow',
  43. drawtype = "mesh",
  44. mesh = "switch_arrow_2_off.b3d",
  45. tiles = { "points_lever_arrow.png" },
  46. node_box = {
  47. type = "fixed",
  48. fixed = {
  49. {-0.5, -0.5, -0.5, 0.5, -0.4, 0.5},
  50. {-0.5, -0.5, -1.5, 0.5, 1, -0.5}
  51. }
  52. },
  53. selection_box = {
  54. type = "fixed",
  55. fixed = {
  56. {-0.5, -0.5, -0.5, 0.5, -0.4, 0.5},
  57. {-0.5, -0.5, -1.5, 0.5, 1, -0.5}
  58. }
  59. },
  60. collisionbox = {-0.5, -0.5, -1.5, 0.5, 1, -0.5},
  61. walkable = false,
  62. groups = {snappy=1, choppy=2, oddly_breakable_by_hand=2, flammable=3, not_blocking_trains = 1},
  63. on_place = minetest.rotate_node,
  64. paramtype = "light",
  65. paramtype2 = "facedir",
  66. mesecons = {
  67. receptor = {
  68. state = mesecon.state.off,
  69. rules = mesecon.rules.flat
  70. }
  71. },
  72. after_place_node = function (pos, placer, itemstack, pointed_thing)
  73. mesecon.receptor_off(pos, switch_get_rules(minetest.get_node(pos).param2))
  74. end,
  75. on_rightclick = function (pos, node, player, itemstack, pointed_thing)
  76. if not advtrains.check_turnout_signal_protection(pos, player:get_player_name()) then
  77. return
  78. end
  79. minetest.set_node(pos, { name = "railroad_paraphernalia:switch_with_arrow_act", param2 = minetest.get_node(pos).param2 } )
  80. minetest.sound_play("piston_extend", {
  81. pos = pos,
  82. max_hear_distance = 20,
  83. gain = 0.3,
  84. })
  85. mesecon.receptor_on(pos, switch_get_rules(minetest.get_node(pos).param2))
  86. end,
  87. drop = "railroad_paraphernalia:switch_with_arrow"
  88. })
  89. minetest.register_node("railroad_paraphernalia:switch_with_arrow_act", {
  90. --description = 'Point lever w/arrow',
  91. drawtype = "mesh",
  92. mesh = "switch_arrow_2_on.b3d",
  93. tiles = { "points_lever_arrow.png" },
  94. node_box = {
  95. type = "fixed",
  96. fixed = {
  97. {-0.5, -0.5, -0.5, 0.5, -0.4, 0.5},
  98. {-0.5, -0.5, -1.5, 0.5, 1, -0.5}
  99. }
  100. },
  101. selection_box = {
  102. type = "fixed",
  103. fixed = {
  104. {-0.5, -0.5, -0.5, 0.5, -0.4, 0.5},
  105. {-0.5, -0.5, -1.5, 0.5, 1, -0.5}
  106. }
  107. },
  108. collisionbox = {-0.5, -0.5, -1.5, 0.5, 1, -0.5},
  109. walkable = false,
  110. groups = {snappy=1, choppy=2, oddly_breakable_by_hand=2, flammable=3, not_in_creative_inventory=1, not_blocking_trains = 1},
  111. on_place = minetest.rotate_node,
  112. paramtype = "light",
  113. paramtype2 = "facedir",
  114. mesecons = {
  115. receptor = {
  116. state = mesecon.state.off,
  117. rules = mesecon.rules.flat2
  118. }
  119. },
  120. on_rightclick = function (pos, node, player, itemstack, pointed_thing)
  121. if not advtrains.check_turnout_signal_protection(pos, player:get_player_name()) then
  122. return
  123. end
  124. minetest.set_node(pos, { name = "railroad_paraphernalia:switch_with_arrow", param2 = minetest.get_node(pos).param2 } )
  125. minetest.sound_play("piston_retract", {
  126. pos = pos,
  127. max_hear_distance = 20,
  128. gain = 0.3,
  129. })
  130. mesecon.receptor_off(pos, switch_get_rules(minetest.get_node(pos).param2))
  131. end,
  132. drop = "railroad_paraphernalia:switch_with_arrow"
  133. })
  134. minetest.register_craft({
  135. output = 'railroad_paraphernalia:switch_with_arrow 3',
  136. recipe = {
  137. {'dye:black', 'dye:white', 'dye:black'},
  138. {'', 'default:stick', 'default:stick'},
  139. {'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'},
  140. }
  141. })
  142. -- POINT LEVERS WITH LAMP INDICATORS
  143. minetest.register_node("railroad_paraphernalia:switch_with_lamp", {
  144. description = 'Point lever w/lamp',
  145. drawtype = "mesh",
  146. mesh = "switch_lamp_2_off.b3d",
  147. tiles = { "points_lever_lamp.png" },
  148. node_box = {
  149. type = "fixed",
  150. fixed = {
  151. {-0.5, -0.5, -0.5, 0.5, -0.4, 0.5},
  152. {-0.5, -0.5, -1.5, 0.5, 1, -0.5}
  153. }
  154. },
  155. selection_box = {
  156. type = "fixed",
  157. fixed = {
  158. {-0.5, -0.5, -0.5, 0.5, -0.4, 0.5},
  159. {-0.5, -0.5, -1.5, 0.5, 1, -0.5}
  160. }
  161. },
  162. collisionbox = {-0.5, -0.5, -1.5, 0.5, 1, -0.5},
  163. walkable = false,
  164. groups = {snappy=1, choppy=2, oddly_breakable_by_hand=2, flammable=3, not_blocking_trains = 1},
  165. on_place = minetest.rotate_node,
  166. paramtype = "light",
  167. paramtype2 = "facedir",
  168. mesecons = {
  169. receptor = {
  170. state = mesecon.state.off,
  171. rules = mesecon.rules.flat
  172. }
  173. },
  174. after_place_node = function (pos, placer, itemstack, pointed_thing)
  175. mesecon.receptor_off(pos, switch_get_rules(minetest.get_node(pos).param2))
  176. end,
  177. on_rightclick = function (pos, node, player, itemstack, pointed_thing)
  178. if not advtrains.check_turnout_signal_protection(pos, player:get_player_name()) then
  179. return
  180. end
  181. minetest.set_node(pos, { name = "railroad_paraphernalia:switch_with_lamp_act", param2 = minetest.get_node(pos).param2 } )
  182. minetest.sound_play("piston_extend", {
  183. pos = pos,
  184. max_hear_distance = 20,
  185. gain = 0.3,
  186. })
  187. mesecon.receptor_on(pos, switch_get_rules(minetest.get_node(pos).param2))
  188. end,
  189. drop = "railroad_paraphernalia:switch_with_lamp"
  190. })
  191. minetest.register_node("railroad_paraphernalia:switch_with_lamp_act", {
  192. --description = 'Point lever w/lamp',
  193. drawtype = "mesh",
  194. mesh = "switch_lamp_2_on.b3d",
  195. tiles = { "points_lever_lamp.png" },
  196. node_box = {
  197. type = "fixed",
  198. fixed = {
  199. {-0.5, -0.5, -0.5, 0.5, -0.4, 0.5},
  200. {-0.5, -0.5, -1.5, 0.5, 1, -0.5}
  201. }
  202. },
  203. selection_box = {
  204. type = "fixed",
  205. fixed = {
  206. {-0.5, -0.5, -0.5, 0.5, -0.4, 0.5},
  207. {-0.5, -0.5, -1.5, 0.5, 1, -0.5}
  208. }
  209. },
  210. collisionbox = {-0.5, -0.5, -1.5, 0.5, 1, -0.5},
  211. walkable = false,
  212. groups = {snappy=1, choppy=2, oddly_breakable_by_hand=2, flammable=3, not_in_creative_inventory=1, not_blocking_trains = 1},
  213. on_place = minetest.rotate_node,
  214. paramtype = "light",
  215. paramtype2 = "facedir",
  216. mesecons = {
  217. receptor = {
  218. state = mesecon.state.off,
  219. rules = mesecon.rules.flat2
  220. }
  221. },
  222. on_rightclick = function (pos, node, player, itemstack, pointed_thing)
  223. if not advtrains.check_turnout_signal_protection(pos, player:get_player_name()) then
  224. return
  225. end
  226. minetest.set_node(pos, { name = "railroad_paraphernalia:switch_with_lamp", param2 = minetest.get_node(pos).param2 } )
  227. minetest.sound_play("piston_retract", {
  228. pos = pos,
  229. max_hear_distance = 20,
  230. gain = 0.3,
  231. })
  232. mesecon.receptor_off(pos, switch_get_rules(minetest.get_node(pos).param2))
  233. end,
  234. drop = "railroad_paraphernalia:switch_with_lamp"
  235. })
  236. minetest.register_craft({
  237. output = 'railroad_paraphernalia:switch_with_lamp 3',
  238. recipe = {
  239. {'dye:grey', 'dye:yellow', 'dye:white'},
  240. {'', 'default:stick', 'default:stick'},
  241. {'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'},
  242. }
  243. })
  244. -- POINT LEVERS WITH A RED BALL
  245. -- minetest.register_node("railroad_paraphernalia:switch_with_ball", {
  246. -- description = 'Point lever w/ball',
  247. -- drawtype = "mesh",
  248. -- mesh = "switch_ball_off.b3d",
  249. -- tiles = { "switch_ball_off.png" },
  250. -- selection_box = { type = "fixed",
  251. -- fixed = {{-0.5, -0.5, -0.5, 0.5, 0.5, 0.5}}
  252. -- },
  253. -- collisionbox = {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
  254. -- groups = {snappy=1, choppy=2, oddly_breakable_by_hand=2, flammable=3},
  255. -- on_place = minetest.rotate_node,
  256. -- paramtype = "light",
  257. -- paramtype2 = "facedir",
  258. -- mesecons = {
  259. -- receptor = {
  260. -- state = mesecon.state.off,
  261. -- rules = mesecon.rules.flat
  262. -- }
  263. -- },
  264. -- after_place_node = function (pos, placer, itemstack, pointed_thing)
  265. -- mesecon.receptor_off(pos, switch_get_rules(minetest.get_node(pos).param2))
  266. -- end,
  267. -- on_rightclick = function (pos, node, player, itemstack, pointed_thing)
  268. -- minetest.set_node(pos, { name = "railroad_paraphernalia:switch_with_ball_act", param2 = minetest.get_node(pos).param2 } )
  269. -- minetest.sound_play("piston_extend", {
  270. -- pos = pos,
  271. -- max_hear_distance = 20,
  272. -- gain = 0.3,
  273. -- })
  274. -- mesecon.receptor_on(pos, switch_get_rules(minetest.get_node(pos).param2))
  275. -- end
  276. -- })
  277. --
  278. --
  279. -- minetest.register_node("railroad_paraphernalia:switch_with_ball_act", {
  280. -- --description = 'Point lever w/ball',
  281. -- drawtype = "mesh",
  282. -- mesh = "switch_ball_on.b3d",
  283. -- tiles = { "switch_ball_on.png" },
  284. -- selection_box = { type = "fixed",
  285. -- fixed = {{-0.5, -0.5, -0.5, 0.5, 0.5, 0.5}}
  286. -- },
  287. -- collisionbox = {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
  288. -- groups = {snappy=1, choppy=2, oddly_breakable_by_hand=2, flammable=3, not_in_creative_inventory=1},
  289. -- on_place = minetest.rotate_node,
  290. -- paramtype = "light",
  291. -- paramtype2 = "facedir",
  292. -- mesecons = {
  293. -- receptor = {
  294. -- state = mesecon.state.off,
  295. -- rules = mesecon.rules.flat2
  296. -- }
  297. -- },
  298. -- on_rightclick = function (pos, node, player, itemstack, pointed_thing)
  299. -- minetest.set_node(pos, { name = "railroad_paraphernalia:switch_with_ball", param2 = minetest.get_node(pos).param2 } )
  300. -- minetest.sound_play("piston_retract", {
  301. -- pos = pos,
  302. -- max_hear_distance = 20,
  303. -- gain = 0.3,
  304. -- })
  305. -- mesecon.receptor_off(pos, switch_get_rules(minetest.get_node(pos).param2))
  306. -- end
  307. -- })
  308. -- TRACK BLOCKER
  309. minetest.register_node("railroad_paraphernalia:track_blocker", {
  310. description = 'Track Blocker',
  311. drawtype = "mesh",
  312. mesh = "switch_blocker_off.b3d",
  313. tiles = { "track_blocker.png" },
  314. node_box = {
  315. type = "fixed",
  316. fixed = {
  317. {-0.5, -0.5, -0.5, 0.5, -0.4, 0.5},
  318. {-0.5, -0.5, -1.5, 0.5, 1, -0.5}
  319. }
  320. },
  321. selection_box = {
  322. type = "fixed",
  323. fixed = {
  324. {-0.5, -0.5, -0.5, 0.5, -0.4, 0.5},
  325. {-0.5, -0.5, -1.5, 0.5, 1, -0.5}
  326. }
  327. },
  328. collisionbox = {-0.5, -0.5, -1.5, 0.5, 1, -0.5},
  329. groups = {snappy=1, choppy=2, oddly_breakable_by_hand=2, flammable=3, not_blocking_trains = 1},
  330. on_place = minetest.rotate_node,
  331. paramtype = "light",
  332. paramtype2 = "facedir",
  333. --light_source = 3,
  334. mesecons = { receptor = {
  335. state = mesecon.state.off,
  336. rules = mesecon.rules.flat
  337. }},
  338. walkable = false,
  339. after_place_node = function (pos, placer, itemstack, pointed_thing)
  340. mesecon.receptor_off(pos, switch_get_rules(minetest.get_node(pos).param2))
  341. end,
  342. on_rightclick = function (pos, node, player, itemstack, pointed_thing)
  343. if not advtrains.check_turnout_signal_protection(pos, player:get_player_name()) then
  344. return
  345. end
  346. minetest.set_node(pos, { name = "railroad_paraphernalia:track_blocker_act", param2 = minetest.get_node(pos).param2 } )
  347. minetest.sound_play("piston_extend", {
  348. pos = pos,
  349. max_hear_distance = 20,
  350. gain = 0.3,
  351. })
  352. mesecon.receptor_on(pos, switch_get_rules(minetest.get_node(pos).param2))
  353. end,
  354. drop = "railroad_paraphernalia:track_blocker"
  355. })
  356. minetest.register_node("railroad_paraphernalia:track_blocker_act", {
  357. --description = 'Track Blocker',
  358. drawtype = "mesh",
  359. mesh = "switch_blocker_on.b3d",
  360. tiles = { "track_blocker.png" },
  361. node_box = {
  362. type = "fixed",
  363. fixed = {
  364. {-0.5, -0.5, -0.5, 0.5, -0.4, 0.5},
  365. {-0.5, -0.5, -1.5, 0.5, 1, -0.5}
  366. }
  367. },
  368. selection_box = {
  369. type = "fixed",
  370. fixed = {
  371. {-0.5, -0.5, -0.5, 0.5, -0.4, 0.5},
  372. {-0.5, -0.5, -1.5, 0.5, 1, -0.5}
  373. }
  374. },
  375. collisionbox = {-0.5, -0.5, -1.5, 0.5, 1, -0.5},
  376. groups = {snappy=1, choppy=2, oddly_breakable_by_hand=2, flammable=3, not_in_creative_inventory=1},
  377. on_place = minetest.rotate_node,
  378. paramtype = "light",
  379. paramtype2 = "facedir",
  380. --light_source = 3,
  381. mesecons = { receptor = {
  382. state = mesecon.state.off,
  383. rules = mesecon.rules.flat2
  384. }},
  385. walkable = true,
  386. on_rightclick = function (pos, node, player, itemstack, pointed_thing)
  387. if not advtrains.check_turnout_signal_protection(pos, player:get_player_name()) then
  388. return
  389. end
  390. minetest.set_node(pos, { name = "railroad_paraphernalia:track_blocker", param2 = minetest.get_node(pos).param2 } )
  391. minetest.sound_play("piston_retract", {
  392. pos = pos,
  393. max_hear_distance = 20,
  394. gain = 0.3,
  395. })
  396. mesecon.receptor_off(pos, switch_get_rules(minetest.get_node(pos).param2))
  397. end,
  398. drop = "railroad_paraphernalia:track_blocker"
  399. })
  400. minetest.register_craft({
  401. output = 'railroad_paraphernalia:track_blocker 2',
  402. recipe = {
  403. {'dye:white', 'dye:black', 'dye:white'},
  404. {'', 'default:stick', ''},
  405. {'dye:red', 'default:steel_ingot', 'default:steel_ingot'},
  406. }
  407. })
  408. -- -------------------------
  409. -- SHUNT SIGNAL
  410. -- 'tracktype' here actually just means something changeable with the trackworker
  411. advtrains.trackplacer.register_tracktype("railroad_paraphernalia:shunting_signal")
  412. local supported_aspects = {
  413. main = {false},
  414. shunt = nil,
  415. dst = { false },
  416. proceed_as_main = false,
  417. }
  418. local function gen_setaspect(rot)
  419. return function(pos, node, asp)
  420. local newstate = asp.shunt and "act" or "off"
  421. advtrains.ndb.swap_node(pos,
  422. {name="railroad_paraphernalia:shunting_signal_"..newstate.."_"..rot,
  423. param2 = node.param2})
  424. end
  425. end
  426. minetest.register_alias("railroad_paraphernalia:shunting_signal",
  427. "railroad_paraphernalia:shunting_signal_off_0")
  428. minetest.register_alias("railroad_paraphernalia:shunting_signal_act",
  429. "railroad_paraphernalia:shunting_signal_act_0")
  430. for _, rot in ipairs({"0","30","45","60"}) do
  431. for typ, prts in pairs({
  432. ["off"] = {tile = "blue", atlatc_state = "off", swapnode = "act", swapstate = "on", asp = { main = false, shunt = false}, ici = true},
  433. ["act"] = {tile = "white", atlatc_state = "on", swapnode = "off", swapstate = "off", asp = { main = false, shunt = true}}
  434. }) do
  435. local nodename = "railroad_paraphernalia:shunting_signal_"..typ.."_"..rot
  436. local swapnode = "railroad_paraphernalia:shunting_signal_"..prts.swapnode.."_"..rot
  437. minetest.register_node(nodename, {
  438. description = "Shunting signal",
  439. drawtype = "mesh",
  440. mesh = "shunting_signal_"..rot..".b3d",
  441. tiles = { "shunting_signal_"..prts.tile..".png" },
  442. selection_box = {
  443. type = "fixed",
  444. fixed = {{-0.33, -0.5, -0.33, 0.33, 0.4, 0.33}}
  445. },
  446. collisionbox = {-0.33, -0.5, -0.33, 0.33, 0.4, 0.33},
  447. groups = {
  448. snappy=1, choppy=2, oddly_breakable_by_hand=2, flammable=3,
  449. not_blocking_trains = 1,
  450. advtrains_signal = 2,
  451. save_in_at_nodedb = 1,
  452. not_in_creative_inventory = (rot == "0" and prts.ici == true) and 0 or 1,
  453. },
  454. on_place = minetest.rotate_node,
  455. paramtype = "light",
  456. paramtype2 = "facedir",
  457. light_source = 1,
  458. mesecons = {
  459. effector = {
  460. rules = mesecon.rules.shunting_signal,
  461. action_on = (typ == "off" and function(pos, node)
  462. advtrains.ndb.swap_node(pos, {name = swapnode, param2 = node.param2}, true)
  463. end) or nil,
  464. action_off = (typ == "act" and function (pos, node)
  465. advtrains.ndb.swap_node(pos, {name = swapnode, param2 = node.param2}, true)
  466. end) or nil,
  467. },
  468. },
  469. on_rightclick = function(pos,node,player,itemstack,pointed_thing)
  470. local pname = player:get_player_name()
  471. local sigd = advtrains.interlocking and advtrains.interlocking.db.get_sigd_for_signal(pos)
  472. if sigd then
  473. advtrains.interlocking.show_signalling_form(sigd, pname)
  474. elseif advtrains.interlocking and player:get_player_control().aux1 then
  475. advtrains.interlocking.show_ip_form(pos, pname)
  476. elseif advtrains.check_turnout_signal_protection(pos, player:get_player_name()) then
  477. advtrains.ndb.swap_node(pos, {name = swapnode, param2 = advtrains.ndb.get_node(pos).param2}, true)
  478. if advtrains.interlocking then
  479. advtrains.interlocking.signal_on_aspect_changed(pos)
  480. end
  481. end
  482. end,
  483. can_dig = advtrains.interlocking and advtrains.interlocking.signal_can_dig,
  484. advtrains = {
  485. set_aspect = gen_setaspect(rot),
  486. get_aspect = function(pos, node)
  487. return prts.asp
  488. end,
  489. supported_aspects = supported_aspects,
  490. getstate = prts.atlatc_state,
  491. setstate = function(pos, node, newstate)
  492. if newstate == prts.swapstate then
  493. advtrains.ndb.swap_node(pos, {name = swapnode, param2 = node.param2}, true)
  494. end
  495. end,
  496. },
  497. at_nnpref = "shunting_signal",
  498. at_suffix = typ,
  499. at_rotation = rot,
  500. drop = "railroad_paraphernalia:shunting_signal_off_0",
  501. })
  502. advtrains.trackplacer.add_worked("railroad_paraphernalia:shunting_signal", typ, "_" .. rot)
  503. end
  504. end
  505. minetest.register_craft({
  506. output = 'railroad_paraphernalia:shunting_signal',
  507. recipe = {
  508. {'', 'dye:white', ''},
  509. {'', 'dye:blue', ''},
  510. {'', 'default:stone', ''},
  511. }
  512. })
  513. -- MISC ---------------------
  514. minetest.register_node("railroad_paraphernalia:limit_post", {
  515. description = "Delimiting post",
  516. drawtype = "mesh",
  517. mesh = "limit_post.b3d",
  518. tiles = { "limit_post.png" },
  519. selection_box = { type = "fixed",
  520. fixed = {{-0.33, -0.5, -0.33, 0.33, 0.4, 0.33}}
  521. },
  522. collisionbox = {-0.33, -0.5, -0.33, 0.33, 0.4, 0.33},
  523. groups = {
  524. snappy=1, choppy=2, oddly_breakable_by_hand=2, flammable=3,
  525. advtrains_signal = 1, save_in_at_nodedb = 1
  526. },
  527. on_place = minetest.rotate_node,
  528. paramtype = "light",
  529. paramtype2 = "facedir",
  530. sunlight_propagates = true,
  531. advtrains = {
  532. get_aspect = function(pos, node)
  533. return {main = false, shunt = false}
  534. end
  535. },
  536. on_rightclick = advtrains.interlocking and advtrains.interlocking.signal_rc_handler,
  537. can_dig = advtrains.interlocking and advtrains.interlocking.signal_can_dig,
  538. })
  539. minetest.register_craft({
  540. output = 'railroad_paraphernalia:limit_post',
  541. recipe = {
  542. {'', 'dye:black', ''},
  543. {'', 'dye:white', ''},
  544. {'', 'default:stone', ''},
  545. }
  546. })
  547. ----