summaryrefslogtreecommitdiff
path: root/luaentity.lua
diff options
context:
space:
mode:
authorSkgland <bb-github@t-online.de>2020-12-18 19:21:39 +0100
committerSkgland <bb-github@t-online.de>2020-12-18 19:28:07 +0100
commitba7eb19317651e4e02a8e9cec741192b3141f93e (patch)
treee7cae4afec7db87eb1778f78f60e4950e962930d /luaentity.lua
parent065c953eba3f2194d56e45f17dae0d4c40852a8e (diff)
downloadpipeworks-ba7eb19317651e4e02a8e9cec741192b3141f93e.tar
pipeworks-ba7eb19317651e4e02a8e9cec741192b3141f93e.tar.gz
pipeworks-ba7eb19317651e4e02a8e9cec741192b3141f93e.tar.bz2
pipeworks-ba7eb19317651e4e02a8e9cec741192b3141f93e.tar.xz
pipeworks-ba7eb19317651e4e02a8e9cec741192b3141f93e.zip
Prevent the symptoms of Issue #33
Try to prevent the crash from issue #33 by replaving nil velocity or acceleration with (0,0,0). This does not fix the underlying cause of them being nil, but should prevent the crash.
Diffstat (limited to 'luaentity.lua')
-rw-r--r--luaentity.lua2
1 files changed, 2 insertions, 0 deletions
diff --git a/luaentity.lua b/luaentity.lua
index 8385264..6e75eeb 100644
--- a/luaentity.lua
+++ b/luaentity.lua
@@ -340,6 +340,8 @@ local move_entities_globalstep_part2 = function(dtime)
entity._velocity = master_entity:get_velocity()
entity._acceleration = master_entity:get_acceleration()
else
+ entity._velocity = entity._velocity or vector.new(0,0,0)
+ entity._acceleration = entity._acceleration or vector.new(0,0,0)
entity._pos = vector.add(vector.add(
entity._pos,
vector.multiply(entity._velocity, dtime)),