Make node references absolute. Accomodate different top directory name.
This commit is contained in:
parent
29308079d8
commit
af62f41ce1
16
detector.lua
16
detector.lua
|
@ -3,8 +3,8 @@ local mesecons_rules = mesecon.rules.flat
|
||||||
function boost_cart:turnoff_detector_rail(pos)
|
function boost_cart:turnoff_detector_rail(pos)
|
||||||
local node = minetest.get_node(pos)
|
local node = minetest.get_node(pos)
|
||||||
if minetest.get_item_group(node.name, "detector_rail") == 1 then
|
if minetest.get_item_group(node.name, "detector_rail") == 1 then
|
||||||
if node.name == "boost_cart:detectorrail_on" then --has not been dug
|
if node.name == ":boost_cart:detectorrail_on" then --has not been dug
|
||||||
minetest.swap_node(pos, {name = "boost_cart:detectorrail", param2=node.param2})
|
minetest.swap_node(pos, {name = ":boost_cart:detectorrail", param2=node.param2})
|
||||||
end
|
end
|
||||||
mesecon.receptor_off(pos, mesecons_rules)
|
mesecon.receptor_off(pos, mesecons_rules)
|
||||||
end
|
end
|
||||||
|
@ -16,14 +16,14 @@ function boost_cart:signal_detector_rail(pos)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if node.name == "boost_cart:detectorrail" then
|
if node.name == ":boost_cart:detectorrail" then
|
||||||
minetest.swap_node(pos, {name = "boost_cart:detectorrail_on", param2=node.param2})
|
minetest.swap_node(pos, {name = ":boost_cart:detectorrail_on", param2=node.param2})
|
||||||
end
|
end
|
||||||
mesecon.receptor_on(pos, mesecons_rules)
|
mesecon.receptor_on(pos, mesecons_rules)
|
||||||
minetest.after(0.5, boost_cart.turnoff_detector_rail, boost_cart, pos)
|
minetest.after(0.5, boost_cart.turnoff_detector_rail, boost_cart, pos)
|
||||||
end
|
end
|
||||||
|
|
||||||
boost_cart:register_rail("boost_cart:detectorrail", {
|
boost_cart:register_rail(":boost_cart:detectorrail", {
|
||||||
description = "Detector rail",
|
description = "Detector rail",
|
||||||
tiles = {
|
tiles = {
|
||||||
"carts_rail_straight_dtc.png", "carts_rail_curved_dtc.png",
|
"carts_rail_straight_dtc.png", "carts_rail_curved_dtc.png",
|
||||||
|
@ -34,7 +34,7 @@ boost_cart:register_rail("boost_cart:detectorrail", {
|
||||||
mesecons = {receptor = {state = "off", rules = mesecons_rules}},
|
mesecons = {receptor = {state = "off", rules = mesecons_rules}},
|
||||||
})
|
})
|
||||||
|
|
||||||
boost_cart:register_rail("boost_cart:detectorrail_on", {
|
boost_cart:register_rail(":boost_cart:detectorrail_on", {
|
||||||
description = "Detector rail ON (you hacker you)",
|
description = "Detector rail ON (you hacker you)",
|
||||||
tiles = {
|
tiles = {
|
||||||
"carts_rail_straight_dtc_on.png", "carts_rail_curved_dtc_on.png",
|
"carts_rail_straight_dtc_on.png", "carts_rail_curved_dtc_on.png",
|
||||||
|
@ -43,13 +43,13 @@ boost_cart:register_rail("boost_cart:detectorrail_on", {
|
||||||
groups = boost_cart:get_rail_groups({
|
groups = boost_cart:get_rail_groups({
|
||||||
detector_rail = 1, not_in_creative_inventory = 1
|
detector_rail = 1, not_in_creative_inventory = 1
|
||||||
}),
|
}),
|
||||||
drop = "boost_cart:detectorrail",
|
drop = ":boost_cart:detectorrail",
|
||||||
|
|
||||||
mesecons = {receptor = {state = "on", rules = mesecons_rules}},
|
mesecons = {receptor = {state = "on", rules = mesecons_rules}},
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "boost_cart:detectorrail 6",
|
output = ":boost_cart:detectorrail 6",
|
||||||
recipe = {
|
recipe = {
|
||||||
{"default:steel_ingot", "mesecons:wire_00000000_off", "default:steel_ingot"},
|
{"default:steel_ingot", "mesecons:wire_00000000_off", "default:steel_ingot"},
|
||||||
{"default:steel_ingot", "group:stick", "default:steel_ingot"},
|
{"default:steel_ingot", "group:stick", "default:steel_ingot"},
|
||||||
|
|
12
init.lua
12
init.lua
|
@ -1,16 +1,14 @@
|
||||||
|
modDirectory = "boostcart"
|
||||||
boost_cart = {}
|
boost_cart = {}
|
||||||
boost_cart.modpath = minetest.get_modpath("boost_cart")
|
boost_cart.modpath = minetest.get_modpath(modDirectory)
|
||||||
|
|
||||||
-- Maximal speed of the cart in m/s
|
-- Maximal speed of the cart in m/s
|
||||||
boost_cart.speed_max = 10
|
boost_cart.speed_max = 10
|
||||||
-- Set to -1 to disable punching the cart from inside
|
-- Set to -1 to disable punching the cart from inside
|
||||||
boost_cart.punch_speed_max = 7
|
boost_cart.punch_speed_max = 7
|
||||||
|
|
||||||
|
|
||||||
if not boost_cart.modpath then
|
if not boost_cart.modpath then
|
||||||
error("\nWrong mod directory name! Please change it to 'boost_cart'.\n" ..
|
error("\nWrong mod directory name! Please change it to '" ..modDirectory.. "'.\nSee also: http://dev.minetest.net/Installing_Mods")
|
||||||
"See also: http://dev.minetest.net/Installing_Mods")
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Support for non-default games
|
-- Support for non-default games
|
||||||
|
@ -24,8 +22,8 @@ dofile(boost_cart.modpath.."/rails.lua")
|
||||||
if minetest.global_exists("mesecon") then
|
if minetest.global_exists("mesecon") then
|
||||||
dofile(boost_cart.modpath.."/detector.lua")
|
dofile(boost_cart.modpath.."/detector.lua")
|
||||||
--else
|
--else
|
||||||
-- minetest.register_alias("carts:powerrail", "boost_cart:detectorrail")
|
-- minetest.register_alias("carts:powerrail", ":boost_cart:detectorrail")
|
||||||
-- minetest.register_alias("carts:powerrail", "boost_cart:detectorrail_on")
|
-- minetest.register_alias("carts:powerrail", ":boost_cart:detectorrail_on")
|
||||||
end
|
end
|
||||||
|
|
||||||
boost_cart.mtg_compat = minetest.global_exists("carts") and carts.pathfinder
|
boost_cart.mtg_compat = minetest.global_exists("carts") and carts.pathfinder
|
||||||
|
|
|
@ -106,7 +106,7 @@ minetest.register_craft({
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
boost_cart:register_rail("boost_cart:startstoprail", {
|
boost_cart:register_rail(":boost_cart:startstoprail", {
|
||||||
description = "Start-stop rail",
|
description = "Start-stop rail",
|
||||||
tiles = {
|
tiles = {
|
||||||
"carts_rail_straight_ss.png", "carts_rail_curved_ss.png",
|
"carts_rail_straight_ss.png", "carts_rail_curved_ss.png",
|
||||||
|
@ -132,6 +132,6 @@ boost_cart:register_rail("boost_cart:startstoprail", {
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
type = "shapeless",
|
type = "shapeless",
|
||||||
output = "boost_cart:startstoprail 2",
|
output = ":boost_cart:startstoprail 2",
|
||||||
recipe = {"carts:powerrail", "carts:brakerail"},
|
recipe = {"carts:powerrail", "carts:brakerail"},
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue