Armor (#4934)
* Armor * radiation tweaks * asphyxiation ignore resistances
This commit is contained in:
15
Content.Server/Armor/ArmorComponent.cs
Normal file
15
Content.Server/Armor/ArmorComponent.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using Content.Shared.Damage;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
|
||||
namespace Content.Server.Armor
|
||||
{
|
||||
[RegisterComponent]
|
||||
public class ArmorComponent : Component
|
||||
{
|
||||
public override string Name => "Armor";
|
||||
|
||||
[DataField("modifiers", required: true)]
|
||||
public DamageModifierSet Modifiers = default!;
|
||||
}
|
||||
}
|
||||
20
Content.Server/Armor/ArmorSystem.cs
Normal file
20
Content.Server/Armor/ArmorSystem.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using Content.Shared.Damage;
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
namespace Content.Server.Armor
|
||||
{
|
||||
public class ArmorSystem : EntitySystem
|
||||
{
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<ArmorComponent, DamageModifyEvent>(OnDamageModify);
|
||||
}
|
||||
|
||||
private void OnDamageModify(EntityUid uid, ArmorComponent component, DamageModifyEvent args)
|
||||
{
|
||||
args.Damage = DamageSpecifier.ApplyModifierSet(args.Damage, component.Modifiers);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user