Fix occasional crash in discouple on_punch

I think the issue is caused by the new animal damage code...
master
orwell96 2017-11-14 22:08:56 +01:00 committed by GitHub
parent 480011c781
commit 17ee62dc64
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -32,6 +32,10 @@ minetest.register_entity("advtrains:discouple", {
get_staticdata=function() return "DISCOUPLE" end,
on_punch=function(self, player)
return advtrains.pcall(function()
if not self.wagon or not player or player:get_player_name()=="" then
--our new animal damage code seems to generate problems
return
end
--only if player owns at least one wagon next to this
local own=player:get_player_name()
if self.wagon.owner and self.wagon.owner==own and not self.wagon.lock_couples then