Add a penalty to self-repair (#8951)

This commit is contained in:
Rane 2022-06-19 01:50:43 -04:00 committed by GitHub
parent eacffcccc1
commit 4206780889
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 1 deletions

View File

@ -25,5 +25,11 @@ namespace Content.Server.Repairable
[ViewVariables(VVAccess.ReadWrite)] [DataField("doAfterDelay")]
public int DoAfterDelay = 1;
/// <summary>
/// A multiplier that will be applied to the above if an entity is repairing themselves.
/// </summary>
[ViewVariables(VVAccess.ReadWrite)] [DataField("selfRepairPenalty")]
public float SelfRepairPenalty = 3f;
}
}

View File

@ -24,8 +24,14 @@ namespace Content.Server.Repairable
if (!EntityManager.TryGetComponent(component.Owner, out DamageableComponent? damageable) || damageable.TotalDamage == 0)
return;
float delay = component.DoAfterDelay;
// Add a penalty to how long it takes if the user is repairing itself
if (args.User == args.Target)
delay *= component.SelfRepairPenalty;
// Can the tool actually repair this, does it have enough fuel?
if (!await _toolSystem.UseTool(args.Used, args.User, uid, component.FuelCost, component.DoAfterDelay, component.QualityNeeded))
if (!await _toolSystem.UseTool(args.Used, args.User, uid, component.FuelCost, delay, component.QualityNeeded))
return;
if (component.Damage != null)