76 lines
1.1 KiB
Rust
76 lines
1.1 KiB
Rust
use mlua::UserData;
|
|
use mlua::Lua;
|
|
use bevy::prelude::*;
|
|
|
|
use include_dir::{include_dir, Dir};
|
|
|
|
static DATA_DIR: Dir<'_> = include_dir!("data");
|
|
|
|
/*
|
|
In lieu of the old Roblox instances.
|
|
Instances, at least for the sake of bevy's design,
|
|
are helper components that also implement a lua userdata wrapper.
|
|
|
|
I'm sure storing the Entity in the component is bad practice,
|
|
but I can't find a cleaner way of integrating with Bevy's ECS like this.
|
|
*/
|
|
|
|
trait Instance: UserData {
|
|
|
|
}
|
|
|
|
struct Script {
|
|
name: String
|
|
}
|
|
|
|
impl Instance for Script {
|
|
|
|
}
|
|
|
|
struct Context {
|
|
name: String,
|
|
lua: Lua
|
|
}
|
|
|
|
impl Instance for Context {
|
|
|
|
}
|
|
|
|
struct Part {
|
|
name: String
|
|
}
|
|
|
|
impl Instance for Part {
|
|
|
|
}
|
|
|
|
struct Folder {
|
|
name: String
|
|
}
|
|
|
|
impl Instance for Folder {
|
|
|
|
}
|
|
|
|
#[derive(Component)]
|
|
enum AnyInstance {
|
|
Context(Context),
|
|
Script(Script),
|
|
Part(Part)
|
|
}
|
|
|
|
fn script_executor() {
|
|
|
|
}
|
|
|
|
fn collision_detector() {
|
|
|
|
}
|
|
|
|
pub struct DuckPlugin;
|
|
|
|
impl Plugin for DuckPlugin {
|
|
fn build(&self, app: &mut App) {
|
|
app.add_systems(Update,(script_executor,collision_detector));
|
|
}
|
|
} |