Skip to content

Fix space-queue proximity bug - #5805

Open
QrowZK wants to merge 1 commit into
ZeroK-RTS:masterfrom
QrowZK:master
Open

Fix space-queue proximity bug#5805
QrowZK wants to merge 1 commit into
ZeroK-RTS:masterfrom
QrowZK:master

Conversation

@QrowZK

@QrowZK QrowZK commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Fixes a bug where space-shift queue at the beginning of the game would not figure out where the unit should go within the queue, but instead always put the space-shift queue'd item first in the queue line rather than figuring it out based on existing queue items and commander plop location.

Fixes #5803

Confirmed working via local widget drop in locally.

Fixes a bug where space-shift queue at the beginning of the game would not figure out where the unit should go within the queue, but instead always put the space-shift queue'd item first in the queue line rather than figuring it out based on existing queue items and commander plop location.
Comment on lines +621 to +622
local function Distance3D(x1, y1, z1, x2, y2, z2)
return math.sqrt((x1 - x2)^2 + (y1 - y2)^2 + (z1 - z2)^2)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks generic, probably belongs to spring.utilities

msg = "IQ|2|".. (MAX_QUEUE + 1)
local insertPos = GetLeastTravelInsertPos(buildData) -- zero-based
-- Inserting past a full queue would only push the new order straight back off it.
if #buildQueue < MAX_QUEUE or insertPos < MAX_QUEUE then

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks incorrect

table.remove(buildQueue, MAX_QUEUE + 1)
msg2 = msg
msg = "IQ|2|".. (MAX_QUEUE + 1)
local insertPos = GetLeastTravelInsertPos(buildData) -- zero-based

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why zero-based?

table.insert(playerXBuildQueue, 1, {unitDefID,x,y,z,face})
elseif typeArg == 3 then -- Append to end of queue
playerXBuildQueue[#playerXBuildQueue+1] = {unitDefID,x,y,z,face}
elseif typeArg == 6 then -- Insert at a given index

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this sort of makes the previous two redundant

msg = "IQ|6|"..selDefID.."|"..math.modf(bx).."|"..math.modf(by).."|"..math.modf(bz).."|"..buildFacing.."|"..(insertPos + 1)
if (buildQueue[MAX_QUEUE + 1] ~= nil) then -- exceeded max queue, remove the one at the end
table.remove(buildQueue, MAX_QUEUE + 1)
msg2 = "IQ|2|".. (MAX_QUEUE + 1)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the receiver side shouldnt rely on this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Pre-Game Command Misfunction with Space+Shift

2 participants