2023-04-05 22:24:16 +00:00
|
|
|
use crate::{RtState, Rule};
|
|
|
|
use common::{
|
2023-06-03 22:14:18 +00:00
|
|
|
mounting::VolumePos,
|
2023-04-05 22:24:16 +00:00
|
|
|
resources::{Time, TimeOfDay},
|
2023-10-03 12:23:47 +00:00
|
|
|
rtsim::{Actor, NpcId},
|
2023-04-05 22:24:16 +00:00
|
|
|
};
|
2023-04-06 17:25:33 +00:00
|
|
|
use vek::*;
|
2022-09-03 09:47:18 +00:00
|
|
|
use world::{IndexRef, World};
|
2022-08-09 23:02:56 +00:00
|
|
|
|
|
|
|
pub trait Event: Clone + 'static {}
|
|
|
|
|
2022-08-11 14:44:57 +00:00
|
|
|
pub struct EventCtx<'a, R: Rule, E: Event> {
|
|
|
|
pub state: &'a RtState,
|
|
|
|
pub rule: &'a mut R,
|
|
|
|
pub event: &'a E,
|
|
|
|
pub world: &'a World,
|
|
|
|
pub index: IndexRef<'a>,
|
|
|
|
}
|
|
|
|
|
2022-08-09 23:02:56 +00:00
|
|
|
#[derive(Clone)]
|
2022-08-11 14:44:57 +00:00
|
|
|
pub struct OnSetup;
|
|
|
|
impl Event for OnSetup {}
|
2022-08-09 23:02:56 +00:00
|
|
|
|
2022-08-11 14:44:57 +00:00
|
|
|
#[derive(Clone)]
|
2022-08-11 20:54:35 +00:00
|
|
|
pub struct OnTick {
|
2022-08-14 14:20:22 +00:00
|
|
|
pub time_of_day: TimeOfDay,
|
|
|
|
pub time: Time,
|
2023-04-05 15:32:54 +00:00
|
|
|
pub tick: u64,
|
2022-08-11 20:54:35 +00:00
|
|
|
pub dt: f32,
|
|
|
|
}
|
2022-08-09 23:02:56 +00:00
|
|
|
impl Event for OnTick {}
|
2023-01-05 23:15:43 +00:00
|
|
|
|
|
|
|
#[derive(Clone)]
|
|
|
|
pub struct OnDeath {
|
2023-04-05 22:24:16 +00:00
|
|
|
pub actor: Actor,
|
2023-04-06 17:25:33 +00:00
|
|
|
pub wpos: Option<Vec3<f32>>,
|
2023-04-05 22:24:16 +00:00
|
|
|
pub killer: Option<Actor>,
|
2023-01-05 23:15:43 +00:00
|
|
|
}
|
|
|
|
impl Event for OnDeath {}
|
2023-06-03 22:14:18 +00:00
|
|
|
|
|
|
|
#[derive(Clone)]
|
|
|
|
pub struct OnMountVolume {
|
|
|
|
pub actor: Actor,
|
2023-10-03 12:23:47 +00:00
|
|
|
pub pos: VolumePos<NpcId>,
|
2023-06-03 22:14:18 +00:00
|
|
|
}
|
|
|
|
impl Event for OnMountVolume {}
|