summaryrefslogtreecommitdiff
path: root/boost_cart
diff options
context:
space:
mode:
authorVanessa Ezekowitz <vanessaezekowitz@gmail.com>2017-08-12 20:37:50 -0400
committerVanessa Ezekowitz <vanessaezekowitz@gmail.com>2017-08-12 20:37:50 -0400
commit4aab7d0dbd782cf6741bdbba94440faf0c5c2e61 (patch)
treef5a13374fb176c21e381a2ae6ab53ac2ff282057 /boost_cart
parent047a770ad04fc264039fa5b6109c803bd3d2d258 (diff)
downloaddreambuilder_modpack-4aab7d0dbd782cf6741bdbba94440faf0c5c2e61.tar
dreambuilder_modpack-4aab7d0dbd782cf6741bdbba94440faf0c5c2e61.tar.gz
dreambuilder_modpack-4aab7d0dbd782cf6741bdbba94440faf0c5c2e61.tar.bz2
dreambuilder_modpack-4aab7d0dbd782cf6741bdbba94440faf0c5c2e61.tar.xz
dreambuilder_modpack-4aab7d0dbd782cf6741bdbba94440faf0c5c2e61.zip
updated several mods
biome_lib, boost cart, homedecor modpack, plantlife modpack, cottages, currency, farming redo, gloopblocks, ilights, moreores, moretrees, pipeworks, plasticbox, replacer, signs_lib, streets, travelnet, unified dyes, and vines, and maybe one or two others that I didn't see in the list. :-) I fixed the misc_overrides component (it broke when I switched over to farming redo a while back), and also I've added the classic peaceful_npc mod back into the modpack, since it seems to work now. Be sure when you run a world for the first time after this update, that you "Configure" the world, *disable* all of Dreambuilder Modpack, then re-enable the whole thing. If you don't, a few mods will fail to load due to recent changes in their dependencies.
Diffstat (limited to 'boost_cart')
-rw-r--r--boost_cart/cart_entity.lua5
-rw-r--r--boost_cart/functions.lua26
2 files changed, 23 insertions, 8 deletions
diff --git a/boost_cart/cart_entity.lua b/boost_cart/cart_entity.lua
index 4147c09..257aae6 100644
--- a/boost_cart/cart_entity.lua
+++ b/boost_cart/cart_entity.lua
@@ -83,7 +83,8 @@ end
function cart_entity:on_punch(puncher, time_from_last_punch, tool_capabilities, direction)
local pos = self.object:getpos()
- if not self.railtype then
+ local vel = self.object:getvelocity()
+ if not self.railtype or vector.equals(vel, {x=0, y=0, z=0}) then
local node = minetest.get_node(pos).name
self.railtype = minetest.get_item_group(node, "connect_to_raillike")
end
@@ -122,7 +123,7 @@ function cart_entity:on_punch(puncher, time_from_last_punch, tool_capabilities,
return
end
- local vel = self.object:getvelocity()
+ -- Driver punches to accelerate the cart
if puncher:get_player_name() == self.driver then
if math.abs(vel.x + vel.z) > boost_cart.punch_speed_max then
return
diff --git a/boost_cart/functions.lua b/boost_cart/functions.lua
index 9876eb2..1332578 100644
--- a/boost_cart/functions.lua
+++ b/boost_cart/functions.lua
@@ -159,23 +159,29 @@ function boost_cart:get_rail_direction(pos_, dir, ctrl, old_switch, railtype)
end
function boost_cart:pathfinder(pos_, old_pos, old_dir, ctrl, pf_switch, railtype)
+ if vector.equals(old_pos, pos_) then
+ return true
+ end
+
local pos = vector.round(pos_)
local pf_pos = vector.round(old_pos)
local pf_dir = vector.new(old_dir)
for i = 1, 3 do
- if vector.equals(pf_pos, pos) then
- -- Success! Cart moved on correctly
- return true
- end
+ pf_dir, pf_switch = boost_cart:get_rail_direction(
+ pf_pos, pf_dir, ctrl, pf_switch, railtype)
- pf_dir, pf_switch = boost_cart:get_rail_direction(pf_pos, pf_dir, ctrl, pf_switch, railtype)
if vector.equals(pf_dir, {x=0, y=0, z=0}) then
-- No way forwards
return false
end
pf_pos = vector.add(pf_pos, pf_dir)
+
+ if vector.equals(pf_pos, pos) then
+ -- Success! Cart moved on correctly
+ return true
+ end
end
-- Cart not found
return false
@@ -217,7 +223,15 @@ 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}
+ local groups = {
+ dig_immediate = 2,
+ attached_node = 1,
+ rail = 1,
+ connect_to_raillike = 1
+ }
+ if minetest.raillike_group then
+ groups.connect_to_raillike = minetest.raillike_group("rail")
+ end
if type(additional_groups) == "table" then
for k, v in pairs(additional_groups) do
groups[k] = v