Skip to content

Commit

Permalink
pve boss priority targetting: dont attack own allyteam units
Browse files Browse the repository at this point in the history
  • Loading branch information
Ruwetuin committed Mar 2, 2024
1 parent 0e842d3 commit 775e974
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions luarules/gadgets/pve_boss_priority_targetting.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ local queenUnitDefs = {
raptor_queen_hard = true,
raptor_queen_veryhard = true,
raptor_queen_epic = true,

raptor_matriarch_spectre = true,
raptor_matriarch_electric = true,
raptor_matriarch_acid = true,
Expand All @@ -39,8 +39,8 @@ local queenUnitDefs = {


local queenUnits = {}
for unitDefName, isqueen in pairs(queenUnitDefs) do
if UnitDefNames[unitDefName] then
for unitDefName, isqueen in pairs(queenUnitDefs) do
if UnitDefNames[unitDefName] then
queenUnits[UnitDefNames[unitDefName].id] = isqueen
end
end
Expand Down Expand Up @@ -80,12 +80,12 @@ function gadget:GameFrame(frame)
local queenx,queeny,queenz = Spring.GetUnitPosition(queenID)
local surroundingUnits = Spring.GetUnitsInSphere(queenx, queeny, queenz, 750)
for i = 1,#surroundingUnits do
if aliveTargets[surroundingUnits[i]] then
if aliveTargets[surroundingUnits[i]] and Spring.GetUnitAllyTeam(surroundingUnits[i]) ~= Spring.GetUnitAllyTeam(queenID) then
Spring.GiveOrderToUnit(queenID, CMD.STOP, 0, 0)
Spring.GiveOrderToUnit(queenID, CMD.ATTACK, {surroundingUnits[i]}, 0)
break
end
end
end
end
end
end

0 comments on commit 775e974

Please sign in to comment.