2023-04-06 17:25:33 +00:00
|
|
|
pub mod cleanup;
|
2023-04-05 12:57:41 +00:00
|
|
|
pub mod migrate;
|
2022-09-03 09:47:18 +00:00
|
|
|
pub mod npc_ai;
|
2023-01-06 01:16:15 +00:00
|
|
|
pub mod replenish_resources;
|
2023-04-06 17:25:33 +00:00
|
|
|
pub mod report;
|
2022-08-11 14:44:57 +00:00
|
|
|
pub mod simulate_npcs;
|
2023-04-05 12:57:41 +00:00
|
|
|
pub mod sync_npcs;
|
2022-08-09 23:02:56 +00:00
|
|
|
|
|
|
|
use super::RtState;
|
2022-09-03 09:47:18 +00:00
|
|
|
use std::fmt;
|
2022-08-09 23:02:56 +00:00
|
|
|
|
|
|
|
#[derive(Debug)]
|
|
|
|
pub enum RuleError {
|
|
|
|
NoSuchRule(&'static str),
|
|
|
|
}
|
|
|
|
|
|
|
|
impl fmt::Display for RuleError {
|
|
|
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
|
|
|
match self {
|
2022-09-03 09:47:18 +00:00
|
|
|
Self::NoSuchRule(r) => {
|
|
|
|
write!(f, "tried to fetch rule state '{}' but it does not exist", r)
|
|
|
|
},
|
2022-08-09 23:02:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pub trait Rule: Sized + Send + Sync + 'static {
|
|
|
|
fn start(rtstate: &mut RtState) -> Result<Self, RuleError>;
|
|
|
|
}
|