Bug description: in Hot Coffee (https://steamcommunity.com/sharedfiles/filedetails/?id=764752651) (made by Toasty with collaboration from me) we implemented a rottable comp in our coffee XML.
Expected behaviour: it's expected that coffee, after production, remains fresh for 12 hours and then disappears according to this code:
<comps>
<li Class="CompProperties_Rottable">
<daysToRotStart>0.5</daysToRotStart>
<rotDestroys>true</rotDestroys>
</li>
</comps>
Current behaviour: Coffee will never rot. It is constantly in a state of "spoils in X hours/days".
This behaviour is independent of mod lists. It is the same if you have 50 mods or just Hot Coffee installed.
Current version of Hot Coffee (direct download) (https://drive.google.com/uc?export=download&id=0Bz2imWwZydMqUl8yLTEzbzY0ek0)
Does the rottable comp work for vanilla items for you without any mods? does it still work for vanilla with hot coffee installed?
Yes to both questions (I tested it myself, tested again just now + reported by a Steam user). I suspect this is because it's a drug, but I'm not sure.
So what we are saying is if a mod item uses comp_rottable its not working?
I don't know of any other mods that do this with a drug XML so I can't say for sure. Right now I can definitely say if a mod drug (has CompProperties_Drug) has the rottable comp it doesn't work.
Did you add the <Ticker>Rare</Ticker> to your XML? I'm rather sure that Comp_Rottable needs this ticker to work..
Compare it with another item from Core, as I can't look into it right now to give the exact name of it.. ( Not home yet :) )
It does have rare tick, I checked that.
Quote from: Haplo on October 04, 2016, 06:05:26 AM
Did you add the <Ticker>Rare</Ticker> to your XML? I'm rather sure that Comp_Rottable needs this ticker to work..
Compare it with another item from Core, as I can't look into it right now to give the exact name of it.. ( Not home yet :) )
I did not have tickerType rare, thanks! Can you expand on what this does? I see it can be Never, Normal, Rare or Long.
wat? yes you did it was in the abstract....wasnt it, i swear i saw it.....its the first thing i checked.
Also its how the "thing" ticks, normal is every tick, rare is 250 ticks, long is something longer than 250 that i cant remember but might be like 2000....:D
You're old, skully. Too old for this town. Also please do expand :(
See above.
Your def had a parentName abstract set, I thought the tickertype was set in that.
Yes im right:
RawCoffeeBeans has a parent of PlantFoodRawBase which has a parent of OrganicProductBase which has <tickerType>Rare</tickerType> in it.
Quote from: Dingo on October 03, 2016, 07:38:47 AMCurrent behaviour: Coffee will never rot. It is constantly in a state of "spoils in X hours/days".
Quote from: skullywag on October 04, 2016, 11:11:35 AM
Yes im right:
RawCoffeeBeans has a parent of PlantFoodRawBase which has a parent of OrganicProductBase which has <tickerType>Rare</tickerType> in it.
Who said anything about coffee BEANS? ;)
Quote from: Dingo on October 04, 2016, 11:15:57 AM
Quote from: Dingo on October 03, 2016, 07:38:47 AMCurrent behaviour: Coffee will never rot. It is constantly in a state of "spoils in X hours/days".
Quote from: skullywag on October 04, 2016, 11:11:35 AM
Yes im right:
RawCoffeeBeans has a parent of PlantFoodRawBase which has a parent of OrganicProductBase which has <tickerType>Rare</tickerType> in it.
Who said anything about coffee BEANS? ;)
The purest snortable ground-coffee powder
ohhhh i see, i really misread that OP. ugh.
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.
Thats exactly what it is.
tickerType validation warnings would be a good suggestion for the 'make modding easier thread'
"Thing has a comp that requires ticking, ticking is set to none" type deal?
"Cannot initialize CompRottable in Food.xml - tickerType undefined, expected Rare" type deal, maybe? Of course could be another comp.