mirror of
https://github.com/SmallJoker/boost_cart.git
synced 2025-06-30 15:30:21 +02:00
Break too long lines and simplify the code
- Add boost_cart:get_rail_groups to get the default rail groups - Remove duplicated code - Do not boost the cart backwards when the brake rail gets activated - Attempt to fix the cart swing problem - Trim tailings and tidy up code - TODO: Document all the stuff
This commit is contained in:
22
detector.lua
22
detector.lua
@ -15,7 +15,7 @@ function boost_cart:signal_detector_rail(pos)
|
||||
if minetest.get_item_group(node.name, "detector_rail") ~= 1 then
|
||||
return
|
||||
end
|
||||
--minetest.log("action", "Signaling detector at " .. minetest.pos_to_string(pos))
|
||||
|
||||
if node.name == "boost_cart:detectorrail" then
|
||||
minetest.swap_node(pos, {name = "boost_cart:detectorrail_on", param2=node.param2})
|
||||
end
|
||||
@ -25,19 +25,27 @@ end
|
||||
|
||||
boost_cart:register_rail("boost_cart:detectorrail", {
|
||||
description = "Detector rail",
|
||||
tiles = {"carts_rail_dtc.png", "carts_rail_curved_dtc.png", "carts_rail_t_junction_dtc.png", "carts_rail_crossing_dtc.png"},
|
||||
groups = {dig_immediate = 2, attached_node = 1, rail = 1, connect_to_raillike = 1, detector_rail = 1},
|
||||
tiles = {
|
||||
"carts_rail_dtc.png", "carts_rail_curved_dtc.png",
|
||||
"carts_rail_t_junction_dtc.png", "carts_rail_crossing_dtc.png"
|
||||
},
|
||||
groups = boost_cart:get_rail_groups({detector_rail = 1}),
|
||||
|
||||
mesecons = {receptor = {state = "off", rules = mesecons_rules }},
|
||||
mesecons = {receptor = {state = "off", rules = mesecons_rules}},
|
||||
})
|
||||
|
||||
boost_cart:register_rail("boost_cart:detectorrail_on", {
|
||||
description = "Detector rail ON (you hacker you)",
|
||||
tiles = {"carts_rail_dtc_on.png", "carts_rail_curved_dtc_on.png", "carts_rail_t_junction_dtc_on.png", "carts_rail_crossing_dtc_on.png"},
|
||||
groups = {dig_immediate = 2, attached_node = 1, rail = 1, connect_to_raillike = 1, detector_rail = 1, not_in_creative_inventory = 1},
|
||||
tiles = {
|
||||
"carts_rail_dtc_on.png", "carts_rail_curved_dtc_on.png",
|
||||
"carts_rail_t_junction_dtc_on.png", "carts_rail_crossing_dtc_on.png"
|
||||
},
|
||||
groups = boost_cart:get_rail_groups({
|
||||
detector_rail = 1, not_in_creative_inventory = 1
|
||||
}),
|
||||
drop = "boost_cart:detectorrail",
|
||||
|
||||
mesecons = {receptor = {state = "on", rules = mesecons_rules }},
|
||||
mesecons = {receptor = {state = "on", rules = mesecons_rules}},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
|
Reference in New Issue
Block a user