Skip to content

Commit

Permalink
Some Imps only aggro by sight during the night
Browse files Browse the repository at this point in the history
  • Loading branch information
jmcmorris committed Sep 8, 2024
1 parent 65e64d3 commit 3d77d43
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 2 deletions.
33 changes: 33 additions & 0 deletions scripts/mixins/families/imp_aggro.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
require('scripts/globals/mixins')
-----------------------------------
xi = xi or {}
xi.mix = xi.mix or {}
xi.mix.imp_aggro = xi.mix.imp_aggro or {}

g_mixins = g_mixins or {}
g_mixins.families = g_mixins.families or {}

local function updateAggro(mob, hour)
mob:setLocalVar('hour', hour)

if hour >= 18 or hour < 6 then
mob:setMobMod(xi.mobMod.DETECTION, bit.bor(xi.detects.SIGHT, xi.detects.HEARING))
elseif hour < 18 and hour >= 6 then
mob:setMobMod(xi.mobMod.DETECTION, xi.detects.HEARING)
end
end

g_mixins.families.imp_aggro = function(mob)
mob:addListener('SPAWN', 'IMP_AGGRO_SPAWN', function(imp)
updateAggro(imp, VanadielHour())
end)

mob:addListener('ROAM_TICK', 'IMP_AGGRO_ROAM_TICK', function(imp)
local hour = VanadielHour()
if hour ~= imp:getLocalVar('hour') then
updateAggro(imp, hour)
end
end)
end

return g_mixins.families.imp_aggro
2 changes: 1 addition & 1 deletion scripts/zones/Caedarva_Mire/mobs/Heraldic_Imp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
-- Area: Caedarva Mire
-- Mob: Heraldic Imp
-----------------------------------
mixins = { require('scripts/mixins/families/imp') }
mixins = { require('scripts/mixins/families/imp'), require('scripts/mixins/families/imp_aggro') }
-----------------------------------
---@type TMobEntity
local entity = {}
Expand Down
2 changes: 1 addition & 1 deletion scripts/zones/Caedarva_Mire/mobs/Orderly_Imp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
-- Area: Caedarva Mire
-- Mob: Orderly Imp
-----------------------------------
mixins = { require('scripts/mixins/families/imp') }
mixins = { require('scripts/mixins/families/imp'), require('scripts/mixins/families/imp_aggro') }
-----------------------------------
---@type TMobEntity
local entity = {}
Expand Down

5 comments on commit 3d77d43

@ShiyoKozuki
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you have a source for this testing?

@jmcmorris
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I try to include capture links with all of my PRs including this one: #6227

@Xaver-DaRed
Copy link
Contributor

@Xaver-DaRed Xaver-DaRed commented on 3d77d43 Sep 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ShiyoKozuki we have repeatedly asked you to open issues or discussions instead of commenting on closed PRs/commits.

Please stop. Seriously.

@ShiyoKozuki
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I try to include capture links with all of my PRs including this one: #6227

Thanks, I didnt' know you could click the link at top to get to the PR. I'm not a master of github.

@Xaver-DaRed
In the future I recommend you don't be a dick to people for 0 reason, especially for a project that relies on people helping for free.

@Xaver-DaRed
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First, I wasn't a "dick", I asked you to please follow a set of instructions which you have been told several times in the past.
Second, there IS a reason. As I said, you have been told, repeatedly how to operate and continue to ignore said instructions.

And lastly, @ShiyoKozuki abstain yourself from making recommendations until you are able to follow a very simple request.

Locking the thread. Have a nice day.

Please sign in to comment.