nil_core/world/cheat/
npc.rs1use crate::bail_if_cheats_are_not_allowed;
5use crate::error::Result;
6use crate::ethic::Ethics;
7use crate::infrastructure::Infrastructure;
8use crate::npc::bot::BotId;
9use crate::ruler::Ruler;
10use crate::world::World;
11
12pub fn get_ethics(world: &World, ruler: &Ruler) -> Result<Option<Ethics>> {
13 bail_if_cheats_are_not_allowed!(world);
14 world.get_ethics(ruler)
15}
16
17pub fn set_bot_ethics(world: &mut World, id: &BotId, ethics: Ethics) -> Result<()> {
18 bail_if_cheats_are_not_allowed!(world);
19 *world.bot_mut(id)?.ethics_mut() = ethics;
20 Ok(())
21}
22
23pub fn spawn_bot(
24 world: &mut World,
25 name: impl Into<BotId>,
26 infrastructure: Infrastructure,
27) -> Result<BotId> {
28 bail_if_cheats_are_not_allowed!(world);
29 world.spawn_bot(name, infrastructure)
30}