コード例 #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);
            }
        }
コード例 #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);
        }
コード例 #3
0
        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);
        }
コード例 #4
0
 public override void SpawnSetup(Map map, bool respawningAfterLoad)
 {
     base.SpawnSetup(map, respawningAfterLoad);
     cpt = GetComp <CompPowerTrader>();
     cf  = GetComp <CompFlickable>();
     OnPowerChanged();
 }
コード例 #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);
        }
コード例 #7
0
    public override void PostMake()
    {
        base.PostMake();

        powerComp = GetComp<CompPowerTrader>();
        soilDef = DefDatabase<TerrainDef>.GetNamed("Soil");
    }
コード例 #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;
                }
            }
        }
コード例 #9
0
 public override void SpawnSetup()
 {
     base.SpawnSetup();
     this.Glower    = base.GetComp <CompGlower>();
     this.powerComp = base.GetComp <CompPowerTrader>();
     ChangeColour(this.green);
     CurrentColour = this.green;
 }
コード例 #10
0
 //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;
 }
コード例 #12
0
        public override void SpawnSetup()
        {
            base.SpawnSetup();

            this.powerComp             = base.GetComp <CompPowerTrader>();
            this.glowerComp            = base.GetComp <CompGlower>();
            this.powerComp.powerOutput = 0;
        }
コード例 #13
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;
        }
コード例 #14
0
        // ===================== 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>();
        }
コード例 #15
0
        public override void SpawnSetup(Map map, bool respawningAfterLoad)
        {
            base.SpawnSetup(map, respawningAfterLoad);

            compPowerTrader = GetComp <CompPowerTrader>();

            LongEventHandler.ExecuteWhenFinished((Action)CreateAnim);
        }
コード例 #16
0
ファイル: Building_MAD.cs プロジェクト: scyde/Hardcore-SK
 public override void SpawnSetup()
 {
     base.SpawnSetup();
     this.Glower = base.GetComp<CompGlower>();
     this.powerComp = base.GetComp<CompPowerTrader>();
     ChangeColour(this.green);
     CurrentColour = this.green;
 }
コード例 #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();
        }
コード例 #18
0
        public override void SpawnSetup(Map map, bool respawningAfterLoad)
        {
            base.SpawnSetup(map, respawningAfterLoad);

            power = GetComp <CompPowerTrader>();

            SetFaction(Faction.OfPlayer);
        }
コード例 #19
0
 public override void PostSpawnSetup(bool respawningAfterLoad)
 {
     compPower = parent.GetComp <CompPowerTrader>();
     if (compPower == null)
     {
         Log.Error(parent + " not have CompPowerTrader which is required.");
     }
 }
コード例 #20
0
 static public void Postfix(CompPowerTrader __instance)
 {
     if (__instance.parent.def == ReplimatDef.ReplimatHopper)
     {
         ReplimatMod.repHopperCache.Add(__instance.parent, __instance);
         ReplimatUtility.UpdateRepHopperGrid(__instance);
     }
 }
コード例 #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>();
 }
コード例 #22
0
        public override void PostSpawnSetup(bool respawningAfterLoad)
        {
            base.PostSpawnSetup(respawningAfterLoad);

            powerComp     = parent.GetComp <CompPowerTrader>();
            flickableComp = parent.GetComp <CompFlickable>();
            fullPower     = powerComp.Props.basePowerConsumption;
        }
コード例 #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);
 }
コード例 #24
0
        public override void SpawnSetup(Map map, bool respawningAfterLoad)
        {
            base.SpawnSetup(map, respawningAfterLoad);

            power = GetComp <CompPowerTrader>();

            PlayerHasGeoscape = true;
        }
コード例 #25
0
 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;
        }
コード例 #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);
        }
コード例 #28
0
        public float Consumption(CompPowerTrader comp)
        {
            if (!comp.PowerOn && !FlickUtility.WantsToBeOn(comp.parent))
            {
                return(0);
            }

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

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

                if (rs != null)
                {
                    rs.refreshPowerConsumed();
                }
            }
コード例 #31
0
        public override void PostSpawnSetup(bool respawningAfterLoad)
        {
            base.PostSpawnSetup(respawningAfterLoad);

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

            this.RecalculateStatistics();
        }
コード例 #32
0
 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");
 }
コード例 #33
0
        // ===================== 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");
        }
コード例 #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 );
     }
 }
コード例 #35
0
        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;
        }
コード例 #36
0
        // ===================== 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);
        }
コード例 #37
0
        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 );
        }
コード例 #38
0
 public override void SpawnSetup()
 {
     base.SpawnSetup();
     this.compTempControl = base.GetComp<CompTempControl>();
     this.compPowerTrader = base.GetComp<CompPowerTrader>();
 }
コード例 #39
0
        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;
        }
コード例 #40
0
        //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();
        }
コード例 #41
0
ファイル: Lamps.cs プロジェクト: isistoy/DevLib
 public override void SpawnSetup()
 {
     base.SpawnSetup();
     powerComp = base.GetComp<CompPowerTrader>();
     glowerComp = base.GetComp<CompGlower>();
     LampDetect();
 }
コード例 #42
0
 //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);
 }
コード例 #43
0
        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;
            }
        }
コード例 #44
0
        // ===================== 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;
            }
        }
コード例 #45
0
        // ===================== 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);
        }
コード例 #46
0
        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 );
        }
コード例 #47
0
        // ===================== 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");
        }
コード例 #48
0
 public override void SpawnSetup()
 {
     base.SpawnSetup();
     powerComp = base.GetComp<CompPowerTrader>();
     WhoIsManningMe = base.GetComp<CompMannable>();
 }
コード例 #49
0
 public override void SpawnSetup()
 {
     base.SpawnSetup();
     power = base.GetComp<CompPowerTrader>();
     glower = base.GetComp<CompGlower>();
     powerOutputInt = power.powerOutputInt;
 }
コード例 #50
0
        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;
        }
コード例 #51
0
        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\"");
            }
        }
コード例 #52
0
 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();
 }
コード例 #53
0
        public override void SpawnSetup()
        {
            base.SpawnSetup();
            this.powerComp = this.GetComp<CompPowerTrader>();

            UI_ACTIVATE_GATE = ContentFinder<Texture2D>.Get("UI/nuke", true);
        }
コード例 #54
0
 public override void SpawnSetup()
 {
     base.SpawnSetup();
     this.power = base.GetComp<CompPowerTrader>();
     if (HasFissure)
     {
         FirstSetup();
     }
 }
コード例 #55
0
        //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);
        }
コード例 #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 );
        }
コード例 #57
0
ファイル: Building_Door.cs プロジェクト: raimis001/raWorld
    public override void SpawnSetup()
    {
        base.SpawnSetup();

        powerComp = GetComp<CompPowerTrader>();

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