Merge remote-tracking branch 'upstream/master' into ed-16-02-2025-planet-light-upstream
# Conflicts: # Content.IntegrationTests/Tests/EntityTest.cs # Content.IntegrationTests/Tests/PostMapInitTest.cs # Content.Server/Medical/HealthAnalyzerSystem.cs # Content.Server/Procedural/DungeonSystem.Rooms.cs # Content.Server/Procedural/RoomFillComponent.cs # Content.Server/Procedural/RoomFillSystem.cs # Content.Shared/Inventory/InventorySystem.Relay.cs # Content.Shared/Projectiles/SharedProjectileSystem.cs # Content.Shared/Storage/EntitySystems/SharedStorageSystem.cs # Resources/Prototypes/Maps/Pools/default.yml # Resources/migration.yml
This commit is contained in:
@@ -19,11 +19,25 @@ public abstract class SharedArmorSystem : EntitySystem
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<ArmorComponent, InventoryRelayedEvent<CoefficientQueryEvent>>(OnCoefficientQuery);
|
||||
SubscribeLocalEvent<ArmorComponent, InventoryRelayedEvent<DamageModifyEvent>>(OnDamageModify);
|
||||
SubscribeLocalEvent<ArmorComponent, BorgModuleRelayedEvent<DamageModifyEvent>>(OnBorgDamageModify);
|
||||
SubscribeLocalEvent<ArmorComponent, GetVerbsEvent<ExamineVerb>>(OnArmorVerbExamine);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the total Damage reduction value of all equipment caught by the relay.
|
||||
/// </summary>
|
||||
/// <param name="ent">The item that's being relayed to</param>
|
||||
/// <param name="args">The event, contains the running count of armor percentage as a coefficient</param>
|
||||
private void OnCoefficientQuery(Entity<ArmorComponent> ent, ref InventoryRelayedEvent<CoefficientQueryEvent> args)
|
||||
{
|
||||
foreach (var armorCoefficient in ent.Comp.Modifiers.Coefficients)
|
||||
{
|
||||
args.Args.DamageModifiers.Coefficients[armorCoefficient.Key] = args.Args.DamageModifiers.Coefficients.TryGetValue(armorCoefficient.Key, out var coefficient) ? coefficient * armorCoefficient.Value : armorCoefficient.Value;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnDamageModify(EntityUid uid, ArmorComponent component, InventoryRelayedEvent<DamageModifyEvent> args)
|
||||
{
|
||||
args.Args.Damage = DamageSpecifier.ApplyModifierSet(args.Args.Damage, component.Modifiers);
|
||||
|
||||
Reference in New Issue
Block a user