Add a penalty to self-repair (#8951)
This commit is contained in:
@@ -25,5 +25,11 @@ namespace Content.Server.Repairable
|
|||||||
|
|
||||||
[ViewVariables(VVAccess.ReadWrite)] [DataField("doAfterDelay")]
|
[ViewVariables(VVAccess.ReadWrite)] [DataField("doAfterDelay")]
|
||||||
public int DoAfterDelay = 1;
|
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)
|
if (!EntityManager.TryGetComponent(component.Owner, out DamageableComponent? damageable) || damageable.TotalDamage == 0)
|
||||||
return;
|
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?
|
// 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;
|
return;
|
||||||
|
|
||||||
if (component.Damage != null)
|
if (component.Damage != null)
|
||||||
|
|||||||
Reference in New Issue
Block a user