2017-05-26 20:43:29 +02:00
|
|
|
-- Common rail registrations
|
|
|
|
|
|
|
|
local regular_rail_itemname = "default:rail"
|
|
|
|
if minetest.registered_nodes["carts:rail"] then
|
|
|
|
-- MTG Compatibility
|
|
|
|
regular_rail_itemname = "carts:rail"
|
|
|
|
end
|
|
|
|
|
|
|
|
boost_cart:register_rail(":"..regular_rail_itemname, {
|
2014-07-22 23:15:43 +02:00
|
|
|
description = "Rail",
|
2016-07-22 11:06:28 +02:00
|
|
|
tiles = {
|
2016-11-27 11:53:25 +01:00
|
|
|
"carts_rail_straight.png", "carts_rail_curved.png",
|
|
|
|
"carts_rail_t_junction.png", "carts_rail_crossing.png"
|
2016-07-22 11:06:28 +02:00
|
|
|
},
|
2016-11-22 20:32:17 +01:00
|
|
|
groups = boost_cart:get_rail_groups()
|
2014-08-04 19:06:02 +02:00
|
|
|
})
|
|
|
|
|
2016-11-27 11:53:25 +01:00
|
|
|
-- Moreores' copper rail
|
2014-11-08 11:06:12 +01:00
|
|
|
if minetest.get_modpath("moreores") then
|
|
|
|
minetest.register_alias("carts:copperrail", "moreores:copper_rail")
|
|
|
|
else
|
2015-06-05 20:00:53 +02:00
|
|
|
boost_cart:register_rail(":carts:copperrail", {
|
2014-11-08 11:06:12 +01:00
|
|
|
description = "Copper rail",
|
2016-07-22 11:06:28 +02:00
|
|
|
tiles = {
|
2016-11-27 11:53:25 +01:00
|
|
|
"carts_rail_straight_cp.png", "carts_rail_curved_cp.png",
|
2016-07-22 11:06:28 +02:00
|
|
|
"carts_rail_t_junction_cp.png", "carts_rail_crossing_cp.png"
|
|
|
|
},
|
2016-11-22 20:32:17 +01:00
|
|
|
groups = boost_cart:get_rail_groups()
|
2014-11-08 11:06:12 +01:00
|
|
|
})
|
2014-08-04 19:06:02 +02:00
|
|
|
|
2014-11-08 11:06:12 +01:00
|
|
|
minetest.register_craft({
|
|
|
|
output = "carts:copperrail 12",
|
|
|
|
recipe = {
|
2016-11-27 11:53:25 +01:00
|
|
|
{"default:copper_ingot", "", "default:copper_ingot"},
|
2014-11-08 11:06:12 +01:00
|
|
|
{"default:copper_ingot", "group:stick", "default:copper_ingot"},
|
2016-11-27 11:53:25 +01:00
|
|
|
{"default:copper_ingot", "", "default:copper_ingot"},
|
2014-11-08 11:06:12 +01:00
|
|
|
}
|
|
|
|
})
|
|
|
|
end
|
2014-08-04 19:06:02 +02:00
|
|
|
|
2016-11-27 11:53:25 +01:00
|
|
|
-- Power rail
|
2015-06-05 20:00:53 +02:00
|
|
|
boost_cart:register_rail(":carts:powerrail", {
|
2014-08-04 19:06:02 +02:00
|
|
|
description = "Powered rail",
|
2016-07-22 11:06:28 +02:00
|
|
|
tiles = {
|
2016-11-27 11:53:25 +01:00
|
|
|
"carts_rail_straight_pwr.png", "carts_rail_curved_pwr.png",
|
2016-07-22 11:06:28 +02:00
|
|
|
"carts_rail_t_junction_pwr.png", "carts_rail_crossing_pwr.png"
|
|
|
|
},
|
|
|
|
groups = boost_cart:get_rail_groups(),
|
2014-08-04 19:06:02 +02:00
|
|
|
after_place_node = function(pos, placer, itemstack)
|
|
|
|
if not mesecon then
|
|
|
|
minetest.get_meta(pos):set_string("cart_acceleration", "0.5")
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
mesecons = {
|
|
|
|
effector = {
|
|
|
|
action_on = function(pos, node)
|
2015-03-22 10:52:48 +01:00
|
|
|
boost_cart:boost_rail(pos, 0.5)
|
2014-08-04 19:06:02 +02:00
|
|
|
end,
|
|
|
|
action_off = function(pos, node)
|
|
|
|
minetest.get_meta(pos):set_string("cart_acceleration", "0")
|
|
|
|
end,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_craft({
|
|
|
|
output = "carts:powerrail 6",
|
|
|
|
recipe = {
|
|
|
|
{"default:steel_ingot", "default:mese_crystal_fragment", "default:steel_ingot"},
|
|
|
|
{"default:steel_ingot", "group:stick", "default:steel_ingot"},
|
|
|
|
{"default:steel_ingot", "default:mese_crystal_fragment", "default:steel_ingot"},
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
2016-11-27 11:53:25 +01:00
|
|
|
-- Brake rail
|
2015-06-05 20:00:53 +02:00
|
|
|
boost_cart:register_rail(":carts:brakerail", {
|
2014-08-04 19:06:02 +02:00
|
|
|
description = "Brake rail",
|
2016-07-22 11:06:28 +02:00
|
|
|
tiles = {
|
2016-11-27 11:53:25 +01:00
|
|
|
"carts_rail_straight_brk.png", "carts_rail_curved_brk.png",
|
2016-07-22 11:06:28 +02:00
|
|
|
"carts_rail_t_junction_brk.png", "carts_rail_crossing_brk.png"
|
|
|
|
},
|
|
|
|
groups = boost_cart:get_rail_groups(),
|
2014-08-04 19:06:02 +02:00
|
|
|
after_place_node = function(pos, placer, itemstack)
|
|
|
|
if not mesecon then
|
2016-07-22 11:06:28 +02:00
|
|
|
minetest.get_meta(pos):set_string("cart_acceleration", "-0.3")
|
2014-08-04 19:06:02 +02:00
|
|
|
end
|
|
|
|
end,
|
|
|
|
mesecons = {
|
|
|
|
effector = {
|
|
|
|
action_on = function(pos, node)
|
2016-07-22 11:06:28 +02:00
|
|
|
minetest.get_meta(pos):set_string("cart_acceleration", "-0.3")
|
2014-08-04 19:06:02 +02:00
|
|
|
end,
|
|
|
|
action_off = function(pos, node)
|
|
|
|
minetest.get_meta(pos):set_string("cart_acceleration", "0")
|
|
|
|
end,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_craft({
|
|
|
|
output = "carts:brakerail 6",
|
|
|
|
recipe = {
|
|
|
|
{"default:steel_ingot", "default:coal_lump", "default:steel_ingot"},
|
|
|
|
{"default:steel_ingot", "group:stick", "default:steel_ingot"},
|
|
|
|
{"default:steel_ingot", "default:coal_lump", "default:steel_ingot"},
|
|
|
|
}
|
2016-07-20 09:48:39 +02:00
|
|
|
})
|
|
|
|
|
2016-07-22 11:06:28 +02:00
|
|
|
boost_cart:register_rail("boost_cart:startstoprail", {
|
2016-07-20 09:48:39 +02:00
|
|
|
description = "Start-stop rail",
|
2016-07-22 11:06:28 +02:00
|
|
|
tiles = {
|
2016-11-27 11:53:25 +01:00
|
|
|
"carts_rail_straight_ss.png", "carts_rail_curved_ss.png",
|
2016-07-22 11:06:28 +02:00
|
|
|
"carts_rail_t_junction_ss.png", "carts_rail_crossing_ss.png"
|
|
|
|
},
|
|
|
|
groups = boost_cart:get_rail_groups(),
|
2016-07-20 09:48:39 +02:00
|
|
|
after_place_node = function(pos, placer, itemstack)
|
|
|
|
if not mesecon then
|
|
|
|
minetest.get_meta(pos):set_string("cart_acceleration", "halt")
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
mesecons = {
|
|
|
|
effector = {
|
|
|
|
action_on = function(pos, node)
|
|
|
|
boost_cart:boost_rail(pos, 0.5)
|
|
|
|
end,
|
|
|
|
action_off = function(pos, node)
|
|
|
|
minetest.get_meta(pos):set_string("cart_acceleration", "halt")
|
|
|
|
end,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_craft({
|
|
|
|
type = "shapeless",
|
|
|
|
output = "boost_cart:startstoprail 2",
|
|
|
|
recipe = {"carts:powerrail", "carts:brakerail"},
|
|
|
|
})
|