Skip to content

Commit

Permalink
v2.4.9
Browse files Browse the repository at this point in the history
  • Loading branch information
SchuhBaum committed Mar 27, 2024
1 parent e85cce3 commit 9f6a43c
Show file tree
Hide file tree
Showing 6 changed files with 95 additions and 28 deletions.
7 changes: 4 additions & 3 deletions ReadMe.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## SimplifiedMoveset
###### Version: 2.4.8
###### Version: 2.4.9

This is a mod for Rain World v1.9.

Expand All @@ -11,7 +11,7 @@ https://www.youtube.com/watch?v=Jp6UyUgoWB0

### Installation
0. Update Rain World to version 1.9 if needed.
1. Download the file `SimplifiedMoveset.zip` from [Releases](https://github.com/SchuhBaum/SimplifiedMoveset/releases/tag/v2.4.8).
1. Download the file `SimplifiedMoveset.zip` from [Releases](https://github.com/SchuhBaum/SimplifiedMoveset/releases/tag/v2.4.9).
2. Extract its content in the folder `[Steam]\SteamApps\common\Rain World\RainWorld_Data\StreamingAssets\mods`.
3. Start the game as normal. In the main menu select `Remix` and enable the mod.

Expand All @@ -26,7 +26,7 @@ There are two licenses available - MIT and Unlicense. You can choose which one y

### Changelog
#### (Rain World v1.9)
v2.4.8:
v2.4.9:
- (belly slide) Reduced the duration of the normal belly slide back to vanilla. The overall distance is unintentionally increased otherwise (like +20%). Not sure why since the speed is decreased and the same as the long belly slide. From what I tested the distance is as in vanilla now. I might need to double check later since this seems somewhat odd.
- (belly slide) Reduced the speed and increased the duration of the belly slide for Gourmand. This way it matches better with his rocket jump.
- (gourmand) Added this option. Enabled by default. Exhaust only when throwing spears. Stun creatures with rocket jumps. Slides, rocket jumps and rolls only stun and deal no damage.
Expand All @@ -39,6 +39,7 @@ v2.4.8:
- (gourmand) Fixed a bug where you would not get exhausted when throwing a spear shortly after getting stun grabbed.
- (swim) Gourmand can recover from exhaustion while being underwater.
- Potentially fixed some issues with the new update (v1.9.15).
- (wall climb + jump) Modified how friction is applied when touching walls. This way you slide down a bit and don't stop immediately when you are falling fast.

v2.4.0:
- (crawl) Forgot to add an option check for the last change.
Expand Down
2 changes: 1 addition & 1 deletion SimplifiedMoveset/modinfo.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "SimplifiedMoveset",
"name": "SimplifiedMoveset",
"version": "2.4.8",
"version": "2.4.9",
"authors": "SchuhBaum",
"description": "Various movement changes. The main idea is to remove or simplify timings, making it easier to perform advanced moves consistently.",
"requirements": [],
Expand Down
2 changes: 1 addition & 1 deletion SimplifiedMoveset/workshopdata.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"Title": "SimplifiedMoveset",
"Description": "Various movement changes. The main idea is to remove or simplify timings, making it easier to perform advanced moves consistently.",
"ID": "SimplifiedMoveset",
"Version": "2.4.8",
"Version": "2.4.9",
"TargetGameVersion": "",
"Requirements": "",
"RequirementNames": "",
Expand Down
4 changes: 2 additions & 2 deletions SourceCode/MainMod.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@

namespace SimplifiedMoveset;

[BepInPlugin("SimplifiedMoveset", "SimplifiedMoveset", "2.4.8")]
[BepInPlugin("SimplifiedMoveset", "SimplifiedMoveset", "2.4.9")]
public class MainMod : BaseUnityPlugin {
//
// meta data
//

public static readonly string mod_id = "SimplifiedMoveset";
public static readonly string author = "SchuhBaum";
public static readonly string version = "2.4.8";
public static readonly string version = "2.4.9";

//
// options
Expand Down
102 changes: 84 additions & 18 deletions SourceCode/PlayerMod.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ internal static void On_Config_Changed() {

if (Option_BeamClimb) {
IL.Player.GrabVerticalPole += IL_Player_GrabVerticalPole;
IL.Player.Update += IL_Player_Update;
On.Player.MovementUpdate += Player_MovementUpdate;
}

Expand All @@ -111,6 +110,10 @@ internal static void On_Config_Changed() {
IL.Player.MovementUpdate += IL_Player_MovementUpdate;
}

if (Option_BeamClimb || Option_WallClimb || Option_WallJump) {
IL.Player.Update += IL_Player_Update;
}

if (Option_BellySlide || Option_Crawl || Option_Roll_1 || Option_Roll_2) {
IL.Player.TerrainImpact += IL_Player_TerrainImpact;
}
Expand Down Expand Up @@ -1101,8 +1104,10 @@ public static void UpdateBodyMode_WallClimb(Player player) {
vel_x_gain *= 0.4f + 0.6f * Mathf.InverseLerp(10f, 0.0f, player.slowMovementStun);
}

if (Option_WallClimb && player.input[0].y != 0) {
if (player.input[0].y == 1 && !player.IsTileSolid(bChunk: 1, player.input[0].x, 0) && (body_chunk_1.pos.x < body_chunk_0.pos.x) == (player.input[0].x < 0)) { // climb up even when lower body part is hanging in the air
// same condition for body_chunk_0.vel.y as in the function IL_Player_Update();
if (Option_WallClimb && player.input[0].y != 0 && Math.Abs(body_chunk_0.vel.y) < 3f) {
// climb up even when lower body part is hanging in the air;
if (player.input[0].y == 1 && !player.IsTileSolid(bChunk: 1, player.input[0].x, 0) && (body_chunk_1.pos.x < body_chunk_0.pos.x) == (player.input[0].x < 0)) {
body_chunk_0.pos.y += Mathf.Abs(body_chunk_0.pos.x - body_chunk_1.pos.x);
body_chunk_1.pos.x = body_chunk_0.pos.x;
body_chunk_1.vel.x = -player.input[0].x * vel_x_gain;
Expand All @@ -1115,13 +1120,17 @@ public static void UpdateBodyMode_WallClimb(Player player) {
body_chunk_0.vel.y = Mathf.Lerp(body_chunk_0.vel.y, player.input[0].y * 2.5f, 0.3f);
body_chunk_1.vel.y = Mathf.Lerp(body_chunk_1.vel.y, player.input[0].y * 2.5f, 0.3f);
++player.animationFrame;
} else if (player.lowerBodyFramesOffGround > 8 && player.input[0].y != -1) { // stay in place // don't slide down // when only Option_WallClimb is enabled then this happens even when holding up // don't slide/climb when doing a normal jump off the ground
} else if (player.lowerBodyFramesOffGround > 8 && player.input[0].y != -1) {
// stay in place; don't slide down; when only Option_WallClimb is enabled then
// this happens even when holding up; don't slide/climb when doing a normal jump
// off the ground

if (player.grasps[0]?.grabbed is Cicada cicada) {
body_chunk_0.vel.y = Custom.LerpAndTick(body_chunk_0.vel.y, player.gravity - cicada.LiftPlayerPower * 0.5f, 0.3f, 1f);
body_chunk_0.vel.y = Custom.LerpAndTick(body_chunk_0.vel.y, player.gravity - cicada.LiftPlayerPower * 0.5f, 0.025f, 1f);
} else {
body_chunk_0.vel.y = Custom.LerpAndTick(body_chunk_0.vel.y, player.gravity, 0.3f, 1f);
body_chunk_0.vel.y = Custom.LerpAndTick(body_chunk_0.vel.y, player.gravity, 0.025f, 1f);
}
body_chunk_1.vel.y = Custom.LerpAndTick(body_chunk_1.vel.y, player.gravity, 0.3f, 1f);
body_chunk_1.vel.y = Custom.LerpAndTick(body_chunk_1.vel.y, player.gravity, 0.025f, 1f);

if (!player.IsTileSolid(bChunk: 1, player.input[0].x, 0) && player.input[0].x > 0 == body_chunk_1.pos.x > body_chunk_0.pos.x) {
body_chunk_1.vel.x = -player.input[0].x * vel_x_gain;
Expand Down Expand Up @@ -1733,30 +1742,87 @@ private static void IL_Player_TongueUpdate(ILContext context) { // Option_TubeWo
// LogAllInstructions(context);
}

private static void IL_Player_Update(ILContext context) { // Option_BeamClimb
private static void IL_Player_Update(ILContext context) { // Option_BeamClimb // Option_WallClimb // Option_WallJump
// LogAllInstructions(context);
ILCursor cursor = new(context);

if (cursor.TryGotoNext(instruction => instruction.MatchLdsfld<BodyModeIndex>("Default")) &&
cursor.TryGotoNext(instruction => instruction.MatchLdfld<Player>("poleSkipPenalty"))) {
cursor.Goto(cursor.Index - 2);
if (cursor.Next.OpCode != OpCodes.Bgt) {
if (can_log_il_hooks) {
Debug.Log(mod_id + ": IL_Player_Update could not be applied.");
if (can_log_il_hooks) {
Debug.Log(mod_id + ": IL_Player_Update: Index " + cursor.Index); // 2929
}

if (Option_BeamClimb) {
if (cursor.Next.OpCode != OpCodes.Bgt) {
if (can_log_il_hooks) {
Debug.Log(mod_id + ": IL_Player_Update could not be applied.");
}
return;
}
return;

//
// allow beam hopping even when the player is holding up => makes it no risk
// and low reward instead of high risk and low reward;
//

cursor.Next.OpCode = OpCodes.Blt;
}
} else {
if (can_log_il_hooks) {
Debug.Log(mod_id + ": IL_Player_Update could not be applied.");
}
return;
}

if (cursor.TryGotoNext(
instruction => instruction.MatchLdfld("Player", "bodyMode"),
instruction => instruction.MatchLdsfld("Player/BodyModeIndex", "Swimming"),
instruction => instruction.MatchCall("ExtEnum`1<Player/BodyModeIndex>", "op_Inequality")
) && cursor.TryGotoNext(MoveType.After,
instruction => instruction.MatchLdflda("BodyChunk", "pos"),
instruction => instruction.MatchLdfld("UnityEngine.Vector2", "y"),
instruction => instruction.MatchBgt(out ILLabel _)
)) {
if (can_log_il_hooks) {
Debug.Log(mod_id + ": IL_Player_Update: Index " + cursor.Index); // 3386
}

if (Option_WallClimb || Option_WallJump) {
//
// change how the friction is applied when touching the wall while having higher
// velocity in y; this way you slide down a bit before you stop; there are two
// locations where this change needs to be applied;
//

cursor.Prev.OpCode = OpCodes.Brtrue;
cursor.Goto(cursor.Index - 12);
cursor.RemoveRange(11);
cursor.EmitDelegate<Func<Player, bool>>(player => player.bodyChunks[0].pos.y > player.bodyChunks[1].pos.y && Math.Abs(player.bodyChunks[0].vel.y) < 3f);
}
} else {
if (can_log_il_hooks) {
Debug.Log(mod_id + ": IL_Player_Update: Index " + cursor.Index); // 1936
Debug.Log(mod_id + ": IL_Player_Update could not be applied.");
}
return;
}

//
// allow beam hopping even when the player is holding up => makes it no risk
// and low reward instead of high risk and low reward;
//
if (cursor.TryGotoNext(MoveType.After,
instruction => instruction.MatchLdflda("BodyChunk", "pos"),
instruction => instruction.MatchLdfld("UnityEngine.Vector2", "y"),
instruction => instruction.MatchBgt(out ILLabel _)
)) {
if (can_log_il_hooks) {
Debug.Log(mod_id + ": IL_Player_Update: Index " + cursor.Index); // 3444
}

cursor.Next.OpCode = OpCodes.Blt;
if (Option_WallClimb || Option_WallJump) {
// same as before;
cursor.Prev.OpCode = OpCodes.Brtrue;
cursor.Goto(cursor.Index - 12);
cursor.RemoveRange(11);
cursor.EmitDelegate<Func<Player, bool>>(player => player.bodyChunks[0].pos.y > player.bodyChunks[1].pos.y && Math.Abs(player.bodyChunks[0].vel.y) < 3f);
}
} else {
if (can_log_il_hooks) {
Debug.Log(mod_id + ": IL_Player_Update could not be applied.");
Expand Down
6 changes: 3 additions & 3 deletions SourceCode/SimplifiedMoveset.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@
<TargetFramework>net48</TargetFramework>
<Nullable>enable</Nullable>
<LangVersion>10.0</LangVersion>
<Version>2.4.8</Version>
<Version>2.4.9</Version>
</PropertyGroup>

<ItemGroup>
<Reference Include="..\..\references\PUBLIC-Assembly-CSharp.dll"/>
<Reference Include="..\..\references\BepInEx.dll"/>
<Reference Include="..\..\references\HOOKS-Assembly-CSharp.dll"/>
<Reference Include="..\..\references\Mono.Cecil.dll"/>

<Reference Include="..\..\references\MonoMod.Utils.dll"/>

<Reference Include="..\..\references\PUBLIC-Assembly-CSharp.dll"/>
<Reference Include="..\..\references\Unity.Mathematics.dll"/>
<Reference Include="..\..\references\UnityEngine.dll"/>
<Reference Include="..\..\references\UnityEngine.CoreModule.dll"/>
Expand Down

0 comments on commit 9f6a43c

Please sign in to comment.