Skip to content

Commit

Permalink
fix rune example
Browse files Browse the repository at this point in the history
  • Loading branch information
makspll committed Mar 5, 2024
1 parent bb93162 commit 7e61c30
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"lua_script_api",
"rhai",
"rhai_script_api",
"teal"
"teal",
"rune"
],
"rust-analyzer.server.extraEnv": {
"RUSTUP_TOOLCHAIN": "stable"
Expand Down
9 changes: 2 additions & 7 deletions examples/rune/event_recipients.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
use bevy::asset::ChangeWatcher;
use bevy::prelude::*;
use bevy_mod_scripting::prelude::*;
use rand::prelude::SliceRandom;
use std::sync::atomic::AtomicU32;
use std::sync::atomic::Ordering::Relaxed;
use std::time::Duration;

#[derive(Clone)]
pub struct MyRuneArg(usize);
Expand Down Expand Up @@ -96,7 +94,7 @@ fn load_scripts(server: Res<AssetServer>, mut commands: Commands) {
// Spawn two identical scripts.
// Their id's will be 0 and 1.
let path = "scripts/event_recipients.rune";
let handle = server.load::<RuneFile, &str>(path);
let handle = server.load::<RuneFile>(path);
let scripts = (0..2)
.map(|_| Script::<RuneFile>::new(path.to_string(), handle.clone()))
.collect();
Expand All @@ -108,10 +106,7 @@ fn load_scripts(server: Res<AssetServer>, mut commands: Commands) {

fn main() {
App::new()
.add_plugins(DefaultPlugins.set(AssetPlugin {
watch_for_changes: ChangeWatcher::with_delay(Duration::from_secs(0)),
..Default::default()
}))
.add_plugins(DefaultPlugins)
.add_plugins(ScriptingPlugin)
.add_systems(Startup, load_scripts)
// Randomly fire events for either all scripts, the script with an id of `0`,
Expand Down

0 comments on commit 7e61c30

Please sign in to comment.