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
2 changed files with 13 additions and 1 deletions

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)