Files
OldThink/Content.Client/Weapons/Ranged/Systems/GunSystem.Ballistic.cs
Aviu00 f7edea42cd Некоторые балансные изменения (#72)
* - balance: Chainsaw can only be crafted using advanced saw.

* - balance: Tweak some melee weapon damage and sizes.

* - balance: Tweak stun baton.

* - balance: No flash heavy attack.

* - balance: Tweak modifier sets.

* - tweak: Stunprod and snatcherprod tweaks.

* - tweak: Auto cycle tweaks.

* - balance: Nerf flamethrower.

* - tweak: Remove old stunprod construction.

* - balance: Tweak shotgun ammo.

* - tweak: Cartridge ejecting tweaks.

* - fix: Fix stunprod held prefix.

* Revert "Makes external & shuttle airlocks bump-openable (#22706)"

This reverts commit 6a73aed6d5.

* - balance: Tweak modifier sets once again.

* - balance: Tweak IED timer.

* - tweak: Chemical explosions can't create vacuum.
2024-02-15 18:08:42 +00:00

59 lines
1.7 KiB
C#

using Content.Shared.Weapons.Ranged.Components;
using Content.Shared.Weapons.Ranged.Events;
using Robust.Shared.Map;
namespace Content.Client.Weapons.Ranged.Systems;
public sealed partial class GunSystem
{
protected override void InitializeBallistic()
{
base.InitializeBallistic();
SubscribeLocalEvent<BallisticAmmoProviderComponent, UpdateAmmoCounterEvent>(OnBallisticAmmoCount);
}
private void OnBallisticAmmoCount(
EntityUid uid,
BallisticAmmoProviderComponent component,
UpdateAmmoCounterEvent args)
{
if (args.Control is DefaultStatusControl control)
{
control.Update(GetBallisticShots(component), component.Capacity);
}
}
protected override void Cycle(EntityUid uid, BallisticAmmoProviderComponent component, MapCoordinates coordinates)
{
if (!Timing.IsFirstTimePredicted)
return;
EntityUid? ent = null;
// TODO: Combine with TakeAmmo
if (component.Entities.Count > 0)
{
var existing = component.Entities[^1];
component.Entities.RemoveAt(component.Entities.Count - 1);
if (Containers.CanRemove(existing, component.Container)) // WD EDIT
{
Containers.Remove(existing, component.Container);
EnsureShootable(existing);
}
}
else if (component.UnspawnedCount > 0)
{
component.UnspawnedCount--;
ent = Spawn(component.Proto, coordinates);
EnsureShootable(ent.Value);
}
if (ent != null && IsClientSide(ent.Value))
Del(ent.Value);
var cycledEvent = new GunCycledEvent();
RaiseLocalEvent(uid, ref cycledEvent);
}
}