перенос файлов сервера из папки White в _White
This commit is contained in:
33
Content.Server/_White/Crossbow/ModifyDamageOnShootSystem.cs
Normal file
33
Content.Server/_White/Crossbow/ModifyDamageOnShootSystem.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using Content.Shared.Projectiles;
|
||||
using Content.Shared.Throwing;
|
||||
using Content.Shared.Weapons.Ranged.Events;
|
||||
|
||||
namespace Content.Server._White.Crossbow;
|
||||
|
||||
public sealed class ModifyDamageOnShootSystem : EntitySystem
|
||||
{
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<ModifyDamageOnShootComponent, AmmoShotEvent>(OnShoot);
|
||||
}
|
||||
|
||||
private void OnShoot(EntityUid uid, ModifyDamageOnShootComponent component, AmmoShotEvent args)
|
||||
{
|
||||
foreach (var proj in args.FiredProjectiles)
|
||||
{
|
||||
var comp = EnsureComp<ThrowDamageModifierComponent>(proj);
|
||||
comp.Damage += component.Damage;
|
||||
|
||||
if (!component.AddEmbedding)
|
||||
continue;
|
||||
|
||||
comp.AddEmbedding = true;
|
||||
var embed = EnsureComp<EmbeddableProjectileComponent>(proj);
|
||||
embed.Offset = component.Offset;
|
||||
embed.PreventEmbedding = false;
|
||||
Dirty(proj, embed);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user