mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-14 21:01:14 +03:00
* Make every EntitySystem partial * Oobs thats for a diff PR * Also oops on that one * Test systems * git are we fr * Update file templates * cleanup empty classes while we are here * forgor --------- Co-authored-by: AJCM-git <ajcm_mail@disroot.org>
29 lines
1.1 KiB
C#
29 lines
1.1 KiB
C#
using Content.Shared.Examine;
|
|
using Content.Shared.Weapons.Ranged.Components;
|
|
using Content.Shared.Weapons.Ranged.Events;
|
|
|
|
namespace Content.Shared.Weapons.Ranged.Systems;
|
|
|
|
public sealed partial class GunSpreadModifierSystem : EntitySystem
|
|
{
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
SubscribeLocalEvent<GunSpreadModifierComponent, GunGetAmmoSpreadEvent>(OnGunGetAmmoSpread);
|
|
SubscribeLocalEvent<GunSpreadModifierComponent, ExaminedEvent>(OnExamine);
|
|
}
|
|
|
|
private void OnGunGetAmmoSpread(Entity<GunSpreadModifierComponent> ent, ref GunGetAmmoSpreadEvent args)
|
|
{
|
|
args.Spread *= ent.Comp.Spread;
|
|
}
|
|
|
|
private void OnExamine(Entity<GunSpreadModifierComponent> ent, ref ExaminedEvent args)
|
|
{
|
|
var percentage = Math.Round(ent.Comp.Spread * 100);
|
|
var loc = percentage < 100 ? "examine-gun-spread-modifier-reduction" : "examine-gun-spread-modifier-increase";
|
|
percentage = percentage < 100 ? 100 - percentage : percentage - 100;
|
|
var msg = Loc.GetString(loc, ("percentage", percentage));
|
|
args.PushMarkup(msg);
|
|
}
|
|
}
|