Add a penalty to self-repair (#8951)
This commit is contained in:
parent
eacffcccc1
commit
4206780889
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in New Issue