2016-08-08 15:01:43 +02:00
|
|
|
minetest.register_node(":default:rail", {
|
2016-07-28 17:28:08 +02:00
|
|
|
description = "Rail",
|
|
|
|
drawtype = "raillike",
|
2016-08-08 15:01:43 +02:00
|
|
|
tiles = {
|
|
|
|
"default_rail.png", "default_rail_curved.png",
|
|
|
|
"default_rail_t_junction.png", "default_rail_crossing.png"
|
|
|
|
},
|
2016-07-28 17:28:08 +02:00
|
|
|
inventory_image = "default_rail.png",
|
|
|
|
wield_image = "default_rail.png",
|
|
|
|
paramtype = "light",
|
|
|
|
sunlight_propagates = true,
|
|
|
|
is_ground_content = true,
|
|
|
|
walkable = false,
|
|
|
|
selection_box = {
|
|
|
|
type = "fixed",
|
|
|
|
fixed = {-1/2, -1/2, -1/2, 1/2, -1/2+1/16, 1/2},
|
|
|
|
},
|
2016-08-08 15:01:43 +02:00
|
|
|
groups = carts:get_rail_groups(),
|
2016-07-28 17:28:08 +02:00
|
|
|
})
|
|
|
|
|
|
|
|
|
2016-08-08 15:01:43 +02:00
|
|
|
-- Copper rail
|
2016-07-28 17:28:08 +02:00
|
|
|
|
2016-08-08 15:01:43 +02:00
|
|
|
if minetest.get_modpath("moreores") then
|
|
|
|
-- Moreores' copper rail
|
|
|
|
minetest.register_alias("carts:rail_copper", "moreores:copper_rail")
|
|
|
|
else
|
|
|
|
carts:register_rail(":carts:rail_copper", {
|
|
|
|
description = "Copper rail",
|
|
|
|
tiles = {
|
|
|
|
"carts_rail_cp.png", "carts_rail_curved_cp.png",
|
|
|
|
"carts_rail_t_junction_cp.png", "carts_rail_crossing_cp.png"
|
|
|
|
},
|
|
|
|
groups = carts:get_rail_groups(),
|
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_craft({
|
|
|
|
output = "carts:rail_copper 16",
|
|
|
|
recipe = {
|
|
|
|
{"default:copper_ingot", "group:stick", "default:copper_ingot"},
|
|
|
|
{"default:copper_ingot", "group:stick", "default:copper_ingot"},
|
|
|
|
{"default:copper_ingot", "group:stick", "default:copper_ingot"},
|
|
|
|
}
|
|
|
|
})
|
|
|
|
end
|
|
|
|
|
|
|
|
-- Speed up
|
|
|
|
|
|
|
|
-- Rail Power
|
|
|
|
|
|
|
|
carts:register_rail(":carts:rail_power", {
|
|
|
|
description = "Powered rail",
|
|
|
|
tiles = {
|
|
|
|
"carts_rail_pwr.png", "carts_rail_curved_pwr.png",
|
|
|
|
"carts_rail_t_junction_pwr.png", "carts_rail_crossing_pwr.png"
|
2016-07-28 17:28:08 +02:00
|
|
|
},
|
2016-08-08 15:01:43 +02:00
|
|
|
groups = carts:get_rail_groups(),
|
2016-07-28 17:28:08 +02:00
|
|
|
|
|
|
|
after_place_node = function(pos, placer, itemstack)
|
2016-08-08 15:01:43 +02:00
|
|
|
if not mesecon then
|
|
|
|
minetest.get_meta(pos):set_string("cart_acceleration", "1")
|
|
|
|
end
|
2016-07-28 17:28:08 +02:00
|
|
|
end,
|
|
|
|
|
2016-08-08 15:01:43 +02:00
|
|
|
mesecons = {
|
2016-07-28 17:28:08 +02:00
|
|
|
effector = {
|
2016-08-08 15:01:43 +02:00
|
|
|
action_on = function(pos, node)
|
|
|
|
carts:boost_rail(pos, 1)
|
2016-07-28 17:28:08 +02:00
|
|
|
end,
|
|
|
|
|
2016-08-08 15:01:43 +02:00
|
|
|
action_off = function(pos, node)
|
2016-07-28 17:28:08 +02:00
|
|
|
minetest.get_meta(pos):set_string("cart_acceleration", "0")
|
|
|
|
end,
|
|
|
|
},
|
|
|
|
},
|
2016-08-08 15:01:43 +02:00
|
|
|
})
|
2016-07-28 17:28:08 +02:00
|
|
|
|
2016-08-08 15:01:43 +02:00
|
|
|
minetest.register_craft({
|
|
|
|
type = "shapeless",
|
|
|
|
output = "carts:rail_power",
|
|
|
|
recipe = {"group:rail", "default:mese_crystal_fragment"},
|
2016-07-28 17:28:08 +02:00
|
|
|
})
|
|
|
|
|
2016-08-08 15:01:43 +02:00
|
|
|
|
|
|
|
-- Rail Brake
|
|
|
|
|
|
|
|
carts:register_rail(":carts:rail_brake", {
|
|
|
|
description = "Brake rail",
|
|
|
|
tiles = {
|
|
|
|
"carts_rail_brk.png", "carts_rail_curved_brk.png",
|
|
|
|
"carts_rail_t_junction_brk.png", "carts_rail_crossing_brk.png"
|
2016-07-28 17:28:08 +02:00
|
|
|
},
|
2016-08-08 15:01:43 +02:00
|
|
|
groups = carts:get_rail_groups(),
|
2016-07-28 17:28:08 +02:00
|
|
|
|
|
|
|
after_place_node = function(pos, placer, itemstack)
|
2016-08-08 15:01:43 +02:00
|
|
|
if not mesecon then
|
|
|
|
minetest.get_meta(pos):set_string("cart_acceleration", "-1")
|
|
|
|
end
|
2016-07-28 17:28:08 +02:00
|
|
|
end,
|
|
|
|
|
2016-08-08 15:01:43 +02:00
|
|
|
mesecons = {
|
2016-07-28 17:28:08 +02:00
|
|
|
effector = {
|
2016-08-08 15:01:43 +02:00
|
|
|
action_on = function(pos, node)
|
|
|
|
minetest.get_meta(pos):set_string("cart_acceleration", "-1")
|
2016-07-28 17:28:08 +02:00
|
|
|
end,
|
|
|
|
|
2016-08-08 15:01:43 +02:00
|
|
|
action_off = function(pos, node)
|
2016-07-28 17:28:08 +02:00
|
|
|
minetest.get_meta(pos):set_string("cart_acceleration", "0")
|
|
|
|
end,
|
|
|
|
},
|
2016-08-08 15:01:43 +02:00
|
|
|
},
|
2016-07-28 17:28:08 +02:00
|
|
|
})
|
|
|
|
|
2016-08-08 15:01:43 +02:00
|
|
|
minetest.register_craft({
|
|
|
|
type = "shapeless",
|
|
|
|
output = "carts:rail_brake",
|
|
|
|
recipe = {"group:rail", "default:coal_lump"},
|
|
|
|
})
|
|
|
|
|
|
|
|
-- Start stop rail (temporary removed for mff)
|
|
|
|
|
|
|
|
--[[carts:register_rail("carts:startstoprail", {
|
|
|
|
description = "Start-stop rail",
|
|
|
|
tiles = {
|
|
|
|
"carts_rail_ss.png", "carts_rail_curved_ss.png",
|
|
|
|
"carts_rail_t_junction_ss.png", "carts_rail_crossing_ss.png"
|
2016-07-28 17:28:08 +02:00
|
|
|
},
|
2016-08-08 15:01:43 +02:00
|
|
|
groups = carts:get_rail_groups(),
|
2016-07-28 17:28:08 +02:00
|
|
|
|
|
|
|
after_place_node = function(pos, placer, itemstack)
|
2016-08-08 15:01:43 +02:00
|
|
|
if not mesecon then
|
|
|
|
minetest.get_meta(pos):set_string("cart_acceleration", "halt")
|
|
|
|
end
|
2016-07-28 17:28:08 +02:00
|
|
|
end,
|
|
|
|
|
2016-08-08 15:01:43 +02:00
|
|
|
mesecons = {
|
|
|
|
effector = {
|
|
|
|
action_on = function(pos, node)
|
|
|
|
carts:boost_rail(pos, 0.5)
|
|
|
|
end,
|
2016-07-28 17:28:08 +02:00
|
|
|
|
2016-08-08 15:01:43 +02:00
|
|
|
action_off = function(pos, node)
|
|
|
|
minetest.get_meta(pos):set_string("cart_acceleration", "halt")
|
|
|
|
end,
|
|
|
|
},
|
|
|
|
},
|
2016-07-28 17:28:08 +02:00
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_craft({
|
|
|
|
type = "shapeless",
|
2016-08-08 15:01:43 +02:00
|
|
|
output = "carts:startstoprail 2",
|
|
|
|
recipe = {"carts:powerrail", "carts:brakerail"},
|
|
|
|
})--]]
|
2016-07-28 17:28:08 +02:00
|
|
|
|
2016-08-08 15:01:43 +02:00
|
|
|
--Alias
|
2016-07-28 17:28:08 +02:00
|
|
|
|
|
|
|
minetest.register_alias("carts:powerrail", "carts:rail_power")
|
|
|
|
minetest.register_alias("carts:power_rail", "carts:rail_power")
|
|
|
|
minetest.register_alias("carts:brakerail", "carts:rail_brake")
|
2016-08-08 15:01:43 +02:00
|
|
|
minetest.register_alias("carts:brake_rail", "carts:rail_brake")
|