-
Notifications
You must be signed in to change notification settings - Fork 28
"[Sonic Frontiers] "Gameplay/Skills/Allow Boost to Damage Objects": Fixed Damage Collision turning off when changing to states that alredy has Damage Collision enabled" #266
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
efc9ed9
[Sonic Frontiers] Fixed "Gameplay/Skills/Allow Boost to Damage Object…
aleprime2007 d9a7a87
[Sonic Frontiers] "Gameplay/Skills/Allow Boost to Damage Objects": Fi…
aleprime2007 f88637a
Merge branch 'main' into main
aleprime2007 60412d0
[Sonic Frontiers] "Gameplay/Skills/Allow Boost to Damage Objects": Fi…
aleprime2007 96c8305
[Sonic Frontiers] "Gameplay/Skills/Allow Boost to Damage Objects": Ma…
aleprime2007 598cce7
[Sonic Frontiers] "Gameplay/Skills/Allow Boost to Damage Objects": Re…
aleprime2007 7eef535
[Sonic Frontiers] "Gameplay/Skills/Allow Boost to Damage Objects": Ad…
aleprime2007 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
71 changes: 48 additions & 23 deletions
71
Source/Sonic Frontiers/Gameplay/Skills/Allow Boost to Damage Objects.hmm
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,44 +1,69 @@ | ||
| 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 | ||
|
|
||
| #lib "Player" | ||
|
|
||
| using System.Collections.Generic; | ||
|
|
||
| static bool _isBoostPrevious = false; | ||
| static bool _isDamageEnabled = false; | ||
| static bool _isDamageOverride = false; | ||
|
|
||
| static List<Sonic.StateID> _boostStates = new() | ||
| static List<Sonic.StateID> _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<Sonic.StateID> _overrideStates = new() | ||
| { | ||
| Sonic.StateID.StateRun, | ||
| Sonic.StateID.StateWallMove | ||
| Sonic.StateID.StateAirBoost | ||
| }; | ||
| // | ||
| { | ||
| Sonic.StateID _stateId = Player.State.GetCurrentStateID<Sonic.StateID>(); | ||
| 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<Sonic.StateID>(); | ||
|
|
||
| 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; | ||
| } | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.