Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions LuaRules/Gadgets/unit_spawner.lua
Original file line number Diff line number Diff line change
Expand Up @@ -439,9 +439,9 @@ local function UpdateBurrowTarget(burrowID, targetArg)
end
end
--echo("Final selected target ID: "..data.targetID)
local validUnitID = spValidUnitID(data.targetID) --in case multiple UnitDestroyed() is called at same frame and burrow happen to choose a target before all Destroyed unit is registered.
local validUnitID = (targetData.targetID ~= burrowID) and spValidUnitID(targetData.targetID) --in case multiple UnitDestroyed() is called at same frame and burrow happen to choose a target before all Destroyed unit is registered.
if validUnitID and targetData.targetID ~= oldTarget then
targetData.targetTeam = spGetUnitTeam(data.targets[data.targetID])
targetData.targetTeam = spGetUnitTeam(targetData.targetID)
--spGiveOrderToUnit(burrowID, CMD_ATTACK, data.targetID, 0)
--echo("Target for burrow ID ".. burrowID .." updated to target ID " .. data.targetID)
elseif not validUnitID then
Expand Down Expand Up @@ -1071,7 +1071,7 @@ end
function gadget:UnitFinished(unitID, unitDefID, unitTeam)
--burrow targetting
local name = UnitDefs[unitDefID].name
if (humanTeams[unitTeam]) and UnitDefs[unitDefID].isImmobile and (not noTarget.name) then
if (humanTeams[unitTeam]) and UnitDefs[unitDefID].isImmobile and (not noTarget[name]) then
--echo("Building ID "..unitID .." added to target array")
local x, y, z = spGetUnitPosition(unitID)
data.targets[unitID] = unitTeam
Expand Down