Galactica/crates/behavior/src/lib.rs

22 lines
529 B
Rust
Raw Normal View History

2024-01-01 12:01:29 -08:00
#![warn(missing_docs)]
//! Computer-controlled ship behaviors
2024-01-01 11:40:31 -08:00
pub mod behavior;
use galactica_content as content;
2024-01-01 15:41:47 -08:00
use galactica_world::{ShipPhysicsHandle, World};
2024-01-01 11:40:31 -08:00
2024-01-01 12:01:29 -08:00
/// Main behavior trait. Any struct that implements this
/// may be used to control a ship.
2024-01-01 11:40:31 -08:00
pub trait ShipBehavior
where
Self: Send,
{
2024-01-01 12:01:29 -08:00
/// Update a ship's controls based on world state
2024-01-01 15:41:47 -08:00
fn update_controls(&mut self, physics: &mut World, content: &content::Content);
2024-01-01 12:01:29 -08:00
/// Get the ship this behavior is attached to
2024-01-01 15:41:47 -08:00
fn get_handle(&self) -> ShipPhysicsHandle;
2024-01-01 11:40:31 -08:00
}