-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
46 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
This file contains 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 |
---|---|---|
@@ -0,0 +1,41 @@ | ||
namespace GodSeekerPlus.Modules.Restrictions; | ||
|
||
internal sealed class NoDiveInvincibility : Module { | ||
private PlayMakerFSM? spellControl = null; | ||
|
||
public NoDiveInvincibility() => | ||
On.HeroController.Awake += GetSpellControl; | ||
|
||
private protected override void Load() { | ||
On.HeroController.Start += ModifySpellControlFSM; | ||
|
||
Apply(true); | ||
} | ||
|
||
private protected override void Unload() { | ||
On.HeroController.Start -= ModifySpellControlFSM; | ||
|
||
Apply(false); | ||
} | ||
|
||
private void GetSpellControl(On.HeroController.orig_Awake orig, HeroController self) { | ||
spellControl = self.gameObject.LocateMyFSM("Spell Control"); | ||
|
||
orig(self); | ||
} | ||
|
||
private void ModifySpellControlFSM(On.HeroController.orig_Start orig, HeroController self) { | ||
orig(self); | ||
|
||
Apply(ModuleManager.TryGetActiveModule<NoDiveInvincibility>(out _)); | ||
} | ||
|
||
private void Apply(bool active) { | ||
if (spellControl == null) { | ||
return; | ||
} | ||
|
||
spellControl.GetAction<CallMethodProper>("Quake1 Down", 4).Enabled = !active; | ||
spellControl.GetAction<CallMethodProper>("Quake2 Down", 4).Enabled = !active; | ||
} | ||
} |
This file contains 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
This file contains 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
This file contains 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
This file contains 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