Skip to content

Commit

Permalink
Temporary reversion
Browse files Browse the repository at this point in the history
RW v1.9.07's input overhaul isn't compatible with the current 'custom keybind' system.
Since it seems to have some issues of its own though, I'm holding off on rewriting the code until the next game version.
  • Loading branch information
SabreML committed Mar 21, 2023
1 parent 153e24e commit a28f7aa
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 11 deletions.
4 changes: 2 additions & 2 deletions SingleplayerCoopEmotes/modinfo.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"id": "sabreml.singleplayercoopemotes",
"name": "Singleplayer Co-op Emotes",
"version": "1.2.1",
"target_game_version": "v1.9.06",
"version": "1.2.1.1",
"target_game_version": "v1.9.07",
"authors": "SabreML",
"description": "Makes the Jolly Co-op emotes work in singleplayer!",
"tags": ["Game Mechanics"]
Expand Down
8 changes: 6 additions & 2 deletions src/SPCoopEmotesConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,11 @@ public override void Initialize()
AddTitle();
AddDivider(540f);
AddControlsText();
AddKeyBinder();
//AddKeyBinder();
}

// Temporarily disabled until the next update because the new input system seems to have some issues.
/*
// Updates the text for the pointing instructions based on the current value in `keyBinder`.
// If the player is using the default map key then a double tap is required to start pointing, so this changes to reflect that.
public override void Update()
Expand Down Expand Up @@ -66,6 +68,7 @@ public override void Update()
pointingLabel.text = newLabelText;
}
}
*/

// Combines two flipped 'LinearGradient200's together to make a fancy looking divider.
private void AddDivider(float y)
Expand Down Expand Up @@ -104,7 +107,8 @@ private void AddControlsText()
OpLabel titleLabel = new OpLabel(new Vector2(150f, 480f), new Vector2(300f, 30f), "Controls:", bigText: true);

// The text for this is added in `Update()`.
pointingLabel = new OpLabel(new Vector2(150f, titleLabel.pos.y - 25f), new Vector2(300f, 30f));
//pointingLabel = new OpLabel(new Vector2(150f, titleLabel.pos.y - 25f), new Vector2(300f, 30f));
pointingLabel = new OpLabel(new Vector2(150f, titleLabel.pos.y - 25f), new Vector2(300f, 30f), "Double tap and hold the Point button with a movement input to start pointing in a direction.");

OpLabel sleepingLabel = new OpLabel(new Vector2(150f, titleLabel.pos.y - 45f), new Vector2(300f, 30f), "Hold Down while crawling to curl up into a ball and sleep.");

Expand Down
35 changes: 28 additions & 7 deletions src/SingleplayerCoopEmotes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

namespace SingleplayerCoopEmotes
{
[BepInPlugin("sabreml.singleplayercoopemotes", "SingleplayerCoopEmotes", "1.2.1")]
[BepInPlugin("sabreml.singleplayercoopemotes", "SingleplayerCoopEmotes", "1.2.1.1")]
public class SingleplayerCoopEmotes : BaseUnityPlugin
{
// The current mod version.
Expand Down Expand Up @@ -94,11 +94,37 @@ private void JollyUpdateHK(On.Player.orig_JollyUpdate orig, Player self, bool eu
// Update the jolly button.
UpdateJollyButton(self);

// If the 'Aim Anywhere' mod is enabled, point in the direction of the mouse cursor.
if (aimAnywhereEnabled)
{
AimAnywhereSupport.UpdatePointDirection(self);
}

// Pointing emote things.
self.JollyPointUpdate();
}

private void UpdateJollyButton(Player self)
{
if (!self.input[0].mp) // If the button isn't being held down at all.
{
self.jollyButtonDown = false;
}
else if (!self.input[1].mp) // If the button was down this frame, but not last frame.
{
self.jollyButtonDown = false;
for (int i = 2; i < self.input.Length - 1; i++)
{
if (self.input[i].mp && !self.input[i + 1].mp) // Look for a double tap.
{
self.jollyButtonDown = true;
}
}
}
}

// Temporarily disabled until the next update because the new input system seems to have some issues.
/*
// Updates `self.jollyButtonDown` based on the player's pointing keybind.
// If the player is using the default keybind (the map button), this copies the standard Jolly Co-op behaviour of a double-tap and hold.
// If not, then this just checks if the key is currently being held.
Expand Down Expand Up @@ -131,11 +157,6 @@ private void UpdateJollyButton(Player self)
{
self.jollyButtonDown = Input.GetKey(customKeybind);
}

if (aimAnywhereEnabled)
{
AimAnywhereSupport.UpdatePointDirection(self);
}
}
Expand All @@ -148,7 +169,7 @@ public static bool KeybindIsMapKey(KeyCode keybindToCheck)
// If the keybind is the same as the keyboard or controller map key.
return keybindToCheck == playerControls.KeyboardMap || keybindToCheck == playerControls.GamePadMap;
}

*/

// Restores the (most likely unintentional) functionality from the 1.5 version of
// pointing with no movement input making your slugcat face towards the screen.
Expand Down

0 comments on commit a28f7aa

Please sign in to comment.