veloren_rtsim/rule/
mod.rs1pub mod architect;
2pub mod cleanup;
3pub mod migrate;
4pub mod npc_ai;
5pub mod replenish_resources;
6pub mod report;
7pub mod simulate_npcs;
8pub mod sync_npcs;
9
10use super::RtState;
11use std::fmt;
12
13#[derive(Debug)]
14pub enum RuleError {
15 NoSuchRule(&'static str),
16}
17
18impl fmt::Display for RuleError {
19 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
20 match self {
21 Self::NoSuchRule(r) => {
22 write!(f, "tried to fetch rule state '{}' but it does not exist", r)
23 },
24 }
25 }
26}
27
28pub trait Rule: Sized + Send + Sync + 'static {
29 fn start(rtstate: &mut RtState) -> Result<Self, RuleError>;
30}