aboutsummaryrefslogtreecommitdiff
path: root/server/bot/src/algos/customer.rs
diff options
context:
space:
mode:
Diffstat (limited to 'server/bot/src/algos/customer.rs')
-rw-r--r--server/bot/src/algos/customer.rs16
1 files changed, 9 insertions, 7 deletions
diff --git a/server/bot/src/algos/customer.rs b/server/bot/src/algos/customer.rs
index 043e5358..cb5c5b59 100644
--- a/server/bot/src/algos/customer.rs
+++ b/server/bot/src/algos/customer.rs
@@ -134,15 +134,17 @@ impl CustomerState {
let check = *ticks % 10 == 0;
if path.is_done() {
let demand = DemandIndex(random::<u32>() as usize % game.data.demands.len());
+ let requested_item = game.data.demands[demand.0].input;
info!("{me:?} -> waiting");
let timeout = 90. + random::<f32>() * 60.;
let mut facing = Vec2::ZERO;
for off in [IVec2::NEG_X, IVec2::NEG_Y, IVec2::X, IVec2::Y] {
- if game
- .tiles
- .get(&(off + *chair))
- .is_some_and(|t| game.data.is_tile_interactable(t.kind))
- {
+ if game.tiles.get(&(off + *chair)).is_some_and(|t| {
+ game.data
+ .tile_placeable_items
+ .get(&t.kind)
+ .map_or(true, |p| p.contains(&requested_item))
+ }) {
facing = off.as_vec2();
}
}
@@ -158,9 +160,9 @@ impl CustomerState {
let message_item = if config.unknown_order {
game.data
.get_item_by_name("unknown-order")
- .unwrap_or(game.data.demands[demand.0].input)
+ .unwrap_or(requested_item)
} else {
- game.data.demands[demand.0].input
+ requested_item
};
BotInput {
extra: vec![PacketS::Communicate {