{"TotalCount":132,"Files":[{"Ident":"lfinchgames.oneplusround","Path":"OMRBotController.CombatHumanization.cs","FileName":"OMRBotController.CombatHumanization.cs","PackageType":"game","CodeKind":"Game","AssetVersionId":399243,"IsPrivate":false,"Code":"using Sandbox;\nusing System;\n\npublic enum OMRBotCombatSequenceKind\n{\n    None,\n    AutomaticPressure,\n    AutomaticReset,\n    PrecisionReset,\n    ShotgunCommit,\n    PistolRhythm\n}\n\n/// \u003Csummary\u003E\n/// BOT 8A-8C combat execution and movement humanization.\n///\n/// This layer deliberately sits underneath BOT 7D\u0027s strategic choice. It does\n/// not invent hidden information and it does not bypass OMR locomotion/weapons.\n/// It converts doctrine into short combat rhythms: committed automatic bursts,\n/// post-shot precision resets, close-range shotgun commits and less robotic path\n/// steering. All physical movement still goes through PlayerMovementInput.\n/// \u003C/summary\u003E\npublic sealed partial class OMRBotController\n{\n    [Property, Group( \u0022BOT 8 / Combat\u0022 )]\n    public bool WeaponCombatSequencesEnabled { get; set; } = true;\n\n    [Property, Group( \u0022BOT 8 / Movement\u0022 )]\n    public bool HumanizedMovementEnabled { get; set; } = true;\n\n    [Property, Group( \u0022BOT 8 / Automatic Fire\u0022 ), Range( 0.02f, 0.30f )]\n    public float AutomaticBurstPauseMin { get; set; } = 0.065f;\n\n    [Property, Group( \u0022BOT 8 / Automatic Fire\u0022 ), Range( 0.04f, 0.45f )]\n    public float AutomaticBurstPauseMax { get; set; } = 0.18f;\n\n    [Property, Group( \u0022BOT 8 / Precision\u0022 ), Range( 0.10f, 1.25f )]\n    public float PrecisionPostShotResetScale { get; set; } = 0.78f;\n\n    [Property, Group( \u0022BOT 8 / Shotgun\u0022 ), Range( 0.20f, 1.5f )]\n    public float ShotgunCommitDuration { get; set; } = 0.72f;\n\n    [Property, Group( \u0022BOT 8 / Movement\u0022 ), Range( 0f, 0.8f )]\n    public float CombatInputReversalPenalty { get; set; } = 0.30f;\n\n    [Property, Group( \u0022BOT 8 / Movement\u0022 ), Range( 36f, 140f )]\n    public float CorridorCenteringProbeDistance { get; set; } = 82f;\n\n    [Property, Group( \u0022BOT 8 / Movement\u0022 ), Range( 0f, 0.8f )]\n    public float CorridorCenteringStrength { get; set; } = 0.34f;\n\n    [Property, Group( \u0022BOT 8 / Movement\u0022 ), Range( 0.04f, 0.35f )]\n    public float CorridorProbeInterval { get; set; } = 0.12f;\n\n    [Property, Sync( SyncFlags.FromHost )]\n    public string CombatSequenceStatus { get; set; } = \u0022IDLE\u0022;\n\n    [Property, Sync( SyncFlags.FromHost )]\n    public string HumanizationStatus { get; set; } = \u0022READY\u0022;\n\n    private OMRBotCombatSequenceKind _combatSequence = OMRBotCombatSequenceKind.None;\n    private OneMoreRoundWeapon _combatSequenceWeapon;\n    private int _automaticBurstShotsRemaining;\n    private float _automaticBurstPauseUntil = -999f;\n    private float _precisionResetUntil = -999f;\n    private float _shotgunCommitUntil = -999f;\n    private float _pistolRhythmUntil = -999f;\n    private float _lastSequenceShotAt = -999f;\n\n    private float _nextCorridorProbeAt;\n    private float _corridorSteeringBias;\n\n    private void ResetCombatHumanization()\n    {\n        _combatSequence = OMRBotCombatSequenceKind.None;\n        _combatSequenceWeapon = null;\n        _automaticBurstShotsRemaining = 0;\n        _automaticBurstPauseUntil = -999f;\n        _precisionResetUntil = -999f;\n        _shotgunCommitUntil = -999f;\n        _pistolRhythmUntil = -999f;\n        _lastSequenceShotAt = -999f;\n        _nextCorridorProbeAt = 0f;\n        _corridorSteeringBias = 0f;\n        CombatSequenceStatus = \u0022IDLE\u0022;\n        HumanizationStatus = \u0022READY\u0022;\n    }\n\n    private void RefreshCombatSequenceContext( OneMoreRoundWeapon weapon )\n    {\n        if ( !WeaponCombatSequencesEnabled || weapon?.IsValid != true )\n        {\n            _combatSequence = OMRBotCombatSequenceKind.None;\n            _combatSequenceWeapon = weapon;\n            _automaticBurstShotsRemaining = 0;\n            CombatSequenceStatus = WeaponCombatSequencesEnabled ? \u0022UNARMED\u0022 : \u0022OFF\u0022;\n            return;\n        }\n\n        if ( _combatSequenceWeapon != weapon )\n        {\n            _combatSequenceWeapon = weapon;\n            _automaticBurstShotsRemaining = 0;\n            _automaticBurstPauseUntil = -999f;\n            _precisionResetUntil = -999f;\n            _shotgunCommitUntil = -999f;\n            _pistolRhythmUntil = -999f;\n            _combatSequence = OMRBotCombatSequenceKind.None;\n        }\n\n        OMRBotWeaponDoctrine doctrine = GetWeaponDoctrine( weapon );\n        float distance = _hasConfirmedSight\n            ? ( _observedTargetPosition - WorldPosition ).WithZ( 0f ).Length\n            : float.PositiveInfinity;\n\n        if (\n            doctrine.Archetype == OMRWeaponArchetype.Shotgun \u0026\u0026\n            _hasConfirmedSight \u0026\u0026\n            distance \u003E doctrine.LegacyHoldDistance * 0.92f \u0026\u0026\n            distance \u003C= doctrine.LegacyMaximumFireDistance * 1.05f\n        )\n        {\n            _shotgunCommitUntil = MathF.Max(\n                _shotgunCommitUntil,\n                Time.Now \u002B MathF.Max( 0.20f, ShotgunCommitDuration ) * 0.45f\n            );\n        }\n\n        if ( Time.Now \u003C _precisionResetUntil )\n        {\n            _combatSequence = OMRBotCombatSequenceKind.PrecisionReset;\n            CombatSequenceStatus = $\u0022PRECISION RESET \u00B7 {MathF.Max( 0f, _precisionResetUntil - Time.Now ):0.00}s\u0022;\n        }\n        else if ( Time.Now \u003C _automaticBurstPauseUntil )\n        {\n            _combatSequence = OMRBotCombatSequenceKind.AutomaticReset;\n            CombatSequenceStatus = $\u0022BURST RESET \u00B7 {MathF.Max( 0f, _automaticBurstPauseUntil - Time.Now ):0.00}s\u0022;\n        }\n        else if ( doctrine.IsAutomatic \u0026\u0026 _automaticBurstShotsRemaining \u003E 0 )\n        {\n            _combatSequence = OMRBotCombatSequenceKind.AutomaticPressure;\n            CombatSequenceStatus = $\u0022AUTO PRESSURE \u00B7 {_automaticBurstShotsRemaining} SHOTS\u0022;\n        }\n        else if ( Time.Now \u003C _shotgunCommitUntil )\n        {\n            _combatSequence = OMRBotCombatSequenceKind.ShotgunCommit;\n            CombatSequenceStatus = \u0022SHOTGUN COMMIT\u0022;\n        }\n        else if ( Time.Now \u003C _pistolRhythmUntil )\n        {\n            _combatSequence = OMRBotCombatSequenceKind.PistolRhythm;\n            CombatSequenceStatus = \u0022PRECISION RHYTHM\u0022;\n        }\n        else\n        {\n            _combatSequence = OMRBotCombatSequenceKind.None;\n            CombatSequenceStatus = doctrine.DisplayName;\n        }\n    }\n\n    private bool TryAllowCombatSequenceShot(\n        OneMoreRoundWeapon weapon,\n        float distance,\n        out string holdReason\n    )\n    {\n        holdReason = string.Empty;\n        if ( !WeaponCombatSequencesEnabled || weapon?.IsValid != true )\n            return true;\n\n        OMRBotWeaponDoctrine doctrine = GetWeaponDoctrine( weapon );\n        if ( !doctrine.IsAutomatic )\n            return true;\n\n        if ( Time.Now \u003C _automaticBurstPauseUntil )\n        {\n            holdReason = \u0022BURST RESET\u0022;\n            return false;\n        }\n\n        if ( _automaticBurstShotsRemaining \u003C= 0 )\n            BeginAutomaticBurst( doctrine, distance );\n\n        return _automaticBurstShotsRemaining \u003E 0;\n    }\n\n    private void BeginAutomaticBurst( OMRBotWeaponDoctrine doctrine, float distance )\n    {\n        int minShots;\n        int maxShots;\n\n        if ( doctrine.WeaponId == \u0022mp5\u0022 )\n        {\n            minShots = 7;\n            maxShots = 13;\n        }\n        else if ( doctrine.WeaponId == \u0022m4a1\u0022 )\n        {\n            minShots = distance \u003E doctrine.LegacyHoldDistance * 1.25f ? 3 : 5;\n            maxShots = distance \u003E doctrine.LegacyHoldDistance * 1.25f ? 6 : 9;\n        }\n        else\n        {\n            minShots = 4;\n            maxShots = 8;\n        }\n\n        if ( _hasConfirmedSight \u0026\u0026 Difficulty != OMRBotDifficulty.Easy \u0026\u0026\n            distance \u003C= doctrine.LegacyHoldDistance * 1.25f \u0026\u0026 CombatAimError \u003C= GetFireToleranceDegrees() * 1.25f )\n        {\n            minShots \u002B= 3;\n            maxShots \u002B= 5;\n        }\n\n        if ( Difficulty == OMRBotDifficulty.Easy )\n        {\n            minShots = Math.Max( 2, minShots - 2 );\n            maxShots = Math.Max( minShots, maxShots - 2 );\n        }\n        else if ( Difficulty == OMRBotDifficulty.Hard )\n        {\n            maxShots \u002B= 2;\n        }\n\n        float sustained = MathX.Clamp( doctrine.SustainedFireBias, 0f, 1f );\n        int weightedMax = Math.Max(\n            minShots,\n            (int)MathF.Round( MathX.Lerp( minShots, maxShots, sustained ) )\n        );\n\n        _automaticBurstShotsRemaining = Game.Random.Int( minShots, weightedMax );\n        _combatSequence = OMRBotCombatSequenceKind.AutomaticPressure;\n        CombatSequenceStatus = $\u0022AUTO PRESSURE \u00B7 {_automaticBurstShotsRemaining} SHOTS\u0022;\n    }\n\n    private float GetCombatSequenceTriggerInterval( OneMoreRoundWeapon weapon )\n    {\n        if ( weapon?.IsValid == true \u0026\u0026 weapon.IsAutomaticWeapon ) return 0f;\n        return GetBotTriggerInterval( weapon );\n    }\n\n    private void OnCombatSequenceShotFired( OneMoreRoundWeapon weapon, float distance )\n    {\n        if ( !WeaponCombatSequencesEnabled || weapon?.IsValid != true )\n            return;\n\n        _lastSequenceShotAt = Time.Now;\n        OMRBotWeaponDoctrine doctrine = GetWeaponDoctrine( weapon );\n\n        if ( doctrine.IsAutomatic )\n        {\n            _automaticBurstShotsRemaining = Math.Max( 0, _automaticBurstShotsRemaining - 1 );\n            if ( _automaticBurstShotsRemaining \u003C= 0 )\n            {\n                float minPause = MathF.Max( 0.02f, AutomaticBurstPauseMin );\n                float maxPause = MathF.Max( minPause, AutomaticBurstPauseMax );\n                float discipline = MathX.Clamp( doctrine.BurstDisciplineBias, 0f, 1f );\n                float pause = Game.Random.Float( minPause, maxPause );\n                pause *= MathX.Lerp( 0.65f, 1.25f, discipline );\n                if ( Difficulty == OMRBotDifficulty.Hard ) pause *= 0.82f;\n                if ( Difficulty == OMRBotDifficulty.Easy ) pause *= 1.18f;\n                _automaticBurstPauseUntil = Time.Now \u002B pause;\n                _combatSequence = OMRBotCombatSequenceKind.AutomaticReset;\n            }\n            else\n            {\n                _combatSequence = OMRBotCombatSequenceKind.AutomaticPressure;\n            }\n\n            // Do not let a healthy automatic-fire engagement get interrupted by a\n            // trivially different utility score halfway through a committed burst.\n            if (\n                _utilitySelectedIntent == OMRBotIntentKind.Engage ||\n                _utilitySelectedIntent == OMRBotIntentKind.Press\n            )\n            {\n                _utilityCommitUntil = MathF.Max( _utilityCommitUntil, Time.Now \u002B 0.26f );\n            }\n            return;\n        }\n\n        if ( doctrine.PostShotResetBias \u003E= 0.72f )\n        {\n            float reset = MathF.Max(\n                0.18f,\n                doctrine.FireInterval * MathF.Max( 0.25f, PrecisionPostShotResetScale )\n            );\n            reset *= MathX.Lerp( 0.70f, 1.10f, doctrine.PostShotResetBias );\n            _precisionResetUntil = Time.Now \u002B reset;\n            _combatSequence = OMRBotCombatSequenceKind.PrecisionReset;\n\n            // If the shot came from an authored cover peek, immediately begin the\n            // existing return-to-anchor phase. The next peek naturally alternates.\n            if ( _coverPeekActive \u0026\u0026 !_coverPeekReturning )\n            {\n                _coverPeekReturning = true;\n                _coverPeekUntil = -1f;\n            }\n            _nextUtilityDecisionAt = 0f;\n            return;\n        }\n\n        if ( doctrine.Archetype == OMRWeaponArchetype.Shotgun )\n        {\n            _shotgunCommitUntil = Time.Now \u002B MathF.Max( 0.20f, ShotgunCommitDuration );\n            _combatSequence = OMRBotCombatSequenceKind.ShotgunCommit;\n            _nextUtilityDecisionAt = 0f;\n            return;\n        }\n\n        if ( doctrine.Archetype == OMRWeaponArchetype.Pistol )\n        {\n            _pistolRhythmUntil = Time.Now \u002B MathF.Max( 0.12f, doctrine.FireInterval * 0.65f );\n            _combatSequence = OMRBotCombatSequenceKind.PistolRhythm;\n        }\n    }\n\n    private float GetCombatSequenceUtilityAdjustment( OMRBotIntentKind intent )\n    {\n        if ( !WeaponCombatSequencesEnabled )\n            return 0f;\n\n        OMRBotWeaponDoctrine doctrine = _brainWeaponDoctrine ?? OMRBotWeaponDoctrine.Empty;\n        float adjustment = 0f;\n\n        bool autoPressure =\n            _combatSequence == OMRBotCombatSequenceKind.AutomaticPressure \u0026\u0026\n            _automaticBurstShotsRemaining \u003E 0;\n        bool precisionReset = Time.Now \u003C _precisionResetUntil;\n        bool shotgunCommit = Time.Now \u003C _shotgunCommitUntil;\n        bool pistolRhythm = Time.Now \u003C _pistolRhythmUntil;\n\n        if ( autoPressure )\n        {\n            if ( intent == OMRBotIntentKind.Engage ) adjustment \u002B= 0.20f;\n            if ( intent == OMRBotIntentKind.Press ) adjustment \u002B= 0.10f \u002B doctrine.AggressiveCommitBias * 0.05f;\n            if ( intent == OMRBotIntentKind.Reposition ) adjustment -= 0.09f;\n            if ( intent == OMRBotIntentKind.TakeCover ) adjustment -= 0.10f;\n            if ( intent == OMRBotIntentKind.FlankLeft || intent == OMRBotIntentKind.FlankRight ) adjustment -= 0.05f;\n        }\n\n        if ( precisionReset )\n        {\n            if ( intent == OMRBotIntentKind.TakeCover ) adjustment \u002B= 0.42f * doctrine.PostShotResetBias;\n            if ( intent == OMRBotIntentKind.Reposition ) adjustment \u002B= 0.28f * doctrine.PostShotResetBias;\n            if ( intent == OMRBotIntentKind.OpenDistance ) adjustment \u002B= 0.18f * doctrine.PostShotResetBias;\n            if ( intent == OMRBotIntentKind.Engage ) adjustment -= 0.32f * doctrine.PostShotResetBias;\n            if ( intent == OMRBotIntentKind.Press ) adjustment -= 0.38f * doctrine.PostShotResetBias;\n        }\n\n        if ( shotgunCommit )\n        {\n            if ( intent == OMRBotIntentKind.Press ) adjustment \u002B= 0.20f \u002B doctrine.AggressiveCommitBias * 0.16f;\n            if ( intent == OMRBotIntentKind.Engage ) adjustment \u002B= 0.10f \u002B doctrine.AggressiveCommitBias * 0.05f;\n            if ( intent == OMRBotIntentKind.FlankLeft || intent == OMRBotIntentKind.FlankRight ) adjustment \u002B= 0.07f;\n            if ( intent == OMRBotIntentKind.OpenDistance ) adjustment -= 0.32f;\n            if ( intent == OMRBotIntentKind.TakeCover ) adjustment -= 0.10f;\n        }\n\n        if ( pistolRhythm )\n        {\n            if ( intent == OMRBotIntentKind.Engage ) adjustment \u002B= 0.05f;\n            if ( intent == OMRBotIntentKind.Reposition ) adjustment \u002B= 0.035f;\n        }\n\n        return adjustment;\n    }\n\n    private void ApplyCombatSequenceMovementScore(\n        Vector3 localInput,\n        OMRBotWeaponDoctrine doctrine,\n        float currentDistance,\n        float holdDistance,\n        ref float score\n    )\n    {\n        if ( !WeaponCombatSequencesEnabled || doctrine is null )\n            return;\n\n        float forward = localInput.x;\n        float lateral = MathF.Abs( localInput.y );\n        float amount = localInput.WithZ( 0f ).Length;\n\n        if ( _combatSequence == OMRBotCombatSequenceKind.AutomaticPressure )\n        {\n            score \u002B= lateral * doctrine.SustainedFireBias * 0.12f;\n            if ( amount \u003C= 0.01f ) score \u002B= doctrine.CombatStabilityBias * 0.06f;\n        }\n\n        if ( Time.Now \u003C _precisionResetUntil )\n        {\n            if ( forward \u003C -0.05f ) score \u002B= 0.32f * doctrine.PostShotResetBias;\n            if ( lateral \u003E 0.30f ) score \u002B= 0.18f * doctrine.PostShotResetBias;\n            if ( forward \u003E 0.05f ) score -= 0.34f * doctrine.PostShotResetBias;\n        }\n\n        if ( Time.Now \u003C _shotgunCommitUntil )\n        {\n            if ( currentDistance \u003E holdDistance * 0.82f \u0026\u0026 forward \u003E 0.05f ) score \u002B= 0.38f;\n            if ( currentDistance \u003E holdDistance \u0026\u0026 forward \u003C -0.05f ) score -= 0.42f;\n            score \u002B= lateral * 0.06f;\n        }\n    }\n\n    private bool TryHoldPrecisionResetInCover( OneMoreRoundWeapon weapon )\n    {\n        if (\n            !WeaponCombatSequencesEnabled ||\n            weapon?.IsValid != true ||\n            Time.Now \u003E= _precisionResetUntil ||\n            !_hasCoverTarget ||\n            _coverPeekActive\n        )\n            return false;\n\n        OMRBotWeaponDoctrine doctrine = GetWeaponDoctrine( weapon );\n        if ( doctrine.PostShotResetBias \u003C 0.72f )\n            return false;\n\n        EnsureBotCrouchState( _coverPosture == OMRCoverPosture.Crouch );\n        StopMovementOnly();\n        ReleaseBotWeaponIntent( weapon );\n        CombatWantsAim = false;\n        CoverStatus = weapon.IsCyclePendingOrActive\n            ? \u0022RESET / CYCLING IN COVER\u0022\n            : \u0022RESET / HIDDEN\u0022;\n        TacticalStatus = \u0022POST-SHOT RESET\u0022;\n        CombatStatus = weapon.IsCyclePendingOrActive ? \u0022CYCLING IN COVER\u0022 : \u0022RESETTING\u0022;\n        return true;\n    }\n\n    private float GetHumanizedCombatDecisionIntervalScale( OMRBotWeaponDoctrine doctrine )\n    {\n        if ( !HumanizedMovementEnabled || doctrine is null )\n            return 1f;\n\n        float scale = MathX.Lerp( 0.94f, 1.16f, doctrine.CombatStabilityBias );\n        if ( _combatSequence == OMRBotCombatSequenceKind.AutomaticPressure )\n            scale *= 0.92f;\n        if ( Time.Now \u003C _precisionResetUntil )\n            scale *= 1.08f;\n        return scale;\n    }\n\n    private bool ApplyHumanizedCombatCandidateScore(\n        Vector3 localInput,\n        float wallClearance,\n        ref float score\n    )\n    {\n        if ( !HumanizedMovementEnabled )\n            return true;\n\n        Vector3 previous = _combatCommittedInput.WithZ( 0f );\n        Vector3 proposed = localInput.WithZ( 0f );\n        if ( !previous.IsNearlyZero( 0.01f ) \u0026\u0026 !proposed.IsNearlyZero( 0.01f ) )\n        {\n            float directionalDot = previous.Normal.Dot( proposed.Normal );\n            if ( directionalDot \u003C -0.20f )\n                score -= MathF.Max( 0f, CombatInputReversalPenalty ) * MathF.Abs( directionalDot );\n            else if ( directionalDot \u003E 0.72f )\n                score \u002B= 0.055f;\n        }\n\n        // The existing four-direction clearance probe is already paid for by BOT\n        // 7B. Use it more decisively instead of adding another per-candidate trace\n        // batch. This rejects the classic AI behavior of deliberately walking with\n        // its shoulder almost scraping arena walls.\n        if ( !proposed.IsNearlyZero( 0.01f ) )\n        {\n            float clearance = wallClearance;\n            float minimum = Difficulty switch\n            {\n                OMRBotDifficulty.Easy =\u003E 0.09f,\n                OMRBotDifficulty.Hard =\u003E 0.15f,\n                _ =\u003E 0.12f\n            };\n            if ( clearance \u003C minimum )\n                return false;\n            score \u002B= clearance * 0.10f;\n        }\n\n        return true;\n    }\n\n    private Vector3 ApplyHumanizedPathSteering( Vector3 desired )\n    {\n        if (\n            !HumanizedMovementEnabled ||\n            Scene is null ||\n            desired.WithZ( 0f ).IsNearlyZero( 0.01f )\n        )\n        {\n            HumanizationStatus = HumanizedMovementEnabled ? \u0022READY\u0022 : \u0022OFF\u0022;\n            return desired;\n        }\n\n        Vector3 forward = desired.WithZ( 0f ).Normal;\n        Vector3 lateral = new Vector3( -forward.y, forward.x, 0f ).Normal;\n\n        if ( Time.Now \u003E= _nextCorridorProbeAt )\n        {\n            _nextCorridorProbeAt = Time.Now \u002B MathF.Max( 0.04f, CorridorProbeInterval );\n            float probe = MathF.Max( 36f, CorridorCenteringProbeDistance );\n            float leftDistance = ProbeHumanizedWallDistance( lateral, probe );\n            float rightDistance = ProbeHumanizedWallDistance( -lateral, probe );\n            float leftPressure = 1f - MathX.Clamp( leftDistance / probe, 0f, 1f );\n            float rightPressure = 1f - MathX.Clamp( rightDistance / probe, 0f, 1f );\n            _corridorSteeringBias = MathX.Clamp( rightPressure - leftPressure, -1f, 1f );\n        }\n\n        float strength = MathF.Max( 0f, CorridorCenteringStrength );\n        if ( MathF.Abs( _corridorSteeringBias ) \u003C= 0.025f || strength \u003C= 0f )\n        {\n            HumanizationStatus = \u0022CENTERED\u0022;\n            return forward;\n        }\n\n        Vector3 adjusted = ( forward \u002B lateral * _corridorSteeringBias * strength ).WithZ( 0f );\n        if ( adjusted.IsNearlyZero( 0.01f ) )\n            return forward;\n\n        HumanizationStatus = _corridorSteeringBias \u003E 0f ? \u0022CENTER / LEFT\u0022 : \u0022CENTER / RIGHT\u0022;\n        return adjusted.Normal;\n    }\n\n    private float ProbeHumanizedWallDistance( Vector3 direction, float maximum )\n    {\n        Vector3 start = WorldPosition \u002B Vector3.Up * 34f;\n        SceneTrace trace =\n            Scene.Trace.Ray( start, start \u002B direction.WithZ( 0f ).Normal * maximum )\n                .IgnoreGameObjectHierarchy( GameObject )\n                .WithoutTags( \u0022trigger\u0022 )\n                .UseHitboxes( false );\n\n        if ( _perceptionTarget?.GameObject is not null )\n            trace = trace.IgnoreGameObjectHierarchy( _perceptionTarget.GameObject );\n\n        SceneTraceResult result = trace.Run();\n        if ( !result.Hit )\n            return maximum;\n\n        return MathF.Min( maximum, ( result.EndPosition - start ).Length );\n    }\n}\n"},{"Ident":"lfinchgames.oneplusround","Path":"OMRWeaponMetadata.cs","FileName":"OMRWeaponMetadata.cs","PackageType":"game","CodeKind":"Game","AssetVersionId":399243,"IsPrivate":false,"Code":"using Sandbox;\nusing System;\nusing System.Collections.Generic;\n\n/// \u003Csummary\u003E\n/// Stable gameplay archetype for OMR weapon selection.\n///\n/// This is intentionally broader than a weapon\u0027s exact identity:\n/// - WeaponId identifies one exact weapon (\u0022usp\u0022, \u0022mp5\u0022, \u0022m4a1\u0022).\n/// - WeaponArchetype lets future round presets ask for a class\n///   (\u0022any shotgun\u0022, \u0022any sniper\u0022) without relying on prefab filenames.\n///\n/// Mechanical facts that already exist in BaseCombatWeapon, such as\n/// PrimaryAutomatic or Ballistics.Pellets, are NOT duplicated here.\n/// \u003C/summary\u003E\npublic enum OMRWeaponArchetype\n{\n\tUnknown,\n\tPistol,\n\tSubmachineGun,\n\tAssaultRifle,\n\tShotgun,\n\tSniperRifle,\n\tRevolver,\n\tSpecial\n}\n\n/// \u003Csummary\u003E\n/// Small, dependency-free helper layer around weapon prefab metadata.\n///\n/// Round rules and modifier selection can use this instead of knowing about\n/// prefab filenames or duplicating component lookups throughout the project.\n/// \u003C/summary\u003E\npublic static class OMRWeaponUtility\n{\n\tpublic static OneMoreRoundWeapon GetWeapon(\n\t\tGameObject prefab\n\t)\n\t{\n\t\tif (\n\t\t\tprefab is null ||\n\t\t\t!prefab.IsValid\n\t\t)\n\t\t{\n\t\t\treturn null;\n\t\t}\n\n\t\treturn prefab.Components.Get\u003COneMoreRoundWeapon\u003E(\n\t\t\tFindMode.InSelf |\n\t\t\tFindMode.InDescendants\n\t\t);\n\t}\n\n\tpublic static string GetWeaponId(\n\t\tGameObject prefab\n\t)\n\t{\n\t\tOneMoreRoundWeapon weapon =\n\t\t\tGetWeapon(\n\t\t\t\tprefab\n\t\t\t);\n\n\t\tif ( weapon is null )\n\t\t\treturn string.Empty;\n\n\t\tif (\n\t\t\tweapon.Definition is not null \u0026\u0026\n\t\t\tweapon.Definition.IsValid \u0026\u0026\n\t\t\t!string.IsNullOrWhiteSpace( weapon.Definition.WeaponId )\n\t\t)\n\t\t{\n\t\t\treturn weapon.Definition.WeaponId.Trim();\n\t\t}\n\n\t\tif ( string.IsNullOrWhiteSpace( weapon.WeaponId ) )\n\t\t\treturn string.Empty;\n\n\t\treturn weapon.WeaponId.Trim();\n\t}\n\n\tpublic static string GetDisplayName(\n\t\tGameObject prefab\n\t)\n\t{\n\t\tOneMoreRoundWeapon weapon =\n\t\t\tGetWeapon(\n\t\t\t\tprefab\n\t\t\t);\n\n\t\tif ( weapon is not null )\n\t\t{\n\t\t\tif (\n\t\t\t\tweapon.Definition is not null \u0026\u0026\n\t\t\t\tweapon.Definition.IsValid \u0026\u0026\n\t\t\t\t!string.IsNullOrWhiteSpace( weapon.Definition.DisplayName )\n\t\t\t)\n\t\t\t{\n\t\t\t\treturn weapon.Definition.DisplayName.Trim();\n\t\t\t}\n\n\t\t\tif ( !string.IsNullOrWhiteSpace( weapon.DisplayName ) )\n\t\t\t\treturn weapon.DisplayName.Trim();\n\t\t}\n\n\t\tif (\n\t\t\tprefab is not null \u0026\u0026\n\t\t\tprefab.IsValid \u0026\u0026\n\t\t\t!string.IsNullOrWhiteSpace(\n\t\t\t\tprefab.Name\n\t\t\t)\n\t\t)\n\t\t{\n\t\t\treturn prefab.Name\n\t\t\t\t.Replace(\n\t\t\t\t\t\u0022_\u0022,\n\t\t\t\t\t\u0022 \u0022\n\t\t\t\t)\n\t\t\t\t.Trim();\n\t\t}\n\n\t\treturn \u0022Unknown Weapon\u0022;\n\t}\n\n\tpublic static bool MatchesArchetype(\n\t\tGameObject prefab,\n\t\tOMRWeaponArchetype archetype\n\t)\n\t{\n\t\tOneMoreRoundWeapon weapon =\n\t\t\tGetWeapon(\n\t\t\t\tprefab\n\t\t\t);\n\n\t\tif ( weapon is null )\n\t\t\treturn false;\n\n\t\tOMRWeaponArchetype candidate =\n\t\t\tweapon.Definition is not null \u0026\u0026 weapon.Definition.IsValid\n\t\t\t\t? weapon.Definition.Archetype\n\t\t\t\t: weapon.WeaponArchetype;\n\n\t\treturn candidate == archetype;\n\t}\n\n\tpublic static GameObject FindById(\n\t\tIEnumerable\u003CGameObject\u003E prefabs,\n\t\tstring weaponId\n\t)\n\t{\n\t\tif (\n\t\t\tprefabs is null ||\n\t\t\tstring.IsNullOrWhiteSpace(\n\t\t\t\tweaponId\n\t\t\t)\n\t\t)\n\t\t{\n\t\t\treturn null;\n\t\t}\n\n\t\tforeach (\n\t\t\tGameObject prefab in prefabs\n\t\t)\n\t\t{\n\t\t\tstring candidate =\n\t\t\t\tGetWeaponId(\n\t\t\t\t\tprefab\n\t\t\t\t);\n\n\t\t\tif (\n\t\t\t\tstring.Equals(\n\t\t\t\t\tcandidate,\n\t\t\t\t\tweaponId,\n\t\t\t\t\tStringComparison.OrdinalIgnoreCase\n\t\t\t\t)\n\t\t\t)\n\t\t\t{\n\t\t\t\treturn prefab;\n\t\t\t}\n\t\t}\n\n\t\treturn null;\n\t}\n}\n"},{"Ident":"lfinchgames.oneplusround","Path":"OMRWeaponStats.cs","FileName":"OMRWeaponStats.cs","PackageType":"game","CodeKind":"Game","AssetVersionId":399243,"IsPrivate":false,"Code":"using Sandbox;\nusing System;\nusing System.Collections.Generic;\n\n/// \u003Csummary\u003E\n/// Plain runtime data representing the effective authored/gameplay values of a\n/// weapon. Instances are copied before modifiers are applied, so the source\n/// OMRWeaponDefinition is never mutated during gameplay.\n/// \u003C/summary\u003E\npublic sealed class OMRWeaponStats\n{\n\t// Identity is carried with the snapshot for diagnostics and filtering. It is\n\t// not intended to be changed by ordinary stat modifiers.\n\tpublic string WeaponId { get; set; } = string.Empty;\n\tpublic string DisplayName { get; set; } = string.Empty;\n\tpublic OMRWeaponArchetype Archetype { get; set; } = OMRWeaponArchetype.Unknown;\n\n\t// Fire / ballistics\n\tpublic float Damage { get; set; }\n\tpublic int Pellets { get; set; }\n\tpublic float Range { get; set; }\n\tpublic float Radius { get; set; }\n\tpublic float Force { get; set; }\n\tpublic Vector2 SpreadBase { get; set; }\n\tpublic Vector2 SpreadGrowth { get; set; }\n\tpublic float SpreadRecovery { get; set; }\n\tpublic bool PrimaryAutomatic { get; set; }\n\tpublic float PrimaryDelay { get; set; }\n\tpublic int ClipMaxSize { get; set; }\n\tpublic float ReloadTime { get; set; }\n\tpublic float DeployTime { get; set; }\n\tpublic bool AutoReload { get; set; }\n\tpublic bool CanCancelReload { get; set; }\n\n\t// Handling\n\tpublic float IronSightsFireScale { get; set; }\n\tpublic float AimFovScale { get; set; }\n\tpublic float AimFovTransitionTime { get; set; }\n\tpublic float AimAnimationSpeed { get; set; }\n\tpublic float SprintToFireDelay { get; set; }\n\tpublic float SprintFirePoseHoldTime { get; set; }\n\n\t// Accuracy\n\tpublic OMRMovementAccuracyModel MovementAccuracyModel { get; set; }\n\tpublic float MovingSpeedThreshold { get; set; }\n\tpublic float MovementAccuracyStartFraction { get; set; }\n\tpublic float MovementAccuracyFullFraction { get; set; }\n\tpublic float MovingSpreadMultiplier { get; set; }\n\tpublic float CrouchedSpreadMultiplier { get; set; }\n\tpublic float AirborneSpreadMultiplier { get; set; }\n\tpublic float SlidingSpreadMultiplier { get; set; }\n\tpublic float AimSpreadMultiplier { get; set; }\n\n\t// Recoil\n\tpublic OMRGameplayRecoilModel RecoilModel { get; set; }\n\tpublic Vector2 RecoilPitch { get; set; }\n\tpublic Vector2 RecoilYaw { get; set; }\n\tpublic OMRRecoilPattern RecoilPatternAsset { get; set; }\n\tpublic Vector2 RecoilPatternScale { get; set; } = Vector2.One;\n\tpublic List\u003CVector2\u003E RecoilPattern { get; set; } = new();\n\tpublic Vector2 RecoilPatternNoise { get; set; }\n\tpublic float RecoilPatternResetDelay { get; set; }\n\tpublic bool RecoilPatternLoop { get; set; }\n\tpublic bool RecoilRecoveryEnabled { get; set; }\n\tpublic float RecoilRecoveryFraction { get; set; }\n\tpublic float RecoilRecoveryDelay { get; set; }\n\tpublic float RecoilRecoveryPitchSpeed { get; set; }\n\tpublic float RecoilRecoveryYawSpeed { get; set; }\n\tpublic float CameraRecoilRoll { get; set; }\n\tpublic float CameraRecoilFrequency { get; set; }\n\tpublic float CameraRecoilDuration { get; set; }\n\tpublic float AdsCameraRecoilScale { get; set; }\n\n\t// Crosshair\n\tpublic float CrosshairSpreadVisualScale { get; set; }\n\tpublic float CrosshairMinimumGap { get; set; }\n\tpublic float CrosshairMaximumGap { get; set; }\n\tpublic float CrosshairLineLength { get; set; }\n\tpublic float CrosshairLineWidth { get; set; }\n\tpublic Color CrosshairColor { get; set; }\n\n\tpublic OMRWeaponStats Clone()\n\t{\n\t\treturn new OMRWeaponStats\n\t\t{\n\t\t\tWeaponId = WeaponId,\n\t\t\tDisplayName = DisplayName,\n\t\t\tArchetype = Archetype,\n\n\t\t\tDamage = Damage,\n\t\t\tPellets = Pellets,\n\t\t\tRange = Range,\n\t\t\tRadius = Radius,\n\t\t\tForce = Force,\n\t\t\tSpreadBase = SpreadBase,\n\t\t\tSpreadGrowth = SpreadGrowth,\n\t\t\tSpreadRecovery = SpreadRecovery,\n\t\t\tPrimaryAutomatic = PrimaryAutomatic,\n\t\t\tPrimaryDelay = PrimaryDelay,\n\t\t\tClipMaxSize = ClipMaxSize,\n\t\t\tReloadTime = ReloadTime,\n\t\t\tDeployTime = DeployTime,\n\t\t\tAutoReload = AutoReload,\n\t\t\tCanCancelReload = CanCancelReload,\n\n\t\t\tIronSightsFireScale = IronSightsFireScale,\n\t\t\tAimFovScale = AimFovScale,\n\t\t\tAimFovTransitionTime = AimFovTransitionTime,\n\t\t\tAimAnimationSpeed = AimAnimationSpeed,\n\t\t\tSprintToFireDelay = SprintToFireDelay,\n\t\t\tSprintFirePoseHoldTime = SprintFirePoseHoldTime,\n\n\t\t\tMovementAccuracyModel = MovementAccuracyModel,\n\t\t\tMovingSpeedThreshold = MovingSpeedThreshold,\n\t\t\tMovementAccuracyStartFraction = MovementAccuracyStartFraction,\n\t\t\tMovementAccuracyFullFraction = MovementAccuracyFullFraction,\n\t\t\tMovingSpreadMultiplier = MovingSpreadMultiplier,\n\t\t\tCrouchedSpreadMultiplier = CrouchedSpreadMultiplier,\n\t\t\tAirborneSpreadMultiplier = AirborneSpreadMultiplier,\n\t\t\tSlidingSpreadMultiplier = SlidingSpreadMultiplier,\n\t\t\tAimSpreadMultiplier = AimSpreadMultiplier,\n\n\t\t\tRecoilModel = RecoilModel,\n\t\t\tRecoilPitch = RecoilPitch,\n\t\t\tRecoilYaw = RecoilYaw,\n\t\t\tRecoilPatternAsset = RecoilPatternAsset,\n\t\t\tRecoilPatternScale = RecoilPatternScale,\n\t\t\tRecoilPattern = RecoilPattern is null\n\t\t\t\t? new List\u003CVector2\u003E()\n\t\t\t\t: new List\u003CVector2\u003E( RecoilPattern ),\n\t\t\tRecoilPatternNoise = RecoilPatternNoise,\n\t\t\tRecoilPatternResetDelay = RecoilPatternResetDelay,\n\t\t\tRecoilPatternLoop = RecoilPatternLoop,\n\t\t\tRecoilRecoveryEnabled = RecoilRecoveryEnabled,\n\t\t\tRecoilRecoveryFraction = RecoilRecoveryFraction,\n\t\t\tRecoilRecoveryDelay = RecoilRecoveryDelay,\n\t\t\tRecoilRecoveryPitchSpeed = RecoilRecoveryPitchSpeed,\n\t\t\tRecoilRecoveryYawSpeed = RecoilRecoveryYawSpeed,\n\t\t\tCameraRecoilRoll = CameraRecoilRoll,\n\t\t\tCameraRecoilFrequency = CameraRecoilFrequency,\n\t\t\tCameraRecoilDuration = CameraRecoilDuration,\n\t\t\tAdsCameraRecoilScale = AdsCameraRecoilScale,\n\n\t\t\tCrosshairSpreadVisualScale = CrosshairSpreadVisualScale,\n\t\t\tCrosshairMinimumGap = CrosshairMinimumGap,\n\t\t\tCrosshairMaximumGap = CrosshairMaximumGap,\n\t\t\tCrosshairLineLength = CrosshairLineLength,\n\t\t\tCrosshairLineWidth = CrosshairLineWidth,\n\t\t\tCrosshairColor = CrosshairColor\n\t\t};\n\t}\n\n\tpublic static OMRWeaponStats FromDefinition( OMRWeaponDefinition definition )\n\t{\n\t\tif ( definition is null || !definition.IsValid )\n\t\t\treturn null;\n\n\t\tOMROpticProfile optic =\n\t\t\tdefinition.OpticProfile is not null \u0026\u0026\n\t\t\tdefinition.OpticProfile.IsValid\n\t\t\t\t? definition.OpticProfile\n\t\t\t\t: null;\n\n\t\treturn new OMRWeaponStats\n\t\t{\n\t\t\tWeaponId = definition.WeaponId?.Trim() ?? string.Empty,\n\t\t\tDisplayName = definition.DisplayName?.Trim() ?? string.Empty,\n\t\t\tArchetype = definition.Archetype,\n\n\t\t\tDamage = definition.Damage,\n\t\t\tPellets = definition.Pellets,\n\t\t\tRange = definition.Range,\n\t\t\tRadius = definition.Radius,\n\t\t\tForce = definition.Force,\n\t\t\tSpreadBase = definition.SpreadBase,\n\t\t\tSpreadGrowth = definition.SpreadGrowth,\n\t\t\tSpreadRecovery = definition.SpreadRecovery,\n\t\t\tPrimaryAutomatic = definition.PrimaryAutomatic,\n\t\t\tPrimaryDelay = definition.PrimaryDelay,\n\t\t\tClipMaxSize = definition.ClipMaxSize,\n\t\t\tReloadTime = definition.ReloadTime,\n\t\t\tDeployTime = definition.DeployTime,\n\t\t\tAutoReload = definition.AutoReload,\n\t\t\tCanCancelReload = definition.CanCancelReload,\n\n\t\t\tIronSightsFireScale = definition.IronSightsFireScale,\n\t\t\tAimFovScale = optic?.AimFovScale ?? definition.AimFovScale,\n\t\t\tAimFovTransitionTime = optic?.AimTransitionTime ?? definition.AimFovTransitionTime,\n\t\t\tAimAnimationSpeed = optic?.AimAnimationSpeed ?? definition.AimAnimationSpeed,\n\t\t\tSprintToFireDelay = definition.SprintToFireDelay,\n\t\t\tSprintFirePoseHoldTime = definition.SprintFirePoseHoldTime,\n\n\t\t\tMovementAccuracyModel = definition.MovementAccuracyModel,\n\t\t\tMovingSpeedThreshold = definition.MovingSpeedThreshold,\n\t\t\tMovementAccuracyStartFraction = definition.MovementAccuracyStartFraction,\n\t\t\tMovementAccuracyFullFraction = definition.MovementAccuracyFullFraction,\n\t\t\tMovingSpreadMultiplier = definition.MovingSpreadMultiplier,\n\t\t\tCrouchedSpreadMultiplier = definition.CrouchedSpreadMultiplier,\n\t\t\tAirborneSpreadMultiplier = definition.AirborneSpreadMultiplier,\n\t\t\tSlidingSpreadMultiplier = definition.SlidingSpreadMultiplier,\n\t\t\tAimSpreadMultiplier = definition.AimSpreadMultiplier,\n\n\t\t\tRecoilModel = definition.RecoilModel,\n\t\t\tRecoilPitch = definition.RecoilPitch,\n\t\t\tRecoilYaw = definition.RecoilYaw,\n\t\t\tRecoilPatternAsset = definition.RecoilPatternAsset,\n\t\t\tRecoilPatternScale = definition.RecoilPatternScale,\n\t\t\tRecoilPattern = definition.RecoilPattern is null\n\t\t\t\t? new List\u003CVector2\u003E()\n\t\t\t\t: new List\u003CVector2\u003E( definition.RecoilPattern ),\n\t\t\tRecoilPatternNoise = definition.RecoilPatternNoise,\n\t\t\tRecoilPatternResetDelay = definition.RecoilPatternResetDelay,\n\t\t\tRecoilPatternLoop = definition.RecoilPatternLoop,\n\t\t\tRecoilRecoveryEnabled = definition.RecoilRecoveryEnabled,\n\t\t\tRecoilRecoveryFraction = definition.RecoilRecoveryFraction,\n\t\t\tRecoilRecoveryDelay = definition.RecoilRecoveryDelay,\n\t\t\tRecoilRecoveryPitchSpeed = definition.RecoilRecoveryPitchSpeed,\n\t\t\tRecoilRecoveryYawSpeed = definition.RecoilRecoveryYawSpeed,\n\t\t\tCameraRecoilRoll = definition.CameraRecoilRoll,\n\t\t\tCameraRecoilFrequency = definition.CameraRecoilFrequency,\n\t\t\tCameraRecoilDuration = definition.CameraRecoilDuration,\n\t\t\tAdsCameraRecoilScale = definition.AdsCameraRecoilScale,\n\n\t\t\tCrosshairSpreadVisualScale = definition.CrosshairSpreadVisualScale,\n\t\t\tCrosshairMinimumGap = definition.CrosshairMinimumGap,\n\t\t\tCrosshairMaximumGap = definition.CrosshairMaximumGap,\n\t\t\tCrosshairLineLength = definition.CrosshairLineLength,\n\t\t\tCrosshairLineWidth = definition.CrosshairLineWidth,\n\t\t\tCrosshairColor = definition.CrosshairColor\n\t\t};\n\t}\n\n\tpublic static OMRWeaponStats Capture( OneMoreRoundWeapon weapon )\n\t{\n\t\tif ( weapon is null )\n\t\t\treturn null;\n\n\t\tOMROpticProfile optic =\n\t\t\tweapon.OpticProfile is not null \u0026\u0026\n\t\t\tweapon.OpticProfile.IsValid\n\t\t\t\t? weapon.OpticProfile\n\t\t\t\t: null;\n\n\t\treturn new OMRWeaponStats\n\t\t{\n\t\t\tWeaponId = weapon.WeaponId?.Trim() ?? string.Empty,\n\t\t\tDisplayName = weapon.DisplayName?.Trim() ?? string.Empty,\n\t\t\tArchetype = weapon.WeaponArchetype,\n\n\t\t\tDamage = weapon.Ballistics.Damage,\n\t\t\tPellets = weapon.Ballistics.Pellets,\n\t\t\tRange = weapon.Ballistics.Range,\n\t\t\tRadius = weapon.Ballistics.Radius,\n\t\t\tForce = weapon.Ballistics.Force,\n\t\t\tSpreadBase = weapon.Ballistics.SpreadBase,\n\t\t\tSpreadGrowth = weapon.Ballistics.SpreadGrowth,\n\t\t\tSpreadRecovery = weapon.Ballistics.SpreadRecovery,\n\t\t\tPrimaryAutomatic = weapon.PrimaryAutomatic,\n\t\t\tPrimaryDelay = weapon.PrimaryDelay,\n\t\t\tClipMaxSize = weapon.ClipMaxSize,\n\t\t\tReloadTime = weapon.ReloadTime,\n\t\t\tDeployTime = weapon.DeployTime,\n\t\t\tAutoReload = weapon.AutoReload,\n\t\t\tCanCancelReload = weapon.CanCancelReload,\n\n\t\t\tIronSightsFireScale = weapon.IronSightsFireScale,\n\t\t\tAimFovScale = optic?.AimFovScale ?? weapon.AimFovScale,\n\t\t\tAimFovTransitionTime = optic?.AimTransitionTime ?? weapon.AimFovTransitionTime,\n\t\t\tAimAnimationSpeed = optic?.AimAnimationSpeed ?? weapon.AimAnimationSpeed,\n\t\t\tSprintToFireDelay = weapon.SprintToFireDelay,\n\t\t\tSprintFirePoseHoldTime = weapon.SprintFirePoseHoldTime,\n\n\t\t\tMovementAccuracyModel = weapon.MovementAccuracyModel,\n\t\t\tMovingSpeedThreshold = weapon.MovingSpeedThreshold,\n\t\t\tMovementAccuracyStartFraction = weapon.MovementAccuracyStartFraction,\n\t\t\tMovementAccuracyFullFraction = weapon.MovementAccuracyFullFraction,\n\t\t\tMovingSpreadMultiplier = weapon.MovingSpreadMultiplier,\n\t\t\tCrouchedSpreadMultiplier = weapon.CrouchedSpreadMultiplier,\n\t\t\tAirborneSpreadMultiplier = weapon.AirborneSpreadMultiplier,\n\t\t\tSlidingSpreadMultiplier = weapon.SlidingSpreadMultiplier,\n\t\t\tAimSpreadMultiplier = weapon.AimSpreadMultiplier,\n\n\t\t\tRecoilModel = weapon.RecoilModel,\n\t\t\tRecoilPitch = weapon.RecoilPitch,\n\t\t\tRecoilYaw = weapon.RecoilYaw,\n\t\t\tRecoilPatternAsset = weapon.RecoilPatternAsset,\n\t\t\tRecoilPatternScale = weapon.RecoilPatternScale,\n\t\t\tRecoilPattern = weapon.RecoilPattern is null\n\t\t\t\t? new List\u003CVector2\u003E()\n\t\t\t\t: new List\u003CVector2\u003E( weapon.RecoilPattern ),\n\t\t\tRecoilPatternNoise = weapon.RecoilPatternNoise,\n\t\t\tRecoilPatternResetDelay = weapon.RecoilPatternResetDelay,\n\t\t\tRecoilPatternLoop = weapon.RecoilPatternLoop,\n\t\t\tRecoilRecoveryEnabled = weapon.RecoilRecoveryEnabled,\n\t\t\tRecoilRecoveryFraction = weapon.RecoilRecoveryFraction,\n\t\t\tRecoilRecoveryDelay = weapon.RecoilRecoveryDelay,\n\t\t\tRecoilRecoveryPitchSpeed = weapon.RecoilRecoveryPitchSpeed,\n\t\t\tRecoilRecoveryYawSpeed = weapon.RecoilRecoveryYawSpeed,\n\t\t\tCameraRecoilRoll = weapon.CameraRecoilRoll,\n\t\t\tCameraRecoilFrequency = weapon.CameraRecoilFrequency,\n\t\t\tCameraRecoilDuration = weapon.CameraRecoilDuration,\n\t\t\tAdsCameraRecoilScale = weapon.AdsCameraRecoilScale,\n\n\t\t\tCrosshairSpreadVisualScale = weapon.CrosshairSpreadVisualScale,\n\t\t\tCrosshairMinimumGap = weapon.CrosshairMinimumGap,\n\t\t\tCrosshairMaximumGap = weapon.CrosshairMaximumGap,\n\t\t\tCrosshairLineLength = weapon.CrosshairLineLength,\n\t\t\tCrosshairLineWidth = weapon.CrosshairLineWidth,\n\t\t\tCrosshairColor = weapon.CrosshairColor\n\t\t};\n\t}\n\n\t/// \u003Csummary\u003E\n\t/// Applies only sanity constraints required for the weapon to remain valid.\n\t/// This deliberately avoids imposing balance opinions on the resolved values.\n\t/// \u003C/summary\u003E\n\tpublic void Normalize()\n\t{\n\t\tWeaponId = WeaponId?.Trim() ?? string.Empty;\n\t\tDisplayName = DisplayName?.Trim() ?? string.Empty;\n\n\t\tDamage = MathF.Max( Damage, 0f );\n\t\tPellets = Math.Max( Pellets, 1 );\n\t\tRange = MathF.Max( Range, 0.01f );\n\t\tRadius = MathF.Max( Radius, 0f );\n\t\tForce = MathF.Max( Force, 0f );\n\t\tSpreadBase = ClampVectorMinimum( SpreadBase, 0f );\n\t\tSpreadGrowth = ClampVectorMinimum( SpreadGrowth, 0f );\n\t\tSpreadRecovery = MathF.Max( SpreadRecovery, 0f );\n\t\tPrimaryDelay = MathF.Max( PrimaryDelay, 0.001f );\n\t\tClipMaxSize = Math.Max( ClipMaxSize, 1 );\n\t\tReloadTime = MathF.Max( ReloadTime, 0f );\n\t\tDeployTime = MathF.Max( DeployTime, 0f );\n\n\t\tIronSightsFireScale = MathF.Max( IronSightsFireScale, 0f );\n\t\tAimFovScale = MathF.Max( AimFovScale, 0.01f );\n\t\tAimFovTransitionTime = MathF.Max( AimFovTransitionTime, 0f );\n\t\tAimAnimationSpeed = MathF.Max( AimAnimationSpeed, 0.01f );\n\t\tSprintToFireDelay = MathF.Max( SprintToFireDelay, 0f );\n\t\tSprintFirePoseHoldTime = MathF.Max( SprintFirePoseHoldTime, 0f );\n\n\t\tMovingSpeedThreshold = MathF.Max( MovingSpeedThreshold, 0f );\n\t\tMovementAccuracyStartFraction = MathX.Clamp( MovementAccuracyStartFraction, 0f, 1f );\n\t\tMovementAccuracyFullFraction = MathX.Clamp( MovementAccuracyFullFraction, MovementAccuracyStartFraction, 1f );\n\t\tMovingSpreadMultiplier = MathF.Max( MovingSpreadMultiplier, 0f );\n\t\tCrouchedSpreadMultiplier = MathF.Max( CrouchedSpreadMultiplier, 0f );\n\t\tAirborneSpreadMultiplier = MathF.Max( AirborneSpreadMultiplier, 0f );\n\t\tSlidingSpreadMultiplier = MathF.Max( SlidingSpreadMultiplier, 0f );\n\t\tAimSpreadMultiplier = MathF.Max( AimSpreadMultiplier, 0f );\n\n\t\tRecoilPattern ??= new List\u003CVector2\u003E();\n\t\tRecoilPatternNoise = new Vector2( MathF.Abs( RecoilPatternNoise.x ), MathF.Abs( RecoilPatternNoise.y ) );\n\t\tRecoilPatternResetDelay = MathF.Max( RecoilPatternResetDelay, 0f );\n\t\tRecoilRecoveryFraction = MathX.Clamp( RecoilRecoveryFraction, 0f, 1f );\n\t\tRecoilRecoveryDelay = MathF.Max( RecoilRecoveryDelay, 0f );\n\t\tRecoilRecoveryPitchSpeed = MathF.Max( RecoilRecoveryPitchSpeed, 0f );\n\t\tRecoilRecoveryYawSpeed = MathF.Max( RecoilRecoveryYawSpeed, 0f );\n\n\t\tCameraRecoilRoll = MathF.Max( CameraRecoilRoll, 0f );\n\t\tCameraRecoilFrequency = MathF.Max( CameraRecoilFrequency, 0f );\n\t\tCameraRecoilDuration = MathF.Max( CameraRecoilDuration, 0f );\n\t\tAdsCameraRecoilScale = MathF.Max( AdsCameraRecoilScale, 0f );\n\n\t\tCrosshairSpreadVisualScale = MathF.Max( CrosshairSpreadVisualScale, 0f );\n\t\tCrosshairMinimumGap = MathF.Max( CrosshairMinimumGap, 0f );\n\t\tCrosshairMaximumGap = MathF.Max( CrosshairMaximumGap, CrosshairMinimumGap );\n\t\tCrosshairLineLength = MathF.Max( CrosshairLineLength, 0f );\n\t\tCrosshairLineWidth = MathF.Max( CrosshairLineWidth, 0f );\n\t}\n\n\tpublic void ApplyTo( OneMoreRoundWeapon weapon, bool clampLoadedAmmoToMagazine )\n\t{\n\t\tif ( weapon is null )\n\t\t\treturn;\n\n\t\tWeaponId = WeaponId?.Trim() ?? string.Empty;\n\t\tDisplayName = DisplayName?.Trim() ?? string.Empty;\n\n\t\tweapon.WeaponId = WeaponId;\n\t\tweapon.DisplayName = DisplayName;\n\t\tweapon.WeaponArchetype = Archetype;\n\n\t\tvar ballistics = weapon.Ballistics;\n\t\tballistics.Damage = Damage;\n\t\tballistics.Pellets = Pellets;\n\t\tballistics.Range = Range;\n\t\tballistics.Radius = Radius;\n\t\tballistics.Force = Force;\n\t\tballistics.SpreadBase = SpreadBase;\n\t\tballistics.SpreadGrowth = SpreadGrowth;\n\t\tballistics.SpreadRecovery = SpreadRecovery;\n\t\tweapon.Ballistics = ballistics;\n\n\t\tweapon.PrimaryAutomatic = PrimaryAutomatic;\n\t\tweapon.PrimaryDelay = PrimaryDelay;\n\t\tweapon.ClipMaxSize = ClipMaxSize;\n\t\tweapon.ReloadTime = ReloadTime;\n\t\tweapon.DeployTime = DeployTime;\n\t\tweapon.AutoReload = AutoReload;\n\t\tweapon.CanCancelReload = CanCancelReload;\n\n\t\tweapon.IronSightsFireScale = IronSightsFireScale;\n\t\tweapon.AimFovScale = AimFovScale;\n\t\tweapon.AimFovTransitionTime = AimFovTransitionTime;\n\t\tweapon.AimAnimationSpeed = AimAnimationSpeed;\n\t\tweapon.SprintToFireDelay = SprintToFireDelay;\n\t\tweapon.SprintFirePoseHoldTime = SprintFirePoseHoldTime;\n\n\t\tweapon.MovementAccuracyModel = MovementAccuracyModel;\n\t\tweapon.MovingSpeedThreshold = MovingSpeedThreshold;\n\t\tweapon.MovementAccuracyStartFraction = MovementAccuracyStartFraction;\n\t\tweapon.MovementAccuracyFullFraction = MovementAccuracyFullFraction;\n\t\tweapon.MovingSpreadMultiplier = MovingSpreadMultiplier;\n\t\tweapon.CrouchedSpreadMultiplier = CrouchedSpreadMultiplier;\n\t\tweapon.AirborneSpreadMultiplier = AirborneSpreadMultiplier;\n\t\tweapon.SlidingSpreadMultiplier = SlidingSpreadMultiplier;\n\t\tweapon.AimSpreadMultiplier = AimSpreadMultiplier;\n\n\t\tweapon.RecoilModel = RecoilModel;\n\t\tweapon.RecoilPitch = RecoilPitch;\n\t\tweapon.RecoilYaw = RecoilYaw;\n\t\tweapon.RecoilPatternAsset = RecoilPatternAsset;\n\t\tweapon.RecoilPatternScale = RecoilPatternScale;\n\t\tweapon.RecoilPattern = RecoilPattern is null\n\t\t\t? new List\u003CVector2\u003E()\n\t\t\t: new List\u003CVector2\u003E( RecoilPattern );\n\t\tweapon.RecoilPatternNoise = RecoilPatternNoise;\n\t\tweapon.RecoilPatternResetDelay = RecoilPatternResetDelay;\n\t\tweapon.RecoilPatternLoop = RecoilPatternLoop;\n\t\tweapon.RecoilRecoveryEnabled = RecoilRecoveryEnabled;\n\t\tweapon.RecoilRecoveryFraction = RecoilRecoveryFraction;\n\t\tweapon.RecoilRecoveryDelay = RecoilRecoveryDelay;\n\t\tweapon.RecoilRecoveryPitchSpeed = RecoilRecoveryPitchSpeed;\n\t\tweapon.RecoilRecoveryYawSpeed = RecoilRecoveryYawSpeed;\n\t\tweapon.CameraRecoilRoll = CameraRecoilRoll;\n\t\tweapon.CameraRecoilFrequency = CameraRecoilFrequency;\n\t\tweapon.CameraRecoilDuration = CameraRecoilDuration;\n\t\tweapon.AdsCameraRecoilScale = AdsCameraRecoilScale;\n\n\t\tweapon.CrosshairSpreadVisualScale = CrosshairSpreadVisualScale;\n\t\tweapon.CrosshairMinimumGap = CrosshairMinimumGap;\n\t\tweapon.CrosshairMaximumGap = CrosshairMaximumGap;\n\t\tweapon.CrosshairLineLength = CrosshairLineLength;\n\t\tweapon.CrosshairLineWidth = CrosshairLineWidth;\n\t\tweapon.CrosshairColor = CrosshairColor;\n\n\t\t// Runtime magazine-size reductions must not leave a physically impossible\n\t\t// loaded count. Increasing capacity deliberately does not conjure ammo.\n\t\tif ( clampLoadedAmmoToMagazine \u0026\u0026 weapon.Clip1 \u003E weapon.ClipMaxSize )\n\t\t{\n\t\t\tweapon.Clip1 = weapon.ClipMaxSize;\n\t\t}\n\t}\n\n\tprivate static Vector2 ClampVectorMinimum( Vector2 value, float minimum )\n\t{\n\t\treturn new Vector2(\n\t\t\tMathF.Max( value.x, minimum ),\n\t\t\tMathF.Max( value.y, minimum )\n\t\t);\n\t}\n}\n"},{"Ident":"lfinchgames.oneplusround","Path":"OneMoreRoundWeapon.Locomotion.cs","FileName":"OneMoreRoundWeapon.Locomotion.cs","PackageType":"game","CodeKind":"Game","AssetVersionId":399243,"IsPrivate":false,"Code":"using Sandbox;\n\n/// \u003Csummary\u003E\n/// Generic locomotion/handling bridge for OneMoreRoundWeapon.\n///\n/// The weapon deliberately knows only the reusable contracts declared in\n/// WeaponInteractionContracts.cs. OMR-specific movement components remain on\n/// the player/controller side of that boundary.\n/// \u003C/summary\u003E\npublic partial class OneMoreRoundWeapon : IWeaponHandlingState\n{\n\tprivate GameObject _locomotionProviderOwner;\n\tprivate IWeaponLocomotionProvider _locomotionProvider;\n\n\t/// \u003Csummary\u003E\n\t/// Current OMR behavior: ADS prevents physical sprint from resolving.\n\t/// Future action-state work can extend this without PlayerLocomotion needing\n\t/// to know why the item is blocking sprint.\n\t/// \u003C/summary\u003E\n\tpublic bool BlocksSprint =\u003E IsAiming;\n\n\t/// \u003Csummary\u003E\n\t/// Reserved handling hooks. They intentionally resolve to 1 during this\n\t/// migration so Phase 2 changes no movement feel.\n\t/// \u003C/summary\u003E\n\tpublic float MovementSpeedScale =\u003E 1f;\n\tpublic float AimingMovementSpeedScale =\u003E 1f;\n\n\tpublic void SetSprintAimSuppressed( bool suppressed )\n\t{\n\t\tif ( suppressed )\n\t\t{\n\t\t\tSuppressAimForSprint();\n\t\t}\n\t\telse\n\t\t{\n\t\t\tReleaseAimSuppressionForSprint();\n\t\t}\n\t}\n\n\t/// \u003Csummary\u003E\n\t/// Resolves the current controller-side locomotion provider once per owner\n\t/// hierarchy, then consumes its lightweight snapshot. If another game uses\n\t/// this weapon framework without an adapter, BaseCombatWeapon.Owner supplies\n\t/// a conservative PlayerController fallback.\n\t/// \u003C/summary\u003E\n\tpublic bool TryGetLocomotionSnapshot(\n\t\tout WeaponLocomotionSnapshot snapshot\n\t)\n\t{\n\t\tGameObject ownerObject =\n\t\t\tInventory?.GameObject;\n\n\t\tif ( ownerObject != _locomotionProviderOwner )\n\t\t{\n\t\t\tResolveLocomotionProvider( ownerObject );\n\t\t}\n\n\t\tif ( _locomotionProvider is not null )\n\t\t{\n\t\t\tsnapshot = _locomotionProvider.WeaponLocomotion;\n\n\t\t\tif ( snapshot.IsValid )\n\t\t\t\treturn true;\n\t\t}\n\n\t\tPlayerController owner = Owner;\n\t\tif ( owner is not null )\n\t\t{\n\t\t\tsnapshot =\n\t\t\t\tWeaponLocomotionSnapshot.FromPlayerController(\n\t\t\t\t\towner\n\t\t\t\t);\n\n\t\t\treturn snapshot.IsValid;\n\t\t}\n\n\t\tsnapshot = WeaponLocomotionSnapshot.Invalid;\n\t\treturn false;\n\t}\n\n\tprivate void ResolveLocomotionProvider(\n\t\tGameObject ownerObject\n\t)\n\t{\n\t\t_locomotionProviderOwner = ownerObject;\n\t\t_locomotionProvider = null;\n\n\t\tif (\n\t\t\townerObject is null ||\n\t\t\t!ownerObject.IsValid\n\t\t)\n\t\t{\n\t\t\treturn;\n\t\t}\n\n\t\tforeach ( Component component in ownerObject.Components.GetAll() )\n\t\t{\n\t\t\tif ( component is IWeaponLocomotionProvider provider )\n\t\t\t{\n\t\t\t\t_locomotionProvider = provider;\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate void ResetLocomotionProviderCache()\n\t{\n\t\t_locomotionProviderOwner = null;\n\t\t_locomotionProvider = null;\n\t}\n}\n"},{"Ident":"lfinchgames.oneplusround","Path":"OneMoreRoundWeapon.Recoil.cs","FileName":"OneMoreRoundWeapon.Recoil.cs","PackageType":"game","CodeKind":"Game","AssetVersionId":399243,"IsPrivate":false,"Code":"using Sandbox;\nusing System;\nusing System.Collections.Generic;\n\n/// \u003Csummary\u003E\n/// Gameplay recoil selection plus cosmetic camera recoil.\n///\n/// Existing weapons remain on LegacyRandom by default. Pattern recoil uses an\n/// authored sequence plus optional noise. Optional gameplay-recoil recovery is\n/// authored independently so pattern shape, lasting displacement and visual\n/// camera kick remain separate tuning channels.\n/// \u003C/summary\u003E\npublic partial class OneMoreRoundWeapon\n{\n\t// =========================================================\n\t// AUTHORED GAMEPLAY RECOIL\n\t// =========================================================\n\n\t[Property, Group( \u0022Recoil\u0022 )]\n\tpublic OMRGameplayRecoilModel RecoilModel { get; set; } =\n\t\tOMRGameplayRecoilModel.LegacyRandom;\n\n\t/// \u003Csummary\u003E\n\t/// Legacy vertical aim recoil range in degrees.\n\t/// Negative pitch moves the player\u0027s aim upward in s\u0026box.\n\t/// \u003C/summary\u003E\n\t[Property, Group( \u0022Recoil\u0022 )]\n\tpublic Vector2 RecoilPitch { get; set; } =\n\t\tnew( -0.45f, -0.25f );\n\n\t/// \u003Csummary\u003E\n\t/// Legacy horizontal aim recoil range in degrees.\n\t/// \u003C/summary\u003E\n\t[Property, Group( \u0022Recoil\u0022 )]\n\tpublic Vector2 RecoilYaw { get; set; } =\n\t\tnew( -0.12f, 0.12f );\n\n\t/// \u003Csummary\u003E\n\t/// Preferred visual-authoring source for Pattern mode. The resource stores\n\t/// cumulative vertical/horizontal curves and converts them to per-shot kicks.\n\t/// When assigned, it takes priority over the legacy Vector2 step list.\n\t/// \u003C/summary\u003E\n\t[Property, Group( \u0022Recoil\u0022 )]\n\tpublic OMRRecoilPattern RecoilPatternAsset { get; set; }\n\n\t/// \u003Csummary\u003E\n\t/// Per-weapon strength multiplier for the authored pattern source.\n\t/// X scales pitch/vertical kick, Y scales yaw/horizontal kick.\n\t/// \u003C/summary\u003E\n\t[Property, Group( \u0022Recoil\u0022 )]\n\tpublic Vector2 RecoilPatternScale { get; set; } = Vector2.One;\n\n\t/// \u003Csummary\u003E\n\t/// Legacy compatibility sequence for Pattern mode.\n\t/// X = pitch delta, Y = yaw delta, both in degrees. New weapons should\n\t/// normally use RecoilPatternAsset instead.\n\t/// \u003C/summary\u003E\n\t[Property, Group( \u0022Recoil\u0022 )]\n\tpublic List\u003CVector2\u003E RecoilPattern { get; set; } = new();\n\n\t/// \u003Csummary\u003E\n\t/// Symmetric random noise added to each authored pattern step.\n\t/// X = maximum pitch noise, Y = maximum yaw noise.\n\t/// \u003C/summary\u003E\n\t[Property, Group( \u0022Recoil\u0022 )]\n\tpublic Vector2 RecoilPatternNoise { get; set; } = Vector2.Zero;\n\n\t[Property, Group( \u0022Recoil\u0022 )]\n\t[Range( 0f, 5f )]\n\tpublic float RecoilPatternResetDelay { get; set; } = 0.35f;\n\n\t/// \u003Csummary\u003E\n\t/// When false, a long spray stays on the final pattern step plus noise once\n\t/// the authored sequence is exhausted. When true, the sequence loops.\n\t/// \u003C/summary\u003E\n\t[Property, Group( \u0022Recoil\u0022 )]\n\tpublic bool RecoilPatternLoop { get; set; } = false;\n\n\t// =========================================================\n\t// AUTHORED GAMEPLAY RECOIL RECOVERY\n\t// =========================================================\n\n\t[Property, Group( \u0022Recoil Recovery\u0022 )]\n\tpublic bool RecoilRecoveryEnabled { get; set; } = false;\n\n\t/// \u003Csummary\u003E\n\t/// Fraction of each gameplay recoil kick that is eligible to return\n\t/// automatically. Keeping this below 1 preserves some lasting displacement\n\t/// for player-controlled recoil management.\n\t/// \u003C/summary\u003E\n\t[Property, Group( \u0022Recoil Recovery\u0022 )]\n\t[Range( 0f, 1f )]\n\tpublic float RecoilRecoveryFraction { get; set; } = 0.65f;\n\n\t/// \u003Csummary\u003E\n\t/// Time after the latest shot before automatic gameplay recoil return begins.\n\t/// Set this above an automatic weapon\u0027s fire interval if recovery should only\n\t/// occur after a burst/spray actually stops.\n\t/// \u003C/summary\u003E\n\t[Property, Group( \u0022Recoil Recovery\u0022 )]\n\t[Range( 0f, 2f )]\n\tpublic float RecoilRecoveryDelay { get; set; } = 0.18f;\n\n\t[Property, Group( \u0022Recoil Recovery\u0022 )]\n\t[Range( 0f, 30f )]\n\tpublic float RecoilRecoveryPitchSpeed { get; set; } = 3.25f;\n\n\t[Property, Group( \u0022Recoil Recovery\u0022 )]\n\t[Range( 0f, 30f )]\n\tpublic float RecoilRecoveryYawSpeed { get; set; } = 4.5f;\n\n\t// =========================================================\n\t// AUTHORED CAMERA RECOIL\n\t// =========================================================\n\n\t/// \u003Csummary\u003E\n\t/// Small transient roll wobble applied to the rendered camera after firing.\n\t/// This does NOT move the player\u0027s actual aim.\n\t/// \u003C/summary\u003E\n\t[Property, Group( \u0022Recoil\u0022 )]\n\tpublic float CameraRecoilRoll { get; set; } = 0.45f;\n\n\t[Property, Group( \u0022Recoil\u0022 )]\n\tpublic float CameraRecoilFrequency { get; set; } = 1.0f;\n\n\t[Property, Group( \u0022Recoil\u0022 )]\n\tpublic float CameraRecoilDuration { get; set; } = 0.30f;\n\n\t/// \u003Csummary\u003E\n\t/// ADS keeps the same gameplay recoil but reduces cosmetic camera wobble.\n\t/// \u003C/summary\u003E\n\t[Property, Group( \u0022Recoil\u0022 )]\n\t[Range( 0f, 1f )]\n\tpublic float AdsCameraRecoilScale { get; set; } = 0.65f;\n\n\t// =========================================================\n\t// RUNTIME RECOIL STATE\n\t// =========================================================\n\n\tprivate int _recoilPatternIndex;\n\tprivate float _lastRecoilShotAt = -1f;\n\tprivate Vector2 _recoverableGameplayRecoil = Vector2.Zero;\n\n\tpublic int CurrentRecoilPatternIndex =\u003E _recoilPatternIndex;\n\tpublic Vector2 LastGameplayRecoilKick { get; private set; } = Vector2.Zero;\n\tpublic Vector2 RemainingGameplayRecoilRecovery =\u003E _recoverableGameplayRecoil;\n\tpublic bool IsRecoveringGameplayRecoil =\u003E\n\t\tRecoilRecoveryEnabled \u0026\u0026\n\t\t_lastRecoilShotAt \u003E= 0f \u0026\u0026\n\t\tRealTime.Now - _lastRecoilShotAt \u003E= MathF.Max( RecoilRecoveryDelay, 0f ) \u0026\u0026\n\t\t(MathF.Abs( _recoverableGameplayRecoil.x ) \u003E 0.0001f ||\n\t\t MathF.Abs( _recoverableGameplayRecoil.y ) \u003E 0.0001f);\n\n\tprivate void UpdateRecoilRuntimeState()\n\t{\n\t\tUpdateGameplayRecoilRecovery();\n\n\t\tif (\n\t\t\tRecoilModel != OMRGameplayRecoilModel.Pattern ||\n\t\t\t_recoilPatternIndex \u003C= 0 ||\n\t\t\t_lastRecoilShotAt \u003C 0f\n\t\t)\n\t\t{\n\t\t\treturn;\n\t\t}\n\n\t\tfloat resetDelay = MathF.Max( RecoilPatternResetDelay, 0f );\n\t\tif ( resetDelay \u003C= 0f || RealTime.Now - _lastRecoilShotAt \u003E= resetDelay )\n\t\t{\n\t\t\t_recoilPatternIndex = 0;\n\t\t}\n\t}\n\n\tprivate void UpdateGameplayRecoilRecovery()\n\t{\n\t\tif (\n\t\t\t!RecoilRecoveryEnabled ||\n\t\t\tIsProxy ||\n\t\t\t_lastRecoilShotAt \u003C 0f\n\t\t)\n\t\t{\n\t\t\treturn;\n\t\t}\n\n\t\tPlayerController owner = Owner;\n\t\tif ( owner is null )\n\t\t\treturn;\n\n\t\tfloat recoveryDelay = MathF.Max( RecoilRecoveryDelay, 0f );\n\t\tif ( RealTime.Now - _lastRecoilShotAt \u003C recoveryDelay )\n\t\t\treturn;\n\n\t\tif (\n\t\t\tMathF.Abs( _recoverableGameplayRecoil.x ) \u003C= 0.0001f \u0026\u0026\n\t\t\tMathF.Abs( _recoverableGameplayRecoil.y ) \u003C= 0.0001f\n\t\t)\n\t\t{\n\t\t\t_recoverableGameplayRecoil = Vector2.Zero;\n\t\t\treturn;\n\t\t}\n\n\t\tfloat delta = MathF.Max( RealTime.Delta, 0f );\n\t\tif ( delta \u003C= 0f )\n\t\t\treturn;\n\n\t\tVector2 before = _recoverableGameplayRecoil;\n\t\tVector2 after = new(\n\t\t\tMoveTowardZero(\n\t\t\t\tbefore.x,\n\t\t\t\tMathF.Max( RecoilRecoveryPitchSpeed, 0f ) * delta\n\t\t\t),\n\t\t\tMoveTowardZero(\n\t\t\t\tbefore.y,\n\t\t\t\tMathF.Max( RecoilRecoveryYawSpeed, 0f ) * delta\n\t\t\t)\n\t\t);\n\n\t\tVector2 returned = before - after;\n\t\t_recoverableGameplayRecoil = after;\n\n\t\t// Recoil kicks are added to EyeAngles. Returning a portion therefore\n\t\t// subtracts the amount removed from the tracked recovery debt.\n\t\towner.EyeAngles \u002B= new Angles(\n\t\t\t-returned.x,\n\t\t\t-returned.y,\n\t\t\t0f\n\t\t);\n\t}\n\n\tprivate static float MoveTowardZero( float value, float maximumDelta )\n\t{\n\t\tif ( maximumDelta \u003C= 0f )\n\t\t\treturn value;\n\n\t\tif ( value \u003E 0f )\n\t\t\treturn MathF.Max( value - maximumDelta, 0f );\n\n\t\tif ( value \u003C 0f )\n\t\t\treturn MathF.Min( value \u002B maximumDelta, 0f );\n\n\t\treturn 0f;\n\t}\n\n\tprivate void ResetRecoilState()\n\t{\n\t\t_recoilPatternIndex = 0;\n\t\t_lastRecoilShotAt = -1f;\n\t\t_recoverableGameplayRecoil = Vector2.Zero;\n\t\tLastGameplayRecoilKick = Vector2.Zero;\n\t}\n\n\t/// \u003Csummary\u003E\n\t/// Applies gameplay recoil after BaseCombatWeapon has already fired the\n\t/// current shot, then adds a separate cosmetic camera response.\n\t/// \u003C/summary\u003E\n\tprotected virtual void ApplyRecoil()\n\t{\n\t\tPlayerController owner = Owner;\n\t\tif ( owner is null )\n\t\t\treturn;\n\n\t\tVector2 kick = ResolveGameplayRecoilKick();\n\t\tLastGameplayRecoilKick = kick;\n\n\t\t// REAL AIM RECOIL. X is pitch and Y is yaw.\n\t\towner.EyeAngles \u002B= new Angles(\n\t\t\tkick.x,\n\t\t\tkick.y,\n\t\t\t0f\n\t\t);\n\n\t\tif ( RecoilRecoveryEnabled )\n\t\t{\n\t\t\tfloat fraction = MathX.Clamp( RecoilRecoveryFraction, 0f, 1f );\n\t\t\t_recoverableGameplayRecoil \u002B= kick * fraction;\n\t\t}\n\n\t\tApplyCameraRecoil();\n\t}\n\n\tprivate Vector2 ResolveGameplayRecoilKick()\n\t{\n\t\tif ( RecoilModel == OMRGameplayRecoilModel.Pattern \u0026\u0026 HasAuthoredRecoilPattern() )\n\t\t{\n\t\t\tfloat now = RealTime.Now;\n\t\t\tfloat resetDelay = MathF.Max( RecoilPatternResetDelay, 0f );\n\n\t\t\tif (\n\t\t\t\t_lastRecoilShotAt \u003C 0f ||\n\t\t\t\tresetDelay \u003C= 0f ||\n\t\t\t\tnow - _lastRecoilShotAt \u003E= resetDelay\n\t\t\t)\n\t\t\t{\n\t\t\t\t_recoilPatternIndex = 0;\n\t\t\t}\n\n\t\t\tVector2 authored = ResolveAuthoredPatternKick( _recoilPatternIndex );\n\t\t\tVector2 scaled = new(\n\t\t\t\tauthored.x * RecoilPatternScale.x,\n\t\t\t\tauthored.y * RecoilPatternScale.y\n\t\t\t);\n\n\t\t\tVector2 noise = new(\n\t\t\t\tRandom.Shared.Float(\n\t\t\t\t\t-MathF.Abs( RecoilPatternNoise.x ),\n\t\t\t\t\tMathF.Abs( RecoilPatternNoise.x )\n\t\t\t\t),\n\t\t\t\tRandom.Shared.Float(\n\t\t\t\t\t-MathF.Abs( RecoilPatternNoise.y ),\n\t\t\t\t\tMathF.Abs( RecoilPatternNoise.y )\n\t\t\t\t)\n\t\t\t);\n\n\t\t\t_recoilPatternIndex\u002B\u002B;\n\t\t\t_lastRecoilShotAt = now;\n\t\t\treturn scaled \u002B noise;\n\t\t}\n\n\t\t_lastRecoilShotAt = RealTime.Now;\n\n\t\treturn new Vector2(\n\t\t\tRandom.Shared.Float(\n\t\t\t\tMathF.Min( RecoilPitch.x, RecoilPitch.y ),\n\t\t\t\tMathF.Max( RecoilPitch.x, RecoilPitch.y )\n\t\t\t),\n\t\t\tRandom.Shared.Float(\n\t\t\t\tMathF.Min( RecoilYaw.x, RecoilYaw.y ),\n\t\t\t\tMathF.Max( RecoilYaw.x, RecoilYaw.y )\n\t\t\t)\n\t\t);\n\t}\n\n\tprivate bool HasAuthoredRecoilPattern()\n\t{\n\t\tif ( RecoilPatternAsset is not null \u0026\u0026 RecoilPatternAsset.IsValid )\n\t\t\treturn true;\n\n\t\treturn RecoilPattern is not null \u0026\u0026 RecoilPattern.Count \u003E 0;\n\t}\n\n\tprivate Vector2 ResolveAuthoredPatternKick( int shotIndex )\n\t{\n\t\tif ( RecoilPatternAsset is not null \u0026\u0026 RecoilPatternAsset.IsValid )\n\t\t{\n\t\t\treturn RecoilPatternAsset.GetKickForShot( shotIndex, RecoilPatternLoop );\n\t\t}\n\n\t\tint count = RecoilPattern?.Count ?? 0;\n\t\tif ( count \u003C= 0 )\n\t\t\treturn Vector2.Zero;\n\n\t\tint stepIndex = RecoilPatternLoop\n\t\t\t? PositiveModulo( shotIndex, count )\n\t\t\t: Math.Min( Math.Max( shotIndex, 0 ), count - 1 );\n\n\t\treturn RecoilPattern[stepIndex];\n\t}\n\n\tprivate static int PositiveModulo( int value, int modulus )\n\t{\n\t\tif ( modulus \u003C= 0 )\n\t\t\treturn 0;\n\n\t\tint result = value % modulus;\n\t\treturn result \u003C 0 ? result \u002B modulus : result;\n\t}\n\n\tprivate void ApplyCameraRecoil()\n\t{\n\t\t// Gameplay recoil still affects the owning controller (including bots),\n\t\t// but cosmetic camera punch is strictly local-human presentation. A\n\t\t// host-owned bot shares the host process and must never punch Scene.Camera.\n\t\tPlayerState ownerState =\n\t\t\tOwner?.Components.Get\u003CPlayerState\u003E();\n\n\t\tif ( ownerState?.IsLocalHuman != true )\n\t\t\treturn;\n\n\t\tCameraComponent camera = Scene.Camera;\n\t\tif ( camera is null )\n\t\t\treturn;\n\n\t\tfloat visualScale =\n\t\t\tIsAiming\n\t\t\t\t? AdsCameraRecoilScale\n\t\t\t\t: 1f;\n\n\t\tfloat roll = CameraRecoilRoll * visualScale;\n\t\tif ( roll \u003C= 0f )\n\t\t\treturn;\n\n\t\tfloat signedRoll =\n\t\t\tRandom.Shared.Float( 0f, 1f ) \u003C 0.5f\n\t\t\t\t? -roll\n\t\t\t\t: roll;\n\n\t\tcamera.AddPunch(\n\t\t\tnew Angles( 0f, 0f, signedRoll ),\n\t\t\tCameraRecoilFrequency * 2f,\n\t\t\tCameraRecoilDuration\n\t\t);\n\t}\n}\n"},{"Ident":"lfinchgames.oneplusround","Path":"OneMoreRoundWeapon.cs","FileName":"OneMoreRoundWeapon.cs","PackageType":"game","CodeKind":"Game","AssetVersionId":399243,"IsPrivate":false,"Code":"using Sandbox;\nusing Sandbox.Rendering;\nusing System;\n\n/// \u003Csummary\u003E\n/// Marker component placed on a world-model GameObject that represents\n/// where the holder\u0027s left hand should be positioned and oriented.\n///\n/// Put this component on a child such as \u0022left_hand_ik\u0022 inside the\n/// weapon\u0027s world-model prefab. The weapon discovers the runtime clone\n/// automatically and feeds its world transform into the holder AnimGraph.\n/// \u003C/summary\u003E\npublic sealed class WeaponLeftHandIkTarget : Component\n{\n}\n\npublic partial class OneMoreRoundWeapon : BaseCombatWeapon\n{\n\tprivate const string AimAction = \u0022aim\u0022;\n\n\t// =========================================================\n\t// OMR IDENTITY\n\t// =========================================================\n\n\t/// \u003Csummary\u003E\n\t/// Stable, code-facing identity for this exact weapon.\n\t///\n\t/// Do not derive gameplay rules from the prefab filename. Prefabs can be\n\t/// renamed; WeaponId is the durable key future round presets/mutators use.\n\t/// Examples: \u0022usp\u0022, \u0022mp5\u0022, \u0022m4a1\u0022.\n\t/// \u003C/summary\u003E\n\t[Property, Group( \u0022OMR Identity\u0022 )]\n\tpublic string WeaponId { get; set; } = string.Empty;\n\n\t/// \u003Csummary\u003E\n\t/// Broad category used by future loadout rules such as \u0022any shotgun\u0022.\n\t/// Exact-weapon rules should use WeaponId instead.\n\t/// \u003C/summary\u003E\n\t[Property, Group( \u0022OMR Identity\u0022 )]\n\tpublic OMRWeaponArchetype WeaponArchetype { get; set; } =\n\t\tOMRWeaponArchetype.Unknown;\n\n\t/// \u003Csummary\u003E\n\t/// Mechanical traits should come from BaseCombatWeapon\u0027s real settings\n\t/// rather than duplicated inspector booleans that can drift out of sync.\n\t/// \u003C/summary\u003E\n\tpublic bool IsAutomaticWeapon =\u003E\n\t\tPrimaryAutomatic;\n\n\tpublic bool IsPelletWeapon =\u003E\n\t\tBallistics.Pellets \u003E 1;\n\n\t[Property, Group( \u0022Diagnostics\u0022 )]\n\tpublic bool EnableDebugLogging { get; set; } = false;\n\n\t// =========================================================\n\t// WORLD MODEL RECOVERY\n\t// =========================================================\n\n\t[Property]\n\tpublic bool EnableWorldModelRecovery { get; set; } = true;\n\n\t[Property]\n\tpublic float WorldModelRecoveryDelay { get; set; } = 0.75f;\n\n\t// =========================================================\n\t// REUSABLE CAPABILITY GATES\n\t// =========================================================\n\n\t[Property, Group( \u0022Capabilities\u0022 ), Title( \u0022Allow Aim\u0022 )]\n\tpublic bool AllowAim { get; set; } = true;\n\n\t[Property, Group( \u0022Capabilities\u0022 ), Title( \u0022Allow Reload\u0022 )]\n\tpublic bool AllowReload { get; set; } = true;\n\n\t// =========================================================\n\t// AIM DOWN SIGHTS\n\t// =========================================================\n\n\t[Property, Group( \u0022ADS\u0022 )]\n\t[Range( 0f, 1f )]\n\tpublic float IronSightsFireScale { get; set; } = 0.2f;\n\n\t[Property, Group( \u0022ADS\u0022 )]\n\t[Range( 0.1f, 1f )]\n\tpublic float AimFovScale { get; set; } = 0.8f;\n\n\t[Property, Group( \u0022ADS\u0022 )]\n\t[Range( 0f, 1f )]\n\tpublic float AimFovTransitionTime { get; set; } = 0.15f;\n\n\t/// \u003Csummary\u003E\n\t/// Speed multiplier for the authored Facepunch ironsight transition.\n\t/// This drives the documented speed_ironsights AnimGraph parameter and\n\t/// does not move the viewmodel root in code.\n\t/// \u003C/summary\u003E\n\t[Property, Group( \u0022ADS\u0022 )]\n\t[Range( 0.1f, 4f )]\n\tpublic float AimAnimationSpeed { get; set; } = 1.0f;\n\n\t[Sync]\n\tpublic bool IsAiming { get; set; }\n\n\t// =========================================================\n\t// CROSSHAIR\n\t// =========================================================\n\n\t[Property, Group( \u0022Crosshair\u0022 )]\n\t[Range( 0.1f, 10f )]\n\tpublic float CrosshairSpreadVisualScale { get; set; } = 2.5f;\n\n\t[Property, Group( \u0022Crosshair\u0022 )]\n\tpublic float CrosshairMinimumGap { get; set; } = 4f;\n\n\t[Property, Group( \u0022Crosshair\u0022 )]\n\tpublic float CrosshairMaximumGap { get; set; } = 70f;\n\n\t[Property, Group( \u0022Crosshair\u0022 )]\n\tpublic float CrosshairLineLength { get; set; } = 9f;\n\n\t[Property, Group( \u0022Crosshair\u0022 )]\n\tpublic float CrosshairLineWidth { get; set; } = 2f;\n\n\t[Property, Group( \u0022Crosshair\u0022 )]\n\tpublic Color CrosshairColor { get; set; } = Color.White;\n\n\t// =========================================================\n\t// INTERNAL STATE\n\t// =========================================================\n\n\tprivate float _timeAlive;\n\n\tprivate bool _worldModelRecoveryAttempted;\n\n\tprivate float _aimFovBlend;\n\n\tprivate GameObject _lastAimViewModel;\n\n\tprivate bool _viewModelAimStateDirty = true;\n\n\tprivate bool _sprintSuppressesAim;\n\n\t/// \u003Csummary\u003E\n\t/// Host-owned bots are non-proxy just like the host\u0027s real player. Never use\n\t/// IsProxy alone to decide whether this weapon should read local human input\n\t/// or create first-person presentation.\n\t/// \u003C/summary\u003E\n\tpublic bool IsBotControlled\n\t{\n\t\tget\n\t\t{\n\t\t\tPlayerController owner = Owner;\n\t\t\treturn owner?.Components.Get\u003CPlayerState\u003E()?.IsBot == true;\n\t\t}\n\t}\n\n\n\tprivate GameObject _ikWorldModel;\n\n\tprivate WeaponLeftHandIkTarget _leftHandIkTarget;\n\n\t// =========================================================\n\t// LIFECYCLE\n\t// =========================================================\n\n\tprotected override void OnStart()\n\t{\n\t\t// Definition values must be resolved before BaseCombatWeapon initializes\n\t\t// magazines, models and other engine-owned weapon state.\n\t\tApplyWeaponDefinitionIfAssigned();\n\n\t\tbase.OnStart();\n\n\t\t_timeAlive =\n\t\t\t0f;\n\n\t\t_worldModelRecoveryAttempted =\n\t\t\tfalse;\n\n\t\t_aimFovBlend =\n\t\t\t0f;\n\n\t\t_lastAimViewModel =\n\t\t\tnull;\n\n\t\t_viewModelAimStateDirty =\n\t\t\ttrue;\n\n\t\t_sprintSuppressesAim =\n\t\t\tfalse;\n\n\t\tResetAccuracyState();\n\t\tResetRecoilState();\n\t\tResetCycleState( chambered: true );\n\t\tResetCyclePresentationState();\n\t\tResetWeaponActionState();\n\t\tResetShotValidationState();\n\n\t\t_ikWorldModel =\n\t\t\tnull;\n\n\t\t_leftHandIkTarget =\n\t\t\tnull;\n\n\t\tResetViewModelPresentationState();\n\t\tInitializePresentationEventPipeline();\n\n\t\t// If the inventory made this item active before OnStart ran, OnEquipped\n\t\t// has already fired. Re-check model presence now that all component\n\t\t// initialization is complete instead of waiting for a weapon switch.\n\t\tif ( IsActive )\n\t\t{\n\t\t\tSuppressBotViewModel();\n\t\t\tEnsureEquippedPresentationModels();\n\t\t}\n\n\t\tif ( EnableDebugLogging )\n\t\t{\n\t\t\tLog.Info(\n\t\t\t\t$\u0022[OMR WEAPON] Started | Object: {GameObject.Name} | Proxy: {IsProxy}\u0022\n\t\t\t);\n\t\t}\n\t}\n\n\tprotected override void OnUpdate()\n\t{\n\t\tbase.OnUpdate();\n\n\t\t// Safety net for host-owned bots. If an engine lifecycle or a future\n\t\t// weapon change recreates an owner-local viewmodel after equip, remove it\n\t\t// before any OMR first-person presentation code can update/render it.\n\t\tSuppressBotViewModel();\n\n\t\tUpdateAimTransitionState();\n\t\tUpdateCycleRuntimeState();\n\t\tUpdateCyclePresentationState();\n\t\tUpdateRecoilRuntimeState();\n\t\tUpdateWorldModelRecovery();\n\t\tUpdateViewModelPresentationAnimations();\n\t\tUpdateWeaponModelPresentation();\n\t}\n\n\tprotected override void OnDestroy()\n\t{\n\t\t// World/view models are local, non-networked presentation clones.\n\t\t// A replicated inventory item can be destroyed on a remote peer before\n\t\t// BaseInventoryComponent gets a chance to call OnHolstered() locally.\n\t\t// In that ordering, BaseCombatWeapon\u0027s normal holster cleanup is skipped\n\t\t// and the world model (parented to the holder bone, not this weapon item)\n\t\t// would survive as an orphan. Always tear presentation down here as the\n\t\t// final lifecycle safety net.\n\t\t_worldModelRecoveryAttempted = true;\n\t\t_timeAlive = 0f;\n\n\t\tClearBodyIk();\n\t\tResetWeaponModelPresentationState();\n\n\t\tDestroyWorldModel();\n\t\tDestroyViewModel();\n\n\t\tbase.OnDestroy();\n\t}\n\n\tprotected override void OnDisabled()\n\t{\n\t\t_worldModelRecoveryAttempted = true;\n\t\t_timeAlive = 0f;\n\n\t\tClearBodyIk();\n\t\tResetAimState();\n\t\tResetAccuracyState();\n\t\tResetRecoilState();\n\t\tResetCycleState( chambered: true );\n\t\tResetCyclePresentationState();\n\t\tResetWeaponActionState();\n\t\tResetViewModelPresentationState();\n\t\tResetWeaponModelPresentationState();\n\t\tCancelReloadAudio();\n\t\tCancelCycleAudio();\n\n\t\tbase.OnDisabled();\n\t}\n\n\tprotected override void OnHolstered()\n\t{\n\t\t// BaseCombatWeapon destroys the local view/world models on holster.\n\t\t// Prevent our delayed recovery path from resurrecting the world model\n\t\t// while this inactive inventory item is still parented under the player.\n\t\t_worldModelRecoveryAttempted = true;\n\t\t_timeAlive = 0f;\n\n\t\tClearBodyIk();\n\t\tResetAimState();\n\t\tResetAccuracyState();\n\t\tResetRecoilState();\n\n\t\t// Holstering resolves an unfinished manual cycle as ready. This avoids\n\t\t// returning to a permanently unchambered weapon after inventory switching.\n\t\tResetCycleState( chambered: true );\n\t\tResetCyclePresentationState();\n\t\tResetWeaponActionState();\n\t\tResetViewModelPresentationState();\n\t\tResetWeaponModelPresentationState();\n\t\tCancelCycleAudio();\n\n\t\tbase.OnHolstered();\n\t\tRaisePresentationEvent( WeaponPresentationEventKind.Holstered );\n\t}\n\n\t// =========================================================\n\t// THIRD-PERSON BODY IK\n\t// =========================================================\n\n\t/// \u003Csummary\u003E\n\t/// Extends BaseCombatWeapon\u0027s normal holder animation update.\n\t///\n\t/// The base implementation still owns HoldType/Handedness. We only\n\t/// add an optional left-hand IK target supplied by the weapon\u0027s\n\t/// world-model prefab. Because UpdateBodyAnimations runs on every\n\t/// peer while the weapon is deployed, each peer drives the hand\n\t/// against its own local WorldModel clone.\n\t/// \u003C/summary\u003E\n\tprotected override void UpdateBodyAnimations(\n\t\tSkinnedModelRenderer body\n\t)\n\t{\n\t\tbase.UpdateBodyAnimations(\n\t\t\tbody\n\t\t);\n\n\t\tif ( body is null )\n\t\t\treturn;\n\n\t\tResolveBodyIkTarget();\n\n\t\tif (\n\t\t\t_leftHandIkTarget is null ||\n\t\t\t_leftHandIkTarget.GameObject is null ||\n\t\t\t!_leftHandIkTarget.GameObject.IsValid\n\t\t)\n\t\t{\n\t\t\tbody.ClearIk(\n\t\t\t\t\u0022hand_left\u0022\n\t\t\t);\n\n\t\t\treturn;\n\t\t}\n\n\t\tGameObject target =\n\t\t\t_leftHandIkTarget.GameObject;\n\n\t\tbody.SetIk(\n\t\t\t\u0022hand_left\u0022,\n\t\t\tnew Transform(\n\t\t\t\ttarget.WorldPosition,\n\t\t\t\ttarget.WorldRotation\n\t\t\t)\n\t\t);\n\t}\n\n\tprivate void ResolveBodyIkTarget()\n\t{\n\t\tGameObject currentWorldModel =\n\t\t\tWorldModel;\n\n\t\tif (\n\t\t\tcurrentWorldModel ==\n\t\t\t_ikWorldModel\n\t\t)\n\t\t\treturn;\n\n\t\t_ikWorldModel =\n\t\t\tcurrentWorldModel;\n\n\t\t_leftHandIkTarget =\n\t\t\tnull;\n\n\t\tif ( currentWorldModel is null )\n\t\t\treturn;\n\n\t\t_leftHandIkTarget =\n\t\t\tcurrentWorldModel\n\t\t\t\t.Components\n\t\t\t\t.Get\u003CWeaponLeftHandIkTarget\u003E(\n\t\t\t\t\tFindMode.InSelf |\n\t\t\t\t\tFindMode.InDescendants\n\t\t\t\t);\n\t}\n\n\tprivate void ClearBodyIk()\n\t{\n\t\tHolderRenderer?.ClearIk(\n\t\t\t\u0022hand_left\u0022\n\t\t);\n\n\t\t_ikWorldModel =\n\t\t\tnull;\n\n\t\t_leftHandIkTarget =\n\t\t\tnull;\n\t}\n\n\n\t// =========================================================\n\t// WEAPON CONTROL\n\t// =========================================================\n\n\tprotected override void OnControl()\n\t{\n\t\tUpdateAccuracyState();\n\n\t\t// Bot combat will call the same authored weapon actions explicitly in a\n\t\t// later phase. Until then, and permanently for raw-input sampling, never\n\t\t// let a host-owned bot weapon mirror the host\u0027s mouse/buttons.\n\t\tif ( IsBotControlled )\n\t\t{\n\t\t\treturn;\n\t\t}\n\n\t\tUpdateTemporaryPrimaryGate();\n\n\t\t//\n\t\t// This must happen BEFORE BaseCombatWeapon handles attack1 so the first\n\t\t// sprint shot can be buffered while the authored sprint-exit animation\n\t\t// raises the weapon.\n\t\t//\n\t\tUpdateSprintToFireGate();\n\n\t\tbase.OnControl();\n\n\t\tif (\n\t\t\tInput.Pressed(\n\t\t\t\tAimAction\n\t\t\t)\n\t\t)\n\t\t{\n\t\t\t_sprintSuppressesAim =\n\t\t\t\tfalse;\n\t\t}\n\n\t\t//\n\t\t// ADS has its own input action and therefore no longer\n\t\t// touches attack2 / secondary fire. While reloading we\n\t\t// deliberately keep ADS out of the AnimGraph; holding aim\n\t\t// queues it naturally and ADS begins as soon as the reload\n\t\t// has actually finished.\n\t\t//\n\t\tbool wantsAim =\n\t\t\tAllowAim \u0026\u0026\n\t\t\tRoundAllowsAim \u0026\u0026\n\t\t\tInput.Down(\n\t\t\t\tAimAction\n\t\t\t) \u0026\u0026\n\t\t\t!_sprintSuppressesAim \u0026\u0026\n\t\t\t!IsReloading \u0026\u0026\n\t\t\tCanAimDuringCurrentCycle();\n\n\t\tif (\n\t\t\twantsAim !=\n\t\t\tIsAiming\n\t\t)\n\t\t{\n\t\t\tSetAiming(\n\t\t\t\twantsAim\n\t\t\t);\n\t\t}\n\n\t\tEnsureViewModelAimState();\n\t}\n\n\t// =========================================================\n\t// CROSSHAIR\n\t// =========================================================\n\n\tpublic override void DrawHud(\n\t\tHudPainter painter,\n\t\tVector2 crosshair\n\t)\n\t{\n\t\tif ( IsAiming \u0026\u0026 HideCrosshairWhileAiming )\n\t\t\treturn;\n\n\t\tbase.DrawHud(\n\t\t\tpainter,\n\t\t\tcrosshair\n\t\t);\n\t}\n\n\tpublic override void DrawCrosshair(\n\t\tHudPainter painter,\n\t\tVector2 center\n\t)\n\t{\n\t\tVector2 gap =\n\t\t\tCalculateCrosshairGap(\n\t\t\t\tCurrentSpread\n\t\t\t);\n\n\t\tfloat horizontalGap =\n\t\t\tgap.x;\n\n\t\tfloat verticalGap =\n\t\t\tgap.y;\n\n\t\tfloat length =\n\t\t\tMathF.Max(\n\t\t\t\tCrosshairLineLength,\n\t\t\t\t0f\n\t\t\t);\n\n\t\tfloat width =\n\t\t\tMathF.Max(\n\t\t\t\tCrosshairLineWidth,\n\t\t\t\t0.5f\n\t\t\t);\n\n\t\tpainter.DrawLine(\n\t\t\tcenter \u002B\n\t\t\t\tVector2.Left *\n\t\t\t\t(\n\t\t\t\t\thorizontalGap \u002B\n\t\t\t\t\tlength\n\t\t\t\t),\n\t\t\tcenter \u002B\n\t\t\t\tVector2.Left *\n\t\t\t\t\thorizontalGap,\n\t\t\twidth,\n\t\t\tCrosshairColor\n\t\t);\n\n\t\tpainter.DrawLine(\n\t\t\tcenter \u002B\n\t\t\t\tVector2.Right *\n\t\t\t\t\thorizontalGap,\n\t\t\tcenter \u002B\n\t\t\t\tVector2.Right *\n\t\t\t\t\t(\n\t\t\t\t\t\thorizontalGap \u002B\n\t\t\t\t\t\tlength\n\t\t\t\t\t),\n\t\t\twidth,\n\t\t\tCrosshairColor\n\t\t);\n\n\t\tpainter.DrawLine(\n\t\t\tcenter \u002B\n\t\t\t\tVector2.Up *\n\t\t\t\t\t(\n\t\t\t\t\t\tverticalGap \u002B\n\t\t\t\t\t\tlength\n\t\t\t\t\t),\n\t\t\tcenter \u002B\n\t\t\t\tVector2.Up *\n\t\t\t\t\tverticalGap,\n\t\t\twidth,\n\t\t\tCrosshairColor\n\t\t);\n\n\t\tpainter.DrawLine(\n\t\t\tcenter \u002B\n\t\t\t\tVector2.Down *\n\t\t\t\t\tverticalGap,\n\t\t\tcenter \u002B\n\t\t\t\tVector2.Down *\n\t\t\t\t\t(\n\t\t\t\t\t\tverticalGap \u002B\n\t\t\t\t\t\tlength\n\t\t\t\t\t),\n\t\t\twidth,\n\t\t\tCrosshairColor\n\t\t);\n\t}\n\n\tprivate Vector2 CalculateCrosshairGap(\n\t\tVector2 spread\n\t)\n\t{\n\t\tCameraComponent camera =\n\t\t\tScene.Camera;\n\n\t\tif (\n\t\t\tcamera is null ||\n\t\t\tScreen.Width \u003C= 1f ||\n\t\t\tScreen.Height \u003C= 1f\n\t\t)\n\t\t{\n\t\t\treturn new Vector2(\n\t\t\t\tCrosshairMinimumGap,\n\t\t\t\tCrosshairMinimumGap\n\t\t\t);\n\t\t}\n\n\t\tfloat fov =\n\t\t\tcamera.View.FieldOfView;\n\n\t\tif ( fov \u003C= 1f )\n\t\t{\n\t\t\tfov =\n\t\t\t\tcamera.FieldOfView;\n\t\t}\n\n\t\tfov =\n\t\t\tMathX.Clamp(\n\t\t\t\tfov,\n\t\t\t\t1f,\n\t\t\t\t179f\n\t\t\t);\n\n\t\tfloat aspect =\n\t\t\tScreen.Aspect;\n\n\t\tif ( aspect \u003C= 0.01f )\n\t\t{\n\t\t\taspect =\n\t\t\t\tScreen.Width /\n\t\t\t\tScreen.Height;\n\t\t}\n\n\t\tfloat horizontalFovRadians;\n\n\t\tfloat verticalFovRadians;\n\n\t\tfloat sourceFovRadians =\n\t\t\tDegreesToRadians(\n\t\t\t\tfov\n\t\t\t);\n\n\t\tif (\n\t\t\tcamera.FovAxis ==\n\t\t\tCameraComponent.Axis.Horizontal\n\t\t)\n\t\t{\n\t\t\thorizontalFovRadians =\n\t\t\t\tsourceFovRadians;\n\n\t\t\tverticalFovRadians =\n\t\t\t\t2f *\n\t\t\t\tMathF.Atan(\n\t\t\t\t\tMathF.Tan(\n\t\t\t\t\t\thorizontalFovRadians *\n\t\t\t\t\t\t\t0.5f\n\t\t\t\t\t) /\n\t\t\t\t\taspect\n\t\t\t\t);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tverticalFovRadians =\n\t\t\t\tsourceFovRadians;\n\n\t\t\thorizontalFovRadians =\n\t\t\t\t2f *\n\t\t\t\tMathF.Atan(\n\t\t\t\t\tMathF.Tan(\n\t\t\t\t\t\tverticalFovRadians *\n\t\t\t\t\t\t\t0.5f\n\t\t\t\t\t) *\n\t\t\t\t\taspect\n\t\t\t\t);\n\t\t}\n\n\t\tfloat spreadXRadians =\n\t\t\tDegreesToRadians(\n\t\t\t\tMathF.Abs(\n\t\t\t\t\tspread.x\n\t\t\t\t)\n\t\t\t);\n\n\t\tfloat spreadYRadians =\n\t\t\tDegreesToRadians(\n\t\t\t\tMathF.Abs(\n\t\t\t\t\tspread.y\n\t\t\t\t)\n\t\t\t);\n\n\t\tfloat horizontalProjection =\n\t\t\tMathF.Tan(\n\t\t\t\thorizontalFovRadians *\n\t\t\t\t\t0.5f\n\t\t\t);\n\n\t\tfloat verticalProjection =\n\t\t\tMathF.Tan(\n\t\t\t\tverticalFovRadians *\n\t\t\t\t\t0.5f\n\t\t\t);\n\n\t\tif (\n\t\t\thorizontalProjection \u003C= 0.0001f ||\n\t\t\tverticalProjection \u003C= 0.0001f\n\t\t)\n\t\t{\n\t\t\treturn new Vector2(\n\t\t\t\tCrosshairMinimumGap,\n\t\t\t\tCrosshairMinimumGap\n\t\t\t);\n\t\t}\n\n\t\tfloat gapX =\n\t\t\tMathF.Tan(\n\t\t\t\tspreadXRadians\n\t\t\t) /\n\t\t\thorizontalProjection *\n\t\t\t(\n\t\t\t\tScreen.Width *\n\t\t\t\t\t0.5f\n\t\t\t);\n\n\t\tfloat gapY =\n\t\t\tMathF.Tan(\n\t\t\t\tspreadYRadians\n\t\t\t) /\n\t\t\tverticalProjection *\n\t\t\t(\n\t\t\t\tScreen.Height *\n\t\t\t\t\t0.5f\n\t\t\t);\n\n\t\tgapX *=\n\t\t\tCrosshairSpreadVisualScale;\n\n\t\tgapY *=\n\t\t\tCrosshairSpreadVisualScale;\n\n\t\tgapX =\n\t\t\tMathX.Clamp(\n\t\t\t\tgapX,\n\t\t\t\tCrosshairMinimumGap,\n\t\t\t\tCrosshairMaximumGap\n\t\t\t);\n\n\t\tgapY =\n\t\t\tMathX.Clamp(\n\t\t\t\tgapY,\n\t\t\t\tCrosshairMinimumGap,\n\t\t\t\tCrosshairMaximumGap\n\t\t\t);\n\n\t\treturn new Vector2(\n\t\t\tgapX,\n\t\t\tgapY\n\t\t);\n\t}\n\n\tprivate static float DegreesToRadians(\n\t\tfloat degrees\n\t)\n\t{\n\t\treturn degrees *\n\t\t\t(\n\t\t\t\tMathF.PI /\n\t\t\t\t180f\n\t\t\t);\n\t}\n\n\t// =========================================================\n\t// ROUND RESET\n\t// =========================================================\n\n\t/// \u003Csummary\u003E\n\t/// Clears owner-local transient weapon state when a new round\n\t/// is prepared.\n\t///\n\t/// BaseCombatWeapon owns reload cancellation and ammo on the\n\t/// host. This method only resets One More Round presentation\n\t/// and accuracy state without trying to call the protected\n\t/// CreateViewModel/DestroyViewModel methods from another\n\t/// component.\n\t/// \u003C/summary\u003E\n\tpublic void ResetForRoundPresentation()\n\t{\n\t\t_sprintSuppressesAim =\n\t\t\tfalse;\n\n\t\tResetAimState();\n\t\tResetAccuracyState();\n\t\tResetRecoilState();\n\t\tResetCycleState( chambered: true );\n\t\tResetWeaponActionState();\n\t\tResetShotValidationState();\n\t\tResetViewModelPresentationState();\n\t}\n\n\t// =========================================================\n\t// ADS / SPRINT NEGOTIATION\n\t// =========================================================\n\n\tpublic void SuppressAimForSprint()\n\t{\n\t\tif ( _sprintSuppressesAim )\n\t\t\treturn;\n\n\t\t_sprintSuppressesAim =\n\t\t\ttrue;\n\n\t\tif ( IsAiming )\n\t\t{\n\t\t\tSetAiming(\n\t\t\t\tfalse\n\t\t\t);\n\t\t}\n\t}\n\n\tpublic void ReleaseAimSuppressionForSprint()\n\t{\n\t\t_sprintSuppressesAim =\n\t\t\tfalse;\n\t}\n\n\t// =========================================================\n\t// ADS STATE\n\t// =========================================================\n\n\tprivate void SetAiming(\n\t\tbool aiming\n\t)\n\t{\n\t\tif ( aiming \u0026\u0026 !AllowAim )\n\t\t\taiming = false;\n\n\t\tif (\n\t\t\tIsAiming ==\n\t\t\taiming\n\t\t)\n\t\t\treturn;\n\n\t\tIsAiming =\n\t\t\taiming;\n\n\t\t_viewModelAimStateDirty =\n\t\t\ttrue;\n\n\t\tif ( EnableDebugLogging )\n\t\t{\n\t\t\tLog.Info(\n\t\t\t\t$\u0022[OMR ADS] {(IsAiming ? \u0022ON\u0022 : \u0022OFF\u0022)} | Weapon: {GameObject.Name}\u0022\n\t\t\t);\n\t\t}\n\n\t\tEnsureViewModelAimState();\n\t}\n\n\tprivate void ResetAimState()\n\t{\n\t\tIsAiming =\n\t\t\tfalse;\n\n\t\t_aimFovBlend =\n\t\t\t0f;\n\n\t\t_sprintSuppressesAim =\n\t\t\tfalse;\n\n\t\t_viewModelAimStateDirty =\n\t\t\ttrue;\n\n\t\tEnsureViewModelAimState();\n\n\t\t_lastAimViewModel =\n\t\t\tnull;\n\t}\n\n\t// =========================================================\n\t// VIEW MODEL ADS\n\t// =========================================================\n\n\tprivate void EnsureViewModelAimState()\n\t{\n\t\tGameObject currentViewModel =\n\t\t\tViewModel;\n\n\t\tif (\n\t\t\tcurrentViewModel is null\n\t\t)\n\t\t{\n\t\t\t_lastAimViewModel =\n\t\t\t\tnull;\n\n\t\t\t_viewModelAimStateDirty =\n\t\t\t\ttrue;\n\n\t\t\treturn;\n\t\t}\n\n\t\tif (\n\t\t\tcurrentViewModel !=\n\t\t\t_lastAimViewModel\n\t\t)\n\t\t{\n\t\t\t_lastAimViewModel =\n\t\t\t\tcurrentViewModel;\n\n\t\t\t_viewModelAimStateDirty =\n\t\t\t\ttrue;\n\t\t}\n\n\t\tif (\n\t\t\t!_viewModelAimStateDirty\n\t\t)\n\t\t\treturn;\n\n\t\tBaseWeaponModel weaponModel =\n\t\t\tcurrentViewModel\n\t\t\t\t.Components\n\t\t\t\t.Get\u003CBaseWeaponModel\u003E();\n\n\t\tSkinnedModelRenderer renderer =\n\t\t\tweaponModel?.\n\t\t\t\tRenderer;\n\n\t\trenderer ??=\n\t\t\tcurrentViewModel\n\t\t\t\t.Components\n\t\t\t\t.Get\u003CSkinnedModelRenderer\u003E();\n\n\t\tif (\n\t\t\trenderer is null\n\t\t)\n\t\t\treturn;\n\n\t\trenderer.Set(\n\t\t\t\u0022ironsights\u0022,\n\t\t\tIsAiming ? 1 : 0\n\t\t);\n\n\t\trenderer.Set(\n\t\t\t\u0022ironsights_fire_scale\u0022,\n\t\t\tGetEffectiveViewModelFireScale()\n\t\t);\n\n\t\trenderer.Set(\n\t\t\t\u0022speed_ironsights\u0022,\n\t\t\tMathF.Max( AimAnimationSpeed, 0.1f )\n\t\t);\n\n\t\t_viewModelAimStateDirty =\n\t\t\tfalse;\n\t}\n\n\t// =========================================================\n\t// ADS CAMERA\n\t// =========================================================\n\n\tprotected override void ModifyCamera(\n\t\tCameraComponent camera,\n\t\tref CameraView view\n\t)\n\t{\n\t\t// Only the weapon held by the actual local human may modify the local\n\t\t// gameplay camera. Host-owned bots are non-proxy on the host, so an\n\t\t// IsProxy-only check is insufficient: without this gate, ROOK\u0027s ADS state\n\t\t// multiplies the host player\u0027s FOV whenever the bot aims.\n\t\tPlayerState ownerState =\n\t\t\tOwner?.Components.Get\u003CPlayerState\u003E();\n\n\t\tif ( ownerState?.IsLocalHuman != true )\n\t\t\treturn;\n\n\t\tfloat clampedAimFovScale =\n\t\t\tMathX.Clamp(\n\t\t\t\tAimFovScale,\n\t\t\t\t0.1f,\n\t\t\t\t1f\n\t\t\t);\n\n\t\tfloat finalFovScale =\n\t\t\tMathX.Lerp(\n\t\t\t\t1f,\n\t\t\t\tclampedAimFovScale,\n\t\t\t\t_aimFovBlend\n\t\t\t);\n\n\t\t// Weapon ADS projection belongs only to the real gameplay camera. Secondary\n\t\t// cameras (viewmodel, PiP optics, mirrors, future RT cameras) own their own\n\t\t// projection and must not inherit this modifier accidentally.\n\t\t//\n\t\t// PiP scopes keep their optical magnification in OMRScopePiPCamera. The\n\t\t// gameplay camera may optionally receive only a separate, presentation-only\n\t\t// peripheral focus scale from the optic profile.\n\t\tbool isGameplayCamera = camera == Scene?.Camera;\n\n\t\tif ( isGameplayCamera )\n\t\t{\n\t\t\tif ( UsesPictureInPictureScope )\n\t\t\t{\n\t\t\t\t// PiP optics own their real magnification in OMRScopePiPCamera, but\n\t\t\t\t// may optionally apply a small presentation-only focus zoom to the\n\t\t\t\t// surrounding world. Keep this separate from AimFovScale so the\n\t\t\t\t// authored optical magnification remains independent.\n\t\t\t\tview.FieldOfView *= CurrentPeripheralAimFovScale;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tview.FieldOfView *= finalFovScale;\n\t\t\t}\n\n\t\t\tview.FieldOfView = MathX.Clamp(\n\t\t\t\tview.FieldOfView,\n\t\t\t\t1f,\n\t\t\t\t179f\n\t\t\t);\n\t\t}\n\n\t\tbase.ModifyCamera(\n\t\t\tcamera,\n\t\t\tref view\n\t\t);\n\t}\n\n\t// =========================================================\n\t// WORLD MODEL RECOVERY\n\t// =========================================================\n\n\tprivate void UpdateWorldModelRecovery()\n\t{\n\t\tif (\n\t\t\t!EnableWorldModelRecovery\n\t\t)\n\t\t\treturn;\n\n\t\t// World models belong only to the deployed weapon. BaseCombatWeapon\n\t\t// destroys them in OnHolstered(); IsHeld alone is not sufficient here\n\t\t// because inactive inventory items can remain parented to the player.\n\t\tif ( !IsActive || !IsHeld )\n\t\t\treturn;\n\n\t\tif (\n\t\t\t_worldModelRecoveryAttempted\n\t\t)\n\t\t\treturn;\n\n\t\t_timeAlive \u002B=\n\t\t\tTime.Delta;\n\n\t\tif (\n\t\t\t_timeAlive \u003C\n\t\t\tWorldModelRecoveryDelay\n\t\t)\n\t\t\treturn;\n\n\t\t_worldModelRecoveryAttempted =\n\t\t\ttrue;\n\n\t\tTryRecoverWorldModel();\n\t}\n\n\tprivate void TryRecoverWorldModel()\n\t{\n\t\tif (\n\t\t\tWorldModel is not null\n\t\t)\n\t\t\treturn;\n\n\t\tif ( !IsActive || !IsHeld )\n\t\t\treturn;\n\n\t\tif (\n\t\t\tWorldModelPrefab is null\n\t\t)\n\t\t{\n\t\t\tLog.Warning(\n\t\t\t\t$\u0022[OMR WEAPON] Recovery failed | {GameObject.Name} | WorldModelPrefab NULL\u0022\n\t\t\t);\n\n\t\t\treturn;\n\t\t}\n\n\t\tif (\n\t\t\tHolderRenderer is null\n\t\t)\n\t\t{\n\t\t\tLog.Warning(\n\t\t\t\t$\u0022[OMR WEAPON] Recovery failed | {GameObject.Name} | HolderRenderer NULL\u0022\n\t\t\t);\n\n\t\t\treturn;\n\t\t}\n\n\t\tif (\n\t\t\tstring.IsNullOrWhiteSpace(\n\t\t\t\tHoldBone\n\t\t\t)\n\t\t)\n\t\t{\n\t\t\tLog.Warning(\n\t\t\t\t$\u0022[OMR WEAPON] Recovery failed | {GameObject.Name} | HoldBone empty\u0022\n\t\t\t);\n\n\t\t\treturn;\n\t\t}\n\n\t\tbool hasBone =\n\t\t\tHolderRenderer.TryGetBoneTransform(\n\t\t\t\tHoldBone,\n\t\t\t\tout _\n\t\t\t);\n\n\t\tif (\n\t\t\t!hasBone\n\t\t)\n\t\t{\n\t\t\tLog.Warning(\n\t\t\t\t$\u0022[OMR WEAPON] Recovery failed | {GameObject.Name} | Hold bone \u0027{HoldBone}\u0027 unavailable\u0022\n\t\t\t);\n\n\t\t\treturn;\n\t\t}\n\n\t\tif ( EnableDebugLogging )\n\t\t{\n\t\t\tLog.Info(\n\t\t\t\t$\u0022[OMR WEAPON] Recovering WorldModel | {GameObject.Name} | Proxy: {IsProxy}\u0022\n\t\t\t);\n\t\t}\n\n\t\tCreateWorldModel();\n\n\t\tif (\n\t\t\tWorldModel is not null\n\t\t)\n\t\t{\n\t\t\tif ( EnableDebugLogging )\n\t\t\t{\n\t\t\t\tLog.Info(\n\t\t\t\t\t$\u0022[OMR WEAPON] Recovery SUCCESS | WorldModel: {WorldModel.Name}\u0022\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tLog.Warning(\n\t\t\t\t\u0022[OMR WEAPON] Recovery attempt completed but WorldModel is still NULL\u0022\n\t\t\t);\n\t\t}\n\t}\n}\n"},{"Ident":"lfinchgames.oneplusround","Path":"UI/Foundation/OMRSceneFlow.cs","FileName":"OMRSceneFlow.cs","PackageType":"game","CodeKind":"Game","AssetVersionId":399243,"IsPrivate":false,"Code":"using Sandbox;\n\npublic enum OMRGameplayEntry\n{\n\tNone,\n\tFindMatch,\n\tBotMatch,\n\tSandboxSetup\n}\n\npublic enum OMRMenuPreviewPage\n{\n\tHome,\n\tPlay,\n\tPractice,\n\tSettings\n}\n\n/// \u003Csummary\u003E\n/// Carries a one-shot local menu intent across the startup-menu to gameplay\n/// scene transition. It never stores match state and never replaces the\n/// authoritative RoundManager/GameFlowManager flow.\n/// \u003C/summary\u003E\npublic static class OMRSceneFlow\n{\n\t// Local explanation survives a clean scene reload after a lost session.\n\tpublic static string SessionNotice { get; set; } = \u0022\u0022;\n\tprivate static OMRGameplayEntry _pendingEntry;\n\n\t// Practice-vs-bot preference must survive the menu.scene -\u003E main.scene handoff.\n\t// This is local UI state only; RoundManager remains authoritative once gameplay starts.\n\tpublic static OMRBotDifficulty BotMatchDifficulty { get; set; } = OMRBotDifficulty.Hard;\n\n\tpublic static void CycleBotMatchDifficulty( int delta )\n\t{\n\t\tint count = System.Enum.GetValues\u003COMRBotDifficulty\u003E().Length;\n\t\tif ( count \u003C= 0 ) return;\n\t\tint next = ( (int)BotMatchDifficulty \u002B delta ) % count;\n\t\tif ( next \u003C 0 ) next \u002B= count;\n\t\tBotMatchDifficulty = (OMRBotDifficulty)next;\n\t}\n\n\tpublic static string GetBotMatchDifficultyName() =\u003E\n\t\tBotMatchDifficulty.ToString().ToUpperInvariant();\n\n\tpublic static void RequestGameplayEntry( OMRGameplayEntry entry )\n\t{\n\t\t_pendingEntry = entry;\n\t}\n\n\tpublic static OMRGameplayEntry ConsumeGameplayEntry()\n\t{\n\t\tOMRGameplayEntry entry = _pendingEntry;\n\t\t_pendingEntry = OMRGameplayEntry.None;\n\t\treturn entry;\n\t}\n}\n"},{"Ident":"lfinchgames.oneplusround","Path":"UI/Foundation/OMRUIRuntimeStyle.cs","FileName":"OMRUIRuntimeStyle.cs","PackageType":"game","CodeKind":"Game","AssetVersionId":399243,"IsPrivate":false,"Code":"using Sandbox;\nusing Sandbox.UI;\nusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Linq;\n\n/// \u003Csummary\u003E\n/// Applies GameResource values as typed Panel styles. SCSS remains responsible\n/// for structure, transitions and responsive rules; this layer supplies the\n/// values designers are expected to tune from the Inspector.\n/// \u003C/summary\u003E\npublic static class OMRUIRuntimeStyle\n{\n\tpublic static void ApplyMenu(\n\t\tPanel root,\n\t\tOMRUITheme theme,\n\t\tOMRMainMenuLayout layout\n\t)\n\t{\n\t\tif ( root is null || theme is null || layout is null )\n\t\t\treturn;\n\n\t\troot.Style.FontFamily = theme.BodyFont;\n\t\troot.Style.FontColor = theme.PrimaryText;\n\n\t\tforeach ( Panel panel in Panels( root ) )\n\t\t{\n\t\t\tApplyTextFormatting( panel, theme );\n\t\t\tApplyDisplayTextEffect( panel, theme );\n\t\t\tif ( panel.HasClass( \u0022menu-screen\u0022 ) )\n\t\t\t\tpanel.Style.BackgroundColor = theme.MenuCanvasColor;\n\n\t\t\tif ( panel.HasClass( \u0022menu-background\u0022 ) )\n\t\t\t{\n\t\t\t\tif ( panel is Image background )\n\t\t\t\t\tbackground.Texture = theme.GetBackgroundImage();\n\n\t\t\t\tpanel.Style.ObjectFit = Fit( layout.BackgroundFit );\n\t\t\t\tpanel.Style.Opacity = theme.MenuBackgroundOpacity;\n\n\t\t\t\t// Keep the image box locked to the viewport and zoom it using a real\n\t\t\t\t// transform. Growing Width/Height caused the engine to effectively\n\t\t\t\t// zoom from the top-left corner and made pan/focus hard to reason about.\n\t\t\t\tpanel.Style.Width = Length.Percent( 100f );\n\t\t\t\tpanel.Style.Height = Length.Percent( 100f );\n\t\t\t\tpanel.Style.Left = Length.Pixels( layout.BackgroundOffsetX );\n\t\t\t\tpanel.Style.Top = Length.Pixels( layout.BackgroundOffsetY );\n\n\t\t\t\tfloat originX = Math.Clamp( layout.BackgroundPositionXPercent, 0f, 100f );\n\t\t\t\tfloat originY = Math.Clamp( layout.BackgroundPositionYPercent, 0f, 100f );\n\t\t\t\tpanel.Style.TransformOriginX = Length.Percent( originX );\n\t\t\t\tpanel.Style.TransformOriginY = Length.Percent( originY );\n\n\t\t\t\tfloat zoomScale = Math.Clamp( layout.BackgroundZoomPercent, 100f, 200f ) / 100f;\n\t\t\t\tPanelTransform backgroundTransform = new();\n\t\t\t\tbackgroundTransform.AddScale( zoomScale );\n\t\t\t\tpanel.Style.Transform = backgroundTransform;\n\t\t\t}\n\n\t\t\tif ( panel.HasClass( \u0022menu-overlay\u0022 ) )\n\t\t\t{\n\t\t\t\tpanel.Style.BackgroundColor = theme.ScreenOverlay;\n\t\t\t\tpanel.Style.Opacity = layout.ShowScreenOverlay ? layout.ScreenOverlayOpacity : 0f;\n\t\t\t}\n\n\t\t\tif ( panel.HasClass( \u0022menu-shell\u0022 ) )\n\t\t\t{\n\t\t\t\tif ( layout.ShellMode == OMRMenuShellMode.FullScreenCanvas )\n\t\t\t\t{\n\t\t\t\t\t// In canvas mode the shell stops being a layout constraint. It remains\n\t\t\t\t\t// only as a structural parent so brand/navigation offsets are relative\n\t\t\t\t\t// to the full screen rather than a centered panel.\n\t\t\t\t\tpanel.Style.Width = Length.Percent( 100f );\n\t\t\t\t\tpanel.Style.Height = Length.Percent( 100f );\n\t\t\t\t\tpanel.Style.MaxHeight = Length.Percent( 100f );\n\t\t\t\t\tSetPadding( panel, 0f );\n\t\t\t\t\tpanel.Style.Left = Length.Pixels( 0f );\n\t\t\t\t\tpanel.Style.Top = Length.Pixels( 0f );\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tpanel.Style.Width = Length.Pixels( layout.ShellWidth );\n\t\t\t\t\tpanel.Style.Height = Length.Auto;\n\t\t\t\t\tpanel.Style.MaxHeight = Length.Percent( layout.ShellMaxHeightPercent );\n\t\t\t\t\tSetPadding( panel, layout.ShellPadding );\n\t\t\t\t\tpanel.Style.Left = Length.Pixels( layout.ShellOffsetX );\n\t\t\t\t\tpanel.Style.Top = Length.Pixels( layout.ShellOffsetY );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ( panel.HasClass( \u0022menu-shell-chrome\u0022 ) )\n\t\t\t{\n\t\t\t\tpanel.Style.BackgroundColor = theme.MenuShellBackground;\n\t\t\t\tpanel.Style.BorderColor = theme.StrongBorder;\n\t\t\t\tpanel.Style.BorderWidth = Length.Pixels( layout.BorderWidth );\n\t\t\t\tbool shellChromeVisible =\n\t\t\t\t\tlayout.ShellMode == OMRMenuShellMode.Panel \u0026\u0026\n\t\t\t\t\tlayout.ShowShellChrome;\n\t\t\t\tpanel.Style.Opacity = shellChromeVisible ? layout.ShellChromeOpacity : 0f;\n\t\t\t\tSetCornerRadius( panel, theme.MenuShellCornerRadius );\n\t\t\t\tApplyBackdropBlur( panel, theme.PrimaryPanelBackdropBlur );\n\t\t\t\tApplyPrimaryPanelShadow( panel, theme );\n\t\t\t}\n\n\t\t\tif ( panel.HasClass( \u0022session-notice\u0022 ) )\n\t\t\t{\n\t\t\t\tpanel.Style.BackgroundColor = theme.NoticeBackground;\n\t\t\t\tpanel.Style.BorderColor = theme.SoftBorder;\n\t\t\t\tpanel.Style.FontColor = theme.SecondaryText;\n\t\t\t\tSetCornerRadius( panel, theme.TagCornerRadius );\n\t\t\t}\n\n\t\t\tif ( panel.HasClass( \u0022menu-brand\u0022 ) )\n\t\t\t{\n\t\t\t\tpanel.Style.Display = layout.ShowBrand ? DisplayMode.Flex : DisplayMode.None;\n\t\t\t\tpanel.Style.Opacity = layout.BrandOpacity;\n\t\t\t\tpanel.Style.MarginBottom = Length.Pixels( layout.BrandBottomSpacing );\n\t\t\t\tpanel.Style.Left = Length.Pixels( layout.BrandOffsetX );\n\t\t\t\tpanel.Style.Top = Length.Pixels( layout.BrandOffsetY );\n\t\t\t}\n\n\t\t\tif ( panel.HasClass( \u0022menu-logo\u0022 ) )\n\t\t\t{\n\t\t\t\tpanel.Style.Display = layout.ShowLogo ? DisplayMode.Flex : DisplayMode.None;\n\t\t\t\tpanel.Style.ObjectFit = Fit( layout.LogoFit );\n\t\t\t\tpanel.Style.Width = Length.Pixels( layout.LogoWidth );\n\t\t\t\tpanel.Style.Height = Length.Pixels( layout.LogoHeight );\n\t\t\t\tpanel.Style.Left = Length.Pixels( layout.LogoOffsetX );\n\t\t\t\tpanel.Style.Top = Length.Pixels( layout.LogoOffsetY );\n\t\t\t\tpanel.Style.MarginBottom = Length.Pixels( layout.LogoBottomSpacing );\n\t\t\t\tpanel.Style.Opacity = layout.LogoOpacity;\n\t\t\t\tif ( panel is Image logo ) logo.Texture = theme.GetLogoImage();\n\t\t\t}\n\n\t\t\tif ( panel.HasClass( \u0022menu-title\u0022 ) )\n\t\t\t{\n\t\t\t\tpanel.Style.FontFamily = theme.DisplayFont;\n\t\t\t\tpanel.Style.FontColor = theme.OverrideMenuTitleColor ? theme.MenuTitleColor : theme.PrimaryText;\n\t\t\t\tpanel.Style.FontSize = Length.Pixels( layout.TitleSize );\n\t\t\t\tpanel.Style.LetterSpacing = Length.Pixels( layout.TitleLetterSpacing );\n\t\t\t\tpanel.Style.Width = Length.Percent( 100f );\n\t\t\t\tpanel.Style.Left = Length.Pixels( layout.TitleOffsetX );\n\t\t\t\tpanel.Style.Top = Length.Pixels( layout.TitleOffsetY );\n\t\t\t\tpanel.Style.Opacity = layout.TitleOpacity;\n\t\t\t\tApplyTextLayout( panel, layout.TitleAlignment, layout.TitleIndent );\n\t\t\t}\n\n\t\t\tif ( panel.HasClass( \u0022menu-subtitle\u0022 ) )\n\t\t\t{\n\t\t\t\tpanel.Style.FontFamily = theme.BodyFont;\n\t\t\t\tpanel.Style.FontColor = theme.OverrideSubtitleColor ? theme.SubtitleColor : theme.SecondaryText;\n\t\t\t\tpanel.Style.FontSize = Length.Pixels( layout.SubtitleSize );\n\t\t\t\tpanel.Style.LetterSpacing = Length.Pixels( layout.SubtitleLetterSpacing );\n\t\t\t\tpanel.Style.Width = Length.Percent( 100f );\n\t\t\t\tpanel.Style.Left = Length.Pixels( layout.SubtitleOffsetX );\n\t\t\t\tpanel.Style.Top = Length.Pixels( layout.SubtitleOffsetY );\n\t\t\t\tpanel.Style.Opacity = layout.SubtitleOpacity;\n\t\t\t\tApplyTextLayout( panel, layout.SubtitleAlignment, layout.SubtitleIndent );\n\t\t\t}\n\n\t\t\tif ( panel.HasClass( \u0022menu-navigation\u0022 ) )\n\t\t\t{\n\t\t\t\tpanel.Style.Left = Length.Pixels( layout.NavigationOffsetX );\n\t\t\t\tpanel.Style.Top = Length.Pixels( layout.NavigationOffsetY );\n\t\t\t\tpanel.Style.Display = layout.ShowNavigation ? DisplayMode.Flex : DisplayMode.None;\n\t\t\t\tpanel.Style.Opacity = layout.NavigationOpacity;\n\t\t\t}\n\n\t\t\tif ( panel.HasClass( \u0022menu-page\u0022 ) )\n\t\t\t{\n\t\t\t\tpanel.Style.RowGap = Length.Pixels( layout.ButtonGap );\n\t\t\t\tpanel.Style.AlignItems = layout.NavigationContentAlignment switch\n\t\t\t\t{\n\t\t\t\t\tOMRTextHorizontalAlignment.Left =\u003E Align.FlexStart,\n\t\t\t\t\tOMRTextHorizontalAlignment.Right =\u003E Align.FlexEnd,\n\t\t\t\t\t_ =\u003E Align.Center\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tif ( panel.HasClass( \u0022menu-button\u0022 ) )\n\t\t\t{\n\t\t\t\tpanel.Style.Width = Length.Pixels( layout.ButtonWidth );\n\t\t\t\tpanel.Style.MinHeight = Length.Pixels( layout.ButtonHeight );\n\t\t\t\tpanel.Style.FontColor = theme.PrimaryText;\n\t\t\t\tpanel.Style.TransformOriginX = Length.Percent( 50f );\n\t\t\t\tpanel.Style.TransformOriginY = Length.Percent( 50f );\n\n\t\t\t\tfloat buttonScale = 1f;\n\t\t\t\tfloat hoverX = 0f;\n\t\t\t\tfloat hoverY = 0f;\n\n\t\t\t\tif ( panel.HasHovered )\n\t\t\t\t{\n\t\t\t\t\tbuttonScale = Math.Clamp( layout.ButtonHoverScalePercent, 100f, 120f ) / 100f;\n\t\t\t\t\thoverX = layout.ButtonHoverOffsetX;\n\t\t\t\t\thoverY = layout.ButtonHoverOffsetY;\n\t\t\t\t}\n\n\t\t\t\tif ( panel.HasActive )\n\t\t\t\t\tbuttonScale = Math.Clamp( layout.ButtonPressedScalePercent, 80f, 100f ) / 100f;\n\n\t\t\t\tPanelTransform buttonTransform = new();\n\t\t\t\tbuttonTransform.AddTranslate( Length.Pixels( hoverX ), Length.Pixels( hoverY ), null );\n\t\t\t\tbuttonTransform.AddScale( buttonScale );\n\t\t\t\tpanel.Style.Transform = buttonTransform;\n\n\t\t\t\tbool accent =\n\t\t\t\t\tpanel.HasClass( \u0022primary\u0022 ) ||\n\t\t\t\t\tpanel.HasClass( \u0022matchmaking-button\u0022 );\n\n\t\t\t\tif ( layout.ShowButtonChrome )\n\t\t\t\t{\n\t\t\t\t\tpanel.Style.BorderColor = accent ? theme.AccentBorder : theme.Border;\n\t\t\t\t\tpanel.Style.BorderWidth = Length.Pixels( layout.BorderWidth );\n\t\t\t\t\tpanel.Style.BackgroundColor = accent\n\t\t\t\t\t\t? InteractiveColor( panel, theme.Accent, theme.AccentHover, theme.AccentPressed )\n\t\t\t\t\t\t: InteractiveColor( panel, theme.Button, theme.ButtonHover, theme.ButtonPressed );\n\t\t\t\t\tSetCornerRadius( panel, theme.ButtonCornerRadius );\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tpanel.Style.BorderWidth = Length.Pixels( 0f );\n\t\t\t\t\tpanel.Style.BackgroundColor = Color.Transparent;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ( panel.HasClass( \u0022button-title\u0022 ) )\n\t\t\t{\n\t\t\t\tpanel.Style.FontFamily = theme.DisplayFont;\n\t\t\t\tpanel.Style.FontSize = Length.Pixels( layout.ButtonTitleSize );\n\t\t\t\tpanel.Style.FontColor = theme.OverrideButtonTitleColor ? theme.ButtonTitleColor : theme.PrimaryText;\n\t\t\t\tpanel.Style.Width = Length.Percent( 100f );\n\t\t\t\tpanel.Style.Left = Length.Pixels( layout.ButtonTitleOffsetX );\n\t\t\t\tpanel.Style.Top = Length.Pixels( layout.ButtonTitleOffsetY );\n\t\t\t\tApplyTextLayout( panel, layout.ButtonTitleAlignment, layout.ButtonTitleIndent );\n\t\t\t}\n\n\t\t\tif ( panel.HasClass( \u0022button-description\u0022 ) )\n\t\t\t{\n\t\t\t\tpanel.Style.Display = layout.ShowButtonDescriptions ? DisplayMode.Flex : DisplayMode.None;\n\t\t\t\tpanel.Style.FontFamily = theme.BodyFont;\n\t\t\t\tpanel.Style.FontSize = Length.Pixels( layout.ButtonDescriptionSize );\n\t\t\t\tpanel.Style.FontColor = theme.OverrideButtonDescriptionColor ? theme.ButtonDescriptionColor : theme.SecondaryText;\n\t\t\t\tpanel.Style.Width = Length.Percent( 100f );\n\t\t\t\tpanel.Style.Left = Length.Pixels( layout.ButtonDescriptionOffsetX );\n\t\t\t\tpanel.Style.Top = Length.Pixels( layout.ButtonDescriptionOffsetY );\n\t\t\t\tApplyTextLayout( panel, layout.ButtonDescriptionAlignment, layout.ButtonDescriptionIndent );\n\t\t\t}\n\n\t\t\tif ( panel.HasClass( \u0022page-heading\u0022 ) )\n\t\t\t{\n\t\t\t\tpanel.Style.FontFamily = theme.DisplayFont;\n\t\t\t\tpanel.Style.FontSize = Length.Pixels( layout.PageHeadingSize );\n\t\t\t\tpanel.Style.FontColor = theme.OverridePageHeadingColor ? theme.PageHeadingColor : theme.PrimaryText;\n\t\t\t\tpanel.Style.Left = Length.Pixels( layout.PageHeadingOffsetX );\n\t\t\t\tpanel.Style.Top = Length.Pixels( layout.PageHeadingOffsetY );\n\t\t\t\tApplyTextLayout( panel, layout.PageHeadingAlignment, layout.PageHeadingIndent );\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\tpanel.HasClass( \u0022page-copy\u0022 ) ||\n\t\t\t\tpanel.HasClass( \u0022setting-description\u0022 ) ||\n\t\t\t\tpanel.HasClass( \u0022lobby-note\u0022 )\n\t\t\t)\n\t\t\t{\n\t\t\t\tpanel.Style.FontFamily = theme.BodyFont;\n\t\t\t\tpanel.Style.FontColor = theme.SecondaryText;\n\t\t\t}\n\n\t\t\tif ( panel.HasClass( \u0022page-copy\u0022 ) )\n\t\t\t{\n\t\t\t\tpanel.Style.Display = layout.ShowPageCopy ? DisplayMode.Flex : DisplayMode.None;\n\t\t\t\tpanel.Style.FontSize = Length.Pixels( layout.PageCopySize );\n\t\t\t\tpanel.Style.FontColor = theme.OverridePageCopyColor ? theme.PageCopyColor : theme.SecondaryText;\n\t\t\t\tpanel.Style.Left = Length.Pixels( layout.PageCopyOffsetX );\n\t\t\t\tpanel.Style.Top = Length.Pixels( layout.PageCopyOffsetY );\n\t\t\t\tApplyTextLayout( panel, layout.PageCopyAlignment, layout.PageCopyIndent );\n\t\t\t}\n\n\t\t\tif ( panel.HasClass( \u0022player-card\u0022 ) )\n\t\t\t{\n\t\t\t\tpanel.Style.Width = Length.Pixels( layout.PlayerCardWidth );\n\t\t\t\tpanel.Style.MinHeight = Length.Pixels( layout.PlayerCardHeight );\n\n\t\t\t\tif ( layout.ShowPlayerCardChrome )\n\t\t\t\t{\n\t\t\t\t\tpanel.Style.BackgroundColor = theme.SoftPanelBackground;\n\t\t\t\t\tpanel.Style.BorderColor = theme.SoftBorder;\n\t\t\t\t\tpanel.Style.BorderWidth = Length.Pixels( layout.BorderWidth );\n\n\t\t\t\t\tif ( panel.HasClass( \u0022ready\u0022 ) )\n\t\t\t\t\t{\n\t\t\t\t\t\tpanel.Style.BackgroundColor = theme.PositiveSoft;\n\t\t\t\t\t\tpanel.Style.BorderColor = theme.PositiveBorder;\n\t\t\t\t\t}\n\t\t\t\t\telse if ( panel.HasClass( \u0022opponent-card\u0022 ) )\n\t\t\t\t\t{\n\t\t\t\t\t\tpanel.Style.BackgroundColor = theme.DangerSoft;\n\t\t\t\t\t\tpanel.Style.BorderColor = theme.DangerBorder;\n\t\t\t\t\t}\n\t\t\t\t\telse if ( panel.HasClass( \u0022practicing\u0022 ) )\n\t\t\t\t\t{\n\t\t\t\t\t\tpanel.Style.BackgroundColor = theme.AccentSoft;\n\t\t\t\t\t\tpanel.Style.BorderColor = theme.AccentBorder;\n\t\t\t\t\t}\n\n\t\t\t\t\tSetCornerRadius( panel, theme.SoftPanelCornerRadius );\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tpanel.Style.BackgroundColor = Color.Transparent;\n\t\t\t\t\tpanel.Style.BorderWidth = Length.Pixels( 0f );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\tpanel.HasClass( \u0022setup-section\u0022 ) ||\n\t\t\t\tpanel.HasClass( \u0022lobby-weapon-panel\u0022 ) ||\n\t\t\t\tpanel.HasClass( \u0022setting-row\u0022 )\n\t\t\t)\n\t\t\t{\n\t\t\t\tif ( layout.ShowSettingsChrome )\n\t\t\t\t{\n\t\t\t\t\tpanel.Style.BackgroundColor = theme.SoftPanelBackground;\n\t\t\t\t\tpanel.Style.BorderColor = theme.SoftBorder;\n\t\t\t\t\tpanel.Style.BorderWidth = Length.Pixels( layout.BorderWidth );\n\t\t\t\t\tSetCornerRadius( panel, theme.SoftPanelCornerRadius );\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tpanel.Style.BackgroundColor = Color.Transparent;\n\t\t\t\t\tpanel.Style.BorderWidth = Length.Pixels( 0f );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ( panel.HasClass( \u0022setting-row\u0022 ) )\n\t\t\t\tpanel.Style.MinHeight = Length.Pixels( layout.SettingRowHeight );\n\n\t\t\tif (\n\t\t\t\tpanel.HasClass( \u0022setting-control\u0022 ) ||\n\t\t\t\tpanel.HasClass( \u0022setup-selector\u0022 )\n\t\t\t)\n\t\t\t{\n\t\t\t\tpanel.Style.BackgroundColor = theme.ControlBackground;\n\t\t\t\tpanel.Style.BorderColor = theme.Border;\n\t\t\t\tSetCornerRadius( panel, theme.ControlCornerRadius );\n\t\t\t}\n\n\t\t\tif ( panel.HasClass( \u0022menu-back\u0022 ) || panel.HasClass( \u0022menu-primary\u0022 ) )\n\t\t\t{\n\t\t\t\tApplyActionAlignment( panel, layout.ActionTextAlignment, layout.ActionTextIndent );\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\tpanel.HasClass( \u0022menu-back\u0022 ) ||\n\t\t\t\tpanel.HasClass( \u0022setting-step\u0022 ) ||\n\t\t\t\tpanel.HasClass( \u0022setting-cycle\u0022 ) ||\n\t\t\t\tpanel.HasClass( \u0022settings-reset\u0022 ) ||\n\t\t\t\tpanel.HasClass( \u0022selector-arrow\u0022 )\n\t\t\t)\n\t\t\t{\n\t\t\t\tpanel.Style.BackgroundColor = InteractiveColor( panel, theme.Button, theme.ButtonHover, theme.ButtonPressed );\n\t\t\t\tpanel.Style.BorderColor = theme.Border;\n\t\t\t\tpanel.Style.FontColor = theme.PrimaryText;\n\t\t\t\tSetCornerRadius( panel, theme.ControlCornerRadius );\n\t\t\t}\n\n\t\t\tif ( panel.HasClass( \u0022menu-primary\u0022 ) )\n\t\t\t{\n\t\t\t\tif ( panel.HasClass( \u0022secondary-action\u0022 ) )\n\t\t\t\t{\n\t\t\t\t\tpanel.Style.BackgroundColor = InteractiveColor( panel, theme.Button, theme.ButtonHover, theme.ButtonPressed );\n\t\t\t\t\tpanel.Style.BorderColor = theme.Border;\n\t\t\t\t}\n\t\t\t\telse if ( panel.HasClass( \u0022warmup-action\u0022 ) )\n\t\t\t\t{\n\t\t\t\t\tpanel.Style.BackgroundColor = InteractiveColor( panel, theme.Accent, theme.AccentHover, theme.AccentPressed );\n\t\t\t\t\tpanel.Style.BorderColor = theme.AccentBorder;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tpanel.Style.BackgroundColor = panel.HasClass( \u0022active\u0022 )\n\t\t\t\t\t\t? theme.PositiveSelected\n\t\t\t\t\t\t: InteractiveColor( panel, theme.Positive, theme.PositiveHover, theme.PositivePressed );\n\t\t\t\t\tpanel.Style.BorderColor = theme.PositiveBorder;\n\t\t\t\t}\n\n\t\t\t\tSetCornerRadius( panel, theme.ButtonCornerRadius );\n\t\t\t}\n\n\t\t\tif ( panel.HasClass( \u0022online-subheading\u0022 ) )\n\t\t\t\tpanel.Style.FontColor = theme.AccentText;\n\n\t\t\tif ( panel.HasClass( \u0022lobby-ready-summary\u0022 ) )\n\t\t\t\tpanel.Style.FontColor = theme.SecondaryText;\n\n\t\t\tif ( panel.HasClass( \u0022setting-value\u0022 ) )\n\t\t\t\tpanel.Style.FontColor = theme.PrimaryText;\n\n\t\t\tif (\n\t\t\t\tpanel.HasClass( \u0022error\u0022 ) ||\n\t\t\t\tpanel.HasClass( \u0022error-copy\u0022 )\n\t\t\t)\n\t\t\t\tpanel.Style.FontColor = theme.ErrorText;\n\t\t}\n\t}\n\n\n\t/// \u003Csummary\u003E\n\t/// Applies OMRTHEME to the developer reference board. Unlike menu/HUD layout\n\t/// styling this method intentionally contains no gameplay geometry; its only\n\t/// job is to expose the theme\u0027s semantic roles in one place.\n\t/// \u003C/summary\u003E\n\tpublic static void ApplyThemePreview( Panel root, OMRUITheme theme )\n\t{\n\t\tif ( root is null || theme is null )\n\t\t\treturn;\n\n\t\troot.Style.FontFamily = theme.BodyFont;\n\t\troot.Style.FontColor = theme.PrimaryText;\n\n\t\tforeach ( Panel panel in Panels( root ) )\n\t\t{\n\t\t\tApplyTextFormatting( panel, theme );\n\t\t\tApplyDisplayTextEffect( panel, theme );\n\n\t\t\tif ( panel.HasClass( \u0022theme-background-sample\u0022 ) )\n\t\t\t{\n\t\t\t\tif ( panel is Image background )\n\t\t\t\t\tbackground.Texture = theme.GetBackgroundImage();\n\t\t\t\tpanel.Style.Opacity = theme.MenuBackgroundOpacity;\n\t\t\t}\n\n\t\t\tif ( panel.HasClass( \u0022theme-logo-sample\u0022 ) )\n\t\t\t{\n\t\t\t\tpanel.Style.Display = theme.HasLogo ? DisplayMode.Flex : DisplayMode.None;\n\t\t\t\tif ( panel is Image logo )\n\t\t\t\t\tlogo.Texture = theme.GetLogoImage();\n\t\t\t}\n\n\t\t\tif ( panel.HasClass( \u0022theme-preview-title\u0022 ) )\n\t\t\t{\n\t\t\t\tpanel.Style.FontFamily = theme.DisplayFont;\n\t\t\t\tpanel.Style.FontColor = theme.OverrideMenuTitleColor ? theme.MenuTitleColor : theme.PrimaryText;\n\t\t\t}\n\t\t\tif ( panel.HasClass( \u0022theme-preview-subtitle\u0022 ) )\n\t\t\t\tpanel.Style.FontColor = theme.OverrideSubtitleColor ? theme.SubtitleColor : theme.SecondaryText;\n\t\t\tif ( panel.HasClass( \u0022theme-preview-heading\u0022 ) )\n\t\t\t{\n\t\t\t\tpanel.Style.FontFamily = theme.DisplayFont;\n\t\t\t\tpanel.Style.FontColor = theme.OverridePageHeadingColor ? theme.PageHeadingColor : theme.PrimaryText;\n\t\t\t}\n\t\t\tif ( panel.HasClass( \u0022theme-preview-body\u0022 ) )\n\t\t\t\tpanel.Style.FontColor = theme.OverridePageCopyColor ? theme.PageCopyColor : theme.SecondaryText;\n\t\t\tif ( panel.HasClass( \u0022theme-preview-meta\u0022 ) )\n\t\t\t\tpanel.Style.FontColor = theme.MutedText;\n\t\t\tif ( panel.HasClass( \u0022theme-preview-number\u0022 ) )\n\t\t\t{\n\t\t\t\tpanel.Style.FontFamily = theme.NumericFont;\n\t\t\t\tpanel.Style.FontColor = theme.PrimaryText;\n\t\t\t}\n\n\t\t\tif ( panel.HasClass( \u0022theme-text-primary\u0022 ) ) panel.Style.FontColor = theme.PrimaryText;\n\t\t\tif ( panel.HasClass( \u0022theme-text-secondary\u0022 ) ) panel.Style.FontColor = theme.SecondaryText;\n\t\t\tif ( panel.HasClass( \u0022theme-text-muted\u0022 ) ) panel.Style.FontColor = theme.MutedText;\n\t\t\tif ( panel.HasClass( \u0022theme-text-accent\u0022 ) ) panel.Style.FontColor = theme.AccentText;\n\t\t\tif ( panel.HasClass( \u0022theme-text-positive\u0022 ) ) panel.Style.FontColor = theme.PositiveText;\n\t\t\tif ( panel.HasClass( \u0022theme-text-danger\u0022 ) ) panel.Style.FontColor = theme.DangerText;\n\t\t\tif ( panel.HasClass( \u0022theme-text-error\u0022 ) ) panel.Style.FontColor = theme.ErrorText;\n\n\t\t\tif ( panel.HasClass( \u0022theme-surface-menu-shell\u0022 ) )\n\t\t\t\tStylePreviewSurface( panel, theme.MenuShellBackground, theme.StrongBorder, theme.MenuShellCornerRadius, theme.PrimaryPanelBackdropBlur );\n\t\t\tif ( panel.HasClass( \u0022theme-surface-soft\u0022 ) )\n\t\t\t\tStylePreviewSurface( panel, theme.SoftPanelBackground, theme.SoftBorder, theme.SoftPanelCornerRadius );\n\t\t\tif ( panel.HasClass( \u0022theme-surface-control\u0022 ) )\n\t\t\t\tStylePreviewSurface( panel, theme.ControlBackground, theme.Border, theme.ControlCornerRadius );\n\t\t\tif ( panel.HasClass( \u0022theme-surface-notice\u0022 ) )\n\t\t\t\tStylePreviewSurface( panel, theme.NoticeBackground, theme.SoftBorder, theme.TagCornerRadius );\n\t\t\tif ( panel.HasClass( \u0022theme-surface-pause\u0022 ) )\n\t\t\t\tStylePreviewSurface( panel, theme.PausePanelBackground, theme.StrongBorder, theme.PanelCornerRadius, theme.PrimaryPanelBackdropBlur );\n\t\t\tif ( panel.HasClass( \u0022theme-surface-hud\u0022 ) )\n\t\t\t\tStylePreviewSurface( panel, theme.HudPanel, theme.SoftBorder, theme.HudCornerRadius, theme.HudBackdropBlur, theme.HudBorderWidth );\n\t\t\tif ( panel.HasClass( \u0022theme-surface-timer\u0022 ) )\n\t\t\t\tStylePreviewSurface( panel, theme.TimerPanel, theme.Border, theme.HudCornerRadius, theme.HudBackdropBlur, theme.HudBorderWidth );\n\t\t\tif ( panel.HasClass( \u0022theme-surface-pot\u0022 ) )\n\t\t\t\tStylePreviewSurface( panel, theme.PotPanel, theme.Border, theme.HudCornerRadius, theme.HudBackdropBlur, theme.HudBorderWidth );\n\t\t\tif ( panel.HasClass( \u0022theme-surface-ammo\u0022 ) )\n\t\t\t\tStylePreviewSurface( panel, theme.AmmoPanel, theme.Border, theme.HudCornerRadius, theme.HudBackdropBlur, theme.HudBorderWidth );\n\t\t\tif ( panel.HasClass( \u0022theme-surface-decision\u0022 ) )\n\t\t\t\tStylePreviewSurface( panel, theme.DecisionPanelBackground, theme.StrongBorder, theme.PanelCornerRadius, theme.PrimaryPanelBackdropBlur, theme.HudBorderWidth );\n\t\t\tif ( panel.HasClass( \u0022theme-surface-sandbox\u0022 ) )\n\t\t\t\tStylePreviewSurface( panel, theme.SandboxLabel, theme.Border, theme.HudCornerRadius, theme.HudBackdropBlur, theme.HudBorderWidth );\n\t\t\tif ( panel.HasClass( \u0022theme-surface-warmup\u0022 ) )\n\t\t\t\tStylePreviewSurface( panel, theme.WarmupLabel, theme.AccentBorder, theme.HudCornerRadius, theme.HudBackdropBlur, theme.HudBorderWidth );\n\t\t\tif ( panel.HasClass( \u0022theme-surface-track\u0022 ) )\n\t\t\t\tStylePreviewSurface( panel, theme.HealthTrack, theme.SoftBorder, theme.HealthBarCornerRadius, 0f, theme.HudBorderWidth );\n\t\t\tif ( panel.HasClass( \u0022theme-surface-sudden\u0022 ) )\n\t\t\t\tStylePreviewSurface( panel, theme.SuddenDeath, theme.DangerBorder, theme.HudCornerRadius, theme.HudBackdropBlur, theme.HudBorderWidth );\n\n\t\t\tif ( panel.HasClass( \u0022theme-surface-menu-shell\u0022 ) || panel.HasClass( \u0022theme-surface-pause\u0022 ) || panel.HasClass( \u0022theme-surface-decision\u0022 ) )\n\t\t\t\tApplyPrimaryPanelShadow( panel, theme );\n\t\t\telse if ( panel.HasClass( \u0022theme-surface-hud\u0022 ) || panel.HasClass( \u0022theme-surface-timer\u0022 ) || panel.HasClass( \u0022theme-surface-pot\u0022 ) || panel.HasClass( \u0022theme-surface-ammo\u0022 ) || panel.HasClass( \u0022theme-surface-sandbox\u0022 ) || panel.HasClass( \u0022theme-surface-warmup\u0022 ) || panel.HasClass( \u0022theme-surface-sudden\u0022 ) )\n\t\t\t\tApplyHudPanelShadow( panel, theme );\n\n\t\t\tif ( panel.HasClass( \u0022theme-overlay-menu-canvas\u0022 ) ) panel.Style.BackgroundColor = theme.MenuCanvasColor;\n\t\t\tif ( panel.HasClass( \u0022theme-overlay-menu\u0022 ) ) panel.Style.BackgroundColor = theme.ScreenOverlay;\n\t\t\tif ( panel.HasClass( \u0022theme-overlay-pause\u0022 ) ) panel.Style.BackgroundColor = theme.PauseOverlay;\n\t\t\tif ( panel.HasClass( \u0022theme-overlay-decision\u0022 ) ) panel.Style.BackgroundColor = theme.DecisionOverlay;\n\n\t\t\tif ( panel.HasClass( \u0022theme-health-local\u0022 ) )\n\t\t\t{\n\t\t\t\tpanel.Style.BackgroundColor = theme.LocalHealth;\n\t\t\t\tSetCornerRadius( panel, theme.HealthBarCornerRadius );\n\t\t\t}\n\t\t\tif ( panel.HasClass( \u0022theme-health-opponent\u0022 ) )\n\t\t\t{\n\t\t\t\tpanel.Style.BackgroundColor = theme.OpponentHealth;\n\t\t\t\tSetCornerRadius( panel, theme.HealthBarCornerRadius );\n\t\t\t}\n\n\t\t\tif ( panel.HasClass( \u0022theme-border-primary\u0022 ) ) panel.Style.BorderColor = theme.Border;\n\t\t\tif ( panel.HasClass( \u0022theme-border-soft\u0022 ) ) panel.Style.BorderColor = theme.SoftBorder;\n\t\t\tif ( panel.HasClass( \u0022theme-border-strong\u0022 ) ) panel.Style.BorderColor = theme.StrongBorder;\n\t\t\tif ( panel.HasClass( \u0022theme-border-accent\u0022 ) ) panel.Style.BorderColor = theme.AccentBorder;\n\t\t\tif ( panel.HasClass( \u0022theme-border-positive\u0022 ) ) panel.Style.BorderColor = theme.PositiveBorder;\n\t\t\tif ( panel.HasClass( \u0022theme-border-danger\u0022 ) ) panel.Style.BorderColor = theme.DangerBorder;\n\t\t\tif ( panel.HasClass( \u0022theme-border-sample\u0022 ) )\n\t\t\t{\n\t\t\t\tpanel.Style.BorderWidth = Length.Pixels( Math.Max( 1f, theme.HudBorderWidth ) );\n\t\t\t\tSetCornerRadius( panel, theme.ControlCornerRadius );\n\t\t\t}\n\n\t\t\tif ( panel.HasClass( \u0022theme-interactive-neutral-normal\u0022 ) ) panel.Style.BackgroundColor = theme.Button;\n\t\t\tif ( panel.HasClass( \u0022theme-interactive-neutral-hover\u0022 ) ) panel.Style.BackgroundColor = theme.ButtonHover;\n\t\t\tif ( panel.HasClass( \u0022theme-interactive-neutral-pressed\u0022 ) ) panel.Style.BackgroundColor = theme.ButtonPressed;\n\t\t\tif ( panel.HasClass( \u0022theme-interactive-accent-normal\u0022 ) ) panel.Style.BackgroundColor = theme.Accent;\n\t\t\tif ( panel.HasClass( \u0022theme-interactive-accent-hover\u0022 ) ) panel.Style.BackgroundColor = theme.AccentHover;\n\t\t\tif ( panel.HasClass( \u0022theme-interactive-accent-pressed\u0022 ) ) panel.Style.BackgroundColor = theme.AccentPressed;\n\t\t\tif ( panel.HasClass( \u0022theme-interactive-accent-selected\u0022 ) ) panel.Style.BackgroundColor = theme.AccentSelected;\n\t\t\tif ( panel.HasClass( \u0022theme-interactive-accent-soft\u0022 ) ) panel.Style.BackgroundColor = theme.AccentSoft;\n\t\t\tif ( panel.HasClass( \u0022theme-interactive-positive-normal\u0022 ) ) panel.Style.BackgroundColor = theme.Positive;\n\t\t\tif ( panel.HasClass( \u0022theme-interactive-positive-hover\u0022 ) ) panel.Style.BackgroundColor = theme.PositiveHover;\n\t\t\tif ( panel.HasClass( \u0022theme-interactive-positive-pressed\u0022 ) ) panel.Style.BackgroundColor = theme.PositivePressed;\n\t\t\tif ( panel.HasClass( \u0022theme-interactive-positive-selected\u0022 ) ) panel.Style.BackgroundColor = theme.PositiveSelected;\n\t\t\tif ( panel.HasClass( \u0022theme-interactive-positive-soft\u0022 ) ) panel.Style.BackgroundColor = theme.PositiveSoft;\n\t\t\tif ( panel.HasClass( \u0022theme-interactive-danger-normal\u0022 ) ) panel.Style.BackgroundColor = theme.Danger;\n\t\t\tif ( panel.HasClass( \u0022theme-interactive-danger-hover\u0022 ) ) panel.Style.BackgroundColor = theme.DangerHover;\n\t\t\tif ( panel.HasClass( \u0022theme-interactive-danger-pressed\u0022 ) ) panel.Style.BackgroundColor = theme.DangerPressed;\n\t\t\tif ( panel.HasClass( \u0022theme-interactive-danger-soft\u0022 ) ) panel.Style.BackgroundColor = theme.DangerSoft;\n\n\t\t\tif ( panel.HasClass( \u0022theme-interactive-chip\u0022 ) )\n\t\t\t{\n\t\t\t\tpanel.Style.BorderColor = theme.SoftBorder;\n\t\t\t\tpanel.Style.BorderWidth = Length.Pixels( theme.HudBorderWidth );\n\t\t\t\tSetCornerRadius( panel, theme.ButtonCornerRadius );\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic static void ApplyPause(\n\t\tPanel root,\n\t\tOMRUITheme theme,\n\t\tOMRMainMenuLayout layout\n\t)\n\t{\n\t\tif ( root is null || theme is null || layout is null )\n\t\t\treturn;\n\n\t\troot.Style.FontFamily = theme.BodyFont;\n\t\troot.Style.FontColor = theme.PrimaryText;\n\n\t\tforeach ( Panel panel in Panels( root ) )\n\t\t{\n\t\t\tApplyTextFormatting( panel, theme );\n\t\t\tApplyDisplayTextEffect( panel, theme );\n\t\t\tif ( panel.HasClass( \u0022pause-screen-overlay\u0022 ) )\n\t\t\t{\n\t\t\t\tpanel.Style.BackgroundColor = theme.PauseOverlay;\n\t\t\t\tpanel.Style.Opacity = layout.ShowPauseOverlay ? layout.PauseOverlayOpacity : 0f;\n\t\t\t}\n\n\t\t\tif ( panel.HasClass( \u0022pause-panel\u0022 ) )\n\t\t\t{\n\t\t\t\tpanel.Style.Width = Length.Pixels( layout.PauseWidth );\n\t\t\t\tSetPadding( panel, layout.PausePadding );\n\t\t\t\tpanel.Style.Left = Length.Pixels( layout.PauseOffsetX );\n\t\t\t\tpanel.Style.Top = Length.Pixels( layout.PauseOffsetY );\n\t\t\t}\n\n\t\t\tif ( panel.HasClass( \u0022pause-panel-chrome\u0022 ) )\n\t\t\t{\n\t\t\t\tpanel.Style.BackgroundColor = theme.PausePanelBackground;\n\t\t\t\tpanel.Style.BorderColor = theme.StrongBorder;\n\t\t\t\tpanel.Style.BorderWidth = Length.Pixels( layout.BorderWidth );\n\t\t\t\tpanel.Style.Opacity = layout.ShowPauseChrome ? layout.PauseChromeOpacity : 0f;\n\t\t\t\tSetCornerRadius( panel, theme.PanelCornerRadius );\n\t\t\t\tApplyBackdropBlur( panel, theme.PrimaryPanelBackdropBlur );\n\t\t\t\tApplyPrimaryPanelShadow( panel, theme );\n\t\t\t}\n\n\t\t\tif ( panel.HasClass( \u0022pause-title\u0022 ) )\n\t\t\t{\n\t\t\t\tpanel.Style.FontFamily = theme.DisplayFont;\n\t\t\t\tpanel.Style.FontSize = Length.Pixels( layout.PauseTitleSize );\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\tpanel.HasClass( \u0022pause-note\u0022 ) ||\n\t\t\t\tpanel.HasClass( \u0022pause-button-copy\u0022 ) ||\n\t\t\t\tpanel.HasClass( \u0022pause-summary\u0022 ) ||\n\t\t\t\tpanel.HasClass( \u0022setting-description\u0022 )\n\t\t\t)\n\t\t\t\tpanel.Style.FontColor = theme.SecondaryText;\n\n\t\t\tif ( panel.HasClass( \u0022pause-eyebrow\u0022 ) )\n\t\t\t\tpanel.Style.FontColor = theme.AccentText;\n\n\t\t\tif ( panel.HasClass( \u0022setting-value\u0022 ) )\n\t\t\t\tpanel.Style.FontColor = theme.PrimaryText;\n\n\t\t\tif ( panel.HasClass( \u0022pause-button\u0022 ) )\n\t\t\t{\n\t\t\t\tpanel.Style.MinHeight = Length.Pixels( layout.PauseButtonHeight );\n\t\t\t\tpanel.Style.BorderColor = theme.Border;\n\t\t\t\tpanel.Style.BorderWidth = Length.Pixels( layout.BorderWidth );\n\n\t\t\t\tif ( panel.HasClass( \u0022primary\u0022 ) )\n\t\t\t\t{\n\t\t\t\t\tpanel.Style.BackgroundColor = InteractiveColor( panel, theme.Positive, theme.PositiveHover, theme.PositivePressed );\n\t\t\t\t\tpanel.Style.BorderColor = theme.PositiveBorder;\n\t\t\t\t}\n\t\t\t\telse if ( panel.HasClass( \u0022danger\u0022 ) )\n\t\t\t\t{\n\t\t\t\t\tpanel.Style.BackgroundColor = InteractiveColor( panel, theme.Danger, theme.DangerHover, theme.DangerPressed );\n\t\t\t\t\tpanel.Style.BorderColor = theme.DangerBorder;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tpanel.Style.BackgroundColor = InteractiveColor( panel, theme.Button, theme.ButtonHover, theme.ButtonPressed );\n\t\t\t\t}\n\n\t\t\t\tSetCornerRadius( panel, theme.ButtonCornerRadius );\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\tpanel.HasClass( \u0022pause-settings-back\u0022 ) ||\n\t\t\t\tpanel.HasClass( \u0022setting-step\u0022 ) ||\n\t\t\t\tpanel.HasClass( \u0022setting-cycle\u0022 ) ||\n\t\t\t\tpanel.HasClass( \u0022settings-reset\u0022 )\n\t\t\t)\n\t\t\t{\n\t\t\t\tpanel.Style.BackgroundColor = InteractiveColor( panel, theme.Button, theme.ButtonHover, theme.ButtonPressed );\n\t\t\t\tpanel.Style.BorderColor = theme.Border;\n\t\t\t\tSetCornerRadius( panel, theme.ControlCornerRadius );\n\t\t\t}\n\n\t\t\tif ( panel.HasClass( \u0022setting-row\u0022 ) )\n\t\t\t{\n\t\t\t\tpanel.Style.MinHeight = Length.Pixels( layout.SettingRowHeight );\n\t\t\t\tpanel.Style.BackgroundColor = theme.SoftPanelBackground;\n\t\t\t\tpanel.Style.BorderColor = theme.SoftBorder;\n\t\t\t\tSetCornerRadius( panel, theme.SoftPanelCornerRadius );\n\t\t\t}\n\n\t\t\tif ( panel.HasClass( \u0022setting-control\u0022 ) )\n\t\t\t{\n\t\t\t\tpanel.Style.BackgroundColor = theme.ControlBackground;\n\t\t\t\tpanel.Style.BorderColor = theme.Border;\n\t\t\t\tSetCornerRadius( panel, theme.ControlCornerRadius );\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic static void ApplyHud(\n\t\tPanel root,\n\t\tOMRUITheme theme,\n\t\tOMRHUDLayout layout\n\t)\n\t{\n\t\tif ( root is null || theme is null || layout is null )\n\t\t\treturn;\n\n\t\troot.Style.FontFamily = theme.BodyFont;\n\t\troot.Style.FontColor = theme.PrimaryText;\n\n\t\tforeach ( Panel panel in Panels( root ) )\n\t\t{\n\t\t\tApplyTextFormatting( panel, theme );\n\t\t\tApplyDisplayTextEffect( panel, theme );\n\n\t\t\t// ------------------------------------------------------------\n\t\t\t// HEALTH\n\t\t\t// ------------------------------------------------------------\n\t\t\tif ( panel.HasClass( \u0022combat-health\u0022 ) )\n\t\t\t{\n\t\t\t\tpanel.Style.Top = Length.Pixels( layout.HealthTop );\n\t\t\t\tpanel.Style.Left = Length.Pixels( layout.HealthHorizontalInset );\n\t\t\t\tpanel.Style.Right = Length.Pixels( layout.HealthHorizontalInset );\n\t\t\t\tpanel.Style.Display = layout.ShowLocalHealth || layout.ShowOpponentHealth\n\t\t\t\t\t? DisplayMode.Flex : DisplayMode.None;\n\t\t\t}\n\n\t\t\tif ( panel.HasClass( \u0022health-side\u0022 ) )\n\t\t\t{\n\t\t\t\tbool opponent = panel.HasClass( \u0022opponent\u0022 );\n\t\t\t\tpanel.Style.Width = Length.Percent( layout.HealthSideWidthPercent );\n\t\t\t\tpanel.Style.MaxWidth = Length.Pixels( layout.HealthMaximumWidth );\n\t\t\t\tpanel.Style.Display = opponent\n\t\t\t\t\t? (layout.ShowOpponentHealth ? DisplayMode.Flex : DisplayMode.None)\n\t\t\t\t\t: (layout.ShowLocalHealth ? DisplayMode.Flex : DisplayMode.None);\n\t\t\t\tpanel.Style.Left = Length.Pixels( opponent ? layout.OpponentHealthOffsetX : layout.LocalHealthOffsetX );\n\t\t\t\tpanel.Style.Top = Length.Pixels( opponent ? layout.OpponentHealthOffsetY : layout.LocalHealthOffsetY );\n\t\t\t\tpanel.Style.Opacity = opponent ? layout.OpponentHealthOpacity : layout.LocalHealthOpacity;\n\t\t\t}\n\n\t\t\tif ( panel.HasClass( \u0022health-heading\u0022 ) )\n\t\t\t{\n\t\t\t\tbool opponent = panel.Ancestors.Any( x =\u003E x.HasClass( \u0022health-side\u0022 ) \u0026\u0026 x.HasClass( \u0022opponent\u0022 ) );\n\t\t\t\tOMRHUDPairAlignment headingAlignment = opponent\n\t\t\t\t\t? layout.OpponentHealthHeadingAlignment\n\t\t\t\t\t: layout.LocalHealthHeadingAlignment;\n\t\t\t\tfloat headingGap = opponent\n\t\t\t\t\t? layout.OpponentHealthHeadingGap\n\t\t\t\t\t: layout.LocalHealthHeadingGap;\n\n\t\t\t\tpanel.Style.MarginBottom = Length.Pixels( layout.HealthHeadingBottomSpacing );\n\t\t\t\t// SpaceBetween owns spacing in Split mode. A manual gap only has\n\t\t\t\t// meaning when both items are grouped to one side or the center.\n\t\t\t\tpanel.Style.ColumnGap = Length.Pixels(\n\t\t\t\t\theadingAlignment == OMRHUDPairAlignment.Split ? 0f : headingGap\n\t\t\t\t);\n\t\t\t\tpanel.Style.FlexDirection = opponent ? FlexDirection.RowReverse : FlexDirection.Row;\n\t\t\t\tApplyPairAlignment( panel, headingAlignment );\n\t\t\t}\n\n\t\t\tif ( panel.HasClass( \u0022health-label\u0022 ) )\n\t\t\t{\n\t\t\t\tpanel.Style.Display = layout.ShowHealthLabels ? DisplayMode.Flex : DisplayMode.None;\n\t\t\t\tpanel.Style.FontSize = Length.Pixels( layout.HealthLabelSize );\n\t\t\t\tpanel.Style.FontColor = theme.SecondaryText;\n\t\t\t}\n\n\t\t\tif ( panel.HasClass( \u0022health-number\u0022 ) )\n\t\t\t{\n\t\t\t\tbool opponent = panel.Ancestors.Any( x =\u003E x.HasClass( \u0022health-side\u0022 ) \u0026\u0026 x.HasClass( \u0022opponent\u0022 ) );\n\t\t\t\tpanel.Style.Display = layout.ShowHealthNumbers ? DisplayMode.Flex : DisplayMode.None;\n\t\t\t\tpanel.Style.FontFamily = theme.NumericFont;\n\t\t\t\tpanel.Style.FontSize = Length.Pixels( layout.HealthNumberSize );\n\t\t\t\tpanel.Style.FontColor = opponent\n\t\t\t\t\t? (theme.OverrideOpponentHealthTextColor ? theme.OpponentHealthTextColor : theme.PrimaryText)\n\t\t\t\t\t: (theme.OverrideLocalHealthTextColor ? theme.LocalHealthTextColor : theme.PrimaryText);\n\t\t\t}\n\n\t\t\tif ( panel.HasClass( \u0022health-track\u0022 ) )\n\t\t\t{\n\t\t\t\tpanel.Style.Display = layout.ShowHealthBars ? DisplayMode.Flex : DisplayMode.None;\n\t\t\t\tpanel.Style.Height = Length.Pixels( layout.HealthBarHeight );\n\t\t\t\tpanel.Style.BackgroundColor = Color.Transparent;\n\t\t\t\tpanel.Style.BorderWidth = Length.Pixels( 0f );\n\t\t\t\tSetCornerRadius( panel, theme.HealthBarCornerRadius );\n\t\t\t}\n\n\t\t\tif ( panel.HasClass( \u0022health-track-chrome\u0022 ) )\n\t\t\t{\n\t\t\t\tpanel.Style.BackgroundColor = theme.HealthTrack;\n\t\t\t\tpanel.Style.BorderColor = theme.SoftBorder;\n\t\t\t\tpanel.Style.BorderWidth = Length.Pixels( theme.HudBorderWidth );\n\t\t\t\tpanel.Style.Opacity = layout.ShowHealthTrackChrome ? layout.HealthTrackChromeOpacity : 0f;\n\t\t\t\tSetCornerRadius( panel, theme.HealthBarCornerRadius );\n\t\t\t}\n\n\t\t\tif ( panel.HasClass( \u0022health-fill\u0022 ) )\n\t\t\t{\n\t\t\t\tbool opponent = panel.Ancestors.Any( x =\u003E x.HasClass( \u0022health-side\u0022 ) \u0026\u0026 x.HasClass( \u0022opponent\u0022 ) );\n\t\t\t\tOMRHUDFillDirection direction = opponent\n\t\t\t\t\t? layout.OpponentHealthFillDirection\n\t\t\t\t\t: layout.LocalHealthFillDirection;\n\n\t\t\t\tpanel.Style.BackgroundColor = opponent ? theme.OpponentHealth : theme.LocalHealth;\n\t\t\t\tpanel.Style.Opacity = layout.HealthBarOpacity;\n\t\t\t\tpanel.Style.Left = direction == OMRHUDFillDirection.LeftToRight ? Length.Pixels( 0f ) : null;\n\t\t\t\tpanel.Style.Right = direction == OMRHUDFillDirection.RightToLeft ? Length.Pixels( 0f ) : null;\n\t\t\t\tSetCornerRadius( panel, theme.HealthBarCornerRadius );\n\t\t\t}\n\n\t\t\t// ------------------------------------------------------------\n\t\t\t// MATCH HEADER\n\t\t\t// ------------------------------------------------------------\n\t\t\tif ( panel.HasClass( \u0022match-header\u0022 ) )\n\t\t\t{\n\t\t\t\tpanel.Style.Display = layout.ShowMatchHeader ? DisplayMode.Flex : DisplayMode.None;\n\t\t\t\tpanel.Style.Top = Length.Pixels( layout.MatchHeaderTop \u002B layout.MatchHeaderOffsetY );\n\t\t\t\tpanel.Style.Left = Length.Pixels( layout.MatchHeaderHorizontalInset \u002B layout.MatchHeaderOffsetX );\n\t\t\t\tpanel.Style.Right = Length.Pixels( layout.MatchHeaderHorizontalInset - layout.MatchHeaderOffsetX );\n\t\t\t\tpanel.Style.Width = Length.Auto;\n\t\t\t\tpanel.Style.Opacity = layout.MatchHeaderOpacity;\n\t\t\t\tpanel.Style.RowGap = Length.Pixels( layout.MatchHeaderElementGap );\n\t\t\t\tApplyHorizontalContainerAlignment( panel, layout.MatchHeaderAlignment );\n\t\t\t}\n\n\t\t\tif ( panel.HasClass( \u0022round\u0022 ) )\n\t\t\t{\n\t\t\t\tpanel.Style.Display = layout.ShowRoundTitle ? DisplayMode.Flex : DisplayMode.None;\n\t\t\t\tpanel.Style.Top = Length.Pixels( layout.RoundTitleOffsetY );\n\t\t\t\tpanel.Style.MarginBottom = Length.Pixels( 0f );\n\t\t\t\tpanel.Style.Opacity = layout.RoundTitleOpacity;\n\t\t\t\tpanel.Style.FontFamily = theme.DisplayFont;\n\t\t\t\tpanel.Style.FontSize = Length.Pixels( layout.RoundTitleSize );\n\t\t\t\tpanel.Style.FontColor = theme.OverrideRoundTextColor ? theme.RoundTextColor : theme.PrimaryText;\n\t\t\t\tApplyTextLayout( panel, layout.MatchHeaderAlignment, 0f );\n\t\t\t}\n\n\t\t\tif ( panel.HasClass( \u0022round-timer\u0022 ) )\n\t\t\t{\n\t\t\t\tpanel.Style.Display = layout.ShowTimer ? DisplayMode.Flex : DisplayMode.None;\n\t\t\t\tpanel.Style.Top = Length.Pixels( layout.TimerOffsetY );\n\t\t\t\tpanel.Style.MarginBottom = Length.Pixels( 0f );\n\t\t\t\tpanel.Style.MinWidth = Length.Pixels( layout.TimerMinimumWidth );\n\t\t\t\tpanel.Style.PaddingLeft = Length.Pixels( layout.TimerPaddingX );\n\t\t\t\tpanel.Style.PaddingRight = Length.Pixels( layout.TimerPaddingX );\n\t\t\t\tpanel.Style.PaddingTop = Length.Pixels( layout.TimerPaddingY );\n\t\t\t\tpanel.Style.PaddingBottom = Length.Pixels( layout.TimerPaddingY );\n\t\t\t}\n\n\t\t\tif ( panel.HasClass( \u0022round-timer-chrome\u0022 ) )\n\t\t\t{\n\t\t\t\tbool sudden = panel.Ancestors.Any( x =\u003E x.HasClass( \u0022round-timer\u0022 ) \u0026\u0026 x.HasClass( \u0022sudden\u0022 ) );\n\t\t\t\tpanel.Style.BackgroundColor = sudden ? theme.SuddenDeath : theme.TimerPanel;\n\t\t\t\tpanel.Style.BorderColor = sudden ? theme.DangerBorder : theme.Border;\n\t\t\t\tpanel.Style.BorderWidth = Length.Pixels( theme.HudBorderWidth );\n\t\t\t\tpanel.Style.Opacity = layout.ShowTimerChrome ? layout.TimerChromeOpacity : 0f;\n\t\t\t\tSetCornerRadius( panel, theme.HudCornerRadius );\n\t\t\t\tApplyBackdropBlur( panel, theme.HudBackdropBlur );\n\t\t\t\tApplyHudPanelShadow( panel, theme );\n\t\t\t}\n\n\t\t\tif ( panel.HasClass( \u0022timer-number\u0022 ) )\n\t\t\t{\n\t\t\t\tbool sudden = panel.Ancestors.Any( x =\u003E x.HasClass( \u0022round-timer\u0022 ) \u0026\u0026 x.HasClass( \u0022sudden\u0022 ) );\n\t\t\t\tpanel.Style.FontFamily = theme.NumericFont;\n\t\t\t\tpanel.Style.FontColor = sudden\n\t\t\t\t\t? (theme.OverrideSuddenDeathTextColor ? theme.SuddenDeathTextColor : theme.PrimaryText)\n\t\t\t\t\t: (theme.OverrideTimerTextColor ? theme.TimerTextColor : theme.PrimaryText);\n\t\t\t\tpanel.Style.FontSize = Length.Pixels( sudden ? layout.SuddenDeathTimerSize : layout.TimerSize );\n\t\t\t}\n\n\t\t\tif ( panel.HasClass( \u0022timer-mode\u0022 ) )\n\t\t\t{\n\t\t\t\tpanel.Style.Display = layout.ShowTimerMode ? DisplayMode.Flex : DisplayMode.None;\n\t\t\t\tpanel.Style.FontSize = Length.Pixels( layout.TimerMetaSize );\n\t\t\t}\n\n\t\t\tif ( panel.HasClass( \u0022timer-note\u0022 ) )\n\t\t\t{\n\t\t\t\tpanel.Style.Display = layout.ShowTimerNote ? DisplayMode.Flex : DisplayMode.None;\n\t\t\t\tpanel.Style.FontSize = Length.Pixels( layout.TimerMetaSize );\n\t\t\t}\n\n\t\t\tif ( panel.HasClass( \u0022score-label\u0022 ) )\n\t\t\t{\n\t\t\t\tpanel.Style.Display = layout.ShowScore \u0026\u0026 layout.ShowScoreHeading ? DisplayMode.Flex : DisplayMode.None;\n\t\t\t\tpanel.Style.FontSize = Length.Pixels( layout.ScoreHeadingSize );\n\t\t\t\tpanel.Style.MarginBottom = Length.Pixels( 0f );\n\t\t\t\tApplyTextLayout( panel, layout.MatchHeaderAlignment, 0f );\n\t\t\t}\n\n\t\t\tif ( panel.HasClass( \u0022score\u0022 ) )\n\t\t\t{\n\t\t\t\tpanel.Style.Display = layout.ShowScore ? DisplayMode.Flex : DisplayMode.None;\n\t\t\t\tpanel.Style.Top = Length.Pixels( layout.ScoreOffsetY );\n\t\t\t\tpanel.Style.ColumnGap = Length.Pixels( layout.ScoreColumnGap );\n\t\t\t}\n\n\t\t\tif ( panel.HasClass( \u0022score-number\u0022 ) )\n\t\t\t{\n\t\t\t\tpanel.Style.FontFamily = theme.NumericFont;\n\t\t\t\tpanel.Style.FontColor = theme.OverrideScoreTextColor ? theme.ScoreTextColor : theme.PrimaryText;\n\t\t\t\tpanel.Style.FontSize = Length.Pixels( layout.ScoreNumberSize );\n\t\t\t}\n\n\t\t\tif ( panel.HasClass( \u0022score-player-label\u0022 ) )\n\t\t\t{\n\t\t\t\tpanel.Style.Display = layout.ShowScorePlayerLabels ? DisplayMode.Flex : DisplayMode.None;\n\t\t\t\tpanel.Style.FontSize = Length.Pixels( layout.ScoreLabelSize );\n\t\t\t\tpanel.Style.FontColor = theme.SecondaryText;\n\t\t\t}\n\n\t\t\tif ( panel.HasClass( \u0022separator\u0022 ) )\n\t\t\t{\n\t\t\t\tpanel.Style.Display = layout.ShowScoreSeparator ? DisplayMode.Flex : DisplayMode.None;\n\t\t\t\tpanel.Style.FontSize = Length.Pixels( layout.ScoreSeparatorSize );\n\t\t\t\tpanel.Style.FontColor = theme.MutedText;\n\t\t\t}\n\n\t\t\tif ( panel.HasClass( \u0022pot-display\u0022 ) )\n\t\t\t{\n\t\t\t\tpanel.Style.Display = layout.ShowPot ? DisplayMode.Flex : DisplayMode.None;\n\t\t\t\tpanel.Style.MarginTop = Length.Pixels( 0f );\n\t\t\t\tpanel.Style.PaddingLeft = Length.Pixels( layout.PotPaddingX );\n\t\t\t\tpanel.Style.PaddingRight = Length.Pixels( layout.PotPaddingX );\n\t\t\t\tpanel.Style.PaddingTop = Length.Pixels( layout.PotPaddingY );\n\t\t\t\tpanel.Style.PaddingBottom = Length.Pixels( layout.PotPaddingY );\n\t\t\t\tpanel.Style.ColumnGap = Length.Pixels( layout.PotGap );\n\t\t\t\tpanel.Style.BackgroundColor = Color.Transparent;\n\t\t\t\tpanel.Style.BorderWidth = Length.Pixels( 0f );\n\t\t\t}\n\n\t\t\tif ( panel.HasClass( \u0022pot-display-chrome\u0022 ) )\n\t\t\t{\n\t\t\t\tpanel.Style.BackgroundColor = theme.PotPanel;\n\t\t\t\tpanel.Style.BorderColor = theme.Border;\n\t\t\t\tpanel.Style.BorderWidth = Length.Pixels( theme.HudBorderWidth );\n\t\t\t\tpanel.Style.Opacity = layout.ShowPotChrome ? layout.PotChromeOpacity : 0f;\n\t\t\t\tSetCornerRadius( panel, theme.HudCornerRadius );\n\t\t\t\tApplyBackdropBlur( panel, theme.HudBackdropBlur );\n\t\t\t\tApplyHudPanelShadow( panel, theme );\n\t\t\t}\n\n\t\t\tif ( panel.HasClass( \u0022pot-owner\u0022 ) )\n\t\t\t{\n\t\t\t\tpanel.Style.FontSize = Length.Pixels( layout.PotOwnerSize );\n\t\t\t\tpanel.Style.Opacity = layout.PotOpacity;\n\t\t\t\tpanel.Style.FontColor = theme.SecondaryText;\n\t\t\t}\n\n\t\t\tif ( panel.HasClass( \u0022pot-value\u0022 ) )\n\t\t\t{\n\t\t\t\tpanel.Style.FontSize = Length.Pixels( layout.PotValueSize );\n\t\t\t\tpanel.Style.Opacity = layout.PotOpacity;\n\t\t\t\tpanel.Style.FontColor = theme.OverridePotTextColor ? theme.PotTextColor : theme.PrimaryText;\n\t\t\t}\n\n\t\t\tif ( panel.HasClass( \u0022modifier-label\u0022 ) )\n\t\t\t{\n\t\t\t\tpanel.Style.Display = layout.ShowModifierLabel ? DisplayMode.Flex : DisplayMode.None;\n\t\t\t\tpanel.Style.MarginTop = Length.Pixels( 0f );\n\t\t\t\tpanel.Style.FontSize = Length.Pixels( layout.ModifierLabelSize );\n\t\t\t\tpanel.Style.Opacity = layout.ModifierLabelOpacity;\n\t\t\t\tpanel.Style.FontColor = theme.OverrideModifierTextColor ? theme.ModifierTextColor : theme.AccentText;\n\t\t\t\tApplyTextLayout( panel, layout.MatchHeaderAlignment, 0f );\n\t\t\t}\n\n\t\t\t// ------------------------------------------------------------\n\t\t\t// CENTER MESSAGE\n\t\t\t// ------------------------------------------------------------\n\t\t\tif ( panel.HasClass( \u0022center-message\u0022 ) )\n\t\t\t{\n\t\t\t\tpanel.Style.Display = layout.ShowCenterMessage ? DisplayMode.Flex : DisplayMode.None;\n\t\t\t\tpanel.Style.Top = Length.Percent( layout.CenterMessageTopPercent );\n\t\t\t\tpanel.Style.Left = Length.Pixels( 0f );\n\t\t\t\tpanel.Style.MarginTop = Length.Pixels( layout.CenterMessageOffsetY );\n\t\t\t\tpanel.Style.Opacity = layout.CenterMessageOpacity;\n\t\t\t\tpanel.Style.FontFamily = theme.DisplayFont;\n\t\t\t\tpanel.Style.FontSize = Length.Pixels( layout.CenterMessageSize );\n\t\t\t\tpanel.Style.FontColor = theme.OverrideCenterMessageColor ? theme.CenterMessageColor : theme.PrimaryText;\n\t\t\t\tPanelTransform messageTransform = new();\n\t\t\t\tmessageTransform.AddTranslate( Length.Pixels( layout.CenterMessageOffsetX ), Length.Pixels( 0f ), null );\n\t\t\t\tpanel.Style.Transform = messageTransform;\n\t\t\t\tApplyTextLayout( panel, layout.CenterMessageAlignment, layout.CenterMessageIndent );\n\t\t\t}\n\n\t\t\t// ------------------------------------------------------------\n\t\t\t// DECISIONS\n\t\t\t// ------------------------------------------------------------\n\t\t\tif ( panel.HasClass( \u0022decision-screen-overlay\u0022 ) )\n\t\t\t{\n\t\t\t\tpanel.Style.BackgroundColor = theme.DecisionOverlay;\n\t\t\t\tpanel.Style.Opacity = layout.ShowDecisionOverlay ? layout.DecisionScreenOpacity : 0f;\n\t\t\t}\n\n\t\t\tif ( panel.HasClass( \u0022decision-panel\u0022 ) )\n\t\t\t{\n\t\t\t\tpanel.Style.Width = Length.Pixels( layout.DecisionPanelWidth );\n\t\t\t\tSetPadding( panel, layout.DecisionPanelPadding );\n\t\t\t\tpanel.Style.MarginLeft = Length.Pixels( 0f );\n\t\t\t\tpanel.Style.MarginTop = Length.Pixels( 0f );\n\t\t\t\tpanel.Style.Left = Length.Pixels( layout.DecisionOffsetX );\n\t\t\t\tpanel.Style.Top = Length.Pixels( layout.DecisionOffsetY );\n\t\t\t\tApplyHorizontalContainerAlignment( panel, layout.DecisionContentAlignment );\n\t\t\t}\n\n\t\t\tif ( panel.HasClass( \u0022decision-panel-chrome\u0022 ) )\n\t\t\t{\n\t\t\t\tpanel.Style.BackgroundColor = theme.DecisionPanelBackground;\n\t\t\t\tpanel.Style.BorderColor = theme.StrongBorder;\n\t\t\t\tpanel.Style.BorderWidth = Length.Pixels( theme.HudBorderWidth );\n\t\t\t\tpanel.Style.Opacity = layout.ShowDecisionChrome ? layout.DecisionChromeOpacity : 0f;\n\t\t\t\tSetCornerRadius( panel, theme.PanelCornerRadius );\n\t\t\t\tApplyBackdropBlur( panel, theme.PrimaryPanelBackdropBlur );\n\t\t\t\tApplyPrimaryPanelShadow( panel, theme );\n\t\t\t}\n\n\t\t\tif ( panel.HasClass( \u0022decision-eyebrow\u0022 ) )\n\t\t\t{\n\t\t\t\tpanel.Style.Display = layout.ShowDecisionEyebrow ? DisplayMode.Flex : DisplayMode.None;\n\t\t\t\tpanel.Style.FontSize = Length.Pixels( layout.DecisionEyebrowSize );\n\t\t\t\tpanel.Style.FontColor = theme.AccentText;\n\t\t\t\tApplyTextLayout( panel, layout.DecisionContentAlignment, layout.DecisionTextIndent );\n\t\t\t}\n\n\t\t\tif ( panel.HasClass( \u0022decision-title\u0022 ) )\n\t\t\t{\n\t\t\t\tpanel.Style.FontFamily = theme.DisplayFont;\n\t\t\t\tpanel.Style.FontSize = Length.Pixels( layout.DecisionTitleSize );\n\t\t\t\tpanel.Style.FontColor = theme.OverrideDecisionTitleColor ? theme.DecisionTitleColor : theme.PrimaryText;\n\t\t\t\tApplyTextLayout( panel, layout.DecisionContentAlignment, layout.DecisionTextIndent );\n\t\t\t}\n\n\t\t\tif ( panel.HasClass( \u0022decision-pot\u0022 ) )\n\t\t\t{\n\t\t\t\tpanel.Style.Display = layout.ShowDecisionPot ? DisplayMode.Flex : DisplayMode.None;\n\t\t\t\tpanel.Style.FontSize = Length.Pixels( layout.DecisionPotSize );\n\t\t\t\tApplyTextLayout( panel, layout.DecisionContentAlignment, layout.DecisionTextIndent );\n\t\t\t}\n\n\t\t\tif ( panel.HasClass( \u0022decision-timer\u0022 ) )\n\t\t\t{\n\t\t\t\tpanel.Style.Display = layout.ShowDecisionTimer ? DisplayMode.Flex : DisplayMode.None;\n\t\t\t\tpanel.Style.FontFamily = theme.NumericFont;\n\t\t\t\tpanel.Style.FontSize = Length.Pixels( layout.DecisionTimerSize );\n\t\t\t\tApplyTextLayout( panel, layout.DecisionContentAlignment, layout.DecisionTextIndent );\n\t\t\t}\n\n\t\t\tif ( panel.HasClass( \u0022final-score\u0022 ) )\n\t\t\t{\n\t\t\t\tpanel.Style.Display = layout.ShowDecisionFinalScore ? DisplayMode.Flex : DisplayMode.None;\n\t\t\t\tpanel.Style.FontFamily = theme.NumericFont;\n\t\t\t\tpanel.Style.FontSize = Length.Pixels( layout.DecisionFinalScoreSize );\n\t\t\t\tApplyTextLayout( panel, layout.DecisionContentAlignment, layout.DecisionTextIndent );\n\t\t\t}\n\n\t\t\tif ( panel.HasClass( \u0022decision-buttons\u0022 ) )\n\t\t\t\tpanel.Style.ColumnGap = Length.Pixels( layout.DecisionButtonGap );\n\n\t\t\tif ( panel.HasClass( \u0022decision-button\u0022 ) )\n\t\t\t{\n\t\t\t\tpanel.Style.MinHeight = Length.Pixels( layout.DecisionButtonHeight );\n\t\t\t\tSetPadding( panel, layout.DecisionButtonPadding );\n\t\t\t\tpanel.Style.TransformOriginX = Length.Percent( 50f );\n\t\t\t\tpanel.Style.TransformOriginY = Length.Percent( 50f );\n\n\t\t\t\tfloat scale = 1f;\n\t\t\t\tfloat hoverX = 0f;\n\t\t\t\tfloat hoverY = 0f;\n\t\t\t\tif ( panel.HasHovered )\n\t\t\t\t{\n\t\t\t\t\tscale = Math.Clamp( layout.DecisionButtonHoverScalePercent, 100f, 120f ) / 100f;\n\t\t\t\t\thoverX = layout.DecisionButtonHoverOffsetX;\n\t\t\t\t\thoverY = layout.DecisionButtonHoverOffsetY;\n\t\t\t\t}\n\t\t\t\tif ( panel.HasActive )\n\t\t\t\t\tscale = Math.Clamp( layout.DecisionButtonPressedScalePercent, 80f, 100f ) / 100f;\n\n\t\t\t\tPanelTransform buttonTransform = new();\n\t\t\t\tbuttonTransform.AddTranslate( Length.Pixels( hoverX ), Length.Pixels( hoverY ), null );\n\t\t\t\tbuttonTransform.AddScale( scale );\n\t\t\t\tpanel.Style.Transform = buttonTransform;\n\n\t\t\t\tif ( layout.ShowDecisionButtonChrome )\n\t\t\t\t{\n\t\t\t\t\tpanel.Style.BorderWidth = Length.Pixels( theme.HudBorderWidth );\n\t\t\t\t\tif ( panel.HasClass( \u0022safe\u0022 ) )\n\t\t\t\t\t{\n\t\t\t\t\t\tpanel.Style.BorderColor = theme.PositiveBorder;\n\t\t\t\t\t\tpanel.Style.BackgroundColor = InteractiveColor( panel, theme.Positive, theme.PositiveHover, theme.PositivePressed );\n\t\t\t\t\t}\n\t\t\t\t\telse if ( panel.HasClass( \u0022risk\u0022 ) )\n\t\t\t\t\t{\n\t\t\t\t\t\tpanel.Style.BorderColor = theme.DangerBorder;\n\t\t\t\t\t\tpanel.Style.BackgroundColor = InteractiveColor( panel, theme.Danger, theme.DangerHover, theme.DangerPressed );\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tpanel.Style.BorderColor = theme.AccentBorder;\n\t\t\t\t\t\tpanel.Style.BackgroundColor = InteractiveColor( panel, theme.Accent, theme.AccentHover, theme.AccentPressed );\n\t\t\t\t\t}\n\t\t\t\t\tSetCornerRadius( panel, theme.ButtonCornerRadius );\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tpanel.Style.BorderWidth = Length.Pixels( 0f );\n\t\t\t\t\tpanel.Style.BackgroundColor = Color.Transparent;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ( panel.HasClass( \u0022decision-button-title\u0022 ) )\n\t\t\t{\n\t\t\t\tpanel.Style.FontFamily = theme.DisplayFont;\n\t\t\t\tpanel.Style.FontSize = Length.Pixels( layout.DecisionButtonTitleSize );\n\n\t\t\t\tPanel action = panel.Ancestors.FirstOrDefault( x =\u003E x.HasClass( \u0022decision-button\u0022 ) );\n\t\t\t\tpanel.Style.FontColor = action?.HasClass( \u0022safe\u0022 ) == true\n\t\t\t\t\t? theme.PositiveText\n\t\t\t\t\t: action?.HasClass( \u0022risk\u0022 ) == true\n\t\t\t\t\t\t? theme.DangerText\n\t\t\t\t\t\t: theme.AccentText;\n\n\t\t\t\tApplyTextLayout( panel, layout.DecisionButtonTitleAlignment, layout.DecisionButtonTitleIndent );\n\t\t\t}\n\n\t\t\tif ( panel.HasClass( \u0022decision-button-description\u0022 ) )\n\t\t\t{\n\t\t\t\tpanel.Style.Display = layout.ShowDecisionButtonDescriptions ? DisplayMode.Flex : DisplayMode.None;\n\t\t\t\tpanel.Style.FontSize = Length.Pixels( layout.DecisionButtonDescriptionSize );\n\t\t\t\tApplyTextLayout( panel, layout.DecisionButtonDescriptionAlignment, layout.DecisionButtonDescriptionIndent );\n\t\t\t}\n\n\t\t\t// ------------------------------------------------------------\n\t\t\t// AMMO\n\t\t\t// ------------------------------------------------------------\n\t\t\tif ( panel.HasClass( \u0022ammo-hud\u0022 ) )\n\t\t\t{\n\t\t\t\tpanel.Style.Display = layout.ShowAmmo ? DisplayMode.Flex : DisplayMode.None;\n\t\t\t\tpanel.Style.MinWidth = Length.Pixels( layout.AmmoMinimumWidth );\n\t\t\t\tpanel.Style.RowGap = Length.Pixels( layout.AmmoElementGap );\n\t\t\t\tSetPadding( panel, layout.AmmoPadding );\n\t\t\t\tApplyScreenAnchor( panel, layout.AmmoAnchor, layout.AmmoRight, layout.AmmoBottom, layout.AmmoOffsetX, layout.AmmoOffsetY );\n\t\t\t\tApplyHorizontalContainerAlignment( panel, layout.AmmoAlignment );\n\t\t\t}\n\n\t\t\tif ( panel.HasClass( \u0022ammo-hud-chrome\u0022 ) )\n\t\t\t{\n\t\t\t\tpanel.Style.BackgroundColor = theme.AmmoPanel;\n\t\t\t\tpanel.Style.BorderColor = theme.Border;\n\t\t\t\tpanel.Style.BorderWidth = Length.Pixels( theme.HudBorderWidth );\n\t\t\t\tpanel.Style.Opacity = layout.ShowAmmoChrome ? layout.AmmoChromeOpacity : 0f;\n\t\t\t\tSetCornerRadius( panel, theme.HudCornerRadius );\n\t\t\t\tApplyBackdropBlur( panel, theme.HudBackdropBlur );\n\t\t\t\tApplyHudPanelShadow( panel, theme );\n\t\t\t}\n\n\t\t\tif ( panel.HasClass( \u0022ammo-weapon\u0022 ) )\n\t\t\t{\n\t\t\t\tpanel.Style.Display = layout.ShowAmmoWeaponName ? DisplayMode.Flex : DisplayMode.None;\n\t\t\t\tpanel.Style.FontSize = Length.Pixels( layout.AmmoWeaponSize );\n\t\t\t\tpanel.Style.FontColor = theme.SecondaryText;\n\t\t\t\tpanel.Style.Opacity = layout.AmmoOpacity;\n\t\t\t\tApplyTextLayout( panel, layout.AmmoAlignment, 0f );\n\t\t\t}\n\n\t\t\tif ( panel.HasClass( \u0022ammo-state\u0022 ) )\n\t\t\t{\n\t\t\t\tpanel.Style.Display = layout.ShowAmmoReloadState ? DisplayMode.Flex : DisplayMode.None;\n\t\t\t\tpanel.Style.FontSize = Length.Pixels( layout.AmmoReloadSize );\n\t\t\t\tpanel.Style.Opacity = layout.AmmoOpacity;\n\t\t\t\tApplyTextLayout( panel, layout.AmmoAlignment, 0f );\n\t\t\t}\n\n\t\t\tif ( panel.HasClass( \u0022ammo-count\u0022 ) )\n\t\t\t{\n\t\t\t\tpanel.Style.ColumnGap = Length.Pixels( layout.AmmoCountGap );\n\t\t\t\tpanel.Style.Opacity = layout.AmmoOpacity;\n\t\t\t}\n\n\t\t\tif ( panel.HasClass( \u0022ammo-current\u0022 ) )\n\t\t\t{\n\t\t\t\tpanel.Style.FontFamily = theme.NumericFont;\n\t\t\t\tpanel.Style.FontSize = Length.Pixels( layout.AmmoCurrentSize );\n\t\t\t\tpanel.Style.FontColor = theme.OverrideAmmoCurrentColor ? theme.AmmoCurrentColor : theme.PrimaryText;\n\t\t\t}\n\n\t\t\tif ( panel.HasClass( \u0022ammo-divider\u0022 ) )\n\t\t\t{\n\t\t\t\tpanel.Style.Display = layout.ShowAmmoDivider ? DisplayMode.Flex : DisplayMode.None;\n\t\t\t\tpanel.Style.FontSize = Length.Pixels( layout.AmmoDividerSize );\n\t\t\t\tpanel.Style.FontColor = theme.MutedText;\n\t\t\t}\n\n\t\t\tif ( panel.HasClass( \u0022ammo-capacity\u0022 ) )\n\t\t\t{\n\t\t\t\tpanel.Style.FontFamily = theme.NumericFont;\n\t\t\t\tpanel.Style.FontSize = Length.Pixels( layout.AmmoCapacitySize );\n\t\t\t\tpanel.Style.FontColor = theme.SecondaryText;\n\t\t\t}\n\n\t\t\t// ------------------------------------------------------------\n\t\t\t// SANDBOX / WARMUP\n\t\t\t// ------------------------------------------------------------\n\t\t\tif ( panel.HasClass( \u0022sandbox-label\u0022 ) )\n\t\t\t{\n\t\t\t\tpanel.Style.Display = layout.ShowSandboxLabel ? DisplayMode.Flex : DisplayMode.None;\n\t\t\t\tpanel.Style.MinWidth = layout.SandboxLabelMinimumWidth \u003E 0f ? Length.Pixels( layout.SandboxLabelMinimumWidth ) : null;\n\t\t\t\tSetPadding( panel, layout.SandboxLabelPadding );\n\t\t\t\tpanel.Style.RowGap = Length.Pixels( layout.SandboxElementGap );\n\t\t\t\tpanel.Style.BackgroundColor = Color.Transparent;\n\t\t\t\tApplyScreenAnchor( panel, layout.SandboxLabelAnchor, layout.SandboxLabelLeft, layout.SandboxLabelTop, layout.SandboxLabelOffsetX, layout.SandboxLabelOffsetY );\n\t\t\t\tApplyHorizontalContainerAlignment( panel, layout.SandboxLabelAlignment );\n\t\t\t}\n\n\t\t\tif ( panel.HasClass( \u0022sandbox-label-chrome\u0022 ) )\n\t\t\t{\n\t\t\t\tbool warmup = panel.Ancestors.Any( x =\u003E x.HasClass( \u0022sandbox-label\u0022 ) \u0026\u0026 x.HasClass( \u0022warmup-label\u0022 ) );\n\t\t\t\tpanel.Style.BackgroundColor = warmup ? theme.WarmupLabel : theme.SandboxLabel;\n\t\t\t\tpanel.Style.BorderColor = warmup ? theme.AccentBorder : theme.Border;\n\t\t\t\tpanel.Style.BorderWidth = Length.Pixels( theme.HudBorderWidth );\n\t\t\t\tpanel.Style.Opacity = layout.ShowSandboxLabelChrome ? layout.SandboxLabelChromeOpacity : 0f;\n\t\t\t\tSetCornerRadius( panel, theme.HudCornerRadius );\n\t\t\t\tApplyBackdropBlur( panel, theme.HudBackdropBlur );\n\t\t\t\tApplyHudPanelShadow( panel, theme );\n\t\t\t}\n\n\t\t\tif ( panel.HasClass( \u0022sandbox-title\u0022 ) )\n\t\t\t{\n\t\t\t\tbool warmup = panel.Ancestors.Any( x =\u003E x.HasClass( \u0022sandbox-label\u0022 ) \u0026\u0026 x.HasClass( \u0022warmup-label\u0022 ) );\n\t\t\t\tpanel.Style.FontFamily = theme.DisplayFont;\n\t\t\t\tpanel.Style.FontSize = Length.Pixels( layout.SandboxTitleSize );\n\t\t\t\tpanel.Style.FontColor = warmup\n\t\t\t\t\t? (theme.OverrideWarmupTitleColor ? theme.WarmupTitleColor : theme.AccentText)\n\t\t\t\t\t: (theme.OverrideSandboxTitleColor ? theme.SandboxTitleColor : theme.PrimaryText);\n\t\t\t\tpanel.Style.Opacity = layout.SandboxLabelOpacity;\n\t\t\t\tApplyTextLayout( panel, layout.SandboxLabelAlignment, 0f );\n\t\t\t}\n\n\t\t\tif ( panel.HasClass( \u0022sandbox-status\u0022 ) )\n\t\t\t{\n\t\t\t\tpanel.Style.Display = layout.ShowSandboxStatus ? DisplayMode.Flex : DisplayMode.None;\n\t\t\t\tpanel.Style.FontSize = Length.Pixels( layout.SandboxStatusSize );\n\t\t\t\tpanel.Style.Opacity = layout.SandboxLabelOpacity;\n\t\t\t\tApplyTextLayout( panel, layout.SandboxLabelAlignment, 0f );\n\t\t\t}\n\n\t\t\tif ( panel.HasClass( \u0022sandbox-hint\u0022 ) )\n\t\t\t{\n\t\t\t\tpanel.Style.Display = layout.ShowSandboxHint ? DisplayMode.Flex : DisplayMode.None;\n\t\t\t\tpanel.Style.FontSize = Length.Pixels( layout.SandboxHintSize );\n\t\t\t\tpanel.Style.Opacity = layout.SandboxLabelOpacity;\n\t\t\t\tApplyTextLayout( panel, layout.SandboxLabelAlignment, 0f );\n\t\t\t}\n\n\t\t\t// The developer preview toolbar is intentionally themed too, making the\n\t\t\t// generic HUD surface and selected accent state visible while tuning.\n\t\t\tif ( panel.HasClass( \u0022hud-preview-toolbar\u0022 ) )\n\t\t\t{\n\t\t\t\tpanel.Style.BackgroundColor = theme.HudPanel;\n\t\t\t\tpanel.Style.BorderColor = theme.SoftBorder;\n\t\t\t\tpanel.Style.BorderWidth = Length.Pixels( theme.HudBorderWidth );\n\t\t\t\tSetCornerRadius( panel, theme.HudCornerRadius );\n\t\t\t\tApplyBackdropBlur( panel, theme.HudBackdropBlur );\n\t\t\t\tApplyHudPanelShadow( panel, theme );\n\t\t\t}\n\n\t\t\tif ( panel.HasClass( \u0022hud-preview-state\u0022 ) )\n\t\t\t{\n\t\t\t\tbool selected = panel.HasClass( \u0022active\u0022 );\n\t\t\t\tpanel.Style.BackgroundColor = selected\n\t\t\t\t\t? theme.AccentSelected\n\t\t\t\t\t: InteractiveColor( panel, theme.Button, theme.ButtonHover, theme.ButtonPressed );\n\t\t\t\tpanel.Style.BorderColor = selected ? theme.AccentBorder : theme.SoftBorder;\n\t\t\t\tSetCornerRadius( panel, theme.ControlCornerRadius );\n\t\t\t}\n\n\t\t\t// Semantic text roles. Keep this explicit rather than using generic class\n\t\t\t// names so one theme control cannot accidentally recolor the entire HUD.\n\t\t\tif ( panel.HasClass( \u0022decision-eyebrow\u0022 ) )\n\t\t\t\tpanel.Style.FontColor = theme.AccentText;\n\t\t\telse if ( (panel.HasClass( \u0022timer-mode\u0022 ) || panel.HasClass( \u0022timer-note\u0022 )) \u0026\u0026 panel.Ancestors.Any( x =\u003E x.HasClass( \u0022round-timer\u0022 ) \u0026\u0026 x.HasClass( \u0022sudden\u0022 ) ) )\n\t\t\t\tpanel.Style.FontColor = theme.DangerText;\n\t\t\telse if ( panel.HasClass( \u0022ammo-state\u0022 ) )\n\t\t\t\tpanel.Style.FontColor = theme.AccentText;\n\t\t\telse if ( panel.HasClass( \u0022sandbox-hint\u0022 ) )\n\t\t\t\tpanel.Style.FontColor = theme.MutedText;\n\t\t\telse if (\n\t\t\t\tpanel.HasClass( \u0022decision-pot\u0022 ) ||\n\t\t\t\tpanel.HasClass( \u0022decision-button-description\u0022 ) ||\n\t\t\t\tpanel.HasClass( \u0022timer-mode\u0022 ) ||\n\t\t\t\tpanel.HasClass( \u0022timer-note\u0022 ) ||\n\t\t\t\tpanel.HasClass( \u0022score-label\u0022 ) ||\n\t\t\t\tpanel.HasClass( \u0022score-player-label\u0022 ) ||\n\t\t\t\tpanel.HasClass( \u0022pot-owner\u0022 ) ||\n\t\t\t\tpanel.HasClass( \u0022sandbox-status\u0022 ) ||\n\t\t\t\tpanel.HasClass( \u0022ammo-weapon\u0022 )\n\t\t\t)\n\t\t\t\tpanel.Style.FontColor = theme.SecondaryText;\n\t\t}\n\t}\n\n\tprivate static void ApplyTextFormatting( Panel panel, OMRUITheme theme )\n\t{\n\t\tif ( panel.HasClass( \u0022menu-title\u0022 ) )\n\t\t\tOMRUITextFormat.Apply( panel, theme.TitleFormat );\n\t\telse if ( panel.HasClass( \u0022menu-subtitle\u0022 ) )\n\t\t\tOMRUITextFormat.Apply( panel, theme.SubtitleFormat );\n\t\telse if (\n\t\t\tpanel.HasClass( \u0022health-number\u0022 ) ||\n\t\t\tpanel.HasClass( \u0022timer-number\u0022 ) ||\n\t\t\tpanel.HasClass( \u0022score-number\u0022 ) ||\n\t\t\tpanel.HasClass( \u0022ammo-current\u0022 ) ||\n\t\t\tpanel.HasClass( \u0022ammo-capacity\u0022 ) ||\n\t\t\tpanel.HasClass( \u0022decision-timer\u0022 ) ||\n\t\t\tpanel.HasClass( \u0022final-score\u0022 ) ||\n\t\t\tpanel.HasClass( \u0022pot-value\u0022 ) ||\n\t\t\tpanel.HasClass( \u0022theme-preview-number\u0022 )\n\t\t)\n\t\t\tOMRUITextFormat.Apply( panel, theme.NumberFormat );\n\t\telse if (\n\t\t\tpanel.HasClass( \u0022page-heading\u0022 ) ||\n\t\t\tpanel.HasClass( \u0022pause-title\u0022 ) ||\n\t\t\tpanel.HasClass( \u0022round\u0022 ) ||\n\t\t\tpanel.HasClass( \u0022center-message\u0022 ) ||\n\t\t\tpanel.HasClass( \u0022decision-title\u0022 ) ||\n\t\t\tpanel.HasClass( \u0022sandbox-title\u0022 ) ||\n\t\t\tpanel.HasClass( \u0022modifier-label\u0022 ) ||\n\t\t\tpanel.HasClass( \u0022online-status-label\u0022 ) ||\n\t\t\tpanel.HasClass( \u0022setting-name\u0022 )\n\t\t)\n\t\t\tOMRUITextFormat.Apply( panel, theme.HeadingFormat );\n\t\telse if (\n\t\t\tpanel.HasClass( \u0022button-title\u0022 ) ||\n\t\t\tpanel.HasClass( \u0022menu-primary\u0022 ) ||\n\t\t\tpanel.HasClass( \u0022menu-back\u0022 ) ||\n\t\t\tpanel.HasClass( \u0022pause-button-title\u0022 ) ||\n\t\t\tpanel.HasClass( \u0022decision-button-title\u0022 ) ||\n\t\t\tpanel.HasClass( \u0022theme-interactive-chip\u0022 )\n\t\t)\n\t\t\tOMRUITextFormat.Apply( panel, theme.ButtonFormat );\n\t\telse if (\n\t\t\tpanel.HasClass( \u0022health-label\u0022 ) ||\n\t\t\tpanel.HasClass( \u0022score-label\u0022 ) ||\n\t\t\tpanel.HasClass( \u0022score-player-label\u0022 ) ||\n\t\t\tpanel.HasClass( \u0022timer-mode\u0022 ) ||\n\t\t\tpanel.HasClass( \u0022timer-note\u0022 ) ||\n\t\t\tpanel.HasClass( \u0022decision-eyebrow\u0022 ) ||\n\t\t\tpanel.HasClass( \u0022decision-pot\u0022 ) ||\n\t\t\tpanel.HasClass( \u0022pot-owner\u0022 ) ||\n\t\t\tpanel.HasClass( \u0022sandbox-status\u0022 ) ||\n\t\t\tpanel.HasClass( \u0022sandbox-hint\u0022 ) ||\n\t\t\tpanel.HasClass( \u0022ammo-weapon\u0022 ) ||\n\t\t\tpanel.HasClass( \u0022ammo-state\u0022 ) ||\n\t\t\tpanel.HasClass( \u0022session-notice\u0022 ) ||\n\t\t\tpanel.HasClass( \u0022pause-eyebrow\u0022 ) ||\n\t\t\tpanel.HasClass( \u0022online-subheading\u0022 ) ||\n\t\t\tpanel.HasClass( \u0022lobby-ready-summary\u0022 ) ||\n\t\t\tpanel.HasClass( \u0022setting-value\u0022 ) ||\n\t\t\tpanel.HasClass( \u0022hud-preview-toolbar-title\u0022 ) ||\n\t\t\tpanel.HasClass( \u0022theme-preview-meta\u0022 )\n\t\t)\n\t\t\tOMRUITextFormat.Apply( panel, theme.MetaFormat );\n\t\telse if (\n\t\t\tpanel.HasClass( \u0022page-copy\u0022 ) ||\n\t\t\tpanel.HasClass( \u0022button-description\u0022 ) ||\n\t\t\tpanel.HasClass( \u0022lobby-note\u0022 ) ||\n\t\t\tpanel.HasClass( \u0022setting-description\u0022 ) ||\n\t\t\tpanel.HasClass( \u0022pause-note\u0022 ) ||\n\t\t\tpanel.HasClass( \u0022pause-summary\u0022 ) ||\n\t\t\tpanel.HasClass( \u0022pause-button-copy\u0022 ) ||\n\t\t\tpanel.HasClass( \u0022decision-button-description\u0022 ) ||\n\t\t\tpanel.HasClass( \u0022theme-preview-body\u0022 )\n\t\t)\n\t\t\tOMRUITextFormat.Apply( panel, theme.BodyFormat );\n\t}\n\n\tprivate static IEnumerable\u003CPanel\u003E Panels( Panel root )\n\t{\n\t\tyield return root;\n\n\t\tforeach ( Panel panel in root.Descendants )\n\t\t\tyield return panel;\n\t}\n\n\tprivate static ObjectFit Fit( OMRImageFit fit ) =\u003E fit switch\n\t{\n\t\tOMRImageFit.Contain =\u003E ObjectFit.Contain,\n\t\tOMRImageFit.Fill =\u003E ObjectFit.Fill,\n\t\t_ =\u003E ObjectFit.Cover\n\t};\n\n\tprivate static void ApplyTextLayout(\n\t\tPanel panel,\n\t\tOMRTextHorizontalAlignment alignment,\n\t\tfloat indent\n\t)\n\t{\n\t\t// Configurable UI text is authored as Label panels. Give every text\n\t\t// element a real horizontal layout area instead of letting it collapse\n\t\t// to the intrinsic width of its glyphs. Without this, text-align can be\n\t\t// technically applied while producing almost no visible movement.\n\t\tpanel.Style.Width = Length.Percent( 100f );\n\t\tpanel.Style.AlignSelf = Align.Stretch;\n\n\t\tpanel.Style.TextAlign = alignment switch\n\t\t{\n\t\t\tOMRTextHorizontalAlignment.Left =\u003E TextAlign.Left,\n\t\t\tOMRTextHorizontalAlignment.Right =\u003E TextAlign.Right,\n\t\t\t_ =\u003E TextAlign.Center\n\t\t};\n\n\t\tfloat safeIndent = Math.Max( 0f, indent );\n\t\tpanel.Style.PaddingLeft = Length.Pixels(\n\t\t\talignment == OMRTextHorizontalAlignment.Right ? 0f : safeIndent\n\t\t);\n\t\tpanel.Style.PaddingRight = Length.Pixels(\n\t\t\talignment == OMRTextHorizontalAlignment.Left ? 0f : safeIndent\n\t\t);\n\t}\n\n\tprivate static void ApplyActionAlignment(\n\t\tPanel panel,\n\t\tOMRTextHorizontalAlignment alignment,\n\t\tfloat indent\n\t)\n\t{\n\t\tpanel.Style.JustifyContent = alignment switch\n\t\t{\n\t\t\tOMRTextHorizontalAlignment.Left =\u003E Justify.FlexStart,\n\t\t\tOMRTextHorizontalAlignment.Right =\u003E Justify.FlexEnd,\n\t\t\t_ =\u003E Justify.Center\n\t\t};\n\n\t\tconst float baseHorizontalPadding = 20f;\n\t\tfloat safeIndent = Math.Max( 0f, indent );\n\t\tpanel.Style.PaddingLeft = Length.Pixels(\n\t\t\tbaseHorizontalPadding \u002B\n\t\t\t(alignment == OMRTextHorizontalAlignment.Left ? safeIndent : 0f)\n\t\t);\n\t\tpanel.Style.PaddingRight = Length.Pixels(\n\t\t\tbaseHorizontalPadding \u002B\n\t\t\t(alignment == OMRTextHorizontalAlignment.Right ? safeIndent : 0f)\n\t\t);\n\t}\n\n\n\tprivate static void ApplyHorizontalContainerAlignment(\n\t\tPanel panel,\n\t\tOMRTextHorizontalAlignment alignment\n\t)\n\t{\n\t\tpanel.Style.AlignItems = alignment switch\n\t\t{\n\t\t\tOMRTextHorizontalAlignment.Left =\u003E Align.FlexStart,\n\t\t\tOMRTextHorizontalAlignment.Right =\u003E Align.FlexEnd,\n\t\t\t_ =\u003E Align.Center\n\t\t};\n\t}\n\n\tprivate static void ApplyPairAlignment(\n\t\tPanel panel,\n\t\tOMRHUDPairAlignment alignment\n\t)\n\t{\n\t\tpanel.Style.JustifyContent = alignment switch\n\t\t{\n\t\t\tOMRHUDPairAlignment.Left =\u003E Justify.FlexStart,\n\t\t\tOMRHUDPairAlignment.Center =\u003E Justify.Center,\n\t\t\tOMRHUDPairAlignment.Right =\u003E Justify.FlexEnd,\n\t\t\t_ =\u003E Justify.SpaceBetween\n\t\t};\n\t}\n\n\tprivate static void ApplyScreenAnchor(\n\t\tPanel panel,\n\t\tOMRHUDScreenAnchor anchor,\n\t\tfloat horizontalInset,\n\t\tfloat verticalInset,\n\t\tfloat offsetX,\n\t\tfloat offsetY\n\t)\n\t{\n\t\tpanel.Style.Left = null;\n\t\tpanel.Style.Right = null;\n\t\tpanel.Style.Top = null;\n\t\tpanel.Style.Bottom = null;\n\n\t\tbool centerX = anchor is OMRHUDScreenAnchor.TopCenter or OMRHUDScreenAnchor.Center or OMRHUDScreenAnchor.BottomCenter;\n\t\tbool right = anchor is OMRHUDScreenAnchor.TopRight or OMRHUDScreenAnchor.MiddleRight or OMRHUDScreenAnchor.BottomRight;\n\t\tbool centerY = anchor is OMRHUDScreenAnchor.MiddleLeft or OMRHUDScreenAnchor.Center or OMRHUDScreenAnchor.MiddleRight;\n\t\tbool bottom = anchor is OMRHUDScreenAnchor.BottomLeft or OMRHUDScreenAnchor.BottomCenter or OMRHUDScreenAnchor.BottomRight;\n\n\t\tif ( centerX )\n\t\t\tpanel.Style.Left = Length.Percent( 50f );\n\t\telse if ( right )\n\t\t\tpanel.Style.Right = Length.Pixels( horizontalInset );\n\t\telse\n\t\t\tpanel.Style.Left = Length.Pixels( horizontalInset );\n\n\t\tif ( centerY )\n\t\t\tpanel.Style.Top = Length.Percent( 50f );\n\t\telse if ( bottom )\n\t\t\tpanel.Style.Bottom = Length.Pixels( verticalInset );\n\t\telse\n\t\t\tpanel.Style.Top = Length.Pixels( verticalInset );\n\n\t\tPanelTransform transform = new();\n\t\tif ( centerX )\n\t\t\ttransform.AddTranslate( Length.Percent( -50f ), Length.Pixels( 0f ), null );\n\t\tif ( centerY )\n\t\t\ttransform.AddTranslate( Length.Pixels( 0f ), Length.Percent( -50f ), null );\n\t\ttransform.AddTranslate( Length.Pixels( offsetX ), Length.Pixels( offsetY ), null );\n\t\tpanel.Style.Transform = transform;\n\t}\n\n\tprivate static void ApplyPrimaryPanelShadow( Panel panel, OMRUITheme theme )\n\t{\n\t\tApplyBoxShadow(\n\t\t\tpanel,\n\t\t\ttheme.EnablePrimaryPanelShadow,\n\t\t\ttheme.PrimaryPanelShadowOffsetX,\n\t\t\ttheme.PrimaryPanelShadowOffsetY,\n\t\t\ttheme.PrimaryPanelShadowBlur,\n\t\t\ttheme.PrimaryPanelShadowSpread,\n\t\t\ttheme.PrimaryPanelShadowColor\n\t\t);\n\t}\n\n\tprivate static void ApplyHudPanelShadow( Panel panel, OMRUITheme theme )\n\t{\n\t\tApplyBoxShadow(\n\t\t\tpanel,\n\t\t\ttheme.EnableHudPanelShadow,\n\t\t\ttheme.HudPanelShadowOffsetX,\n\t\t\ttheme.HudPanelShadowOffsetY,\n\t\t\ttheme.HudPanelShadowBlur,\n\t\t\ttheme.HudPanelShadowSpread,\n\t\t\ttheme.HudPanelShadowColor\n\t\t);\n\t}\n\n\tprivate static void ApplyBoxShadow( Panel panel, bool enabled, float x, float y, float blur, float spread, Color color )\n\t{\n\t\tif ( !enabled )\n\t\t{\n\t\t\tpanel.Style.Set( \u0022box-shadow\u0022, \u0022none\u0022 );\n\t\t\treturn;\n\t\t}\n\n\t\tstring value = string.Format(\n\t\t\tCultureInfo.InvariantCulture,\n\t\t\t\u0022{0:0.###}px {1:0.###}px {2:0.###}px {3:0.###}px {4}\u0022,\n\t\t\tx, y, Math.Max( 0f, blur ), spread, color.Rgba\n\t\t);\n\t\tpanel.Style.Set( \u0022box-shadow\u0022, value );\n\t}\n\n\tprivate static void ApplyTextShadow( Panel panel, bool enabled, float x, float y, float blur, Color color )\n\t{\n\t\tif ( !enabled )\n\t\t{\n\t\t\tpanel.Style.Set( \u0022text-shadow\u0022, \u0022none\u0022 );\n\t\t\treturn;\n\t\t}\n\n\t\tstring value = string.Format(\n\t\t\tCultureInfo.InvariantCulture,\n\t\t\t\u0022{0:0.###}px {1:0.###}px {2:0.###}px {3}\u0022,\n\t\t\tx, y, Math.Max( 0f, blur ), color.Rgba\n\t\t);\n\t\tpanel.Style.Set( \u0022text-shadow\u0022, value );\n\t}\n\n\tprivate static void StylePreviewSurface(\n\t\tPanel panel,\n\t\tColor background,\n\t\tColor border,\n\t\tfloat radius,\n\t\tfloat blur = 0f,\n\t\tfloat borderWidth = 1f\n\t)\n\t{\n\t\tpanel.Style.BackgroundColor = background;\n\t\tpanel.Style.BorderColor = border;\n\t\tpanel.Style.BorderWidth = Length.Pixels( Math.Max( 0f, borderWidth ) );\n\t\tSetCornerRadius( panel, radius );\n\t\tApplyBackdropBlur( panel, blur );\n\t}\n\n\tprivate static Color InteractiveColor( Panel panel, Color normal, Color hover, Color pressed )\n\t{\n\t\tif ( panel.HasActive )\n\t\t\treturn pressed;\n\t\tif ( panel.HasHovered )\n\t\t\treturn hover;\n\t\treturn normal;\n\t}\n\n\tprivate static void ApplyBackdropBlur( Panel panel, float pixels )\n\t{\n\t\tpanel.Style.BackdropFilterBlur = Length.Pixels( Math.Max( 0f, pixels ) );\n\t}\n\n\tprivate static void ApplyDisplayTextEffect( Panel panel, OMRUITheme theme )\n\t{\n\t\tbool displayText =\n\t\t\tpanel.HasClass( \u0022menu-title\u0022 ) ||\n\t\t\tpanel.HasClass( \u0022page-heading\u0022 ) ||\n\t\t\tpanel.HasClass( \u0022pause-title\u0022 ) ||\n\t\t\tpanel.HasClass( \u0022round\u0022 ) ||\n\t\t\tpanel.HasClass( \u0022center-message\u0022 ) ||\n\t\t\tpanel.HasClass( \u0022decision-title\u0022 ) ||\n\t\t\tpanel.HasClass( \u0022sandbox-title\u0022 );\n\n\t\tif ( !displayText )\n\t\t\treturn;\n\n\t\tApplyTextShadow(\n\t\t\tpanel,\n\t\t\ttheme.EnableDisplayTextShadow,\n\t\t\ttheme.DisplayTextShadowOffsetX,\n\t\t\ttheme.DisplayTextShadowOffsetY,\n\t\t\ttheme.DisplayTextShadowBlur,\n\t\t\ttheme.DisplayTextShadowColor\n\t\t);\n\n\t\tbool enabled = theme.EnableDisplayTextStroke \u0026\u0026 theme.DisplayTextStrokeWidth \u003E 0f;\n\t\tpanel.Style.TextStrokeColor = enabled ? theme.DisplayTextStrokeColor : Color.Transparent;\n\t\tpanel.Style.TextStrokeWidth = Length.Pixels( enabled\n\t\t\t? Math.Max( 0f, theme.DisplayTextStrokeWidth )\n\t\t\t: 0f );\n\t}\n\n\tprivate static void SetCornerRadius( Panel panel, float pixels )\n\t{\n\t\tLength? radius = Length.Pixels( Math.Max( 0f, pixels ) );\n\t\tpanel.Style.BorderTopLeftRadius = radius;\n\t\tpanel.Style.BorderTopRightRadius = radius;\n\t\tpanel.Style.BorderBottomLeftRadius = radius;\n\t\tpanel.Style.BorderBottomRightRadius = radius;\n\t}\n\n\tprivate static void SetPadding( Panel panel, float pixels )\n\t{\n\t\tLength? value = Length.Pixels( pixels );\n\n\t\tpanel.Style.PaddingLeft = value;\n\t\tpanel.Style.PaddingRight = value;\n\t\tpanel.Style.PaddingTop = value;\n\t\tpanel.Style.PaddingBottom = value;\n\t}\n}\n"},{"Ident":"lfinchgames.oneplusround","Path":"WeaponPresentationEvents.cs","FileName":"WeaponPresentationEvents.cs","PackageType":"game","CodeKind":"Game","AssetVersionId":399243,"IsPrivate":false,"Code":"using Sandbox;\nusing System;\n\n/// \u003Csummary\u003E\n/// Presentation-level events emitted by a weapon after the corresponding\n/// engine/gameplay hook has been resolved on this peer.\n///\n/// These are intentionally presentation events, not authoritative gameplay\n/// commands. Consumers may drive audio, animation, particles, scopes, HUD\n/// feedback, etc. They must not apply damage or mutate authoritative ammo.\n/// \u003C/summary\u003E\npublic enum WeaponPresentationEventKind\n{\n\tEquipped,\n\tHolstered,\n\tShotFired,\n\tDryFire,\n\tReloadStarted,\n\tReloadInserted,\n\tReloadCancelled,\n\tReloadFinished,\n\tBoltCycleStarted,\n\tBoltCycleCompleted,\n\tCycleStarted,\n\tCycleCompleted\n}\n\n/// \u003Csummary\u003E\n/// Small immutable snapshot accompanying a weapon presentation event.\n/// Sequence is local to this weapon instance on this peer and is intended for\n/// diagnostics/order tracking rather than networking authority.\n/// \u003C/summary\u003E\npublic readonly record struct WeaponPresentationEvent\n{\n\tpublic WeaponPresentationEventKind Kind { get; init; }\n\tpublic BaseCombatWeapon Weapon { get; init; }\n\tpublic int Sequence { get; init; }\n\tpublic float Time { get; init; }\n\tpublic int Clip { get; init; }\n\tpublic int Reserve { get; init; }\n}\n\n/// \u003Csummary\u003E\n/// Generic contract for weapon presentation event sources. OMR-specific game\n/// modes should not be required to consume this; presentation components can.\n/// \u003C/summary\u003E\npublic interface IWeaponPresentationEventSource\n{\n\tevent Action\u003CWeaponPresentationEvent\u003E PresentationEvent;\n}\n"},{"Ident":"lfinchgames.oneplusround","Path":"UI/OMRCrosshairHUD.razor","FileName":"OMRCrosshairHUD.razor","PackageType":"game","CodeKind":"Game","AssetVersionId":399243,"IsPrivate":false,"Code":"@using System;\n@using System.Linq;\n@using Sandbox;\n@using Sandbox.UI;\n@inherits PanelComponent\n\n\u003Croot\u003E\n\t@if ( ShouldShowCrosshair )\n\t{\n\t\t\u003Cdiv\n\t\t\tclass=\u0022omr-crosshair\u0022\n\t\t\tstyle=\u0022@CrosshairRootStyle\u0022\n\t\t\u003E\n\t\t\t\u003Cdiv\n\t\t\t\tclass=\u0022omr-crosshair-line horizontal\u0022\n\t\t\t\tstyle=\u0022@CrosshairLeftStyle\u0022\n\t\t\t\u003E\u003C/div\u003E\n\n\t\t\t\u003Cdiv\n\t\t\t\tclass=\u0022omr-crosshair-line horizontal\u0022\n\t\t\t\tstyle=\u0022@CrosshairRightStyle\u0022\n\t\t\t\u003E\u003C/div\u003E\n\n\t\t\t\u003Cdiv\n\t\t\t\tclass=\u0022omr-crosshair-line vertical\u0022\n\t\t\t\tstyle=\u0022@CrosshairUpStyle\u0022\n\t\t\t\u003E\u003C/div\u003E\n\n\t\t\t\u003Cdiv\n\t\t\t\tclass=\u0022omr-crosshair-line vertical\u0022\n\t\t\t\tstyle=\u0022@CrosshairDownStyle\u0022\n\t\t\t\u003E\u003C/div\u003E\n\t\t\u003C/div\u003E\n\t}\n\u003C/root\u003E\n\n@code\n{\n\tprivate readonly OMRSceneReferences _sceneReferences = new();\n\tprivate OMRSceneReferences SceneReferences\n\t{\n\t\tget { _sceneReferences.Refresh( Scene ); return _sceneReferences; }\n\t}\n\tprivate PlayerState LocalPlayerState =\u003E SceneReferences.LocalPlayer;\n\n\tprivate BaseInventoryComponent LocalInventory =\u003E SceneReferences.LocalInventory;\n\n\tprivate OneMoreRoundWeapon LocalWeapon =\u003E\n\t\tLocalInventory?\n\t\t\t.ActiveItem as OneMoreRoundWeapon;\n\n\tprivate RoundManager LocalRoundManager =\u003E SceneReferences.Rounds;\n\n\t/// \u003Csummary\u003E\n\t/// Crosshair visibility follows actual gameplay context rather than only\n\t/// weapon state.\n\t///\n\t/// Visible:\n\t/// - Sandbox gameplay\n\t/// - Online warmup\n\t/// - Active Fighting phase\n\t///\n\t/// Hidden:\n\t/// - pause/settings\n\t/// - pre-match lobby/ready screen\n\t/// - countdown\n\t/// - round end\n\t/// - winner/modifier decisions\n\t/// - match end/menu\n\t/// \u003C/summary\u003E\n\tprivate bool IsCrosshairGameplayContext\n\t{\n\t\tget\n\t\t{\n\t\t\tif ( PauseMenu.IsAnyPauseOpen )\n\t\t\t\treturn false;\n\n\t\t\tRoundManager roundManager =\n\t\t\t\tLocalRoundManager;\n\n\t\t\tif ( roundManager is null )\n\t\t\t\treturn false;\n\n\t\t\treturn roundManager.Mode switch\n\t\t\t{\n\t\t\t\tSessionMode.Sandbox =\u003E\n\t\t\t\t\ttrue,\n\n\t\t\t\tSessionMode.Match =\u003E\n\t\t\t\t\troundManager.Phase ==\n\t\t\t\t\t\tRoundPhase.Fighting,\n\n\t\t\t\tSessionMode.Menu =\u003E\n\t\t\t\t\tLocalPlayerState?.\n\t\t\t\t\t\tPreMatchState ==\n\t\t\t\t\t\t\tPreMatchPlayerState.Warmup,\n\n\t\t\t\t_ =\u003E\n\t\t\t\t\tfalse\n\t\t\t};\n\t\t}\n\t}\n\n\tprivate bool ShouldShowCrosshair =\u003E\n\t\tIsCrosshairGameplayContext \u0026\u0026\n\t\tLocalWeapon is not null \u0026\u0026\n\t\tLocalWeapon.IsValid \u0026\u0026\n\t\tLocalWeapon.ShouldShowScreenCrosshair;\n\n\tprivate Vector2 Gap =\u003E\n\t\tLocalWeapon?\n\t\t\t.ScreenCrosshairGap ??\n\t\tVector2.Zero;\n\n\tprivate float LineLength =\u003E\n\t\tMathF.Max(\n\t\t\tLocalWeapon?\n\t\t\t\t.CrosshairLineLength ??\n\t\t\t0f,\n\t\t\t0f\n\t\t);\n\n\tprivate float LineWidth =\u003E\n\t\tMathF.Max(\n\t\t\tLocalWeapon?\n\t\t\t\t.CrosshairLineWidth ??\n\t\t\t0.5f,\n\t\t\t0.5f\n\t\t);\n\n\tprivate string CrosshairRootStyle\n\t{\n\t\tget\n\t\t{\n\t\t\tColor color =\n\t\t\t\tLocalWeapon?\n\t\t\t\t\t.CrosshairColor ??\n\t\t\t\tColor.White;\n\n\t\t\treturn $\u0022color: {color.Rgba};\u0022;\n\t\t}\n\t}\n\n\tprivate string CrosshairLeftStyle =\u003E\n\t\t$\u0022width: {Css( LineLength )}px; \u0022 \u002B\n\t\t$\u0022height: {Css( LineWidth )}px; \u0022 \u002B\n\t\t$\u0022left: {Css( -(Gap.x \u002B LineLength) )}px; \u0022 \u002B\n\t\t$\u0022top: {Css( -LineWidth * 0.5f )}px;\u0022;\n\n\tprivate string CrosshairRightStyle =\u003E\n\t\t$\u0022width: {Css( LineLength )}px; \u0022 \u002B\n\t\t$\u0022height: {Css( LineWidth )}px; \u0022 \u002B\n\t\t$\u0022left: {Css( Gap.x )}px; \u0022 \u002B\n\t\t$\u0022top: {Css( -LineWidth * 0.5f )}px;\u0022;\n\n\tprivate string CrosshairUpStyle =\u003E\n\t\t$\u0022width: {Css( LineWidth )}px; \u0022 \u002B\n\t\t$\u0022height: {Css( LineLength )}px; \u0022 \u002B\n\t\t$\u0022left: {Css( -LineWidth * 0.5f )}px; \u0022 \u002B\n\t\t$\u0022top: {Css( -(Gap.y \u002B LineLength) )}px;\u0022;\n\n\tprivate string CrosshairDownStyle =\u003E\n\t\t$\u0022width: {Css( LineWidth )}px; \u0022 \u002B\n\t\t$\u0022height: {Css( LineLength )}px; \u0022 \u002B\n\t\t$\u0022left: {Css( -LineWidth * 0.5f )}px; \u0022 \u002B\n\t\t$\u0022top: {Css( Gap.y )}px;\u0022;\n\n\tprivate static string Css(\n\t\tfloat value\n\t)\n\t{\n\t\treturn value.ToString(\n\t\t\t\u00220.###\u0022,\n\t\t\tSystem.Globalization.CultureInfo.InvariantCulture\n\t\t);\n\t}\n\n\tprotected override int BuildHash()\n\t{\n\t\tOneMoreRoundWeapon weapon =\n\t\t\tLocalWeapon;\n\n\t\tRoundManager roundManager =\n\t\t\tLocalRoundManager;\n\n\t\tPlayerState player =\n\t\t\tLocalPlayerState;\n\n\t\tHashCode hash =\n\t\t\tnew();\n\n\t\t//\n\t\t// UI context belongs in the hash too. Without this, opening Pause or\n\t\t// entering a decision phase can change ShouldShowCrosshair without\n\t\t// giving Razor a weapon-property change to rebuild from.\n\t\t//\n\t\thash.Add(\n\t\t\tPauseMenu.IsAnyPauseOpen\n\t\t);\n\n\t\thash.Add(\n\t\t\troundManager?.\n\t\t\t\tMode ??\n\t\t\tSessionMode.Menu\n\t\t);\n\n\t\thash.Add(\n\t\t\troundManager?.\n\t\t\t\tPhase ??\n\t\t\tRoundPhase.Waiting\n\t\t);\n\n\t\thash.Add(\n\t\t\tplayer?.\n\t\t\t\tPreMatchState ??\n\t\t\tPreMatchPlayerState.Lobby\n\t\t);\n\n\t\tif (\n\t\t\tweapon is null ||\n\t\t\t!weapon.IsValid\n\t\t)\n\t\t{\n\t\t\treturn hash.ToHashCode();\n\t\t}\n\n\t\tVector2 gap =\n\t\t\tweapon.ScreenCrosshairGap;\n\n\t\thash.Add(\n\t\t\tweapon.IsAiming\n\t\t);\n\n\t\thash.Add(\n\t\t\tgap.x\n\t\t);\n\n\t\thash.Add(\n\t\t\tgap.y\n\t\t);\n\n\t\thash.Add(\n\t\t\tweapon.CrosshairLineLength\n\t\t);\n\n\t\thash.Add(\n\t\t\tweapon.CrosshairLineWidth\n\t\t);\n\n\t\thash.Add(\n\t\t\tweapon.CrosshairColor\n\t\t);\n\n\t\treturn hash.ToHashCode();\n\t}\n}\n"},{"Ident":"lfinchgames.oneplusround","Path":"UI/PracticePage.razor","FileName":"PracticePage.razor","PackageType":"game","CodeKind":"Game","AssetVersionId":399243,"IsPrivate":false,"Code":"@using Sandbox.UI;\n@using Sandbox.UI.Navigation;\n@inherits Panel\n@attribute [Route( \u0022/practice\u0022 )]\n\n\u003Croot class=\u0022menu-page\u0022\u003E\n\n\t\u003Clabel class=\u0022page-heading\u0022\u003EPRACTICE\u003C/label\u003E\n\n\t\u003Clabel class=\u0022page-copy\u0022\u003E\n\t\tFight ROOK through the full competitive loop, or open Sandbox\n\t\tfor persistent weapon, arena and AI testing.\n\t\u003C/label\u003E\n\n\t\u003Cdiv class=\u0022setup-section bot-match-setup\u0022\u003E\n\t\t\u003Cdiv class=\u0022setup-section-title\u0022\u003EBOT MATCH\u003C/div\u003E\n\t\t\u003Cdiv class=\u0022setup-row\u0022\u003E\n\t\t\t\u003Cdiv class=\u0022setup-label\u0022\u003EDIFFICULTY PROFILE\u003C/div\u003E\n\t\t\t\u003Cdiv class=\u0022setup-selector\u0022\u003E\n\t\t\t\t\u003Cdiv class=\u0022selector-arrow\u0022 onclick=@BotDifficultyPrevious\u003E\u0026lt;\u003C/div\u003E\n\t\t\t\t\u003Cdiv class=\u0022selector-value\u0022\u003E@OMRSceneFlow.GetBotMatchDifficultyName()\u003C/div\u003E\n\t\t\t\t\u003Cdiv class=\u0022selector-arrow\u0022 onclick=@BotDifficultyNext\u003E\u0026gt;\u003C/div\u003E\n\t\t\t\u003C/div\u003E\n\t\t\u003C/div\u003E\n\t\u003C/div\u003E\n\n\t\u003Cdiv\n\t\tclass=\u0022menu-button\u0022\n\t\tonclick=@StartBotMatch\n\t\u003E\n\t\t\u003Clabel class=\u0022button-title\u0022\u003EVS BOT MATCH\u003C/label\u003E\n\t\t\u003Clabel class=\u0022button-description\u0022\u003E\n\t\t\tFull match rules \u00B7 @(OMRSceneFlow.GetBotMatchDifficultyName()) \u00B7 BANK / ONE MORE ROUND \u00B7 adaptive ROOK\n\t\t\u003C/label\u003E\n\t\u003C/div\u003E\n\n\t\u003Cdiv\n\t\tclass=\u0022menu-button\u0022\n\t\tonclick=@OpenSandboxSetup\n\t\u003E\n\t\t\u003Clabel class=\u0022button-title\u0022\u003ESANDBOX\u003C/label\u003E\n\t\t\u003Clabel class=\u0022button-description\u0022\u003E\n\t\t\tSolo or multiplayer \u00B7 custom weapons and arena modules\n\t\t\u003C/label\u003E\n\t\u003C/div\u003E\n\n\t\u003Ca\n\t\thref=\u0022/\u0022\n\t\tclass=\u0022menu-back\u0022\n\t\u003E\n\t\tBACK\n\t\u003C/a\u003E\n\n\u003C/root\u003E\n\n@code\n{\n\tprivate void BotDifficultyPrevious()\n\t{\n\t\tOMRSceneFlow.CycleBotMatchDifficulty( -1 );\n\t}\n\n\tprivate void BotDifficultyNext()\n\t{\n\t\tOMRSceneFlow.CycleBotMatchDifficulty( 1 );\n\t}\n\n\tprivate void StartBotMatch()\n\t{\n\t\tMainMenuHost.Current?.StartBotMatch();\n\t}\n\n\tprivate void OpenSandboxSetup()\n\t{\n\t\tMainMenuHost.Current?.OpenSandboxSetup();\n\t}\n}\n"},{"Ident":"lfinchgames.oneplusround","Path":"ui/omrscopelenspanel.razor.scss","FileName":"omrscopelenspanel.razor.scss","PackageType":"game","CodeKind":"Game","AssetVersionId":399243,"IsPrivate":false,"Code":"OMRScopeLensPanel {\n\tposition: absolute;\n\tleft: 0;\n\ttop: 0;\n\twidth: 100%;\n\theight: 100%;\n\tpointer-events: none;\n\n\t.lens-window {\n\t\tposition: absolute;\n\t\tleft: 0;\n\t\ttop: 0;\n\t\twidth: 100%;\n\t\theight: 100%;\n\t\tborder-radius: 50%;\n\t\toverflow: hidden;\n\t\tbackground-color: black;\n\t}\n\n\t.lens-feed {\n\t\tposition: absolute;\n\t\tleft: 0;\n\t\ttop: 0;\n\t\twidth: 100%;\n\t\theight: 100%;\n\t\tz-index: 0;\n\t\ttransform-origin: 50% 50%;\n\t}\n\n\t.lens-erect-transition {\n\t\tposition: absolute;\n\t\tleft: 0;\n\t\ttop: 0;\n\t\twidth: 100%;\n\t\theight: 100%;\n\t\tz-index: 1;\n\t\tpointer-events: none;\n\t}\n\n\t.lens-transmission,\n\t.lens-tint,\n\t.lens-vignette,\n\t.lens-reflection {\n\t\tposition: absolute;\n\t\tleft: 0;\n\t\ttop: 0;\n\t\twidth: 100%;\n\t\theight: 100%;\n\t\tpointer-events: none;\n\t}\n\n\t.lens-transmission {\n\t\tz-index: 2;\n\t}\n\n\t.lens-tint {\n\t\tz-index: 3;\n\t}\n\n\t.lens-vignette {\n\t\tz-index: 4;\n\t}\n\n\t.lens-reflection {\n\t\tz-index: 5;\n\t\tbackground-image: linear-gradient(rgba(255,255,255,0.65), rgba(255,255,255,0));\n\t}\n\n\t.scope-reticle {\n\t\tposition: absolute;\n\t\tleft: 0;\n\t\ttop: 0;\n\t\twidth: 100%;\n\t\theight: 100%;\n\t\tz-index: 10;\n\t\tpointer-events: none;\n\t}\n}\n"},{"Ident":"lfinchgames.oneplusround","Path":"OMRBotManager.cs","FileName":"OMRBotManager.cs","PackageType":"game","CodeKind":"Game","AssetVersionId":399243,"IsPrivate":false,"Code":"using Sandbox;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Threading.Tasks;\n\n/// \u003Csummary\u003E\n/// Host-only lifecycle manager for OMR player bots.\n///\n/// BOT 0/0.5 establishes a host-owned player bot. BOT 1 manages the runtime\n/// navigation mesh for the modular arena. BOT 2 reuses that same mesh while\n/// perception decides whether the bot may navigate to a visible or remembered\n/// target position. BOT 3 layers real weapon combat on top. BOT 4 adds\n/// contextual sprint/strafe/slide/crouch/jump decisions through synthetic input.\n/// BOT 5 adds tactical cover, under-fire reactions, hearing/search, flanking and\n/// anti-loop traversal safeguards. BOT 6 adds modifier-aware decisions, bounded\n/// tactical variation and an online opponent model while keeping physical movement\n/// inside the normal OMR locomotion pipeline.\n/// \u003C/summary\u003E\npublic sealed class OMRBotManager : Component\n{\n\t[Property]\n\tpublic RoundManager RoundManager { get; set; }\n\n\t[Property, ResourceType( \u0022prefab\u0022 )]\n\tpublic string PlayerPrefabPath { get; set; } =\n\t\t\u0022prefabs/player.prefab\u0022;\n\n\t[Property, Group( \u0022Diagnostics\u0022 )]\n\tpublic bool LogLifecycle { get; set; } = true;\n\n\tprivate readonly List\u003COMRBotController\u003E _managedBots = new();\n\tprivate readonly List\u003CPlayerState\u003E _managedHumans = new();\n\tprivate float _incrementalNavigationQueuedAt;\n\tprivate float _navigationRetryAfter;\n\tprivate int _navigationFailureCount;\n\n\t// RequestTilesGeneration queues work for future frames. IsGenerating alone\n\t// can briefly be false before that queued work begins.\n\tpublic bool NavigationReady =\u003E _navigationHasInitialFullBuild \u0026\u0026\n\t\t!_navigationRebuildPending \u0026\u0026 !_incrementalNavigationRefreshPending \u0026\u0026\n\t\t_navigationGenerationTask is null \u0026\u0026 Scene?.NavMesh is not null \u0026\u0026\n\t\t!Scene.NavMesh.IsGenerating \u0026\u0026\n\t\t( RoundManager?.Arena?.CurrentLayoutState ?? ArenaLayoutState.Invalid ) == _lastNavigationLayoutState;\n\n\tprivate float _nextSyncAt;\n\tprivate ArenaLayoutState _lastNavigationLayoutState =\n\t\tArenaLayoutState.Invalid;\n\tprivate bool _navigationMeshConfigured;\n\tprivate bool _navigationRebuildPending;\n\tprivate float _navigationRebuildAt;\n\tprivate ArenaLayoutState _pendingNavigationLayoutState =\n\t\tArenaLayoutState.Invalid;\n\tprivate Task\u003Cbool\u003E _navigationGenerationTask;\n\tprivate ArenaLayoutState _generatingNavigationLayoutState =\n\t\tArenaLayoutState.Invalid;\n\tprivate bool _navigationHasInitialFullBuild;\n\tprivate bool _incrementalNavigationRefreshPending;\n\tprivate ArenaLayoutState _incrementalNavigationLayoutState =\n\t\tArenaLayoutState.Invalid;\n\n\tprotected override void OnStart()\n\t{\n\t\tRoundManager ??=\n\t\t\tComponents.Get\u003CRoundManager\u003E();\n\t}\n\n\tprotected override void OnUpdate()\n\t{\n\t\tif ( !Networking.IsHost )\n\t\t\treturn;\n\n\t\tif ( Time.Now \u003C _nextSyncAt )\n\t\t\treturn;\n\n\t\t_nextSyncAt =\n\t\t\tTime.Now \u002B 0.20f;\n\n\t\tSyncNavigationMesh();\n\t\tSyncManagedBot();\n\t}\n\n\tpublic void SyncNow()\n\t{\n\t\tif ( !Networking.IsHost )\n\t\t\treturn;\n\n\t\t_nextSyncAt = 0f;\n\t\tSyncNavigationMesh();\n\t\tSyncManagedBot();\n\t}\n\n\tpublic void DestroyAllBots()\n\t{\n\t\tif ( !Networking.IsHost || Scene is null )\n\t\t\treturn;\n\n\t\tforeach (\n\t\t\tOMRBotController bot in\n\t\t\t\tScene\n\t\t\t\t\t.GetAllComponents\u003COMRBotController\u003E()\n\t\t\t\t\t.ToArray()\n\t\t)\n\t\t{\n\t\t\tif (\n\t\t\t\tbot?.GameObject is null ||\n\t\t\t\tbot.GameObject.IsDestroyed\n\t\t\t)\n\t\t\t\tcontinue;\n\n\t\t\tif ( LogLifecycle )\n\t\t\t{\n\t\t\t\tLog.Info(\n\t\t\t\t\t$\u0022[OMR BOT] Destroying \u0027{bot.GameObject.Name}\u0027\u0022\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tbot.GameObject.Destroy();\n\t\t}\n\t}\n\n\tprivate void SyncNavigationMesh()\n\t{\n\t\tif (\n\t\t\tRoundManager is null ||\n\t\t\tScene?.NavMesh is null\n\t\t)\n\t\t\treturn;\n\n\t\tbool sandboxNavigationRequested =\n\t\t\tRoundManager.Mode == SessionMode.Sandbox \u0026\u0026\n\t\t\tRoundManager.SandboxBotEnabled \u0026\u0026\n\t\t\tRoundManager.SandboxBotBehavior != OMRBotBehaviorMode.Stationary;\n\n\t\tbool matchNavigationRequested =\n\t\t\tRoundManager.Mode == SessionMode.Match \u0026\u0026\n\t\t\tRoundManager.MatchBotEnabled;\n\n\t\tbool navigationRequested = sandboxNavigationRequested || matchNavigationRequested;\n\n\t\tScene.NavMesh.DrawMesh =\n\t\t\tRoundManager.Mode == SessionMode.Sandbox \u0026\u0026 RoundManager.SandboxBotDrawNavMesh;\n\n\t\tif ( !navigationRequested )\n\t\t{\n\t\t\t_navigationRebuildPending = false;\n\t\t\t_pendingNavigationLayoutState = ArenaLayoutState.Invalid;\n\t\t\treturn;\n\t\t}\n\n\t\tif ( !_navigationMeshConfigured )\n\t\t{\n\t\t\tScene.NavMesh.IsEnabled = true;\n\t\t\tScene.NavMesh.IncludeStaticBodies = true;\n\t\t\tScene.NavMesh.IncludeKeyframedBodies = true;\n\t\t\tScene.NavMesh.DeferGeneration = true;\n\t\t\t// Dynamic player capsules and triggers are never arena geometry.\n\t\t\tScene.NavMesh.ExcludedBodies.Add( \u0022player\u0022 );\n\t\t\tScene.NavMesh.ExcludedBodies.Add( \u0022playercontroller\u0022 );\n\t\t\tScene.NavMesh.ExcludedBodies.Add( \u0022trigger\u0022 );\n\n\t\t\t// Match the authored player capsule instead of the older generic\n\t\t\t// scene defaults. This preserves realistic clearance around cover.\n\t\t\tScene.NavMesh.AgentHeight = 72f;\n\t\t\tScene.NavMesh.AgentRadius = 20f;\n\t\t\tScene.NavMesh.AgentStepSize = 18f;\n\t\t\tScene.NavMesh.AgentMaxSlope = 40f;\n\n\t\t\t_navigationMeshConfigured = true;\n\t\t}\n\n\t\tArenaLayoutState layoutState =\n\t\t\tRoundManager.Arena?.CurrentLayoutState ??\n\t\t\tArenaLayoutState.Invalid;\n\n\t\t// Finish/log an explicit generation request before considering another.\n\t\tif ( _navigationGenerationTask is not null )\n\t\t{\n\t\t\tif ( !_navigationGenerationTask.IsCompleted )\n\t\t\t\treturn;\n\n\t\t\tbool generated = false;\n\n\t\t\tif ( _navigationGenerationTask.Status == TaskStatus.RanToCompletion )\n\t\t\t\tgenerated = _navigationGenerationTask.Result;\n\n\t\t\tif ( LogLifecycle )\n\t\t\t{\n\t\t\t\tVector3? samplePoint =\n\t\t\t\t\tgenerated ? Scene.NavMesh.GetRandomPoint() : null;\n\n\t\t\t\tstring sampleText =\n\t\t\t\t\tsamplePoint is null\n\t\t\t\t\t\t? \u0022NONE\u0022\n\t\t\t\t\t\t: samplePoint.Value.ToString();\n\n\t\t\t\tLog.Info(\n\t\t\t\t\t$\u0022[OMR BOT] NavMesh generation finished | Layout:{_generatingNavigationLayoutState} | Success:{generated} | Dirty:{Scene.NavMesh.IsDirty} | Sample:{sampleText}\u0022\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tif ( generated )\n\t\t\t{\n\t\t\t\t_navigationHasInitialFullBuild = true;\n\t\t\t\t_navigationFailureCount = 0;\n\t\t\t\t_navigationRetryAfter = 0f;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t_lastNavigationLayoutState = ArenaLayoutState.Invalid;\n\t\t\t\t_navigationHasInitialFullBuild = false;\n\t\t\t\t_navigationFailureCount = System.Math.Min( 5, _navigationFailureCount \u002B 1 );\n\t\t\t\t_navigationRetryAfter = Time.Now \u002B System.MathF.Min( 8f, _navigationFailureCount * 1.5f );\n\t\t\t\tif ( _navigationGenerationTask.IsFaulted )\n\t\t\t\t\tLog.Warning( $\u0022[OMR BOT] NavMesh build failed: {_navigationGenerationTask.Exception?.GetBaseException().Message}\u0022 );\n\t\t\t}\n\t\t\t_navigationGenerationTask = null;\n\t\t\t_generatingNavigationLayoutState = ArenaLayoutState.Invalid;\n\t\t}\n\n\t\tif ( _incrementalNavigationRefreshPending \u0026\u0026 Time.Now \u003E= _incrementalNavigationQueuedAt \u002B 0.25f \u0026\u0026 !Scene.NavMesh.IsGenerating )\n\t\t{\n\t\t\tif ( LogLifecycle )\n\t\t\t{\n\t\t\t\tLog.Info(\n\t\t\t\t\t$\u0022[OMR BOT] NavMesh incremental refresh settled | Layout:{_incrementalNavigationLayoutState}\u0022\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t_incrementalNavigationRefreshPending = false;\n\t\t\t_incrementalNavigationLayoutState = ArenaLayoutState.Invalid;\n\t\t}\n\n\t\tif ( layoutState.IsValid \u0026\u0026 layoutState != _lastNavigationLayoutState )\n\t\t{\n\t\t\t_lastNavigationLayoutState = layoutState;\n\n\t\t\t// Arena pieces are cloned at runtime. Give their physics shapes a few\n\t\t\t// frames to enter the PhysicsWorld before generating Recast data.\n\t\t\t_pendingNavigationLayoutState = layoutState;\n\t\t\t_navigationRebuildPending = true;\n\t\t\t_navigationRebuildAt = System.MathF.Max( Time.Now \u002B 0.40f, _navigationRetryAfter );\n\n\t\t\tif ( LogLifecycle )\n\t\t\t{\n\t\t\t\tLog.Info(\n\t\t\t\t\t$\u0022[OMR BOT] NavMesh refresh scheduled | Layout:{layoutState} | Mode:{(_navigationHasInitialFullBuild ? \u0022TILES\u0022 : \u0022FULL\u0022)}\u0022\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\tif (\n\t\t\t_navigationRebuildPending \u0026\u0026\n\t\t\tTime.Now \u003E= _navigationRebuildAt \u0026\u0026\n\t\t\t_navigationGenerationTask is null \u0026\u0026\n\t\t\t!_incrementalNavigationRefreshPending \u0026\u0026\n\t\t\t!Scene.NavMesh.IsGenerating\n\t\t)\n\t\t{\n\t\t\t_navigationRebuildPending = false;\n\t\t\t_generatingNavigationLayoutState = _pendingNavigationLayoutState;\n\t\t\t_pendingNavigationLayoutState = ArenaLayoutState.Invalid;\n\n\t\t\tif ( !_navigationHasInitialFullBuild )\n\t\t\t{\n\t\t\t\t// The first bot-active layout needs a complete build. Subsequent modular\n\t\t\t\t// swaps keep the arena bounds and refresh the overlapping tiles instead\n\t\t\t\t// of repeatedly rebuilding all Recast data between rounds.\n\t\t\t\t_navigationGenerationTask =\n\t\t\t\t\tScene.NavMesh.Generate( Scene.PhysicsWorld );\n\n\t\t\t\tif ( LogLifecycle )\n\t\t\t\t{\n\t\t\t\t\tLog.Info(\n\t\t\t\t\t\t$\u0022[OMR BOT] NavMesh full generation started | Layout:{_generatingNavigationLayoutState}\u0022\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tScene.NavMesh.RequestTilesGeneration( Scene.NavMesh.Bounds );\n\t\t\t\t_incrementalNavigationQueuedAt = Time.Now;\n\t\t\t\t_incrementalNavigationRefreshPending = true;\n\t\t\t\t_incrementalNavigationLayoutState = _generatingNavigationLayoutState;\n\t\t\t\t_generatingNavigationLayoutState = ArenaLayoutState.Invalid;\n\n\t\t\t\tif ( LogLifecycle )\n\t\t\t\t{\n\t\t\t\t\tLog.Info(\n\t\t\t\t\t\t$\u0022[OMR BOT] NavMesh incremental tile refresh queued | Layout:{_incrementalNavigationLayoutState}\u0022\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate void SyncManagedBot()\n\t{\n\t\tRoundManager ??= Components.Get\u003CRoundManager\u003E();\n\t\tif ( RoundManager is null || Scene is null )\n\t\t\treturn;\n\n\t\tList\u003COMRBotController\u003E bots = _managedBots;\n\t\tList\u003CPlayerState\u003E humans = _managedHumans;\n\t\tbots.Clear(); humans.Clear();\n\t\tforeach ( OMRBotController bot in Scene.GetAllComponents\u003COMRBotController\u003E() )\n\t\t\tif ( bot?.IsValid == true \u0026\u0026 bot.GameObject is not null \u0026\u0026 !bot.GameObject.IsDestroyed ) bots.Add( bot );\n\t\tforeach ( PlayerState human in Scene.GetAllComponents\u003CPlayerState\u003E() )\n\t\t\tif ( human?.IsValid == true \u0026\u0026 !human.IsBot ) humans.Add( human );\n\n\t\tbool sandboxRequested =\n\t\t\tRoundManager.Mode == SessionMode.Sandbox \u0026\u0026\n\t\t\tRoundManager.SandboxBotEnabled \u0026\u0026\n\t\t\thumans.Count \u003C 2;\n\t\tbool matchRequested =\n\t\t\tRoundManager.Mode == SessionMode.Match \u0026\u0026\n\t\t\tRoundManager.MatchBotEnabled \u0026\u0026\n\t\t\thumans.Count == 1;\n\t\tbool shouldHaveBot = sandboxRequested || matchRequested;\n\n\t\tif ( !shouldHaveBot )\n\t\t{\n\t\t\tif ( bots.Count \u003E 0 ) DestroyAllBots();\n\t\t\treturn;\n\t\t}\n\n\t\tfor ( int index = bots.Count - 1; index \u003E= 1; index-- )\n\t\t{\n\t\t\tbots[index].GameObject.Destroy();\n\t\t\tbots.RemoveAt( index );\n\t\t}\n\n\t\tOMRBotDifficulty difficulty = matchRequested ? RoundManager.MatchBotDifficulty : RoundManager.SandboxBotDifficulty;\n\t\tOMRBotBehaviorMode behavior = matchRequested ? OMRBotBehaviorMode.TacticalCombat : RoundManager.SandboxBotBehavior;\n\t\tstring name = matchRequested ? RoundManager.MatchBotName : RoundManager.SandboxBotName;\n\n\t\tif ( bots.Count == 0 )\n\t\t{\n\t\t\tSpawnManagedBot( name, difficulty, behavior, matchRequested );\n\t\t\treturn;\n\t\t}\n\n\t\tOMRBotController existing = bots[0];\n\t\texisting.Configure( 0, difficulty, behavior );\n\t\tPlayerState existingState = existing.Components.Get\u003CPlayerState\u003E( true );\n\t\tif ( existingState is not null )\n\t\t{\n\t\t\texistingState.BotDisplayName = name;\n\t\t\tint desiredTeam = ResolveSandboxBotTeam();\n\t\t\tif ( desiredTeam \u003E= 0 ) existingState.TeamId = desiredTeam;\n\t\t}\n\t}\n\n\tprivate int ResolveSandboxBotTeam()\n\t{\n\t\tPlayerState human = _managedHumans.FirstOrDefault( x =\u003E x.IsValid \u0026\u0026 !x.IsBot );\n\n\t\tif ( human?.TeamId == 1 )\n\t\t\treturn 0;\n\n\t\t// Unassigned/Team A humans default to the conventional Team B bot slot.\n\t\treturn 1;\n\t}\n\n\tprivate void SpawnManagedBot( string botName, OMRBotDifficulty difficulty, OMRBotBehaviorMode behavior, bool competitiveMatch )\n\t{\n\t\tif (\n\t\t\t!Networking.IsHost ||\n\t\t\tRoundManager is null ||\n\t\t\tstring.IsNullOrWhiteSpace( PlayerPrefabPath )\n\t\t)\n\t\t\treturn;\n\n\t\tint botTeam =\n\t\t\tResolveSandboxBotTeam();\n\n\t\tGameObject spawn =\n\t\t\tbotTeam == 0\n\t\t\t\t? RoundManager.SpawnA\n\t\t\t\t: RoundManager.SpawnB;\n\n\t\tTransform spawnTransform =\n\t\t\tspawn is not null\n\t\t\t\t? spawn.WorldTransform.WithScale( 1f )\n\t\t\t\t: WorldTransform.WithScale( 1f );\n\n\t\tGameObject bot =\n\t\t\tGameObject.Clone(\n\t\t\t\tPlayerPrefabPath,\n\t\t\t\tnew CloneConfig\n\t\t\t\t{\n\t\t\t\t\tName = $\u0022Bot - {botName}\u0022,\n\t\t\t\t\tStartEnabled = false,\n\t\t\t\t\tTransform = spawnTransform\n\t\t\t\t}\n\t\t\t);\n\n\t\tif ( bot is null || !bot.IsValid )\n\t\t{\n\t\t\tLog.Error(\n\t\t\t\t$\u0022[OMR BOT] Could not clone player prefab \u0027{PlayerPrefabPath}\u0027.\u0022\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\n\t\t// The clone is intentionally created with StartEnabled = false so none of\n\t\t// the human-player components start running before bot ownership/input is\n\t\t// configured. ComponentList.Get() ignores inactive components by default,\n\t\t// so every pre-NetworkSpawn lookup here must include disabled components.\n\t\tPlayerState state =\n\t\t\tbot.Components.Get\u003CPlayerState\u003E( true );\n\n\t\tif ( state is null )\n\t\t{\n\t\t\tLog.Error(\n\t\t\t\t\u0022[OMR BOT] Player prefab has no PlayerState.\u0022\n\t\t\t);\n\t\t\tbot.Destroy();\n\t\t\treturn;\n\t\t}\n\n\t\tstate.IsBot = true;\n\t\tstate.BotDisplayName = botName;\n\t\tstate.TeamId = botTeam;\n\t\tstate.PreMatchState =\n\t\t\tPreMatchPlayerState.Lobby;\n\n\t\tPlayerController playerController =\n\t\t\tbot.Components.Get\u003CPlayerController\u003E( true );\n\n\t\tif ( playerController is not null )\n\t\t{\n\t\t\tplayerController.UseInputControls = false;\n\t\t\tplayerController.UseLookControls = false;\n\t\t\tplayerController.UseCameraControls = false;\n\n\t\t\t// A bot is host-owned, but visually it is always another third-person\n\t\t\t// competitor. Never let ownership-based first-person hiding make its\n\t\t\t// Citizen body disappear for the host tester.\n\t\t\tplayerController.HideBodyInFirstPerson = false;\n\t\t}\n\n\t\t// OMR keeps CalculatePath points as input for the shared PlayerLocomotion\n\t\t// pipeline. The historical NavMeshAgent transform bug (#11811) was fixed\n\t\t// by S\u0026box on 2026-09-15; retaining input-driven motion is an architectural\n\t\t// choice, not a workaround for a current engine defect.\n\n\t\t// These components exist for the human owner experience only. Keeping\n\t\t// them disabled on a host-controlled bot prevents a second local camera,\n\t\t// settings path, hitmarker path or inventory-input reader from attaching\n\t\t// itself to the host.\n\t\tPlayerInventoryInput inventoryInput =\n\t\t\tbot.Components.Get\u003CPlayerInventoryInput\u003E( true );\n\n\t\tif ( inventoryInput is not null )\n\t\t\tinventoryInput.Enabled = false;\n\n\t\tPlayerCameraFeel cameraFeel =\n\t\t\tbot.Components.Get\u003CPlayerCameraFeel\u003E( true );\n\n\t\tif ( cameraFeel is not null )\n\t\t\tcameraFeel.Enabled = false;\n\n\t\tPlayerCombatFeedback combatFeedback =\n\t\t\tbot.Components.Get\u003CPlayerCombatFeedback\u003E( true );\n\n\t\tif ( combatFeedback is not null )\n\t\t\tcombatFeedback.Enabled = false;\n\n\t\tDresser dresser =\n\t\t\tbot.Components.Get\u003CDresser\u003E( true );\n\n\t\tif ( dresser is not null )\n\t\t{\n\t\t\tdresser.Source =\n\t\t\t\tDresser.ClothingSource.Manual;\n\t\t\tdresser.RemoveUnownedItems = false;\n\t\t\tdresser.Randomize();\n\t\t}\n\n\t\tOMRBotController botController =\n\t\t\tbot.Components.Get\u003COMRBotController\u003E( true );\n\n\t\tbotController ??=\n\t\t\tbot.AddComponent\u003COMRBotController\u003E();\n\n\t\tbotController.Configure(\n\t\t\t0,\n\t\t\tdifficulty,\n\t\t\tbehavior\n\t\t);\n\n\t\t// No connection argument: the host owns/simulates this networked player.\n\t\t// This is the same player-bot pattern used by released S\u0026box games such\n\t\t// as Dropout, while avoiding fake/debug Connection objects.\n\t\tif ( !bot.NetworkSpawn() )\n\t\t{\n\t\t\tLog.Error(\n\t\t\t\t\u0022[OMR BOT] NetworkSpawn failed.\u0022\n\t\t\t);\n\t\t\tbot.Destroy();\n\t\t\treturn;\n\t\t}\n\n\t\tif ( LogLifecycle )\n\t\t{\n\t\t\tLog.Info(\n\t\t\t\t$\u0022[OMR BOT] Spawned {state.BotDisplayName} | Team:{botTeam} | Difficulty:{difficulty} | Behavior:{behavior} | Match:{competitiveMatch}\u0022\n\t\t\t);\n\t\t}\n\t}\n}\n"},{"Ident":"lfinchgames.oneplusround","Path":"OMRPlayerSettings.cs","FileName":"OMRPlayerSettings.cs","PackageType":"game","CodeKind":"Game","AssetVersionId":399243,"IsPrivate":false,"Code":"using Sandbox;\nusing System;\nusing System.Linq;\n\n/// \u003Csummary\u003E\n/// Local One More Round player preferences.\n///\n/// The current local s\u0026box build exposes Sandbox.Preferences values\n/// as readable engine preferences, but they are not assignable from\n/// game code. OMR therefore stores its own game-specific values in\n/// Game.Cookies and applies them on top of the engine\u0027s normal input\n/// and camera pipeline.\n/// \u003C/summary\u003E\npublic static class OMRPlayerSettings\n{\n\tprivate const string SensitivityKey =\n\t\t\u0022omr.settings.look_sensitivity\u0022;\n\n\tprivate const string FieldOfViewKey =\n\t\t\u0022omr.settings.field_of_view\u0022;\n\n\tprivate const string CrouchBehaviorKey =\n\t\t\u0022omr.settings.crouch_behavior\u0022;\n\n\tprivate const string SprintBehaviorKey =\n\t\t\u0022omr.settings.sprint_behavior\u0022;\n\n\t/// \u003Csummary\u003E\n\t/// Game-specific multiplier applied after the player\u0027s normal\n\t/// s\u0026box sensitivity preference.\n\t/// \u003C/summary\u003E\n\tpublic const float MinimumSensitivity =\n\t\t0.10f;\n\n\tpublic const float MaximumSensitivity =\n\t\t5.00f;\n\n\tpublic const float MinimumFieldOfView =\n\t\t60f;\n\n\tpublic const float MaximumFieldOfView =\n\t\t100f;\n\n\tpublic static float Sensitivity\n\t{\n\t\tget\n\t\t{\n\t\t\tfloat value =\n\t\t\t\tGame.Cookies.Get(\n\t\t\t\t\tSensitivityKey,\n\t\t\t\t\t1.0f\n\t\t\t\t);\n\n\t\t\treturn MathX.Clamp(\n\t\t\t\tvalue,\n\t\t\t\tMinimumSensitivity,\n\t\t\t\tMaximumSensitivity\n\t\t\t);\n\t\t}\n\n\t\tset\n\t\t{\n\t\t\tGame.Cookies.Set(\n\t\t\t\tSensitivityKey,\n\t\t\t\tMathX.Clamp(\n\t\t\t\t\tvalue,\n\t\t\t\t\tMinimumSensitivity,\n\t\t\t\t\tMaximumSensitivity\n\t\t\t\t)\n\t\t\t);\n\t\t}\n\t}\n\n\tpublic static float FieldOfView\n\t{\n\t\tget\n\t\t{\n\t\t\tfloat defaultFov =\n\t\t\t\tMathX.Clamp(\n\t\t\t\t\tPreferences.FieldOfView,\n\t\t\t\t\tMinimumFieldOfView,\n\t\t\t\t\tMaximumFieldOfView\n\t\t\t\t);\n\n\t\t\tfloat value =\n\t\t\t\tGame.Cookies.Get(\n\t\t\t\t\tFieldOfViewKey,\n\t\t\t\t\tdefaultFov\n\t\t\t\t);\n\n\t\t\treturn MathX.Clamp(\n\t\t\t\tvalue,\n\t\t\t\tMinimumFieldOfView,\n\t\t\t\tMaximumFieldOfView\n\t\t\t);\n\t\t}\n\n\t\tset\n\t\t{\n\t\t\tGame.Cookies.Set(\n\t\t\t\tFieldOfViewKey,\n\t\t\t\tMathX.Clamp(\n\t\t\t\t\tvalue,\n\t\t\t\t\tMinimumFieldOfView,\n\t\t\t\t\tMaximumFieldOfView\n\t\t\t\t)\n\t\t\t);\n\t\t}\n\t}\n\n\tpublic static CrouchBehavior CrouchBehavior\n\t{\n\t\tget\n\t\t{\n\t\t\tint raw =\n\t\t\t\tGame.Cookies.Get(\n\t\t\t\t\tCrouchBehaviorKey,\n\t\t\t\t\t(int)CrouchBehavior.Toggle\n\t\t\t\t);\n\n\t\t\treturn Enum.IsDefined(\n\t\t\t\ttypeof( CrouchBehavior ),\n\t\t\t\traw\n\t\t\t)\n\t\t\t\t? (CrouchBehavior)raw\n\t\t\t\t: CrouchBehavior.Toggle;\n\t\t}\n\n\t\tset\n\t\t{\n\t\t\tGame.Cookies.Set(\n\t\t\t\tCrouchBehaviorKey,\n\t\t\t\t(int)value\n\t\t\t);\n\n\t\t\tApplyToLocalPlayer();\n\t\t}\n\t}\n\n\tpublic static SprintInputBehavior SprintBehavior\n\t{\n\t\tget\n\t\t{\n\t\t\tint raw =\n\t\t\t\tGame.Cookies.Get(\n\t\t\t\t\tSprintBehaviorKey,\n\t\t\t\t\t(int)SprintInputBehavior.Hybrid\n\t\t\t\t);\n\n\t\t\treturn Enum.IsDefined(\n\t\t\t\ttypeof( SprintInputBehavior ),\n\t\t\t\traw\n\t\t\t)\n\t\t\t\t? (SprintInputBehavior)raw\n\t\t\t\t: SprintInputBehavior.Hybrid;\n\t\t}\n\n\t\tset\n\t\t{\n\t\t\tGame.Cookies.Set(\n\t\t\t\tSprintBehaviorKey,\n\t\t\t\t(int)value\n\t\t\t);\n\n\t\t\tApplyToLocalPlayer();\n\t\t}\n\t}\n\n\tpublic static void ResetDefaults()\n\t{\n\t\tGame.Cookies.Set(\n\t\t\tSensitivityKey,\n\t\t\t1.0f\n\t\t);\n\n\t\tGame.Cookies.Set(\n\t\t\tFieldOfViewKey,\n\t\t\t80f\n\t\t);\n\n\t\tGame.Cookies.Set(\n\t\t\tCrouchBehaviorKey,\n\t\t\t(int)CrouchBehavior.Toggle\n\t\t);\n\n\t\tGame.Cookies.Set(\n\t\t\tSprintBehaviorKey,\n\t\t\t(int)SprintInputBehavior.Hybrid\n\t\t);\n\n\t\tApplyToLocalPlayer();\n\t}\n\n\tpublic static void ApplyToLocalPlayer()\n\t{\n\t\tScene scene =\n\t\t\tGame.ActiveScene;\n\n\t\tif ( scene is null )\n\t\t\treturn;\n\n\t\tPlayerState localPlayer =\n\t\t\tscene\n\t\t\t\t.GetAllComponents\u003CPlayerState\u003E()\n\t\t\t\t.FirstOrDefault(\n\t\t\t\t\tx =\u003E\n\t\t\t\t\t\t!x.IsProxy \u0026\u0026\n\t\t\t\t\t!x.IsBot\n\t\t\t\t);\n\n\t\tif ( localPlayer is null )\n\t\t\treturn;\n\n\t\tApplyToPlayer(\n\t\t\tlocalPlayer.GameObject\n\t\t);\n\t}\n\n\tpublic static void ApplyToPlayer(\n\t\tGameObject player\n\t)\n\t{\n\t\tif ( player is null )\n\t\t\treturn;\n\n\t\tPlayerCrouch crouch =\n\t\t\tplayer.Components.Get\u003CPlayerCrouch\u003E();\n\n\t\tif ( crouch is not null )\n\t\t{\n\t\t\tcrouch.Behavior =\n\t\t\t\tCrouchBehavior;\n\t\t}\n\n\t\tPlayerSprint sprint =\n\t\t\tplayer.Components.Get\u003CPlayerSprint\u003E();\n\n\t\tif ( sprint is not null )\n\t\t{\n\t\t\tsprint.Behavior =\n\t\t\t\tSprintBehavior;\n\t\t}\n\t}\n}\n"},{"Ident":"lfinchgames.oneplusround","Path":"OMRRecoilPattern.cs","FileName":"OMRRecoilPattern.cs","PackageType":"game","CodeKind":"Game","AssetVersionId":399243,"IsPrivate":false,"Code":"using Sandbox;\nusing System;\n\n/// \u003Csummary\u003E\n/// Reusable authored recoil trajectory.\n///\n/// The curves describe cumulative aim displacement across the whole spray:\n/// - Vertical Rise is positive-up, in degrees.\n/// - Horizontal Drift is signed yaw displacement, in degrees.\n///\n/// Runtime recoil is derived from the difference between consecutive samples,\n/// so designers can draw the desired overall spray path instead of entering a\n/// pitch/yaw delta for every individual shot.\n/// \u003C/summary\u003E\n[AssetType(\n\tName = \u0022OMR Recoil Pattern\u0022,\n\tExtension = \u0022omrcoil\u0022,\n\tCategory = \u0022One More Round/Weapons\u0022\n)]\npublic sealed partial class OMRRecoilPattern : GameResource\n{\n\t[Group( \u0022Pattern\u0022 ), Range( 1, 200 ), Description( \u0022Number of shots represented by the complete 0..1 curve range.\u0022 )]\n\tpublic int ShotCount { get; set; } = 30;\n\n\t[Group( \u0022Trajectory\u0022 ), Title( \u0022Vertical Rise\u0022 )]\n\t[Description( \u0022Cumulative upward aim displacement in degrees. Keep the curve near 0 at time 0; larger values mean the spray has climbed farther upward.\u0022 )]\n\t[TimeRange( 0f, 1f )]\n\t[ValueRange( 0f, 16f )]\n\tpublic Curve VerticalRise { get; set; } = new Curve(\n\t\tnew Curve.Frame( 0f, 0f ),\n\t\tnew Curve.Frame( 1f, 9f )\n\t);\n\n\t[Group( \u0022Trajectory\u0022 ), Title( \u0022Horizontal Drift\u0022 )]\n\t[Description( \u0022Cumulative horizontal yaw displacement in degrees. Positive and negative values move the trajectory to opposite sides.\u0022 )]\n\t[TimeRange( 0f, 1f )]\n\t[ValueRange( -2f, 2f )]\n\tpublic Curve HorizontalDrift { get; set; } = new Curve(\n\t\tnew Curve.Frame( 0f, 0f ),\n\t\tnew Curve.Frame( 1f, 0f )\n\t);\n\n\t/// \u003Csummary\u003E\n\t/// Returns the gameplay pitch/yaw kick for a zero-based shot index.\n\t/// Negative pitch moves aim upward in the current OMR convention.\n\t/// \u003C/summary\u003E\n\tpublic Vector2 GetKickForShot( int shotIndex, bool loop )\n\t{\n\t\tint count = Math.Max( ShotCount, 1 );\n\t\tint index;\n\n\t\tif ( loop )\n\t\t{\n\t\t\tindex = PositiveModulo( shotIndex, count );\n\t\t}\n\t\telse\n\t\t{\n\t\t\t// Preserve the previous list-pattern behavior: after the authored\n\t\t\t// pattern is exhausted, keep repeating the final authored kick.\n\t\t\tindex = Math.Min( Math.Max( shotIndex, 0 ), count - 1 );\n\t\t}\n\n\t\tfloat previousProgress = index / (float)count;\n\t\tfloat currentProgress = (index \u002B 1) / (float)count;\n\n\t\tfloat previousRise = VerticalRise.Evaluate( previousProgress );\n\t\tfloat currentRise = VerticalRise.Evaluate( currentProgress );\n\t\tfloat previousDrift = HorizontalDrift.Evaluate( previousProgress );\n\t\tfloat currentDrift = HorizontalDrift.Evaluate( currentProgress );\n\n\t\tfloat riseDelta = currentRise - previousRise;\n\t\tfloat yawDelta = currentDrift - previousDrift;\n\n\t\treturn new Vector2(\n\t\t\t-riseDelta,\n\t\t\tyawDelta\n\t\t);\n\t}\n\n\t/// \u003Csummary\u003E\n\t/// Cumulative trajectory sample, useful for diagnostics and future editor\n\t/// previews. X = upward rise in degrees, Y = horizontal drift in degrees.\n\t/// \u003C/summary\u003E\n\tpublic Vector2 EvaluateTrajectory( float progress )\n\t{\n\t\tfloat t = MathX.Clamp( progress, 0f, 1f );\n\n\t\treturn new Vector2(\n\t\t\tVerticalRise.Evaluate( t ),\n\t\t\tHorizontalDrift.Evaluate( t )\n\t\t);\n\t}\n\n\tprivate static int PositiveModulo( int value, int modulus )\n\t{\n\t\tif ( modulus \u003C= 0 )\n\t\t\treturn 0;\n\n\t\tint result = value % modulus;\n\t\treturn result \u003C 0 ? result \u002B modulus : result;\n\t}\n}\n"},{"Ident":"lfinchgames.oneplusround","Path":"OMRViewModelAimAlignment.cs","FileName":"OMRViewModelAimAlignment.cs","PackageType":"game","CodeKind":"Game","AssetVersionId":399243,"IsPrivate":false,"Code":"using Sandbox;\nusing System;\n\n/// \u003Csummary\u003E\n/// Attachment-aware ADS correction applied from OneMoreRoundWeapon.PlaceViewModel.\n///\n/// IMPORTANT: this class never samples a world-space bone after the viewmodel root has\n/// been moved. OneMoreRoundWeapon supplies a root-relative lens pose captured before\n/// BaseCombatWeapon.PlaceViewModel. That makes centering independent of the previous\n/// frame\u0027s root transform and avoids the A/B oscillation that was visible while strafing.\n/// \u003C/summary\u003E\n[Title( \u0022OMR Viewmodel Aim Alignment\u0022 )]\npublic sealed class OMRViewModelAimAlignment : Component\n{\n\t[Property, Group( \u0022Diagnostics\u0022 )]\n\tpublic bool LogCorrection { get; set; } = false;\n\n\tpublic float CurrentBlend { get; private set; }\n\tpublic Vector3 CurrentCorrection { get; private set; }\n\tpublic bool HasCapturedEyeRelief { get; private set; }\n\tpublic bool EyeReliefGuardActive { get; private set; }\n\tpublic float CapturedEyeReliefDepth { get; private set; }\n\tpublic float CurrentEyeReliefDepth { get; private set; }\n\tprivate float _nextLogAt;\n\n\tpublic void ApplyAlignment(\n\t\tOneMoreRoundWeapon weapon,\n\t\tCameraComponent camera,\n\t\tin CameraView view,\n\t\tin OMRViewModelBoneAnchor.RootRelativePose alignmentPose\n\t)\n\t{\n\t\tCurrentBlend = 0f;\n\t\tCurrentCorrection = Vector3.Zero;\n\t\tEyeReliefGuardActive = false;\n\n\t\tif (\n\t\t\tweapon is null ||\n\t\t\t!weapon.IsValid ||\n\t\t\tcamera is null ||\n\t\t\t!camera.IsValid ||\n\t\t\tScene is null ||\n\t\t\tScene.Camera != camera ||\n\t\t\tweapon.ViewModel != GameObject\n\t\t)\n\t\t{\n\t\t\tResetEyeReliefCapture();\n\t\t\treturn;\n\t\t}\n\n\t\tOMROpticProfile profile = weapon.ActiveOpticProfile;\n\t\tif (\n\t\t\tprofile is null ||\n\t\t\t!profile.IsValid ||\n\t\t\t!profile.EnableViewModelAimAlignment\n\t\t)\n\t\t{\n\t\t\tResetEyeReliefCapture();\n\t\t\treturn;\n\t\t}\n\n\t\tif ( !profile.ProtectViewModelEyeRelief \u0026\u0026 HasCapturedEyeRelief )\n\t\t{\n\t\t\tResetEyeReliefCapture();\n\t\t}\n\n\t\tfloat blend = ResolveBlend( weapon.AimFraction, profile );\n\t\tCurrentBlend = blend;\n\n\t\tfloat alignmentStart = MathX.Clamp(\n\t\t\tprofile.ViewModelAimAlignmentStart,\n\t\t\t0f,\n\t\t\t1f\n\t\t);\n\n\t\tif ( weapon.AimFraction \u003C= alignmentStart \u002B 0.0001f )\n\t\t{\n\t\t\tResetEyeReliefCapture();\n\t\t}\n\n\t\tif ( blend \u003C= 0.0001f )\n\t\t\treturn;\n\n\t\t// BaseCombatWeapon has already pinned the root to this frame\u0027s final CameraView.\n\t\t// Rebuild the current optical-center position from the CURRENT root plus the\n\t\t// root-relative animated pose captured before the root moved.\n\t\tVector3 predictedAnchorWorld = GameObject.WorldTransform.PointToWorld(\n\t\t\talignmentPose.Position\n\t\t);\n\n\t\tRotation cameraRotation = view.Rotation;\n\t\tVector3 cameraPosition = view.Position;\n\t\tVector3 cameraToAnchor = predictedAnchorWorld - cameraPosition;\n\n\t\tfloat currentRight = Vector3.Dot(\n\t\t\tcameraToAnchor,\n\t\t\tcameraRotation.Right\n\t\t);\n\n\t\tfloat currentUp = Vector3.Dot(\n\t\t\tcameraToAnchor,\n\t\t\tcameraRotation.Up\n\t\t);\n\n\t\tfloat currentForward = Vector3.Dot(\n\t\t\tcameraToAnchor,\n\t\t\tcameraRotation.Forward\n\t\t);\n\n\t\tCurrentEyeReliefDepth = currentForward;\n\n\t\tfloat depthCorrection = profile.ViewModelAimDepthOffset;\n\n\t\tif ( profile.ProtectViewModelEyeRelief )\n\t\t{\n\t\t\tfloat captureThreshold = MathX.Clamp(\n\t\t\t\tprofile.ViewModelEyeReliefCaptureThreshold,\n\t\t\t\t0f,\n\t\t\t\t1f\n\t\t\t);\n\n\t\t\tif (\n\t\t\t\t!HasCapturedEyeRelief \u0026\u0026\n\t\t\t\tweapon.AimFraction \u003E= captureThreshold\n\t\t\t)\n\t\t\t{\n\t\t\t\tHasCapturedEyeRelief = true;\n\t\t\t\tCapturedEyeReliefDepth = currentForward;\n\t\t\t}\n\n\t\t\tif ( HasCapturedEyeRelief )\n\t\t\t{\n\t\t\t\tfloat tolerance = MathF.Max(\n\t\t\t\t\tprofile.ViewModelEyeReliefTolerance,\n\t\t\t\t\t0f\n\t\t\t\t);\n\n\t\t\t\tfloat minimumDepth =\n\t\t\t\t\tCapturedEyeReliefDepth - tolerance;\n\n\t\t\t\tif ( currentForward \u003C minimumDepth )\n\t\t\t\t{\n\t\t\t\t\tdepthCorrection \u002B= minimumDepth - currentForward;\n\t\t\t\t\tEyeReliefGuardActive = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tVector2 target = profile.ViewModelAimScreenOffset;\n\n\t\tVector3 fullCorrection =\n\t\t\tcameraRotation.Right * (target.x - currentRight) \u002B\n\t\t\tcameraRotation.Up * (target.y - currentUp) \u002B\n\t\t\tcameraRotation.Forward * depthCorrection;\n\n\t\tVector3 applied = fullCorrection * blend;\n\n\t\t// Always rebuild from the canonical camera baseline. Never \u002B= the previous\n\t\t// root transform, and never measure against a helper that we just moved.\n\t\tGameObject.WorldPosition = cameraPosition \u002B applied;\n\t\tGameObject.WorldRotation = cameraRotation;\n\n\t\tCurrentCorrection = applied;\n\n\t\tif ( LogCorrection \u0026\u0026 RealTime.Now \u003E= _nextLogAt )\n\t\t{\n\t\t\t_nextLogAt = RealTime.Now \u002B 0.5f;\n\t\t\tLog.Info(\n\t\t\t\t$\u0022[OMR VM ALIGN] Weapon:{weapon.WeaponId} | \u0022 \u002B\n\t\t\t\t$\u0022Aim:{weapon.AimFraction:0.###} | Blend:{blend:0.###} | \u0022 \u002B\n\t\t\t\t$\u0022AnchorPlane:({currentRight:0.###},{currentUp:0.###}) | \u0022 \u002B\n\t\t\t\t$\u0022Depth:{currentForward:0.###} | EyeBase:{(HasCapturedEyeRelief ? CapturedEyeReliefDepth : -1f):0.###} | \u0022 \u002B\n\t\t\t\t$\u0022EyeGuard:{EyeReliefGuardActive} | Correction:{applied}\u0022\n\t\t\t);\n\t\t}\n\t}\n\n\tprivate void ResetEyeReliefCapture()\n\t{\n\t\tHasCapturedEyeRelief = false;\n\t\tEyeReliefGuardActive = false;\n\t\tCapturedEyeReliefDepth = 0f;\n\t}\n\n\tprivate static float ResolveBlend(\n\t\tfloat aimFraction,\n\t\tOMROpticProfile profile\n\t)\n\t{\n\t\tfloat start = MathX.Clamp(\n\t\t\tprofile.ViewModelAimAlignmentStart,\n\t\t\t0f,\n\t\t\t1f\n\t\t);\n\n\t\tfloat full = MathX.Clamp(\n\t\t\tprofile.ViewModelAimAlignmentFull,\n\t\t\tstart,\n\t\t\t1f\n\t\t);\n\n\t\tfloat t;\n\n\t\tif ( full \u003C= start \u002B 0.0001f )\n\t\t{\n\t\t\tt = aimFraction \u003E= full ? 1f : 0f;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tt = MathX.Clamp(\n\t\t\t\t(aimFraction - start) / (full - start),\n\t\t\t\t0f,\n\t\t\t\t1f\n\t\t\t);\n\t\t}\n\n\t\treturn t * t * (3f - 2f * t);\n\t}\n}\n"},{"Ident":"lfinchgames.oneplusround","Path":"OMRVisualFoundation.Bloom.cs","FileName":"OMRVisualFoundation.Bloom.cs","PackageType":"game","CodeKind":"Game","AssetVersionId":399243,"IsPrivate":false,"Code":"using Sandbox;\nusing System;\n\n/// \u003Csummary\u003E\n/// Phase 8F3F3: restrained native HDR bloom for the gameplay world.\n///\n/// This deliberately uses Sandbox.Bloom instead of reproducing the engine\u0027s\n/// multi-resolution bloom chain in an OMR shader. The native implementation\n/// thresholds the HDR scene, builds a six-level half-resolution pyramid and\n/// composites the accumulated glow before later post-processing.\n///\n/// Bloom stays on the authored gameplay/world camera. In OMR\u0027s two-camera\n/// presentation stack that means the world receives bloom while the offscreen\n/// first-person viewmodel remains clean. The later adaptive pixelation/edge\n/// passes can then stylize the already-bloomed world instead of Bloom blurring\n/// their pixel structure afterward.\n/// \u003C/summary\u003E\npublic sealed partial class OMRVisualFoundation\n{\n    [Property, Group( \u0022World Look/Bloom\u0022 ), Title( \u0022Enable Bloom\u0022 )]\n    [Description( \u0022Native HDR bloom for bright world lighting and emissive/high-intensity regions. The local viewmodel remains outside this pass.\u0022 )]\n    public bool EnableBloom { get; set; } = false;\n\n    [Property, Group( \u0022World Look/Bloom\u0022 ), Title( \u0022Mode\u0022 )]\n    public SceneCamera.BloomAccessor.BloomMode BloomMode { get; set; } = SceneCamera.BloomAccessor.BloomMode.Additive;\n\n    [Property, Group( \u0022World Look/Bloom\u0022 ), Range( 0f, 10f ), Title( \u0022Strength\u0022 )]\n    [Description( \u0022Overall bloom contribution. OMR starts deliberately low; high values quickly wash out competitive contrast.\u0022 )]\n    public float BloomStrength { get; set; } = 0.18f;\n\n    [Property, Group( \u0022World Look/Bloom\u0022 ), Range( 0f, 2f ), Title( \u0022Threshold\u0022 )]\n    [Description( \u0022HDR brightness required before a pixel contributes to bloom. Higher values restrict glow to the brightest lights/highlights.\u0022 )]\n    public float BloomThreshold { get; set; } = 1.10f;\n\n    [Property, Group( \u0022World Look/Bloom\u0022 ), Title( \u0022Tint\u0022 )]\n    [Description( \u0022Multiplies the accumulated bloom color. White preserves the authored light colors.\u0022 )]\n    public Color BloomTint { get; set; } = Color.White;\n\n    [Button, Group( \u0022World Look/Bloom\u0022 ), Title( \u0022Subtle Standard Preset\u0022 )]\n    public void ApplyBloomSubtlePreset()\n    {\n        EnableBloom = true;\n        BloomMode = SceneCamera.BloomAccessor.BloomMode.Additive;\n        BloomStrength = 0.18f;\n        BloomThreshold = 1.10f;\n        BloomTint = Color.White;\n        RebuildBloom();\n    }\n\n    [Button, Group( \u0022World Look/Bloom\u0022 ), Title( \u0022Disable Bloom\u0022 )]\n    public void DisableBloom()\n    {\n        EnableBloom = false;\n        RebuildBloom();\n    }\n\n    [Button, Group( \u0022World Look/Bloom\u0022 ), Title( \u0022Setup Bloom Preview\u0022 )]\n    [Description( \u0022Adds/reuses Sandbox.Bloom on the gameplay camera for editor preview and runtime world bloom.\u0022 )]\n    public void SetupBloomPreview()\n    {\n        CameraComponent camera = GetComponent\u003CCameraComponent\u003E( true );\n        if ( camera is null || !camera.IsValid )\n        {\n            Log.Warning(\n                \u0022[OMR VISUAL] Bloom preview setup failed: OMRVisualFoundation must share a GameObject with the gameplay CameraComponent.\u0022\n            );\n            return;\n        }\n\n        ResolveBloomComponent();\n\n        if ( _bloom is null || !_bloom.IsValid )\n        {\n            _bloom = GameObject.AddComponent\u003CBloom\u003E( false );\n            _bloomCreatedByFoundation = false;\n        }\n\n        ApplyBloomSettings();\n\n        Log.Info(\n            $\u0022[OMR VISUAL] Native Bloom ready on \u0027{GameObject.Name}\u0027 | \u0022 \u002B\n            $\u0022Enabled:{_bloom.Enabled} | Mode:{_bloom.Mode} | \u0022 \u002B\n            $\u0022Strength:{_bloom.Strength:0.###} | Threshold:{_bloom.Threshold:0.###}\u0022\n        );\n    }\n\n    private Bloom _bloom;\n    private bool _bloomCreatedByFoundation;\n    private bool _bloomReadyLogged;\n\n    private float EffectiveBloomStrength =\u003E\n        EnableWorldLook \u0026\u0026 EnableBloom\n            ? MathX.Clamp( BloomStrength, 0f, 10f ) * MathX.Clamp( BlendWeight, 0f, 1f )\n            : 0f;\n\n    private void ResetBloomSettings()\n    {\n        EnableBloom = false;\n        BloomMode = SceneCamera.BloomAccessor.BloomMode.Additive;\n        BloomStrength = 0.18f;\n        BloomThreshold = 1.10f;\n        BloomTint = Color.White;\n    }\n\n    private void ResolveBloomComponent()\n    {\n        if ( _bloom is not null \u0026\u0026 _bloom.IsValid )\n            return;\n\n        _bloom = GetComponent\u003CBloom\u003E( true );\n        _bloomCreatedByFoundation = false;\n    }\n\n    private void RebuildBloom()\n    {\n        CameraComponent camera = GetComponent\u003CCameraComponent\u003E( true );\n        if ( camera is null || !camera.IsValid )\n            return;\n\n        ResolveBloomComponent();\n\n        // Do not silently author a component while ExecuteInEditor is ticking.\n        // The patch already includes one, and Setup Bloom Preview is available\n        // for scenes that do not.\n        if ( !Game.IsPlaying )\n        {\n            if ( _bloom is not null \u0026\u0026 _bloom.IsValid )\n                ApplyBloomSettings();\n\n            return;\n        }\n\n        if (\n            EnableBloom \u0026\u0026\n            (_bloom is null || !_bloom.IsValid)\n        )\n        {\n            _bloom = GameObject.AddComponent\u003CBloom\u003E( false );\n            _bloomCreatedByFoundation = true;\n        }\n\n        if ( _bloom is null || !_bloom.IsValid )\n            return;\n\n        ApplyBloomSettings();\n\n        if ( _bloom.Enabled \u0026\u0026 LogSetup \u0026\u0026 !_bloomReadyLogged )\n        {\n            _bloomReadyLogged = true;\n            Log.Info(\n                $\u0022[OMR VISUAL] Native world Bloom active on \u0027{GameObject.Name}\u0027 | \u0022 \u002B\n                $\u0022Mode:{_bloom.Mode} | Strength:{_bloom.Strength:0.###} | \u0022 \u002B\n                $\u0022Threshold:{_bloom.Threshold:0.###} | \u0022 \u002B\n                $\u0022CameraPostProcessing:{camera.EnablePostProcessing}\u0022\n            );\n        }\n\n        if ( !_bloom.Enabled )\n            _bloomReadyLogged = false;\n    }\n\n    private void ApplyBloomSettings()\n    {\n        if ( _bloom is null || !_bloom.IsValid )\n            return;\n\n        _bloom.Mode = BloomMode;\n        _bloom.Strength = EffectiveBloomStrength;\n        _bloom.Threshold = MathX.Clamp( BloomThreshold, 0f, 2f );\n        _bloom.Tint = BloomTint;\n        _bloom.Enabled = EffectiveBloomStrength \u003E 0.0001f;\n    }\n\n    private void ReleaseBloom()\n    {\n        if ( _bloom is not null \u0026\u0026 _bloom.IsValid )\n        {\n            _bloom.Enabled = false;\n\n            if ( _bloomCreatedByFoundation )\n                _bloom.Destroy();\n        }\n\n        _bloom = null;\n        _bloomCreatedByFoundation = false;\n        _bloomReadyLogged = false;\n    }\n}\n"},{"Ident":"lfinchgames.oneplusround","Path":"OneMoreRoundWeapon.Actions.cs","FileName":"OneMoreRoundWeapon.Actions.cs","PackageType":"game","CodeKind":"Game","AssetVersionId":399243,"IsPrivate":false,"Code":"using Sandbox;\n\n/// \u003Csummary\u003E\n/// Mechanical weapon-action gate. Locomotion and ADS remain orthogonal states.\n/// This gives future capabilities such as bolt cycling a real mechanical state\n/// without creating a combinatorial movement/aim state machine.\n/// \u003C/summary\u003E\npublic partial class OneMoreRoundWeapon\n{\n\tprivate OMRWeaponActionState _mechanicalActionState =\n\t\tOMRWeaponActionState.Ready;\n\n\tprivate int _primaryShotsFiredSinceReset;\n\tprivate float _lastPrimaryShotAt = -1f;\n\n\t/// \u003Csummary\u003E\n\t/// Effective action state for gameplay/debugging. Reloading and the existing\n\t/// sprint-to-fire queue are derived from their authoritative/current systems;\n\t/// explicit mechanical state is reserved for capabilities such as Cycling.\n\t/// \u003C/summary\u003E\n\tpublic OMRWeaponActionState ActionState\n\t{\n\t\tget\n\t\t{\n\t\t\tif ( !IsHeld )\n\t\t\t\treturn OMRWeaponActionState.Holstered;\n\n\t\t\tif ( IsReloading )\n\t\t\t\treturn OMRWeaponActionState.Reloading;\n\n\t\t\tif ( IsCyclePendingOrActive )\n\t\t\t\treturn OMRWeaponActionState.Cycling;\n\n\t\t\tif ( _mechanicalActionState != OMRWeaponActionState.Ready )\n\t\t\t\treturn _mechanicalActionState;\n\n\t\t\tif ( _sprintFireQueued )\n\t\t\t\treturn OMRWeaponActionState.SprintToFire;\n\n\t\t\treturn OMRWeaponActionState.Ready;\n\t\t}\n\t}\n\n\tpublic int PrimaryShotsFiredSinceReset =\u003E\n\t\t_primaryShotsFiredSinceReset;\n\n\tpublic float LastPrimaryShotAt =\u003E\n\t\t_lastPrimaryShotAt;\n\n\t/// \u003Csummary\u003E\n\t/// Future reusable capabilities can call this when they own a mutually\n\t/// exclusive mechanical action. Do not use it for ADS/crouch/sprint.\n\t/// \u003C/summary\u003E\n\tinternal void SetMechanicalActionState(\n\t\tOMRWeaponActionState state\n\t)\n\t{\n\t\t_mechanicalActionState = state switch\n\t\t{\n\t\t\tOMRWeaponActionState.Holstered =\u003E OMRWeaponActionState.Ready,\n\t\t\tOMRWeaponActionState.Reloading =\u003E OMRWeaponActionState.Ready,\n\t\t\tOMRWeaponActionState.SprintToFire =\u003E OMRWeaponActionState.Ready,\n\t\t\t_ =\u003E state\n\t\t};\n\n\t}\n\n\tinternal void ClearMechanicalActionState(\n\t\tOMRWeaponActionState expectedState\n\t)\n\t{\n\t\tif ( _mechanicalActionState != expectedState )\n\t\t\treturn;\n\n\t\t_mechanicalActionState = OMRWeaponActionState.Ready;\n\t}\n\n\tprivate void ResetWeaponActionState()\n\t{\n\t\t_mechanicalActionState = OMRWeaponActionState.Ready;\n\t\t_primaryShotsFiredSinceReset = 0;\n\t\t_lastPrimaryShotAt = -1f;\n\t}\n\n\tprivate void RecordPrimaryShot()\n\t{\n\t\t_primaryShotsFiredSinceReset\u002B\u002B;\n\t\t_lastPrimaryShotAt = RealTime.Now;\n\t}\n\n\tprivate bool IsPrimaryBlockedByMechanicalAction()\n\t{\n\t\treturn _mechanicalActionState != OMRWeaponActionState.Ready;\n\t}\n\n\t/// \u003Csummary\u003E\n\t/// BaseCombatWeapon performs the actual shot first so the current projectile\n\t/// uses the pre-recoil aim direction. OMR then records the mechanical action\n\t/// and applies recoil to subsequent aim.\n\t/// \u003C/summary\u003E\n\tpublic override void PrimaryAttack()\n\t{\n\t\t// Capture the synchronized trigger time at the exact point a valid primary\n\t\t// attack is actually committed. High Noon uses this for latency-aware\n\t\t// reaction adjudication; ordinary rounds simply ignore the notification.\n\t\tNotifyRoundPrimaryShotFired();\n\n\t\tInterruptViewModelSprintForAttack();\n\n\t\t// Preserve the scoped fire-animation scale before BaseCombatWeapon\n\t\t// raises b_attack. Bolt-action weapons can leave ADS immediately after\n\t\t// the shot; without this latch the AnimGraph can see the scale jump back\n\t\t// to 1 while the fire animation is still playing.\n\t\tLatchViewModelFireScaleForPrimaryShot();\n\n\t\tbase.PrimaryAttack();\n\n\t\tRecordPrimaryShot();\n\t\tApplyRecoil();\n\t\tBeginPostShotCycle();\n\t}\n\n\tpublic override bool CanPrimaryAttack()\n\t{\n\t\tif ( IsPrimaryBlockedByTemporaryGate() )\n\t\t\treturn false;\n\n\t\t// The queued sprint shot must be released only through the gate in\n\t\t// UpdateSprintToFireGate, where FirePrimary() re-runs this readiness check.\n\t\tif ( _sprintFireQueued )\n\t\t\treturn false;\n\n\t\tif ( IsPrimaryBlockedByMechanicalAction() )\n\t\t\treturn false;\n\n\t\tif ( IsPrimaryBlockedByCycle() )\n\t\t\treturn false;\n\n\t\treturn base.CanPrimaryAttack();\n\t}\n\n\tpublic override bool CanSecondaryAttack()\n\t{\n\t\treturn false;\n\t}\n}\n"},{"Ident":"lfinchgames.oneplusround","Path":"PlayerCombatFeedback.cs","FileName":"PlayerCombatFeedback.cs","PackageType":"game","CodeKind":"Game","AssetVersionId":399243,"IsPrivate":false,"Code":"using Sandbox;\nusing System;\n\npublic enum OMRDamageIndicatorDirection\n{\n\tFront,\n\tLeft,\n\tRight,\n\tAbove,\n\tBack\n}\n\n/// \u003Csummary\u003E\n/// Owner-local combat feedback fed by host-authoritative damage resolution.\n///\n/// The host decides that damage actually happened. Presentation is then sent\n/// only to the connection that owns the relevant player. Lifetimes use absolute\n/// RealTime timestamps so HUD rendering frequency cannot leave stale feedback.\n/// \u003C/summary\u003E\npublic sealed class PlayerCombatFeedback : Component\n{\n\tprivate OMRCombatTuning Tuning =\u003E\n\t\tOMRCombatResources.DefaultTuning;\n\n\tprivate float HitmarkerDuration =\u003E\n\t\tMathF.Max( 0.01f, Tuning?.HitmarkerDuration ?? 0.16f );\n\n\tprivate float KillHitmarkerDuration =\u003E\n\t\tMathF.Max( 0.01f, Tuning?.KillHitmarkerDuration ?? 0.26f );\n\n\tprivate float HitmarkerMaxOpacity =\u003E\n\t\tMathX.Clamp( Tuning?.HitmarkerMaxOpacity ?? 1f, 0f, 1f );\n\n\tprivate float DamageIndicatorDuration =\u003E\n\t\tMathF.Max( 0.01f, Tuning?.DamageIndicatorDuration ?? 0.42f );\n\n\tprivate float MinimumDamageIndicatorStrength =\u003E\n\t\tMathX.Clamp( Tuning?.MinimumDamageIndicatorStrength ?? 0.65f, 0f, 1f );\n\n\tprivate float DamageAmountInfluence =\u003E\n\t\tMathX.Clamp( Tuning?.DamageIndicatorDamageInfluence ?? 0.35f, 0f, 1f );\n\n\tprivate float DamageIndicatorHoldFraction =\u003E\n\t\tMathX.Clamp( Tuning?.DamageIndicatorHoldFraction ?? 0.24f, 0f, 0.75f );\n\n\tpublic bool HitmarkerVisible =\u003E\n\t\t(Tuning?.ShowHitmarker ?? true) \u0026\u0026\n\t\tRealTime.Now \u003C _hitmarkerExpiresAt;\n\n\tpublic bool DamageIndicatorVisible =\u003E\n\t\t(Tuning?.ShowDamageIndicator ?? true) \u0026\u0026\n\t\tRealTime.Now \u003C _damageIndicatorExpiresAt;\n\n\tpublic bool LastHitWasKill { get; private set; }\n\tpublic bool LastHitWasHeadshot { get; private set; }\n\tpublic float LastConfirmedDamage { get; private set; }\n\n\t/// \u003Csummary\u003E\n\t/// Kept as a coarse semantic/debug value for compatibility. Revision 11 HUD\n\t/// presentation uses the continuous DamageAngleDegrees value instead.\n\t/// \u003C/summary\u003E\n\tpublic OMRDamageIndicatorDirection LastDamageDirection { get; private set; } =\n\t\tOMRDamageIndicatorDirection.Front;\n\n\tpublic bool HasDirectionalDamageSource =\u003E\n\t\t_hasDirectionalDamageSource;\n\n\t/// \u003Csummary\u003E\n\t/// Camera-relative horizontal angle to the most recent damage source.\n\t/// 0 = front/top of HUD, \u002B90 = right, \u002B/-180 = behind/bottom, -90 = left.\n\t/// Re-evaluated from the current eye rotation while the indicator is alive,\n\t/// so turning the camera keeps the cue pointing toward the source in world space.\n\t/// \u003C/summary\u003E\n\tpublic float DamageAngleDegrees =\u003E\n\t\t_hasDirectionalDamageSource\n\t\t\t? ResolveDamageAngleDegrees( _lastDamageSourcePosition )\n\t\t\t: 0f;\n\n\tpublic float HitmarkerOpacity\n\t{\n\t\tget\n\t\t{\n\t\t\tif ( !HitmarkerVisible )\n\t\t\t\treturn 0f;\n\n\t\t\tfloat duration =\n\t\t\t\tMathF.Max( _activeHitmarkerDuration, 0.01f );\n\n\t\t\tfloat life = MathX.Clamp(\n\t\t\t\t(_hitmarkerExpiresAt - RealTime.Now) / duration,\n\t\t\t\t0f,\n\t\t\t\t1f\n\t\t\t);\n\n\t\t\treturn HitmarkerMaxOpacity * life;\n\t\t}\n\t}\n\n\tpublic float HitmarkerScale\n\t{\n\t\tget\n\t\t{\n\t\t\tif ( LastHitWasKill )\n\t\t\t\treturn MathF.Max( 0.1f, Tuning?.KillHitmarkerScale ?? 1.18f );\n\n\t\t\tif ( LastHitWasHeadshot )\n\t\t\t\treturn MathF.Max( 0.1f, Tuning?.HeadshotHitmarkerScale ?? 1.08f );\n\n\t\t\treturn 1f;\n\t\t}\n\t}\n\n\t/// \u003Csummary\u003E\n\t/// 0..1 lifetime envelope. Damage feedback holds at full strength briefly,\n\t/// then uses a smooth fade. This avoids the Revision 10 behavior where a\n\t/// linear fade began immediately and made already-low opacity values vanish.\n\t/// \u003C/summary\u003E\n\tpublic float DamageIndicatorFade\n\t{\n\t\tget\n\t\t{\n\t\t\tif ( !DamageIndicatorVisible )\n\t\t\t\treturn 0f;\n\n\t\t\tfloat duration =\n\t\t\t\tMathF.Max( _activeDamageIndicatorDuration, 0.01f );\n\n\t\t\tfloat remaining = MathX.Clamp(\n\t\t\t\t(_damageIndicatorExpiresAt - RealTime.Now) / duration,\n\t\t\t\t0f,\n\t\t\t\t1f\n\t\t\t);\n\n\t\t\tfloat elapsed =\n\t\t\t\t1f - remaining;\n\n\t\t\tfloat hold =\n\t\t\t\tDamageIndicatorHoldFraction;\n\n\t\t\tif ( elapsed \u003C= hold )\n\t\t\t\treturn 1f;\n\n\t\t\tfloat fadeT = MathX.Clamp(\n\t\t\t\t(elapsed - hold) / MathF.Max( 1f - hold, 0.001f ),\n\t\t\t\t0f,\n\t\t\t\t1f\n\t\t\t);\n\n\t\t\t// Smoothstep from 1 -\u003E 0.\n\t\t\tfloat smooth =\n\t\t\t\tfadeT * fadeT * (3f - 2f * fadeT);\n\n\t\t\treturn 1f - smooth;\n\t\t}\n\t}\n\n\t/// \u003Csummary\u003E\n\t/// Severity contribution after the configurable minimum floor. A normal hit\n\t/// remains clearly readable; damage amount adds emphasis instead of deciding\n\t/// whether the indicator is visible at all.\n\t/// \u003C/summary\u003E\n\tpublic float DamageIndicatorVisualStrength\n\t{\n\t\tget\n\t\t{\n\t\t\tfloat severity =\n\t\t\t\tMathX.Clamp( _damageIndicatorStrength, 0f, 1f );\n\n\t\t\treturn MathX.Clamp(\n\t\t\t\t1f \u002B (severity - 1f) * DamageAmountInfluence,\n\t\t\t\t0f,\n\t\t\t\t1f\n\t\t\t);\n\t\t}\n\t}\n\n\t/// \u003Csummary\u003E\n\t/// Compatibility/helper value used by HUD invalidation.\n\t/// Presentation layers apply their own peak opacity directly and do not nest\n\t/// additional opacity beneath this value.\n\t/// \u003C/summary\u003E\n\tpublic float DamageIndicatorOpacity =\u003E\n\t\tDamageIndicatorFade * DamageIndicatorVisualStrength;\n\n\tprivate float _hitmarkerExpiresAt;\n\tprivate float _activeHitmarkerDuration;\n\n\tprivate float _damageIndicatorExpiresAt;\n\tprivate float _activeDamageIndicatorDuration;\n\tprivate float _damageIndicatorStrength;\n\tprivate Vector3 _lastDamageSourcePosition;\n\tprivate bool _hasDirectionalDamageSource;\n\n\n\t/// \u003Csummary\u003E\n\t/// Host-side entry point after damage has been authoritatively accepted.\n\t///\n\t/// We intentionally use a filtered Broadcast RPC instead of Rpc.Owner here.\n\t/// It makes the target connection explicit and avoids coupling hit feedback\n\t/// to owner-RPC resolution on whatever GameObject DamageInfo.Attacker happened\n\t/// to reference. Only the attacker player\u0027s owning connection receives it.\n\t/// \u003C/summary\u003E\n\tpublic void NotifyHitConfirmed(\n\t\tfloat damage,\n\t\tbool killed,\n\t\tbool headshot\n\t)\n\t{\n\t\tif ( !Networking.IsHost )\n\t\t\treturn;\n\n\t\tConnection owner =\n\t\t\tGameObject.Network.OwnerConnection;\n\n\t\tif ( Tuning?.LogCombatFeedbackRpc == true )\n\t\t{\n\t\t\tLog.Info(\n\t\t\t\t$\u0022[OMR FEEDBACK] Dispatch hit confirmation | Player {GameObject.Name} | Owner {(owner is null ? \u0022\u003Chost/unowned\u003E\u0022 : owner.DisplayName)} | Damage {damage:0.##} | Kill {killed} | Head {headshot}\u0022\n\t\t\t);\n\t\t}\n\n\t\tif ( owner is null || owner.IsHost )\n\t\t{\n\t\t\tApplyHitConfirmed( damage, killed, headshot );\n\t\t\treturn;\n\t\t}\n\n\t\tusing ( Rpc.FilterInclude( connection =\u003E connection == owner ) )\n\t\t{\n\t\t\tReceiveHitConfirmed( damage, killed, headshot );\n\t\t}\n\t}\n\n\t[Rpc.Broadcast]\n\tprivate void ReceiveHitConfirmed(\n\t\tfloat damage,\n\t\tbool killed,\n\t\tbool headshot\n\t)\n\t{\n\t\tApplyHitConfirmed( damage, killed, headshot );\n\n\t\tif ( Tuning?.LogCombatFeedbackRpc == true )\n\t\t{\n\t\t\tLog.Info(\n\t\t\t\t$\u0022[OMR FEEDBACK] Received hit confirmation | Player {GameObject.Name} | Damage {damage:0.##} | Kill {killed} | Head {headshot}\u0022\n\t\t\t);\n\t\t}\n\t}\n\n\tprivate void ApplyHitConfirmed(\n\t\tfloat damage,\n\t\tbool killed,\n\t\tbool headshot\n\t)\n\t{\n\t\tLastConfirmedDamage =\n\t\t\tMathF.Max( 0f, damage );\n\n\t\tLastHitWasKill =\n\t\t\tkilled;\n\n\t\tLastHitWasHeadshot =\n\t\t\theadshot;\n\n\t\t_activeHitmarkerDuration =\n\t\t\tkilled\n\t\t\t\t? KillHitmarkerDuration\n\t\t\t\t: HitmarkerDuration;\n\n\t\t_hitmarkerExpiresAt =\n\t\t\tRealTime.Now \u002B _activeHitmarkerDuration;\n\t}\n\n\tprivate void ApplyDamageTaken(\n\t\tfloat damage,\n\t\tbool killed,\n\t\tVector3 sourcePosition,\n\t\tbool hasDirectionalSource\n\t)\n\t{\n\t\tPlayerHealth health =\n\t\t\tComponents.Get\u003CPlayerHealth\u003E();\n\n\t\tfloat maxHealth =\n\t\t\tMathF.Max(\n\t\t\t\thealth?.MaxHealth ?? 180f,\n\t\t\t\t1f\n\t\t\t);\n\n\t\tfloat normalizedDamage =\n\t\t\tMathX.Clamp(\n\t\t\t\tMathF.Max( 0f, damage ) / maxHealth,\n\t\t\t\t0f,\n\t\t\t\t1f\n\t\t\t);\n\n\t\t// Use a curved severity response and a high configurable floor. Damage\n\t\t// amount should add emphasis, not make small hits practically invisible.\n\t\tfloat curvedSeverity =\n\t\t\tMathF.Sqrt( normalizedDamage );\n\n\t\t_damageIndicatorStrength =\n\t\t\tMinimumDamageIndicatorStrength \u002B\n\t\t\t(1f - MinimumDamageIndicatorStrength) * curvedSeverity;\n\n\t\tif ( killed )\n\t\t{\n\t\t\t_damageIndicatorStrength =\n\t\t\t\t1f;\n\t\t}\n\n\t\t_hasDirectionalDamageSource =\n\t\t\thasDirectionalSource;\n\n\t\t_lastDamageSourcePosition =\n\t\t\tsourcePosition;\n\n\t\tLastDamageDirection =\n\t\t\thasDirectionalSource\n\t\t\t\t? ResolveCoarseDamageDirection( sourcePosition )\n\t\t\t\t: OMRDamageIndicatorDirection.Front;\n\n\t\t_activeDamageIndicatorDuration =\n\t\t\tDamageIndicatorDuration;\n\n\t\t_damageIndicatorExpiresAt =\n\t\t\tRealTime.Now \u002B _activeDamageIndicatorDuration;\n\t}\n\n\tprivate float ResolveDamageAngleDegrees(\n\t\tVector3 sourcePosition\n\t)\n\t{\n\t\tGetDamageReference(\n\t\t\tout Vector3 referencePosition,\n\t\t\tout Rotation referenceRotation\n\t\t);\n\n\t\tVector3 toSource =\n\t\t\tsourcePosition - referencePosition;\n\n\t\tVector3 flatDirection =\n\t\t\tnew(\n\t\t\t\ttoSource.x,\n\t\t\t\ttoSource.y,\n\t\t\t\t0f\n\t\t\t);\n\n\t\tif ( flatDirection.Length \u003C 0.01f )\n\t\t\treturn 0f;\n\n\t\tVector3 flatForward =\n\t\t\tnew(\n\t\t\t\treferenceRotation.Forward.x,\n\t\t\t\treferenceRotation.Forward.y,\n\t\t\t\t0f\n\t\t\t);\n\n\t\tVector3 flatRight =\n\t\t\tnew(\n\t\t\t\treferenceRotation.Right.x,\n\t\t\t\treferenceRotation.Right.y,\n\t\t\t\t0f\n\t\t\t);\n\n\t\tif (\n\t\t\tflatForward.Length \u003C 0.01f ||\n\t\t\tflatRight.Length \u003C 0.01f\n\t\t)\n\t\t{\n\t\t\treturn 0f;\n\t\t}\n\n\t\tflatDirection = flatDirection.Normal;\n\t\tflatForward = flatForward.Normal;\n\t\tflatRight = flatRight.Normal;\n\n\t\tfloat forwardDot =\n\t\t\tVector3.Dot( flatDirection, flatForward );\n\n\t\tfloat rightDot =\n\t\t\tVector3.Dot( flatDirection, flatRight );\n\n\t\treturn MathF.Atan2( rightDot, forwardDot ) *\n\t\t\t(180f / MathF.PI);\n\t}\n\n\tprivate OMRDamageIndicatorDirection ResolveCoarseDamageDirection(\n\t\tVector3 sourcePosition\n\t)\n\t{\n\t\tGetDamageReference(\n\t\t\tout Vector3 referencePosition,\n\t\t\tout _\n\t\t);\n\n\t\tVector3 toSource =\n\t\t\tsourcePosition - referencePosition;\n\n\t\tif ( toSource.Length \u003E= 0.01f )\n\t\t{\n\t\t\tfloat upDot =\n\t\t\t\tVector3.Dot( toSource.Normal, Vector3.Up );\n\n\t\t\tif ( upDot \u003E= 0.60f )\n\t\t\t\treturn OMRDamageIndicatorDirection.Above;\n\t\t}\n\n\t\tfloat angle =\n\t\t\tResolveDamageAngleDegrees( sourcePosition );\n\n\t\tfloat absolute =\n\t\t\tMathF.Abs( angle );\n\n\t\tif ( absolute \u003C= 45f )\n\t\t\treturn OMRDamageIndicatorDirection.Front;\n\n\t\tif ( absolute \u003E= 135f )\n\t\t\treturn OMRDamageIndicatorDirection.Back;\n\n\t\treturn angle \u003E= 0f\n\t\t\t? OMRDamageIndicatorDirection.Right\n\t\t\t: OMRDamageIndicatorDirection.Left;\n\t}\n\n\tprivate void GetDamageReference(\n\t\tout Vector3 referencePosition,\n\t\tout Rotation referenceRotation\n\t)\n\t{\n\t\tPlayerController controller =\n\t\t\tComponents.Get\u003CPlayerController\u003E();\n\n\t\treferencePosition =\n\t\t\tcontroller is not null\n\t\t\t\t? controller.EyePosition\n\t\t\t\t: GameObject.WorldPosition;\n\n\t\treferenceRotation =\n\t\t\tcontroller is not null\n\t\t\t\t? controller.EyeTransform.Rotation\n\t\t\t\t: GameObject.WorldRotation;\n\t}\n\n\t/// \u003Csummary\u003E\n\t/// Local presentation bridge used by PlayerHealth\u0027s host-synchronized\n\t/// damage event. This never performs damage logic; it only starts the\n\t/// already-authorized visual feedback on the locally controlled player.\n\t/// \u003C/summary\u003E\n\tinternal void ReceiveLocalDamageFeedback(\n\t\tfloat damage,\n\t\tbool killed,\n\t\tVector3 sourcePosition,\n\t\tbool hasDirectionalSource\n\t)\n\t{\n\t\tif ( IsProxy || Components.Get\u003CPlayerState\u003E()?.IsBot == true )\n\t\t\treturn;\n\n\t\tApplyDamageTaken(\n\t\t\tdamage,\n\t\t\tkilled,\n\t\t\tsourcePosition,\n\t\t\thasDirectionalSource\n\t\t);\n\t}\n\n\tpublic void ResetTransient()\n\t{\n\t\t_hitmarkerExpiresAt = 0f;\n\t\t_activeHitmarkerDuration = 0f;\n\n\t\t_damageIndicatorExpiresAt = 0f;\n\t\t_activeDamageIndicatorDuration = 0f;\n\t\t_damageIndicatorStrength = 0f;\n\t\t_lastDamageSourcePosition = Vector3.Zero;\n\t\t_hasDirectionalDamageSource = false;\n\n\t\tLastHitWasKill = false;\n\t\tLastHitWasHeadshot = false;\n\t\tLastConfirmedDamage = 0f;\n\t\tLastDamageDirection = OMRDamageIndicatorDirection.Front;\n\t}\n\n\tprotected override void OnDisabled()\n\t{\n\t\tResetTransient();\n\t\tbase.OnDisabled();\n\t}\n}\n"},{"Ident":"lfinchgames.oneplusround","Path":"UI/OMRScopeReticlePanel.cs","FileName":"OMRScopeReticlePanel.cs","PackageType":"game","CodeKind":"Game","AssetVersionId":399243,"IsPrivate":false,"Code":"using Sandbox;\nusing Sandbox.UI;\nusing System;\n\nnamespace Sandbox.UI;\n\n/// \u003Csummary\u003E\n/// Draws the scope reticle directly in the panel paint pass. This avoids relying\n/// on four tiny Razor/CSS rectangles inside a scaled WorldPanel, which proved\n/// vulnerable to hotload/layout quirks.\n/// \u003C/summary\u003E\npublic sealed class OMRScopeReticlePanel : Panel\n{\n\tpublic OMRScopeReticleStyle ReticleStyle { get; set; } = OMRScopeReticleStyle.FineCross;\n\tpublic Color ReticleColor { get; set; } = Color.Black;\n\tpublic float Thickness { get; set; } = 1.5f;\n\tpublic float Gap { get; set; } = 8f;\n\tpublic float LineLength { get; set; } = 72f;\n\tpublic float DotSize { get; set; } = 3f;\n\tpublic float ReticleOpacity { get; set; } = 1f;\n\tpublic float OutlineWidth { get; set; } = 0f;\n\tpublic float OutlineOpacity { get; set; } = 0f;\n\n\tpublic override void OnDraw( Painter painter )\n\t{\n\t\tfloat opacity = MathX.Clamp( ReticleOpacity, 0f, 1f );\n\t\tif ( opacity \u003C= 0.001f )\n\t\t\treturn;\n\n\t\tfloat thickness = MathF.Max( Thickness, 0.5f );\n\t\tfloat gap = MathF.Max( Gap, 0f );\n\t\tfloat length = MathF.Max( LineLength, 1f );\n\n\t\tif ( ReticleStyle == OMRScopeReticleStyle.Duplex )\n\t\t{\n\t\t\tthickness *= 1.75f;\n\t\t\tgap *= 1.5f;\n\t\t}\n\n\t\tVector2 center = new( painter.Bounds.Width * 0.5f, painter.Bounds.Height * 0.5f );\n\t\tColor main = ReticleColor.WithAlpha( ReticleColor.a * opacity );\n\n\t\tfloat outlineWidth = MathF.Max( OutlineWidth, 0f );\n\t\tfloat outlineOpacity = MathX.Clamp( OutlineOpacity, 0f, 1f ) * opacity;\n\t\tif ( outlineWidth \u003E 0f \u0026\u0026 outlineOpacity \u003E 0.001f )\n\t\t{\n\t\t\tColor outline = Color.White.WithAlpha( outlineOpacity );\n\t\t\tDrawCross( painter, center, thickness \u002B outlineWidth * 2f, gap, length, outline );\n\t\t}\n\n\t\tDrawCross( painter, center, thickness, gap, length, main );\n\n\t\tif ( ReticleStyle == OMRScopeReticleStyle.DotCross \u0026\u0026 DotSize \u003E 0f )\n\t\t{\n\t\t\tif ( outlineWidth \u003E 0f \u0026\u0026 outlineOpacity \u003E 0.001f )\n\t\t\t{\n\t\t\t\tpainter.Fill = Color.White.WithAlpha( outlineOpacity );\n\t\t\t\tpainter.Circle( center, (DotSize \u002B outlineWidth * 2f) * 0.5f );\n\t\t\t}\n\n\t\t\tpainter.Fill = main;\n\t\t\tpainter.Circle( center, DotSize * 0.5f );\n\t\t}\n\t}\n\n\tprivate static void DrawCross( Painter painter, Vector2 center, float thickness, float gap, float length, Color color )\n\t{\n\t\tfloat halfThickness = thickness * 0.5f;\n\t\tpainter.Fill = color;\n\t\tpainter.Stroke = Stroke.None;\n\n\t\tpainter.Rect( new Rect( center.x - gap - length, center.y - halfThickness, length, thickness ) );\n\t\tpainter.Rect( new Rect( center.x \u002B gap, center.y - halfThickness, length, thickness ) );\n\t\tpainter.Rect( new Rect( center.x - halfThickness, center.y - gap - length, thickness, length ) );\n\t\tpainter.Rect( new Rect( center.x - halfThickness, center.y \u002B gap, thickness, length ) );\n\t}\n}\n"}]}