Skip to content

Commit

Permalink
Spearmaster sleeping
Browse files Browse the repository at this point in the history
I guess maybe canonically they don't sleep since they're always awake in the sleep illustration, but in-game they still close their eyes when the shelter closes so...
  • Loading branch information
SabreML committed Feb 18, 2023
1 parent 380f66d commit 9be33e6
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
19 changes: 18 additions & 1 deletion SingleplayerCoopEmotes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

namespace SingleplayerCoopEmotes
{
[BepInPlugin("sabreml.singleplayercoopemotes", "SingleplayerCoopEmotes", "1.1.2")]
[BepInPlugin("sabreml.singleplayercoopemotes", "SingleplayerCoopEmotes", "1.1.3")]
public class SingleplayerCoopEmotes : BaseUnityPlugin
{
public void OnEnable()
Expand Down Expand Up @@ -40,6 +40,7 @@ private static void Init(On.RainWorld.orig_OnModsInit orig, RainWorld self)
On.Player.JollyPointUpdate += JollyPointUpdateHK;
On.Player.GraphicsModuleUpdated += GraphicsModuleUpdatedHK;
On.Player.checkInput += checkInputHK;
On.PlayerGraphics.PlayerBlink += PlayerBlinkHK;

// Manual hook to override the `Player.RevealMap` property getter.
new Hook(
Expand Down Expand Up @@ -135,6 +136,22 @@ private static void checkInputHK(On.Player.orig_checkInput orig, Player self)
ModManager.CoopAvailable = false;
}

// Called by `PlayerGraphics.Update()` when the player has fully curled up to sleep.
//
// This override is the same as the original except without the Spearmaster check, as it made them inconsistent with
// the other slugcats, and it didn't seem like it was actually used for anything.
private static void PlayerBlinkHK(On.PlayerGraphics.orig_PlayerBlink orig, PlayerGraphics self)
{
if (UnityEngine.Random.value < 0.033333335f)
{
self.blink = Math.Max(2, self.blink);
}
if (self.player.sleepCurlUp == 1f)
{
self.blink = Math.Max(2, self.blink);
}
}


// Same as the original, except without a `ModManager.CoopAvailable` check.
private static bool get_RevealMapHK(Func<Player, bool> orig, Player self)
Expand Down
2 changes: 1 addition & 1 deletion SingleplayerCoopEmotes/modinfo.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "sabreml.singleplayercoopemotes",
"name": "Singleplayer Co-op Emotes",
"version": "1.1.2",
"version": "1.1.3",
"target_game_version": "v1.9.05",
"authors": "SabreML",
"description": "Makes the Jolly Co-op emotes work in singleplayer!"
Expand Down

0 comments on commit 9be33e6

Please sign in to comment.