Exemple #1
0
 public static void WatchTickAction(JobDriver_WatchBuilding __instance)
 {
     // The Hook for tracking things used:
     RePower.AddBuildingUsed(__instance.job.targetA.Thing as Building);
 }
Exemple #2
0
        public override void Initialize()
        {
            IEnumerable <ThingDef> blist = DefDatabase <ThingDef> .AllDefsListForReading.Where(td => td.BuildableByPlayer &&
                                                                                               td.HasComp(typeof(CompPowerTrader)));

            foreach (ThingDef def in blist)
            {
                float bpc = def.GetCompProperties <CompProperties_Power>().basePowerConsumption;
                if (bpc <= 0f)
                {
                    continue;
                }
                float minbpc = bpc / 100f;
                if (minbpc < 10f)
                {
                    minbpc = 10f;
                }

                List <ThingCategoryDef> tc = def.thingCategories;



                if (def.IsWorkTable || def.hasInteractionCell)
                {
                    Logger.Message(string.Format("Table {0} / {1} / {2} / {3} / {4} / {5}", def.defName, minbpc, bpc, tc.NullOrEmpty() ? "false" : string.Join(",", tc.Select(x => x.defName).ToArray()), def.designationCategory, def.hasInteractionCell));
                    RegisterWorkTable(def.defName, -minbpc, -bpc);
                }
                else
                {
                    string desname = def.designationCategory.defName;
                    if (desname == "Joy" || desname == "Structure" || def.HasComp(typeof(CompFacility)))
                    {
                        Logger.Message(string.Format("Reg {0} / {1} / {2} / {3} / {4} / {5}", def.defName, minbpc, bpc, tc.NullOrEmpty() ? "false" : string.Join(",", tc.Select(x => x.defName).ToArray()), def.designationCategory, def.hasInteractionCell));
                        RegisterSpecialPowerTrader(def.defName, -minbpc, -bpc);
                    }
                }
            }

            /*
             * RegisterWorkTable("ElectricTailoringBench", -10, -500); // 10W Idle, 500W active
             * RegisterWorkTable("ElectricSmithy", -10, -1000); // 10W Idle, 1000W Active
             * RegisterWorkTable("TableMachining", -10, -1400); // 10W Idle, 1400W Active
             * RegisterWorkTable("ElectricStove", -10, -1000); // 10W Idle, 1000W Active
             * RegisterWorkTable("ElectricSmelter", -400, -4500); // 400W Idle, 4500W Active
             * RegisterWorkTable("BiofuelRefinery", -10, -1800); // 10W Idle, 1800W Active
             * RegisterWorkTable("FabricationBench", -10, -1800); // 10W Idle, 1800W Active
             * RegisterWorkTable("ElectricCrematorium", -200, -750); // 200W Idle, 750W Active
             *
             * RegisterSpecialPowerTrader("MultiAnalyzer", -10, -600); // 10W Idle, 600W Active
             * RegisterSpecialPowerTrader("VitalsMonitor", -10, -1000); // 10W Idle, 1000W Active
             * RegisterSpecialPowerTrader("HiTechResearchBench", -100, -1000); // 100W Idle, 1000W Active
             * RegisterSpecialPowerTrader("Autodoor", -5, -500); // 5W Idle, 500W Active
             *
             * // Televisions!
             * RegisterSpecialPowerTrader("TubeTelevision", -10, -400); // 10W Idle, 400W Active
             * RegisterSpecialPowerTrader("FlatscreenTelevision", -10, -400); // 10W Idle, 400W Active
             * RegisterSpecialPowerTrader("MegascreenTelevision", -10, -400); // 10W Idle, 400W Active
             *
             * // Drill
             * RegisterSpecialPowerTrader("DeepDrill", -10, -500); // 10W Idle, 500W Active
             */

            Logger.Message("Initialized Components");

            instance = this;

            Logger.Message("Registered instance");
        }
Exemple #3
0
 public static void UsedThisTick(Building_WorkTable __instance)
 {
     // The Hook for tracking things used:
     RePower.AddBuildingUsed(__instance);
 }
Exemple #4
0
 public Tracker(RePower rePower)
 {
     RePower = rePower;
 }