mirror of
https://codeberg.org/tenplus1/mobs_redo.git
synced 2025-07-01 16:00:23 +02:00
make on_death compatible (return either player or nil)
This commit is contained in:
9
api.lua
9
api.lua
@ -882,7 +882,14 @@ function mob_class:check_for_death(cmi_cause)
|
||||
-- execute official engine on_death function if found
|
||||
if self.on_death then
|
||||
|
||||
self:on_death(self, cmi_cause)
|
||||
-- only return killer if punched by player
|
||||
if cmi_cause.type == "punch" and is_player(cmi_cause.puncher) then
|
||||
cmi_cause = cmi_cause.puncher
|
||||
else
|
||||
cmi_cause = nil
|
||||
end
|
||||
|
||||
self:on_death(cmi_cause)
|
||||
|
||||
remove_mob(self, true)
|
||||
|
||||
|
Reference in New Issue
Block a user