Move rail to boost_cart
[minetest_hades/hades_revisited.git] / mods / boost_cart / rails.lua
blob5becf3a37009571309dbfa8565b3881df62035b1
1 local raillike_group = minetest.raillike_group("rail")
3 minetest.register_node(":carts:rail", {
4 description = "Steel Rail",
5 drawtype = "raillike",
6 tiles = {"default_rail.png", "default_rail_curved.png", "default_rail_t_junction.png", "default_rail_crossing.png"},
7 inventory_image = "default_rail.png",
8 wield_image = "default_rail.png",
9 paramtype = "light",
10 sunlight_propagates = true,
11 is_ground_content = true,
12 walkable = false,
13 selection_box = {
14 type = "fixed",
15 fixed = {-1/2, -1/2, -1/2, 1/2, -1/2+1/16, 1/2},
17 groups = {dig_immediate = 2, attached_node = 1, rail = 1, connect_to_raillike = raillike_group},
18 sounds = hades_sounds.node_sound_metal_defaults(),
21 minetest.register_craft({
22 output = 'carts:rail 18',
23 recipe = {
24 {'hades_core:steel_ingot', '', 'hades_core:steel_ingot'},
25 {'hades_core:steel_ingot', 'group:stick', 'hades_core:steel_ingot'},
26 {'hades_core:steel_ingot', '', 'hades_core:steel_ingot'},
30 -- Copper rail
31 minetest.register_node(":carts:copperrail", {
32 description = "Bronze Rail",
33 drawtype = "raillike",
34 tiles = {"carts_rail_cp.png", "carts_rail_curved_cp.png", "carts_rail_t_junction_cp.png", "carts_rail_crossing_cp.png"},
35 inventory_image = "carts_rail_cp.png",
36 wield_image = "carts_rail_cp.png",
37 paramtype = "light",
38 is_ground_content = true,
39 walkable = false,
40 selection_box = {
41 type = "fixed",
42 -- but how to specify the dimensions for curved and sideways rails?
43 fixed = {-1/2, -1/2, -1/2, 1/2, -1/2+1/16, 1/2},
45 groups = {dig_immediate = 2, attached_node = 1, rail = 1, connect_to_raillike = raillike_group},
46 sounds = hades_sounds.node_sound_metal_defaults(),
49 minetest.register_craft({
50 output = "carts:copperrail 12",
51 recipe = {
52 {"hades_core:bronze_ingot", "group:stick", "hades_core:bronze_ingot"},
53 {"hades_core:bronze_ingot", "group:stick", "hades_core:bronze_ingot"},
54 {"hades_core:bronze_ingot", "group:stick", "hades_core:bronze_ingot"},
58 -- Speed up
60 minetest.register_node(":carts:powerrail", {
61 description = "Powered Rail",
62 drawtype = "raillike",
63 tiles = {"carts_rail_pwr.png", "carts_rail_curved_pwr.png", "carts_rail_t_junction_pwr.png", "carts_rail_crossing_pwr.png"},
64 inventory_image = "carts_rail_pwr.png",
65 wield_image = "carts_rail_pwr.png",
66 paramtype = "light",
67 is_ground_content = true,
68 walkable = false,
69 selection_box = {
70 type = "fixed",
71 -- but how to specify the dimensions for curved and sideways rails?
72 fixed = {-1/2, -1/2, -1/2, 1/2, -1/2+1/16, 1/2},
74 groups = {dig_immediate = 2, attached_node = 1, rail = 1, connect_to_raillike = raillike_group},
76 after_place_node = function(pos, placer, itemstack)
77 if not mesecon then
78 minetest.get_meta(pos):set_string("cart_acceleration", "0.5")
79 end
80 end,
82 mesecons = {
83 effector = {
84 action_on = function(pos, node)
85 minetest.get_meta(pos):set_string("cart_acceleration", "0.5")
86 end,
88 action_off = function(pos, node)
89 minetest.get_meta(pos):set_string("cart_acceleration", "0")
90 end,
93 sounds = hades_sounds.node_sound_metal_defaults(),
96 minetest.register_craft({
97 output = "carts:powerrail 6",
98 recipe = {
99 {"hades_core:steel_ingot", "hades_core:mese_crystal_fragment", "hades_core:steel_ingot"},
100 {"hades_core:steel_ingot", "group:stick", "hades_core:steel_ingot"},
101 {"hades_core:steel_ingot", "hades_core:mese_crystal_fragment", "hades_core:steel_ingot"},
105 minetest.register_node(":carts:brakerail", {
106 description = "Brake Rail",
107 drawtype = "raillike",
108 tiles = {"carts_rail_brk.png", "carts_rail_curved_brk.png", "carts_rail_t_junction_brk.png", "carts_rail_crossing_brk.png"},
109 inventory_image = "carts_rail_brk.png",
110 wield_image = "carts_rail_brk.png",
111 paramtype = "light",
112 is_ground_content = true,
113 walkable = false,
114 selection_box = {
115 type = "fixed",
116 -- but how to specify the dimensions for curved and sideways rails?
117 fixed = {-1/2, -1/2, -1/2, 1/2, -1/2+1/16, 1/2},
119 groups = {dig_immediate = 2, attached_node = 1, rail = 1, connect_to_raillike = raillike_group},
121 after_place_node = function(pos, placer, itemstack)
122 if not mesecon then
123 minetest.get_meta(pos):set_string("cart_acceleration", "-0.2")
125 end,
127 mesecons = {
128 effector = {
129 action_on = function(pos, node)
130 minetest.get_meta(pos):set_string("cart_acceleration", "-0.2")
131 end,
133 action_off = function(pos, node)
134 minetest.get_meta(pos):set_string("cart_acceleration", "0")
135 end,
138 sounds = hades_sounds.node_sound_metal_defaults(),
141 minetest.register_craft({
142 output = "carts:brakerail 6",
143 recipe = {
144 {"hades_core:steel_ingot", "hades_core:coal_lump", "hades_core:steel_ingot"},
145 {"hades_core:steel_ingot", "group:stick", "hades_core:steel_ingot"},
146 {"hades_core:steel_ingot", "hades_core:coal_lump", "hades_core:steel_ingot"},