diff --git a/Source/Sonic Frontiers/Gameplay/Skills/Allow Boost to Damage Objects.hmm b/Source/Sonic Frontiers/Gameplay/Skills/Allow Boost to Damage Objects.hmm index b3557211..ee72972e 100644 --- a/Source/Sonic Frontiers/Gameplay/Skills/Allow Boost to Damage Objects.hmm +++ b/Source/Sonic Frontiers/Gameplay/Skills/Allow Boost to Damage Objects.hmm @@ -1,4 +1,4 @@ -Code "Allow Boost to Damage Objects" in "Gameplay/Skills" by "Hyper & NM" does "Allows the player to damage enemies and harder physics objects by boosting through them." +Code "Allow Boost to Damage Objects" in "Gameplay/Skills" by "Hyper, NM & aleprime2007" does "Allows the player to damage enemies and harder physics objects by boosting through them." // #include "BlackboardStatus" noemit @@ -6,39 +6,64 @@ Code "Allow Boost to Damage Objects" in "Gameplay/Skills" by "Hyper & NM" does " using System.Collections.Generic; - static bool _isBoostPrevious = false; + static bool _isDamageEnabled = false; + static bool _isDamageOverride = false; - static List _boostStates = new() + static List _damageStates = new() { - Sonic.StateID.StateAirBoost, - Sonic.StateID.StateBumpJump, - Sonic.StateID.StateGrind, - Sonic.StateID.StateGrindDamage, - Sonic.StateID.StateGrindJump, - Sonic.StateID.StateGrindRoot, - Sonic.StateID.StateGrindStep, Sonic.StateID.StateJump, - Sonic.StateID.StateLeftStepRun, - Sonic.StateID.StateRightStepRun, + Sonic.StateID.StateDoubleJump, + Sonic.StateID.StateSpinAttack, + Sonic.StateID.StateSpinDash, + Sonic.StateID.StateSpinBoostCharge, + Sonic.StateID.StateSpinBoost, + Sonic.StateID.StateHomingAttack, + Sonic.StateID.StateStompingDown, + Sonic.StateID.StateStompingLand, + Sonic.StateID.StateBounceJump, + Sonic.StateID.StateDropDash, + Sonic.StateID.StateSliding + }; + + static List _overrideStates = new() + { Sonic.StateID.StateRun, - Sonic.StateID.StateWallMove + Sonic.StateID.StateAirBoost }; // { - Sonic.StateID _stateId = Player.State.GetCurrentStateID(); - if (_boostStates.Contains(_stateId) && IS_STATE_FLAG(IsBoost)) + void SetDamage(bool in_isEnabled) + { + var col = in_isEnabled + ? Player.CollisionType.Damage + : Player.CollisionType.Default; + + Player.Collision.SetCollisionSphere(col, 1.0f); + Player.Collision.SetEntityCollision(!in_isEnabled); + _isDamageEnabled = in_isEnabled; + } + + Sonic.StateID stateId = Player.State.GetCurrentStateID(); + + if (IS_STATE_FLAG(IsBoost)) { - if (!_isBoostPrevious) + if (_overrideStates.Contains(stateId)) + { + if (!_isDamageOverride) + { + SetDamage(true); + _isDamageOverride = true; + } + } + else { - Player.Collision.SetCollisionSphere(Player.CollisionType.Damage, 1.0f); - Player.Collision.SetEntityCollision(false); - _isBoostPrevious = true; + if (!_isDamageEnabled) SetDamage(true); + _isDamageOverride = false; } } - else if (_isBoostPrevious) + else { - Player.Collision.SetCollisionSphere(Player.CollisionType.Default, 1.0f); - Player.Collision.SetEntityCollision(true); - _isBoostPrevious = false; + if (_isDamageEnabled && !_damageStates.Contains(stateId)) SetDamage(false); + _isDamageOverride = false; } }