public void PerformIdleTreatment() { if ((this.totalTicksCounter >= (totalTicksBetweenPylonsDeployment * (this.pylonsList.Count + 1))) && (this.pylonsList.Count < 8)) { this.ticksCounter = 0; this.terraformerState = TerraformerState.DeployingPylon; } /*else if ((this.totalTicksCounter >= totalTicksBeforeDeployingLightTurrets) && (this.deployingLightTurretsIsDone == false)) * { * this.ticksCounter = 0; * this.terraformerState = TerraformerState.DeployingLightTurrets; * this.deployingLightTurretsIsDone = true; * } * else if ((this.totalTicksCounter >= totalTicksBeforeDeployingHeavyTurrets) && (this.deployingHeavyTurretsIsDone == false)) * { * this.ticksCounter = 0; * this.terraformerState = TerraformerState.DeployingHeavyTurrets; * this.deployingHeavyTurretsIsDone = true; * }*/ else if ((this.totalTicksCounter >= totalTicksBeforeLaunchingInvasion) && (this.invasionIsDone == false)) { this.ticksCounter = 0; string eventText = " Beware! The mechanoid invasion has begun. This world will soon become a new mechanoid hive!"; LaunchInvasion("Invasion", eventText, 2f, 10, LetterType.BadUrgent); } else if ((this.totalTicksCounter >= this.terraformingThunderstormNextStartTicks) && (this.pylonsList.Count >= 1)) { this.ticksCounter = 0; this.terraformerState = TerraformerState.StartingGenerator; } }
public void PerformLandingTreatment() { const int periodInTicks = 600; if (this.ticksCounter % periodInTicks != 0) { return; } IntVec2 foundationsSize = new IntVec2(); foundationsSize.x = 1 + 2 * this.foundationRange; foundationsSize.z = 1 + 2 * this.foundationRange; if (this.foundationRange <= foundationRangeMax) { foreach (IntVec3 cell in GenRadial.RadialCellsAround(this.Position, this.foundationRange, true)) { Find.TerrainGrid.SetTerrain(cell, TerrainDefOf.Concrete); } this.foundationRange++; } else { for (int rotationIndex = 0; rotationIndex < 4; rotationIndex++) { Rot4 rotation = new Rot4(rotationIndex); Find.TerrainGrid.SetTerrain(this.Position + new IntVec3(0, 0, 2).RotatedBy(rotation), TerrainDef.Named("MetalTile")); } this.ticksCounter = 0; this.terraformerState = TerraformerState.Idle; } }
public void PerformStoppingGeneratorTreatment() { this.generatorAngleIncrementPerTickInDegrees -= 0.01f; if (this.generatorAngleIncrementPerTickInDegrees <= 0) { this.generatorAngleIncrementPerTickInDegrees = 0; this.generatorIsStarted = false; // Next storm in [15 .. 25] * stormMaxDuration. this.terraformingThunderstormNextStartTicks = this.totalTicksCounter + (int)(Util_MechanoidTerraformer.TerraformingThunderstormDef.durationRange.max * (20f + Rand.Range(-5f, 5f))); this.ticksCounter = 0; this.terraformerState = TerraformerState.Idle; } }
public void PerformStartingGeneratorTreatment() { const int startingGeneratorDurationInTicks = 600; if (this.generatorIsStarted == false) { StartNewTerraformingThunderStorm(); this.generatorIsStarted = true; } this.generatorAngleIncrementPerTickInDegrees += 0.01f; if (this.ticksCounter >= startingGeneratorDurationInTicks) { this.ticksCounter = 0; this.terraformerState = TerraformerState.Harnessingpower; } }
public void PerformHarnessingPowerTreatment() { if (this.ticksCounter >= this.terraformingThunderstormDurationInTicks) { this.ticksCounter = 0; this.terraformerState = TerraformerState.StoppingGenerator; Find.WeatherManager.TransitionTo(this.desiredWeather); this.desiredWeather = WeatherDef.Named("Clear"); return; } // The weather should not change before the storm is finished. if (Find.WeatherManager.curWeather != Util_MechanoidTerraformer.TerraformingThunderstormDef) { this.desiredWeather = Find.WeatherManager.curWeather; Find.WeatherManager.TransitionTo(Util_MechanoidTerraformer.TerraformingThunderstormDef); } }
/// <summary> /// Gets the state as a string. /// </summary> public string GetStateAsString(TerraformerState state) { string stateAsString = ""; switch (state) { case TerraformerState.Idle: stateAsString = "idle"; break; case TerraformerState.Landing: stateAsString = "landing"; break; case TerraformerState.DeployingPylon: stateAsString = "deploying pylon"; break; case TerraformerState.StartingGenerator: stateAsString = "starting generator"; break; case TerraformerState.Harnessingpower: stateAsString = "harnessing power"; break; case TerraformerState.StoppingGenerator: stateAsString = "stopping generator"; break; case TerraformerState.DeployingLightTurrets: stateAsString = "deploying light turrets"; break; case TerraformerState.DeployingHeavyTurrets: stateAsString = "deploying heavy turrets"; break; } return(stateAsString); }
/// <summary> /// Gets the state as a string. /// </summary> public string GetStateAsString(TerraformerState state) { string stateAsString = ""; switch (state) { case TerraformerState.Idle: stateAsString = "idle"; break; case TerraformerState.Landing: stateAsString = "landing"; break; case TerraformerState.DeployingPylon: stateAsString = "deploying pylon"; break; case TerraformerState.StartingGenerator: stateAsString = "starting generator"; break; case TerraformerState.Harnessingpower: stateAsString = "harnessing power"; break; case TerraformerState.StoppingGenerator: stateAsString = "stopping generator"; break; case TerraformerState.DeployingLightTurrets: stateAsString = "deploying light turrets"; break; case TerraformerState.DeployingHeavyTurrets: stateAsString = "deploying heavy turrets"; break; } return stateAsString; }
public void PerformIdleTreatment() { if ((this.totalTicksCounter >= (totalTicksBetweenPylonsDeployment * (this.pylonsList.Count + 1))) && (this.pylonsList.Count < 8)) { this.ticksCounter = 0; this.terraformerState = TerraformerState.DeployingPylon; } /*else if ((this.totalTicksCounter >= totalTicksBeforeDeployingLightTurrets) && (this.deployingLightTurretsIsDone == false)) { this.ticksCounter = 0; this.terraformerState = TerraformerState.DeployingLightTurrets; this.deployingLightTurretsIsDone = true; } else if ((this.totalTicksCounter >= totalTicksBeforeDeployingHeavyTurrets) && (this.deployingHeavyTurretsIsDone == false)) { this.ticksCounter = 0; this.terraformerState = TerraformerState.DeployingHeavyTurrets; this.deployingHeavyTurretsIsDone = true; }*/ else if ((this.totalTicksCounter >= totalTicksBeforeLaunchingInvasion) && (this.invasionIsDone == false)) { this.ticksCounter = 0; string eventText = " Beware! The mechanoid invasion has begun. This world will soon become a new mechanoid hive!"; LaunchInvasion("Invasion", eventText, 2f, 10, LetterType.BadUrgent); } else if ((this.totalTicksCounter >= this.terraformingThunderstormNextStartTicks) && (this.pylonsList.Count >= 1)) { this.ticksCounter = 0; this.terraformerState = TerraformerState.StartingGenerator; } }
public void PerformDeployingPylonTreatment() { const int phasePeriodInTicks = 600; if (this.pylonConstructionIsInProgress == false) { if (this.pylonsList.Count == 8) { // This case should not happen. this.ticksCounter = 0; this.terraformerState = TerraformerState.Idle; return; } // Find a random free pylon position. do { this.currentPylonIndex = Rand.RangeInclusive(0, 7); } while (this.pylonIsConstructed[this.currentPylonIndex] != false); this.pylonConstructionIsInProgress = true; this.ticksCounter = 0; } if (this.ticksCounter == phasePeriodInTicks) { Find.TerrainGrid.SetTerrain(this.pylonsPositions[this.currentPylonIndex], TerrainDefOf.Concrete); } else if (this.ticksCounter == 2 * phasePeriodInTicks) { for (int cellIndex = 0; cellIndex < 5; cellIndex++) { Find.TerrainGrid.SetTerrain(this.pylonsPositions[this.currentPylonIndex] + GenRadial.RadialPattern[cellIndex], TerrainDefOf.Concrete); } } else if (this.ticksCounter == 3 * phasePeriodInTicks) { for (int cellIndex = 0; cellIndex < 9; cellIndex++) { Find.TerrainGrid.SetTerrain(this.pylonsPositions[this.currentPylonIndex] + GenRadial.RadialPattern[cellIndex], TerrainDefOf.Concrete); } } else if (this.ticksCounter == 4 * phasePeriodInTicks) { for (int cellIndex = 0; cellIndex < 13; cellIndex++) { Find.TerrainGrid.SetTerrain(this.pylonsPositions[this.currentPylonIndex] + GenRadial.RadialPattern[cellIndex], TerrainDefOf.Concrete); } } else if (this.ticksCounter == 5 * phasePeriodInTicks) { Thing pylon = ThingMaker.MakeThing(Util_MechanoidTerraformer.MechanoidPylonDef); pylon.SetFactionDirect(Faction.OfMechanoids); GenSpawn.Spawn(pylon, this.pylonsPositions[this.currentPylonIndex]); this.pylonsList.Add(pylon); this.pylonIsConstructed[this.currentPylonIndex] = true; } else if (this.ticksCounter == 6 * phasePeriodInTicks) { this.pylonConstructionIsInProgress = false; this.ticksCounter = 0; this.terraformerState = TerraformerState.Idle; } else { Vector3 dustMotePosition = this.pylonsPositions[this.currentPylonIndex].ToVector3ShiftedWithAltitude(AltitudeLayer.MoteOverhead) + Gen.RandomHorizontalVector(1.2f); MoteThrower.ThrowDustPuff(dustMotePosition, 0.8f); } }