Merge 03c22e55d1 into c3c6a6abd9
This commit is contained in:
commit
e703112f8b
|
|
@ -8,6 +8,7 @@ namespace Content.Shared.Armor;
|
|||
/// <summary>
|
||||
/// Used for clothing that reduces damage when worn.
|
||||
/// </summary>
|
||||
[AutoGenerateComponentState] // DeltaV - Give armor melee stamina resistance
|
||||
[RegisterComponent, NetworkedComponent, Access(typeof(SharedArmorSystem))]
|
||||
public sealed partial class ArmorComponent : Component
|
||||
{
|
||||
|
|
@ -30,11 +31,13 @@ public sealed partial class ArmorComponent : Component
|
|||
[DataField]
|
||||
public bool ShowArmorOnExamine = true;
|
||||
|
||||
// Start DeltaV - Give armor melee stamina resistance
|
||||
/// <summary>
|
||||
/// DeltaV - Gets the effective stamina melee damage coefficient, based on the armor's blunt protection.
|
||||
/// </summary>
|
||||
[ViewVariables]
|
||||
public float StaminaMeleeDamageCoefficient => Modifiers.Coefficients.GetValueOrDefault("Blunt", 1.0f);
|
||||
[DataField, AutoNetworkedField]
|
||||
public float? StaminaMeleeDamageCoefficient;
|
||||
// End DeltaV - Give armor melee stamina resistance
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
|
|
@ -25,8 +25,21 @@ public abstract class SharedArmorSystem : EntitySystem
|
|||
SubscribeLocalEvent<ArmorComponent, InventoryRelayedEvent<DamageModifyEvent>>(OnDamageModify);
|
||||
SubscribeLocalEvent<ArmorComponent, BorgModuleRelayedEvent<DamageModifyEvent>>(OnBorgDamageModify);
|
||||
SubscribeLocalEvent<ArmorComponent, GetVerbsEvent<ExamineVerb>>(OnArmorVerbExamine);
|
||||
|
||||
SubscribeLocalEvent<ArmorComponent, MapInitEvent>(OnMapInit); // DeltaV - Give armor melee stamina resistance
|
||||
}
|
||||
|
||||
// Start DeltaV - Give armor melee stamina resistance
|
||||
private void OnMapInit(Entity<ArmorComponent> armor, ref MapInitEvent args)
|
||||
{
|
||||
if (armor.Comp.StaminaMeleeDamageCoefficient is not null)
|
||||
return;
|
||||
|
||||
armor.Comp.StaminaMeleeDamageCoefficient = armor.Comp.Modifiers.Coefficients.GetValueOrDefault("Blunt", 1.0f);
|
||||
Dirty(armor);
|
||||
}
|
||||
// End DeltaV - Give armor melee stamina resistance
|
||||
|
||||
/// <summary>
|
||||
/// Get the total Damage reduction value of all equipment caught by the relay.
|
||||
/// </summary>
|
||||
|
|
@ -103,16 +116,16 @@ public abstract class SharedArmorSystem : EntitySystem
|
|||
));
|
||||
}
|
||||
|
||||
// Begin DeltaV Additions - Add melee stamina resistance information if it has any
|
||||
if (!MathHelper.CloseTo(component.StaminaMeleeDamageCoefficient, 1.0f))
|
||||
{
|
||||
msg.PushNewline();
|
||||
var reduction = (1 - component.StaminaMeleeDamageCoefficient) * 100;
|
||||
msg.AddMarkupOrThrow(Loc.GetString("armor-stamina-melee-coefficient-value",
|
||||
("value", MathF.Round(reduction, 1))
|
||||
));
|
||||
}
|
||||
// End DeltaV
|
||||
// Start DeltaV - Add melee stamina resistance information if it has any
|
||||
if (component.StaminaMeleeDamageCoefficient == null || MathHelper.CloseTo(component.StaminaMeleeDamageCoefficient.Value, 1.0f))
|
||||
return msg;
|
||||
|
||||
msg.PushNewline();
|
||||
var reduction = (1 - component.StaminaMeleeDamageCoefficient) * 100;
|
||||
msg.AddMarkupOrThrow(Loc.GetString("armor-stamina-melee-coefficient-value",
|
||||
("value", MathF.Round(reduction.Value, 2))
|
||||
));
|
||||
// End DeltaV - Add melee stamina resistance information if it has any
|
||||
|
||||
return msg;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ public sealed class StaminaMeleeResistanceSystem : EntitySystem
|
|||
|
||||
private void OnGetMeleeResistance(Entity<ArmorComponent> ent, ref InventoryRelayedEvent<BeforeStaminaDamageEvent> args)
|
||||
{
|
||||
if (args.Args.FromMelee)
|
||||
args.Args.Value *= ent.Comp.StaminaMeleeDamageCoefficient;
|
||||
if (args.Args.FromMelee && ent.Comp.StaminaMeleeDamageCoefficient.HasValue)
|
||||
args.Args.Value *= ent.Comp.StaminaMeleeDamageCoefficient.Value;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -171,6 +171,7 @@
|
|||
Slash: 0.6
|
||||
Piercing: 0.3
|
||||
Heat: 0.9
|
||||
staminaMeleeDamageCoefficient: 0.9 # DeltaV - Reduce Melee Stamina
|
||||
- type: StaminaResistance # DeltaV
|
||||
damageCoefficient: 0.6
|
||||
- type: ExplosionResistance
|
||||
|
|
|
|||
Loading…
Reference in New Issue