Open
Conversation
When multiple production buildings are selected and the player issues a produce command, the resources should be fairly distributed across all buildings, prioritizing those not currently producing. This fix has two parts: 1. Commander: Sort selected units before issuing commands - Non-producing buildings get priority - Among same production status, prefer buildings with fewer queued commands 2. Unit: Defer resource costs until command becomes active - Only deduct resources when a command starts executing - Queued commands don't consume resources until they become the current command - This allows multiple commands to be queued without prematurely consuming all resources Scenario that is now fixed: - Player selects 3 barracks: 2 producing, 1 idle - Player issues produce command with enough resources for 1 unit - Previously: One of the producing barracks would get it (wrong) - Now: The idle barracks gets sorted first and receives the command - Resources are only deducted when the idle barracks' command becomes active Fixes #254 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Sort units by queue size (fewest commands first) to prioritize idle/underutilized buildings - Use round-robin cycling to fairly distribute commands across selected units - Ensure immediate resource deduction to prevent queueing without resources
2b9bcfd to
ad1086d
Compare
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 #254
Will need a little more testing, but looks great so far!