From a28f7aadf8ba589c65c5ec32a51c98629c5816d0 Mon Sep 17 00:00:00 2001 From: SabreML <57483089+SabreML@users.noreply.github.com> Date: Tue, 21 Mar 2023 16:18:04 +0000 Subject: [PATCH] Temporary reversion 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. --- SingleplayerCoopEmotes/modinfo.json | 4 ++-- src/SPCoopEmotesConfig.cs | 8 +++++-- src/SingleplayerCoopEmotes.cs | 35 +++++++++++++++++++++++------ 3 files changed, 36 insertions(+), 11 deletions(-) diff --git a/SingleplayerCoopEmotes/modinfo.json b/SingleplayerCoopEmotes/modinfo.json index d69f07f..e1857db 100644 --- a/SingleplayerCoopEmotes/modinfo.json +++ b/SingleplayerCoopEmotes/modinfo.json @@ -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"] diff --git a/src/SPCoopEmotesConfig.cs b/src/SPCoopEmotesConfig.cs index 39fddb6..ed8303e 100644 --- a/src/SPCoopEmotesConfig.cs +++ b/src/SPCoopEmotesConfig.cs @@ -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() @@ -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) @@ -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."); diff --git a/src/SingleplayerCoopEmotes.cs b/src/SingleplayerCoopEmotes.cs index 5b594e1..b4196ab 100644 --- a/src/SingleplayerCoopEmotes.cs +++ b/src/SingleplayerCoopEmotes.cs @@ -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. @@ -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. @@ -131,11 +157,6 @@ private void UpdateJollyButton(Player self) { self.jollyButtonDown = Input.GetKey(customKeybind); } - - if (aimAnywhereEnabled) - { - AimAnywhereSupport.UpdatePointDirection(self); - } } @@ -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.