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:
SmallJoker
2016-07-22 11:06:28 +02:00
parent d166b7ea68
commit eb6a833b66
4 changed files with 79 additions and 45 deletions

View File

@ -213,3 +213,14 @@ function boost_cart:register_rail(name, def)
minetest.register_node(name, def)
end
function boost_cart:get_rail_groups(additional_groups)
-- Get the default rail groups and add more when a table is given
local groups = {dig_immediate = 2, attached_node = 1, rail = 1, connect_to_raillike = 1}
if type(additional_groups) == "table" then
for k, v in pairs(additional_groups) do
groups[k] = v
end
end
return groups
end