From 9ae92c7cdf5ea06d3fe70a14a430a58267e71c8d Mon Sep 17 00:00:00 2001 From: Mikhail <99481254+DCFApixels@users.noreply.github.com> Date: Fri, 26 Jan 2024 18:58:54 +0800 Subject: [PATCH] add Deconstruct to entlong --- src/entlong.cs | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/entlong.cs b/src/entlong.cs index 8b2a4d3..af2c556 100644 --- a/src/entlong.cs +++ b/src/entlong.cs @@ -155,9 +155,27 @@ namespace DCFApixels.DragonECS [MethodImpl(MethodImplOptions.AggressiveInlining)] public static explicit operator entlong(long a) => new entlong(a); - [MethodImpl(MethodImplOptions.AggressiveInlining)] public static explicit operator int(entlong a) => a.ID; + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public void Deconstruct(out int id, out int gen, out int world) + { +#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS + if (!IsAlive) Throw.Ent_ThrowIsNotAlive(this); +#endif + id = this.id; + gen = this.gen; + world = this.world; + } + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public void Deconstruct(out int id, out int world) + { +#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS + if (!IsAlive) Throw.Ent_ThrowIsNotAlive(this); +#endif + id = this.id; + world = this.world; + } #endregion #region Other