From 70f14959c20b02dd1fecbd0061167a43af8b53f8 Mon Sep 17 00:00:00 2001 From: SuperKitowiec Date: Tue, 13 Aug 2024 09:13:23 +0200 Subject: [PATCH] Use correct UnitSeparation --- fix_construction_turrets.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fix_construction_turrets.lua b/fix_construction_turrets.lua index e6b4d31..812ceb3 100644 --- a/fix_construction_turrets.lua +++ b/fix_construction_turrets.lua @@ -84,7 +84,7 @@ function widget:UnitCommand(unitID, unitDefID, unitTeam, cmdID, cmdParams, cmdOp return end end - local unitSeparation = Spring.GetUnitSeparation(target_unit_id, unitID, true) + local unitSeparation = Spring.GetUnitSeparation(target_unit_id, unitID, true, true) if UD.buildDistance == nil or unitSeparation == nil or unitSeparation > UD.buildDistance then -- impossible command detected, issue stop command. Spring.GiveOrderToUnit(unitID, CMD.STOP, {}, {} ) @@ -107,7 +107,7 @@ function fixNanosAfterTheFact() -- stop nanos assisting beyond range targetUnitID = allCommands[1]['params'][1] if targetUnitID ~= nil then - if Spring.GetUnitSeparation(unitID, targetUnitID, true) > UnitDefs[Spring.GetUnitDefID(unitID)].buildDistance then + if Spring.GetUnitSeparation(unitID, targetUnitID, true, true) > UnitDefs[Spring.GetUnitDefID(unitID)].buildDistance then Spring.GiveOrderToUnit(unitID, CMD.STOP, {}, {} ) end end