Create an early scripting engine #2
|
@ -206,7 +206,7 @@ async fn main() {
|
||||||
Ok(())
|
Ok(())
|
||||||
};
|
};
|
||||||
let fps_plugin = move |game: &mut Game| {
|
let fps_plugin = move |game: &mut Game| {
|
||||||
let world = game.world();
|
let world = game.world_mut();
|
||||||
world.add_resource(fps_counter::FPSCounter::new());
|
world.add_resource(fps_counter::FPSCounter::new());
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -228,7 +228,7 @@ async fn main() {
|
||||||
};
|
};
|
||||||
|
|
||||||
let jiggle_plugin = move |game: &mut Game| {
|
let jiggle_plugin = move |game: &mut Game| {
|
||||||
game.world().add_resource(TpsAccumulator(0.0));
|
game.world_mut().add_resource(TpsAccumulator(0.0));
|
||||||
|
|
||||||
let mut sys = BatchedSystem::new();
|
let mut sys = BatchedSystem::new();
|
||||||
sys.with_criteria(FixedTimestep::new(45));
|
sys.with_criteria(FixedTimestep::new(45));
|
||||||
|
@ -293,7 +293,7 @@ async fn main() {
|
||||||
Ok(())
|
Ok(())
|
||||||
}; */
|
}; */
|
||||||
|
|
||||||
let world = game.world();
|
let world = game.world_mut();
|
||||||
world.add_resource(action_handler);
|
world.add_resource(action_handler);
|
||||||
world.spawn((Vec3::new(0.5, 0.1, 3.0),));
|
world.spawn((Vec3::new(0.5, 0.1, 3.0),));
|
||||||
game.with_plugin(InputActionPlugin);
|
game.with_plugin(InputActionPlugin);
|
||||||
|
@ -303,7 +303,7 @@ async fn main() {
|
||||||
let script_test_plugin = |game: &mut Game| {
|
let script_test_plugin = |game: &mut Game| {
|
||||||
game.with_plugin(LuaScriptingPlugin);
|
game.with_plugin(LuaScriptingPlugin);
|
||||||
|
|
||||||
let world = game.world();
|
let world = game.world_mut();
|
||||||
let mut res_man = world.get_resource_mut::<ResourceManager>();
|
let mut res_man = world.get_resource_mut::<ResourceManager>();
|
||||||
let script = res_man.request::<LuaScript>("scripts/test.lua").unwrap();
|
let script = res_man.request::<LuaScript>("scripts/test.lua").unwrap();
|
||||||
res_man.watch("scripts/test.lua", false).unwrap();
|
res_man.watch("scripts/test.lua", false).unwrap();
|
||||||
|
|
|
@ -134,7 +134,7 @@ impl GameScriptExt for Game {
|
||||||
T: ScriptHost,
|
T: ScriptHost,
|
||||||
P: ScriptApiProvider<ScriptContext = T::ScriptContext> + 'static
|
P: ScriptApiProvider<ScriptContext = T::ScriptContext> + 'static
|
||||||
{
|
{
|
||||||
let world = self.world();
|
let world = self.world_mut();
|
||||||
provider.prepare_world(world);
|
provider.prepare_world(world);
|
||||||
let mut providers = world.get_resource_mut::<ScriptApiProviders<T>>();
|
let mut providers = world.get_resource_mut::<ScriptApiProviders<T>>();
|
||||||
providers.add_provider(provider);
|
providers.add_provider(provider);
|
||||||
|
|
|
@ -171,7 +171,7 @@ pub struct LuaScriptingPlugin;
|
||||||
|
|
||||||
impl Plugin for LuaScriptingPlugin {
|
impl Plugin for LuaScriptingPlugin {
|
||||||
fn setup(&self, game: &mut lyra_game::game::Game) {
|
fn setup(&self, game: &mut lyra_game::game::Game) {
|
||||||
let world = game.world();
|
let world = game.world_mut();
|
||||||
|
|
||||||
world.add_resource_default::<TypeRegistry>();
|
world.add_resource_default::<TypeRegistry>();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue