Revolver fix (again) (#8635)

This commit is contained in:
metalgearsloth
2022-06-04 14:19:08 +10:00
committed by GitHub
parent d5f0d23c2d
commit 27b3ca04c5
2 changed files with 3 additions and 6 deletions

View File

@@ -54,13 +54,8 @@ public partial class SharedGunSystem
var oldIndex = component.CurrentIndex; var oldIndex = component.CurrentIndex;
component.CurrentIndex = state.CurrentIndex; component.CurrentIndex = state.CurrentIndex;
component.AmmoSlots.EnsureCapacity(state.AmmoSlots.Count);
component.AmmoSlots.Clear();
component.Chambers = new bool?[state.Chambers.Length]; component.Chambers = new bool?[state.Chambers.Length];
DebugTools.Assert(component.AmmoSlots.Count == component.Chambers.Length);
// Need to copy across the state rather than the ref. // Need to copy across the state rather than the ref.
for (var i = 0; i < component.AmmoSlots.Count; i++) for (var i = 0; i < component.AmmoSlots.Count; i++)
{ {
@@ -322,6 +317,8 @@ public partial class SharedGunSystem
component.Chambers[i] = true; component.Chambers[i] = true;
} }
} }
DebugTools.Assert(component.AmmoSlots.Count == component.Capacity);
} }
[Serializable, NetSerializable] [Serializable, NetSerializable]

View File

@@ -23,6 +23,6 @@ gun-magazine-examine = It has [color={$color}]{$count}[/color] shots remaining.
# RevolverAmmoProvider # RevolverAmmoProvider
gun-revolver-empty = Empty revolver gun-revolver-empty = Empty revolver
gun-revolver-full = Revolver full gun-revolver-full = Revolver full
gun-revolver-insert = Insert gun-revolver-insert = Inserted
gun-revolver-spin = Spin revolver gun-revolver-spin = Spin revolver
gun-revolver-spun = Spun gun-revolver-spun = Spun