* - Corrupt borg speech the more damaged they are - Corrupt long borg messages if battery is low or empty * twiddle values * Remove RNG based loop, hardcode repeating values for p=0.25 up to 10 repeats. * Make sure that DamagedSiliconAccentSystem is AFTER ReplacementAccentSystem * add missing base initializer call * use Entity<T> pattern for event listener and clarify default values * Move corruption parameters to datafields * Add datafields to enable and disable the two types of corruption, and add datafields to override damage values and charge levels to support entities that don't have damageable components or power cells. * Use nullables for override values * Move DamagedSiliconAccentComponent to Shared and make it networked * Add DamagedSiliconAccent to cloning whitelist
81 lines
2.6 KiB
C#
81 lines
2.6 KiB
C#
using Content.Shared.FixedPoint;
|
|
using Robust.Shared.GameStates;
|
|
|
|
namespace Content.Shared.Speech.Components;
|
|
|
|
[RegisterComponent]
|
|
[NetworkedComponent]
|
|
public sealed partial class DamagedSiliconAccentComponent : Component
|
|
{
|
|
/// <summary>
|
|
/// Enable damage corruption effects
|
|
/// </summary>
|
|
[DataField]
|
|
public bool EnableDamageCorruption = true;
|
|
|
|
/// <summary>
|
|
/// Override total damage for damage corruption effects
|
|
/// </summary>
|
|
[DataField]
|
|
public FixedPoint2? OverrideTotalDamage;
|
|
|
|
/// <summary>
|
|
/// The probability that a character will be corrupted when total damage at or above <see cref="MaxDamageCorruption" />.
|
|
/// </summary>
|
|
[DataField]
|
|
public float MaxDamageCorruption = 0.5f;
|
|
|
|
/// <summary>
|
|
/// Probability of character corruption will increase linearly to <see cref="MaxDamageCorruption" /> once until
|
|
/// total damage is at or above this value.
|
|
/// </summary>
|
|
[DataField]
|
|
public FixedPoint2 DamageAtMaxCorruption = 300;
|
|
|
|
/// <summary>
|
|
/// Enable charge level corruption effects
|
|
/// </summary>
|
|
[DataField]
|
|
public bool EnableChargeCorruption = true;
|
|
|
|
/// <summary>
|
|
/// Override charge level for charge level corruption effects
|
|
/// </summary>
|
|
[DataField]
|
|
public float? OverrideChargeLevel;
|
|
|
|
/// <summary>
|
|
/// If the power cell charge is below this value (as a fraction of maximum charge),
|
|
/// power corruption will begin to be applied.
|
|
/// </summary>
|
|
[DataField]
|
|
public float ChargeThresholdForPowerCorruption = 0.15f;
|
|
|
|
/// <summary>
|
|
/// Regardless of charge level, this is how many characters at the start of a message will be 100% safe
|
|
/// from being dropped.
|
|
/// </summary>
|
|
[DataField]
|
|
public int StartPowerCorruptionAtCharIdx = 8;
|
|
|
|
/// <summary>
|
|
/// The probability that a character will be dropped due to charge level will be maximum for characters past
|
|
/// this index. This has the effect of longer messages dropping more characters later in the message.
|
|
/// </summary>
|
|
[DataField]
|
|
public int MaxPowerCorruptionAtCharIdx = 40;
|
|
|
|
/// <summary>
|
|
/// The maximum probability that a character will be dropped due to charge level.
|
|
/// </summary>
|
|
[DataField]
|
|
public float MaxDropProbFromPower = 0.5f;
|
|
|
|
/// <summary>
|
|
/// If a character is "dropped", this is the probability that the character will be turned into a period instead
|
|
/// of completely deleting the character.
|
|
/// </summary>
|
|
[DataField]
|
|
public float ProbToCorruptDotFromPower = 0.6f;
|
|
}
|