veloren_common/comp/
misc.rs1use crate::resources::{Secs, Time};
2use serde::{Deserialize, Serialize};
3use specs::{Component, DerefFlaggedStorage};
4use std::time::Duration;
5use vek::Vec3;
6
7#[derive(Copy, Clone, Debug, PartialEq, Serialize, Deserialize)]
8pub enum Object {
9 DeleteAfter {
10 spawned_at: Time,
11 timeout: Duration,
12 },
13 Portal {
14 target: Vec3<f32>,
15 requires_no_aggro: bool,
16 buildup_time: Secs,
17 },
18}
19
20impl Component for Object {
21 type Storage = DerefFlaggedStorage<Self, specs::VecStorage<Self>>;
22}
23
24#[derive(Clone, Debug)]
25pub struct PortalData {
26 pub target: Vec3<f32>,
27 pub requires_no_aggro: bool,
28 pub buildup_time: Secs,
29}
30
31impl From<PortalData> for Object {
32 fn from(
33 PortalData {
34 target,
35 requires_no_aggro,
36 buildup_time,
37 }: PortalData,
38 ) -> Self {
39 Self::Portal {
40 target,
41 requires_no_aggro,
42 buildup_time,
43 }
44 }
45}