Skip to content

Commit b2090d8

Browse files
committed
combined two near-identical codeblocks
1 parent c7d016b commit b2090d8

1 file changed

Lines changed: 3 additions & 13 deletions

File tree

LuaUI/Widgets/unit_smart_nanos.lua

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -293,20 +293,10 @@ function widget:Update(deltaTime)
293293
end
294294

295295
if nanoTurrets[unitID].auto then
296-
if (prevCommand == CMD.RECLAIM) then
297-
if prevUnit < Game.maxUnits then
298-
local targetDefID = spGetUnitDefID(prevUnit)
299-
if (targetDefID ~= nil) and UnitDefs[targetDefID].canMove then
300-
local uX, _, uZ = spGetUnitPosition(prevUnit)
301-
if posInRangeOfUnit(unitDefs, uX, uZ) then
302-
commandMe = true
303-
end
304-
end
305-
end
306-
end
307-
if (prevCommand == CMD.REPAIR) then
296+
if (prevCommand == CMD.RECLAIM) and prevUnit < Game.maxUnits or
297+
prevCommand == CMD.REPAIR then
308298
local targetDefID = spGetUnitDefID(prevUnit)
309-
if (targetDefID ~= nil) and UnitDefs[targetDefID].canMove then
299+
if targetDefID and UnitDefs[targetDefID].canMove then
310300
local uX, _, uZ = spGetUnitPosition(prevUnit)
311301
if posInRangeOfUnit(unitDefs, uX, uZ) then
312302
commandMe = true

0 commit comments

Comments
 (0)