{"TotalCount":293,"Files":[{"Ident":"perkedel.testpen","Path":".obj/__compiler_extra.cs","FileName":"__compiler_extra.cs","PackageType":"game","CodeKind":"Game","AssetVersionId":340855,"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, \u0022Testpen\u0022 )]\r\n[assembly: global::System.Reflection.AssemblyMetadata( \u0022AddonIdent\u0022, \u0022testpen\u0022 )]\r\n[assembly: global::System.Reflection.AssemblyMetadata( \u0022OrgIdent\u0022, \u0022perkedel\u0022 )]\r\n[assembly: global::System.Reflection.AssemblyMetadata( \u0022Ident\u0022, \u0022perkedel.testpen\u0022 )]\r\n[assembly: global::System.Reflection.AssemblyMetadata( \u0022EngineVersion\u0022, \u002228\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-08-11T07:43:16.2910966Z\u0022 )]\r\n[assembly: global::System.Reflection.AssemblyVersion(\u00220.0.702.0\u0022)]\r\n[assembly: global::System.Reflection.AssemblyFileVersion(\u00220.0.702.0\u0022)]"},{"Ident":"perkedel.testpen","Path":"Animation/GlideState.cs","FileName":"GlideState.cs","PackageType":"game","CodeKind":"Game","AssetVersionId":340855,"IsPrivate":false,"Code":"using Sandbox;\n\nnamespace Goo.Animation;\n\n/// \u003Csummary\u003EBanked-offset glide for layout position transitions; pure value type, caller owns the clock.\u003C/summary\u003E\npublic record struct GlideState\n{\n    Vector2 _banked;\n    float _elapsed;\n    Tween _tween;\n    bool _active;\n\n    const float SettleSq = 0.25f;\n\n    /// \u003Csummary\u003ECreates a glide with duration in milliseconds and optional easing (defaults to EaseOut).\u003C/summary\u003E\n    public GlideState(float ms, Sandbox.Utility.Easing.Function? easing = null)\n    {\n        _tween = new Tween(easing ?? Easing.EaseOut, ms / 1000f);\n        _banked = Vector2.Zero;\n        _elapsed = 0f;\n        _active = false;\n    }\n\n    /// \u003Csummary\u003ECurrent visual displacement from the layout slot; exactly zero when settled.\u003C/summary\u003E\n    public readonly Vector2 Offset =\u003E _active ? _banked * (1f - _tween.Eval(_elapsed)) : Vector2.Zero;\n\n    /// \u003Csummary\u003ETrue while the glide is still animating toward zero.\u003C/summary\u003E\n    public readonly bool IsActive =\u003E _active;\n\n    /// \u003Csummary\u003EBanks a layout jump; a mid-flight bank preserves the current visual offset and restarts the clock.\u003C/summary\u003E\n    public void Bank(Vector2 jump)\n    {\n        if (_tween.Duration \u003C= 0f) return;\n        var next = Offset \u002B jump;\n        _elapsed = 0f;\n        if (next.LengthSquared \u003C SettleSq) { _banked = Vector2.Zero; _active = false; return; }\n        _banked = next;\n        _active = true;\n    }\n\n    /// \u003Csummary\u003ESteps the animation forward by dt seconds; settles when the offset drops below 0.5px.\u003C/summary\u003E\n    public void Advance(float dt)\n    {\n        if (!_active) return;\n        _elapsed \u002B= dt;\n        if (Offset.LengthSquared \u003C SettleSq) { _banked = Vector2.Zero; _active = false; }\n    }\n}\n"},{"Ident":"perkedel.testpen","Path":"Animation/Timeline.cs","FileName":"Timeline.cs","PackageType":"game","CodeKind":"Game","AssetVersionId":340855,"IsPrivate":false,"Code":"using System;\nusing System.Collections.Immutable;\n\nnamespace Goo.Animation;\n\npublic readonly record struct Segment\n{\n    public float StartTime { get; init; }\n    public float Duration  { get; init; }\n    public Tween Tween     { get; init; }\n}\n\npublic readonly record struct TimelineSample\n{\n    public int   SegmentIndex { get; init; }\n    public float Value        { get; init; }\n}\n\npublic readonly record struct Timeline\n{\n    public ImmutableArray\u003CSegment\u003E Segments { get; init; }\n    public int   Iterations { get; init; }\n    public float Duration   { get; init; }\n\n    /// \u003Csummary\u003EAuto-concatenated: segment N starts where N-1 ends. Skips the internal sort because the input is ascending by construction.\u003C/summary\u003E\n    public static Timeline Sequence(params Tween[] tweens)\n    {\n        if (tweens == null || tweens.Length == 0)\n            throw new ArgumentException(\u0022Timeline requires at least one segment.\u0022, nameof(tweens));\n\n        var builder  = ImmutableArray.CreateBuilder\u003CSegment\u003E(tweens.Length);\n        float cursor = 0f;\n        for (int i = 0; i \u003C tweens.Length; i\u002B\u002B)\n        {\n            if (tweens[i].Duration \u003C= 0f)\n                throw new ArgumentException(\n                    $\u0022Timeline segment {i} has duration {tweens[i].Duration}; durations must be \u003E 0.\u0022,\n                    nameof(tweens));\n            builder.Add(new Segment\n            {\n                StartTime = cursor,\n                Duration  = tweens[i].Duration,\n                Tween     = tweens[i],\n            });\n            cursor \u002B= tweens[i].Duration;\n        }\n        return new Timeline\n        {\n            Segments   = builder.MoveToImmutable(),\n            Iterations = 1,\n            Duration   = cursor,\n        };\n    }\n\n    /// \u003Csummary\u003EExplicit timing: each entry is (absolute startTime, tween), gaps allowed; sorts internally so stored Segments are ascending by StartTime.\u003C/summary\u003E\n    public static Timeline At(params (float startTime, Tween tween)[] entries)\n    {\n        if (entries == null || entries.Length == 0)\n            throw new ArgumentException(\u0022Timeline requires at least one segment.\u0022, nameof(entries));\n\n        var arr = new Segment[entries.Length];\n        for (int i = 0; i \u003C entries.Length; i\u002B\u002B)\n        {\n            if (entries[i].startTime \u003C 0f)\n                throw new ArgumentException(\n                    $\u0022Timeline segment {i} has StartTime {entries[i].startTime}; StartTime must be \u003E= 0.\u0022,\n                    nameof(entries));\n            if (entries[i].tween.Duration \u003C= 0f)\n                throw new ArgumentException(\n                    $\u0022Timeline segment {i} has duration {entries[i].tween.Duration}; durations must be \u003E 0.\u0022,\n                    nameof(entries));\n            arr[i] = new Segment\n            {\n                StartTime = entries[i].startTime,\n                Duration  = entries[i].tween.Duration,\n                Tween     = entries[i].tween,\n            };\n        }\n        Array.Sort(arr, static (x, y) =\u003E x.StartTime.CompareTo(y.StartTime));\n\n        for (int i = 1; i \u003C arr.Length; i\u002B\u002B)\n        {\n            float prevEnd = arr[i - 1].StartTime \u002B arr[i - 1].Duration;\n            if (prevEnd \u003E arr[i].StartTime)\n                throw new ArgumentException(\n                    $\u0022Timeline segments {i - 1} and {i} overlap: segment {i - 1} ends at {prevEnd} but segment {i} starts at {arr[i].StartTime}.\u0022,\n                    nameof(entries));\n        }\n\n        float duration = arr[arr.Length - 1].StartTime \u002B arr[arr.Length - 1].Duration;\n        return new Timeline\n        {\n            Segments   = ImmutableArray.Create(arr),\n            Iterations = 1,\n            Duration   = duration,\n        };\n    }\n\n    public TimelineSample Eval(float elapsedSec)\n    {\n        if (Iterations \u003C= 0)\n        {\n            // Loop forever. Wrap into [0, Duration) using positive-result modulo.\n            if (elapsedSec \u003C 0f) elapsedSec = 0f;\n            elapsedSec %= Duration;\n        }\n        else\n        {\n            float totalPlayTime = Duration * Iterations;\n            if (elapsedSec \u003E= totalPlayTime) elapsedSec = Duration;\n            else if (elapsedSec \u003E Duration)\n            {\n                // Mid-play, cycle 2..Iterations: wrap into the canonical [0, Duration) range.\n                elapsedSec %= Duration;\n            }\n        }\n\n        int idx = -1;\n        for (int i = 0; i \u003C Segments.Length; i\u002B\u002B)\n        {\n            if (Segments[i].StartTime \u003C= elapsedSec) idx = i;\n            else break;\n        }\n\n        if (idx \u003C 0)\n            return new TimelineSample { SegmentIndex = -1, Value = 0f };\n\n        var seg     = Segments[idx];\n        float local = elapsedSec - seg.StartTime;\n        if (local \u003E seg.Duration) local = seg.Duration;\n\n        return new TimelineSample\n        {\n            SegmentIndex = idx,\n            Value        = seg.Tween.Eval(local),\n        };\n    }\n}\n\npublic static class TimelineExtensions\n{\n    public static Timeline Loop(this Timeline tl)         =\u003E tl with { Iterations = -1 };\n    public static Timeline Times(this Timeline tl, int n) =\u003E tl with { Iterations = n };\n}\n"},{"Ident":"perkedel.testpen","Path":"Animation/Tween.cs","FileName":"Tween.cs","PackageType":"game","CodeKind":"Game","AssetVersionId":340855,"IsPrivate":false,"Code":"using System;\r\n\r\nnamespace Goo.Animation;\r\n\r\npublic readonly record struct Tween\r\n{\r\n    public Sandbox.Utility.Easing.Function Easing { get; init; }\r\n    public float Duration   { get; init; }\r\n    public float Delay      { get; init; }\r\n    public float SpeedScale { get; init; }\r\n    public int   Iterations { get; init; }\r\n    public bool  PingPong   { get; init; }\r\n    public bool  Reversed   { get; init; }\r\n\r\n    public Tween(Sandbox.Utility.Easing.Function easing, float duration, float delay = 0f)\r\n    {\r\n        Easing     = easing;\r\n        Duration   = duration;\r\n        Delay      = delay;\r\n        SpeedScale = 1f;\r\n        Iterations = 1;\r\n        PingPong   = false;\r\n        Reversed   = false;\r\n    }\r\n\r\n    /// \u003Csummary\u003E\r\n    /// Bridge a designer-authored Sandbox.Curve (authored over [0, 1]) into a Tween.\r\n    /// Allocates one delegate per call; cache the result in a static readonly field.\r\n    /// \u003C/summary\u003E\r\n    public static Tween FromCurve(Sandbox.Curve curve, float duration, float delay = 0f)\r\n        =\u003E new Tween(curve.Evaluate, duration, delay);\r\n\r\n    public float Eval(float elapsedSec)\r\n    {\r\n        if (Duration \u003C= 0f) return Reversed ? 0f : 1f;\r\n\r\n        float t = (elapsedSec - Delay) * SpeedScale;\r\n        if (t \u003C= 0f) return Reversed ? 1f : 0f;\r\n\r\n        float cycleDuration = PingPong ? 2f * Duration : Duration;\r\n\r\n        if (Iterations \u003E 0 \u0026\u0026 t \u003E= cycleDuration * Iterations)\r\n        {\r\n            float endLocal = PingPong ? 0f : 1f;\r\n            if (Reversed) endLocal = 1f - endLocal;\r\n            return Easing(endLocal);\r\n        }\r\n\r\n        float cycleT = t % cycleDuration;\r\n        float local = PingPong\r\n            ? (cycleT \u003C Duration ? cycleT / Duration : 1f - (cycleT - Duration) / Duration)\r\n            : cycleT / Duration;\r\n\r\n        if (Reversed) local = 1f - local;\r\n        return Easing(local);\r\n    }\r\n}\r\n\r\npublic static class TweenExtensions\r\n{\r\n    public static Tween Loop(this Tween t)               =\u003E t with { Iterations = -1 };\r\n    public static Tween Times(this Tween t, int n)       =\u003E t with { Iterations = n };\r\n    public static Tween PingPong(this Tween t)           =\u003E t with { PingPong = true };\r\n    public static Tween Scale(this Tween t, float speed) =\u003E t with { SpeedScale = speed };\r\n    public static Tween WithDelay(this Tween t, float s) =\u003E t with { Delay = s };\r\n    public static Tween Reverse(this Tween t)            =\u003E t with { Reversed = true };\r\n}\r\n"},{"Ident":"perkedel.testpen","Path":"Animator/AnimationDictionary.cs","FileName":"AnimationDictionary.cs","PackageType":"game","CodeKind":"Game","AssetVersionId":340855,"IsPrivate":false,"Code":"using System;\r\nusing System.Collections;\r\nusing System.Collections.Generic;\r\nusing System.Diagnostics.CodeAnalysis;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing Sandbox;\r\n\r\n#nullable enable\r\nnamespace CrosshairMaker.Animator\r\n{\r\n\tpublic sealed class AnimationDictionary : IDictionary\u003Cint,CrosshairAnimation\u003E , IDictionary\r\n\t{\r\n\t\t//Init\r\n\t\t//-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-//\r\n\t\tpublic void Init(AnimationValueSetter setterCollection )\r\n\t\t{\r\n\t\t\tif (AnimationSize.Length != 0) this.Clear();\r\n\t\t\tValueSetters = setterCollection;\r\n\r\n\t\t}\r\n\t\t//-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-//\r\n\t\t//Init\r\n\r\n\t\t//General features\r\n\t\t//-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-//\r\n\t\t/// \u003Csummary\u003E\r\n\t\t/// Add an animation the same size as the others in this AnimationDictionary with given key , returns the key if sucessful\r\n\t\t/// throws an error if AnimationDictionary is empty\r\n\t\t/// throws an error if key is already contained in this AnimationDictionary\r\n\t\t/// \u003C/summary\u003E\r\n\t\t/// \u003Cparam name=\u0022key\u0022\u003Ekey of animation\u003C/param\u003E\r\n\t\t/// \u003Creturns\u003E\u003C/returns\u003E\r\n\t\t/// \u003Cexception cref=\u0022InvalidOperationException\u0022\u003E\u003C/exception\u003E\r\n\t\tpublic int AddNewAnimation( int key )\r\n\t\t{\r\n\t\t\tif ( AnimationSize.Length == 0 ) throw new InvalidOperationException( \u0022Cannot create an animation, no setters found\u0022 );\r\n\t\t\tif ( _internalDic.ContainsKey( key ) ) throw new InvalidOperationException( $\u0022Cannot create an animation in an already existing key, animation {key} is {_internalDic[key]}\u0022 );\r\n\t\t\tCrosshairAnimation newAnim = CrosshairAnimation.FromPropertyCount( AnimationSize );\r\n\t\t\t_internalDic.Add( key, newAnim );\r\n\t\t\treturn key;\r\n\t\t}\r\n\t\t/// \u003Csummary\u003E\r\n\t\t/// Add an animation the same size as the others in this AnimationDictionary in first avaliable key between 0 -\u003E (int.MaxValue - 1) , returns the key if sucessful\r\n\t\t/// throws an exception if AnimationDictionary is empty\r\n\t\t/// throws an exception if all keys from 0 to (int.MaxValue - 1) are filled\r\n\t\t/// \u003C/summary\u003E\r\n\t\t/// \u003Creturns\u003E\u003C/returns\u003E\r\n\t\t/// \u003Cexception cref=\u0022InvalidOperationException\u0022\u003E\u003C/exception\u003E\r\n\t\tpublic int AddNewAnimation()\r\n\t\t{\r\n\t\t\t_internalDic ??= new();\r\n\t\t\tif ( AnimationSize.Length == 0 ) throw new InvalidOperationException( \u0022Cannot create an animation, no setters found\u0022 );\r\n\t\t\tfor ( int i = 0; true; i\u002B\u002B )\r\n\t\t\t{\r\n\t\t\t\tif ( i == int.MaxValue ) throw new InvalidOperationException( $\u0022AnimationDictionary could not find a key smaller than {int.MaxValue} to add a new animation\u0022 );\r\n\t\t\t\tif ( _internalDic.ContainsKey( i ) ) continue;\r\n\t\t\t\tCrosshairAnimation newAnim = CrosshairAnimation.FromPropertyCount( AnimationSize );\r\n\t\t\t\t_internalDic.Add( i, newAnim ); //Skips the implemented Add method, since both validity conditions are met\r\n\t\t\t\treturn i;\r\n\t\t\t}\r\n\t\t}\r\n\t\t/// \u003Csummary\u003E\r\n\t\t/// Returns the expected animation size based on the setters\r\n\t\t/// \u003C/summary\u003E\r\n\t\tpublic int[] AnimationSize =\u003E ValueSetters?.Sizes ?? Array.Empty\u003Cint\u003E();\r\n\t\tpublic override string ToString()\r\n\t\t{\r\n\t\t\tint[] s = AnimationSize;\r\n\t\t\treturn (s.Length == 3) ? \r\n\t\t\t\t$\u0022AnimationSize : [float:{s[0]}, int:{s[1]}, Color:{s[2]}]\u0022 : \r\n\t\t\t\t\u0022No AnimationSize set : length = \u0022 \u002B s.Length;\r\n\t\t}\r\n\t\t//-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-//\r\n\t\t//General features\r\n\t\t//Overriden Dictionary behaviour\r\n\t\t//-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-//\r\n\t\tpublic void Add( int key, CrosshairAnimation value )\r\n\t\t{\r\n\t\t\t_internalDic ??= new Dictionary\u003Cint,CrosshairAnimation\u003E();\r\n\t\t\tif ( CrosshairAnimation.SameSize( AnimationSize,value )) _internalDic.Add( key, value );\r\n\t\t}\r\n\t\tpublic CrosshairAnimation this[int key]\r\n\t\t{\r\n\t\t\tget =\u003E _internalDic[key];\r\n\t\t\tset\r\n\t\t\t{\r\n\t\t\t\tif ( CrosshairAnimation.SameSize( value,AnimationSize ) ) _internalDic[key] = value;\r\n\t\t\t\telse throw new InvalidOperationException( \u0022Cannot insert an animation of a different size from the others\u0022 );\r\n\t\t\t}\r\n\t\t}\r\n\t\t//-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-//\r\n\t\t//Overriden Dictionary behaviour\r\n\r\n\t\t//Editor features\r\n\t\t//-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-//\r\n#pragma warning disable\r\n#pragma warning enable\r\n\t\tpublic string[] FloatsPropertyNames;\r\n\t\tpublic string[] IntsPropertyNames;\r\n\t\tpublic string[] ColorsPropertyNames;\r\n\t\t//-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-//\r\n\t\t//Editor features\r\n\r\n\t\t//Internal properties\r\n\t\t//-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-//\r\n\t\tpublic AnimationValueSetter? ValueSetters { get; private set; }\r\n\t\tprivate Dictionary\u003Cint, CrosshairAnimation\u003E _internalDic;\r\n\t\t//-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-//\r\n\t\t//Internal properties\r\n\r\n\t\t//Unchanged IDictionary Implementations\r\n\t\t//-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-//\r\n\t\tpublic void Add( KeyValuePair\u003Cint, CrosshairAnimation\u003E item ) =\u003E Add( item.Key, item.Value );\r\n\t\tpublic bool ContainsKey( int key ) =\u003E _internalDic.ContainsKey( key );\r\n\t\tpublic bool Remove( int key ) =\u003E _internalDic.Remove( key );\r\n\t\tpublic bool TryGetValue( int key, [MaybeNullWhen( false )] out CrosshairAnimation value ) =\u003E _internalDic.TryGetValue( key, out value );\r\n\t\tpublic void Clear() =\u003E _internalDic.Clear();\r\n\t\tpublic bool Contains( KeyValuePair\u003Cint, CrosshairAnimation\u003E item ) =\u003E _internalDic.Contains( item );\r\n\t\tprivate void CopyTo( KeyValuePair\u003Cint, CrosshairAnimation\u003E[] array, int index )\r\n\t\t{\r\n\t\t\tif ( array == null ) throw new ArgumentNullException();\r\n\t\t\tif ( (uint)index \u003E (uint)array.Length ) throw new ArgumentOutOfRangeException( \u0022Array is too short to handle offset\u0022 );\r\n\t\t\tif ( array.Length - index \u003C Count ) throw new ArgumentOutOfRangeException( \u0022Array is too short to handle offset\u0022 );\r\n\r\n\t\t\tforeach ( var kvp in _internalDic )\r\n\t\t\t{\r\n\t\t\t\tarray[index\u002B\u002B] = new KeyValuePair\u003Cint, CrosshairAnimation\u003E( kvp.Key, kvp.Value );\r\n\t\t\t}\r\n\t\t}\r\n\t\tpublic bool Remove( KeyValuePair\u003Cint, CrosshairAnimation\u003E item )\r\n\t\t{\r\n\t\t\tbool success = _internalDic.TryGetValue( item.Key, out CrosshairAnimation correct );\r\n\t\t\tif ( !success ) return false;\r\n\t\t\tsuccess = correct == item.Value;\r\n\t\t\tif ( success ) _internalDic.Remove( item.Key );\r\n\t\t\treturn success;\r\n\t\t}\r\n\t\tpublic IEnumerator\u003CKeyValuePair\u003Cint, CrosshairAnimation\u003E\u003E GetEnumerator() =\u003E _internalDic.GetEnumerator();\r\n\t\tSystem.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() =\u003E GetEnumerator();\r\n\r\n\t\tvoid ICollection\u003CKeyValuePair\u003Cint, CrosshairAnimation\u003E\u003E.CopyTo( KeyValuePair\u003Cint, CrosshairAnimation\u003E[] array, int arrayIndex ) =\u003E CopyTo( array, arrayIndex );\r\n\r\n\t\tpublic void Add( object key, object value )\r\n\t\t{\r\n\t\t\tif(key is not int ik) throw new InvalidCastException();\r\n\t\t\tif(value is not CrosshairAnimation av) throw new InvalidCastException();\r\n\t\t\tAdd( ik, av );\r\n\t\t}\r\n\r\n\t\tpublic bool Contains( object key ) =\u003E key is int ik ? _internalDic.ContainsKey( ik ) : false;\r\n\r\n\t\tIDictionaryEnumerator IDictionary.GetEnumerator() =\u003E _internalDic.GetEnumerator();\r\n\r\n\t\tpublic void Remove( object key )\r\n\t\t{\r\n\t\t\tif( key is int ik) _internalDic.Remove( ik );\r\n\t\t}\r\n\r\n\t\tpublic void CopyTo( Array array, int index )\r\n\t\t{\r\n\t\t\tif(array == null) throw new ArgumentNullException();\r\n\t\t\tif(array.Rank != 1) throw new ArgumentException(\u0022Array cannot be multi-dimentional\u0022);\r\n\t\t\tif ( array.GetLowerBound( 0 ) != 0 ) throw new ArgumentException( \u0022Array\u0027s lower bound must be 0\u0022 );\r\n\t\t\tif ( (uint)index \u003E (uint)array.Length ) throw new ArgumentOutOfRangeException( \u0022Array is too short to handle offset\u0022 );\r\n\t\t\tif ( array.Length - index \u003C Count ) throw new ArgumentOutOfRangeException( \u0022Array is too short to handle offset\u0022 );\r\n\r\n\t\t\tif ( array is KeyValuePair\u003Cint, CrosshairAnimation\u003E[] kvpArr )\r\n\t\t\t{\r\n\t\t\t\tCopyTo( kvpArr, 0 );\r\n\t\t\t}\r\n\t\t\telse if ( array is DictionaryEntry[] deArr )\r\n\t\t\t{\r\n\t\t\t\tforeach(var kvp in _internalDic )\r\n\t\t\t\t{\r\n\t\t\t\t\tdeArr[index\u002B\u002B] = new DictionaryEntry( kvp.Key, kvp.Value );\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse if ( array is object[] objArr )\r\n\t\t\t{\r\n\r\n\t\t\t}\r\n\t\t\telse throw new ArgumentException( \u0022Array type is not compatible\u0022 );\r\n\r\n\t\t}\r\n\r\n\t\tpublic ICollection\u003Cint\u003E Keys =\u003E _internalDic.Keys;\r\n\t\tpublic ICollection\u003CCrosshairAnimation\u003E Values =\u003E _internalDic.Values;\r\n\t\tpublic int Count =\u003E _internalDic.Count;\r\n\t\tpublic bool IsReadOnly =\u003E false;\r\n\r\n\t\tpublic bool IsFixedSize =\u003E false;\r\n\r\n\t\tICollection IDictionary.Keys =\u003E _internalDic.Keys;\r\n\r\n\t\tICollection IDictionary.Values =\u003E _internalDic.Values;\r\n\r\n\t\tpublic bool IsSynchronized =\u003E false;\r\n\r\n\t\tpublic object SyncRoot =\u003E _internalDic;\r\n\r\n\t\tpublic object this[object key] { get =\u003E throw new NotImplementedException(); set =\u003E throw new NotImplementedException(); }\r\n\t\t//-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-//\r\n\t\t//Unchanged IDictionary Implementations\r\n\t}\r\n}\r\n"},{"Ident":"perkedel.testpen","Path":"Client.cs","FileName":"Client.cs","PackageType":"game","CodeKind":"Game","AssetVersionId":340855,"IsPrivate":false,"Code":"namespace ShrimplePawns;\r\n\r\n/// \u003Csummary\u003E\r\n/// The base client that you should inherit off of.\r\n/// \u003C/summary\u003E\r\npublic abstract class Client : Component\r\n{\r\n\t[Sync( SyncFlags.FromHost )]\r\n\tpublic System.Guid ConnectionId { get; private set; }\r\n\r\n\t[Sync( SyncFlags.FromHost )]\r\n\tprotected Pawn Pawn { get; set; }\r\n\r\n\tpublic Connection Connection =\u003E Connection.Find( ConnectionId );\r\n\r\n\t/// \u003Csummary\u003E\r\n\t/// Get the pawn only if it is valid.\r\n\t/// \u003C/summary\u003E\r\n\tpublic bool TryGetPawn\u003CT\u003E( out T pawn ) where T : Pawn\r\n\t{\r\n\t\tpawn = GetPawn\u003CT\u003E();\r\n\t\treturn pawn.IsValid();\r\n\t}\r\n\r\n\t/// \u003Csummary\u003E\r\n\t/// Get the pawn.\r\n\t/// \u003C/summary\u003E\r\n\tpublic T GetPawn\u003CT\u003E() where T : Pawn\r\n\t{\r\n\t\treturn Pawn as T;\r\n\t}\r\n\r\n\t/// \u003Csummary\u003E\r\n\t/// Get the pawn.\r\n\t/// \u003C/summary\u003E\r\n\tpublic Pawn GetPawn()\r\n\t{\r\n\t\treturn Pawn;\r\n\t}\r\n\r\n\t/// \u003Csummary\u003E\r\n\t/// Assigns the given connection as the client\u0027s current connection.\r\n\t/// This connection will be used to give ownership to any future assigned pawns.\r\n\t/// This must be called on the host!\r\n\t/// \u003C/summary\u003E\r\n\t/// \u003Cparam name=\u0022connection\u0022\u003EThe connection to assign to the client.\u003C/param\u003E\r\n\tpublic void AssignConnection( Connection connection )\r\n\t{\r\n\t\tif ( !Connection.Local.IsHost )\r\n\t\t{\r\n\t\t\tLog.Warning( \u0022Failed to call AssignConnection(...) due to being invoked on non-host client!\u0022 );\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tif ( connection == null )\r\n\t\t{\r\n\t\t\tLog.Warning( \u0022Failed to call AssignConnection(...) due to null connection param!\u0022 );\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tConnectionId = connection.Id;\r\n\t\tGameObject.Name = $\u0022{connection.DisplayName} - CLIENT\u0022;\r\n\t}\r\n\r\n\t/// \u003Csummary\u003E\r\n\t/// Creates a \u003Csee cref=\u0022GameObject\u0022 /\u003E from the given prefab file and assigns it as the client\u0027s current pawn.\r\n\t/// This must be called on the host!\r\n\t/// \u003C/summary\u003E\r\n\t/// \u003Cparam name=\u0022prefabFile\u0022\u003EThe prefab file that is used to create the pawn.\u003C/param\u003E\r\n\tpublic Pawn AssignPawn( PrefabFile prefabFile )\r\n\t{\r\n\t\tvar obj = SceneUtility.GetPrefabScene( prefabFile ).Clone();\r\n\t\treturn InternalAssign( obj );\r\n\t}\r\n\r\n\t/// \u003Csummary\u003E\r\n\t/// Assigns the given pawn type as the client\u0027s current pawn.\r\n\t/// The pawn type must have a \u003Csee cref=\u0022PawnAttribute\u0022 /\u003E defined in order to use this method.\r\n\t/// This must be called on the host!\r\n\t/// \u003C/summary\u003E\r\n\t/// \u003Creturns\u003EThe pawn component that the client was assigned to.\u003C/returns\u003E\r\n\tpublic T AssignPawn\u003CT\u003E() where T : Pawn\r\n\t{\r\n\t\tvar pawnAttribute = TypeLibrary.GetType\u003CT\u003E().GetAttribute\u003CPawnAttribute\u003E();\r\n\r\n\t\tvar path = pawnAttribute?.PrefabPath;\r\n\t\tif ( string.IsNullOrEmpty( path ) )\r\n\t\t{\r\n\t\t\tLog.Warning( $\u0022{typeof( T )} had no PawnAttribute prefab assigned to it.\u0022 );\r\n\t\t\treturn null;\r\n\t\t}\r\n\r\n\t\tvar obj = SceneUtility.GetPrefabScene( ResourceLibrary.Get\u003CPrefabFile\u003E( path ) ).Clone();\r\n\t\treturn InternalAssign\u003CT\u003E( obj ); ;\r\n\t}\r\n\r\n\t/// \u003Csummary\u003E\r\n\t/// Takes a \u003Csee cref=\u0022GameObject\u0022 /\u003E that already exists, networked spawns it, and assigns it to the client.\r\n\t/// This must be called on the host!\r\n\t/// \u003C/summary\u003E\r\n\t/// \u003Cparam name=\u0022obj\u0022\u003EThe pawn game object that will be networked spawned and assigned to the client.\u003C/param\u003E\r\n\tpublic Pawn AssignPawn( GameObject obj )\r\n\t{\r\n\t\treturn InternalAssign( obj );\r\n\t}\r\n\r\n\tprivate T InternalAssign\u003CT\u003E( GameObject obj ) where T : Pawn\r\n\t{\r\n\t\treturn (T)InternalAssign( obj );\r\n\t}\r\n\r\n\tprivate Pawn InternalAssign( GameObject obj )\r\n\t{\r\n\t\tif ( !Connection.Local?.IsHost ?? false )\r\n\t\t{\r\n\t\t\tobj.Destroy();\r\n\t\t\tLog.Warning( \u0022Attempted to call AssignPawn(...) on non-host client!\u0022 );\r\n\t\t\treturn null;\r\n\t\t}\r\n\r\n\t\tvar pawn = obj.Components.Get\u003CPawn\u003E();\r\n\t\tif ( !pawn.IsValid() )\r\n\t\t{\r\n\t\t\tobj.Destroy();\r\n\t\t\tLog.Warning( $\u0022Assigned GameObject ({obj.Name}) with no pawn component!\u0022 );\r\n\t\t\treturn null;\r\n\t\t}\r\n\r\n\t\tif ( Pawn.IsValid() )\r\n\t\t\tPawn.OnUnassign();\r\n\r\n\t\tvar assignedConnection = Connection ?? Connection.Host;\r\n\r\n\t\tif ( !obj.Network.Active )\r\n\t\t\tobj.NetworkSpawn( assignedConnection );\r\n\t\telse\r\n\t\t\tobj.Network.AssignOwnership( assignedConnection );\r\n\r\n\t\tobj.Name = $\u0022{assignedConnection.DisplayName} - PAWN\u0022;\r\n\r\n\t\tPawn = pawn;\r\n\t\tPawn.OnAssign( this );\r\n\r\n\t\treturn pawn;\r\n\t}\r\n}\r\n"},{"Ident":"perkedel.testpen","Path":"Core/Frame.cs","FileName":"Frame.cs","PackageType":"game","CodeKind":"Game","AssetVersionId":340855,"IsPrivate":false,"Code":"using System;\r\nusing System.Collections.Immutable;\r\nusing Sandbox;\r\n\r\nnamespace Goo;\r\n\r\n// Geometry payload for Sector / Arc Blobs.\r\n// Field meaning by BlobKind:\r\n//   Sector: A=StartAngle (deg, 0=up, cw\u002B), B=EndAngle, C=InnerRadius (0..1), D=OuterRadius (0..1), E=CornerRadius (0..1, fraction of outer radius)\r\n//   Arc:    A=StartAngle,                  B=EndAngle,  C=Radius (0..1, centerline), D=StrokeWidth (0..1), E=unused\r\npublic struct ShapeParams : System.IEquatable\u003CShapeParams\u003E\r\n{\r\n    public float A;\r\n    public float B;\r\n    public float C;\r\n    public float D;\r\n    public float E;   // Sector: CornerRadius (0..1 fraction of outer radius). Arc: unused (0).\r\n\r\n    public bool Equals(ShapeParams other) =\u003E A == other.A \u0026\u0026 B == other.B \u0026\u0026 C == other.C \u0026\u0026 D == other.D \u0026\u0026 E == other.E;\r\n    public override bool Equals(object? obj) =\u003E obj is ShapeParams p \u0026\u0026 Equals(p);\r\n    public override int GetHashCode() =\u003E System.HashCode.Combine(A, B, C, D, E);\r\n    public static bool operator ==(ShapeParams a, ShapeParams b) =\u003E a.Equals(b);\r\n    public static bool operator !=(ShapeParams a, ShapeParams b) =\u003E !a.Equals(b);\r\n\r\n    // Stable 64-bit hash of (kind, A, B, C, D) -- excludes E; used as a debug-name suffix only.\r\n    public long PackKey(BlobKind kind)\r\n    {\r\n        long qAngle(float deg)\r\n        {\r\n            float wrapped = deg - 360f * System.MathF.Floor(deg / 360f);\r\n            int n = (int)System.MathF.Round(wrapped * (16384f / 360f));\r\n            if (n == 16384) n = 0;\r\n            return (long)n;\r\n        }\r\n        long qUnit(float u)\r\n        {\r\n            int n = (int)System.MathF.Round(u * 16384f);\r\n            if (n \u003C 0) n = 0;\r\n            if (n \u003E 16383) n = 16383;\r\n            return (long)n;\r\n        }\r\n        return ((long)(byte)kind)\r\n             | (qAngle(A) \u003C\u003C 8)\r\n             | (qAngle(B) \u003C\u003C 22)\r\n             | (qUnit(C) \u003C\u003C 36)\r\n             | (qUnit(D) \u003C\u003C 50);\r\n    }\r\n}\r\n\r\ninternal struct Frame\r\n{\r\n    public BlobKind Kind;\r\n    public string? Key;\r\n    public string Content;     // Text-only; empty for non-Text\r\n    public StyleList Style;    // Container-only; null until StyleList added\r\n    public Children? Children; // Container-only; null otherwise\r\n    public BlobEvents Events;  // Container/Text/Image/ScenePanel; default = all null\r\n    public Texture? Texture;   // Image-only; null for non-Image\r\n    public string? Path;       // Image (texture path), ScenePanel (.scene path), SvgPanel (svg path), or WebPanel (URL); null otherwise\r\n    public Scene? Scene;       // ScenePanel-only; null for non-ScenePanel\r\n    public bool RenderOnce;    // ScenePanel-only; false for non-ScenePanel\r\n    public bool Paused;        // WebPanel-only; false for non-WebPanel\r\n    public string? Color;     // SvgPanel-only; null for non-SvgPanel\r\n    // TextEntry-only carry-fields. Path slot is reused for the text value via\r\n    // the Op.Text alias; these are the additional control-surface fields.\r\n    public string? Placeholder;\r\n    public int?    MaxLength;\r\n    public bool    Disabled;\r\n    public bool    Numeric;\r\n    public float?  MinValue;\r\n    public float?  MaxValue;\r\n    public string? NumberFormat;\r\n    public bool    Multiline;\r\n    public int?    MinLength;\r\n    public string? CharacterRegex;\r\n    public string? StringRegex;\r\n    public Func\u003Cchar, bool\u003E?   CanEnterChar;\r\n    public Func\u003Cstring, bool\u003E? Validate;\r\n    public Action\u003Cbool\u003E?       OnValidationChanged;\r\n    public Action\u003Cstring\u003E? OnChange;\r\n    public Action\u003Cstring\u003E? OnSubmit;\r\n    public Action?         OnFocus;\r\n    public Action\u003Cstring\u003E? OnBlur;\r\n    public Action?         OnCancel;\r\n    public bool    IsControlled;\r\n    public bool    ValueAndInitialTextBothSet;\r\n    public ShapeParams Shape;       // Sector / Arc only; default for non-shape kinds\r\n    public Vector2[]? Points;       // Polygon-only; null for non-Polygon kinds\r\n    // Custom-shader channel (Container only): a self-applying ShaderEffect, drawn via IPanelDraw.\r\n    public ShaderEffect? Effect;\r\n    // Global effect-addressing tag (Container only): resolves an effect from the host manifest.\r\n    public string? Tag;\r\n    // Custom-draw callback (Container only). Invoked from StatefulDrawPanel.OnDraw via the Canvas facade.\r\n    public DrawCallback? Draw;\r\n    // Declared layout-move transition (Container only); null = snap.\r\n    public LayoutTransition? LayoutTransition;\r\n    // Cell-only carry-fields; null/default for non-Cell kinds.\r\n    public Func\u003CCell\u003E?    CellFactory;   // first-mount path (new TCell())\r\n    public Action\u003CCell\u003E?  Seed;          // applied once at first mount only, in the fresh-create branch of DiffCell\r\n    public Action\u003CCell\u003E?  Configure;     // refresh props on the persistent instance each rebuild\r\n    public Type?          CellType;      // typeof(TCell): reuse-vs-fresh match check\r\n}\r\n"},{"Ident":"perkedel.testpen","Path":"Core/FrameList.cs","FileName":"FrameList.cs","PackageType":"game","CodeKind":"Game","AssetVersionId":340855,"IsPrivate":false,"Code":"using System;\r\n\r\nnamespace Goo;\r\n\r\ninternal sealed class FrameList\r\n{\r\n    Frame[] _items = new Frame[4];\r\n    int _count;\r\n    public int Count =\u003E _count;\r\n    public ref Frame this[int i] =\u003E ref _items[i];\r\n\r\n    public ref Frame Reserve()\r\n    {\r\n        if (_count == _items.Length) Array.Resize(ref _items, _items.Length * 2);\r\n        return ref _items[_count\u002B\u002B];\r\n    }\r\n\r\n    internal void Reset()\r\n    {\r\n        Array.Clear(_items, 0, _count);\r\n        _count = 0;\r\n    }\r\n}\r\n"},{"Ident":"perkedel.testpen","Path":"Core/Polygon.Style.g.cs","FileName":"Polygon.Style.g.cs","PackageType":"game","CodeKind":"Game","AssetVersionId":340855,"IsPrivate":false,"Code":"// \u003Cauto-generated /\u003E\r\n// Generated by tools/StyleFacadeEmit. Do not edit by hand.\r\n// Source of truth: tools/StyleFacadeEmit/style-manifest.json\r\nusing Sandbox;\r\nusing Sandbox.Rendering;\r\nusing Sandbox.UI;\r\n\r\nnamespace Goo;\r\n\r\npublic readonly partial record struct Polygon\r\n{\r\n    public Length? Width { init =\u003E _style = StyleAccumulator.Add(_style, StyleField.Width, value); }\r\n    public Length? Height { init =\u003E _style = StyleAccumulator.Add(_style, StyleField.Height, value); }\r\n    public Length? Margin { init =\u003E _style = StyleAccumulator.Add(_style, StyleField.Margin, value); }\r\n    public Length? MarginLeft { init =\u003E _style = StyleAccumulator.Add(_style, StyleField.MarginLeft, value); }\r\n    public Length? MarginTop { init =\u003E _style = StyleAccumulator.Add(_style, StyleField.MarginTop, value); }\r\n    public Length? MarginRight { init =\u003E _style = StyleAccumulator.Add(_style, StyleField.MarginRight, value); }\r\n    public Length? MarginBottom { init =\u003E _style = StyleAccumulator.Add(_style, StyleField.MarginBottom, value); }\r\n    public Color? BackgroundColor { init =\u003E _style = StyleAccumulator.Add(_style, StyleField.BackgroundColor, value, StyleValue.FromColor); }\r\n    public Color? BackgroundTint { init =\u003E _style = StyleAccumulator.Add(_style, StyleField.BackgroundTint, value, StyleValue.FromColor); }\r\n    public Length? Bottom { init =\u003E _style = StyleAccumulator.Add(_style, StyleField.Bottom, value); }\r\n    public Length? Left { init =\u003E _style = StyleAccumulator.Add(_style, StyleField.Left, value); }\r\n    public Length? Right { init =\u003E _style = StyleAccumulator.Add(_style, StyleField.Right, value); }\r\n    public Length? Top { init =\u003E _style = StyleAccumulator.Add(_style, StyleField.Top, value); }\r\n    public Length? FlexBasis { init =\u003E _style = StyleAccumulator.Add(_style, StyleField.FlexBasis, value); }\r\n    public float? FlexGrow { init =\u003E _style = StyleAccumulator.Add(_style, StyleField.FlexGrow, value); }\r\n    public float? FlexShrink { init =\u003E _style = StyleAccumulator.Add(_style, StyleField.FlexShrink, value); }\r\n    public Length? MaxHeight { init =\u003E _style = StyleAccumulator.Add(_style, StyleField.MaxHeight, value); }\r\n    public Length? MaxWidth { init =\u003E _style = StyleAccumulator.Add(_style, StyleField.MaxWidth, value); }\r\n    public Length? MinHeight { init =\u003E _style = StyleAccumulator.Add(_style, StyleField.MinHeight, value); }\r\n    public Length? MinWidth { init =\u003E _style = StyleAccumulator.Add(_style, StyleField.MinWidth, value); }\r\n    public float? Opacity { init =\u003E _style = StyleAccumulator.Add(_style, StyleField.Opacity, value); }\r\n    public PointerEvents? PointerEvents { init =\u003E _style = StyleAccumulator.Add(_style, StyleField.PointerEvents, value, StyleValue.FromPointerEvents); }\r\n    public PositionMode? Position { init =\u003E _style = StyleAccumulator.Add(_style, StyleField.Position, value, StyleValue.FromPositionMode); }\r\n    public Goo.PanelTransform? Transform { init =\u003E _style = StyleAccumulator.Add(_style, StyleField.Transform, value, StyleValue.FromPanelTransform); }\r\n}\r\n"},{"Ident":"perkedel.testpen","Path":"Core/Text.Style.g.cs","FileName":"Text.Style.g.cs","PackageType":"game","CodeKind":"Game","AssetVersionId":340855,"IsPrivate":false,"Code":"// \u003Cauto-generated /\u003E\r\n// Generated by tools/StyleFacadeEmit. Do not edit by hand.\r\n// Source of truth: tools/StyleFacadeEmit/style-manifest.json\r\nusing Sandbox;\r\nusing Sandbox.Rendering;\r\nusing Sandbox.UI;\r\n\r\nnamespace Goo;\r\n\r\npublic readonly partial record struct Text\r\n{\r\n    public Length? Width { init =\u003E _style = StyleAccumulator.Add(_style, StyleField.Width, value); }\r\n    public Length? Height { init =\u003E _style = StyleAccumulator.Add(_style, StyleField.Height, value); }\r\n    public Length? Margin { init =\u003E _style = StyleAccumulator.Add(_style, StyleField.Margin, value); }\r\n    public Length? MarginLeft { init =\u003E _style = StyleAccumulator.Add(_style, StyleField.MarginLeft, value); }\r\n    public Length? MarginTop { init =\u003E _style = StyleAccumulator.Add(_style, StyleField.MarginTop, value); }\r\n    public Length? MarginRight { init =\u003E _style = StyleAccumulator.Add(_style, StyleField.MarginRight, value); }\r\n    public Length? MarginBottom { init =\u003E _style = StyleAccumulator.Add(_style, StyleField.MarginBottom, value); }\r\n    public Color? BackgroundColor { init =\u003E _style = StyleAccumulator.Add(_style, StyleField.BackgroundColor, value, StyleValue.FromColor); }\r\n    public Color? BackgroundTint { init =\u003E _style = StyleAccumulator.Add(_style, StyleField.BackgroundTint, value, StyleValue.FromColor); }\r\n    public Length? FlexBasis { init =\u003E _style = StyleAccumulator.Add(_style, StyleField.FlexBasis, value); }\r\n    public float? FlexGrow { init =\u003E _style = StyleAccumulator.Add(_style, StyleField.FlexGrow, value); }\r\n    public float? FlexShrink { init =\u003E _style = StyleAccumulator.Add(_style, StyleField.FlexShrink, value); }\r\n    public Color? FontColor { init =\u003E _style = StyleAccumulator.Add(_style, StyleField.FontColor, value, StyleValue.FromColor); }\r\n    public string? FontFamily { init =\u003E _style = StyleAccumulator.Add(_style, StyleField.FontFamily, value); }\r\n    public Length? FontSize { init =\u003E _style = StyleAccumulator.Add(_style, StyleField.FontSize, value); }\r\n    public FontSmooth? FontSmooth { init =\u003E _style = StyleAccumulator.Add(_style, StyleField.FontSmooth, value, StyleValue.FromFontSmooth); }\r\n    public FontStyle? FontStyle { init =\u003E _style = StyleAccumulator.Add(_style, StyleField.FontStyle, value, StyleValue.FromFontStyle); }\r\n    public FontVariantNumeric? FontVariantNumeric { init =\u003E _style = StyleAccumulator.Add(_style, StyleField.FontVariantNumeric, value, StyleValue.FromFontVariantNumeric); }\r\n    public int? FontWeight { init =\u003E _style = StyleAccumulator.Add(_style, StyleField.FontWeight, value); }\r\n    public Length? LetterSpacing { init =\u003E _style = StyleAccumulator.Add(_style, StyleField.LetterSpacing, value); }\r\n    public Length? LineHeight { init =\u003E _style = StyleAccumulator.Add(_style, StyleField.LineHeight, value); }\r\n    public Length? MaxHeight { init =\u003E _style = StyleAccumulator.Add(_style, StyleField.MaxHeight, value); }\r\n    public Length? MaxWidth { init =\u003E _style = StyleAccumulator.Add(_style, StyleField.MaxWidth, value); }\r\n    public Length? MinHeight { init =\u003E _style = StyleAccumulator.Add(_style, StyleField.MinHeight, value); }\r\n    public Length? MinWidth { init =\u003E _style = StyleAccumulator.Add(_style, StyleField.MinWidth, value); }\r\n    public float? Opacity { init =\u003E _style = StyleAccumulator.Add(_style, StyleField.Opacity, value); }\r\n    public TextAlign? TextAlign { init =\u003E _style = StyleAccumulator.Add(_style, StyleField.TextAlign, value, StyleValue.FromTextAlign); }\r\n    public Length? TextBackgroundAngle { init =\u003E _style = StyleAccumulator.Add(_style, StyleField.TextBackgroundAngle, value); }\r\n    public Color? TextDecorationColor { init =\u003E _style = StyleAccumulator.Add(_style, StyleField.TextDecorationColor, value, StyleValue.FromColor); }\r\n    public TextDecoration? TextDecorationLine { init =\u003E _style = StyleAccumulator.Add(_style, StyleField.TextDecorationLine, value, StyleValue.FromTextDecoration); }\r\n    public TextSkipInk? TextDecorationSkipInk { init =\u003E _style = StyleAccumulator.Add(_style, StyleField.TextDecorationSkipInk, value, StyleValue.FromTextSkipInk); }\r\n    public TextDecorationStyle? TextDecorationStyle { init =\u003E _style = StyleAccumulator.Add(_style, StyleField.TextDecorationStyle, value, StyleValue.FromTextDecorationStyle); }\r\n    public Length? TextDecorationThickness { init =\u003E _style = StyleAccumulator.Add(_style, StyleField.TextDecorationThickness, value); }\r\n    public FilterMode? TextFilter { init =\u003E _style = StyleAccumulator.Add(_style, StyleField.TextFilter, value, StyleValue.FromFilterMode); }\r\n    public Length? TextLineThroughOffset { init =\u003E _style = StyleAccumulator.Add(_style, StyleField.TextLineThroughOffset, value); }\r\n    public TextOverflow? TextOverflow { init =\u003E _style = StyleAccumulator.Add(_style, StyleField.TextOverflow, value, StyleValue.FromTextOverflow); }\r\n    public Length? TextOverlineOffset { init =\u003E _style = StyleAccumulator.Add(_style, StyleField.TextOverlineOffset, value); }\r\n    public Color? TextStrokeColor { init =\u003E _style = StyleAccumulator.Add(_style, StyleField.TextStrokeColor, value, StyleValue.FromColor); }\r\n    public Length? TextStrokeWidth { init =\u003E _style = StyleAccumulator.Add(_style, StyleField.TextStrokeWidth, value); }\r\n    public TextTransform? TextTransform { init =\u003E _style = StyleAccumulator.Add(_style, StyleField.TextTransform, value, StyleValue.FromTextTransform); }\r\n    public Length? TextUnderlineOffset { init =\u003E _style = StyleAccumulator.Add(_style, StyleField.TextUnderlineOffset, value); }\r\n    public Goo.PanelTransform? Transform { init =\u003E _style = StyleAccumulator.Add(_style, StyleField.Transform, value, StyleValue.FromPanelTransform); }\r\n    public WhiteSpace? WhiteSpace { init =\u003E _style = StyleAccumulator.Add(_style, StyleField.WhiteSpace, value, StyleValue.FromWhiteSpace); }\r\n    public WordBreak? WordBreak { init =\u003E _style = StyleAccumulator.Add(_style, StyleField.WordBreak, value, StyleValue.FromWordBreak); }\r\n    public Length? WordSpacing { init =\u003E _style = StyleAccumulator.Add(_style, StyleField.WordSpacing, value); }\r\n    public Color? HoverBackgroundColor { init =\u003E _style = StyleAccumulator.Add(_style, StyleField.HoverBackgroundColor, value, StyleValue.FromColor); }\r\n    public Color? ActiveBackgroundColor { init =\u003E _style = StyleAccumulator.Add(_style, StyleField.ActiveBackgroundColor, value, StyleValue.FromColor); }\r\n    public Color? FocusBackgroundColor { init =\u003E _style = StyleAccumulator.Add(_style, StyleField.FocusBackgroundColor, value, StyleValue.FromColor); }\r\n    public Color? HoverFontColor { init =\u003E _style = StyleAccumulator.Add(_style, StyleField.HoverFontColor, value, StyleValue.FromColor); }\r\n    public Color? ActiveFontColor { init =\u003E _style = StyleAccumulator.Add(_style, StyleField.ActiveFontColor, value, StyleValue.FromColor); }\r\n    public Color? FocusFontColor { init =\u003E _style = StyleAccumulator.Add(_style, StyleField.FocusFontColor, value, StyleValue.FromColor); }\r\n    public int? TransitionMs { init =\u003E _style = StyleAccumulator.Add(_style, StyleField.TransitionMs, value); }\r\n}\r\n"},{"Ident":"perkedel.testpen","Path":"DataSubStructureSample.cs","FileName":"DataSubStructureSample.cs","PackageType":"game","CodeKind":"Game","AssetVersionId":340855,"IsPrivate":false,"Code":"public class DataSubStructureSample\r\n{\r\n\tpublic string Label { get; set; }\r\n\r\n\tpublic DataSubStructureSample(string writeLabel = \u0022a Label\u0022)\r\n\t{\r\n\t\tLabel = writeLabel;\r\n\t}\r\n}"},{"Ident":"perkedel.testpen","Path":"EffectMap.cs","FileName":"EffectMap.cs","PackageType":"game","CodeKind":"Game","AssetVersionId":340855,"IsPrivate":false,"Code":"using System.Collections.Generic;\n\nnamespace Goo;\n\n/// \u003Csummary\u003EA host-level \u003Cc\u003E{ tag -\u003E ShaderEffect }\u003C/c\u003E manifest. A Blob with a matching\n/// \u003Csee cref=\u0022Container.Tag\u0022/\u003E resolves its effect from here unless it sets \u003Cc\u003EEffect\u003C/c\u003E inline.\u003C/summary\u003E\npublic sealed class EffectMap : Dictionary\u003Cstring, ShaderEffect\u003E\n{\n    /// \u003Csummary\u003EThe shared empty manifest. Hosts that target no tags return this.\u003C/summary\u003E\n    public static readonly EffectMap Empty = new();\n}\n"},{"Ident":"perkedel.testpen","Path":"HitShape.cs","FileName":"HitShape.cs","PackageType":"game","CodeKind":"Game","AssetVersionId":340855,"IsPrivate":false,"Code":"using System;\nusing Sandbox;\n\nnamespace HitShapes;\n\n/// \u003Csummary\u003EFactory entry points for built-in \u003Csee cref=\u0022IHitShape\u0022/\u003E implementations.\u003C/summary\u003E\npublic static class HitShape\n{\n    public static IHitShape Radial(int slots, float innerRatio = 0f, float outerRatio = 1f, float startAngleDeg = 0f)\n        =\u003E ShapeCache.GetOrCreateRadial(slots, innerRatio, outerRatio, startAngleDeg);\n\n    public static IHitShape RectGrid(int cols, int rows)\n        =\u003E ShapeCache.GetOrCreateRectGrid(cols, rows);\n\n    public static IHitShape Custom(int slotCount, Vector2 nativeSize, Func\u003CVector2, int?\u003E resolver)\n        =\u003E new CustomNativeHitShape(slotCount, nativeSize, resolver ?? throw new ArgumentNullException(nameof(resolver)));\n\n    public static IHitShape CustomRaw(int slotCount, Func\u003CVector2, Vector2, int?\u003E resolver)\n        =\u003E new CustomRawHitShape(slotCount, resolver ?? throw new ArgumentNullException(nameof(resolver)));\n\n    public static IHitShape Polygon(params Vector2[] verts)\n    {\n        if (verts == null) throw new ArgumentNullException(nameof(verts));\n        if (verts.Length \u003C 3) throw new ArgumentException(\u0022Polygon requires at least 3 vertices.\u0022);\n        return new PolygonHitShape(new[] { verts });\n    }\n\n    public static IHitShape Polygons(params Vector2[][] polys)\n    {\n        if (polys == null) throw new ArgumentNullException(nameof(polys));\n        for (int i = 0; i \u003C polys.Length; i\u002B\u002B)\n        {\n            if (polys[i] == null) throw new ArgumentNullException(nameof(polys));\n            if (polys[i].Length \u003C 3) throw new ArgumentException(\u0022Polygon requires at least 3 vertices.\u0022);\n        }\n        return new PolygonHitShape(polys);\n    }\n\n    public static IHitShape Union(IHitShape a, IHitShape b)\n    {\n        if (a == null) throw new ArgumentNullException(nameof(a));\n        if (b == null) throw new ArgumentNullException(nameof(b));\n        return new UnionHitShape(a, b);\n    }\n\n    public static IHitShape Intersect(IHitShape a, IHitShape b)\n    {\n        if (a == null) throw new ArgumentNullException(nameof(a));\n        if (b == null) throw new ArgumentNullException(nameof(b));\n        return new IntersectHitShape(a, b);\n    }\n\n    public static IHitShape Difference(IHitShape a, IHitShape b)\n    {\n        if (a == null) throw new ArgumentNullException(nameof(a));\n        if (b == null) throw new ArgumentNullException(nameof(b));\n        return new DifferenceHitShape(a, b);\n    }\n}\n"},{"Ident":"perkedel.testpen","Path":"Internal/CustomNativeHitShape.cs","FileName":"CustomNativeHitShape.cs","PackageType":"game","CodeKind":"Game","AssetVersionId":340855,"IsPrivate":false,"Code":"using System;\nusing Sandbox;\n\nnamespace HitShapes;\n\ninternal sealed class CustomNativeHitShape : IHitShape\n{\n    readonly int _slotCount;\n    readonly Vector2 _nativeSize;\n    readonly Func\u003CVector2, int?\u003E _resolver;\n\n    public CustomNativeHitShape(int slotCount, Vector2 nativeSize, Func\u003CVector2, int?\u003E resolver)\n    {\n        _slotCount = slotCount;\n        _nativeSize = nativeSize;\n        _resolver = resolver;\n    }\n\n    public int SlotCount =\u003E _slotCount;\n\n    public int? Resolve(Vector2 local, Vector2 size)\n    {\n        if (size.x \u003C= 0f || size.y \u003C= 0f) return null;\n        var native = new Vector2(local.x * _nativeSize.x / size.x, local.y * _nativeSize.y / size.y);\n        var slot = _resolver(native);\n        if (slot is int s \u0026\u0026 (s \u003C 0 || s \u003E= _slotCount))\n            throw new InvalidOperationException(\u0022HitShape.Custom resolver returned a slot id outside [0, slotCount).\u0022);\n        return slot;\n    }\n}\n"},{"Ident":"perkedel.testpen","Path":"Internal/PolygonHitShape.cs","FileName":"PolygonHitShape.cs","PackageType":"game","CodeKind":"Game","AssetVersionId":340855,"IsPrivate":false,"Code":"using Sandbox;\n\nnamespace HitShapes;\n\ninternal sealed class PolygonHitShape : IHitShape\n{\n    readonly Vector2[][] _polygons;\n\n    public PolygonHitShape(Vector2[][] polygons)\n    {\n        _polygons = polygons;\n    }\n\n    public int SlotCount =\u003E _polygons.Length;\n\n    public int? Resolve(Vector2 local, Vector2 size)\n    {\n        if (size.x \u003C= 0f || size.y \u003C= 0f) return null;\n        var ux = local.x / size.x;\n        var uy = local.y / size.y;\n        for (int i = 0; i \u003C _polygons.Length; i\u002B\u002B)\n        {\n            if (PointInPolygon(ux, uy, _polygons[i])) return i;\n        }\n        return null;\n    }\n\n    static bool PointInPolygon(float px, float py, Vector2[] verts)\n    {\n        bool inside = false;\n        int n = verts.Length;\n        for (int i = 0, j = n - 1; i \u003C n; j = i\u002B\u002B)\n        {\n            var vi = verts[i];\n            var vj = verts[j];\n            if (((vi.y \u003E py) != (vj.y \u003E py)) \u0026\u0026\n                (px \u003C (vj.x - vi.x) * (py - vi.y) / (vj.y - vi.y) \u002B vi.x))\n                inside = !inside;\n        }\n        return inside;\n    }\n}\n"},{"Ident":"perkedel.testpen","Path":"Internal/StatefulWebPanel.cs","FileName":"StatefulWebPanel.cs","PackageType":"game","CodeKind":"Game","AssetVersionId":340855,"IsPrivate":false,"Code":"using System;\r\nusing Sandbox.UI;\r\n\r\nnamespace Goo.Internal;\r\n\r\ninternal sealed class StatefulWebPanel : Sandbox.UI.WebPanel, IStatefulEventHost\r\n{\r\n    internal Action\u003CMousePanelEvent\u003E? _onClick;\r\n    internal Action\u003CMousePanelEvent\u003E? _onRightClick;\r\n    internal Action\u003CMousePanelEvent\u003E? _onMiddleClick;\r\n    internal Action\u003CMousePanelEvent\u003E? _onMouseEnter;\r\n    internal Action\u003CMousePanelEvent\u003E? _onMouseLeave;\r\n    internal Action\u003CMousePanelEvent\u003E? _onMouseDown;\r\n    internal Action\u003CMousePanelEvent\u003E? _onMouseUp;\r\n    internal Action\u003CMousePanelEvent\u003E? _onMouseMove;\r\n    internal bool    _userSetPointerEvents;\r\n    internal Action? _requestRebuild;\r\n    public Action? RequestRebuild { set =\u003E _requestRebuild = value; }\r\n\r\n    public void ApplyEvents(in BlobEvents events)\r\n    {\r\n        _onClick      = events.OnClick;\r\n        _onRightClick = events.OnRightClick;\r\n        _onMiddleClick = events.OnMiddleClick;\r\n        _onMouseEnter = events.OnMouseEnter;\r\n        _onMouseLeave = events.OnMouseLeave;\r\n        _onMouseDown  = events.OnMouseDown;\r\n        _onMouseUp    = events.OnMouseUp;\r\n        _onMouseMove  = events.OnMouseMove;\r\n    }\r\n\r\n    public bool HasEventHandlers =\u003E\r\n        _onClick != null || _onRightClick != null || _onMiddleClick != null || _onMouseEnter != null || _onMouseLeave != null ||\r\n        _onMouseDown != null || _onMouseUp != null || _onMouseMove != null;\r\n\r\n    public bool UserSetPointerEvents\r\n    {\r\n        get =\u003E _userSetPointerEvents;\r\n        set =\u003E _userSetPointerEvents = value;\r\n    }\r\n\r\n    // (Engine #11055 corrected the WebPanel/Steam-HTML mousewheel sign; the former OnMouseWheel\r\n    //  override is gone - keeping it would now double-invert. See bd engine-fact-webpanel-scroll-inverted.)\r\n\r\n    protected override void OnClick(MousePanelEvent e)       { base.OnClick(e);       EventDispatch.Fire(_onClick, e, _requestRebuild); }\r\n    protected override void OnRightClick(MousePanelEvent e)  { base.OnRightClick(e);  EventDispatch.Fire(_onRightClick, e, _requestRebuild); }\r\n    protected override void OnMiddleClick(MousePanelEvent e) { base.OnMiddleClick(e); EventDispatch.Fire(_onMiddleClick, e, _requestRebuild); }\r\n    protected override void OnMouseOver(MousePanelEvent e)   { base.OnMouseOver(e);   EventDispatch.Fire(_onMouseEnter, e, _requestRebuild); }\r\n    protected override void OnMouseOut(MousePanelEvent e)    { base.OnMouseOut(e);    EventDispatch.Fire(_onMouseLeave, e, _requestRebuild); }\r\n    protected override void OnMouseDown(MousePanelEvent e)   { base.OnMouseDown(e);   EventDispatch.Fire(_onMouseDown, e, _requestRebuild); }\r\n    protected override void OnMouseUp(MousePanelEvent e)     { base.OnMouseUp(e);     EventDispatch.Fire(_onMouseUp, e, _requestRebuild); }\r\n    protected override void OnMouseMove(MousePanelEvent e)   { base.OnMouseMove(e);   EventDispatch.Fire(_onMouseMove, e, _requestRebuild); }\r\n}\r\n"},{"Ident":"perkedel.testpen","Path":"Pawn.cs","FileName":"Pawn.cs","PackageType":"game","CodeKind":"Game","AssetVersionId":340855,"IsPrivate":false,"Code":"namespace ShrimplePawns;\r\n\r\n/// \u003Csummary\u003E\r\n/// The base pawn that you should inherit off of.\r\n/// \u003C/summary\u003E\r\npublic abstract class Pawn : Component\r\n{\r\n\t/// \u003Csummary\u003E\r\n\t/// Called when the pawn has been assigned.\r\n\t/// \u003C/summary\u003E\r\n\tpublic virtual void OnAssign( Client client )\r\n\t{\r\n\r\n\t}\r\n\r\n\t/// \u003Csummary\u003E\r\n\t/// Called when the pawn has been unassigned.\r\n\t/// \u003C/summary\u003E\r\n\tpublic virtual void OnUnassign()\r\n\t{\r\n\t\tif ( GameObject.IsValid() )\r\n\t\t\tGameObject.Network.AssignOwnership( Connection.Host );\r\n\t}\r\n}\r\n"},{"Ident":"perkedel.testpen","Path":"PlayerControllerPlus/PlayerControllerPlus.cs","FileName":"PlayerControllerPlus.cs","PackageType":"game","CodeKind":"Game","AssetVersionId":340855,"IsPrivate":false,"Code":"using Sandbox.MovementPlus;\nnamespace Sandbox;\n\n[Icon( \u0022directions_walk\u0022 )]\n[EditorHandle( Icon = \u0022directions_walk\u0022 )]\n[Title( \u0022Player Controller Plus\u0022 )]\n[Category( \u0022Physics\u0022 )]\n[HelpUrl( \u0022https://sbox.game/dev/doc/scene/components/reference/player-controller/\u0022 )]\npublic sealed partial class PlayerControllerPlus : Component, IScenePhysicsEvents, Component.ExecuteInEditor\n{\n\t/// \u003Csummary\u003E\n\t/// This is used to keep a distance away from surfaces. For example, when grounding, we\u0027ll\n\t/// be a skin distance away from the ground.\n\t/// \u003C/summary\u003E\n\tconst float _skin = 0.095f;\n\n\tpublic CameraComponent CameraOverride { get; set; }\n\tpublic int InputPlayerIndex { get; set; } = -1;\n\n\t[Property, Hide, RequireComponent] public Rigidbody Body { get; set; }\n\n\tpublic CapsuleCollider BodyCollider { get; private set; }\n\tpublic BoxCollider FeetCollider { get; private set; }\n\n\t[Property, Hide]\n\tpublic GameObject ColliderObject { get; private set; }\n\n\tbool _showRigidBodyComponent;\n\n\n\t[Property, Group( \u0022Body\u0022 ), Range( 1, 64 )] public float BodyRadius { get; set; } = 16.0f;\n\t[Property, Group( \u0022Body\u0022 ), Range( 1, 128 )] public float BodyHeight { get; set; } = 72.0f;\n\t[Property, Group( \u0022Body\u0022 ), Range( 1, 1000 )] public float BodyMass { get; set; } = 500;\n\t[Property, Group( \u0022Body\u0022 )] public TagSet BodyCollisionTags { get; set; }\n\n\t/// \u003Csummary\u003E\n\t/// We will apply extra friction when we\u0027re on the ground and our desired velocity is\n\t/// lower than our current velocity, so we will slow down.\n\t/// \u003C/summary\u003E\n\t[Property, Group( \u0022Physics\u0022 ), Range( 0, 1 )] public float BrakePower { get; set; } = 1;\n\n\t/// \u003Csummary\u003E\n\t/// How much friction to add when we\u0027re in the air. This will slow you down unless you have a wish\n\t/// velocity.\n\t/// \u003C/summary\u003E\n\t[Property, Group( \u0022Physics\u0022 ), Range( 0, 1 )] public float AirFriction { get; set; } = 0.1f;\n\n\n\t[Property, Group( \u0022Components\u0022 ), Title( \u0022Show Rigidbody\u0022 )]\n\tpublic bool ShowRigidbodyComponent\n\t{\n\t\tget =\u003E _showRigidBodyComponent;\n\t\tset\n\t\t{\n\t\t\t_showRigidBodyComponent = value;\n\n\t\t\tif ( Body.IsValid() )\n\t\t\t{\n\t\t\t\tBody.Flags = Body.Flags.WithFlag( ComponentFlags.Hidden, !value );\n\t\t\t}\n\t\t}\n\t}\n\n\tbool _showColliderComponent;\n\n\t[Property, Group( \u0022Components\u0022 ), Title( \u0022Show Colliders\u0022 )]\n\tpublic bool ShowColliderComponents\n\t{\n\t\tget =\u003E _showColliderComponent;\n\t\tset\n\t\t{\n\t\t\t_showColliderComponent = value;\n\n\t\t\tif ( ColliderObject.IsValid() )\n\t\t\t{\n\t\t\t\tColliderObject.Flags = ColliderObject.Flags.WithFlag( GameObjectFlags.Hidden, !value );\n\t\t\t}\n\n\t\t\tif ( BodyCollider.IsValid() )\n\t\t\t{\n\t\t\t\tBodyCollider.Flags = BodyCollider.Flags.WithFlag( ComponentFlags.Hidden, !value );\n\t\t\t}\n\n\t\t\tif ( FeetCollider.IsValid() )\n\t\t\t{\n\t\t\t\tFeetCollider.Flags = FeetCollider.Flags.WithFlag( ComponentFlags.Hidden, !value );\n\t\t\t}\n\t\t}\n\t}\n\n\t[FeatureEnabled( \u0022Extended\u0022, Icon = \u0022tune\u0022 )]\n\tpublic bool UseExtendedFeatures { get; set; } = true;\n\n\t[Property, Feature( \u0022Extended\u0022 ), Title( \u0022Enable Extended Features\u0022 )] public bool ExtendedFeaturesEnabled { get; set; }\n\n\t/// \u003Csummary\u003E\n\t/// How much the character resists changes in movement direction. 0 = instant direction changes, 1 = very sluggish.\n\t/// \u003C/summary\u003E\n\t[Property, Feature( \u0022Extended\u0022 ), Group( \u0022General\u0022 ), Range( 0, 1 )] public float Inertia { get; set; } = 0;\n\n\t/// \u003Csummary\u003E\n\t/// When enabled, horizontal velocity is preserved when landing instead of being braked immediately.\n\t/// \u003C/summary\u003E\n\t[Property, Feature( \u0022Extended\u0022 ), Group( \u0022General\u0022 )] public bool PreserveVelocityOnLanding { get; set; }\n\n\t/// \u003Csummary\u003E\n\t/// Show a debug overlay with velocity, move state, and grounded state.\n\t/// \u003C/summary\u003E\n\t[Property, Feature( \u0022Extended\u0022 ), Group( \u0022General\u0022 )] public bool ShowStats { get; set; }\n\n\t/// \u003Csummary\u003E\n\t/// In first person, render the body normally but make head/hair/hats shadow-only so they don\u0027t clip into the camera.\n\t/// Requires HideBodyInFirstPerson to be false.\n\t/// \u003C/summary\u003E\n\t[Property, Feature( \u0022Extended\u0022 ), Group( \u0022Camera\u0022 )] public bool TrueFirstPerson { get; set; }\n\n\t/// \u003Csummary\u003E\n\t/// Offset from the head bone position for the first-person camera.\n\t/// \u003C/summary\u003E\n\t[Property, Feature( \u0022Extended\u0022 ), Group( \u0022Camera\u0022 )] public Vector3 TrueFirstPersonOffset { get; set; } = new Vector3( 0, 0, 0 );\n\n\t/// \u003Csummary\u003E\n\t/// Completely decouples the camera from the player. The camera stays in place\n\t/// and the body only rotates toward its movement direction.\n\t/// \u003C/summary\u003E\n\t[Property, Feature( \u0022Extended\u0022 ), Group( \u0022Camera\u0022 )] public bool DisableCameraBinding { get; set; }\n\n\t[Sync]\n\tpublic Vector3 WishVelocity { get; set; }\n\n\tpublic bool IsOnGround =\u003E GroundObject.IsValid();\n\n\t/// \u003Csummary\u003E\n\t/// Not touching the ground, and not swimming or climbing\n\t/// \u003C/summary\u003E\n\tpublic bool IsAirborne =\u003E !IsOnGround \u0026\u0026 !IsSwimming \u0026\u0026 !IsClimbing;\n\n\t/// \u003Csummary\u003E\n\t/// Our actual physical velocity minus our ground velocity\n\t/// \u003C/summary\u003E\n\tpublic Vector3 Velocity { get; private set; }\n\n\t/// \u003Csummary\u003E\n\t/// The velocity that the ground underneath us is moving\n\t/// \u003C/summary\u003E\n\tpublic Vector3 GroundVelocity { get; set; }\n\n\t/// \u003Csummary\u003E\n\t/// Set to true when entering a climbing \u003Csee cref=\u0022MoveModePlus\u0022/\u003E.\n\t/// \u003C/summary\u003E\n\tpublic bool IsClimbing { get; set; }\n\n\t/// \u003Csummary\u003E\n\t/// Set to true when entering a swimming \u003Csee cref=\u0022MoveModePlus\u0022/\u003E.\n\t/// \u003C/summary\u003E\n\tpublic bool IsSwimming { get; set; }\n\n\tprotected override void OnAwake()\n\t{\n\t\tbase.OnAwake();\n\n\t\t// Some scenes/prefabs may have saved the old colliders before\n\t\t// we moved them to their own GameObject. If that\u0027s the case then\n\t\t// we should destroy them right now to avoid any trouble.\n\t\t{\n\t\t\tvar bc = GetComponent\u003CBoxCollider\u003E();\n\t\t\tvar cc = GetComponent\u003CCapsuleCollider\u003E();\n\n\t\t\tif ( bc.IsValid() \u0026\u0026 cc.IsValid() \u0026\u0026 !bc.IsTrigger \u0026\u0026 !cc.IsTrigger )\n\t\t\t{\n\t\t\t\tbc.Destroy();\n\t\t\t\tcc.Destroy();\n\t\t\t}\n\t\t}\n\n\t\tCreateModeInstances();\n\t\tMode = _walkMode;\n\n\t\tEnsureComponentsCreated();\n\t\tUpdateBody();\n\n\t\tBody.Velocity = 0;\n\t}\n\n\tprotected override void OnEnabled()\n\t{\n\t\tbase.OnEnabled();\n\n\t\tEnableAnimationEvents();\n\n\t\tif ( !Scene.IsEditor )\n\t\t{\n\t\t\tEyeAngles = WorldRotation.Angles() with { pitch = 0, roll = 0 };\n\t\t\tWorldRotation = Rotation.Identity;\n\n\t\t\tif ( Renderer is not null ) Renderer.WorldRotation = new Angles( 0, EyeAngles.yaw, 0 );\n\t\t}\n\t}\n\n\tprotected override void OnDestroy()\n\t{\n\t\tbase.OnDestroy();\n\n\t\tCleanupTrueFirstPerson();\n\n\t\tColliderObject?.Destroy();\n\t\tColliderObject = default;\n\n\t\tBody?.Destroy();\n\t\tBody = default;\n\t}\n\n\tprotected override void OnDisabled()\n\t{\n\t\tbase.OnDisabled();\n\n\t\tDisableAnimationEvents();\n\t\tStopPressing();\n\t}\n\n\tprotected override void OnValidate()\n\t{\n\t\tEnsureComponentsCreated();\n\t\tUpdateBody();\n\t}\n\n\tvoid IScenePhysicsEvents.PrePhysicsStep()\n\t{\n\t\tUpdateBody();\n\n\t\tif ( IsProxy )\n\t\t\treturn;\n\n\t\tusing var scope = InputPlayerIndex \u003E= 0 ? Input.PlayerScope( InputPlayerIndex ) : null;\n\n\t\tMode.AddVelocity();\n\t\tMode.PrePhysicsStep();\n\t}\n\n\tvoid IScenePhysicsEvents.PostPhysicsStep()\n\t{\n\t\tVelocity = Body.Velocity - GroundVelocity;\n\t\tUpdateGroundVelocity();\n\n\t\tRestoreStep();\n\n\t\tMode?.PostPhysicsStep();\n\t\tCategorizeGround();\n\n\t\tChooseBestMoveMode();\n\t}\n\n\tTransform _groundTransform;\n\n\tvoid UpdateGroundVelocity()\n\t{\n\t\tif ( GroundObject is null )\n\t\t{\n\t\t\tGroundVelocity = 0;\n\t\t\treturn;\n\t\t}\n\n\t\tif ( GroundComponent is Collider collider )\n\t\t{\n\t\t\tGroundVelocity = collider.GetVelocityAtPoint( WorldPosition );\n\t\t}\n\n\t\tif ( GroundComponent is Rigidbody rigidbody )\n\t\t{\n\t\t\tvar mass1 = BodyMass;\n\t\t\tvar mass2 = rigidbody.Mass;\n\t\t\tvar massFactor = mass2 / (mass1 \u002B mass2);\n\t\t\tGroundVelocity = rigidbody.GetVelocityAtPoint( WorldPosition ) * massFactor;\n\t\t}\n\t}\n\n\t/// \u003Csummary\u003E\n\t/// Adds velocity in a special way. First we subtract any opposite velocity (ie, falling) then \n\t/// we add the velocity, but we clamp it to that direction. This means that if you jump when you\u0027re running\n\t/// up a platform, you don\u0027t get extra jump power.\n\t/// \u003C/summary\u003E\n\tpublic void Jump( Vector3 velocity )\n\t{\n\t\tPreventGrounding( 0.2f );\n\n\t\tvar currentVel = Body.Velocity;\n\n\t\t// moving in the opposite direction\n\t\t// because this is a jump, we want to counteract that\n\t\tvar dot = currentVel.Dot( velocity );\n\t\tif ( dot \u003C 0 )\n\t\t{\n\t\t\tcurrentVel = currentVel.SubtractDirection( velocity.Normal, 1 );\n\t\t}\n\n\t\tcurrentVel = currentVel.AddClamped( velocity, velocity.Length );\n\n\t\tBody.Velocity = currentVel;\n\t}\n\n\tvoid UpdateEyeTransform()\n\t{\n\t\tEyeTransform = Mode?.CalculateEyeTransform() ?? WorldTransform;\n\t}\n\n}\n"},{"Ident":"perkedel.testpen","Path":"PlayerGrab.cs","FileName":"PlayerGrab.cs","PackageType":"game","CodeKind":"Game","AssetVersionId":340855,"IsPrivate":false,"Code":"using System;\r\nusing Sandbox;\r\n\r\npublic class PlayerGrab : Component\r\n{\r\n\t/// \u003Csummary\u003E\r\n\t/// Input Action name for grabbing an object\r\n\t/// \u003C/summary\u003E\r\n    [Property] public string GrabActionName { get; set; } = \u0022Attack1\u0022;\r\n\t/// \u003Csummary\u003E\r\n\t/// Input Action name for rotating a held object\r\n\t/// \u003C/summary\u003E\r\n\t[Property] public string RotationActionName { get; set; } = \u0022reload\u0022;\r\n\t/// \u003Csummary\u003E\r\n\t/// Interact tag to search gameobjects for\r\n\t/// \u003C/summary\u003E\r\n    [Property] public string TagName { get; set; } = \u0022grab\u0022;\r\n\t/// \u003Csummary\u003E\r\n\t/// Length of the ray for raycast\r\n\t/// \u003C/summary\u003E\r\n    [Property] public float RayLength { get; set; } = 125.0f;\r\n\t/// \u003Csummary\u003E\r\n\t/// Base rotation speed factor\r\n\t/// \u003C/summary\u003E\r\n    [Property, MinMax(0f, 1.0f)] public float RotationSpeedFactor { get; set; } = 0.5f;\r\n\t/// \u003Csummary\u003E\r\n\t/// Minimum mass factor for rotating a held object\r\n\t/// \u003C/summary\u003E\r\n    [Property] public float MinRotationMassFactor { get; set; } = 0.1f;\r\n    public event Action\u003CGameObject\u003E OnObjectGrab;\r\n    public event Action\u003CGameObject\u003E OnObjectRelease;\r\n    public event Action\u003CGameObject\u003E OnObjectRotate;\r\n    public bool IsHoldingObject;\r\n    private GameObject _grabbedObject;\r\n    private Rigidbody _grabbedBody;\r\n    private CameraComponent _camera;\r\n    private PlayerController _playerController;\r\n    private SceneTraceResult _trace;\r\n    private Rotation _targetRotation;\r\n    private bool _isRotating;\r\n    private float _grabDistance;\r\n\r\n    protected override void OnStart()\r\n    {\r\n        base.OnStart();\r\n\r\n        _playerController = GetComponentInChildren\u003CPlayerController\u003E();\r\n        if ( _playerController == null )\r\n        {\r\n\t\t\tLog.Error( \u0022Failed to get PlayerController\u0022 );\r\n\t\t\treturn;\r\n        }\r\n\r\n        _camera = _playerController.UseCameraControls ? Scene.Camera : GetComponentInChildren\u003CCameraComponent\u003E();\r\n        if ( _camera == null )\r\n        {\r\n            Log.Error( \u0022Failed to get CameraComponent\u0022 );\r\n            return;\r\n        }\r\n\r\n    }\r\n\r\n\tprotected override void OnUpdate()\r\n    {\r\n        if ( StartedGrab() )\r\n        {\r\n            _trace = CastRay();\r\n\r\n            if ( _trace.Hit \u0026\u0026 _trace.GameObject.Tags.Has( TagName ) )\r\n            {\r\n                GrabObject( _trace.GameObject );\r\n            }\r\n        }\r\n\r\n        if ( ReleasedGrab() )\r\n        {\r\n            ReleaseObject();\r\n        }\r\n\r\n        _isRotating = Input.Down( RotationActionName );\r\n\r\n        if ( IsHoldingObject \u0026\u0026 _isRotating )\r\n        {\r\n\t        _playerController.UseLookControls = false;\r\n\r\n\t\t\tfloat mass = _grabbedBody.Mass.Clamp( 1f, 50f );\r\n\t\t\tfloat massFactor = MathF.Max( 1.0f / MathF.Sqrt( mass ), MinRotationMassFactor );\r\n            float yaw = Input.MouseDelta.x * RotationSpeedFactor * massFactor;\r\n            float pitch = Input.MouseDelta.y * RotationSpeedFactor * massFactor;\r\n            Rotation camRotation = _camera.WorldRotation;\r\n\r\n            _targetRotation = Rotation.FromAxis( camRotation.Up, yaw ) *\r\n                              Rotation.FromAxis( camRotation.Right, pitch ) *\r\n                              _targetRotation;\r\n\r\n\t\t\tOnObjectRotate?.Invoke( _grabbedObject );\r\n\r\n        }\r\n\r\n        if ( IsHoldingObject )\r\n        {\r\n            UpdateGrabbedObjectPosition();\r\n        }\r\n\r\n        if ( !_isRotating \u0026\u0026 !_playerController.UseLookControls )\r\n        {\r\n\t        _playerController.UseLookControls = true;\r\n        }\r\n    }\r\n\r\n    private bool StartedGrab() =\u003E Input.Pressed( GrabActionName ) \u0026\u0026 !IsHoldingObject;\r\n    private bool ReleasedGrab() =\u003E Input.Released( GrabActionName ) \u0026\u0026 IsHoldingObject;\r\n\r\n    private void GrabObject( GameObject gameObject )\r\n    {\r\n        if ( gameObject == null )\r\n        {\r\n            Log.Warning(\u0022[PlayerGrab] No object to grab\u0022);\r\n            return;\r\n        }\r\n\r\n        var body = gameObject.Components.Get\u003CRigidbody\u003E();\r\n        if ( body == null )\r\n        {\r\n            Log.Warning($\u0022[PlayerGrab] No Rigidbody on object\u0022);\r\n            return;\r\n        }\r\n\r\n        _grabbedObject = gameObject;\r\n        _grabbedBody = body;\r\n        _grabDistance = Vector3.DistanceBetween(\r\n            _camera.WorldPosition,\r\n            _grabbedObject.WorldPosition\r\n        );\r\n\r\n        _targetRotation = _grabbedObject.WorldRotation;\r\n        IsHoldingObject = true;\r\n\r\n        OnObjectGrab?.Invoke( _grabbedObject );\r\n    }\r\n\r\n    private void ReleaseObject()\r\n    {\r\n        OnObjectRelease?.Invoke( _grabbedObject );\r\n\r\n        IsHoldingObject = false;\r\n        _grabbedObject = null;\r\n        _grabbedBody = null;\r\n        _trace = new SceneTraceResult();\r\n    }\r\n\r\n    private void UpdateGrabbedObjectPosition()\r\n    {\r\n        if ( _grabbedBody == null ) return;\r\n\r\n        Vector3 targetPos =\r\n            _camera.WorldPosition \u002B\r\n            _camera.WorldRotation.Forward * _grabDistance;\r\n\r\n        float massFactor = _grabbedBody.Mass.Clamp( 1f, 50f );\r\n        float arriveTime = 0.05f \u002B (massFactor * 0.01f);\r\n        Transform targetTransform = new Transform( targetPos, _targetRotation );\r\n\r\n        _grabbedBody.SmoothMove(\r\n            targetTransform,\r\n            arriveTime,\r\n            Time.Delta\r\n        );\r\n    }\r\n\r\n    private SceneTraceResult CastRay()\r\n    {\r\n        Vector3 direction =\r\n            (_camera.ScreenToWorld( Screen.Size * 0.5f ) - _camera.WorldPosition).Normal;\r\n\r\n        Vector3 start = GameObject.WorldPosition \u002B new Vector3( 0.0f, 0.0f, 64.0f );\r\n        Vector3 end = start \u002B direction * RayLength;\r\n\r\n        return Scene.Trace.Ray( start, end )\r\n            .IgnoreGameObjectHierarchy( GameObject )\r\n            .UseHitboxes()\r\n            .Run();\r\n    }\r\n}\r\n"},{"Ident":"perkedel.testpen","Path":"SaveGameApiTest.cs","FileName":"SaveGameApiTest.cs","PackageType":"game","CodeKind":"Game","AssetVersionId":340855,"IsPrivate":false,"Code":"namespace Sandbox;\r\n\r\npublic sealed class SaveGameApiTest : Component\r\n{\r\n\t// https://sbox.game/dev/doc/assets/storage-ugc\r\n\t// Storage.Entry saveing { get; set; } = Storage.CreateEntry( \u0022save\u0022 );\r\n\tStorage.Entry saveing { get; set; } = Storage.CreateEntry( \u0022save\u0022 );\r\n\r\n\tprotected override void OnStart()\r\n\t{\r\n\t\tbase.OnStart();\r\n\t\tDataStructureSample data = new DataStructureSample(\u0022AAA BBB\u0022);\r\n\t\t//data.Name = \u0022AAA BBB\u0022;\r\n\t\t// saveing.SetMeta( \u0022playerName\u0022, \u0022awawa\u0022 );\r\n\t\t// saveing.SetMeta( \u0022someSome\u0022, \u0022sdafasklfjklwejlk\u0022 );\r\n\t\t// saveing.SetMeta( \u0022level\u0022, 12 );\r\n\t\t// saveing.Files.WriteAllText( \u0022saveingTeswt.txt\u0022, \u0022hello world\u0022 );\r\n\t\t// saveing.Files.WriteJson\u003CDataStructureSample\u003E( \u0022dataStructTest.json\u0022, data );\r\n\r\n\t\t// How about this instead?\r\n\t\t// https://sbox.game/dev/doc/assets/file-system\r\n\t\tFileSystem.Data.WriteJson\u003CDataStructureSample\u003E( \u0022dataStructTestRaw.json\u0022, data );\r\n\t\tFileSystem.OrganizationData.WriteJson\u003CDataStructureSample\u003E( \u0022dataStructTestRaw.json\u0022, data );\r\n\t\t// so saveing is only for doom?\r\n\r\n\t\t//DataStructureSample readData = saveing.Files.ReadJson\u003CDataStructureSample\u003E( \u0022dataStructTest.json\u0022 );\r\n\t\t//Log.Info( $\u0022Here data:,\\n\\n{readData}\u0022 );\r\n\r\n\t\tvar allSaves = Storage.GetAll( \u0022save\u0022 );\r\n\r\n\t\t/*\r\n\r\n\t\tforeach ( var save in allSaves )\r\n\t\t{\r\n    \t\t// Access entry properties\r\n\t\t    Log.Info( $\u0022Save: {save.Id}\u0022 );\r\n\t\t    Log.Info( $\u0022Created: {save.Created}\u0022 );\r\n\r\n\t\t    // Read metadata\r\n\t\t    var playerName = save.GetMeta\u003Cstring\u003E( \u0022playerName\u0022 );\r\n\t\t    var someSome = save.GetMeta\u003Cstring\u003E( \u0022someSome\u0022 );\r\n\t\t    var level = save.GetMeta\u003Cint\u003E( \u0022level\u0022 );\r\n\r\n\t\t    // Access the thumbnail\r\n\t\t    var thumbnail = save.Thumbnail;\r\n\r\n\t\t    // Read files from the entry\r\n\t\t    if ( save.Files.FileExists( \u0022player.json\u0022 ) )\r\n\t\t    {\r\n\t\t        var playerJson = save.Files.ReadAllText( \u0022player.json\u0022 );\r\n\t\t        // Load your game...\r\n\t\t    }\r\n\t\t}\r\n\t\t*/\r\n\t}\r\n\r\n\tprotected override void OnUpdate()\r\n\t{\r\n\r\n\t}\r\n}\r\n"}]}