summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2024-09-26 23:03:14 +0200
committermetamuffin <metamuffin@disroot.org>2024-09-26 23:03:14 +0200
commit2964f8f74efcb59ea35e6dce6f0cc08035e17a57 (patch)
tree316337dc92cb1f3a4f0289621d57e5d8bbdfc3fc
parent2031a8b9d2bf568f538cc9223713f50c77bac897 (diff)
downloadhurrycurry-2964f8f74efcb59ea35e6dce6f0cc08035e17a57.tar
hurrycurry-2964f8f74efcb59ea35e6dce6f0cc08035e17a57.tar.bz2
hurrycurry-2964f8f74efcb59ea35e6dce6f0cc08035e17a57.tar.zst
fix #173
-rw-r--r--server/bot/src/algos/customer.rs21
1 files changed, 10 insertions, 11 deletions
diff --git a/server/bot/src/algos/customer.rs b/server/bot/src/algos/customer.rs
index 64ae726f..bab82056 100644
--- a/server/bot/src/algos/customer.rs
+++ b/server/bot/src/algos/customer.rs
@@ -246,6 +246,7 @@ impl BotAlgo for Customer {
});
if let Some(pos) = demand_pos {
info!("{me:?} -> eating");
+ let points = game.data.demands[demand.0].points;
*self = Customer::Eating {
demand: *demand,
table: pos,
@@ -275,6 +276,11 @@ impl BotAlgo for Customer {
pos: Some(pos),
player: me,
},
+ PacketS::ApplyScore(Score {
+ demands_completed: 1,
+ points,
+ ..Default::default()
+ }),
PacketS::Interact {
pos: None,
player: me,
@@ -300,16 +306,6 @@ impl BotAlgo for Customer {
let demand = &game.data.demands[demand.0];
*progress += dt / demand.duration;
if *progress >= 1. {
- let mut packets = Vec::new();
- packets.push(PacketS::ReplaceHand {
- player: me,
- item: demand.output,
- });
- packets.push(PacketS::ApplyScore(Score {
- demands_completed: 1,
- points: demand.points,
- ..Default::default()
- }));
info!("{me:?} -> finishing");
*self = Customer::Finishing {
table: *table,
@@ -317,7 +313,10 @@ impl BotAlgo for Customer {
cooldown: 0.5,
};
return BotInput {
- extra: packets,
+ extra: vec![PacketS::ReplaceHand {
+ player: me,
+ item: demand.output,
+ }],
..Default::default()
};
}