Use `carts` mod functions to register copper rails

This makes them behave similarly to default rails.
This commit is contained in:
Hugo Locurcio 2019-05-22 11:30:48 +02:00
parent 564cb11ba6
commit d0a1798b0b
No known key found for this signature in database
GPG Key ID: 39E8F8BE30B0A49C
3 changed files with 17 additions and 39 deletions

View File

@ -14,6 +14,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
### Changed
- The minimum supported Minetest version is now 5.0.0.
- Copper rails are now registered using functions from the `carts` mod,
making them interoperate seamlessly with default rails.
- Copper rails can no longer be placed in the air.
## [1.1.0] - 2019-03-23

View File

@ -329,45 +329,20 @@ else
end
-- Copper rail (unique node)
minetest.register_node("moreores:copper_rail", {
description = S("Copper Rail"),
drawtype = "raillike",
tiles = {
"moreores_copper_rail.png",
"moreores_copper_rail_curved.png",
"moreores_copper_rail_t_junction.png",
"moreores_copper_rail_crossing.png",
},
inventory_image = "moreores_copper_rail.png",
wield_image = "moreores_copper_rail.png",
paramtype = "light",
sunlight_propagates = true,
walkable = false,
selection_box = {
type = "fixed",
fixed = {
-1/2,
-1/2,
-1/2,
1/2,
-1/2 + 1/16,
1/2,
if minetest.get_modpath("carts") then
carts:register_rail("moreores:copper_rail", {
description = S("Copper Rail"),
tiles = {
"moreores_copper_rail.png",
"moreores_copper_rail_curved.png",
"moreores_copper_rail_t_junction.png",
"moreores_copper_rail_crossing.png",
},
},
sounds = default_metal_sounds,
groups = {bendy = 2, snappy = 1, dig_immediate = 2, rail = 1, connect_to_raillike = 1},
mesecons = {
effector = {
action_on = function(pos, node)
minetest.get_meta(pos):set_string("cart_acceleration", "0.5")
end,
action_off = function(pos, node)
minetest.get_meta(pos):set_string("cart_acceleration", "0")
end,
},
},
})
inventory_image = "moreores_copper_rail.png",
wield_image = "moreores_copper_rail.png",
groups = carts:get_rail_groups(),
}, {})
end
minetest.register_craft({
output = "moreores:copper_rail 24",

View File

@ -1,4 +1,4 @@
name = moreores
description = Adds new ore types.
depends = default
optional_depends = farming,intllib,mg
optional_depends = carts,farming,intllib,mg