aboutsummaryrefslogtreecommitdiff
path: root/server/src/game.rs
diff options
context:
space:
mode:
Diffstat (limited to 'server/src/game.rs')
-rw-r--r--server/src/game.rs16
1 files changed, 7 insertions, 9 deletions
diff --git a/server/src/game.rs b/server/src/game.rs
index 7609b965..e8d307db 100644
--- a/server/src/game.rs
+++ b/server/src/game.rs
@@ -18,7 +18,7 @@
use crate::{
customer::DemandState,
data::Gamedata,
- entity::{construct_entity, DynEntity},
+ entity::{Entity, EntityT},
interaction::{interact, tick_slot, InteractEffect, TickEffect},
protocol::{
ItemIndex, ItemLocation, Message, PacketC, PacketS, PlayerID, RecipeIndex, TileIndex,
@@ -69,7 +69,7 @@ pub struct Game {
packet_out: VecDeque<PacketC>,
demand: Option<DemandState>,
pub points: i64,
- entities: Vec<DynEntity>,
+ entities: Vec<Entity>,
end: Option<Instant>,
}
@@ -117,12 +117,7 @@ impl Game {
self.data = gamedata.into();
self.points = 0;
self.end = timer.map(|dur| Instant::now() + dur);
- self.entities = self
- .data
- .entities
- .iter()
- .map(|decl| construct_entity(decl))
- .collect();
+ self.entities = self.data.entities.clone();
for (&p, (tile, item)) in &self.data.initial_map {
self.tiles.insert(
@@ -364,6 +359,7 @@ impl Game {
None,
&mut self.packet_out,
&mut self.points,
+ false,
)
} else {
let player = self
@@ -381,6 +377,7 @@ impl Game {
Some(tile.kind),
&mut self.packet_out,
&mut self.points,
+ false,
)
}
}
@@ -523,11 +520,12 @@ pub fn interact_effect(
this_tile_kind: Option<TileIndex>,
packet_out: &mut VecDeque<PacketC>,
points: &mut i64,
+ automated: bool,
) {
let this_had_item = this.is_some();
let other_had_item = other.is_some();
- if let Some(effect) = interact(&data, edge, this_tile_kind, this, other, points) {
+ if let Some(effect) = interact(&data, edge, this_tile_kind, this, other, points, automated) {
match effect {
InteractEffect::Put => packet_out.push_back(PacketC::MoveItem {
from: other_loc,