lotus_script/
lib.rs

1pub use lotus_bindgen_macros::lotus_bindgen;
2
3use message::Message;
4
5pub mod action;
6pub mod assets;
7pub mod content;
8#[doc(hidden)]
9pub mod event;
10pub mod font;
11pub mod gizmos;
12pub mod graphics;
13pub mod input;
14pub mod log;
15pub mod macros;
16pub mod math;
17pub mod message;
18pub mod public_vars;
19pub mod rand;
20#[doc(hidden)]
21pub mod settings;
22pub mod time;
23pub mod var;
24pub mod prelude {
25    pub use crate::action;
26    pub use crate::log;
27    pub use crate::message::{Message, MessageType};
28}
29
30pub trait Script {
31    /// Initialize the script.
32    fn init(&mut self) {}
33
34    /// Register actions.
35    fn actions() -> Vec<action::RegisterAction> {
36        Default::default()
37    }
38
39    /// Tick the script.
40    fn tick(&mut self) {}
41
42    /// Handle a message.
43    #[allow(unused_variables)]
44    fn on_message(&mut self, msg: Message) {}
45}
46
47/// Returns true if the object the script is attached to is remote controlled.
48pub fn is_rc() -> bool {
49    unsafe { lotus_script_sys::is_rc() }
50}