Skip to main content

mittens_engine/engine/ecs/component/
option.rs

1use crate::engine::ecs::{ComponentId, component::Component};
2
3#[derive(Debug, Clone, Default)]
4pub struct OptionComponent {
5    component: Option<ComponentId>,
6}
7
8impl OptionComponent {
9    pub fn new() -> Self {
10        Self { component: None }
11    }
12}
13
14impl Component for OptionComponent {
15    fn set_id(&mut self, id: ComponentId) {
16        self.component = Some(id);
17    }
18
19    fn name(&self) -> &'static str {
20        "option"
21    }
22
23    fn as_any(&self) -> &dyn std::any::Any {
24        self
25    }
26
27    fn as_any_mut(&mut self) -> &mut dyn std::any::Any {
28        self
29    }
30
31    fn to_mms_ast(
32        &self,
33        _world: &crate::engine::ecs::World,
34    ) -> crate::scripting::ast::ComponentExpression {
35        use crate::engine::ecs::component::ce_helpers::*;
36        ce_call("Option", "", vec![])
37    }
38}