Fix empty guns (#10650)

This commit is contained in:
Leon Friedrich
2022-08-17 15:44:43 +12:00
committed by GitHub
parent 6cb7bbaf73
commit 9fd25937fb

View File

@@ -127,8 +127,13 @@ public abstract partial class SharedGunSystem
private void OnBallisticMapInit(EntityUid uid, BallisticAmmoProviderComponent component, MapInitEvent args) private void OnBallisticMapInit(EntityUid uid, BallisticAmmoProviderComponent component, MapInitEvent args)
{ {
// TODO this should be part of the prototype, not set on map init.
// Alternatively, just track spawned count, instead of unspawned count.
if (component.FillProto != null) if (component.FillProto != null)
component.UnspawnedCount -= Math.Min(component.UnspawnedCount, component.Container.ContainedEntities.Count); {
component.UnspawnedCount = Math.Max(0, component.Capacity - component.Container.ContainedEntities.Count);
Dirty(component);
}
} }
protected int GetBallisticShots(BallisticAmmoProviderComponent component) protected int GetBallisticShots(BallisticAmmoProviderComponent component)