1
0
mirror of https://github.com/SmallJoker/boost_cart.git synced 2024-12-25 02:10:19 +01:00

Fix edge case crash due nil old_pos, remove player_api warning

This commit is contained in:
SmallJoker 2018-01-15 18:41:40 +01:00
parent 57d09fac79
commit f4c1a2ec3b
2 changed files with 4 additions and 3 deletions

View File

@ -220,7 +220,8 @@ function cart_entity:on_step(dtime)
if stop_wiggle or vector.equals(dir, {x=0, y=0, z=0}) then if stop_wiggle or vector.equals(dir, {x=0, y=0, z=0}) then
vel = {x=0, y=0, z=0} vel = {x=0, y=0, z=0}
local pos_r = vector.round(pos) local pos_r = vector.round(pos)
if not boost_cart:is_rail(pos_r, self.railtype) then if not boost_cart:is_rail(pos_r, self.railtype)
and self.old_pos then
pos = self.old_pos pos = self.old_pos
elseif not stop_wiggle then elseif not stop_wiggle then
pos = pos_r pos = pos_r

View File

@ -25,8 +25,8 @@ if not default.player_attached then
default.player_attached = {} default.player_attached = {}
end end
minetest.after(1, function() minetest.after(0.5, function()
boost_cart.old_player_model = type(player_api) ~= "table" boost_cart.old_player_model = not minetest.global_exists("player_api")
end) end)
dofile(boost_cart.modpath.."/functions.lua") dofile(boost_cart.modpath.."/functions.lua")