aboutsummaryrefslogtreecommitdiff
path: root/server/bot/src
diff options
context:
space:
mode:
Diffstat (limited to 'server/bot/src')
-rw-r--r--server/bot/src/algos/customer.rs13
1 files changed, 11 insertions, 2 deletions
diff --git a/server/bot/src/algos/customer.rs b/server/bot/src/algos/customer.rs
index 0c38c79d..64ae726f 100644
--- a/server/bot/src/algos/customer.rs
+++ b/server/bot/src/algos/customer.rs
@@ -285,7 +285,7 @@ impl BotAlgo for Customer {
}
}
BotInput {
- direction: (chair.as_vec2() + 0.5) - pos + *facing * 0.3,
+ direction: dir_input(pos, *chair, *facing),
..Default::default()
}
}
@@ -322,7 +322,7 @@ impl BotAlgo for Customer {
};
}
BotInput {
- direction: (chair.as_vec2() + 0.5) - pos + (*table - *chair).as_vec2() * 0.3,
+ direction: dir_input(pos, *chair, (*table - *chair).as_vec2()),
..Default::default()
}
}
@@ -380,3 +380,12 @@ impl BotAlgo for Customer {
}
}
}
+
+fn dir_input(pos: Vec2, target: IVec2, facing: Vec2) -> Vec2 {
+ let diff = (target.as_vec2() + 0.5) - pos;
+ (if diff.length() > 0.3 {
+ diff.normalize()
+ } else {
+ diff * 0.5
+ }) + facing.clamp_length_max(1.) * 0.3
+}