Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use correct UnitSeparation #3

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
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
4 changes: 2 additions & 2 deletions fix_construction_turrets.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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, {}, {} )
Expand All @@ -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
Expand Down