Skip to content

Commit

Permalink
core: Notify monsters that summon appears (#2841)
Browse files Browse the repository at this point in the history
  • Loading branch information
nekiro committed May 1, 2020
1 parent 196963a commit c614a3c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions data/lib/core/creature.lua
Expand Up @@ -105,6 +105,7 @@ function Creature:addSummon(monster)
summon:setDropLoot(false)
summon:setSkillLoss(false)
summon:setMaster(self)
summon:getPosition():notifySummonAppear(summon)

return true
end
Expand Down
9 changes: 9 additions & 0 deletions data/lib/core/position.lua
Expand Up @@ -70,3 +70,12 @@ function Position:isInRange(from, to)
end
return false
end

function Position:notifySummonAppear(summon)
local spectators = Game.getSpectators(self)
for _, spectator in ipairs(spectators) do
if spectator:isMonster() then
spectator:addTarget(summon)
end
end
end

0 comments on commit c614a3c

Please sign in to comment.