diff options
author | metamuffin <metamuffin@disroot.org> | 2024-09-04 22:11:51 +0200 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2024-09-04 22:11:51 +0200 |
commit | c646336dc3bf470d4185eec995d00a89c420127b (patch) | |
tree | e1ad02976adc2489b547242a513757014e2b4862 /server/src/entity/mod.rs | |
parent | 4df50b07df35f8c75980ce19d954f3f366dae848 (diff) | |
download | hurrycurry-c646336dc3bf470d4185eec995d00a89c420127b.tar hurrycurry-c646336dc3bf470d4185eec995d00a89c420127b.tar.bz2 hurrycurry-c646336dc3bf470d4185eec995d00a89c420127b.tar.zst |
book as entity and /book command
Diffstat (limited to 'server/src/entity/mod.rs')
-rw-r--r-- | server/src/entity/mod.rs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/server/src/entity/mod.rs b/server/src/entity/mod.rs index c8424934..30a5da55 100644 --- a/server/src/entity/mod.rs +++ b/server/src/entity/mod.rs @@ -15,6 +15,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>. */ +pub mod book; pub mod bot; pub mod campaign; pub mod conveyor; @@ -25,6 +26,7 @@ pub mod player_portal; use crate::{data::ItemTileRegistry, scoreboard::ScoreboardStore}; use anyhow::{anyhow, Result}; +use book::Book; use campaign::{Gate, GateCondition, Map}; use conveyor::Conveyor; use customers::Customers; @@ -53,7 +55,9 @@ pub struct EntityContext<'a> { } pub trait Entity { - fn tick(&mut self, c: EntityContext<'_>) -> Result<()>; + fn tick(&mut self, _c: EntityContext<'_>) -> Result<()> { + Ok(()) + } fn destructor(&mut self, _c: EntityContext<'_>) {} fn interact( &mut self, @@ -117,6 +121,7 @@ pub enum EntityDecl { location: Option<IVec2>, condition: GateCondition, }, + Book, } pub fn construct_entity( @@ -125,6 +130,7 @@ pub fn construct_entity( reg: &ItemTileRegistry, ) -> Result<DynEntity> { Ok(match decl.to_owned() { + EntityDecl::Book => Box::new(Book(pos.ok_or(anyhow!("book is tile entity"))?)), EntityDecl::ItemPortal { from, to } => Box::new(ItemPortal { from: from .or(pos) |