Files
Delta-v/Content.Shared/_DV/Projectiles/SharedPressureProjectileSystem.cs
T
8ae2199a46 pka re-rework (#3671)
* make pka smaller

* re-buffs proto kinetic accelerator (#37012)

* new ruins

* genpop

* nvm

* abc

* fuckin

* turnstyle

* ruins

* stamp

* abc

* bruh

* efg

* pka fixed

* range tweak

* make lavaland 42kpa

* rework pka modkits and quarter damage when in pressure

* add modkits to points shop

* add indoors modkit for traitors

* change range to actually be range

---------

Co-authored-by: deltanedas <@deltanedas:kde.org>
Co-authored-by: TytosB <54259736+TytosB@users.noreply.github.com>
2025-05-09 16:53:26 +01:00

37 lines
1.3 KiB
C#

using Content.Shared.Projectiles;
namespace Content.Shared._DV.Projectiles;
public abstract class SharedPressureProjectileSystem : EntitySystem
{
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<PressureProjectileComponent, ProjectileHitEvent>(OnProjectileHit);
}
private void OnProjectileHit(Entity<PressureProjectileComponent> ent, ref ProjectileHitEvent args)
{
if (GetPressure(ent) > ent.Comp.MaxPressure)
args.Damage *= ent.Comp.Modifier;
}
/// <summary>
/// Multiply the modifier by some factor.
/// </summary>
public void MultiplyModifier(Entity<PressureProjectileComponent?> ent, float factor)
{
if (!Resolve(ent, ref ent.Comp, false))
return;
ent.Comp.Modifier *= factor;
// no dirty since shooting is almost guaranteed to happen in pvs range, mispredict is nearly impossible
// (and projectile hit event isnt predicted anyway)
}
// client assumes it to be in a vacuum to correctly predict for the intended use case of lavaland/space.
// it also means it would mispredict targets staying alive rather than falsely falling over which is far more annoying.
protected virtual float GetPressure(EntityUid uid) => 0f;
}