Skip to content
This repository was archived by the owner on Nov 7, 2024. It is now read-only.

Commit 39e54c6

Browse files
author
DaZombieKiller
committed
Fix for Slime Rancher 1.2.0
1 parent e85b4e5 commit 39e54c6

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

Source/SrDebugDirector.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ private void Update()
166166
if (Input.GetKeyDown(KeyCode.Alpha9) && _playerState)
167167
{
168168
Console.WriteLine("DEBUG: Fill Ammo");
169-
_playerState?.Ammo?.DebugFillRandomAmmo(_playerState.GetMaxAmmo());
169+
_playerState?.Ammo?.DebugFillRandomAmmo();
170170
}
171171

172172
// toggle infinite energy
@@ -183,7 +183,7 @@ private void Update()
183183

184184
// refill inventory
185185
if (Input.GetKeyDown(KeyCode.L) && _playerState)
186-
_playerState?.Ammo?.DebugRefillAmmo(_playerState.GetMaxAmmo());
186+
_playerState?.Ammo?.DebugRefillAmmo();
187187

188188
// toggle noclip
189189
if (Input.GetKeyDown(KeyCode.N) && _player)

Source/SrDebugExtensions.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ public static void DebugGiveAllUpgrades(this PlayerState self)
124124
/// <summary>Fills the player's inventory with random items</summary>
125125
/// <param name="self">The Ammo instance</param>
126126
/// <param name="fillTo"></param>
127-
public static void DebugFillRandomAmmo(this Ammo self, int fillTo)
127+
public static void DebugFillRandomAmmo(this Ammo self)
128128
{
129129
var potentialAmmo = GetPrivateField<Ammo, GameObject[]>("potentialAmmo", self);
130130
var numSlots = GetPrivateField<Ammo, int>("numSlots", self);
@@ -135,6 +135,8 @@ public static void DebugFillRandomAmmo(this Ammo self, int fillTo)
135135

136136
for (var i = 0; i < numSlots; i++)
137137
{
138+
int fillTo = self.GetSlotMaxCount(i);
139+
138140
// pick a random item to insert into the slot
139141
var plucked = Randoms.SHARED.Pluck(new List<GameObject>(potentialAmmo), null);
140142

@@ -160,7 +162,7 @@ public static void DebugFillRandomAmmo(this Ammo self, int fillTo)
160162
/// <summary>Refills the player's inventory</summary>
161163
/// <param name="self">The Ammo instance</param>
162164
/// <param name="fillTo"></param>
163-
public static void DebugRefillAmmo(this Ammo self, int fillTo)
165+
public static void DebugRefillAmmo(this Ammo self)
164166
{
165167
var ammoSlot = typeof(Ammo).GetNestedType("Slot", BindingFlags.NonPublic | BindingFlags.Instance);
166168
var slotCount = ammoSlot.GetField("count");
@@ -169,6 +171,8 @@ public static void DebugRefillAmmo(this Ammo self, int fillTo)
169171

170172
for (var i = 0; i < numSlots; i++)
171173
{
174+
int fillTo = self.GetSlotMaxCount(i);
175+
172176
if (slots[i] != null)
173177
slotCount?.SetValue(slots[i], fillTo);
174178
else if (i == numSlots - 1) // refill water if slot empty

0 commit comments

Comments
 (0)