Make many nodes floodable
[minetest_hades/hades_revisited.git] / mods / boost_cart / rails.lua
bloba43859f26f9892e4cccb72cb87efc779561591d8
1 local raillike_group = minetest.raillike_group("rail")
3 local S = minetest.get_translator("boost_cart")
5 minetest.register_node(":carts:rail", {
6 description = S("Steel Rail"),
7 _tt_help = S("Track for cart"),
8 drawtype = "raillike",
9 tiles = {"default_rail.png", "default_rail_curved.png", "default_rail_t_junction.png", "default_rail_crossing.png"},
10 inventory_image = "default_rail.png",
11 wield_image = "default_rail.png",
12 paramtype = "light",
13 sunlight_propagates = true,
14 is_ground_content = true,
15 walkable = false,
16 floodable = true,
17 selection_box = {
18 type = "fixed",
19 fixed = {-1/2, -1/2, -1/2, 1/2, -1/2+1/16, 1/2},
21 groups = {dig_immediate = 2, attached_node = 1, rail = 1, connect_to_raillike = raillike_group},
22 sounds = hades_sounds.node_sound_metal_defaults(),
25 minetest.register_craft({
26 output = 'carts:rail 18',
27 recipe = {
28 {'hades_core:steel_ingot', '', 'hades_core:steel_ingot'},
29 {'hades_core:steel_ingot', 'group:stick', 'hades_core:steel_ingot'},
30 {'hades_core:steel_ingot', '', 'hades_core:steel_ingot'},
34 -- Copper rail
35 minetest.register_node(":carts:copperrail", {
36 description = S("Bronze Rail"),
37 _tt_help = S("Track for cart"),
38 drawtype = "raillike",
39 tiles = {"carts_rail_cp.png", "carts_rail_curved_cp.png", "carts_rail_t_junction_cp.png", "carts_rail_crossing_cp.png"},
40 inventory_image = "carts_rail_cp.png",
41 wield_image = "carts_rail_cp.png",
42 paramtype = "light",
43 is_ground_content = true,
44 walkable = false,
45 floodable = true,
46 selection_box = {
47 type = "fixed",
48 -- but how to specify the dimensions for curved and sideways rails?
49 fixed = {-1/2, -1/2, -1/2, 1/2, -1/2+1/16, 1/2},
51 groups = {dig_immediate = 2, attached_node = 1, rail = 1, connect_to_raillike = raillike_group},
52 sounds = hades_sounds.node_sound_metal_defaults(),
55 minetest.register_craft({
56 output = "carts:copperrail 12",
57 recipe = {
58 {"hades_core:bronze_ingot", "group:stick", "hades_core:bronze_ingot"},
59 {"hades_core:bronze_ingot", "group:stick", "hades_core:bronze_ingot"},
60 {"hades_core:bronze_ingot", "group:stick", "hades_core:bronze_ingot"},
64 -- Speed up
66 minetest.register_node(":carts:powerrail", {
67 description = S("Powered Rail"),
68 _tt_help = S("Track for cart, accelerates"),
69 drawtype = "raillike",
70 tiles = {"carts_rail_pwr.png", "carts_rail_curved_pwr.png", "carts_rail_t_junction_pwr.png", "carts_rail_crossing_pwr.png"},
71 inventory_image = "carts_rail_pwr.png",
72 wield_image = "carts_rail_pwr.png",
73 paramtype = "light",
74 is_ground_content = true,
75 walkable = false,
76 floodable = true,
77 selection_box = {
78 type = "fixed",
79 -- but how to specify the dimensions for curved and sideways rails?
80 fixed = {-1/2, -1/2, -1/2, 1/2, -1/2+1/16, 1/2},
82 groups = {dig_immediate = 2, attached_node = 1, rail = 1, connect_to_raillike = raillike_group},
84 after_place_node = function(pos, placer, itemstack)
85 if not mesecon then
86 minetest.get_meta(pos):set_string("cart_acceleration", "0.5")
87 end
88 end,
90 mesecons = {
91 effector = {
92 action_on = function(pos, node)
93 minetest.get_meta(pos):set_string("cart_acceleration", "0.5")
94 end,
96 action_off = function(pos, node)
97 minetest.get_meta(pos):set_string("cart_acceleration", "0")
98 end,
101 sounds = hades_sounds.node_sound_metal_defaults(),
104 minetest.register_craft({
105 output = "carts:powerrail 6",
106 recipe = {
107 {"hades_core:steel_ingot", "hades_core:mese_crystal_fragment", "hades_core:steel_ingot"},
108 {"hades_core:steel_ingot", "group:stick", "hades_core:steel_ingot"},
109 {"hades_core:steel_ingot", "hades_core:mese_crystal_fragment", "hades_core:steel_ingot"},
113 minetest.register_node(":carts:brakerail", {
114 description = S("Brake Rail"),
115 _tt_help = S("Track for cart, slows down"),
116 drawtype = "raillike",
117 tiles = {"carts_rail_brk.png", "carts_rail_curved_brk.png", "carts_rail_t_junction_brk.png", "carts_rail_crossing_brk.png"},
118 inventory_image = "carts_rail_brk.png",
119 wield_image = "carts_rail_brk.png",
120 paramtype = "light",
121 is_ground_content = true,
122 walkable = false,
123 floodable = true,
124 selection_box = {
125 type = "fixed",
126 -- but how to specify the dimensions for curved and sideways rails?
127 fixed = {-1/2, -1/2, -1/2, 1/2, -1/2+1/16, 1/2},
129 groups = {dig_immediate = 2, attached_node = 1, rail = 1, connect_to_raillike = raillike_group},
131 after_place_node = function(pos, placer, itemstack)
132 if not mesecon then
133 minetest.get_meta(pos):set_string("cart_acceleration", "-0.2")
135 end,
137 mesecons = {
138 effector = {
139 action_on = function(pos, node)
140 minetest.get_meta(pos):set_string("cart_acceleration", "-0.2")
141 end,
143 action_off = function(pos, node)
144 minetest.get_meta(pos):set_string("cart_acceleration", "0")
145 end,
148 sounds = hades_sounds.node_sound_metal_defaults(),
151 minetest.register_craft({
152 output = "carts:brakerail 6",
153 recipe = {
154 {"hades_core:steel_ingot", "hades_core:coal_lump", "hades_core:steel_ingot"},
155 {"hades_core:steel_ingot", "group:stick", "hades_core:steel_ingot"},
156 {"hades_core:steel_ingot", "hades_core:coal_lump", "hades_core:steel_ingot"},