[−][src]Crate quill_prototype
A prototype API for quill
, Feather's plugin API.
Concepts
- Feather is based on [the ECS architecture], an alternative to classic object-oriented game architecture which is generally more flexible and slightly more performant.
- Feather plugins compile to WebAssembly and are run in a sandboxed environment.
Example plugin
use quill::*; // Initialize Quill FFI interfaces: // * creates `_quill_setup` which calls the `setup` function // * sets the global allocator to defer to host allocation APIs #![quill::plugin] struct Counter(u32); // Called when the plugin is loaded. pub fn setup(setup: &mut Setup) -> SysResult { setup.resource(Counter(0)) .system(each_tick); CommandBuilder::new("increment") .build(on_increment, setup); Ok(()) } fn each_tick(state: &mut State) -> SysResult { println!("Ticking"); println!("Command has been executed {} times", state.resource::<Counter>()?.0); Ok(()) } fn on_increment(state: &mut State, sender: EntityRef, args: &[&str]) -> SysResult { state.resource_mut::<Counter>()?.0 += 1; println("Command called with arguments {:?}", args); Ok(()) }
Structs
BlockId | (Would be reexported from |
BlockPosition | Position of a block in world space. |
ChunkNotLoaded | Error returned when a block cannot be accessed because its chunk is not loaded. |
CommandBuilder | A builder for a command. |
EntityDead | Error returned when an entity no longer exists. |
EntityId | An opaque, unique ID of an entity. Can be used with |
EntityRef | A handle to an entity. Provides access to components. |
MissingResource | Error returned when a resource of some type does not exist. |
Name | The name of an entity. |
Position | A position in world space. |
Setup | Struct passed to your plugin's |
State | The main server state. |
Enums
ComponentError | Error returned when attempting to get a component from an entity. |
Traits
Component | A type that can be associated with an entity as a component. |
Resource | A type that can be stored in |
Type Definitions
CommandExecutor | A function that can be used as a command executor. |
SysResult | Result type returned by most functions. |
System | A system, the |