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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -347,7 +347,7 @@ namespace Content.Server.Body.Respiratory
|
||||
alertsComponent.ShowAlert(AlertType.LowOxygen);
|
||||
}
|
||||
|
||||
EntitySystem.Get<DamageableSystem>().TryChangeDamage(Owner.Uid, Damage);
|
||||
EntitySystem.Get<DamageableSystem>().TryChangeDamage(Owner.Uid, Damage, true);
|
||||
}
|
||||
|
||||
private void StopSuffocation()
|
||||
@@ -359,7 +359,7 @@ namespace Content.Server.Body.Respiratory
|
||||
alertsComponent.ClearAlert(AlertType.LowOxygen);
|
||||
}
|
||||
|
||||
EntitySystem.Get<DamageableSystem>().TryChangeDamage(Owner.Uid, DamageRecovery);
|
||||
EntitySystem.Get<DamageableSystem>().TryChangeDamage(Owner.Uid, DamageRecovery, true);
|
||||
}
|
||||
|
||||
public GasMixture Clean(BloodstreamComponent bloodstream)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using Content.Server.Atmos;
|
||||
using Content.Server.Inventory.Components;
|
||||
using Content.Shared.Damage;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
@@ -15,6 +16,7 @@ namespace Content.Server.Inventory
|
||||
SubscribeLocalEvent<InventoryComponent, EntRemovedFromContainerMessage>(HandleInvRemovedFromContainer);
|
||||
SubscribeLocalEvent<InventoryComponent, HighPressureEvent>(OnHighPressureEvent);
|
||||
SubscribeLocalEvent<InventoryComponent, LowPressureEvent>(OnLowPressureEvent);
|
||||
SubscribeLocalEvent<InventoryComponent, DamageModifyEvent>(OnDamageModify);
|
||||
}
|
||||
|
||||
private static void HandleInvRemovedFromContainer(EntityUid uid, InventoryComponent component, EntRemovedFromContainerMessage args)
|
||||
@@ -37,6 +39,14 @@ namespace Content.Server.Inventory
|
||||
RelayPressureEvent(component, args);
|
||||
}
|
||||
|
||||
private void OnDamageModify(EntityUid uid, InventoryComponent component, DamageModifyEvent args)
|
||||
{
|
||||
foreach (var equipped in component.GetAllHeldItems())
|
||||
{
|
||||
RaiseLocalEvent(equipped.Uid, args, false);
|
||||
}
|
||||
}
|
||||
|
||||
private void RelayPressureEvent<T>(InventoryComponent component, T args) where T : PressureEvent
|
||||
{
|
||||
foreach (var equipped in component.GetAllHeldItems())
|
||||
|
||||
Reference in New Issue
Block a user