diff options
author | Aki <nthirtyone@gmail.com> | 2017-01-14 21:05:02 +0100 |
---|---|---|
committer | Aki <nthirtyone@gmail.com> | 2017-01-14 21:05:02 +0100 |
commit | 2cb2ffdbeb5c25b01ad361cc4f42724eb0a28b12 (patch) | |
tree | 9f679dbb0b93afb9185cd6800193fe6f992c8c3a /player.lua | |
parent | 44f94f0752063852ededa73c0bb7eada50b08f33 (diff) | |
download | roflnauts-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.lua | 12 |
1 files changed, 7 insertions, 5 deletions
@@ -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 |