I'm sorry if it isn't the good category to post Hooks suggestion but because OxidePatcher doesn't supports creating new hook inside a method (I mean it only allow to create hook at start of a method) so I can't create a PR and because I don't want to ping administrator on Discord each time I would like a new hook so I prefer to post it there hoping someone can add them.
Assembly-CSharp > Global > DecayEntity > DecayTick():
public virtual void DecayTick()
{
if (this.decay == null)
{
return;
}
float single = UnityEngine.Time.time - this.lastDecayTick;
if (single < ConVar.Decay.tick)
{
return;
}
this.lastDecayTick = UnityEngine.Time.time;
if (!this.decay.ShouldDecay(this))
{
return;
}
float single1 = single * ConVar.Decay.scale;
if (ConVar.Decay.upkeep)
{
this.upkeepTimer += single1;
if (this.upkeepTimer > 0f)
{
BuildingPrivlidge buildingPrivilege = this.GetBuildingPrivilege();
if (buildingPrivilege != null)
{
this.upkeepTimer -= buildingPrivilege.PurchaseUpkeepTime(this, Mathf.Max(this.upkeepTimer, 600f));
}
}
if (this.upkeepTimer < 1f)
{
if (base.healthFraction < 1f && ConVar.Decay.upkeep_heal_scale > 0f && base.SecondsSinceAttacked > 600f)
{
if (Interface.CallHook("OnDecayTickHeal", this) != null)
{
return;
}
float decayDuration = single / this.decay.GetDecayDuration(this) * ConVar.Decay.upkeep_heal_scale;
this.Heal(this.MaxHealth() * decayDuration);
}
return;
}
this.upkeepTimer = 1f;
}
this.decayTimer += single1;
if (this.decayTimer < this.decay.GetDecayDelay(this))
{
return;
}
using (TimeWarning timeWarning = TimeWarning.New("DecayTick", 0))
{
float upkeepInsideDecayScale = 1f;
if (!ConVar.Decay.upkeep)
{
for (int i = 0; i < (int)this.decayPoints.Length; i++)
{
DecayPoint decayPoint = this.decayPoints[i];
if (decayPoint.IsOccupied(this))
{
upkeepInsideDecayScale -= decayPoint.protection;
}
}
}
else if (!this.IsOutside())
{
upkeepInsideDecayScale *= ConVar.Decay.upkeep_inside_decay_scale;
}
if (upkeepInsideDecayScale > 0f)
{
if (Interface.CallHook("OnDecayTickDamage", this) != null)
{
return;
}
float decayDuration1 = single1 / this.decay.GetDecayDuration(this) * this.MaxHealth();
base.Hurt(decayDuration1 * upkeepInsideDecayScale * this.decayVariance, DamageType.Decay, null, true);
}
}
}