Skip to content

Commit 1ad2599

Browse files
committed
2.0.0: Use both hands toggle
1 parent 931bfcb commit 1ad2599

File tree

5 files changed

+40
-6
lines changed

5 files changed

+40
-6
lines changed

PlayerHooks.cs

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ private void PlayerHooks()
4040

4141
// In movement if it's true we can keep walking into walls, which shouldn't happen
4242
IL.Player.MovementUpdate += Player_AppendToIsSlugpupCheck;
43+
44+
// False in SlugcatGrab if we have using both arms enabled
45+
IL.Player.SlugcatGrab += Player_SlugcatGrabAppendToIsSlugpupCheck;
4346

4447
// Add so we get correct hand positions
4548
IL.SlugcatHand.Update += Player_AppendPupCheck;
@@ -252,9 +255,9 @@ private void Player_AppendToIsSlugpupCheck(ILContext il)
252255

253256
// Match the IL sequence for `call instance bool Player::get_isSlugpup()`
254257
while (c.TryGotoNext(MoveType.AfterLabel,
255-
i => i.MatchLdarg(0), // Match ldarg.0 instruction
256-
i => i.MatchCall(typeof(Player).GetMethod("get_isSlugpup")) // Match call to get_isSlugpup()
257-
)) // Match the branch instruction after get_isSlugpup
258+
i => i.MatchLdarg(0), // Match ldarg.0 instruction
259+
i => i.MatchCall(typeof(Player).GetMethod("get_isSlugpup")) // Match call to get_isSlugpup()
260+
)) // Match the branch instruction after get_isSlugpup
258261
{
259262
c.Index += 2;
260263
// Insert the condition directly after get_isSlugpup
@@ -269,6 +272,34 @@ private void Player_AppendToIsSlugpupCheck(ILContext il)
269272
}
270273
}
271274

275+
private void Player_SlugcatGrabAppendToIsSlugpupCheck(ILContext il)
276+
{
277+
// 136 017F ldarg.0
278+
// 137 0180 call instance bool Player::get_isSlugpup()
279+
// 138 0185 brfalse.s 164 (01BF) ldc.i4.1
280+
try
281+
{
282+
var c = new ILCursor(il);
283+
284+
// Match the IL sequence for `call instance bool Player::get_isSlugpup()`
285+
while (c.TryGotoNext(MoveType.AfterLabel,
286+
i => i.MatchLdarg(0), // Match ldarg.0 instruction
287+
i => i.MatchCall(typeof(Player).GetMethod("get_isSlugpup")) // Match call to get_isSlugpup()
288+
)) // Match the branch instruction after get_isSlugpup
289+
{
290+
c.Index += 2;
291+
// Insert the condition directly after get_isSlugpup
292+
c.Emit(OpCodes.Ldarg_0);
293+
c.EmitDelegate((Player player) => !Options.UseBothHands.Value);
294+
c.Emit(OpCodes.And);
295+
}
296+
}
297+
catch (Exception ex)
298+
{
299+
LogError(ex, "Error in Player_AppendToIsSlugpupCheck");
300+
}
301+
}
302+
272303
private void Player_AppendPupCheck(ILContext il)
273304
{
274305
//351 0328 isinst Player

PluginInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
internal static class PluginInfo {
22
public const string PluginGUID = "amione.Pupifier";
33
public const string PluginName = "Pupifier";
4-
public const string PluginVersion = "0.1.9";
4+
public const string PluginVersion = "2.0.0";
55
}

Pupifier.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<AssemblyName>amione.Pupifier</AssemblyName>
55
<Product>Pupifier</Product>
66
<ProductDescription>Pupifier is a mod that allows you to become a slugpup in Rain World! This mod enhances your gameplay experience by enabling you to transform into a slugpup, offering a unique perspective and new challenges. Additionally, this mod was made for Rain Meadow but works normally as well!</ProductDescription>
7-
<ModVersion>0.1.9</ModVersion>
7+
<ModVersion>2.0.0</ModVersion>
88
<Version>2.0.8</Version>
99
<LangVersion>10.0</LangVersion>
1010
<Nullable>enable</Nullable>

PupifierOptions.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ public partial class PupifierOptions : OptionInterface
2727
public readonly Configurable<float> WallJumpPowerFac;
2828
public readonly Configurable<float> ActionJumpPowerFac;
2929
public readonly Configurable<bool> DisableBeingGrabbed;
30+
public readonly Configurable<bool> UseBothHands;
3031

3132
public PupifierOptions()
3233
{
@@ -52,6 +53,7 @@ public PupifierOptions()
5253

5354
// Toggles tab
5455
DisableBeingGrabbed = config.Bind(nameof(DisableBeingGrabbed), false, new ConfigurableInfo("If enabled, you can't be grabbed", null, "", "Disable being Grabbed"));
56+
UseBothHands = config.Bind(nameof(UseBothHands), false, new ConfigurableInfo("If enabled, you can use both hands as a pup", null, "", "Enable using both hands"));
5557

5658
// Experimental tab
5759
ModAutoDisabledToggle = config.Bind(nameof(ModAutoDisabledToggle), false, new ConfigurableInfo("If true, Pupifier will not disable itself when other mods are found. This requires a restart", null, "", "Allow Incompatible Mods (Requires Restart)"));
@@ -122,6 +124,7 @@ public override void Initialize()
122124
y = 540f;
123125
sepr = 30f;
124126
AddCheckbox(DisableBeingGrabbed, new Vector2(x, y -= sepr), softYellow, softYellow, softYellow);
127+
AddCheckbox(UseBothHands, new Vector2(x, y -= sepr), softYellow, softYellow, softYellow);
125128

126129
/**************** Experimental ****************/
127130
curTab++;

pupifier/modinfo.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"id": "amione.Pupifier",
33
"name": "Pupifier",
4-
"version": "0.1.9",
4+
"version": "2.0.0",
55
"target_game_version": "v1.9.15",
66
"authors": "amione - Creator, youbitchoc - For helping in development, henpemaz - For Rain Meadow, Maxi Mol - For Mouse Drag code, LDani, simichan1227 - For testing the s**t out of my mod (It was kinda encouraging)",
77
"description": "Pupifier is a mod that allows you to become a slugpup in Rain World! This mod enhances your gameplay experience by enabling you to transform into a slugpup, offering a unique perspective and new challenges. Additionally, this mod was made for Rain Meadow but works normally as well!",

0 commit comments

Comments
 (0)