* Armor

* radiation tweaks

* asphyxiation ignore resistances
This commit is contained in:
mirrorcult
2021-10-18 16:24:37 -07:00
committed by GitHub
parent 47954e1565
commit 636a04eccd
13 changed files with 148 additions and 8 deletions

View File

@@ -288,6 +288,7 @@ namespace Content.Client.Entry
"HandLabeler",
"Label",
"GhostRadio",
"Armor"
};
}
}

View 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!;
}
}

View 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);
}
}
}

View File

@@ -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)

View File

@@ -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())

View File

@@ -118,13 +118,18 @@ namespace Content.Shared.Damage
}
// Apply resistances
if (!ignoreResistances && damageable.DamageModifierSetId != null)
if (!ignoreResistances)
{
if (_prototypeManager.TryIndex<DamageModifierSetPrototype>(damageable.DamageModifierSetId, out var modifierSet))
if (damageable.DamageModifierSetId != null &&
_prototypeManager.TryIndex<DamageModifierSetPrototype>(damageable.DamageModifierSetId, out var modifierSet))
{
damage = DamageSpecifier.ApplyModifierSet(damage, modifierSet);
}
var ev = new DamageModifyEvent(damage);
RaiseLocalEvent(uid, ev, false);
damage = ev.Damage;
if (damage.Empty)
{
return damage;
@@ -199,6 +204,23 @@ namespace Content.Shared.Damage
}
}
/// <summary>
/// Raised on an entity when damage is about to be dealt,
/// in case anything else needs to modify it other than the base
/// damageable component.
///
/// For example, armor.
/// </summary>
public class DamageModifyEvent : EntityEventArgs
{
public DamageSpecifier Damage;
public DamageModifyEvent(DamageSpecifier damage)
{
Damage = damage;
}
}
public class DamageChangedEvent : EntityEventArgs
{
/// <summary>

View File

@@ -69,6 +69,10 @@
sprite: Clothing/Eyes/Glasses/meson.rsi
- type: Clothing
sprite: Clothing/Eyes/Glasses/meson.rsi
- type: Armor
modifiers:
coefficients:
Radiation: 0.5
- type: entity
parent: ClothingEyesBase

View File

@@ -29,6 +29,14 @@
- type: PressureProtection
highPressureMultiplier: 0.5
lowPressureMultiplier: 100
- type: Armor
modifiers:
coefficients:
Blunt: 0.90
Slash: 0.90
Piercing: 0.95
Heat: 0.90
Radiation: 0.25
- type: entity
abstract: true

View File

@@ -41,6 +41,13 @@
sprite: Clothing/Head/Helmets/security.rsi
- type: Clothing
sprite: Clothing/Head/Helmets/security.rsi
- type: Armor
modifiers:
coefficients:
Blunt: 0.8
Slash: 0.8
Piercing: 0.9
Heat: 0.8
- type: entity
parent: ClothingHeadBase

View File

@@ -1,3 +1,5 @@
# Numbers for armor here largely taken from /tg/.
- type: entity
parent: ClothingOuterBase
id: ClothingOuterArmorReflective
@@ -8,6 +10,13 @@
sprite: Clothing/OuterClothing/Armor/armor_reflec.rsi
- type: Clothing
sprite: Clothing/OuterClothing/Armor/armor_reflec.rsi
- type: Armor
modifiers:
coefficients:
Blunt: 0.9
Slash: 0.9
Piercing: 0.9
Heat: 0.4 # this technically means it protects against fires pretty well?
- type: entity
parent: ClothingOuterBase
@@ -19,6 +28,13 @@
sprite: Clothing/OuterClothing/Armor/bulletproof.rsi
- type: Clothing
sprite: Clothing/OuterClothing/Armor/bulletproof.rsi
- type: Armor
modifiers:
coefficients:
Blunt: 0.9
Slash: 0.9
Piercing: 0.4
Heat: 0.9
- type: entity
parent: ClothingOuterBase
@@ -30,6 +46,13 @@
sprite: Clothing/OuterClothing/Armor/cult_armour.rsi
- type: Clothing
sprite: Clothing/OuterClothing/Armor/cult_armour.rsi
- type: Armor
modifiers:
coefficients:
Blunt: 0.5
Slash: 0.5
Piercing: 0.6
Heat: 0.5
- type: entity
parent: ClothingOuterBase
@@ -41,9 +64,17 @@
sprite: Clothing/OuterClothing/Armor/heavy.rsi
- type: Clothing
sprite: Clothing/OuterClothing/Armor/heavy.rsi
- type: Armor
modifiers:
coefficients:
Blunt: 0.2
Slash: 0.2
Piercing: 0.2
Heat: 0.5
Radiation: 0
- type: entity
parent: ClothingOuterBase
parent: ClothingOuterArmorHeavy
id: ClothingOuterArmorHeavyGreen
name: green heavy armor suit
description: A heavily armored suit with green accents that protects against excessive damage.
@@ -54,7 +85,7 @@
sprite: Clothing/OuterClothing/Armor/heavygreen.rsi
- type: entity
parent: ClothingOuterBase
parent: ClothingOuterArmorHeavy
id: ClothingOuterArmorHeavyRed
name: red heavy armor suit
description: A heavily armored suit with red accents that protects against excessive damage.
@@ -65,7 +96,7 @@
sprite: Clothing/OuterClothing/Armor/heavyred.rsi
- type: entity
parent: ClothingOuterBase
parent: ClothingOuterArmorHeavy
id: ClothingOuterArmorMagusblue
name: magus blue
description: An blue armored suit that provides good protection.
@@ -76,7 +107,7 @@
sprite: Clothing/OuterClothing/Armor/magusblue.rsi
- type: entity
parent: ClothingOuterBase
parent: ClothingOuterArmorHeavy
id: ClothingOuterArmorMagusred
name: magus red
description: A red armored suit that provides good protection.

View File

@@ -18,3 +18,11 @@
- type: PressureProtection
highPressureMultiplier: 0.75
lowPressureMultiplier: 100
- type: Armor
modifiers:
coefficients:
Blunt: 0.90
Slash: 0.90
Piercing: 0.95
Heat: 0.90
Radiation: 0.25

View File

@@ -49,6 +49,13 @@
sprite: Clothing/OuterClothing/Coats/hos_trenchcoat.rsi
- type: Storage
capacity: 10
- type: Armor
modifiers:
coefficients:
Blunt: 0.7
Slash: 0.7
Piercing: 0.7
Heat: 0.7
- type: entity
parent: ClothingOuterBase

View File

@@ -30,6 +30,13 @@
sprite: Clothing/OuterClothing/Vests/kevlar.rsi
- type: Clothing
sprite: Clothing/OuterClothing/Vests/kevlar.rsi
- type: Armor
modifiers:
coefficients:
Blunt: 0.9
Slash: 0.9
Piercing: 0.4
Heat: 0.9
- type: entity
parent: ClothingOuterBase