Limit maximum capacity of fillable cluster grenades (#34281)

* Limit maximum capacity of fillable cluster grenades

* Swap GrenadeCount method for component property
This commit is contained in:
Tayrtahn
2025-02-11 18:13:00 -05:00
committed by GitHub
parent a849d2c989
commit 4603b47778
2 changed files with 12 additions and 2 deletions

View File

@@ -49,6 +49,10 @@ public abstract class SharedScatteringGrenadeSystem : EntitySystem
if (entity.Comp.Whitelist == null)
return;
// Make sure there's room for another grenade to be added
if (entity.Comp.Count >= entity.Comp.Capacity)
return;
if (args.Handled || !_whitelistSystem.IsValid(entity.Comp.Whitelist, args.Used))
return;
@@ -65,6 +69,6 @@ public abstract class SharedScatteringGrenadeSystem : EntitySystem
if (!TryComp<AppearanceComponent>(entity, out var appearanceComponent))
return;
_appearance.SetData(entity, ClusterGrenadeVisuals.GrenadesCounter, entity.Comp.UnspawnedCount + entity.Comp.Container.ContainedEntities.Count, appearanceComponent);
_appearance.SetData(entity, ClusterGrenadeVisuals.GrenadesCounter, entity.Comp.Count, appearanceComponent);
}
}