summaryrefslogtreecommitdiffhomepage
path: root/player.lua
diff options
context:
space:
mode:
authorAki <nthirtyone@gmail.com>2017-01-14 21:05:02 +0100
committerAki <nthirtyone@gmail.com>2017-01-14 21:05:02 +0100
commit2cb2ffdbeb5c25b01ad361cc4f42724eb0a28b12 (patch)
tree9f679dbb0b93afb9185cd6800193fe6f992c8c3a /player.lua
parent44f94f0752063852ededa73c0bb7eada50b08f33 (diff)
downloadroflnauts-2cb2ffdbeb5c25b01ad361cc4f42724eb0a28b12.zip
roflnauts-2cb2ffdbeb5c25b01ad361cc4f42724eb0a28b12.tar.gz
roflnauts-2cb2ffdbeb5c25b01ad361cc4f42724eb0a28b12.tar.bz2
Hotfix for something that shouldn't happen
Diffstat (limited to 'player.lua')
-rw-r--r--player.lua12
1 files changed, 7 insertions, 5 deletions
diff --git a/player.lua b/player.lua
index ba6e838..544f89e 100644
--- a/player.lua
+++ b/player.lua
@@ -212,11 +212,13 @@ function Player:update(dt)
-- # PUNCH
-- Cooldown
self.punchcd = self.punchcd - dt
- for _,fixture in pairs(self.body:getFixtureList()) do
- if fixture:getUserData() ~= self then
- fixture:setUserData({fixture:getUserData()[1] - dt, fixture:getUserData()[2]})
- if fixture:getUserData()[1] < 0 then
- fixture:destroy()
+ if not self.body:isDestroyed() then -- This is weird
+ for _,fixture in pairs(self.body:getFixtureList()) do
+ if fixture:getUserData() ~= self then
+ fixture:setUserData({fixture:getUserData()[1] - dt, fixture:getUserData()[2]})
+ if fixture:getUserData()[1] < 0 then
+ fixture:destroy()
+ end
end
end
end