veloren_rtsim/data/
architect.rs1use std::collections::VecDeque;
2
3use common::{
4 comp,
5 resources::TimeOfDay,
6 rtsim::{FactionId, Role},
7};
8use serde::{Deserialize, Serialize};
9
10use super::Npc;
11
12#[derive(Clone, Serialize, Deserialize)]
13pub struct Death {
14 pub time: TimeOfDay,
15 pub body: comp::Body,
16 pub role: Role,
17 pub faction: Option<FactionId>,
18}
19
20#[derive(Default, Clone, Serialize, Deserialize)]
28pub struct Architect {
29 pub deaths: VecDeque<Death>,
30}
31
32impl Architect {
33 pub fn on_death(&mut self, npc: &Npc, time: TimeOfDay) {
34 self.deaths.push_back(Death {
35 time,
36 body: npc.body,
37 role: npc.role.clone(),
38 faction: npc.faction,
39 })
40 }
41}