@@ -13,8 +13,13 @@ use bevy_script_api::{
1313 remote = "bevy::ecs::entity::Entity" ,
1414 functions[ r#"
1515
16- #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))]
17- fn clone(&self) -> bevy::ecs::entity::Entity;
16+ #[lua(
17+ as_trait = "std::cmp::PartialEq",
18+ kind = "MetaFunction",
19+ composite = "eq",
20+ metamethod = "Eq",
21+ )]
22+ fn eq(&self, #[proxy] other: &entity::Entity) -> bool;
1823
1924"# ,
2025 r#"
@@ -73,13 +78,8 @@ use bevy_script_api::{
7378"# ,
7479 r#"
7580
76- #[lua(
77- as_trait = "std::cmp::PartialEq",
78- kind = "MetaFunction",
79- composite = "eq",
80- metamethod = "Eq",
81- )]
82- fn eq(&self, #[proxy] other: &entity::Entity) -> bool;
81+ #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))]
82+ fn clone(&self) -> bevy::ecs::entity::Entity;
8383
8484"# ,
8585 r#"
@@ -143,17 +143,6 @@ struct OnReplace {}
143143 derive( clone) ,
144144 remote = "bevy::ecs::component::ComponentId" ,
145145 functions[ r#"
146-
147- #[lua(
148- as_trait = "std::cmp::PartialEq",
149- kind = "MetaFunction",
150- composite = "eq",
151- metamethod = "Eq",
152- )]
153- fn eq(&self, #[proxy] other: &component::ComponentId) -> bool;
154-
155- "# ,
156- r#"
157146/// Creates a new [`ComponentId`].
158147/// The `index` is a unique value associated with each type of component in a given world.
159148/// Usually, this value is taken from a counter incremented for each type of component registered with the world.
@@ -174,6 +163,17 @@ struct OnReplace {}
174163 #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))]
175164 fn clone(&self) -> bevy::ecs::component::ComponentId;
176165
166+ "# ,
167+ r#"
168+
169+ #[lua(
170+ as_trait = "std::cmp::PartialEq",
171+ kind = "MetaFunction",
172+ composite = "eq",
173+ metamethod = "Eq",
174+ )]
175+ fn eq(&self, #[proxy] other: &component::ComponentId) -> bool;
176+
177177"# ,
178178 r#"
179179
@@ -195,8 +195,8 @@ struct ComponentId();
195195 remote = "bevy::ecs::component::Tick" ,
196196 functions[ r#"
197197
198- #[lua(as_trait = "std::cmp::Eq ", kind = "Method")]
199- fn assert_receiver_is_total_eq (&self) -> () ;
198+ #[lua(as_trait = "std::clone::Clone ", kind = "Method", output(proxy) )]
199+ fn clone (&self) -> bevy::ecs::component::Tick ;
200200
201201"# ,
202202 r#"
@@ -212,8 +212,8 @@ struct ComponentId();
212212"# ,
213213 r#"
214214
215- #[lua(as_trait = "std::clone::Clone ", kind = "Method", output(proxy) )]
216- fn clone (&self) -> bevy::ecs::component::Tick ;
215+ #[lua(as_trait = "std::cmp::Eq ", kind = "Method")]
216+ fn assert_receiver_is_total_eq (&self) -> () ;
217217
218218"# ,
219219 r#"
@@ -264,12 +264,6 @@ struct Tick {}
264264 derive( clone) ,
265265 remote = "bevy::ecs::component::ComponentTicks" ,
266266 functions[ r#"
267-
268- #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))]
269- fn clone(&self) -> bevy::ecs::component::ComponentTicks;
270-
271- "# ,
272- r#"
273267/// Returns `true` if the component or resource was added after the system last ran
274268/// (or the system is running for the first time).
275269
@@ -298,17 +292,13 @@ struct Tick {}
298292
299293"# ,
300294 r#"
301- /// Returns the tick recording the time this component or resource was most recently changed.
295+ /// Creates a new instance with the same change tick for `added` and ` changed` .
302296
303- #[lua(kind = "Method", output(proxy))]
304- fn last_changed_tick(&self) -> bevy::ecs::component::Tick;
305-
306- "# ,
307- r#"
308- /// Returns the tick recording the time this component or resource was added.
309-
310- #[lua(kind = "Method", output(proxy))]
311- fn added_tick(&self) -> bevy::ecs::component::Tick;
297+ #[lua(kind = "Function", output(proxy))]
298+ fn new(
299+ #[proxy]
300+ change_tick: bevy::ecs::component::Tick,
301+ ) -> bevy::ecs::component::ComponentTicks;
312302
313303"# ,
314304 r#"
@@ -327,6 +317,12 @@ struct Tick {}
327317 #[lua(kind = "MutatingMethod")]
328318 fn set_changed(&mut self, #[proxy] change_tick: bevy::ecs::component::Tick) -> ();
329319
320+ "# ,
321+ r#"
322+
323+ #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))]
324+ fn clone(&self) -> bevy::ecs::component::ComponentTicks;
325+
330326"# ,
331327 r#"
332328#[lua(kind="MetaMethod", metamethod="ToString")]
@@ -335,19 +331,18 @@ fn index(&self) -> String {
335331}
336332"# ]
337333) ]
338- struct ComponentTicks { }
334+ struct ComponentTicks {
335+ #[ lua( output( proxy) ) ]
336+ added : bevy:: ecs:: component:: Tick ,
337+ #[ lua( output( proxy) ) ]
338+ changed : bevy:: ecs:: component:: Tick ,
339+ }
339340#[ derive( bevy_mod_scripting_lua_derive:: LuaProxy ) ]
340341#[ proxy(
341342 derive( clone) ,
342343 remote = "bevy::ecs::identifier::Identifier" ,
343344 functions[ r#"
344345
345- #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))]
346- fn clone(&self) -> bevy::ecs::identifier::Identifier;
347-
348- "# ,
349- r#"
350-
351346 #[lua(
352347 as_trait = "std::cmp::PartialEq",
353348 kind = "MetaFunction",
@@ -387,6 +382,12 @@ struct ComponentTicks {}
387382 #[lua(kind = "Function", output(proxy))]
388383 fn from_bits(value: u64) -> bevy::ecs::identifier::Identifier;
389384
385+ "# ,
386+ r#"
387+
388+ #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))]
389+ fn clone(&self) -> bevy::ecs::identifier::Identifier;
390+
390391"# ,
391392 r#"
392393#[lua(kind="MetaMethod", metamethod="ToString")]
@@ -451,6 +452,13 @@ impl bevy_mod_scripting_lua::tealr::mlu::ExportInstances for Globals {
451452 "Tick" ,
452453 bevy_mod_scripting_lua:: tealr:: mlu:: UserDataProxy :: < LuaTick > :: new,
453454 ) ?;
455+ instances
456+ . add_instance (
457+ "ComponentTicks" ,
458+ bevy_mod_scripting_lua:: tealr:: mlu:: UserDataProxy :: <
459+ LuaComponentTicks ,
460+ > :: new,
461+ ) ?;
454462 instances
455463 . add_instance (
456464 "Identifier" ,
@@ -500,6 +508,11 @@ impl bevy_mod_scripting_core::hosts::APIProvider for BevyEcsAPIProvider {
500508 bevy_mod_scripting_lua:: tealr:: mlu:: UserDataProxy < LuaTick > ,
501509 > ( )
502510 . process_type :: < LuaComponentTicks > ( )
511+ . process_type :: <
512+ bevy_mod_scripting_lua:: tealr:: mlu:: UserDataProxy <
513+ LuaComponentTicks ,
514+ > ,
515+ > ( )
503516 . process_type :: < LuaIdentifier > ( )
504517 . process_type :: <
505518 bevy_mod_scripting_lua:: tealr:: mlu:: UserDataProxy <
0 commit comments