diff --git a/src/Immersion/Program.cs b/src/Immersion/Program.cs index 4a0109f..78804e0 100644 --- a/src/Immersion/Program.cs +++ b/src/Immersion/Program.cs @@ -23,8 +23,8 @@ var universe = new Universe(); var world = universe.World; // TODO: Figure out a nice way to get rid of "compile errors" here. +// FIXME: universe.Modules.Register(); universe.Modules.Register(); -universe.Modules.Register(); var window = Window.Create(WindowOptions.Default with { Title = "gæmstone", @@ -34,8 +34,8 @@ var window = Window.Create(WindowOptions.Default with { window.Initialize(); window.Center(); -// universe.Modules.Register(); -// universe.Modules.Register(); +// universe.Modules.Register(); +// universe.Modules.Register(); universe.Modules.Register(); universe.Modules.Register(); diff --git a/src/gaemstone.Client/Systems/InputManager.cs b/src/gaemstone.Client/Systems/InputManager.cs index f35b5d1..76a4430 100644 --- a/src/gaemstone.Client/Systems/InputManager.cs +++ b/src/gaemstone.Client/Systems/InputManager.cs @@ -109,11 +109,18 @@ public partial class InputManager { entity.GetMut() = current; if (current >= ActivationThreshold) { - ref var active = ref entity.GetRefOrNull(); - if (Unsafe.IsNullRef(ref active)) { + // TODO: Find out why using GetRefOrNull here crashes. + if (entity.Has()) { + entity.GetMut().Duration += delta; + } else { entity.Set(new Active()); entity.Add(); - } else active.Duration += delta; + } + // ref var active = ref entity.GetRefOrNull(); + // if (Unsafe.IsNullRef(ref active)) { + // entity.Set(new Active()); + // entity.Add(); + // } else active.Duration += delta; } else if (current <= DeactivationThreshold) entity.Remove(); } @@ -123,11 +130,17 @@ public partial class InputManager entity.GetMut() = current; var magnitude = current.Length(); if (magnitude >= ActivationThreshold) { - ref var active = ref entity.GetRefOrNull(); - if (Unsafe.IsNullRef(ref active)) { + if (entity.Has()) { + entity.GetMut().Duration += delta; + } else { entity.Set(new Active()); entity.Add(); - } else active.Duration += delta; + } + // ref var active = ref entity.GetRefOrNull(); + // if (Unsafe.IsNullRef(ref active)) { + // entity.Set(new Active()); + // entity.Add(); + // } else active.Duration += delta; } else if (magnitude <= DeactivationThreshold) entity.Remove(); } @@ -138,12 +151,12 @@ public partial class InputManager // public static void OnActiveAdded(EntityRef entity, Active _) // => entity.Add(); - [Observer] - public static void OnActiveRemoved(Entity entity, Active _) - => entity.Add(); + // [Observer] + // public static void OnActiveRemoved(Entity entity, Active _) + // => entity.Add(); - [System] - [DependsOn] - public static void ClearDeActivated(Entity entity, Has> _) - => entity.Remove().Remove(); + // [System] + // [DependsOn] + // public static void ClearDeActivated(Entity entity, Has> _) + // => entity.Remove().Remove(); } diff --git a/src/gaemstone.ECS b/src/gaemstone.ECS index 9eade0a..eec968d 160000 --- a/src/gaemstone.ECS +++ b/src/gaemstone.ECS @@ -1 +1 @@ -Subproject commit 9eade0adb1200223dffcb2077ecbc992569f4080 +Subproject commit eec968d6361930eebad180f6300d126c4bac70f3 diff --git a/src/gaemstone/Flecs/Core.cs b/src/gaemstone/Flecs/Core.cs index 8cc95ed..649ebf7 100644 --- a/src/gaemstone/Flecs/Core.cs +++ b/src/gaemstone/Flecs/Core.cs @@ -7,35 +7,22 @@ public partial class Core { // Entity Tags - [Tag] public struct Name { } - [Tag] public struct Symbol { } - [Tag] public struct Alias { } - [Tag] public struct Module { } + [Tag] public struct Private { } [Tag] public struct Prefab { } - [Tag] public struct SlotOf { } [Tag] public struct Disabled { } - [Tag] public struct Empty { } - - - // Entities - - [Entity, Path("*")] public struct Wildcard { } - [Entity, Path("_")] public struct Any { } - [Entity] public struct This { } - [Entity, Path("$")] public struct Variable { } - [Entity] public struct Flag { } - - // Entity Relationships - - [Relation, Tag] public struct IsA { } - [Relation, Tag] public struct ChildOf { } - [Relation, Tag] public struct DependsOn { } + [Tag] public struct SlotOf { } + [Tag] public struct Flag { } // Component / Relationship Properties + [Entity, Path("*")] public struct Wildcard { } + [Entity, Path("_")] public struct Any { } + [Entity, Path("this")] public struct This { } + [Entity, Path("$")] public struct Variable { } + [Tag] public struct Transitive { } [Tag] public struct Reflexive { } [Tag] public struct Symmetric { } @@ -45,16 +32,34 @@ public partial class Core [Tag] public struct Union { } [Tag] public struct Exclusive { } [Tag] public struct Acyclic { } + [Tag] public struct Traversable { } [Relation, Tag] public struct With { } [Tag] public struct OneOf { } + // Entity Relationships + + [Relation, Tag] public struct ChildOf { } + [Relation, Tag] public struct IsA { } + [Relation, Tag] public struct DependsOn { } + + + // Identifier Tags + + [Tag] public struct Name { } + [Tag] public struct Symbol { } + [Tag] public struct Alias { } + + // Observer Events [Entity] public struct OnAdd { } [Entity] public struct OnRemove { } [Entity] public struct OnSet { } [Entity] public struct UnSet { } + + [Entity] public struct OnTableCreate { } + [Entity] public struct OnTableDelete { } [Entity] public struct OnTableEmpty { } [Entity] public struct OnTableFilled { }