[A15] CompProperties_Rottable Not Working

Started by Dingo, October 03, 2016, 07:38:47 AM

Previous topic - Next topic

Dingo

So, just to clarify for any aspiring modders who might run into this thread in the year 3016:

The reason the rottable comp doesn't work outside of the tickerType=Rare scenario is probably due to this code (and correct me if I'm wrong here, guys) in CompRottable within the C# assembly -

public override void CompTickRare()
{
float rotProgress = this.RotProgress;
float num = 1f;
float temperatureForCell = GenTemperature.GetTemperatureForCell(this.parent.PositionHeld);
num *= GenTemperature.RotRateAtTemperature(temperatureForCell);
this.RotProgress += Mathf.Round(num * 250f);
if (this.Stage == RotStage.Rotting && this.PropsRot.rotDestroys)
{
if (Find.SlotGroupManager.SlotGroupAt(this.parent.Position) != null)
{
Messages.Message("MessageRottedAwayInStorage".Translate(new object[]
{
this.parent.Label
}).CapitalizeFirst(), MessageSound.Silent);
LessonAutoActivator.TeachOpportunity(ConceptDefOf.SpoilageAndFreezers, OpportunityType.GoodToKnow);
}
this.parent.Destroy(DestroyMode.Vanish);
return;
}
bool flag = Mathf.FloorToInt(rotProgress / 60000f) != Mathf.FloorToInt(this.RotProgress / 60000f);
if (flag)
{
if (this.Stage == RotStage.Rotting && this.PropsRot.rotDamagePerDay > 0f)
{
this.parent.TakeDamage(new DamageInfo(DamageDefOf.Rotting, GenMath.RoundRandom(this.PropsRot.rotDamagePerDay), null, null, null));
}
else if (this.Stage == RotStage.Dessicated && this.PropsRot.dessicatedDamagePerDay > 0f && this.ShouldTakeDessicateDamage())
{
this.parent.TakeDamage(new DamageInfo(DamageDefOf.Rotting, GenMath.RoundRandom(this.PropsRot.dessicatedDamagePerDay), null, null, null));
}
}
}


I have to assume this is done to save system resources, since the Rare ticker doesn't apply to every tick.

skullywag

Skullywag modded to death.
I'd never met an iterator I liked....until Zhentar saved me.
Why Unity5, WHY do you forsake me?

Zhentar

tickerType validation warnings would be a good suggestion for the 'make modding easier thread'

skullywag

"Thing has a comp that requires ticking, ticking is set to none" type deal?
Skullywag modded to death.
I'd never met an iterator I liked....until Zhentar saved me.
Why Unity5, WHY do you forsake me?

Dingo

"Cannot initialize CompRottable in Food.xml - tickerType undefined, expected Rare" type deal, maybe? Of course could be another comp.