public static FindOrbitalRelay ( Faction faction ) : |
||
faction | Faction | |
return |
public override void Tick() { base.Tick(); if (this.ticksToTakeOff == maxTicksToTakeOff) { // Only spawn reinforcement pawns and supply once. SpawnRequestedReinforcements(); SpawnNecessarySupply(); UnforbidItemsToLoadInCargoBay(); } this.ticksToTakeOff--; if (this.ticksToTakeOff <= 0) { // Update requested reinforcements. Building_OrbitalRelay orbitalRelay = OG_Util.FindOrbitalRelay(OG_Util.FactionOfMAndCo); if (orbitalRelay != null) { orbitalRelay.UpdateRequestedReinforcements(); } // Spawn taking off supply ship. SupplyShipTakingOff supplyShip = ThingMaker.MakeThing(OG_Util.SupplyShipTakingOffDef) as SupplyShipTakingOff; supplyShip.InitializeLandingData(this.Position, this.Rotation); supplyShip.SetFaction(this.Faction); GenSpawn.Spawn(supplyShip, this.Position); this.Destroy(); } }
private void SpawnRequestedReinforcements() { Building_OrbitalRelay orbitalRelay = OG_Util.FindOrbitalRelay(this.Faction); if (orbitalRelay != null) { for (int pawnIndex = 0; pawnIndex < orbitalRelay.requestedOfficersNumber; pawnIndex++) { Pawn pawn = OG_Inhabitants.GeneratePawn(OG_Util.OutpostOfficerDef); GenSpawn.Spawn(pawn, this.Position); } for (int pawnIndex = 0; pawnIndex < orbitalRelay.requestedHeavyGuardsNumber; pawnIndex++) { Pawn pawn = OG_Inhabitants.GeneratePawn(OG_Util.OutpostHeavyGuardDef); GenSpawn.Spawn(pawn, this.Position); } for (int pawnIndex = 0; pawnIndex < orbitalRelay.requestedGuardsNumber; pawnIndex++) { Pawn pawn = OG_Inhabitants.GeneratePawn(OG_Util.OutpostGuardDef); GenSpawn.Spawn(pawn, this.Position); } for (int pawnIndex = 0; pawnIndex < orbitalRelay.requestedScoutsNumber; pawnIndex++) { Pawn pawn = OG_Inhabitants.GeneratePawn(OG_Util.OutpostScoutDef); GenSpawn.Spawn(pawn, this.Position); } for (int pawnIndex = 0; pawnIndex < orbitalRelay.requestedTechniciansNumber; pawnIndex++) { Pawn pawn = OG_Inhabitants.GeneratePawn(OG_Util.OutpostTechnicianDef); GenSpawn.Spawn(pawn, this.Position + Vector3Utility.RandomHorizontalOffset(4f).ToIntVec3()); } } }
public override void LordToilTick() { base.LordToilTick(); if (this.lord.ticksInToil > GenTicks.TickRareInterval) { Building_OrbitalRelay orbitalRelay = OG_Util.FindOrbitalRelay(OG_Util.FactionOfMiningCo); if (orbitalRelay != null) { IntVec3 hostilePosition = orbitalRelay.FindHostileInPerimeter(); if ((hostilePosition == IntVec3.Invalid) || (IntVec3Utility.ManhattanDistanceFlat(hostilePosition, this.FlagLoc) > 60)) // If an hostile is still in the perimeter, a new lord will be generated. { this.lord.ReceiveMemo("ThreatIsFinished"); } } } }
protected override IEnumerable <Toil> MakeNewToils() { yield return(Toils_Reserve.Reserve(outpostCommandConsoleTarget)); yield return(Toils_Goto.GotoCell(outpostCommandConsoleTarget, PathEndMode.InteractionCell).FailOnDestroyedOrNull(outpostCommandConsoleTarget)); yield return(Toils_General.Wait(800).FailOnDestroyedOrNull(outpostCommandConsoleTarget).WithProgressBarToilDelay(outpostCommandConsoleTarget)); Toil outpostCaptureResultToil = new Toil() { initAction = () => { const float chanceToSucceedPerSkillLevel = 6f; string eventTitle = "Outpost capture"; string eventText = ""; LetterType letterType = LetterType.Good; Faction turretsNewFaction = null; bool deactivateTurrets = false; Faction doorsNewFaction = null; bool deactivateDoors = false; PawnKindDef securityForcesDef = null; int dropPodsNumber = 0; Building_OutpostCommandConsole outpostCommandConsole = this.TargetThingA as Building_OutpostCommandConsole; eventText = " MiningCo. security systems report\n\n" + "Coralie here.\n" + "I have treated your security parameters change request. Here is the result:\n\n"; HackingResult hackingresult = ComputeHackResult(this.pawn, SkillDefOf.Research, SkillDefOf.Crafting, chanceToSucceedPerSkillLevel); if (hackingresult == HackingResult.MajorFail) { eventText += " - defense systems: ACCESS DENIED => set mode to aggressive.\n" + " - door access control: ACCESS DENIED => security locks engaged.\n" + " - request checksum: FORMAT ERROR => Security systems hacking detected...\n" + " => Shock support team requested!\n\n" + "--- End of transmission ---\n\n\n\n"; eventText += this.pawn.Name.ToStringShort + " failed to hack the outpost command console and triggered the internal securities.\n"; letterType = LetterType.BadUrgent; turretsNewFaction = OG_Util.FactionOfMiningCo; deactivateTurrets = false; doorsNewFaction = OG_Util.FactionOfMiningCo; deactivateDoors = false; if (OG_Util.FindOrbitalRelay(OG_Util.FactionOfMiningCo) == null) { eventText += "Be prepared to welcome the incoming MiningCo. shock security forces!"; securityForcesDef = OG_Util.OutpostGuardDef; dropPodsNumber = 8; } } else if (hackingresult == HackingResult.MinorFail) { eventText += " - defense systems: ACCESS DENIED => set mode to aggressive.\n" + " - door access control: ERROR => emergency open activated.\n" + " - request checksum: WRONG CRC => Security systems hacking detected...\n" + " => Patrol support team requested!\n\n" + "--- End of transmission ---\n\n\n\n"; eventText += this.pawn.Name.ToStringShort + " has some knowledge in the field of security system but did not managed to hack properly the outpost command console.\n\n"; letterType = LetterType.BadUrgent; turretsNewFaction = OG_Util.FactionOfMiningCo; deactivateTurrets = false; doorsNewFaction = null; deactivateDoors = true; if (OG_Util.FindOrbitalRelay(OG_Util.FactionOfMiningCo) == null) { eventText += "Be prepared to welcome the incoming MiningCo. patrol security forces."; securityForcesDef = OG_Util.OutpostScoutDef; dropPodsNumber = 4; } } else if (hackingresult == HackingResult.MinorSuccess) { eventText += " - defense systems: ERROR => systems deactivated.\n" + " - door access control: ACCESS GRANTED\n" + " - request checksum: CRC OK\n" + " => Unexpected error, technician team requested.\n\n" + "--- End of transmission ---\n\n\n\n"; eventText += "Your colonist managed to bypass most of the command console securities. However, " + this.pawn.Name.ToStringShort + " was not able to avoid the sending of a maintenance status report to the nearby MiningCo. comms satellite!\n\n"; letterType = LetterType.BadNonUrgent; turretsNewFaction = null; deactivateTurrets = true; doorsNewFaction = Faction.OfPlayer; deactivateDoors = true; if (OG_Util.FindOrbitalRelay(OG_Util.FactionOfMiningCo) == null) { eventText += "You will soon have to welcome a technician team."; securityForcesDef = OG_Util.OutpostTechnicianDef; dropPodsNumber = 2; } } else if (hackingresult == HackingResult.MajorSuccess) { eventText += " - defense systems: ACCESS GRANTED\n" + " - door access control: ACCESS GRANTED\n" + " - request checksum: CRC OK\n" + " => All parameters are valid.\n\n" + "--- End of transmission ---\n\n\n\n"; eventText += "Hacking the outpost command console was a child's play for " + this.pawn.Name.ToStringShort + ".\n The outpost is now fully under your control!"; letterType = LetterType.Good; turretsNewFaction = Faction.OfPlayer; deactivateTurrets = false; doorsNewFaction = Faction.OfPlayer; deactivateDoors = true; if (OG_Util.FindOrbitalRelay(OG_Util.FactionOfMiningCo) == null) { securityForcesDef = null; dropPodsNumber = 0; } } outpostCommandConsole.TryToCaptureOutpost(eventTitle, eventText, letterType, turretsNewFaction, deactivateTurrets, doorsNewFaction, deactivateDoors, dropPodsNumber, securityForcesDef); outpostCommandConsole.SetFaction(Faction.OfPlayer); }, defaultCompleteMode = ToilCompleteMode.Instant }; yield return(outpostCaptureResultToil); yield return(Toils_Reserve.Release(outpostCommandConsoleTarget)); }