rg-ctf-utils
A collection of utilities for use in the Regression Games Capture the Flag game mode.
Classes
- CTFEvent
A set of event names that are emitted by the RGCTFUtils class, which can be registered on an RGBot.
- RGCTFUtils
Members
- CTFEvent
-
A collection of utilities for the Capture the Flag game mode. Includes location of points of interest, simplified functions for gathering and scoring the flag, and utilities for finding both teammates and enemies.
When using this class, it will register a set of listeners on RGBot, which helps with reacting to CTF game mode events. See the examples within the
CTFEvent
documentation for more information.
CTFEvent
A set of event names that are emitted by the RGCTFUtils class, which can be registered on an RGBot.
RGCTFUtils
-
RGCTFUtils
- new RGCTFUtils(bot)
- .setDebug(debug)
-
.getFlagLocation() ⇒
Vec3
|null
-
.approachFlag() ⇒
Promise.<boolean>
-
.scoreFlag() ⇒
Promise.<boolean>
-
.hasFlag() ⇒
boolean
new RGCTFUtils(bot)
Creates a new instance of the CTF utilities, attached to an RGBot
Param | Type | Description |
---|---|---|
bot | RGBot |
The bot to use when calling these utilities |
Example
const rgctfUtils = new RGCTFUtils(bot);
rgctfUtils.setDebug(debug)
Sets the debug state of this plugin - true if you want to see debug statements, false otherwise
Param | Type | Description |
---|---|---|
debug | boolean |
Whether or not to print debug statements |
Vec3
| null
rgctfUtils.getFlagLocation() ⇒ Gets the location of either the neutral flag OR a team's flag on the ground.
Returns: Vec3
| null
-
The location of either the neutral flag OR a team's flag on the ground.
Example
const flagLocation = ctfutils.getFlagLocation();
if (flagLocation) await bot.approachPosition(flagLocation);
Promise.<boolean>
rgctfUtils.approachFlag() ⇒ Commands the bot to move toward the current flag location, if the flag exists. This will not follow the flag, but will simply move the bot to the location of the flag when this command is called.
Returns: Promise.<boolean>
-
true if the bot reached the location, false otherwise
See{getflaglocation}:
Example
await bot.approachFlag();
Promise.<boolean>
rgctfUtils.scoreFlag() ⇒ Commands the bot to score the flag in your team's base.
Returns: Promise.<boolean>
-
true if the bot reached the scoring zone, and false otherwise
Example
if (rgctfUtils.hasFlag()) {
await rgctfUtils.scoreFlag();
}
boolean
rgctfUtils.hasFlag() ⇒ Returns true if this bot has the flag, and false otherwise.
Returns: boolean
-
true if the bot has the flag, false otherwise
Example
if (rgctfUtils.hasFlag()) {
await rgctfUtils.scoreFlag();
}
CTFEvent
A collection of utilities for the Capture the Flag game mode. Includes location of points of interest, simplified functions for gathering and scoring the flag, and utilities for finding both teammates and enemies.
When using this class, it will register a set of listeners on RGBot, which helps with reacting to CTF game mode events. See the examples within the
CTFEvent
documentation for more information.
© 2023 Regression Games, Inc.