aboutsummaryrefslogtreecommitdiff
path: root/server/src/entity
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2026-03-22 22:12:40 +0100
committermetamuffin <metamuffin@disroot.org>2026-03-22 22:12:40 +0100
commitfd8525e2307a7b5e356684705e8cdc9c1db1d420 (patch)
tree6946ef81015217ca6629beab48d80e60f485b948 /server/src/entity
parent9ee90635a0e6b5847c3c39293b1ebaddd344c593 (diff)
downloadhurrycurry-fd8525e2307a7b5e356684705e8cdc9c1db1d420.tar
hurrycurry-fd8525e2307a7b5e356684705e8cdc9c1db1d420.tar.bz2
hurrycurry-fd8525e2307a7b5e356684705e8cdc9c1db1d420.tar.zst
bot spawning as part of game config; /bot now only available with cheats
Diffstat (limited to 'server/src/entity')
-rw-r--r--server/src/entity/mod.rs27
1 files changed, 24 insertions, 3 deletions
diff --git a/server/src/entity/mod.rs b/server/src/entity/mod.rs
index 709028e8..b17fbfb9 100644
--- a/server/src/entity/mod.rs
+++ b/server/src/entity/mod.rs
@@ -33,8 +33,8 @@ pub mod tutorial;
use crate::{
entity::{
- ctf_minigame::CtfMinigame, demand_sink::DemandSink, pedestrians::Pedestrians,
- player_portal_pair::PlayerPortalPair, tag_minigame::TagMinigame,
+ bot::BotDriver, ctf_minigame::CtfMinigame, demand_sink::DemandSink,
+ pedestrians::Pedestrians, player_portal_pair::PlayerPortalPair, tag_minigame::TagMinigame,
},
scoreboard::ScoreboardStore,
};
@@ -44,10 +44,13 @@ use campaign::{Gate, Map};
use conveyor::Conveyor;
use customers::Customers;
use environment_effect::{EnvironmentController, EnvironmentEffectController};
+use hurrycurry_bot::algos::ALGO_CONSTRUCTORS;
use hurrycurry_data::{PrivateGamedata, entities::EntityDecl};
use hurrycurry_game_core::Game;
use hurrycurry_locale::TrError;
-use hurrycurry_protocol::{Character, GameConfig, ItemLocation, PacketC, PacketS, PlayerID};
+use hurrycurry_protocol::{
+ Character, GameConfig, ItemLocation, PacketC, PacketS, PlayerClass, PlayerID,
+};
use item_portal::ItemPortal;
use player_portal::PlayerPortal;
use std::{
@@ -187,5 +190,23 @@ pub fn construct_entity(decl: &EntityDecl) -> DynEntity {
neutral_tile,
out_tile,
} => Box::new(PlayerPortalPair::new(a, b, in_tile, neutral_tile, out_tile)),
+
+ EntityDecl::Bot { name: search_name } => {
+ let (name, cons) = ALGO_CONSTRUCTORS
+ .iter()
+ .find(|(name, _)| *name == search_name.as_str())
+ .unwrap_or(&ALGO_CONSTRUCTORS[0]);
+
+ Box::new(BotDriver::new(
+ format!("{name}-bot"),
+ Character {
+ color: 0,
+ hairstyle: 0,
+ headwear: 0,
+ },
+ PlayerClass::Bot,
+ cons,
+ ))
+ }
}
}