diff --git a/Package/build/Polonium.targets b/Package/build/Polonium.targets index d7ec3f6..c16770c 100644 --- a/Package/build/Polonium.targets +++ b/Package/build/Polonium.targets @@ -40,9 +40,13 @@ - + diff --git a/Package/build/editorconfig b/Package/build/editorconfig new file mode 100644 index 0000000..3662e2f --- /dev/null +++ b/Package/build/editorconfig @@ -0,0 +1,2 @@ +[embedded/*] +generated_code = true diff --git a/Package/embedded/Patches/GlobalRegistry.p.cs b/Package/embedded/Patches/GlobalRegistry.p.cs index ee28e05..0d6d66e 100644 --- a/Package/embedded/Patches/GlobalRegistry.p.cs +++ b/Package/embedded/Patches/GlobalRegistry.p.cs @@ -45,7 +45,6 @@ public static partial class GlobalRegistry } public static PoloniumRegistry PoloniumRegistry => PoloniumRegistry.Instance; public static bool Paused { get; set; } - public static HashSet TimeConsumers { get; } = []; public static void Prepare() => PoloniumRegistry.Prepare(); // ReSharper disable once PartialTypeWithSinglePart diff --git a/Polonium.csproj b/Polonium.csproj index 6e1222f..28556b7 100644 --- a/Polonium.csproj +++ b/Polonium.csproj @@ -24,17 +24,25 @@ TemplateDirectory="$(ProjectDir)Package/embedded/polonium_templates" AttributeName="ProxyNode" /> + + - - + + + + + diff --git a/src/Attributes/RegistryPassThrough.cs b/src/Attributes/RegistryPassThrough.cs new file mode 100644 index 0000000..9da061a --- /dev/null +++ b/src/Attributes/RegistryPassThrough.cs @@ -0,0 +1,6 @@ +namespace Polonium.Attributes; +[AttributeUsage(AttributeTargets.Property)] +public class RegistryPassThrough(bool getterOnly = false) : Attribute +{ + public bool GetterOnly { get; set; } = getterOnly; +} \ No newline at end of file diff --git a/src/PoloniumRegistry.cs b/src/PoloniumRegistry.cs index 5298889..d3dd4d3 100644 --- a/src/PoloniumRegistry.cs +++ b/src/PoloniumRegistry.cs @@ -1,5 +1,6 @@ using Godot; using Polonium.Agents; +using Polonium.Attributes; using Polonium.Interfaces; using Polonium.Resources; @@ -9,16 +10,22 @@ public class PoloniumRegistry { private static PoloniumRegistry InternalInstance { get; set; } public static PoloniumRegistry Instance => InternalInstance ??= new PoloniumRegistry(); + [RegistryPassThrough] public Config Config { get; set; } + [RegistryPassThrough] public Save Save { get; set; } public static void Prepare() { DirAccess.MakeDirAbsolute("user://saves"); } - public Dictionary Agents { get; set; } = new(); + // ReSharper disable once CollectionNeverQueried.Global + [RegistryPassThrough(true)] + public Dictionary Agents { get; } = new(); - public HashSet TimeConsumers { get; set; } = new(); + // ReSharper disable once CollectionNeverQueried.Global + [RegistryPassThrough(true)] + public HashSet TimeConsumers { get; } = new(); } \ No newline at end of file