Files
ss14-wega/Content.Shared/Repairable/RepairableComponent.cs
Samuka d53fe69b86 Repairing borgs now takes multiple doafters (#41638)
* borg repair is now multiple doafters

* is a float now

* use else

* remove random new line i added for some reason

* add new line at the end of the file

* add documentation

* made repair system super robust

* borg heal faster from crit

* forgot to make it a datafield

* less overpower

* cant repair futher than the threshold for alive if not alive or dead

* fix math

* more math

* fixes

* some comentary

* more accurate

* simple solution

* new solution

* better numbers

* more accurate

* use helper function

* fine tunning the number

* better way to restart the doafter

* update AutoDoAfter

* not used

* more clear

* remove inline if

* improve helper methods

* updare pop up message

* another unused

* nuke consecutive repair bonus

* increase the repair (so it doesn't take ages to fix a borg)

* back to 10 per repair

* heal evenly

* fix for edge case

* fix

* fix

* it works now

* add / fix comments

* small clean up

* make easier to understand

* use FixedPoint2.Zero

* make it smaller

* add support for group even heal

* ops

* easier to read

* typo

* make the HealEvenly better

* rename to GetDamage

* negative value

* Update Content.Shared/Repairable/RepairableSystem.cs

---------

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
2025-12-15 12:15:22 +00:00

71 lines
2.4 KiB
C#

using Content.Shared.Damage;
using Content.Shared.Tools;
using Robust.Shared.GameStates;
using Robust.Shared.Prototypes;
namespace Content.Shared.Repairable;
/// <summary>
/// Use this component to mark a device as repairable.
/// </summary>
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
public sealed partial class RepairableComponent : Component
{
/// <summary>
/// All the damage to change information is stored in this <see cref="DamageSpecifier"/>.
/// </summary>
/// <remarks>
/// If this data-field is specified, it will change damage by this amount instead of setting all damage to 0.
/// in order to heal/repair the damage values have to be negative.
/// This will only be used if <see cref="DamageValue"/> is not null.
/// If this is null and so is <see cref="DamageValue"/> then all damage will be repaired at once.
/// </remarks>
[DataField, AutoNetworkedField]
public DamageSpecifier? Damage;
/// <summary>
/// Amount of damage to repair of the entity equaly distributed among the damage types the entity has.
/// </summary>
/// <remarks>
/// in order to heal/repair the damage values have to be negative.
/// </remarks>
[DataField, AutoNetworkedField]
public float? DamageValue;
/// <summary>
/// Cost of fuel used to repair this device.
/// </summary>
[DataField, AutoNetworkedField]
public float FuelCost = 5f;
/// <summary>
/// Tool quality necessary to repair this device.
/// </summary>
[DataField, AutoNetworkedField]
public ProtoId<ToolQualityPrototype> QualityNeeded = "Welding";
/// <summary>
/// The base tool use delay (seconds). This will be modified by the tool's quality
/// </summary>
[DataField, AutoNetworkedField]
public int DoAfterDelay = 1;
/// <summary>
/// If true and after the repair there still damage, a new doafter starts automatically
/// </summary>
[DataField, AutoNetworkedField]
public bool AutoDoAfter = true;
/// <summary>
/// A multiplier that will be applied to the above if an entity is repairing themselves.
/// </summary>
[DataField, AutoNetworkedField]
public float SelfRepairPenalty = 3f;
/// <summary>
/// Whether an entity is allowed to repair itself.
/// </summary>
[DataField, AutoNetworkedField]
public bool AllowSelfRepair = true;
}