|
|
@ -33,7 +33,7 @@ use crate::ship::location::{ClientLocation, RoomLobby, ClientLocationError, Room |
|
|
|
use crate::ship::drops::DropTable;
|
|
|
|
use crate::ship::items;
|
|
|
|
use crate::ship::room;
|
|
|
|
use crate::ship::map::{MapBuilder, FreeRoamMapBuilder, MapsError, MapAreaError};
|
|
|
|
use crate::ship::map::{Maps, MapsError, MapAreaError, generate_free_roam_maps};
|
|
|
|
use crate::ship::packet::handler;
|
|
|
|
use crate::ship::shops::{WeaponShop, ToolShop, ArmorShop};
|
|
|
|
use crate::ship::trade::TradeState;
|
|
|
@ -380,7 +380,7 @@ pub struct ShipServerStateBuilder<EG: EntityGateway + Clone + 'static> { |
|
|
|
port: Option<u16>,
|
|
|
|
auth_token: Option<AuthToken>,
|
|
|
|
event: Option<ShipEvent>,
|
|
|
|
map_builder: Option<Box<dyn MapBuilder>>,
|
|
|
|
map_builder: Option<Box<dyn Fn(room::RoomMode, ShipEvent) -> Maps + Send + Sync>>,
|
|
|
|
drop_table_builder: Option<Box<dyn Fn(room::Episode, room::Difficulty, SectionID) -> DropTable + Send + Sync>>,
|
|
|
|
num_blocks: usize,
|
|
|
|
}
|
|
|
@ -439,7 +439,7 @@ impl<EG: EntityGateway + Clone + 'static> ShipServerStateBuilder<EG> { |
|
|
|
}
|
|
|
|
|
|
|
|
#[must_use]
|
|
|
|
pub fn map_builder(mut self, map_builder: Box<dyn MapBuilder>) -> ShipServerStateBuilder<EG> {
|
|
|
|
pub fn map_builder(mut self, map_builder: Box<dyn Fn(room::RoomMode, ShipEvent) -> Maps + Send + Sync>) -> ShipServerStateBuilder<EG> {
|
|
|
|
self.map_builder = Some(map_builder);
|
|
|
|
self
|
|
|
|
}
|
|
|
@ -468,7 +468,7 @@ impl<EG: EntityGateway + Clone + 'static> ShipServerStateBuilder<EG> { |
|
|
|
shops: ItemShops::default(),
|
|
|
|
blocks: Blocks(blocks),
|
|
|
|
event: self.event.unwrap_or(ShipEvent::None),
|
|
|
|
map_builder: Arc::new(self.map_builder.unwrap_or(Box::new(FreeRoamMapBuilder::new()))),
|
|
|
|
map_builder: Arc::new(self.map_builder.unwrap_or(Box::new(generate_free_roam_maps))),
|
|
|
|
drop_table_builder: Arc::new(self.drop_table_builder.unwrap_or(Box::new(DropTable::new))),
|
|
|
|
|
|
|
|
auth_token: self.auth_token.unwrap_or_else(|| AuthToken("".into())),
|
|
|
@ -518,7 +518,7 @@ pub struct ShipServerState<EG: EntityGateway + Clone + 'static> { |
|
|
|
ship_list: Arc<RwLock<Vec<Ship>>>,
|
|
|
|
shipgate_sender: Option<channel::Sender<ShipMessage>>,
|
|
|
|
trades: TradeState,
|
|
|
|
map_builder: Arc<Box<dyn MapBuilder>>,
|
|
|
|
map_builder: Arc<Box<dyn Fn(room::RoomMode, ShipEvent) -> Maps + Send + Sync>>,
|
|
|
|
drop_table_builder: Arc<Box<dyn Fn(room::Episode, room::Difficulty, SectionID) -> DropTable + Send + Sync>>,
|
|
|
|
}
|
|
|
|
|
|
|
|