Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
It should follow the format major.minor.patch (semantic versioning). If you publish your mod
as a library to NuGet, this version will also be used as the package version.
-->
<Version>0.3.8</Version>
<Version>0.3.9</Version>
</PropertyGroup>
</Project>
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ This is a library for mods to make FSM edits easier.

To add Silksong.FsmUtil to your mod, add the following line to your .csproj:
```
<PackageReference Include="Silksong.FsmUtil" Version="0.3.8" />
<PackageReference Include="Silksong.FsmUtil" Version="0.3.9" />
```
The most up to date version number can be retrieved from [Nuget](https://www.nuget.org/packages/Silksong.FsmUtil).

You will also need to add a dependency to your thunderstore.toml:
```
silksong_modding-FsmUtil = "0.3.8"
silksong_modding-FsmUtil = "0.3.9"
```
The version number does not matter hugely, but the most up to date number can be retrieved from
[Thunderstore](https://thunderstore.io/c/hollow-knight-silksong/p/silksong_modding/FsmUtil/).
Expand Down
4 changes: 2 additions & 2 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ With this, it's easy to:

To add Silksong.FsmUtil to your mod, add the following line to your .csproj:
```
<PackageReference Include="Silksong.FsmUtil" Version="0.3.8" />
<PackageReference Include="Silksong.FsmUtil" Version="0.3.9" />
```
The most up to date version number can be retrieved from [Nuget](https://www.nuget.org/packages/Silksong.FsmUtil).

You will also need to add a dependency to your thunderstore.toml:
```
silksong_modding-FsmUtil = "0.3.8"
silksong_modding-FsmUtil = "0.3.9"
```
The version number does not matter hugely, but the most up to date number can be retrieved from
[Thunderstore](https://thunderstore.io/c/hollow-knight-silksong/p/silksong_modding/FsmUtil/).
Expand Down
62 changes: 20 additions & 42 deletions src/FsmUtil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -453,19 +453,16 @@ public static void AddActions(this FsmState state, params FsmStateAction[] actio
/// <param name="stateName">The name of the state in which the method is added</param>
/// <param name="method">The method that will be invoked with the action as the parameter</param>
[PublicAPI]
[Obsolete("In a future update, the method here will no longer take a parameter. Please use the `AddLambdaMethod` extension method instead! (Though that one's parameter is the `Finish` method.)")]
public static void AddMethod(this PlayMakerFSM fsm, string stateName, Action<FsmStateAction> method) => fsm.GetState(stateName)!.AddMethod(method);

/// <inheritdoc cref="AddMethod(PlayMakerFSM, string, Action{FsmStateAction})"/>
[PublicAPI]
[Obsolete("In a future update, the method here will no longer take a parameter. Please use the `AddLambdaMethod` extension method instead! (Though that one's parameter is the `Finish` method.)")]
public static void AddMethod(this Fsm fsm, string stateName, Action<FsmStateAction> method) => fsm.GetState(stateName)!.AddMethod(method);

/// <inheritdoc cref="AddMethod(PlayMakerFSM, string, Action{FsmStateAction})"/>
/// <param name="state">The fsm state</param>
/// <param name="method">The method that will be invoked with the action as the parameter</param>
[PublicAPI]
[Obsolete("In a future update, the method here will no longer take a parameter. Please use the `AddLambdaMethod` extension method instead! (Though that one's parameter is the `Finish` method.)")]
public static void AddMethod(this FsmState state, Action<FsmStateAction> method)
{
DelegateAction<FsmStateAction> action = new DelegateAction<FsmStateAction> { Method = method };
Expand All @@ -481,21 +478,18 @@ public static void AddMethod(this FsmState state, Action<FsmStateAction> method)
/// <param name="method">The method that will be invoked</param>
/// <param name="everyFrame">If true, execute the function repeatedly on every update frame</param>
[PublicAPI]
[Obsolete("In a future update, this method will be `AddMethod`.")]
public static void AddMethod2(this PlayMakerFSM fsm, string stateName, Action method, bool everyFrame = false) => fsm.GetState(stateName)!.AddMethod2(method, everyFrame);
public static void AddMethod(this PlayMakerFSM fsm, string stateName, Action method, bool everyFrame = false) => fsm.GetState(stateName)!.AddMethod(method, everyFrame);

/// <inheritdoc cref="AddMethod2(PlayMakerFSM, string, Action, bool)"/>
/// <inheritdoc cref="AddMethod(PlayMakerFSM, string, Action, bool)"/>
[PublicAPI]
[Obsolete("In a future update, this method will be `AddMethod`.")]
public static void AddMethod2(this Fsm fsm, string stateName, Action method, bool everyFrame = false) => fsm.GetState(stateName)!.AddMethod2(method, everyFrame);
public static void AddMethod(this Fsm fsm, string stateName, Action method, bool everyFrame = false) => fsm.GetState(stateName)!.AddMethod(method, everyFrame);

/// <inheritdoc cref="AddMethod2(PlayMakerFSM, string, Action, bool)"/>
/// <inheritdoc cref="AddMethod(PlayMakerFSM, string, Action, bool)"/>
/// <param name="state">The fsm state</param>
/// <param name="method">The method that will be invoked</param>
/// <param name="everyFrame">If true, execute the function repeatedly on every update frame</param>
[PublicAPI]
[Obsolete("In a future update, this method will be `AddMethod`.")]
public static void AddMethod2(this FsmState state, Action method, bool everyFrame = false)
public static void AddMethod(this FsmState state, Action method, bool everyFrame = false)
{
LambdaAction action = new LambdaAction { Method = method };
state.AddAction(action);
Expand Down Expand Up @@ -630,35 +624,29 @@ public static void InsertActions(this FsmState state, int index, params FsmState
/// <param name="index">The index to place the action in</param>
/// <returns>bool that indicates whether the insertion was successful</returns>
[PublicAPI]
[Obsolete("In a future update, the method here will no longer take a parameter. Please use the `InsertLambdaMethod` extension method instead! (Though that one's parameter is the `Finish` method.)")]
public static void InsertMethod(this PlayMakerFSM fsm, string stateName, Action<FsmStateAction> method, int index) => fsm.GetState(stateName)!.InsertMethod(index, method);

/// <inheritdoc cref="InsertMethod(PlayMakerFSM, string, Action{FsmStateAction}, int)"/>
[PublicAPI]
[Obsolete("In a future update, the method here will no longer take a parameter. Please use the `InsertLambdaMethod` extension method instead! (Though that one's parameter is the `Finish` method.)")]
public static void InsertMethod(this PlayMakerFSM fsm, string stateName, int index, Action<FsmStateAction> method) => fsm.GetState(stateName)!.InsertMethod(index, method);

/// <inheritdoc cref="InsertMethod(PlayMakerFSM, string, Action{FsmStateAction}, int)"/>
[PublicAPI]
[Obsolete("In a future update, the method here will no longer take a parameter. Please use the `InsertLambdaMethod` extension method instead! (Though that one's parameter is the `Finish` method.)")]
public static void InsertMethod(this Fsm fsm, string stateName, Action<FsmStateAction> method, int index) => fsm.GetState(stateName)!.InsertMethod(index, method);

/// <inheritdoc cref="InsertMethod(PlayMakerFSM, string, Action{FsmStateAction}, int)"/>
[PublicAPI]
[Obsolete("In a future update, the method here will no longer take a parameter. Please use the `InsertLambdaMethod` extension method instead! (Though that one's parameter is the `Finish` method.)")]
public static void InsertMethod(this Fsm fsm, string stateName, int index, Action<FsmStateAction> method) => fsm.GetState(stateName)!.InsertMethod(index, method);

/// <inheritdoc cref="InsertMethod(PlayMakerFSM, string, Action{FsmStateAction}, int)"/>
/// <param name="state">The fsm state</param>
/// <param name="method">The method that will be invoked</param>
/// <param name="index">The index to place the action in</param>
[PublicAPI]
[Obsolete("In a future update, the method here will no longer take a parameter. Please use the `InsertLambdaMethod` extension method instead! (Though that one's parameter is the `Finish` method.)")]
public static void InsertMethod(this FsmState state, Action<FsmStateAction> method, int index) => state.InsertMethod(index, method);

/// <inheritdoc cref="InsertMethod(FsmState, Action{FsmStateAction}, int)"/>
[PublicAPI]
[Obsolete("In a future update, the method here will no longer take a parameter. Please use the `InsertLambdaMethod` extension method instead! (Though that one's parameter is the `Finish` method.)")]
public static void InsertMethod(this FsmState state, int index, Action<FsmStateAction> method)
{
DelegateAction<FsmStateAction> action = new DelegateAction<FsmStateAction> { Method = method };
Expand All @@ -676,36 +664,30 @@ public static void InsertMethod(this FsmState state, int index, Action<FsmStateA
/// <param name="index">The index to place the action in</param>
/// <returns>bool that indicates whether the insertion was successful</returns>
[PublicAPI]
[Obsolete("In a future update, this method will be `InsertMethod`.")]
public static void InsertMethod2(this PlayMakerFSM fsm, string stateName, Action method, int index, bool everyFrame = false) => fsm.GetState(stateName)!.InsertMethod2(index, method, everyFrame);
public static void InsertMethod(this PlayMakerFSM fsm, string stateName, Action method, int index, bool everyFrame = false) => fsm.GetState(stateName)!.InsertMethod(index, method, everyFrame);

/// <inheritdoc cref="InsertMethod2(PlayMakerFSM, string, Action, int, bool)"/>
/// <inheritdoc cref="InsertMethod(PlayMakerFSM, string, Action, int, bool)"/>
[PublicAPI]
[Obsolete("In a future update, this method will be `InsertMethod`.")]
public static void InsertMethod2(this PlayMakerFSM fsm, string stateName, int index, Action method, bool everyFrame = false) => fsm.GetState(stateName)!.InsertMethod2(index, method, everyFrame);
public static void InsertMethod(this PlayMakerFSM fsm, string stateName, int index, Action method, bool everyFrame = false) => fsm.GetState(stateName)!.InsertMethod(index, method, everyFrame);

/// <inheritdoc cref="InsertMethod2(PlayMakerFSM, string, Action, int, bool)"/>
/// <inheritdoc cref="InsertMethod(PlayMakerFSM, string, Action, int, bool)"/>
[PublicAPI]
[Obsolete("In a future update, this method will be `InsertMethod`.")]
public static void InsertMethod2(this Fsm fsm, string stateName, Action method, int index, bool everyFrame = false) => fsm.GetState(stateName)!.InsertMethod2(index, method, everyFrame);
public static void InsertMethod(this Fsm fsm, string stateName, Action method, int index, bool everyFrame = false) => fsm.GetState(stateName)!.InsertMethod(index, method, everyFrame);

/// <inheritdoc cref="InsertMethod2(PlayMakerFSM, string, Action, int, bool)"/>
/// <inheritdoc cref="InsertMethod(PlayMakerFSM, string, Action, int, bool)"/>
[PublicAPI]
[Obsolete("In a future update, this method will be `InsertMethod`.")]
public static void InsertMethod2(this Fsm fsm, string stateName, int index, Action method, bool everyFrame = false) => fsm.GetState(stateName)!.InsertMethod2(index, method, everyFrame);
public static void InsertMethod(this Fsm fsm, string stateName, int index, Action method, bool everyFrame = false) => fsm.GetState(stateName)!.InsertMethod(index, method, everyFrame);

/// <inheritdoc cref="InsertMethod2(PlayMakerFSM, string, Action, int, bool)"/>
/// <inheritdoc cref="InsertMethod(PlayMakerFSM, string, Action, int, bool)"/>
/// <param name="state">The fsm state</param>
/// <param name="method">The method that will be invoked</param>
/// <param name="index">The index to place the action in</param>
[PublicAPI]
[Obsolete("In a future update, this method will be `InsertMethod`.")]
public static void InsertMethod2(this FsmState state, Action method, int index, bool everyFrame = false) => state.InsertMethod2(index, method, everyFrame);
public static void InsertMethod(this FsmState state, Action method, int index, bool everyFrame = false) => state.InsertMethod(index, method, everyFrame);

/// <inheritdoc cref="InsertMethod2(FsmState, Action, int, bool)"/>
/// <inheritdoc cref="InsertMethod(FsmState, Action, int, bool)"/>
[PublicAPI]
[Obsolete("In a future update, this method will be `InsertMethod`.")]
public static void InsertMethod2(this FsmState state, int index, Action method, bool everyFrame = false)
public static void InsertMethod(this FsmState state, int index, Action method, bool everyFrame = false)
{
LambdaAction action = new LambdaAction { Method = method };
state.InsertAction(action, index);
Expand Down Expand Up @@ -757,7 +739,6 @@ public static void InsertLambdaMethod(this FsmState state, int index, Action<Act
/// <param name="action">The action to insert before.</param>
/// <param name="method">The method to execute. The argument will be the FsmStateAction which is being added.</param>
[PublicAPI]
[Obsolete("In a future update, the method here will no longer take a parameter. Please use the `InsertLambdaMethodBefore` extension method instead! (Though that one's parameter is the `Finish` method.)")]
public static void InsertMethodBefore(this FsmStateAction action, Action<FsmStateAction> method)
{
FsmState state = action.State;
Expand All @@ -771,7 +752,6 @@ public static void InsertMethodBefore(this FsmStateAction action, Action<FsmStat
/// <param name="action">The action to insert after.</param>
/// <param name="method">The method to execute. The argument will be the FsmStateAction which is being added.</param>
[PublicAPI]
[Obsolete("In a future update, the method here will no longer take a parameter. Please use the `InserLambdatMethodAfter` extension method instead! (Though that one's parameter is the `Finish` method.)")]
public static void InsertMethodAfter(this FsmStateAction action, Action<FsmStateAction> method)
{
FsmState state = action.State;
Expand All @@ -785,12 +765,11 @@ public static void InsertMethodAfter(this FsmStateAction action, Action<FsmState
/// <param name="action">The action to insert before.</param>
/// <param name="method">The method to execute.</param>
[PublicAPI]
[Obsolete("In a future update, this method will be `InsertMethodBefore`.")]
public static void InsertMethod2Before(this FsmStateAction action, Action method)
public static void InsertMethodBefore(this FsmStateAction action, Action method)
{
FsmState state = action.State;
int idx = Array.IndexOf(state.Actions, action);
state.InsertMethod2(idx, method);
state.InsertMethod(idx, method);
}

/// <summary>
Expand All @@ -799,12 +778,11 @@ public static void InsertMethod2Before(this FsmStateAction action, Action method
/// <param name="action">The action to insert after.</param>
/// <param name="method">The method to execute.</param>
[PublicAPI]
[Obsolete("In a future update, this method will be `InsertMethodAfter`.")]
public static void InsertMethod2After(this FsmStateAction action, Action method)
public static void InsertMethodAfter(this FsmStateAction action, Action method)
{
FsmState state = action.State;
int idx = Array.IndexOf(state.Actions, action);
state.InsertMethod2(idx + 1, method);
state.InsertMethod(idx + 1, method);
}

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion thunderstore/thunderstore.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[config]
schemaVersion = "0.3.8"
schemaVersion = "0.3.9"

[package]
# The name of the team you are publishing as
Expand Down