About
leafwing-abilities
is an opinionated, ready-to-use Bevy library and plugin for handling abilities. It features:
- cooldown tracking
- resource management
- a battle-tested, coherent structure for writing your own ability logic
Roleplaying games, and particularly Diablo-like action RPGs are the primary target, but you may find it useful for platformers, turn-based RPGs, real-time strategy games and games looking for MOBA-style gameplay.
Instructions
Finally:
- Rename the lib and bin in
Cargo.toml
(and all imports to ensure your code compiles). - Double check that the LICENSE matches your intent.
- Update this README to match your project, modifying
About
,Getting Started
and other sections as needed.
Running examples
To run an example, use cargo run --example_name
, where example_name
is the file name of the example without the .rs
extension.
This repo is set up to always build with full optimizations, so there's no need for a --release
flag in most cases. Dynamic linking is enabled to ensure build times stay snappy.
Contributing
This repository is open to community contributions! There are a few options if you'd like to help:
- File issues for bugs you find or new features you'd like.
- Read over and discuss issues, then make a PR that fixes them. Use "Fixes #X" in your PR description to automatically close the issue when the PR is merged.
- Review existing PRs, and leave thoughtful feedback. If you think a PR is ready to merge, hit "Approve" in your review!
Any contributions made are provided under the licenses (standard MIT + Apache) listed in this repo at the time of their contribution, and do not require separate attribution.
Testing
- Use doc tests aggressively to show how APIs should be used. You can use
#
to hide a setup line from the doc tests. - Unit test belong near the code they are testing. Use
#[cfg(test)]
on the test module to ignore it during builds, and#[test]
on the test functions to ensure they are run. - Integration tests should be stored in the top level
tests
folder, importing functions fromlib.rs
.
Use cargo test
to run all tests.
CI
The CI will:
- Ensure the code is formatted with
cargo fmt
. - Ensure that the code compiles.
- Ensure that (almost) all
clippy
lints pass. - Ensure all tests pass on Windows, MacOS and Ubuntu.
Check this locally with:
cargo run -p ci
cargo test --workspace
To manually rerun CI:
- Navigate to the
Actions
tab. - Use the dropdown menu in the CI run of interest and select "View workflow file".
- In the top-right corner, select "Rerun workflow".
Documentation
Reference documentation is handled with standard Rust doc strings. Use cargo doc --open
to build and then open the docs.
Design docs (or other book-format documentation) is handled with mdBook. Install it with cargo install mdbook
, then use mdbook serve --open
to launch the docs.
Benchmarking
To run the benchmarks, use cargo bench
.
For more documentation on making your own benchmarks, check out criterion's docs.