Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Notify monsters that summon appears #2841

Merged
merged 3 commits into from May 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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