Beispiel #1
0
        /// <summary>
        /// This is called seperately when the Mod-Thread is done.
        /// It is needed to be seperately from SpawnSetup, so that the graphics can be found
        /// </summary>
        private void SpawnSetup_Part2()
        {
            powerComp    = base.GetComp <CompPowerTrader>();
            mannableComp = base.GetComp <CompMannable>();

            ReadXmlData();

            if (forceCreateGunAndTop)
            {
                CreateGunAndTop(gun);
            }
            else
            {
                gun = null;
                top = null;
            }

            // When not of colony, equip a Mortar Bomb as main weapon.
            if (Faction != Faction.OfPlayer)
            {
                def.building.turretGunDef = ThingDef.Named("Artillery_MortarBomb");
                this.gun = (Thing)ThingMaker.MakeThing(def.building.turretGunDef, null);

                List <Verb> allVerbs = this.GunCompEq.AllVerbs;

                for (int i = 0; i < allVerbs.Count; i++)
                {
                    Verb item = allVerbs[i];
                    item.caster = this;
                    item.castCompleteCallback = new Action(this.BurstComplete);
                }

                top = new TurretTop_TurretWeaponBase(this);
            }
        }
Beispiel #2
0
        public override void SpawnSetup(Map map, bool respawningAfterLoad)
        {
            base.SpawnSetup(map, respawningAfterLoad);
            powerComp             = GetComp <CompPowerTrader>();
            medpodSettings        = GetComp <CompMedPodSettings>();
            treatmentRestrictions = GetComp <CompTreatmentRestrictions>();

            MaxDiagnosingTicks         = GenTicks.SecondsToTicks(medpodSettings.MaxDiagnosisTime);
            MaxHealingTicks            = GenTicks.SecondsToTicks(medpodSettings.MaxPerHediffHealingTime);
            DiagnosingPowerConsumption = medpodSettings.DiagnosisModePowerConsumption;
            HealingPowerConsumption    = medpodSettings.HealingModePowerConsumption;

            AlwaysTreatableHediffs = treatmentRestrictions.AlwaysTreatableHediffs;
            NeverTreatableHediffs  = treatmentRestrictions.NeverTreatableHediffs;
            DisallowedRaces        = treatmentRestrictions.DisallowedRaces;

            // Add a blocker region for the MedPod main machinery
            // (If one already exists, then we are probably loading a save with an existing MedPod)
            Thing something = Map.thingGrid.ThingsListAtFast(InvisibleBlockerPosition).FirstOrDefault(x => x.def.Equals(MedPodDef.MedPodInvisibleBlocker));

            if (something != null)
            {
                something.DeSpawn();
            }

            Thing t = ThingMaker.MakeThing(MedPodDef.MedPodInvisibleBlocker);

            GenPlace.TryPlaceThing(t, InvisibleBlockerPosition, Map, ThingPlaceMode.Direct, out resultingBlocker, null, null, Rotation);
        }
        public override void PostSpawnSetup(bool respawningAfterLoad)
        {
            base.PostSpawnSetup(respawningAfterLoad);
            this.m_FlickComp = this.parent.GetComp <CompFlickable>();
            this.Properties  = this.props as CompProperties_LaserDrill;
            this.m_PowerComp = parent.TryGetComp <CompPowerTrader>();

            //Add IRequiresShipResources Comp
            var _Comp = this.parent.GetComps <ThingComp>().FirstOrDefault(x => x is IRequiresShipResources);
            var _ResourcesCompInterface = _Comp as IRequiresShipResources;

            if (_ResourcesCompInterface == null)
            {
                Log.Error(nameof(Comp_LaserDrill) + " Failed to get Comp With " + nameof(IRequiresShipResources));
            }
            else
            {
                this.m_RequiresShipResourcesComp = _ResourcesCompInterface;
            }


            if (!respawningAfterLoad)
            {
                this.SetRequiredDrillScanningToDefault();
            }

            parent.Map.GetComponent <LaserDrillMapComp>().Register(this);
        }
 public override void SpawnSetup(Map map, bool respawningAfterLoad)
 {
     base.SpawnSetup(map, respawningAfterLoad);
     cpt = GetComp <CompPowerTrader>();
     cf  = GetComp <CompFlickable>();
     OnPowerChanged();
 }
Beispiel #5
0
 public override void PostSpawnSetup(bool respawningAfterLoad)
 {
     base.PostSpawnSetup(respawningAfterLoad);
     this.currentColor = Props.colorOptions[currentColorInd];
     this.dirty        = true;
     this.compPower    = this.parent.GetComp <CompPowerTrader>();
 }
        protected override ThoughtState CurrentStateInternal(Pawn p)
        {
            if (!p.Spawned)
            {
                return(false);
            }
            if (!this.def.HasModExtension <ThoughtGiverByProximityDefExtension>())
            {
                return(false);
            }
            ThoughtGiverByProximityDefExtension defExtension = this.def.GetModExtension <ThoughtGiverByProximityDefExtension>();

            if (defExtension.ThingToGiveThought == null)
            {
                return(false);
            }
            List <Thing> list = p.Map.listerThings.ThingsOfDef(defExtension.ThingToGiveThought);

            for (int i = 0; i < list.Count; i++)
            {
                CompPowerTrader compPowerTrader = list[i].TryGetComp <CompPowerTrader>();
                if ((compPowerTrader == null || compPowerTrader.PowerOn) && list[i] != p)
                {
                    if (p.Position.InHorDistOf(list[i].Position, defExtension.DistanceToGiveThought))
                    {
                        return(true);
                    }
                }
            }
            return(false);
        }
    public override void PostMake()
    {
        base.PostMake();

        powerComp = GetComp<CompPowerTrader>();
        soilDef = DefDatabase<TerrainDef>.GetNamed("Soil");
    }
Beispiel #8
0
        public override void SpawnSetup(Map map)
        {
            base.SpawnSetup(map);
            this.powerComp    = base.GetComp <CompPowerTrader>();
            this.mannableComp = base.GetComp <CompMannable>();
            if (gun == null)
            {
                this.gun = ThingMaker.MakeThing(this.def.building.turretGunDef, null);
            }
            for (int i = 0; i < this.GunCompEq.AllVerbs.Count; i++)
            {
                Verb verb = this.GunCompEq.AllVerbs[i];
                verb.caster = this;
                verb.castCompleteCallback = new Action(this.BurstComplete);
            }
            this.top = new TurretTopCE(this);

            // Callback for ammo comp
            if (compAmmo != null)
            {
                compAmmo.turret = this;
                if (def.building.turretShellDef != null && def.building.turretShellDef is AmmoDef)
                {
                    compAmmo.selectedAmmo = (AmmoDef)def.building.turretShellDef;
                }
            }
        }
Beispiel #9
0
 public override void SpawnSetup()
 {
     base.SpawnSetup();
     this.Glower    = base.GetComp <CompGlower>();
     this.powerComp = base.GetComp <CompPowerTrader>();
     ChangeColour(this.green);
     CurrentColour = this.green;
 }
 //Establishes that this building remains after reload and implements the tutor
 public override void SpawnSetup(Map map, bool respawningAfterLoad)
 {
     base.SpawnSetup(map, respawningAfterLoad);
     this.powerComp      = base.GetComp <CompPowerTrader>();
     this.innerContainer = new ThingOwner <Neurolink_Harddrive>(this);
     //LessonAutoActivator.TeachOpportunity(ConceptDefOf.BuildHarddrive, OpportunityType.GoodToKnow);
     LessonAutoActivator.TeachOpportunity(Neurolink_ConceptDefOf.Neurolink_UsingMainframe, OpportunityType.GoodToKnow);
 }
 public override void PostSpawnSetup(bool respawningAfterLoad)
 {
     base.PostSpawnSetup(respawningAfterLoad);
     this.powerComp         = this.parent.GetComp <CompPowerTrader>();
     this.refuelableComp    = this.parent.GetComp <CompRefuelable>();
     this.breakdownableComp = this.parent.GetComp <CompBreakdownable>();
     HeatPerSecondVariable  = this.Props.heatPerSecond;
 }
Beispiel #12
0
        public override void SpawnSetup()
        {
            base.SpawnSetup();

            this.powerComp             = base.GetComp <CompPowerTrader>();
            this.glowerComp            = base.GetComp <CompGlower>();
            this.powerComp.powerOutput = 0;
        }
        // Methods

        public override void Initialize(CompProperties props)
        {
            base.Initialize(props);
            refuelComp     = parent.GetComp <CompRefuelable>();
            powerTradeComp = parent.GetComp <CompPowerTrader>();
            flickComp      = parent.GetComp <CompFlickable>();
            defaultTexPath = parent.def.graphicData.texPath;
        }
        // ===================== Setup Work =====================
        /// <summary>
        /// Initialize instance variables.
        /// </summary>
        ///
        public override void SpawnSetup(Map map, bool respawningAfterLoad)
        {
            base.SpawnSetup(map, respawningAfterLoad);

            randomTickOffset = Rand.Range(0, GenTicks.TicksPerRealSecond);
            this.glowerComp  = this.GetComp <CompGlower>();
            this.powerComp   = this.GetComp <CompPowerTrader>();
        }
Beispiel #15
0
        public override void SpawnSetup(Map map, bool respawningAfterLoad)
        {
            base.SpawnSetup(map, respawningAfterLoad);

            compPowerTrader = GetComp <CompPowerTrader>();

            LongEventHandler.ExecuteWhenFinished((Action)CreateAnim);
        }
Beispiel #16
0
 public override void SpawnSetup()
 {
     base.SpawnSetup();
     this.Glower = base.GetComp<CompGlower>();
     this.powerComp = base.GetComp<CompPowerTrader>();
     ChangeColour(this.green);
     CurrentColour = this.green;
 }
Beispiel #17
0
        public override void SpawnSetup(Map map, bool respawningAfterLoad)
        {
            base.SpawnSetup(map, respawningAfterLoad);
            this.compPowerTrader = this.GetComp <CompPowerTrader>();
            this.compSchedule    = this.GetComp <CompSchedule>();

            this.ResetPowerOutput();
        }
        public override void SpawnSetup(Map map, bool respawningAfterLoad)
        {
            base.SpawnSetup(map, respawningAfterLoad);

            power = GetComp <CompPowerTrader>();

            SetFaction(Faction.OfPlayer);
        }
 public override void PostSpawnSetup(bool respawningAfterLoad)
 {
     compPower = parent.GetComp <CompPowerTrader>();
     if (compPower == null)
     {
         Log.Error(parent + " not have CompPowerTrader which is required.");
     }
 }
 static public void Postfix(CompPowerTrader __instance)
 {
     if (__instance.parent.def == ReplimatDef.ReplimatHopper)
     {
         ReplimatMod.repHopperCache.Add(__instance.parent, __instance);
         ReplimatUtility.UpdateRepHopperGrid(__instance);
     }
 }
Beispiel #21
0
 public override void SpawnSetup(Map map, bool respawningAfterLoad)
 {
     base.SpawnSetup(map, respawningAfterLoad);
     powerTrader   = GetComp <CompPowerTrader>();
     breakdownable = GetComp <CompBreakdownable>();
     Current.Game.GetComponent <PsiTechManager>().RegisterTrainer(this);
     Trainer = GetComp <CompPsiTechTrainer>();
 }
        public override void PostSpawnSetup(bool respawningAfterLoad)
        {
            base.PostSpawnSetup(respawningAfterLoad);

            powerComp     = parent.GetComp <CompPowerTrader>();
            flickableComp = parent.GetComp <CompFlickable>();
            fullPower     = powerComp.Props.basePowerConsumption;
        }
Beispiel #23
0
 public override void SpawnSetup(Map map, bool respawningAfterLoad)
 {
     base.SpawnSetup(map, respawningAfterLoad);
     powerComp = GetComp <CompPowerTrader>();
     stateDependentPowerComp = GetComp <CompStateDependentPowerUse>();
     AllowedAnimalFeedDefs   = def.building.fixedStorageSettings.filter.allowedDefs.ToList();
     volumePerAnimalFeed     = ReplimatUtility.ConvertMassToFeedstockVolume(CurrentAnimalFeedDef.BaseMass);
 }
Beispiel #24
0
        public override void SpawnSetup(Map map, bool respawningAfterLoad)
        {
            base.SpawnSetup(map, respawningAfterLoad);

            power = GetComp <CompPowerTrader>();

            PlayerHasGeoscape = true;
        }
 public static void Postfix(CompPowerTrader __instance)
 {
     // If the turret has been upgraded, multiply its power consumption by the upgrade props' power consumption factor
     if (__instance.parent.IsUpgraded(out CompUpgradable upgradableComp))
     {
         __instance.PowerOutput *= upgradableComp.Props.basePowerConsumptionFactor;
     }
 }
        /// <summary>
        /// Find the PowerComp and GlowerComp
        /// </summary>
        private void SetPowerGlower()
        {
            // Get refferences to the components CompPowerTrader and CompGlower
            powerComp  = base.GetComp <CompPowerTrader>();
            glowerComp = base.GetComp <CompGlower>();

            // Preset the PowerOutput to 0 (negative values will draw power from the powernet)
            powerComp.PowerOutput = 0;
        }
Beispiel #27
0
        // ===================== Setup Work =====================
        /// <summary>
        /// Initialize instance variables.
        /// </summary>
        public override void SpawnSetup(Map map, bool respawningAfterLoad)
        {
            base.SpawnSetup(map, respawningAfterLoad);

            this.powerComp           = base.GetComp <CompPowerTrader>();
            this.updateOffsetInTicks = Rand.RangeInclusive(0, updatePeriodInTicks);

            spotlightMatrix.SetTRS(base.DrawPos + Altitudes.AltIncVect, this.spotLightRotation.ToQuat(), spotlightScale);
        }
Beispiel #28
0
        public float Consumption(CompPowerTrader comp)
        {
            if (!comp.PowerOn && !FlickUtility.WantsToBeOn(comp.parent))
            {
                return(0);
            }

            return(Mathf.Max(-comp.PowerOutput, 0f));
        }
        public static bool CheckPower(CompPowerTrader comp)
        {
            if (comp == null || !comp.PowerOn)
            {
                return(false);
            }

            return(true);
        }
Beispiel #30
0
            public static void Listener(CompPowerTrader __instance, ref float ___powerOutputInt)
            {
                CompReloadStation rs = __instance.parent.TryGetComp <CompReloadStation>();

                if (rs != null)
                {
                    rs.refreshPowerConsumed();
                }
            }
        public override void PostSpawnSetup(bool respawningAfterLoad)
        {
            base.PostSpawnSetup(respawningAfterLoad);

            this.Properties = ((CompProperties_ShieldGenerator)this.props);
            this.m_Power    = this.parent.GetComp <CompPowerTrader>();

            this.RecalculateStatistics();
        }
 public override void SpawnSetup(Map map, bool blabla)
 {
     base.SpawnSetup(map, blabla);
     powerComp         = GetComp <CompPowerTrader>();
     refuelableComp    = GetComp <CompRefuelable>();
     breakdownableComp = GetComp <CompBreakdownable>();
     powerComp         = GetComp <CompPowerTrader>();
     consoleDef        = DefDatabase <ThingDef> .GetNamed("ET_Console");
 }
        // ===================== Setup Work =====================
        /// <summary>
        /// Initializes instance variables.
        /// </summary>
        /// 
        public override void SpawnSetup()
        {
            base.SpawnSetup();

            numberOfAlertSpeakers++;
            glowerComp = base.GetComp<CompGlower>();
            powerComp = base.GetComp<CompPowerTrader>();

            sirenSoundEnabledIcon = ContentFinder<Texture2D>.Get("Ui/Commands/CommandButton_SirenSoundEnabled");
            sirenSoundDisabledIcon = ContentFinder<Texture2D>.Get("Ui/Commands/CommandButton_SirenSoundDisabled");
        }
Beispiel #34
0
 private void DoorLockToggle( CompLockable compLock, CompPowerTrader compPower, bool value )
 {
     compLock.temporaryLock = value;
     if(
         ( compPower != null )&&
         ( compPower.PowerOn )&&
         (
             ( !value )||
             ( compLock.IssueLockToggleJob )
         )
     )
     {   // Auto-toggle auto-doors
         //Log.Message( string.Format( "Auto-toggling door lock on {0}", compLock.parent.ThingID ) );
         compLock.ChangeLockState( value );
     }
 }
        public override void PostSpawnSetup()
        {
            base.PostSpawnSetup();
            okToProcess = false;

            // Get this building
            thisBuilding = (parent as Building_Storage);
            if( thisBuilding == null ) {
                Log.Message( "Community Core Library :: CompRefrigerated :: Unable to cast '" + parent.def.defName + "' to Building" );
                return;
            }

            // Get the power comp
            compPower = parent.GetComp<CompPowerTrader>();
            if( compPower == null )
            {
                Log.Message( "Community Core Library :: CompRefrigerated :: '" + parent.def.defName + "' needs compPowerTrader!" );
                return;
            }

            // Everything seems ok
            okToProcess = true;
        }
        // ===================== Setup Work =====================

        /// <summary>
        /// Initialize instance variables.
        /// </summary>
        public override void SpawnSetup()
        {
            base.SpawnSetup();
            this.powerComp = base.GetComp<CompPowerTrader>();

            // Drawing.
            if (this.breedingSpeciesDef != null)
            {
                if (this.breedingSpeciesDef == Util_FishIndustry.MashgonDef)
                {
                    this.breedingSpeciesTexture = mashgonTexture;
                }
                else if (this.breedingSpeciesDef == Util_FishIndustry.BluebladeDef)
                {
                    this.breedingSpeciesTexture = bluebladeTexture;
                }
                else if (this.breedingSpeciesDef == Util_FishIndustry.TailteethDef)
                {
                    this.breedingSpeciesTexture = tailTeethTexture;
                }
            }
            breedingSpeciesMatrix.SetTRS(base.DrawPos + new Vector3(-1f, 0, -0.7f).RotatedBy(this.Rotation.AsAngle) + Altitudes.AltIncVect + new Vector3(0f, 0.1f, 0f), 0f.ToQuat(), this.breedingSpeciesScale);
            microFungusMatrix.SetTRS(base.DrawPos + Altitudes.AltIncVect + new Vector3(0f, 0.1f, 0f), 0f.ToQuat(), this.microFungusScale);
        }
        public override void PostSpawnSetup()
        {
            base.PostSpawnSetup();

            // Get power comp
            PowerTrader = CompPowerTrader;
            #if DEBUG
            if( PowerTrader == null )
            {
                CCL_Log.Error( "CompColoredLight requires CompPowerTrader!", parent.def.defName );
                return;
            }
            #endif

            // Get the default glower
            #if DEBUG
            if( CompGlower == null )
            {
                CCL_Log.Error( "CompColoredLight requires CompGlower!", parent.def.defName );
                return;
            }
            #endif

            // Get the color properties
            ColorProps = this.CompProperties_ColoredLight();
            #if DEBUG
            if( ColorProps == null )
            {
                CCL_Log.Error( "CompColoredLight requires CompProperties_ColoredLight!", parent.def.defName );
                return;
            }
            #endif

            // Set default palette if none is specified
            if( ColorProps.color == null )
            {
                ColorProps.color = Light.Color;
            }

            // Set default
            if( ( ColorIndex < 0 )||
                ( ColorIndex >= ColorProps.color.Count ) )
            {
                ColorIndex = ColorProps.Default;
            }

            // Get the glow radius
            lightRadius = CompGlower.props.glowRadius;

            // Set the light colour
            ChangeColor( ColorIndex );
        }
 public override void SpawnSetup()
 {
     base.SpawnSetup();
     this.compTempControl = base.GetComp<CompTempControl>();
     this.compPowerTrader = base.GetComp<CompPowerTrader>();
 }
        public override void PostSpawnSetup()
        {
            base.PostSpawnSetup();

            // Get the power comp
            PowerTrader = CompPowerTrader;
            #if DEBUG
            if( PowerTrader == null )
            {
                CCL_Log.Error( "CompPowerLowIdleDraw requires CompPowerTrader!", parent.def.defName );
                return;
            }
            #endif

            // Get the idle properties
            IdleProps = this.CompProperties_LowIdleDraw();
            #if DEBUG
            if( IdleProps == null )
            {
                CCL_Log.Error( "CompPowerLowIdleDraw requires CompProperties_LowIdleDraw!", parent.def.defName );
                return;
            }
            #endif

            // Generate the list of cells to check
            BuildScanList();

            // Calculate low-power mode consumption
            idlePower = IdleProps.idlePowerFactor * -PowerTrader.props.basePowerConsumption;
            if( idlePower > minIdleDraw )
            {
                idlePower = minIdleDraw;
            }

            // Initial state...

            if( curPower > idlePower )
            {
                // ...Default off...
                curPower = idlePower;
            }

            // Set power usage
            PowerTrader.PowerOutput = curPower;
        }
        //On spawn, get the power component reference
        public override void SpawnSetup()
        {
            //Setup UI
            UI_DIRECT_OFF = ContentFinder<Texture2D>.Get("UI/DirectOff", true);
            UI_DIRECT_ON = ContentFinder<Texture2D>.Get("UI/DirectOn", true);
            UI_INDIRECT_OFF = ContentFinder<Texture2D>.Get("UI/IndirectOff", true);
            UI_INDIRECT_ON = ContentFinder<Texture2D>.Get("UI/IndirectOn", true);
            UI_FIRE_OFF = ContentFinder<Texture2D>.Get("UI/FireOff", true);
            UI_FIRE_ON = ContentFinder<Texture2D>.Get("UI/FireOn", true);
            UI_INTERCEPT_DROPPOD_OFF = ContentFinder<Texture2D>.Get("UI/FireOff", true);
            UI_INTERCEPT_DROPPOD_ON = ContentFinder<Texture2D>.Get("UI/FireOn", true);

            UI_REPAIR_ON = ContentFinder<Texture2D>.Get("UI/RepairON", true);
            UI_REPAIR_OFF = ContentFinder<Texture2D>.Get("UI/RepairOFF", true);

            UI_SHOW_ON = ContentFinder<Texture2D>.Get("UI/ShieldShowOn", true);
            UI_SHOW_OFF = ContentFinder<Texture2D>.Get("UI/ShieldShowOff", true);

            base.SpawnSetup();
            this.power = base.GetComp<CompPowerTrader>();
            if (def is ShieldBuildingThingDef)
            {
                //Read in variables from the custom MyThingDef
                shieldMaxShieldStrength = ((Enhanced_Development.Shields.ShieldBuildingThingDef)def).shieldMaxShieldStrength;
                shieldInitialShieldStrength = ((Enhanced_Development.Shields.ShieldBuildingThingDef)def).shieldInitialShieldStrength;
                shieldShieldRadius = ((Enhanced_Development.Shields.ShieldBuildingThingDef)def).shieldShieldRadius;

                shieldPowerRequiredCharging = ((Enhanced_Development.Shields.ShieldBuildingThingDef)def).shieldPowerRequiredCharging;
                shieldPowerRequiredSustaining = ((Enhanced_Development.Shields.ShieldBuildingThingDef)def).shieldPowerRequiredSustaining;

                shieldRechargeTickDelay = ((Enhanced_Development.Shields.ShieldBuildingThingDef)def).shieldRechargeTickDelay;
                shieldRecoverWarmup = ((Enhanced_Development.Shields.ShieldBuildingThingDef)def).shieldRecoverWarmup;

                shieldBlockIndirect = ((Enhanced_Development.Shields.ShieldBuildingThingDef)def).shieldBlockIndirect;
                shieldBlockDirect = ((Enhanced_Development.Shields.ShieldBuildingThingDef)def).shieldBlockDirect;
                shieldFireSupression = ((Enhanced_Development.Shields.ShieldBuildingThingDef)def).shieldFireSupression;
                shieldInterceptDropPod = ((Enhanced_Development.Shields.ShieldBuildingThingDef)def).shieldInterceptDropPod;

                shieldStructuralIntegrityMode = ((Enhanced_Development.Shields.ShieldBuildingThingDef)def).shieldStructuralIntegrityMode;

                colourRed = ((Enhanced_Development.Shields.ShieldBuildingThingDef)def).colourRed;
                colourGreen = ((Enhanced_Development.Shields.ShieldBuildingThingDef)def).colourGreen;
                colourBlue = ((Enhanced_Development.Shields.ShieldBuildingThingDef)def).colourBlue;

                SIFBuildings = ((Enhanced_Development.Shields.ShieldBuildingThingDef)def).SIFBuildings;
                //Log.Error("Count:" + SIFBuildings.Count);
            }
            else
            {
                Log.Error("Shield definition not of type \"ShieldBuildingThingDef\"");
            }

            if (shieldField == null)
            {
                shieldField = new ShieldField(this, base.Position, shieldMaxShieldStrength, shieldInitialShieldStrength, shieldShieldRadius, shieldRechargeTickDelay, shieldRecoverWarmup, shieldBlockIndirect, shieldBlockDirect, shieldFireSupression, shieldInterceptDropPod, shieldStructuralIntegrityMode, colourRed, colourGreen, colourBlue);
            }

            //shieldField.setupValidBuildings();
        }
Beispiel #41
0
 public override void SpawnSetup()
 {
     base.SpawnSetup();
     powerComp = base.GetComp<CompPowerTrader>();
     glowerComp = base.GetComp<CompGlower>();
     LampDetect();
 }
 //Spawn set up
 public override void SpawnSetup()
 {
     base.SpawnSetup();
     this.powerTrader = base.GetComp<CompPowerTrader>();
     Building_FissureGenerator.beginIcon = ContentFinder<Texture2D>.Get("UI/Commands/BeginUI", true);
     Building_FissureGenerator.pauseIcon = ContentFinder<Texture2D>.Get("UI/Commands/PauseUI", true);
     Building_FissureGenerator.cycleButton = ContentFinder<Texture2D>.Get("Terrain/Fissure", true);
 }
        public override void PostSpawnSetup()
        {
            compPowerTrader = parent.TryGetComp<CompPowerTrader>();

            lastTickStagger++;
            tickStagger = lastTickStagger;

            cellIndex = tickStagger;
            cells = GenAdj.CellsAdjacent8Way(parent).ToList();
            while (cellIndex > cells.Count)
            {
                cellIndex -= cells.Count;
            }
        }
        // ===================== Setup Work =====================
        /// <summary>
        /// Initialize instance variables.
        /// </summary>
        /// 
        public override void SpawnSetup()
        {
            base.SpawnSetup();
            
            detectedDefList = new List<ThingDef>();
            detectedDefList.Add(ThingDef.Named("MineableSteel"));
            detectedDefList.Add(ThingDef.Named("MineableSilver"));
            detectedDefList.Add(ThingDef.Named("MineableGold"));
            detectedDefList.Add(ThingDef.Named("MineableUranium"));
            detectedDefList.Add(ThingDef.Named("MineablePlasteel"));
            detectedDefList.Add(ThingDef.Named("MineableComponents"));
            detectedDefList.Add(ThingDef.Named("AncientCryptosleepCasket"));

            // Using custom ThingDef leads to "short hash" bug when loading a savegame.
            // Disabled until I find a working example.
            /*foreach (ThingDef metallicDef in ((ThingDef_MobileMineralSonar)this.def).scannedThingDefs)
            {
                detectedDefList.Add(metallicDef);
            }*/

            // Components initialization.
            powerComp = base.GetComp<CompPowerTrader>();
            powerComp.powerOutputInt = 0;
            
            // The 10f offset on Y axis is mandatory to be over the fog of war.
            scanRangeMatrix10.SetTRS(base.DrawPos + new Vector3(0f, 10f, 0f) + Altitudes.AltIncVect, (0f).ToQuat(), scanRangeScale10);
            scanRangeMatrix20.SetTRS(base.DrawPos + new Vector3(0f, 10f, 0f) + Altitudes.AltIncVect, (0f).ToQuat(), scanRangeScale20);
            scanRangeMatrix30.SetTRS(base.DrawPos + new Vector3(0f, 10f, 0f) + Altitudes.AltIncVect, (0f).ToQuat(), scanRangeScale30);
            scanRangeMatrix40.SetTRS(base.DrawPos + new Vector3(0f, 10f, 0f) + Altitudes.AltIncVect, (0f).ToQuat(), scanRangeScale40);
            scanRangeMatrix50.SetTRS(base.DrawPos + new Vector3(0f, 10f, 0f) + Altitudes.AltIncVect, (0f).ToQuat(), scanRangeScale50);
            satelliteDishMatrix.SetTRS(base.DrawPos + Altitudes.AltIncVect, satelliteDishRotation.ToQuat(), satelliteDishScale);

            TryUpdateScanParameters();

            if (this.isInstalled == false)
            {
                // The MMS has just been moved or is spawned for the first time.
                this.scanRange = 1;
                this.scanProgress = 0;
                this.satelliteDishRotation = 0;
            }
            else
            {
                this.isInstalled = false;
            }
        }
        // ===================== Setup Work =====================
        /// <summary>
        /// Initialize instance variables.
        /// </summary>
        /// 
        public override void SpawnSetup()
        {
            base.SpawnSetup();

            // Force field covered cells initialization.
            this.coveredCells = Building_ForceFieldGenerator.GetCoveredCells(this.Position, this.Rotation);

            // Force field effect positions.
            Vector3 effectCell = new Vector3();
            effectCell = this.Position.ToVector3Shifted() + new Vector3(-2.1f, 0f, 0.1f).RotatedBy(this.Rotation.AsAngle);
            effectCells.Add(effectCell);
            effectCell = this.Position.ToVector3Shifted() + new Vector3(-1.2f, 0f, 0.8f).RotatedBy(this.Rotation.AsAngle);
            effectCells.Add(effectCell);
            effectCell = this.Position.ToVector3Shifted() + new Vector3(0f, 0f, 1f).RotatedBy(this.Rotation.AsAngle);
            effectCells.Add(effectCell);
            effectCell = this.Position.ToVector3Shifted() + new Vector3(1.2f, 0f, 0.8f).RotatedBy(this.Rotation.AsAngle);
            effectCells.Add(effectCell);
            effectCell = this.Position.ToVector3Shifted() + new Vector3(2.1f, 0f, 0.1f).RotatedBy(this.Rotation.AsAngle);
            effectCells.Add(effectCell);

            // Components initialization.
            powerComp = base.GetComp<CompPowerTrader>();
            
            // Textures initialization.
            forceFieldMatrix.SetTRS(base.DrawPos + Altitudes.AltIncVect + new Vector3(0f, 0f, 0.5f).RotatedBy(this.Rotation.AsAngle), this.Rotation.AsAngle.ToQuat(), forceFieldScale);
            forceFieldAbsorbtionMatrix.SetTRS(base.DrawPos + Altitudes.AltIncVect + new Vector3(0f, 0.1f, 0.5f).RotatedBy(this.Rotation.AsAngle), this.Rotation.AsAngle.ToQuat(), forceFieldScale);
        }
        public override void PostSpawnSetup()
        {
            //Log.Message( def.defName + " - SpawnSetup()" );
            base.PostSpawnSetup();

            // Get power comp
            compPower = parent.GetComp<CompPowerTrader>();
            if( compPower == null ){
                Log.Message( parent.def.defName + " - Needs compPowerTrader!" );
                return;
            }

            // Get the default glower
            oldGlower = parent.GetComp<CompGlower>();
            if( oldGlower == null )
            {
                Log.Message( parent.def.defName + " - Needs compGlower!" );
                return;
            }

            // Get the colour palette
            if( compProps == null )
            {
                Log.Message( parent.def.defName + " - Needs CompProperties_ColoredLight!" );
                return;
            }

            // Set default palette if none is specified
            if( compProps.color == null )
                compProps.color = Light.Color;

            // Set default
            if( ( ColorIndex < 0 )||
                ( ColorIndex >= compProps.color.Count ) )
                ColorIndex = compProps.Default;

            // Get the glow radius
            lightRadius = oldGlower.props.glowRadius;

            // Set the light colour
            changeColor( ColorIndex );
        }
        // ===================== Initialization and save/load functions =====================

        public override void SpawnSetup()
        {
            base.SpawnSetup();

            // Case where this is not the first terraformer to land.
            if (Building_MechanoidTerraformer.studyIsCompleted
                && (this.reverseEngineeringState == ReverseEngineeringState.BuildingNotApproched))
            {
                this.reverseEngineeringState = ReverseEngineeringState.StudyCompleted;
            }

            // Pylons initialization.
            GetPylonsPositions();

            // Components initialization.
            this.powerComp = base.GetComp<CompPowerTrader>();

            // Drawing and icons.
            generatorTexture = MaterialPool.MatFrom("Things/Building/Generator", ShaderDatabase.Transparent);
            displayStudyReportIcon = ContentFinder<Texture2D>.Get("Ui/Commands/CommandButton_DisplayStudyReport");
        }
 public override void SpawnSetup()
 {
     base.SpawnSetup();
     powerComp = base.GetComp<CompPowerTrader>();
     WhoIsManningMe = base.GetComp<CompMannable>();
 }
 public override void SpawnSetup()
 {
     base.SpawnSetup();
     power = base.GetComp<CompPowerTrader>();
     glower = base.GetComp<CompGlower>();
     powerOutputInt = power.powerOutputInt;
 }
        public override void PostSpawnSetup()
        {
            //Log.Message( parent.def.defName + " - PostSpawnSetup()" );
            base.PostSpawnSetup();

            // Get this building
            thisBuilding = (Building)parent;
            if( thisBuilding == null ) {
                Log.Message( "Community Core Library :: CompPowerLowIdleDraw :: Unable to cast '" + parent.def.defName + "' to Building" );
                return;
            }

            // Get the power comp
            compPower = parent.GetComp<CompPowerTrader>();
            if( compPower == null )
            {
                Log.Message( "Community Core Library :: CompPowerLowIdleDraw :: '" + parent.def.defName + "' needs compPowerTrader!" );
                return;
            }

            // Get the idle properties
            if( IdleProps == null )
            {
                Log.Message( "Community Core Library :: CompPowerLowIdleDraw :: '" + parent.def.defName + "' unable to get properties of CompProperties_LowIdleDraw!" );
                return;
            }

            // Get the glower (optional)
            compGlower = parent.GetComp<CompGlower>();

            // Generate the list of cells to check
            BuildScanList();

            // Calculate low-power mode consumption
            idlePower = IdleProps.idlePowerFactor * -compPower.props.basePowerConsumption;
            if( idlePower > minIdleDraw )
                idlePower = minIdleDraw;
            //Log.Message( parent.def.defName + " - " + idlePower + " - " + compPower.props.basePowerConsumption + " - " + IdleProps.idlePowerFactor );

            // Initial state...

            if( curPower > idlePower ){
                // ...Default off...
                curPower = idlePower;
            }

            // Set power usage
            compPower.PowerOutput = curPower;
        }
        public override void SpawnSetup()
        {
            base.SpawnSetup();

            this.power = base.GetComp<CompPowerTrader>();

            UI_ADD_RESOURCES = ContentFinder<Texture2D>.Get("UI/ADD_RESOURCES", true);
            UI_ADD_COLONIST = ContentFinder<Texture2D>.Get("UI/ADD_COLONIST", true);
            UI_DROPPOD = ContentFinder<Texture2D>.Get("UI/DEEP_STRIKE", true);

            UI_GATE_IN = ContentFinder<Texture2D>.Get("UI/StargateGUI-In", true);
            UI_GATE_OUT = ContentFinder<Texture2D>.Get("UI/StargateGUI-Out", true);

            UI_POWER_UP = ContentFinder<Texture2D>.Get("UI/PowerUp", true);
            UI_POWER_DOWN = ContentFinder<Texture2D>.Get("UI/PowerDown", true);

            GraphicRequest requestActive = new GraphicRequest(Type.GetType("Graphic_Single"), "Things/Buildings/Stargate-Active", def.graphic.Shader, new Vector2(3, 3), Color.white, Color.white);
            graphicActive = new Graphic_Single();
            graphicActive.Init(requestActive);

            GraphicRequest requestInactive = new GraphicRequest(Type.GetType("Graphic_Single"), "Things/Buildings/Stargate", def.graphic.Shader, new Vector2(3, 3), Color.white, Color.white);
            graphicInactive = new Graphic_Single();
            graphicInactive.Init(requestInactive);

            if (def is StargateThingDef)
            {
                //Read in variables from the custom MyThingDef
                FileLocationPrimary = ((Enhanced_Development.Stargate.StargateThingDef)def).FileLocationPrimary;
                FileLocationSecondary = ((Enhanced_Development.Stargate.StargateThingDef)def).FileLocationSecondary;

                //Log.Message("Setting FileLocationPrimary:" + FileLocationPrimary + " and FileLocationSecondary:" + FileLocationSecondary);
            }
            else
            {
                Log.Error("Stargate definition not of type \"StargateThingDef\"");
            }
        }
 public override void SpawnSetup()
 {
     base.SpawnSetup();
     compPower = this.TryGetComp<CompPowerTrader>();
     compRemote = this.TryGetComp<CompRemotelyObservable>();
     fields = new List<IntVec3>();
     if( markerName == string.Empty )
     {   // Only assign if it's empty, so loading a named marker won't reset it's name
         markerName = BaseNameKey.Translate( Monitor.GetNextMarkerIndex() );
     }
     QueueRoomUpdate();
 }
        public override void SpawnSetup()
        {
            base.SpawnSetup();
            this.powerComp = this.GetComp<CompPowerTrader>();

            UI_ACTIVATE_GATE = ContentFinder<Texture2D>.Get("UI/nuke", true);
        }
 public override void SpawnSetup()
 {
     base.SpawnSetup();
     this.power = base.GetComp<CompPowerTrader>();
     if (HasFissure)
     {
         FirstSetup();
     }
 }
        //On spawn, get the power component reference
        public override void SpawnSetup()
        {
            base.SpawnSetup();
            this.power = base.GetComp<CompPowerTrader>();

            this.power.powerOutputInt = desiredPower;

            WirelessPowerManager.registerToGrid(this);
            //this.nanoConnector = new Jaxxa_Shields.Pawns.Nano.NanoConnector();

            UI_POWER_UP_1 = ContentFinder<Texture2D>.Get("UI/PowerDown1", true);
            UI_POWER_UP_2 = ContentFinder<Texture2D>.Get("UI/PowerDown2", true);
            UI_POWER_DOWN_1 = ContentFinder<Texture2D>.Get("UI/PowerUp1", true);
            UI_POWER_DOWN_2 = ContentFinder<Texture2D>.Get("UI/PowerUp2", true);

            //UI_POWER_TRANSMIT = ContentFinder<Texture2D>.Get("UI/PowerTransmit", true);
            //UI_POWER_RECEIVE = ContentFinder<Texture2D>.Get("UI/PowerReceive", true);
        }
Beispiel #56
0
        private void DrawTrader( CompPowerTrader trader )
        {
            if ( trader == null )
            {
                throw new ArgumentNullException( "trader" );
            }

            // get a nice descriptive color
            Color color = Color.clear;
            if ( trader.PowerOn )
            {
                color = GenUI.MouseoverColor;
            }
            else if (
                ( !trader.PowerOn ) &&
                ( trader.DesirePowerOn )
            )
            {
                color = Color.red;
            }
            else
            {
                color = Color.grey;
            }

            MiniMap_Utilities.DrawThing( texture, trader.parent, color );
        }
Beispiel #57
0
    public override void SpawnSetup()
    {
        base.SpawnSetup();

        powerComp = GetComp<CompPowerTrader>();

        //Doors default to having a metal tile underneath
        //GenSpawn.Spawn("Floor_MetalTile", Position);
    }
 public Building_AIManager()
 {
     _powerTrader = PowerComp as CompPowerTrader;
     _glower = GetComp<CompGlower>();
 }
 public override void SpawnSetup()
 {
     base.SpawnSetup();
     this.powerComp = base.GetComp<CompPowerTrader>();
 }
 public override void PostSpawnSetup()
 {
     base.PostSpawnSetup();
     compPower = this.parent.TryGetComp<CompPowerTrader>();
     // Invalidate observability on spawn
     cachedObservableCells = null;
     cachedVisibleRangeCells = null;
     nextObservableUpdate = 0;
 }