{"TotalCount":22,"Files":[{"Ident":"wizards.wackylib","Path":"Code/Extensions/TraceExtensions.cs","FileName":"TraceExtensions.cs","PackageType":"library","CodeKind":"Game","AssetVersionId":307445,"IsPrivate":false,"Code":"using System.Collections.Generic;\r\n\r\nnamespace Sandbox;\r\n\r\npublic static class TraceExtensions\r\n{\r\n\textension( SceneTrace trace )\r\n\t{\r\n\t\t/// \u003Csummary\u003E\r\n\t\t/// Performs a ray trace along the given ray for the specified distance,\r\n\t\t/// returning only the first hit.\r\n\t\t/// \u003C/summary\u003E\r\n\t\t/// \u003Cparam name=\u0022ray\u0022\u003EThe ray to trace along.\u003C/param\u003E\r\n\t\t/// \u003Cparam name=\u0022distance\u0022\u003EHow far the ray should travel.\u003C/param\u003E\r\n\t\t/// \u003Cparam name=\u0022withTags\u0022\u003EOptional tags to restrict the trace to objects that have any of these tags.\u003C/param\u003E\r\n\t\t/// \u003Creturns\u003EResult of the trace.\u003C/returns\u003E\r\n\t\tpublic SceneTraceResult RunRayTrace( Ray ray, float distance = 100f, params string[] withTags )\r\n\t\t{\r\n\t\t\treturn trace.Ray( ray, distance )\r\n\t\t\t\t.WithAnyTags( withTags )\r\n\t\t\t\t.Run();\r\n\t\t}\r\n\t\t\r\n\t\t/// \u003Csummary\u003E\r\n\t\t/// Performs a ray trace along the given ray for the specified distance,\r\n\t\t/// returning all hits along the ray.\r\n\t\t/// \u003C/summary\u003E\r\n\t\t/// \u003Cparam name=\u0022ray\u0022\u003EThe ray to trace along.\u003C/param\u003E\r\n\t\t/// \u003Cparam name=\u0022distance\u0022\u003EHow far the ray should travel.\u003C/param\u003E\r\n\t\t/// \u003Cparam name=\u0022withTags\u0022\u003EOptional tags to restrict the trace to objects that have any of these tags.\u003C/param\u003E\r\n\t\t/// \u003Creturns\u003EAll results of the trace in order along the ray.\u003C/returns\u003E\r\n\t\tpublic IEnumerable\u003CSceneTraceResult\u003E RunAllRayTrace( Ray ray, float distance = 100f, params string[] withTags )\r\n\t\t{\r\n\t\t\treturn trace.Ray( ray, distance )\r\n\t\t\t\t.WithAnyTags( withTags )\r\n\t\t\t\t.RunAll();\r\n\t\t}\r\n\t}\r\n}\r\n"},{"Ident":"wizards.wackylib","Path":"Code/Patterns/Singleton/Singleton.cs","FileName":"Singleton.cs","PackageType":"library","CodeKind":"Game","AssetVersionId":307445,"IsPrivate":false,"Code":"using System.Collections.Generic;\r\nusing Sandbox;\r\nusing Sandbox.Diagnostics;\r\n\r\nnamespace WackyLib.Patterns;\r\n\r\n/// \u003Csummary\u003E\r\n/// Represents a Singleton component. Which is a component that we can access through an instance, and only one can be allowed in a scene at once.\r\n/// In-game, duplicate instances are automatically destroyed. In the editor (with ExecuteInEditor), multiple instances are permitted to coexist\r\n/// for tooling purposes, but a warning is logged, as only one instance will survive when the game runs (the latest awakened component).\r\n/// \u003C/summary\u003E\r\npublic abstract class Singleton\u003CT\u003E : Component, IHotloadManaged where T : Singleton\u003CT\u003E\r\n{\r\n#nullable enable\r\n#pragma warning disable SB3000\r\n\t// ReSharper disable once MemberCanBePrivate.Global\r\n\tpublic static T? Instance { get; private set; }\r\n#pragma warning restore SB3000\r\n\t\r\n\tprivate readonly Logger Log = new( \u0022Singleton\u0022 );\r\n\t\r\n\tprotected override void OnAwake()\r\n\t{\r\n\t\t// We\u0027re running ExecuteInEditor, which means we should ignore instances.\r\n\t\tif ( ExecutingInEditor() )\r\n\t\t{\r\n\t\t\tLog.Info( $\u0022OnAwake called in editor with ExecuteInEditor, creating once.\u0022 );\r\n\t\t\t\r\n\t\t\tif ( Active )\r\n\t\t\t{\r\n\t\t\t\tif ( Instance.IsValid() \u0026\u0026 Instance != this )\r\n\t\t\t\t{\r\n\t\t\t\t\tLog.Warning( $\u0022Multiple {typeof(T)} instances detected in the scene! Only one will be used in-game.\u0022 );\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\tInstance = (T)this;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\treturn;\r\n\t\t}\r\n\t\t\r\n\t\tif ( Instance.IsValid() )\r\n\t\t{\r\n\t\t\tLog.Warning( $\u0022Singleton tried to initialize another {typeof(T)}!\u0022 );\r\n\t\t\tDestroy();\r\n\t\t\treturn;\r\n\t\t}\r\n\t\t\r\n\t\tif ( Active )\r\n\t\t{\r\n\t\t\tInstance = (T)this;\r\n\t\t}\r\n\t}\r\n\t\r\n\tprotected override void OnDestroy()\r\n\t{\r\n\t\tif ( Instance == this )\r\n\t\t{\r\n\t\t\tInstance = null;\r\n\t\t}\r\n\t}\r\n\t\r\n\tvoid IHotloadManaged.Destroyed( Dictionary\u003Cstring, object\u003E state )\r\n\t{\r\n\t\tstate[\u0022IsActive\u0022] = Instance == this;\r\n\t}\r\n\t\r\n\tvoid IHotloadManaged.Created( IReadOnlyDictionary\u003Cstring, object\u003E state )\r\n\t{\r\n\t\tif ( state.GetValueOrDefault( \u0022IsActive\u0022 ) is true )\r\n\t\t{\r\n\t\t\tInstance = (T)this;\r\n\t\t}\r\n\t}\r\n\t\r\n\tprivate bool ExecutingInEditor()\r\n\t{\r\n\t\tif ( !Game.IsEditor )\r\n\t\t{\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\t\r\n\t\tvar type = GetType();\r\n\t\treturn typeof(ExecuteInEditor).IsAssignableFrom( type );\r\n\t}\r\n}\r\n"},{"Ident":"wizards.wackylib","Path":"Code/Extensions/LoggerExtensions.cs","FileName":"LoggerExtensions.cs","PackageType":"library","CodeKind":"Game","AssetVersionId":307445,"IsPrivate":false,"Code":"using System;\r\nusing Sandbox.Diagnostics;\r\n\r\nnamespace Sandbox;\r\n\r\npublic static class LoggerExtensions\r\n{\r\n\textension( Logger logger )\r\n\t{\r\n\t\t/// \u003Csummary\u003E\r\n\t\t/// Logs a message only when running in the editor.\r\n\t\t/// \u003C/summary\u003E\r\n\t\t/// \u003Cparam name=\u0022message\u0022\u003EMessage to log.\u003C/param\u003E\r\n\t\t/// \u003Cparam name=\u0022type\u0022\u003EType of logging to use.\u003C/param\u003E\r\n\t\t/// \u003Cexception cref=\u0022ArgumentOutOfRangeException\u0022\u003EThrown if the provided LogType is not in range of valid values.\u003C/exception\u003E\r\n\t\tpublic void EditorLog( object message, LogType type = LogType.Info )\r\n\t\t{\r\n\t\t\tif ( !Game.IsEditor )\r\n\t\t\t{\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tswitch ( type )\r\n\t\t\t{\r\n\t\t\t\tcase LogType.Info:\r\n\t\t\t\t\tlogger.Info( message );\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase LogType.Warning:\r\n\t\t\t\t\tlogger.Warning( message );\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase LogType.Error:\r\n\t\t\t\t\tlogger.Error( message );\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase LogType.Trace:\r\n\t\t\t\t\tlogger.Trace( message );\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tdefault:\r\n\t\t\t\t\tthrow new ArgumentOutOfRangeException( nameof( type ), type, null );\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\t\r\n\tpublic enum LogType\r\n\t{\r\n\t\tInfo,\r\n\t\tWarning,\r\n\t\tError,\r\n\t\tTrace\r\n\t}\r\n}\r\n"},{"Ident":"wizards.wackylib","Path":"Code/Extensions/PanelExtensions.cs","FileName":"PanelExtensions.cs","PackageType":"library","CodeKind":"Game","AssetVersionId":307445,"IsPrivate":false,"Code":"using System;\r\nusing Sandbox.UI.Construct;\r\n\r\nnamespace Sandbox.UI;\r\n\r\npublic static class PanelExtensions\r\n{\r\n\textension( Panel panel )\r\n\t{\r\n\t\t/// \u003Csummary\u003E\r\n\t\t/// Applies the \u0022hidden\u0022 class, which presumably hides the panel somehow.\r\n\t\t/// \u003C/summary\u003E\r\n\t\tpublic void Hide()\r\n\t\t{\r\n\t\t\tpanel.AddClass( \u0022hidden\u0022 );\r\n\t\t}\r\n\t\t\r\n\t\t/// \u003Csummary\u003E\r\n\t\t/// Removes the \u0022hidden\u0022 class, which presumably unhides the panel somehow.\r\n\t\t/// \u003C/summary\u003E\r\n\t\tpublic void Show()\r\n\t\t{\r\n\t\t\tpanel.RemoveClass( \u0022hidden\u0022 );\r\n\t\t}\r\n\t}\r\n}\r\n\r\npublic static class PanelComponentExtensions\r\n{\r\n\textension( PanelComponent component )\r\n\t{\r\n\t\t/// \u003Csummary\u003E\r\n\t\t/// Applies the \u0022hidden\u0022 class, which presumably hides the panel somehow.\r\n\t\t/// \u003C/summary\u003E\r\n\t\tpublic void Hide()\r\n\t\t{\r\n\t\t\tcomponent.Panel.Hide();\r\n\t\t}\r\n\t\t\r\n\t\t/// \u003Csummary\u003E\r\n\t\t/// Removes the \u0022hidden\u0022 class, which presumably unhides the panel somehow.\r\n\t\t/// \u003C/summary\u003E\r\n\t\tpublic void Show()\r\n\t\t{\r\n\t\t\tcomponent.Panel.Show();\r\n\t\t}\r\n\t}\r\n}\r\n\r\npublic static class PanelCreatorExtensions\r\n{\r\n\textension( PanelCreator panelCreator )\r\n\t{\r\n\t\tpublic Button Button()\r\n\t\t{\r\n\t\t\tvar button = new Button();\r\n\t\t\treturn panelCreator.panel.AddChild( button );\r\n\t\t}\r\n\t\t\r\n\t\tpublic Button Button( string text, Action onClick )\r\n\t\t{\r\n\t\t\tvar button = new Button( text, onClick );\r\n\t\t\treturn panelCreator.panel.AddChild( button );\r\n\t\t}\r\n\t\t\r\n\t\tpublic Button Button( string text, string icon )\r\n\t\t{\r\n\t\t\tvar button = new Button( text, icon );\r\n\t\t\treturn panelCreator.panel.AddChild( button );\r\n\t\t}\r\n\t\t\r\n\t\tpublic Button Button( string text, string icon, Action onClick )\r\n\t\t{\r\n\t\t\tvar button = new Button( text, icon, onClick );\r\n\t\t\treturn panelCreator.panel.AddChild( button );\r\n\t\t}\r\n\t\t\r\n\t\tpublic Button Button( string text, string icon, string className, Action onClick )\r\n\t\t{\r\n\t\t\tvar button = new Button( text, icon, className, onClick );\r\n\t\t\treturn panelCreator.panel.AddChild( button );\r\n\t\t}\r\n\t}\r\n}\r\n"},{"Ident":"wizards.wackylib","Path":"UnitTests/UnitTest.cs","FileName":"UnitTest.cs","PackageType":"library","CodeKind":"UnitTest","AssetVersionId":307445,"IsPrivate":false,"Code":"global using Microsoft.VisualStudio.TestTools.UnitTesting;\r\n\r\nnamespace WackyLib.Tests;\r\n\r\n[TestClass]\r\npublic class TestInit\r\n{\r\n\tprivate static Sandbox.TestAppSystem s_appSystem;\r\n\t\r\n\t[AssemblyInitialize]\r\n\tpublic static void AssemblyInitialize( TestContext context )\r\n\t{\r\n\t\ts_appSystem = new Sandbox.TestAppSystem();\r\n\t\ts_appSystem.Init();\r\n\t}\r\n\t\r\n\t[AssemblyCleanup]\r\n\tpublic static void AssemblyCleanup()\r\n\t{\r\n\t\ts_appSystem.Shutdown();\r\n\t}\r\n}\r\n"},{"Ident":"wizards.wackylib","Path":".obj/__compiler_extra.cs","FileName":"__compiler_extra.cs","PackageType":"library","CodeKind":"Game","AssetVersionId":307445,"IsPrivate":false,"Code":"global using static Sandbox.Internal.GlobalGameNamespace;\r\nglobal using Microsoft.AspNetCore.Components;\r\nglobal using Microsoft.AspNetCore.Components.Rendering;\r\n[assembly: global::System.Reflection.AssemblyMetadata( \u0022AddonTitle\u0022, \u0022WackyLib\u0022 )]\r\n[assembly: global::System.Reflection.AssemblyMetadata( \u0022AddonIdent\u0022, \u0022wackylib\u0022 )]\r\n[assembly: global::System.Reflection.AssemblyMetadata( \u0022OrgIdent\u0022, \u0022wizards\u0022 )]\r\n[assembly: global::System.Reflection.AssemblyMetadata( \u0022Ident\u0022, \u0022wizards.wackylib\u0022 )]\r\n[assembly: global::System.Reflection.AssemblyMetadata( \u0022EngineVersion\u0022, \u002227\u0022 )]\r\n[assembly: global::System.Reflection.AssemblyMetadata( \u0022EngineMinorVersion\u0022, \u00221\u0022 )]\r\n\r\n[assembly: System.Runtime.Versioning.TargetFramework( \u0022.NETCoreApp,Version=v9.0\u0022, FrameworkDisplayName = \u0022.NET 9.0\u0022 )]\r\n[assembly: global::System.Reflection.AssemblyMetadata( \u0022CompileTime\u0022, \u00222026-07-07T11:52:16.1286384Z\u0022 )]\r\n[assembly: global::System.Reflection.AssemblyVersion(\u00220.0.121.0\u0022)]\r\n[assembly: global::System.Reflection.AssemblyFileVersion(\u00220.0.121.0\u0022)]"},{"Ident":"wizards.wackylib","Path":"Code/Extensions/GameObjectExtensions.cs","FileName":"GameObjectExtensions.cs","PackageType":"library","CodeKind":"Game","AssetVersionId":307445,"IsPrivate":false,"Code":"namespace Sandbox;\r\n\r\npublic static class GameObjectExtensions\r\n{\r\n\textension( GameObject gameObject )\r\n\t{\r\n\t\t/// \u003Csummary\u003E\r\n\t\t/// Clones and network spawn this GameObject.\r\n\t\t/// \u003C/summary\u003E\r\n\t\t/// \u003Cparam name=\u0022owner\u0022\u003EConnection to set as the owner.\u003C/param\u003E\r\n\t\t/// \u003Cparam name=\u0022config\u0022\u003EClone configuration.\u003C/param\u003E\r\n\t\t/// \u003Creturns\u003ESpawned GameObject\u003C/returns\u003E\r\n\t\tpublic GameObject Spawn( Connection owner, CloneConfig config = default )\r\n\t\t{\r\n\t\t\tvar go = gameObject.Clone( config );\r\n\t\t\tgo.NetworkSpawn( owner );\r\n\t\t\t\r\n\t\t\treturn go;\r\n\t\t}\r\n\t}\r\n}\r\n"},{"Ident":"wizards.wackylib","Path":"Extensions/GameObjectExtensions.cs","FileName":"GameObjectExtensions.cs","PackageType":"library","CodeKind":"Game","AssetVersionId":307445,"IsPrivate":false,"Code":"namespace Sandbox;\r\n\r\npublic static class GameObjectExtensions\r\n{\r\n\textension( GameObject gameObject )\r\n\t{\r\n\t\t/// \u003Csummary\u003E\r\n\t\t/// Clones and network spawn this GameObject.\r\n\t\t/// \u003C/summary\u003E\r\n\t\t/// \u003Cparam name=\u0022owner\u0022\u003EConnection to set as the owner.\u003C/param\u003E\r\n\t\t/// \u003Cparam name=\u0022config\u0022\u003EClone configuration.\u003C/param\u003E\r\n\t\t/// \u003Creturns\u003ESpawned GameObject\u003C/returns\u003E\r\n\t\tpublic GameObject Spawn( Connection owner, CloneConfig config = default )\r\n\t\t{\r\n\t\t\tvar go = gameObject.Clone( config );\r\n\t\t\tgo.NetworkSpawn( owner );\r\n\t\t\t\r\n\t\t\treturn go;\r\n\t\t}\r\n\t}\r\n}\r\n"},{"Ident":"wizards.wackylib","Path":"Extensions/LoggerExtensions.cs","FileName":"LoggerExtensions.cs","PackageType":"library","CodeKind":"Game","AssetVersionId":307445,"IsPrivate":false,"Code":"using System;\r\nusing Sandbox.Diagnostics;\r\n\r\nnamespace Sandbox;\r\n\r\npublic static class LoggerExtensions\r\n{\r\n\textension( Logger logger )\r\n\t{\r\n\t\t/// \u003Csummary\u003E\r\n\t\t/// Logs a message only when running in the editor.\r\n\t\t/// \u003C/summary\u003E\r\n\t\t/// \u003Cparam name=\u0022message\u0022\u003EMessage to log.\u003C/param\u003E\r\n\t\t/// \u003Cparam name=\u0022type\u0022\u003EType of logging to use.\u003C/param\u003E\r\n\t\t/// \u003Cexception cref=\u0022ArgumentOutOfRangeException\u0022\u003EThrown if the provided LogType is not in range of valid values.\u003C/exception\u003E\r\n\t\tpublic void EditorLog( object message, LogType type = LogType.Info )\r\n\t\t{\r\n\t\t\tif ( !Game.IsEditor )\r\n\t\t\t{\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tswitch ( type )\r\n\t\t\t{\r\n\t\t\t\tcase LogType.Info:\r\n\t\t\t\t\tlogger.Info( message );\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase LogType.Warning:\r\n\t\t\t\t\tlogger.Warning( message );\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase LogType.Error:\r\n\t\t\t\t\tlogger.Error( message );\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase LogType.Trace:\r\n\t\t\t\t\tlogger.Trace( message );\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tdefault:\r\n\t\t\t\t\tthrow new ArgumentOutOfRangeException( nameof( type ), type, null );\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\t\r\n\tpublic enum LogType\r\n\t{\r\n\t\tInfo,\r\n\t\tWarning,\r\n\t\tError,\r\n\t\tTrace\r\n\t}\r\n}\r\n"},{"Ident":"wizards.wackylib","Path":"Code/Patterns/Singleton/PanelSingleton.cs","FileName":"PanelSingleton.cs","PackageType":"library","CodeKind":"Game","AssetVersionId":307445,"IsPrivate":false,"Code":"using System.Collections.Generic;\r\nusing Sandbox;\r\nusing Sandbox.Diagnostics;\r\n\r\nnamespace WackyLib.Patterns;\r\n\r\n/// \u003Csummary\u003E\r\n/// Represents a Singleton component. Which is a component that we can access through an instance, and only one can be allowed in a scene at once.\r\n/// In-game, duplicate instances are automatically destroyed. In the editor (with ExecuteInEditor), multiple instances are permitted to coexist\r\n/// for tooling purposes, but a warning is logged, as only one instance will survive when the game runs (the latest awakened component).\r\n/// \u003C/summary\u003E\r\npublic abstract class PanelSingleton\u003CT\u003E : PanelComponent, IHotloadManaged where T : PanelSingleton\u003CT\u003E\r\n{\r\n#nullable enable\r\n#pragma warning disable SB3000\r\n\t// ReSharper disable once MemberCanBePrivate.Global\r\n\tpublic static T? Instance { get; private set; }\r\n#pragma warning restore SB3000\r\n\t\r\n\tprivate readonly Logger Log = new( \u0022Singleton\u0022 );\r\n\t\r\n\tprotected override void OnAwake()\r\n\t{\r\n\t\t// We\u0027re running ExecuteInEditor, which means we should ignore instances.\r\n\t\tif ( ExecutingInEditor() )\r\n\t\t{\r\n\t\t\tLog.Info( $\u0022OnAwake called in editor with ExecuteInEditor, creating once.\u0022 );\r\n\t\t\t\r\n\t\t\tif ( Active )\r\n\t\t\t{\r\n\t\t\t\tif ( Instance.IsValid() \u0026\u0026 Instance != this )\r\n\t\t\t\t{\r\n\t\t\t\t\tLog.Warning( $\u0022Multiple {typeof(T)} instances detected in the scene! Only one will be used in-game.\u0022 );\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\tInstance = (T)this;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\treturn;\r\n\t\t}\r\n\t\t\r\n\t\tif ( Instance.IsValid() )\r\n\t\t{\r\n\t\t\tLog.Warning( $\u0022Singleton tried to initialize another {typeof(T)}!\u0022 );\r\n\t\t\tDestroy();\r\n\t\t\treturn;\r\n\t\t}\r\n\t\t\r\n\t\tif ( Active )\r\n\t\t{\r\n\t\t\tInstance = (T)this;\r\n\t\t}\r\n\t}\r\n\r\n\tprotected override void OnDestroy()\r\n\t{\r\n\t\tif ( Instance == this )\r\n\t\t{\r\n\t\t\tInstance = null;\r\n\t\t}\r\n\t}\r\n\t\r\n\tvoid IHotloadManaged.Destroyed( Dictionary\u003Cstring, object\u003E state )\r\n\t{\r\n\t\tstate[\u0022IsActive\u0022] = Instance == this;\r\n\t}\r\n\r\n\tvoid IHotloadManaged.Created( IReadOnlyDictionary\u003Cstring, object\u003E state )\r\n\t{\r\n\t\tif ( state.GetValueOrDefault( \u0022IsActive\u0022 ) is true )\r\n\t\t{\r\n\t\t\tInstance = (T)this;\r\n\t\t}\r\n\t}\r\n\t\r\n\tprivate bool ExecutingInEditor()\r\n\t{\r\n\t\tif ( !Game.IsEditor )\r\n\t\t{\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\t\r\n\t\tvar type = GetType();\r\n\t\treturn typeof(ExecuteInEditor).IsAssignableFrom( type );\r\n\t}\r\n}\r\n"},{"Ident":"wizards.wackylib","Path":"Extensions/PanelExtensions.cs","FileName":"PanelExtensions.cs","PackageType":"library","CodeKind":"Game","AssetVersionId":307445,"IsPrivate":false,"Code":"using System;\r\nusing Sandbox.UI.Construct;\r\n\r\nnamespace Sandbox.UI;\r\n\r\npublic static class PanelExtensions\r\n{\r\n\textension( Panel panel )\r\n\t{\r\n\t\t/// \u003Csummary\u003E\r\n\t\t/// Applies the \u0022hidden\u0022 class, which presumably hides the panel somehow.\r\n\t\t/// \u003C/summary\u003E\r\n\t\tpublic void Hide()\r\n\t\t{\r\n\t\t\tpanel.AddClass( \u0022hidden\u0022 );\r\n\t\t}\r\n\t\t\r\n\t\t/// \u003Csummary\u003E\r\n\t\t/// Removes the \u0022hidden\u0022 class, which presumably unhides the panel somehow.\r\n\t\t/// \u003C/summary\u003E\r\n\t\tpublic void Show()\r\n\t\t{\r\n\t\t\tpanel.RemoveClass( \u0022hidden\u0022 );\r\n\t\t}\r\n\t}\r\n}\r\n\r\npublic static class PanelComponentExtensions\r\n{\r\n\textension( PanelComponent component )\r\n\t{\r\n\t\t/// \u003Csummary\u003E\r\n\t\t/// Applies the \u0022hidden\u0022 class, which presumably hides the panel somehow.\r\n\t\t/// \u003C/summary\u003E\r\n\t\tpublic void Hide()\r\n\t\t{\r\n\t\t\tcomponent.Panel.Hide();\r\n\t\t}\r\n\t\t\r\n\t\t/// \u003Csummary\u003E\r\n\t\t/// Removes the \u0022hidden\u0022 class, which presumably unhides the panel somehow.\r\n\t\t/// \u003C/summary\u003E\r\n\t\tpublic void Show()\r\n\t\t{\r\n\t\t\tcomponent.Panel.Show();\r\n\t\t}\r\n\t}\r\n}\r\n\r\npublic static class PanelCreatorExtensions\r\n{\r\n\textension( PanelCreator panelCreator )\r\n\t{\r\n\t\tpublic Button Button()\r\n\t\t{\r\n\t\t\tvar button = new Button();\r\n\t\t\treturn panelCreator.panel.AddChild( button );\r\n\t\t}\r\n\t\t\r\n\t\tpublic Button Button( string text, Action onClick )\r\n\t\t{\r\n\t\t\tvar button = new Button( text, onClick );\r\n\t\t\treturn panelCreator.panel.AddChild( button );\r\n\t\t}\r\n\t\t\r\n\t\tpublic Button Button( string text, string icon )\r\n\t\t{\r\n\t\t\tvar button = new Button( text, icon );\r\n\t\t\treturn panelCreator.panel.AddChild( button );\r\n\t\t}\r\n\t\t\r\n\t\tpublic Button Button( string text, string icon, Action onClick )\r\n\t\t{\r\n\t\t\tvar button = new Button( text, icon, onClick );\r\n\t\t\treturn panelCreator.panel.AddChild( button );\r\n\t\t}\r\n\t\t\r\n\t\tpublic Button Button( string text, string icon, string className, Action onClick )\r\n\t\t{\r\n\t\t\tvar button = new Button( text, icon, className, onClick );\r\n\t\t\treturn panelCreator.panel.AddChild( button );\r\n\t\t}\r\n\t}\r\n}\r\n"},{"Ident":"wizards.wackylib","Path":"Extensions/SceneExtensions.cs","FileName":"SceneExtensions.cs","PackageType":"library","CodeKind":"Game","AssetVersionId":307445,"IsPrivate":false,"Code":"using System;\r\nusing System.Linq;\r\n\r\nnamespace Sandbox;\r\n\r\npublic static class SceneExtensions\r\n{\r\n\t/// \u003Cparam name=\u0022scene\u0022\u003EThe scene to search in.\u003C/param\u003E\r\n\textension( Scene scene )\r\n\t{\r\n\t\t/// \u003Csummary\u003E\r\n\t\t/// Searches the scene for any enabled gameobjects with the DontDestroyOnLoad flag and destroys them.\r\n\t\t/// \u003C/summary\u003E\r\n\t\t/// \u003Cparam name=\u0022ignored\u0022\u003EComponent types to ignore deletion.\u003C/param\u003E\r\n\t\tpublic void DestroyPersistentObjects( Type[] ignored = null )\r\n\t\t{\r\n\t\t\tvar objects = scene.GetAllObjects( true )\r\n\t\t\t\t.Where( x =\u003E x.Flags == GameObjectFlags.DontDestroyOnLoad );\r\n\t\t\t\r\n\t\t\tif ( ignored is null || ignored.Length == 0 )\r\n\t\t\t{\r\n\t\t\t\tforeach ( var go in objects )\r\n\t\t\t\t{\r\n\t\t\t\t\tgo.Destroy();\r\n\t\t\t\t}\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tvar ignoredSet = ignored.ToHashSet();\r\n\t\t\tforeach ( var go in objects )\r\n\t\t\t{\r\n\t\t\t\tvar hasIgnoredType = ignoredSet.Any( type =\u003E go.Components.Get( type ) is not null );\r\n\t\t\t\tif ( !hasIgnoredType )\r\n\t\t\t\t{\r\n\t\t\t\t\tgo.Destroy();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\t/// \u003Csummary\u003E\r\n\t\t/// Search the scene for a specific component instance. \u003Cbr/\u003E\r\n\t\t/// This method can only be used to find enabled/active components.\r\n\t\t/// \u003C/summary\u003E\r\n\t\t/// \u003Ctypeparam name=\u0022T\u0022\u003EComponent to search for.\u003C/typeparam\u003E\r\n\t\t/// \u003Creturns\u003EFound component instance.\u003C/returns\u003E\r\n\t\t/// \u003Cexception cref=\u0022InvalidOperationException\u0022\u003EThrown if no instance or multiple instances are found.\u003C/exception\u003E\r\n\t\tpublic T GetInstance\u003CT\u003E() where T : Component\r\n\t\t{\r\n\t\t\tvar components = scene.GetAllComponents\u003CT\u003E().ToList();\r\n\t\t\treturn components.Count switch\r\n\t\t\t{\r\n\t\t\t\t0 =\u003E throw new InvalidOperationException( $\u0022No instance of type {typeof(T).Name} found in scene.\u0022 ),\r\n\t\t\t\t1 =\u003E components[0],\r\n\t\t\t\t_ =\u003E throw new InvalidOperationException( $\u0022Multiple instances of type {typeof(T).Name} found in scene. Expected singleton.\u0022 )\r\n\t\t\t};\r\n\t\t}\r\n\t}\r\n}\r\n"},{"Ident":"wizards.wackylib","Path":"Patterns/Singleton/Singleton.cs","FileName":"Singleton.cs","PackageType":"library","CodeKind":"Game","AssetVersionId":307445,"IsPrivate":false,"Code":"using System.Collections.Generic;\r\nusing Sandbox;\r\nusing Sandbox.Diagnostics;\r\n\r\nnamespace WackyLib.Patterns;\r\n\r\n/// \u003Csummary\u003E\r\n/// Represents a Singleton component. Which is a component that we can access through an instance, and only one can be allowed in a scene at once.\r\n/// In-game, duplicate instances are automatically destroyed. In the editor (with ExecuteInEditor), multiple instances are permitted to coexist\r\n/// for tooling purposes, but a warning is logged, as only one instance will survive when the game runs (the latest awakened component).\r\n/// \u003C/summary\u003E\r\npublic abstract class Singleton\u003CT\u003E : Component, IHotloadManaged where T : Singleton\u003CT\u003E\r\n{\r\n#nullable enable\r\n#pragma warning disable SB3000\r\n\t// ReSharper disable once MemberCanBePrivate.Global\r\n\tpublic static T? Instance { get; private set; }\r\n#pragma warning restore SB3000\r\n\t\r\n\tprivate readonly Logger Log = new( \u0022Singleton\u0022 );\r\n\t\r\n\tprotected override void OnAwake()\r\n\t{\r\n\t\t// We\u0027re running ExecuteInEditor, which means we should ignore instances.\r\n\t\tif ( ExecutingInEditor() )\r\n\t\t{\r\n\t\t\tLog.Info( $\u0022OnAwake called in editor with ExecuteInEditor, creating once.\u0022 );\r\n\t\t\t\r\n\t\t\tif ( Active )\r\n\t\t\t{\r\n\t\t\t\tif ( Instance.IsValid() \u0026\u0026 Instance != this )\r\n\t\t\t\t{\r\n\t\t\t\t\tLog.Warning( $\u0022Multiple {typeof(T)} instances detected in the scene! Only one will be used in-game.\u0022 );\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\tInstance = (T)this;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\treturn;\r\n\t\t}\r\n\t\t\r\n\t\tif ( Instance.IsValid() )\r\n\t\t{\r\n\t\t\tLog.Warning( $\u0022Singleton tried to initialize another {typeof(T)}!\u0022 );\r\n\t\t\tDestroy();\r\n\t\t\treturn;\r\n\t\t}\r\n\t\t\r\n\t\tif ( Active )\r\n\t\t{\r\n\t\t\tInstance = (T)this;\r\n\t\t}\r\n\t}\r\n\t\r\n\tprotected override void OnDestroy()\r\n\t{\r\n\t\tif ( Instance == this )\r\n\t\t{\r\n\t\t\tInstance = null;\r\n\t\t}\r\n\t}\r\n\t\r\n\tvoid IHotloadManaged.Destroyed( Dictionary\u003Cstring, object\u003E state )\r\n\t{\r\n\t\tstate[\u0022IsActive\u0022] = Instance == this;\r\n\t}\r\n\t\r\n\tvoid IHotloadManaged.Created( IReadOnlyDictionary\u003Cstring, object\u003E state )\r\n\t{\r\n\t\tif ( state.GetValueOrDefault( \u0022IsActive\u0022 ) is true )\r\n\t\t{\r\n\t\t\tInstance = (T)this;\r\n\t\t}\r\n\t}\r\n\t\r\n\tprivate bool ExecutingInEditor()\r\n\t{\r\n\t\tif ( !Game.IsEditor )\r\n\t\t{\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\t\r\n\t\tvar type = GetType();\r\n\t\treturn typeof(ExecuteInEditor).IsAssignableFrom( type );\r\n\t}\r\n}\r\n"},{"Ident":"wizards.wackylib","Path":"Attributes/IdentAttribute.cs","FileName":"IdentAttribute.cs","PackageType":"library","CodeKind":"Game","AssetVersionId":307445,"IsPrivate":false,"Code":"using System;\r\n\r\nnamespace WackyLib.Attributes;\r\n\r\n[AttributeUsage( AttributeTargets.Field | AttributeTargets.Property )]\r\npublic class IdentAttribute( string ident ) : Attribute\r\n{\r\n\tpublic string Value { get; private set; } = ident;\r\n}\r\n"},{"Ident":"wizards.wackylib","Path":"Attributes/LocalizedNameAttribute.cs","FileName":"LocalizedNameAttribute.cs","PackageType":"library","CodeKind":"Game","AssetVersionId":307445,"IsPrivate":false,"Code":"using System;\r\n\r\nnamespace WackyLib.Attributes;\r\n\r\n[AttributeUsage( AttributeTargets.Field | AttributeTargets.Property )]\r\npublic class LocalizedNameAttribute( string key ) : Attribute\r\n{\r\n\tpublic string Value { get; private set; } = key;\r\n}\r\n"},{"Ident":"wizards.wackylib","Path":"Extensions/TraceExtensions.cs","FileName":"TraceExtensions.cs","PackageType":"library","CodeKind":"Game","AssetVersionId":307445,"IsPrivate":false,"Code":"using System.Collections.Generic;\r\n\r\nnamespace Sandbox;\r\n\r\npublic static class TraceExtensions\r\n{\r\n\textension( SceneTrace trace )\r\n\t{\r\n\t\t/// \u003Csummary\u003E\r\n\t\t/// Performs a ray trace along the given ray for the specified distance,\r\n\t\t/// returning only the first hit.\r\n\t\t/// \u003C/summary\u003E\r\n\t\t/// \u003Cparam name=\u0022ray\u0022\u003EThe ray to trace along.\u003C/param\u003E\r\n\t\t/// \u003Cparam name=\u0022distance\u0022\u003EHow far the ray should travel.\u003C/param\u003E\r\n\t\t/// \u003Cparam name=\u0022withTags\u0022\u003EOptional tags to restrict the trace to objects that have any of these tags.\u003C/param\u003E\r\n\t\t/// \u003Creturns\u003EResult of the trace.\u003C/returns\u003E\r\n\t\tpublic SceneTraceResult RunRayTrace( Ray ray, float distance = 100f, params string[] withTags )\r\n\t\t{\r\n\t\t\treturn trace.Ray( ray, distance )\r\n\t\t\t\t.WithAnyTags( withTags )\r\n\t\t\t\t.Run();\r\n\t\t}\r\n\t\t\r\n\t\t/// \u003Csummary\u003E\r\n\t\t/// Performs a ray trace along the given ray for the specified distance,\r\n\t\t/// returning all hits along the ray.\r\n\t\t/// \u003C/summary\u003E\r\n\t\t/// \u003Cparam name=\u0022ray\u0022\u003EThe ray to trace along.\u003C/param\u003E\r\n\t\t/// \u003Cparam name=\u0022distance\u0022\u003EHow far the ray should travel.\u003C/param\u003E\r\n\t\t/// \u003Cparam name=\u0022withTags\u0022\u003EOptional tags to restrict the trace to objects that have any of these tags.\u003C/param\u003E\r\n\t\t/// \u003Creturns\u003EAll results of the trace in order along the ray.\u003C/returns\u003E\r\n\t\tpublic IEnumerable\u003CSceneTraceResult\u003E RunAllRayTrace( Ray ray, float distance = 100f, params string[] withTags )\r\n\t\t{\r\n\t\t\treturn trace.Ray( ray, distance )\r\n\t\t\t\t.WithAnyTags( withTags )\r\n\t\t\t\t.RunAll();\r\n\t\t}\r\n\t}\r\n}\r\n"},{"Ident":"wizards.wackylib","Path":"Code/Extensions/SceneExtensions.cs","FileName":"SceneExtensions.cs","PackageType":"library","CodeKind":"Game","AssetVersionId":307445,"IsPrivate":false,"Code":"using System;\r\nusing System.Linq;\r\n\r\nnamespace Sandbox;\r\n\r\npublic static class SceneExtensions\r\n{\r\n\t/// \u003Cparam name=\u0022scene\u0022\u003EThe scene to search in.\u003C/param\u003E\r\n\textension( Scene scene )\r\n\t{\r\n\t\t/// \u003Csummary\u003E\r\n\t\t/// Searches the scene for any enabled gameobjects with the DontDestroyOnLoad flag and destroys them.\r\n\t\t/// \u003C/summary\u003E\r\n\t\t/// \u003Cparam name=\u0022ignored\u0022\u003EComponent types to ignore deletion.\u003C/param\u003E\r\n\t\tpublic void DestroyPersistentObjects( Type[] ignored = null )\r\n\t\t{\r\n\t\t\tvar objects = scene.GetAllObjects( true )\r\n\t\t\t\t.Where( x =\u003E x.Flags == GameObjectFlags.DontDestroyOnLoad );\r\n\t\t\t\r\n\t\t\tif ( ignored is null || ignored.Length == 0 )\r\n\t\t\t{\r\n\t\t\t\tforeach ( var go in objects )\r\n\t\t\t\t{\r\n\t\t\t\t\tgo.Destroy();\r\n\t\t\t\t}\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tvar ignoredSet = ignored.ToHashSet();\r\n\t\t\tforeach ( var go in objects )\r\n\t\t\t{\r\n\t\t\t\tvar hasIgnoredType = ignoredSet.Any( type =\u003E go.Components.Get( type ) is not null );\r\n\t\t\t\tif ( !hasIgnoredType )\r\n\t\t\t\t{\r\n\t\t\t\t\tgo.Destroy();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\t/// \u003Csummary\u003E\r\n\t\t/// Search the scene for a specific component instance. \u003Cbr/\u003E\r\n\t\t/// This method can only be used to find enabled/active components.\r\n\t\t/// \u003C/summary\u003E\r\n\t\t/// \u003Ctypeparam name=\u0022T\u0022\u003EComponent to search for.\u003C/typeparam\u003E\r\n\t\t/// \u003Creturns\u003EFound component instance.\u003C/returns\u003E\r\n\t\t/// \u003Cexception cref=\u0022InvalidOperationException\u0022\u003EThrown if no instance or multiple instances are found.\u003C/exception\u003E\r\n\t\tpublic T GetInstance\u003CT\u003E() where T : Component\r\n\t\t{\r\n\t\t\tvar components = scene.GetAllComponents\u003CT\u003E().ToList();\r\n\t\t\treturn components.Count switch\r\n\t\t\t{\r\n\t\t\t\t0 =\u003E throw new InvalidOperationException( $\u0022No instance of type {typeof(T).Name} found in scene.\u0022 ),\r\n\t\t\t\t1 =\u003E components[0],\r\n\t\t\t\t_ =\u003E throw new InvalidOperationException( $\u0022Multiple instances of type {typeof(T).Name} found in scene. Expected singleton.\u0022 )\r\n\t\t\t};\r\n\t\t}\r\n\t}\r\n}\r\n"},{"Ident":"wizards.wackylib","Path":"Extensions/CollectionExtensions.cs","FileName":"CollectionExtensions.cs","PackageType":"library","CodeKind":"Game","AssetVersionId":307445,"IsPrivate":false,"Code":"using System;\r\nusing System.Linq;\r\nusing System.Collections.Generic;\r\n\r\nnamespace Sandbox;\r\n\r\npublic static class CollectionExtensions\r\n{\r\n\t/// \u003Cparam name=\u0022list\u0022\u003E\r\n\t/// The list whose elements will be shuffled. Its order is modified directly.\r\n\t/// \u003C/param\u003E\r\n\t/// \u003Ctypeparam name=\u0022T\u0022\u003EThe type of elements in the list.\u003C/typeparam\u003E\r\n\textension\u003CT\u003E( IList\u003CT\u003E list )\r\n\t{\r\n\t\t/// \u003Csummary\u003E\r\n\t\t/// Randomizes the order of the elements in the given list in-place\r\n\t\t/// using the Fisher\u2013Yates shuffle algorithm.\r\n\t\t/// \u003C/summary\u003E\r\n\t\tpublic void Shuffle()\r\n\t\t{\r\n\t\t\tvar n = list.Count;\r\n\t\t\t\r\n\t\t\twhile ( n \u003E 1 )\r\n\t\t\t{\r\n\t\t\t\tn--;\r\n\t\t\t\tvar k = Game.Random.Next( 0, n \u002B 1 );\r\n\t\t\t\t(list[n], list[k]) = (list[k], list[n]);\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\t/// \u003Csummary\u003E\r\n\t\t/// Inserts an element into the list at a random position.\r\n\t\t/// \u003C/summary\u003E\r\n\t\t/// \u003Cparam name=\u0022item\u0022\u003EThe element to insert at a random index.\u003C/param\u003E\r\n\t\tpublic void ShuffleInto( T item )\r\n\t\t{\r\n\t\t\tvar n = list.Count;\r\n\t\t\tvar randomIndex = Game.Random.Next( 0, n \u002B 1 );\r\n\t\t\tlist.Insert( randomIndex, item );\r\n\t\t}\r\n\t}\r\n\t\r\n\textension\u003CT\u003E( IEnumerable\u003CT\u003E enumerable )\r\n\t{\r\n\t\t/// \u003Csummary\u003E\r\n\t\t/// Combines the hash codes of all elements in the sequence by applying\r\n\t\t/// the given selector and aggregating with \u003Cb\u003EHashCode.Combine\u003C/b\u003E.\r\n\t\t/// \u003C/summary\u003E\r\n\t\tpublic int HashCombine\u003CTKey\u003E( Func\u003CT, TKey\u003E selector )\r\n\t\t{\r\n\t\t\treturn enumerable.Aggregate( 0, ( current, el ) =\u003E HashCode.Combine( current, selector( el ) ) );\r\n\t\t}\r\n\t}\r\n}\r\n"},{"Ident":"wizards.wackylib","Path":"Code/Attributes/IdentAttribute.cs","FileName":"IdentAttribute.cs","PackageType":"library","CodeKind":"Game","AssetVersionId":307445,"IsPrivate":false,"Code":"using System;\r\n\r\nnamespace WackyLib.Attributes;\r\n\r\n[AttributeUsage( AttributeTargets.Field | AttributeTargets.Property )]\r\npublic class IdentAttribute( string ident ) : Attribute\r\n{\r\n\tpublic string Value { get; private set; } = ident;\r\n}\r\n"},{"Ident":"wizards.wackylib","Path":"Code/Attributes/LocalizedNameAttribute.cs","FileName":"LocalizedNameAttribute.cs","PackageType":"library","CodeKind":"Game","AssetVersionId":307445,"IsPrivate":false,"Code":"using System;\r\n\r\nnamespace WackyLib.Attributes;\r\n\r\n[AttributeUsage( AttributeTargets.Field | AttributeTargets.Property )]\r\npublic class LocalizedNameAttribute( string key ) : Attribute\r\n{\r\n\tpublic string Value { get; private set; } = key;\r\n}\r\n"}]}