@@ -9,16 +9,17 @@ use crate::{
9
9
use bevy:: {
10
10
app:: { App , PreUpdate } ,
11
11
asset:: { Asset , AssetEvent , AssetId , AssetLoader , AssetPath , Assets } ,
12
- ecs :: system :: Resource ,
12
+ prelude :: Resource ,
13
13
log:: { debug, info, trace, warn} ,
14
14
prelude:: {
15
- Commands , Event , EventReader , EventWriter , IntoSystemConfigs , IntoSystemSetConfigs , Res ,
15
+ Commands , Event , EventReader , EventWriter , Res ,
16
16
ResMut ,
17
17
} ,
18
18
reflect:: TypePath ,
19
- utils :: hashbrown :: HashMap ,
19
+ platform :: collections :: HashMap ,
20
20
} ;
21
21
use std:: borrow:: Cow ;
22
+ use bevy:: prelude:: IntoScheduleConfigs ;
22
23
23
24
/// Represents a scripting language. Languages which compile into another language should use the target language as their language.
24
25
#[ derive( Debug , Clone , PartialEq , Eq , PartialOrd , Ord , Default ) ]
@@ -142,7 +143,7 @@ impl Default for ScriptAssetSettings {
142
143
fn default ( ) -> Self {
143
144
Self {
144
145
script_id_mapper : AssetPathToScriptIdMapper {
145
- map : ( |path : & AssetPath | path. path ( ) . to_string_lossy ( ) . into_owned ( ) . into ( ) ) ,
146
+ map : |path : & AssetPath | path. path ( ) . to_string_lossy ( ) . into_owned ( ) . into ( ) ,
146
147
} ,
147
148
extension_to_language_map : HashMap :: from_iter ( vec ! [
148
149
( "lua" , Language :: Lua ) ,
@@ -231,7 +232,7 @@ pub(crate) fn dispatch_script_asset_events(
231
232
language,
232
233
} ;
233
234
debug ! ( "Script loaded, populating metadata: {:?}:" , metadata) ;
234
- script_asset_events. send ( ScriptAssetEvent :: Added ( metadata. clone ( ) ) ) ;
235
+ script_asset_events. write ( ScriptAssetEvent :: Added ( metadata. clone ( ) ) ) ;
235
236
metadata_store. insert ( * id, metadata) ;
236
237
} else {
237
238
warn ! ( "A script was added but it's asset was not found, failed to compute metadata. This script will not be loaded. Did you forget to store `Handle<ScriptAsset>` somewhere?. {}" , id) ;
@@ -241,15 +242,15 @@ pub(crate) fn dispatch_script_asset_events(
241
242
AssetEvent :: Removed { id } => {
242
243
if let Some ( metadata) = metadata_store. get ( * id) {
243
244
debug ! ( "Script removed: {:?}" , metadata) ;
244
- script_asset_events. send ( ScriptAssetEvent :: Removed ( metadata. clone ( ) ) ) ;
245
+ script_asset_events. write ( ScriptAssetEvent :: Removed ( metadata. clone ( ) ) ) ;
245
246
} else {
246
247
warn ! ( "Script metadata not found for removed script asset: {}. Cannot properly clean up script" , id) ;
247
248
}
248
249
}
249
250
AssetEvent :: Modified { id } => {
250
251
if let Some ( metadata) = metadata_store. get ( * id) {
251
252
debug ! ( "Script modified: {:?}" , metadata) ;
252
- script_asset_events. send ( ScriptAssetEvent :: Modified ( metadata. clone ( ) ) ) ;
253
+ script_asset_events. write ( ScriptAssetEvent :: Modified ( metadata. clone ( ) ) ) ;
253
254
} else {
254
255
warn ! ( "Script metadata not found for modified script asset: {}. Cannot properly update script" , id) ;
255
256
}
@@ -572,9 +573,9 @@ mod tests {
572
573
struct DummyPlugin ;
573
574
574
575
impl IntoScriptPluginParams for DummyPlugin {
575
- type R = ( ) ;
576
- type C = ( ) ;
577
576
const LANGUAGE : Language = Language :: Lua ;
577
+ type C = ( ) ;
578
+ type R = ( ) ;
578
579
579
580
fn build_runtime ( ) -> Self :: R { }
580
581
}
0 commit comments