Ejemplo n.º 1
0
 public override void PostMake()
 {
     base.PostMake();
     extension       = def.GetModExtension <DefModExtension_DroneStation>();
     refuelableComp  = GetComp <CompRefuelable>();
     compPowerTrader = GetComp <CompPowerTrader>();
 }
Ejemplo n.º 2
0
        public override void SpawnSetup(Map map, bool respawningAfterLoad)
        {
            base.SpawnSetup(map, respawningAfterLoad);
            this.mapManager       = map.GetComponent <MapTickManager>();
            refuelableComp        = GetComp <CompRefuelable>();
            compPowerTrader       = GetComp <CompPowerTrader>();
            extension             = def.GetModExtension <DefModExtension_DroneStation>();
            compPowerWorkSetting  = GetComp <CompPowerWorkSetting>();
            StationRangecells_old = StationRangecells;
            //Setup Allowd Area
            //Enssuring that Update_droneAllowedArea_forDrones() is run resolves #224 (May need to add a diffrent check)
            if (droneAllowedArea == null)
            {
                //Log.Message("droneAllowedArea was null");
                Update_droneAllowedArea_forDrones(droneAllowedArea);
            }
            //Load the SleepTimes from XML
            cachedSleepTimeList = extension.Sleeptimes.Split(',');

            cashed_GetCoverageCells = StationRangecells.ToList();

            //Check for missing WorkTypeDef
            foreach (WorkTypeDef def in extension.workTypes.Except(WorkSettings.Keys).ToList())
            {
                WorkSettings.Add(def, true);
            }
            //Remove stuff thats nolonger valid (can only happen after updates)
            foreach (WorkTypeDef def in WorkSettings.Keys.Except(extension.workTypes).ToList())
            {
                WorkSettings.Remove(def);
            }
            //need to take action to init droneSkillsRecord
            if (droneSkillsRecord.Count == 0)
            {
                Pawn_Drone drone = MakeDrone();
                GenSpawn.Spawn(drone, Position, Map);
                drone.Destroy();

                GetComp <CompRefuelable>()?.Refuel(1);
            }
            //Init the Designator default Label
            update_droneAreaSelectorLable(droneAllowedArea);

            //Need this type of call to set the Powerconsumption on load
            //A normal call will not work
            var rangePowerSupplyMachine = this.RangePowerSupplyMachine;

            if (rangePowerSupplyMachine != null)
            {
                this.MapManager.NextAction(rangePowerSupplyMachine.RefreshPowerStatus);
                this.MapManager.AfterAction(5, rangePowerSupplyMachine.RefreshPowerStatus);
            }
        }
 public override void SpawnSetup(Map map, bool respawningAfterLoad)
 {
     base.SpawnSetup(map, respawningAfterLoad);
     extension = def.GetModExtension <DefModExtension_DroneStation>();
 }
 public override void PostMake()
 {
     base.PostMake();
     extension = def.GetModExtension <DefModExtension_DroneStation>();
 }