WorkTable not ticking?

Started by Liegeman, April 01, 2015, 04:40:17 PM

Previous topic - Next topic

Liegeman

My extension of the worktable class needs to do a few things every tick, but for some reason neither Tick nor TickRare is never called on it. Any ideas? Are workbenches entirely static?

using System;
using System.Collections.Generic;
using UnityEngine;
using Verse;
using Verse.AI;
using Verse.Sound;
using RimWorld;
using System.Text;
namespace ModularResearch
{
    public class Building_ProductionBuilding : Building_WorkTable
    {
        public CompPowerTrader powerComp;

        public bool Powered
        {
            get
            {
                return this.powerComp.PowerOn;
            }
        }

        public Pawn Operator
        {
            get
            {
                List<Thing> list = Find.ThingGrid.ThingsListAt(this.InteractionCell);
                for (int i = 0; i < list.Count; i++)
                {
                    Pawn pawn = list[i] as Pawn;
                    if (pawn != null)
                    {
                        if (pawn.jobs.curJob != null)
                        {
                            return pawn;
                        }
                    }
                }
                return null;
            }
        }

        public bool HasOperator
        {
            get
            {
                return Operator != null;
            }
        }

        public override void SpawnSetup()
        {
            base.SpawnSetup();
            Log.Warning("Yo");
            this.powerComp = base.GetComp<CompPowerTrader>();
            return;
        }

        public override void Tick()
        {
            base.Tick();
            Log.Warning("Am ticking");
            if (!Powered)
                return;

            if (HasOperator)
            {
                Operator.CurJob.RecipeDef.workAmount -= 1;
                Log.Message(Operator.Name + " operating");
            }

            if (!GridsUtility.GetRoom(this).IsHuge) {
                Log.Message(GridsUtility.GetRoom(this).CellCount + " cells in room");
            }
        }

       
    }
}

skullywag

does you worktable xml def have ticvkerType set to normal or raretick?
Skullywag modded to death.
I'd never met an iterator I liked....until Zhentar saved me.
Why Unity5, WHY do you forsake me?

Liegeman

It has neither, but I tried both. Does it default to Never?

Latta

Yes, default is Never. Are you saying that even after setting <tickerType> to Normal, warning never appears on debug log?

Liegeman

No, I think I am saying that I did not know it defaulted to Never. Curious.
I suppose it saves processor cycles and memory.

I will add the tag and set it to normal. That should fix the issue.