@@ -7,17 +7,38 @@ use bevy_mod_scripting_core::{
7
7
AddContextInitializer , StoreDocumentation ,
8
8
bindings:: { ReflectReference , function:: from:: { Ref , Mut , Val } } ,
9
9
} ;
10
- use crate :: * ;
10
+ use crate :: { * , namespaced_register :: NamespaceBuilder } ;
11
11
pub struct BevyEcsScriptingPlugin ;
12
12
impl :: bevy:: app:: Plugin for BevyEcsScriptingPlugin {
13
13
fn build ( & self , app : & mut :: bevy:: prelude:: App ) {
14
14
let mut world = app. world_mut ( ) ;
15
15
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
+ )
16
37
. overwrite_script_function (
17
38
"from_raw" ,
18
39
|index : u32 | {
19
40
let output: Val < bevy:: ecs:: entity:: Entity > = :: bevy:: ecs:: entity:: Entity :: from_raw (
20
- index. into ( ) ,
41
+ index,
21
42
)
22
43
. into ( ) ;
23
44
output
@@ -35,7 +56,7 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin {
35
56
"from_bits" ,
36
57
|bits : u64 | {
37
58
let output: Val < bevy:: ecs:: entity:: Entity > = :: bevy:: ecs:: entity:: Entity :: from_bits (
38
- bits. into ( ) ,
59
+ bits,
39
60
)
40
61
. into ( ) ;
41
62
output
@@ -58,30 +79,6 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin {
58
79
. into ( ) ;
59
80
output
60
81
} ,
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
- } ,
85
82
) ;
86
83
NamespaceBuilder :: < :: bevy:: ecs:: world:: OnAdd > :: new ( world) ;
87
84
NamespaceBuilder :: < :: bevy:: ecs:: world:: OnInsert > :: new ( world) ;
@@ -95,8 +92,8 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin {
95
92
other : Ref < bevy:: ecs:: component:: ComponentId > |
96
93
{
97
94
let output: bool = :: bevy:: ecs:: component:: ComponentId :: eq (
98
- _self. into ( ) ,
99
- other. into ( ) ,
95
+ & _self,
96
+ & other,
100
97
)
101
98
. into ( ) ;
102
99
output
@@ -106,27 +103,7 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin {
106
103
"clone" ,
107
104
|_self : Ref < bevy:: ecs:: component:: ComponentId > | {
108
105
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,
130
107
)
131
108
. into ( ) ;
132
109
output
@@ -136,52 +113,38 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin {
136
113
"assert_receiver_is_total_eq" ,
137
114
|_self : Ref < bevy:: ecs:: component:: ComponentId > | {
138
115
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,
151
117
)
152
118
. into ( ) ;
153
119
output
154
120
} ,
155
121
)
156
122
. 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,
165
127
)
166
128
. into ( ) ;
167
129
output
168
130
} ,
169
131
)
170
132
. 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 (
174
136
_self. into ( ) ,
175
137
)
176
138
. into ( ) ;
177
139
output
178
140
} ,
179
- )
141
+ ) ;
142
+ NamespaceBuilder :: < :: bevy:: ecs:: component:: Tick > :: new ( world)
180
143
. overwrite_script_function (
181
144
"new" ,
182
145
|tick : u32 | {
183
146
let output: Val < bevy:: ecs:: component:: Tick > = :: bevy:: ecs:: component:: Tick :: new (
184
- tick. into ( ) ,
147
+ tick,
185
148
)
186
149
. into ( ) ;
187
150
output
@@ -198,10 +161,7 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin {
198
161
. overwrite_script_function (
199
162
"set" ,
200
163
|_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)
205
165
. into ( ) ;
206
166
output
207
167
} ,
@@ -221,18 +181,39 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin {
221
181
. into ( ) ;
222
182
output
223
183
} ,
224
- ) ;
225
- NamespaceBuilder :: < :: bevy:: ecs:: component:: ComponentTicks > :: new ( world)
184
+ )
226
185
. 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,
231
201
)
232
202
. into ( ) ;
233
203
output
234
204
} ,
235
205
)
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)
236
217
. overwrite_script_function (
237
218
"is_added" ,
238
219
|
@@ -241,7 +222,7 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin {
241
222
this_run : Val < bevy:: ecs:: component:: Tick > |
242
223
{
243
224
let output: bool = :: bevy:: ecs:: component:: ComponentTicks :: is_added (
244
- _self. into ( ) ,
225
+ & _self,
245
226
last_run. into ( ) ,
246
227
this_run. into ( ) ,
247
228
)
@@ -257,7 +238,7 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin {
257
238
this_run : Val < bevy:: ecs:: component:: Tick > |
258
239
{
259
240
let output: bool = :: bevy:: ecs:: component:: ComponentTicks :: is_changed (
260
- _self. into ( ) ,
241
+ & _self,
261
242
last_run. into ( ) ,
262
243
this_run. into ( ) ,
263
244
)
@@ -282,19 +263,29 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin {
282
263
change_tick : Val < bevy:: ecs:: component:: Tick > |
283
264
{
284
265
let output: ( ) = :: bevy:: ecs:: component:: ComponentTicks :: set_changed (
285
- _self . into ( ) ,
266
+ & mut_self ,
286
267
change_tick. into ( ) ,
287
268
)
288
269
. into ( ) ;
289
270
output
290
271
} ,
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
+ } ,
291
282
) ;
292
283
NamespaceBuilder :: < :: bevy:: ecs:: identifier:: Identifier > :: new ( world)
293
284
. overwrite_script_function (
294
285
"clone" ,
295
286
|_self : Ref < bevy:: ecs:: identifier:: Identifier > | {
296
287
let output: Val < bevy:: ecs:: identifier:: Identifier > = :: bevy:: ecs:: identifier:: Identifier :: clone (
297
- _self. into ( ) ,
288
+ & _self,
298
289
)
299
290
. into ( ) ;
300
291
output
@@ -334,7 +325,7 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin {
334
325
"from_bits" ,
335
326
|value : u64 | {
336
327
let output: Val < bevy:: ecs:: identifier:: Identifier > = :: bevy:: ecs:: identifier:: Identifier :: from_bits (
337
- value. into ( ) ,
328
+ value,
338
329
)
339
330
. into ( ) ;
340
331
output
@@ -347,8 +338,8 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin {
347
338
other : Ref < bevy:: ecs:: identifier:: Identifier > |
348
339
{
349
340
let output: bool = :: bevy:: ecs:: identifier:: Identifier :: eq (
350
- _self. into ( ) ,
351
- other. into ( ) ,
341
+ & _self,
342
+ & other,
352
343
)
353
344
. into ( ) ;
354
345
output
@@ -359,7 +350,7 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin {
359
350
"clone" ,
360
351
|_self : Ref < bevy:: ecs:: entity:: EntityHash > | {
361
352
let output: Val < bevy:: ecs:: entity:: EntityHash > = :: bevy:: ecs:: entity:: EntityHash :: clone (
362
- _self. into ( ) ,
353
+ & _self,
363
354
)
364
355
. into ( ) ;
365
356
output
@@ -374,7 +365,7 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin {
374
365
let output: Val <
375
366
bevy:: ecs:: removal_detection:: RemovedComponentEntity ,
376
367
> = :: bevy:: ecs:: removal_detection:: RemovedComponentEntity :: clone (
377
- _self. into ( ) ,
368
+ & _self,
378
369
)
379
370
. into ( ) ;
380
371
output
0 commit comments