Skip to content

Commit

Permalink
feat: fast super dash
Browse files Browse the repository at this point in the history
  • Loading branch information
Clazex committed Oct 2, 2021
1 parent 0c4fe7f commit 5fbbc6b
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 1 deletion.
37 changes: 37 additions & 0 deletions GodSeekerPlus/FastSuperDash.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
using HutongGames.PlayMaker;
using HutongGames.PlayMaker.Actions;
using Vasi;

namespace GodSeekerPlus {
internal static class FastSuperDash {
public static int times = 0;

public static void Hook() => On.PlayMakerFSM.OnEnable += ModifyFSM;

public static void UnHook() => On.PlayMakerFSM.OnEnable -= ModifyFSM;

private static void ModifyFSM(On.PlayMakerFSM.orig_OnEnable orig, PlayMakerFSM self) {
if (self.gameObject.name == "Knight" && self.FsmName == "Superdash") {
FsmState stateWsSpdBuff = FsmUtil.CreateState(self, "GSP Workshop Speed Buff");

FsmUtil.AddAction(stateWsSpdBuff, new CheckSceneName() {
sceneName = "GG_Workshop",
notEqualEvent = FsmEvent.Finished
});
FsmUtil.AddAction(stateWsSpdBuff, new FloatMultiply() {
floatVariable = self.FsmVariables.FindFsmFloat("Current SD Speed"),
multiplyBy = 1.5f
});

FsmUtil.ChangeTransition(FsmUtil.GetState(self, "Left"), FsmEvent.Finished.Name, stateWsSpdBuff.Name);
FsmUtil.ChangeTransition(FsmUtil.GetState(self, "Right"), FsmEvent.Finished.Name, stateWsSpdBuff.Name);

FsmUtil.AddTransition(stateWsSpdBuff, FsmEvent.Finished.Name, "Dash Start");

GodSeekerPlus.Instance.Log("Superdash FSM modified");
}

orig(self);
}
}
}
8 changes: 8 additions & 0 deletions GodSeekerPlus/GlobalSettings.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
namespace GodSeekerPlus {
public class GlobalSettings {
public bool fastDreamWarp = true;
public bool fastSuperDash = true;
public float fastSuperDashSpeedMultiplier = 1.5f;
public bool frameRateLimit = false;
public int frameRateLimitMultiplier = 5;

public void Coerce() {
if (fastSuperDashSpeedMultiplier < 1f) {
fastSuperDashSpeedMultiplier = 1f;
} else if (fastSuperDashSpeedMultiplier > 2f) {
fastSuperDashSpeedMultiplier = 2f;
}

if (frameRateLimitMultiplier < 0) {
frameRateLimitMultiplier = 0;
} else if (frameRateLimitMultiplier > 10) {
Expand Down
5 changes: 5 additions & 0 deletions GodSeekerPlus/GodSeekerPlus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,18 @@ private void Hook() {
FastDreamWarp.Hook();
}

if (GlobalSettings.fastSuperDash) {
FastSuperDash.Hook();
}

if (GlobalSettings.frameRateLimit) {
FrameRateLimit.Hook();
}
}

private void UnHook() {
FastDreamWarp.UnHook();
FastSuperDash.UnHook();
FrameRateLimit.UnHook();
}

Expand Down
2 changes: 1 addition & 1 deletion GodSeekerPlus/GodSeekerPlus.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<AssemblyTitle>GodSeekerPlus</AssemblyTitle>
<Version>0.2.1</Version>
<Version>0.3.0</Version>
<Description>A Hollow Knight mod to enhance your Godhome experience</Description>
<Copyright>Copyright © 2021</Copyright>

Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,14 @@ Compatible with `Hollow Knight` 1.5.
## Features

- **Fast Dream Warping**: Remove dream warping charge time when in Godhome boss fight rooms. This decrease the total warping time from 2.25s to 0.25s.
- **Fast Super Dash**: Buff Super Dash speed in Hall of Gods.
- **Frame Rate Limit**: Create a lag in every in-game frame.

## Configuration

- `fastDreamWarp` (`Boolean`): Whether to enable the Fast Dream Warping feature. Defaults to `true`.
- `fastSuperDash` (`Boolean`): Whether to enable the Fast Super Dash feature. Defaults to `true`.
- `fastSuperDashSpeedMultiplier` (`Float`): Whether to enable the Fast Super Dash feature. Ranges from `1` to `2`, defaults to `1.5`.
- `frameRateLimit` (`Boolean`): Whether to enable the Frame Rate Limit feature. Defaults to `false`.
- `frameRateLimitMultiplier` (`Integer`): Frame rate limit time span multiplier. Final lag time is 10ms multiplied by this value. Note that setting this to `0` does not mean zero lag. Ranges from `0` to `10`, defaults to `5`.

Expand Down

0 comments on commit 5fbbc6b

Please sign in to comment.