Fix bug where affects that aren't applied can be removed giving player super speed

pull/6/head
Brandon 2015-06-27 23:54:33 -05:00
parent c3803ce748
commit c4c875f9fe
1 changed files with 7 additions and 5 deletions

View File

@ -21,11 +21,13 @@ function affects.removeAffect(name, affectid)
if ( affectid == nil ) then
return false
else
affects._affectedPlayers[name][affectid] = nil;
if ( affects._affects[affectid].onremove ~= nil ) then
local player = minetest.get_player_by_name(name)
--player:set_physics_override({ speed=1, jump=1,gravity=1,sneak=true }) -- reset their physics
affects._affects[affectid].onremove(name,player,affectid)
if affects._affectedPlayers[name][affectid] ~= nil then
affects._affectedPlayers[name][affectid] = nil;
if ( affects._affects[affectid].onremove ~= nil ) then
local player = minetest.get_player_by_name(name)
--player:set_physics_override({ speed=1, jump=1,gravity=1,sneak=true }) -- reset their physics
affects._affects[affectid].onremove(name,player,affectid)
end
end
return true
end