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

Command to iterate over robots with a certain name #2200

Open
kostmo opened this issue Nov 2, 2024 · 1 comment
Open

Command to iterate over robots with a certain name #2200

kostmo opened this issue Nov 2, 2024 · 1 comment
Labels
Z-Feature A new feature to be added to the game.

Comments

@kostmo
Copy link
Member

kostmo commented Nov 2, 2024

Multiple copies of a robot with a given name can be placed on the map via palette entries (see also #1396). In goal checking logic, we may want to iterate over all robots of a given template.

The robotnumbered command was used in the gated_paddock scenario (#835) to iterate over sheep robots, since at that stage within the scenario, sheep were the only robots.

However, in a scenario with lots of growing plants, it is inefficient to use robotnumbered to find the desired named robots.

robotnamed will simply return the first instance of a robot with a given name, which does not facilitate iteration. I tried using selfdestruct within a loop inside the goal logic, but this does not remove the robot from the robotnamed lookup table soon enough to facilitate selection of the next robot; the attempt to iterate through all robots of a given name by selfdestructing them resulted in an infinite loop.

There should exist a command that returns a list of all robots with a given name. Perhaps a more general command could list of all robots that satisfy a certain predicate, but note that currently a given robot's name is not queryable.

@kostmo kostmo added the Z-Feature A new feature to be added to the game. label Nov 2, 2024
@byorgey
Copy link
Member

byorgey commented Nov 2, 2024

Related: #506

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Z-Feature A new feature to be added to the game.
Projects
None yet
Development

No branches or pull requests

2 participants