Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/allejo/ctfoverseer
A BZFlag plug-in to oversee the fairness and features of CTF
https://github.com/allejo/ctfoverseer
bzflag bzflag-plugin
Last synced: 5 days ago
JSON representation
A BZFlag plug-in to oversee the fairness and features of CTF
- Host: GitHub
- URL: https://github.com/allejo/ctfoverseer
- Owner: allejo
- License: mit
- Created: 2019-01-05T23:19:42.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2021-01-25T07:05:10.000Z (almost 4 years ago)
- Last Synced: 2024-10-12T19:47:46.786Z (about 1 month ago)
- Topics: bzflag, bzflag-plugin
- Language: C++
- Homepage:
- Size: 55.7 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# CTF Overseer
[![GitHub release](https://img.shields.io/github/release/allejo/ctfOverseer.svg)](https://github.com/allejo/ctfOverseer/releases/latest)
![Minimum BZFlag Version](https://img.shields.io/badge/BZFlag-v2.4.20+-blue.svg)
[![License](https://img.shields.io/github/license/allejo/ctfOverseer.svg)](LICENSE.md)The plug-in that implements all of the CTF-related features from Planet MoFo's Apocalypse map. This plug-in has a number of features relating to capture events such as,
- Disable self-captures
- Disable a team flag from being grabbed X seconds after it was capped (prevent "pass-camping")
- Award bonus points to the player who capped the flag based on team counts
- Announce custom messages on capture events## Requirements
- BZFlag 2.4.20+
- C++11This plug-in follows [my standard instructions for compiling plug-ins](https://github.com/allejo/docs.allejo.io/wiki/BZFlag-Plug-in-Distribution).
## Usage
### Loading the plug-in
Loading the plugins requires [a configuration file](ctfOverseer.cfg) to define templated messages sent to players on certain events.
```
-loadplugin ctfOverseer,ctfOverseer.cfg
```### Configuration File
This plug-in makes use of the `ctfOverseer` section. Each configuration value may use quotes and will have them automatically stripped out.
- `self_cap_message_pub` - The message sent to all players on a self-capture
- `self_cap_message_pm` - The message sent to the player who self-captured
- `fair_cap_message_pub` - The message sent to all players on a capture while teams were fair
- `fair_cap_message_pm` - The message sent to the player who captured the flag when teams were fair
- `unfair_cap_message_pub` - The message sent to all players on a capture while teams were _unfair_
- `unfair_cap_message_pm` - The message sent to the player who captured the flag when teams were unfairThe following placeholders are available for use in any of the above settings.
- `{capper}` - The callsign of the player capping
- `{teamCapping}` - The color of the team capping the flag
- `{teamCapped}` - The color of the team whose flag was capped
- `{points}` - The number of bonus points awarded to the capper; this number may be negative when it's a penalty on self or unfair caps
- `{pointsAbs}` - The absolute value of the points awarded### Custom BZDB Variables
These custom BZDB variables can be configured with `-set` in configuration files and may be changed at any time in-game by using the `/set` command.
```
-set
```| Name | Type | Default | Description |
| ---- | ---- | ------- | ----------- |
| `_delayTeamFlagGrab` | int | 20 | The number of seconds after a team flag is captured that the team flag is ungrabbable by enemy players |
| `_maxCapBonus` | int | 9999 | The maximum number of points that can be granted per cap |
| `_disallowSelfCap` | bool | true | Disallow players from capturing their own flag |
| `_disallowUnfairCap` | bool | false | Disallow an unfair flag capture and send the team flag to its nearest safety zone |
| `_warnUnfairTeams` | bool | true | Send a PM to players to warn them they're grabbing an enemy team flag while teams are unfair |### Custom Slash Commands
This plug-in implements custom slash commands only for administrative tasks.
| Command | Permission | Description |
| ------- | ---------- | ----------- |
| `/reload [ctfoverseer]` | setAll | Re-read the configuration file to load in new messages |### Inter-Plug-in Communication
This plug-in supports using generic callbacks for inter-plug-in communication. Since this plug-in uses semantic versioning in its name, accessing this plugin via a generic callback is not feasible. For this reason, the plug-in registers a clip field under the name of `allejo/ctfOverseer`. This plug-in provides a [`ctfOverseerAPI.h`](./ctfOverseerAPI.h) header file to define types used for callbacks.
```cpp
const char* ctfOverseer = bz_getclipFieldString("allejo/ctfOverseer");TeamPair teamPair = std::make_pair(eRedTeam, eGreenTeam);
void* data = teamPair;int response = bz_callPluginGenericCallback(ctfOverseer, "calcBonusPoints", data);
```| Callback Name | Expected Type | Return Type |
| ------------------- | -------------------------- | ----------- |
| `calcBonusPoints` | [`TeamPair`][teampair-api] | The amount of points that would be awarded at the given moment for a capture |
| `isFairCapture` | [`TeamPair`][teampair-api] | A boolean value casted into an int |
| `listenOnCaptureV1` | [`OnCaptureEventCallbackV1`][oncapv1-api] | Register a callback to be executed whenever ctfOverseer handles a capture event |
| `removeOnCapture` | [`OnCaptureEventCallbackV1`][oncapv1-api] | Remove a registered callback |[teampair-api]: ./ctfOverseerAPI.h#L9-L15
[oncapv1-api]: ./ctfOverseerAPI.h#L17-L30#### Notes
- The value of `-9999` will be returned in the case of an error
- The first value of the `std::pair` will be the team who is grabbing the enemy flag, the second value is the team whose flag was grabbed
- The [`ctfOverseerExtension.cpp`](./ctfOverseerExtension.cpp) plug-in is provided as an example of how to use callbacks#### Warning
- Passing an object of the incorrect type will lead to unexpected behavior (and possibly server crashes?)
## License
[MIT](LICENSE.md)