diff options
Diffstat (limited to 'server/src/entity/mod.rs')
| -rw-r--r-- | server/src/entity/mod.rs | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/server/src/entity/mod.rs b/server/src/entity/mod.rs index ce7cb849..6418d0c7 100644 --- a/server/src/entity/mod.rs +++ b/server/src/entity/mod.rs @@ -37,7 +37,7 @@ use environment_effect::{EnvironmentController, EnvironmentEffectController}; use hurrycurry_client_lib::Game; use hurrycurry_data::{Serverdata, entities::EntityDecl}; use hurrycurry_locale::TrError; -use hurrycurry_protocol::{Character, Gamedata, PacketC, PacketS, PlayerID, glam::IVec2}; +use hurrycurry_protocol::{Character, PacketC, PacketS, PlayerID, glam::IVec2}; use item_portal::ItemPortal; use player_portal::PlayerPortal; use std::{ @@ -80,7 +80,7 @@ pub trait Entity: Any { } } -pub fn construct_entity(decl: &EntityDecl, data: &Gamedata) -> DynEntity { +pub fn construct_entity(decl: &EntityDecl) -> DynEntity { match decl.to_owned() { EntityDecl::Book { pos } => Box::new(Book(pos)), EntityDecl::ItemPortal { from, to } => Box::new(ItemPortal { from, to }), @@ -92,16 +92,18 @@ pub fn construct_entity(decl: &EntityDecl, data: &Gamedata) -> DynEntity { cooldown: 0., }), EntityDecl::Map { name, pos } => Box::new(Map { pos, name }), - EntityDecl::Gate { condition, pos } => Box::new(Gate { + EntityDecl::Gate { + condition, + pos, + blocker_tile, + } => Box::new(Gate { condition, unlocked: false, pos, - blocker_tile: data - .get_tile_by_name("fence") - .expect("asserted earlier (tm)"), + blocker_tile, active: true, }), - EntityDecl::Customers { scaling_factor } => { + EntityDecl::Customers { scaling_factor, .. } => { Box::new(Customers::new(scaling_factor.unwrap_or(0.5))) } EntityDecl::EnvironmentEffect(config) => Box::new(EnvironmentEffectController::new(config)), |