actually stop guards from attacking ignored actors

This commit is contained in:
Lilian Jónsdóttir 2020-08-15 22:54:45 -07:00
parent 70ecca9cc0
commit 353d43a0b3

View file

@ -35,7 +35,8 @@ local function doChecks(attacker, target)
return false return false
end end
if config.ignored[attacker.object.id] or config.ignored[attacker.object.baseObject.id] then local obj = attacker.baseObject and attacker.baseObject or attacker.object
if config.ignored[string.lower(obj.id)] then
log("Ignored NPC or creature detected, not helping.") log("Ignored NPC or creature detected, not helping.")
return false return false
end end
@ -100,6 +101,17 @@ this.onCombatStarted = function(e)
end end
end end
-- hopefully this will stop guards attacking ignored actors
this.onCombatStart = function(e)
local target = e.target.baseObject and e.target.baseObject or e.target.object
local attacker = e.actor.baseObject and e.actor.baseObject or e.actor.object
if config.ignored[string.lower(target.id)] and attacker.isGuard then
log("Combat started against %s by a guard, %s... stopping...", target.id, attacker.id)
return false
end
end
-- }}} -- }}}
return this return this