@@ -7,17 +7,38 @@ use bevy_mod_scripting_core::{
77 AddContextInitializer , StoreDocumentation ,
88 bindings:: { ReflectReference , function:: from:: { Ref , Mut , Val } } ,
99} ;
10- use crate :: * ;
10+ use crate :: { * , namespaced_register :: NamespaceBuilder } ;
1111pub struct BevyEcsScriptingPlugin ;
1212impl :: bevy:: app:: Plugin for BevyEcsScriptingPlugin {
1313 fn build ( & self , app : & mut :: bevy:: prelude:: App ) {
1414 let mut world = app. world_mut ( ) ;
1515 NamespaceBuilder :: < :: bevy:: ecs:: entity:: Entity > :: new ( world)
16+ . overwrite_script_function (
17+ "clone" ,
18+ |_self : Ref < bevy:: ecs:: entity:: Entity > | {
19+ let output: Val < bevy:: ecs:: entity:: Entity > = :: bevy:: ecs:: entity:: Entity :: clone (
20+ & _self,
21+ )
22+ . into ( ) ;
23+ output
24+ } ,
25+ )
26+ . overwrite_script_function (
27+ "eq" ,
28+ |
29+ _self : Ref < bevy:: ecs:: entity:: Entity > ,
30+ other : Ref < bevy:: ecs:: entity:: Entity > |
31+ {
32+ let output: bool = :: bevy:: ecs:: entity:: Entity :: eq ( & _self, & other)
33+ . into ( ) ;
34+ output
35+ } ,
36+ )
1637 . overwrite_script_function (
1738 "from_raw" ,
1839 |index : u32 | {
1940 let output: Val < bevy:: ecs:: entity:: Entity > = :: bevy:: ecs:: entity:: Entity :: from_raw (
20- index. into ( ) ,
41+ index,
2142 )
2243 . into ( ) ;
2344 output
@@ -35,7 +56,7 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin {
3556 "from_bits" ,
3657 |bits : u64 | {
3758 let output: Val < bevy:: ecs:: entity:: Entity > = :: bevy:: ecs:: entity:: Entity :: from_bits (
38- bits. into ( ) ,
59+ bits,
3960 )
4061 . into ( ) ;
4162 output
@@ -58,30 +79,6 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin {
5879 . into ( ) ;
5980 output
6081 } ,
61- )
62- . overwrite_script_function (
63- "eq" ,
64- |
65- _self : Ref < bevy:: ecs:: entity:: Entity > ,
66- other : Ref < bevy:: ecs:: entity:: Entity > |
67- {
68- let output: bool = :: bevy:: ecs:: entity:: Entity :: eq (
69- _self. into ( ) ,
70- other. into ( ) ,
71- )
72- . into ( ) ;
73- output
74- } ,
75- )
76- . overwrite_script_function (
77- "clone" ,
78- |_self : Ref < bevy:: ecs:: entity:: Entity > | {
79- let output: Val < bevy:: ecs:: entity:: Entity > = :: bevy:: ecs:: entity:: Entity :: clone (
80- _self. into ( ) ,
81- )
82- . into ( ) ;
83- output
84- } ,
8582 ) ;
8683 NamespaceBuilder :: < :: bevy:: ecs:: world:: OnAdd > :: new ( world) ;
8784 NamespaceBuilder :: < :: bevy:: ecs:: world:: OnInsert > :: new ( world) ;
@@ -95,8 +92,8 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin {
9592 other : Ref < bevy:: ecs:: component:: ComponentId > |
9693 {
9794 let output: bool = :: bevy:: ecs:: component:: ComponentId :: eq (
98- _self. into ( ) ,
99- other. into ( ) ,
95+ & _self,
96+ & other,
10097 )
10198 . into ( ) ;
10299 output
@@ -106,27 +103,7 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin {
106103 "clone" ,
107104 |_self : Ref < bevy:: ecs:: component:: ComponentId > | {
108105 let output: Val < bevy:: ecs:: component:: ComponentId > = :: bevy:: ecs:: component:: ComponentId :: clone (
109- _self. into ( ) ,
110- )
111- . into ( ) ;
112- output
113- } ,
114- )
115- . overwrite_script_function (
116- "new" ,
117- |index : usize | {
118- let output: Val < bevy:: ecs:: component:: ComponentId > = :: bevy:: ecs:: component:: ComponentId :: new (
119- index. into ( ) ,
120- )
121- . into ( ) ;
122- output
123- } ,
124- )
125- . overwrite_script_function (
126- "index" ,
127- |_self : Val < bevy:: ecs:: component:: ComponentId > | {
128- let output: usize = :: bevy:: ecs:: component:: ComponentId :: index (
129- _self. into ( ) ,
106+ & _self,
130107 )
131108 . into ( ) ;
132109 output
@@ -136,52 +113,38 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin {
136113 "assert_receiver_is_total_eq" ,
137114 |_self : Ref < bevy:: ecs:: component:: ComponentId > | {
138115 let output: ( ) = :: bevy:: ecs:: component:: ComponentId :: assert_receiver_is_total_eq (
139- _self. into ( ) ,
140- )
141- . into ( ) ;
142- output
143- } ,
144- ) ;
145- NamespaceBuilder :: < :: bevy:: ecs:: component:: Tick > :: new ( world)
146- . overwrite_script_function (
147- "assert_receiver_is_total_eq" ,
148- |_self : Ref < bevy:: ecs:: component:: Tick > | {
149- let output: ( ) = :: bevy:: ecs:: component:: Tick :: assert_receiver_is_total_eq (
150- _self. into ( ) ,
116+ & _self,
151117 )
152118 . into ( ) ;
153119 output
154120 } ,
155121 )
156122 . overwrite_script_function (
157- "eq" ,
158- |
159- _self : Ref < bevy:: ecs:: component:: Tick > ,
160- other : Ref < bevy:: ecs:: component:: Tick > |
161- {
162- let output: bool = :: bevy:: ecs:: component:: Tick :: eq (
163- _self. into ( ) ,
164- other. into ( ) ,
123+ "new" ,
124+ |index : usize | {
125+ let output: Val < bevy:: ecs:: component:: ComponentId > = :: bevy:: ecs:: component:: ComponentId :: new (
126+ index,
165127 )
166128 . into ( ) ;
167129 output
168130 } ,
169131 )
170132 . overwrite_script_function (
171- "clone " ,
172- |_self : Ref < bevy:: ecs:: component:: Tick > | {
173- let output: Val < bevy :: ecs :: component :: Tick > = :: bevy:: ecs:: component:: Tick :: clone (
133+ "index " ,
134+ |_self : Val < bevy:: ecs:: component:: ComponentId > | {
135+ let output: usize = :: bevy:: ecs:: component:: ComponentId :: index (
174136 _self. into ( ) ,
175137 )
176138 . into ( ) ;
177139 output
178140 } ,
179- )
141+ ) ;
142+ NamespaceBuilder :: < :: bevy:: ecs:: component:: Tick > :: new ( world)
180143 . overwrite_script_function (
181144 "new" ,
182145 |tick : u32 | {
183146 let output: Val < bevy:: ecs:: component:: Tick > = :: bevy:: ecs:: component:: Tick :: new (
184- tick. into ( ) ,
147+ tick,
185148 )
186149 . into ( ) ;
187150 output
@@ -198,10 +161,7 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin {
198161 . overwrite_script_function (
199162 "set" ,
200163 |_self : Mut < bevy:: ecs:: component:: Tick > , tick : u32 | {
201- let output: ( ) = :: bevy:: ecs:: component:: Tick :: set (
202- _self. into ( ) ,
203- tick. into ( ) ,
204- )
164+ let output: ( ) = :: bevy:: ecs:: component:: Tick :: set ( & mut_self, tick)
205165 . into ( ) ;
206166 output
207167 } ,
@@ -221,18 +181,39 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin {
221181 . into ( ) ;
222182 output
223183 } ,
224- ) ;
225- NamespaceBuilder :: < :: bevy:: ecs:: component:: ComponentTicks > :: new ( world)
184+ )
226185 . overwrite_script_function (
227- "clone" ,
228- |_self : Ref < bevy:: ecs:: component:: ComponentTicks > | {
229- let output: Val < bevy:: ecs:: component:: ComponentTicks > = :: bevy:: ecs:: component:: ComponentTicks :: clone (
230- _self. into ( ) ,
186+ "eq" ,
187+ |
188+ _self : Ref < bevy:: ecs:: component:: Tick > ,
189+ other : Ref < bevy:: ecs:: component:: Tick > |
190+ {
191+ let output: bool = :: bevy:: ecs:: component:: Tick :: eq ( & _self, & other)
192+ . into ( ) ;
193+ output
194+ } ,
195+ )
196+ . overwrite_script_function (
197+ "assert_receiver_is_total_eq" ,
198+ |_self : Ref < bevy:: ecs:: component:: Tick > | {
199+ let output: ( ) = :: bevy:: ecs:: component:: Tick :: assert_receiver_is_total_eq (
200+ & _self,
231201 )
232202 . into ( ) ;
233203 output
234204 } ,
235205 )
206+ . overwrite_script_function (
207+ "clone" ,
208+ |_self : Ref < bevy:: ecs:: component:: Tick > | {
209+ let output: Val < bevy:: ecs:: component:: Tick > = :: bevy:: ecs:: component:: Tick :: clone (
210+ & _self,
211+ )
212+ . into ( ) ;
213+ output
214+ } ,
215+ ) ;
216+ NamespaceBuilder :: < :: bevy:: ecs:: component:: ComponentTicks > :: new ( world)
236217 . overwrite_script_function (
237218 "is_added" ,
238219 |
@@ -241,7 +222,7 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin {
241222 this_run : Val < bevy:: ecs:: component:: Tick > |
242223 {
243224 let output: bool = :: bevy:: ecs:: component:: ComponentTicks :: is_added (
244- _self. into ( ) ,
225+ & _self,
245226 last_run. into ( ) ,
246227 this_run. into ( ) ,
247228 )
@@ -257,7 +238,7 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin {
257238 this_run : Val < bevy:: ecs:: component:: Tick > |
258239 {
259240 let output: bool = :: bevy:: ecs:: component:: ComponentTicks :: is_changed (
260- _self. into ( ) ,
241+ & _self,
261242 last_run. into ( ) ,
262243 this_run. into ( ) ,
263244 )
@@ -282,19 +263,29 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin {
282263 change_tick : Val < bevy:: ecs:: component:: Tick > |
283264 {
284265 let output: ( ) = :: bevy:: ecs:: component:: ComponentTicks :: set_changed (
285- _self . into ( ) ,
266+ & mut_self ,
286267 change_tick. into ( ) ,
287268 )
288269 . into ( ) ;
289270 output
290271 } ,
272+ )
273+ . overwrite_script_function (
274+ "clone" ,
275+ |_self : Ref < bevy:: ecs:: component:: ComponentTicks > | {
276+ let output: Val < bevy:: ecs:: component:: ComponentTicks > = :: bevy:: ecs:: component:: ComponentTicks :: clone (
277+ & _self,
278+ )
279+ . into ( ) ;
280+ output
281+ } ,
291282 ) ;
292283 NamespaceBuilder :: < :: bevy:: ecs:: identifier:: Identifier > :: new ( world)
293284 . overwrite_script_function (
294285 "clone" ,
295286 |_self : Ref < bevy:: ecs:: identifier:: Identifier > | {
296287 let output: Val < bevy:: ecs:: identifier:: Identifier > = :: bevy:: ecs:: identifier:: Identifier :: clone (
297- _self. into ( ) ,
288+ & _self,
298289 )
299290 . into ( ) ;
300291 output
@@ -334,7 +325,7 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin {
334325 "from_bits" ,
335326 |value : u64 | {
336327 let output: Val < bevy:: ecs:: identifier:: Identifier > = :: bevy:: ecs:: identifier:: Identifier :: from_bits (
337- value. into ( ) ,
328+ value,
338329 )
339330 . into ( ) ;
340331 output
@@ -347,8 +338,8 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin {
347338 other : Ref < bevy:: ecs:: identifier:: Identifier > |
348339 {
349340 let output: bool = :: bevy:: ecs:: identifier:: Identifier :: eq (
350- _self. into ( ) ,
351- other. into ( ) ,
341+ & _self,
342+ & other,
352343 )
353344 . into ( ) ;
354345 output
@@ -359,7 +350,7 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin {
359350 "clone" ,
360351 |_self : Ref < bevy:: ecs:: entity:: EntityHash > | {
361352 let output: Val < bevy:: ecs:: entity:: EntityHash > = :: bevy:: ecs:: entity:: EntityHash :: clone (
362- _self. into ( ) ,
353+ & _self,
363354 )
364355 . into ( ) ;
365356 output
@@ -374,7 +365,7 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin {
374365 let output: Val <
375366 bevy:: ecs:: removal_detection:: RemovedComponentEntity ,
376367 > = :: bevy:: ecs:: removal_detection:: RemovedComponentEntity :: clone (
377- _self. into ( ) ,
368+ & _self,
378369 )
379370 . into ( ) ;
380371 output
0 commit comments