Fix space-queue proximity bug - #5805
Open
QrowZK wants to merge 1 commit into
Open
Conversation
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.
sprunk
requested changes
Jul 29, 2026
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) |
Member
There was a problem hiding this comment.
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 |
| table.remove(buildQueue, MAX_QUEUE + 1) | ||
| msg2 = msg | ||
| msg = "IQ|2|".. (MAX_QUEUE + 1) | ||
| local insertPos = GetLeastTravelInsertPos(buildData) -- 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 |
Member
There was a problem hiding this comment.
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) |
Member
There was a problem hiding this comment.
the receiver side shouldnt rely on this
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.