Skip to main content

nil_payload/request/cheat/
npc.rs

1// Copyright (C) Call of Nil contributors
2// SPDX-License-Identifier: AGPL-3.0-only
3
4use bon::Builder;
5use nil_core::ethic::Ethics;
6use nil_core::infrastructure::Infrastructure;
7use nil_core::npc::bot::BotId;
8use nil_core::ruler::Ruler;
9use nil_core::world::config::WorldId;
10use serde::{Deserialize, Serialize};
11
12#[derive(Builder, Clone, Debug, Deserialize, Serialize)]
13#[serde(rename_all = "camelCase")]
14#[cfg_attr(feature = "typescript", derive(ts_rs::TS))]
15#[cfg_attr(feature = "typescript", ts(export))]
16pub struct CheatGetEthicsRequest {
17  #[builder(start_fn, into)]
18  pub world: WorldId,
19  #[builder(into)]
20  pub ruler: Ruler,
21}
22
23#[derive(Builder, Clone, Debug, Deserialize, Serialize)]
24#[serde(rename_all = "camelCase")]
25#[cfg_attr(feature = "typescript", derive(ts_rs::TS))]
26#[cfg_attr(feature = "typescript", ts(export, optional_fields = nullable))]
27pub struct CheatSetBotEthicsRequest {
28  #[builder(start_fn, into)]
29  pub world: WorldId,
30  #[builder(into)]
31  pub id: BotId,
32  #[serde(default)]
33  #[builder(into)]
34  pub ethics: Option<Ethics>,
35}
36
37#[derive(Builder, Clone, Debug, Deserialize, Serialize)]
38#[serde(rename_all = "camelCase")]
39#[cfg_attr(feature = "typescript", derive(ts_rs::TS))]
40#[cfg_attr(feature = "typescript", ts(export, optional_fields = nullable))]
41pub struct CheatSpawnBotRequest {
42  #[builder(start_fn, into)]
43  pub world: WorldId,
44  #[builder(into)]
45  pub name: String,
46  #[serde(default)]
47  pub infrastructure: Option<Infrastructure>,
48}