[SOLVED] Building.Tick() not firing

Started by Kaizyn, April 26, 2016, 03:56:14 PM

Previous topic - Next topic

Kaizyn

If anyone has a suggestion here, it would be great.    I'm working on a mod and hit an issue - I can't see any obvious reason, but the .Tick() (and  .TickRare() ) functions aren't firing.


    public class Building_TradePost : Building
    {

        public Building_TradePost()
        {
            Log.Message("TradePost initialization - start.");
        }

        public override void Tick()
        {
            base.Tick();
            Log.Message("Ticking");
        }

        public override void ExposeData()
        {
            Log.Message("Expose Data called as " + Scribe.mode.ToString());
           
            if (Scribe.mode == LoadSaveMode.LoadingVars)
            {
                Log.Message("Loading variables called");
                base.ExposeData();
                Scribe_Values.LookValue<bool>(ref RWTradeRequestData.dataGenerated, "dataGenerated", false, false);
            }
           
            if (Scribe.mode == LoadSaveMode.Saving)
            {
                Log.Message("Saving called");
                base.ExposeData();
                Scribe_Values.LookValue<bool>(ref RWTradeRequestData.dataGenerated, "dataGenerated", false, false);
            }           
        }

    }



This is a trimmed down version of the class, I deleted most of the contents and just left a few lines in these functions for examples, but as far as I can tell everything is fine -- the building appears fine, when I interact with it, the window I make pops up and does its stuff, and

ExposeData() runs as expected and my data is loaded & saved without any troubles.

... But .Tick() never gets called ...  I also implemented TickRare() and TickLong() as tests, but they also don't fire.   


I was digging and snooping to see if there was some flag you had to set for a Thing to mark it as being in the queue for Tick calls, but I couldn't find anything so far ...

NoImageAvailable

Did you set a ticker type in the ThingDef for your trade post?
"The power of friendship destroyed the jellyfish."

Rikiki

Yep, as NIA said, add this line in your building def:
<TickerType>Normal</TickerType>

Kaizyn

Thanks, folks!     I thought there must be some flag, and I saw those ticker types in the source in my digging, but couldn't figure where they got set.

Didn't catch it in any XML files ...