canary/data/scripts/creaturescripts/monster/spawn_system.lua
Marco f34cb83845
enhance and refactor: multiple scripts for better functionality (#3007)
1. Fixes a minor issue where, when emptying the balloons, they were
transformed into 255 instead of being reset to 1.
2. Adjusts the usage of the "bathtub" in datapacks, in addition to the
RLMap, ensuring better compatibility.
3. Makes minor aesthetic changes to enhance the code's readability.

Resolves #2923
2024-11-13 00:38:54 -03:00

27 lines
830 B
Lua

local monsterDeath = CreatureEvent("monsterDeath")
function monsterDeath.onDeath(creature, corpse, killer, mostDamage, unjustified, mostDamageUnjustified)
if creature and creature:isMonster() then
local self = creature:getStorageValue(MonsterStorage.Spawn.monster_spawn_object)
self:executeFunctionMonster("onDeath", creature)
self:deleteMonster(creature)
return true
end
return true
end
monsterDeath:register()
local monsterDeathBoss = CreatureEvent("monsterDeathBoss")
function monsterDeathBoss.onDeath(creature, corpse, killer, mostDamage, unjustified, mostDamageUnjustified)
if creature and creature:isMonster() then
local self = creature:getStorageValue(MonsterStorage.Spawn.monster_spawn_object)
self:removeSpawn()
self:removeMonsters()
return true
end
return true
end
monsterDeathBoss:register()