From 928f5437fc2a182f42660043028686ed25b14d05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaros=C5=82aw=20Konik?= Date: Wed, 23 Aug 2023 18:29:48 +0200 Subject: [PATCH] Apply side effects for tuple args systems (#8) * Apply side effects for tuple args systems. Deferred side effects(Commands) that were pushed in scripting exposed systems were only applied for argument-less systems. This PR fixes this by applying deferred side effects in macro that implement functions with arguments. * Bump version --- Cargo.toml | 2 +- src/callback.rs | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index fd97a21..5edbf2d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "bevy_scriptum" authors = ["Jaroslaw Konik "] -version = "0.2.1" +version = "0.2.2" edition = "2021" license = "MIT OR Apache-2.0" readme = "README.md" diff --git a/src/callback.rs b/src/callback.rs index de11a8d..47b7ce8 100644 --- a/src/callback.rs +++ b/src/callback.rs @@ -85,7 +85,9 @@ macro_rules! impl_tuple { let args = ( $(args.0.get($idx).unwrap().clone_cast::<$t>(), )+ ); - Dynamic::from(inner_system.run(args, world)) + let result = inner_system.run(args, world); + inner_system.apply_deferred(world); + Dynamic::from(result) }; let system = IntoSystem::into_system(system_fn); CallbackSystem {