static public void Postfix(CompPowerTrader __instance)
 {
     if (__instance.parent.def == ReplimatDef.ReplimatHopper)
     {
         ReplimatMod.repHopperCache.Add(__instance.parent, __instance);
         ReplimatUtility.UpdateRepHopperGrid(__instance);
     }
 }
 static public void Prefix(ThingWithComps __instance)
 {
     if (ReplimatMod.repHopperCache.TryGetValue(__instance, out CompPowerTrader comp))
     {
         comp.powerOnInt = false;
         ReplimatUtility.UpdateRepHopperGrid(comp);
         ReplimatMod.repHopperCache.Remove(__instance);
     }
 }
示例#3
0
        static void Postfix()
        {
            if (++tick == 600)             // 10 seconds
            {
                tick = 0;
                foreach (var repHopper in ReplimatMod.repHopperCache)
                {
                    if (repHopper.Key.Map == null)
                    {
                        ReplimatMod.repHopperCache.Remove(repHopper.Key);
                        break;
                    }

                    ReplimatUtility.UpdateRepHopperGrid(repHopper.Value);
                }
            }
        }