Repository navigation
u.gather(target): send a worker to mine or gather gas - #84
Closed
mstephenhunt wants to merge 1 commit into
Closed
mstephenhunt wants to merge 1 commit into
mstephenhunt wants to merge 1 commit into
Conversation
…m a gas building A right-click's order, written to the worker: MoveToMinerals (85) for a mineral field, MoveToGas (81) for a gas building, order state 0 and the order target. Three read-only fields go with it, u.orderTarget and u.orderTargetX / u.orderTargetY, so a program can see where a just-trained worker is headed (a rally on a patch gives Move to the patch's centre; one on the player's own gas building gives Follow with that target). Played in StarCraft: Remastered: rallied SCVs, Probes and Drones mine and gather gas. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Author
|
Superseded by #88, which adds the trigscript/workers autoMining() library on top of u.gather. |
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.
Not ready to merge
@jeany55 This is my first attempt to create a new function call to make it easier for other people to implement quality of life features. But I want to make sure I actually understand this, really I just threw Claude at it.
My manual tests show this working perfectly, which is encourging!
Why
I wanted newly built workers to start mining on their own when their building is rallied to a mineral patch or a gas building. In Brood War a rallied worker walks there and stands idle, and the Order action can only move, patrol or attack. So a map has no way to give a worker a gather order without writing it into the unit's memory.
What changes
u.gather(target)gives a worker the order a right-click would: MoveToMinerals for a mineral field, MoveToGas for a gas building. It writes the order id, order state 0 and the order target.u.orderTarget,u.orderTargetX,u.orderTargetYare new read-only fields. A just-trained worker rallied onto a patch has a Move order to the patch's centre and no target unit. One rallied onto its own player's gas building has Follow with that building as the target. These fields let a program tell those cases apart.docs/ir.md, and emitter tests.The program I built this for uses one
on.orderlistener. It catches an SCV or Probe whose previous order was Nothing, or a Drone leaving ZergBirth, and callsgatherwhen the rally is on a mineral field or on the owner's own finished gas building.Testing
gatheron a mineral field and on a gas building.scmjs map trace: