public static void DropThingGroupsNear(IntVec3 dropCenter, Map map, List <List <Thing> > thingsGroups, int openDelay = 110, bool instaDrop = false, bool leaveSlag = false, bool canRoofPunch = true, Action callback = null) { foreach (List <Thing> thingsGroup in thingsGroups) { if (!DropCellFinder.TryFindDropSpotNear(dropCenter, map, out IntVec3 result, allowFogged: true, canRoofPunch)) { Log.Warning("DropThingsNear failed to find a place to drop " + thingsGroup.FirstOrDefault() + " near " + dropCenter + ". Dropping on random square instead."); result = CellFinderLoose.RandomCellWith((IntVec3 c) => c.Walkable(map), map); } for (int i = 0; i < thingsGroup.Count; i++) { thingsGroup[i].SetForbidden(value: true, warnOnFail: false); } if (instaDrop) { foreach (Thing item in thingsGroup) { GenPlace.TryPlaceThing(item, result, map, ThingPlaceMode.Near); } } else { ActiveDropPodInfo activeDropPodInfo = new ActiveDropPodInfo(); foreach (Thing item2 in thingsGroup) { activeDropPodInfo.innerContainer.TryAdd(item2); } activeDropPodInfo.openDelay = openDelay; activeDropPodInfo.leaveSlag = leaveSlag; MakeDropPodAt(result, map, activeDropPodInfo, callback); } } }
public static bool Prefix(IntVec3 c, Map map, ActiveDropPodInfo info) { Thing dropship = null; CompUSCMDropship cargo = null; // CompTransporter comp2 = null; for (int index = 0; index < info.innerContainer.Count; index++) { if (info.innerContainer[index].TryGetComp <CompUSCMDropship>() != null) { dropship = info.innerContainer[index]; ActiveDropPod activeDropPod = (ActiveDropPod)ThingMaker.MakeThing(USCMDefOf.RRY_USCM_ActiveDropshipUD4L, null); activeDropPod.Contents = info; EnsureInBounds(ref c, info.innerContainer[index].def, map); info.innerContainer.Remove(dropship); cargo = dropship.TryGetComp <CompUSCMDropship>(); cargo.Transporter.innerContainer = info.innerContainer; SkyfallerMaker.SpawnSkyfaller(USCMDefOf.RRY_USCM_DropshipUD4LIncoming, dropship, c, map); return(false); } } return(true); }
public void AddPod(ActiveDropPodInfo contents, bool justLeftTheMap) { contents.parent = this; this.pods.Add(contents); ThingOwner innerContainer = contents.innerContainer; for (int i = 0; i < innerContainer.Count; i++) { Pawn pawn = innerContainer[i] as Pawn; if (pawn != null && !pawn.IsWorldPawn()) { if (!base.Spawned) { Log.Warning("Passing pawn " + pawn + " to world, but the TravelingTransportPod is not spawned. This means that WorldPawns can discard this pawn which can cause bugs.", false); } if (justLeftTheMap) { pawn.ExitMap(false, Rot4.Invalid); } else { Find.WorldPawns.PassToWorld(pawn, PawnDiscardDecideMode.Decide); } } } contents.savePawnsWithReferenceMode = true; }
// Token: 0x06000001 RID: 1 RVA: 0x00002084 File Offset: 0x00000284 public static void MakeDropPodAt(IntVec3 c, Map map, ActiveDropPodInfo info) { var activeDropPod = (ActiveDropPod)ThingMaker.MakeThing(ThingDef.Named("ActiveSlagPod")); activeDropPod.Contents = info; SkyfallerMaker.SpawnSkyfaller(ThingDef.Named("SlagScatter"), activeDropPod, c, map); }
private void DropThingGroupsAt(IntVec3 dropCenter, Map map, List <List <Thing> > thingsGroups, int openDelay = 110, bool instaDrop = false, bool leaveSlag = false, bool forbid = true, bool allowFogged = true) { foreach (List <Thing> thingsGroup in thingsGroups) { if (forbid) { for (int index = 0; index < thingsGroup.Count; ++index) { thingsGroup[index].SetForbidden(true, false); } } if (instaDrop) { foreach (Thing thing in thingsGroup) { GenPlace.TryPlaceThing(thing, dropCenter, map, ThingPlaceMode.Near); } } else { ActiveDropPodInfo info = new ActiveDropPodInfo(); foreach (Thing thing in thingsGroup) { info.innerContainer.TryAdd(thing); } info.openDelay = openDelay; info.leaveSlag = leaveSlag; DropPodUtility.MakeDropPodAt(dropCenter, map, info); } } }
public static bool Prefix(IntVec3 c, Map map, ActiveDropPodInfo info) { Thing dropship = null; CompDropship cargo = null; // CompTransporter comp2 = null; for (int index = 0; index < info.innerContainer.Count; index++) { if (info.innerContainer[index].TryGetCompFast <CompDropship>() != null) { dropship = info.innerContainer[index]; string defName = dropship.def.defName; ActiveDropPod activeDropPod = (ActiveDropPod)ThingMaker.MakeThing(ThingDef.Named(defName + "_Active"), null); activeDropPod.Contents = info; EnsureInBounds(ref c, info.innerContainer[index].def, map); info.innerContainer.Remove(dropship); cargo = dropship.TryGetCompFast <CompDropship>(); cargo.Transporter.innerContainer = info.innerContainer; SkyfallerMaker.SpawnSkyfaller(ThingDef.Named(defName + "_Incoming"), dropship, c, map); return(false); } } return(true); }
// Token: 0x060011D5 RID: 4565 RVA: 0x000EC6D0 File Offset: 0x000EA8D0 public static bool Prefix(IntVec3 c, Map map, ActiveDropPodInfo info) { bool result = true; if (info.innerContainer.Any(x => x.def.thingClass == typeof(Pawn) && (x.Faction != null && x.Faction.def.HasModExtension <FactionDefExtension>()))) { List <Thing> list = info.innerContainer.Where(x => x.def.thingClass == typeof(Pawn) && (x.Faction != null && x.Faction.def.HasModExtension <FactionDefExtension>())).ToList(); FactionDefExtension extension = list.RandomElement().Faction.def.GetModExtension <FactionDefExtension>(); if (extension.DropPodOverride == DeepStrikeType.Drop) { DeepStrikeUtility.MakeDropPodAt(c, map, info, extension); result = false; } else if (extension.DropPodOverride == DeepStrikeType.Fly) { DeepStrikeUtility.MakeFlyerLandAt(c, map, info, extension); result = false; } else if (extension.DropPodOverride == DeepStrikeType.Teleport) { DeepStrikeUtility.MakeTeleportAt(c, map, info, extension); result = false; } else if (extension.DropPodOverride == DeepStrikeType.Tunnel) { DeepStrikeUtility.MakeTunnelAt(c, map, info, extension); result = false; } } return(result); }
public static bool Prefix(IntVec3 c, Map map, ActiveDropPodInfo info) { for (int index = 0; index < info.innerContainer.Count; index++) { if (info.innerContainer[index].TryGetComp <CompLaunchableSRTS>() != null) { Thing ship = info.innerContainer[index]; string shipType = ship.def.defName; ActiveDropPod activeDropPod = (ActiveDropPod)ThingMaker.MakeThing(ThingDef.Named(shipType + "_Active"), (ThingDef)null); activeDropPod.Contents = info; EnsureInBoundsSRTS(ref c, info.innerContainer[index].def, map); SRTSIncoming incomingSRTS = (SRTSIncoming)SkyfallerMaker.SpawnSkyfaller(ThingDef.Named(shipType + "_Incoming"), (Thing)activeDropPod, c, map); incomingSRTS.SRTSRotation = ship.Rotation; return(false); } else if (DefDatabase <ThingDef> .GetNamedSilentFail(info.innerContainer[index].def.defName.Split('_')[0])?.GetCompProperties <CompProperties_BombsAway>() != null) { ThingDef td = DefDatabase <ThingDef> .GetNamed(info.innerContainer[index].def.defName.Split('_')[0]); ActiveDropPod activeDropPod = (ActiveDropPod)ThingMaker.MakeThing(info.innerContainer[index].def, null); activeDropPod.Contents = info; SRTSIncoming incomingSRTS = (SRTSIncoming)SkyfallerMaker.SpawnSkyfaller(ThingDef.Named(td.defName + "_Incoming"), activeDropPod, c, map); return(false); } } return(true); }
// Token: 0x06002764 RID: 10084 RVA: 0x0012C518 File Offset: 0x0012A918 public static void DropThingGroupsNear(IntVec3 dropCenter, Map map, List <List <Thing> > thingsGroups, int openDelay = 110, bool instaDrop = false, bool leaveSlag = false, bool canRoofPunch = true, DeepStrikeType strikeType = DeepStrikeType.Drop) { foreach (List <Thing> list in thingsGroups) { List <Thing> list2 = list.Where(x => x.def.thingClass == typeof(Pawn) && (x.Faction != null && x.Faction.def.HasModExtension <FactionDefExtension>())).ToList(); FactionDefExtension extension = list2.RandomElement().Faction.def.GetModExtension <FactionDefExtension>(); IntVec3 intVec; if (!DropCellFinder.TryFindDropSpotNear(dropCenter, map, out intVec, true, canRoofPunch)) { Log.Warning(string.Concat(new object[] { "DropThingsNear failed to find a place to drop ", list.FirstOrDefault <Thing>(), " near ", dropCenter, ". Dropping on random square instead." }), false); intVec = CellFinderLoose.RandomCellWith((IntVec3 c) => c.Walkable(map) && (c.Roofed(map) && c.GetRoof(map) != RoofDefOf.RoofRockThick), map, 1000); } for (int i = 0; i < list.Count; i++) { list[i].SetForbidden(true, false); } if (instaDrop) { foreach (Thing thing in list) { GenPlace.TryPlaceThing(thing, intVec, map, ThingPlaceMode.Near, null, null); } } else { ActiveDropPodInfo activeDropPodInfo = new ActiveDropPodInfo(); foreach (Thing item in list) { activeDropPodInfo.innerContainer.TryAddOrTransfer(item, true); } activeDropPodInfo.openDelay = openDelay; activeDropPodInfo.leaveSlag = leaveSlag; if (strikeType == DeepStrikeType.Fly) { DeepStrikeUtility.MakeFlyerLandAt(intVec, map, activeDropPodInfo, extension); } else if (strikeType == DeepStrikeType.Tunnel) { DeepStrikeUtility.MakeTunnelAt(intVec, map, activeDropPodInfo, extension); } else if (strikeType == DeepStrikeType.Teleport) { DeepStrikeUtility.MakeTeleportAt(intVec, map, activeDropPodInfo, extension); } else { DeepStrikeUtility.MakeDropPodAt(intVec, map, activeDropPodInfo, extension); } } } }
public static void MakeDropPodAt(IntVec3 c, Map map, ActiveDropPodInfo info, Action callback = null) { ActiveDropPodPlus activeDropPod = (ActiveDropPodPlus)ThingMaker.MakeThing(ThingDefOfLocal.ActiveDropPodPlus); activeDropPod.Contents = info; activeDropPod.OpenCallback = callback; var pod = (DropPodIncomingPlus)SkyfallerPlusMaker.SpawnSkyfaller(ThingDefOfLocal.DropPodIncomingPlus, activeDropPod, c, map); }
private void CreatePod() { ActiveDropPodInfo activeDropPodInfo = new ActiveDropPodInfo(); activeDropPodInfo.openDelay = 10; activeDropPodInfo.leaveSlag = true; DropPodUtility.MakeDropPodAt(base.Position, base.Map, activeDropPodInfo, true); }
private void CreatePod() { ActiveDropPodInfo info = new ActiveDropPodInfo { openDelay = 10, leaveSlag = true }; DropPodUtility.MakeDropPodAt(base.Position, base.Map, info); }
public static bool Prefix(IntVec3 c, Map map, ActiveDropPodInfo info) { if (info.innerContainer.Contains(ThingDef.Named("Building_Helicopter"))) { ActiveDropPod activeDropPod = (ActiveDropPod)ThingMaker.MakeThing(ThingDef.Named("ActiveHelicopter"), null); activeDropPod.Contents = info; SkyfallerMaker.SpawnSkyfaller(ThingDef.Named("HelicopterIncoming"), activeDropPod, c, map); return(false); } return(true); }
public override void OnAcceptKeyPressed() { base.OnAcceptKeyPressed(); SoundDefOf.ExecuteTrade.PlayOneShotOnCamera(); if (daysAmount > 0 && hireData.Any(kvp => kvp.Value.First > 0)) { var pawns = new List <Pawn>(); var remainingCost = Mathf.RoundToInt(CostFinal); var silverList = targetMap.listerThings.ThingsOfDef(ThingDefOf.Silver) .Where(x => !x.Position.Fogged(x.Map) && (targetMap.areaManager.Home[x.Position] || x.IsInAnyStorage())).ToList(); while (remainingCost > 0) { var silver = silverList.First(t => t.stackCount > 0); var num = Mathf.Min(remainingCost, silver.stackCount); silver.SplitOff(num).Destroy(); remainingCost -= num; } if (!RCellFinder.TryFindRandomPawnEntryCell(out var cell, targetMap, 1f)) { cell = CellFinder.RandomEdgeCell(targetMap); } foreach (var kvp in hireData) { for (var i = 0; i < kvp.Value.First; i++) { var flag = kvp.Key.ignoreFactionApparelStuffRequirements; kvp.Key.ignoreFactionApparelStuffRequirements = true; var pawn = PawnGenerator.GeneratePawn(new PawnGenerationRequest(kvp.Key, mustBeCapableOfViolence: true, faction: Faction.OfPlayer, forbidAnyTitle: true, fixedIdeo: curFaction.referencedFaction is null ? hiredIdeo ?? (hiredIdeo = IdeoGenerator.GenerateIdeo(new IdeoGenerationParms(Faction.OfPlayer.def, classic: true))) : Find.World.factionManager.FirstFactionOfDef(curFaction.referencedFaction).ideos.GetRandomIdeoForNewPawn())); kvp.Key.ignoreFactionApparelStuffRequirements = flag; pawn.playerSettings.hostilityResponse = HostilityResponseMode.Attack; pawns.Add(pawn); var loc = DropCellFinder.TryFindSafeLandingSpotCloseToColony(targetMap, IntVec2.Two); var activeDropPodInfo = new ActiveDropPodInfo(); activeDropPodInfo.innerContainer.TryAdd(pawn, 1); activeDropPodInfo.openDelay = 60; activeDropPodInfo.leaveSlag = false; activeDropPodInfo.despawnPodBeforeSpawningThing = true; activeDropPodInfo.spawnWipeMode = WipeMode.Vanish; DropPodUtility.MakeDropPodAt(loc, targetMap, activeDropPodInfo); } } Find.World.GetComponent <HiringContractTracker>().SetNewContract(daysAmount, pawns, hireable, curFaction, CostFinal); } }
public static void MakeFlyerLandAt(IntVec3 c, Map map, ActiveDropPodInfo info, FactionDefExtension extension = null) { ThingDef ActiveDropPod = DefDatabase <ThingDef> .GetNamed("OG_Active_DeepStrike_Flyer"); ThingDef DropPodIncoming = DefDatabase <ThingDef> .GetNamed("OG_DeepStrike_Flyer_Incoming"); ActiveFlyer activeDropPod = (ActiveFlyer)ThingMaker.MakeThing(ActiveDropPod, null); activeDropPod.Contents = info; activeDropPod.Contents.leaveSlag = false; SkyfallerMaker.SpawnSkyfaller(DropPodIncoming, activeDropPod, c, map); }
public static void MakeTunnelAt(IntVec3 c, Map map, ActiveDropPodInfo info, FactionDefExtension extension = null) { ThingDef TunnelDef = DefDatabase <ThingDef> .GetNamed("OG_AMA_Tunneler"); TunnelSpawner tunnelSpawner = (TunnelSpawner)ThingMaker.MakeThing(TunnelDef, null); foreach (Thing item in info.innerContainer) { tunnelSpawner.GetDirectlyHeldThings().TryAddOrTransfer(item, false); } GenSpawn.Spawn(tunnelSpawner, c, map); }
public static void Enter(Pawn pawn, StringBuilder message) { var map = Find.CurrentMap; if (pawn.Map == map) { message.Append("You're already on the current map"); return; } IntVec3 intVec = DropCellFinder.RandomDropSpot(map); LetterDef textLetterDef = LetterDefOf.NeutralEvent; string label = "LetterLabelRefugeePodCrash".Translate(); string text = "RefugeePodCrash".Translate().AdjustedFor(pawn, "PAWN"); text += "\n\n"; if (pawn.Faction == null) { text += "RefugeePodCrash_Factionless".Translate(new object[] { pawn }).AdjustedFor(pawn, "PAWN"); } else if (pawn.Faction.HostileTo(Faction.OfPlayer)) { text += "RefugeePodCrash_Hostile".Translate(new object[] { pawn }).AdjustedFor(pawn, "PAWN"); textLetterDef = LetterDefOf.ThreatSmall; } else { text += "RefugeePodCrash_NonHostile".Translate(new object[] { pawn }).AdjustedFor(pawn, "PAWN"); } PawnRelationUtility.TryAppendRelationsWithColonistsInfo(ref text, ref label, pawn); Find.LetterStack.ReceiveLetter(label, text, textLetterDef, new TargetInfo(intVec, map, false), null, null); ActiveDropPodInfo activeDropPodInfo = new ActiveDropPodInfo(); activeDropPodInfo.innerContainer.TryAddRangeOrTransfer(new[] { pawn }, true, false); activeDropPodInfo.openDelay = 180; activeDropPodInfo.leaveSlag = true; DropPodUtility.MakeDropPodAt(intVec, map, activeDropPodInfo); message.Append(text); }
static bool Prefix(IntVec3 dropCenter, Map map, List <List <Thing> > thingsGroups, int openDelay = 110, bool instaDrop = false, bool leaveSlag = false, bool canRoofPunch = true) { IntVec3 intVec3; foreach (List <Thing> thingsGroup in thingsGroups) { if (!DropCellFinder.TryFindDropSpotNear(dropCenter, map, out intVec3, true, canRoofPunch)) { Log.Warning(string.Concat(new object[] { "DropThingsNear failed to find a place to drop ", thingsGroup.FirstOrDefault <Thing>(), " near ", dropCenter, ". Dropping on random square instead." })); intVec3 = CellFinderLoose.RandomCellWith((IntVec3 c) => c.Walkable(map), map, 1000); } for (int i = 0; i < thingsGroup.Count; i++) { thingsGroup[i].SetForbidden(true, false); } if (!instaDrop) { ActiveDropPodInfo activeDropPodInfo = new ActiveDropPodInfo(); foreach (Thing thing in thingsGroup) { activeDropPodInfo.innerContainer.TryAdd(thing, true); } if (Controller.Settings.podTrees.Equals(true)) { float woodCheck = map.Biome.plantDensity; if (woodCheck > 1) { woodCheck = 1; } if (Rand.Value < (woodCheck * 4)) { Thing wood = ThingMaker.MakeThing(ThingDefOf.WoodLog, null); float count = Rand.Gaussian(80, 10); count = count * woodCheck; wood.stackCount = (int)count; activeDropPodInfo.innerContainer.TryAdd(wood, true); } } activeDropPodInfo.openDelay = openDelay; activeDropPodInfo.leaveSlag = leaveSlag; DropPodUtility.MakeDropPodAt(intVec3, map, activeDropPodInfo); } else { foreach (Thing thing1 in thingsGroup) { GenPlace.TryPlaceThing(thing1, intVec3, map, ThingPlaceMode.Near, null); } } } return(false); }
public static void Prefix(ActiveDropPod __instance) { ActiveDropPodInfo activeDropPodInfo = Traverse.Create((object)__instance).Field("contents").GetValue <ActiveDropPodInfo>(); for (int index = activeDropPodInfo.innerContainer.Count - 1; index >= 0; --index) { Thing thing = activeDropPodInfo.innerContainer[index]; if (thing?.TryGetComp <CompLaunchableSRTS>() != null) { GenSpawn.Spawn(thing, __instance.Position, __instance.Map, thing.Rotation); break; } } }
// Token: 0x06002762 RID: 10082 RVA: 0x0012C458 File Offset: 0x0012A858 public static void MakeTunnelAt(IntVec3 c, Map map, ActiveDropPodInfo info, FactionDefExtension extension) { ThingDef TunnelDef = DefDatabase <ThingDef> .GetNamed("OG_AMA_Tunneler"); // Log.Message(string.Format("making tunnelSpawner: {0}, @: {1}, {2}, {3}", TunnelDef, c, map, info.innerContainer.ContentsString)); TunnelSpawner tunnelSpawner = (TunnelSpawner)ThingMaker.MakeThing(TunnelDef, null); foreach (Thing item in info.innerContainer) { tunnelSpawner.GetDirectlyHeldThings().TryAddOrTransfer(item, false); } GenSpawn.Spawn(tunnelSpawner, c, map); //-- SkyfallerMaker.SpawnSkyfaller(ThingDefOf.DropPodIncoming, tunnelSpawner, c, map); }
// Token: 0x06002762 RID: 10082 RVA: 0x0012C458 File Offset: 0x0012A858 public static void MakeDropPodAt(IntVec3 c, Map map, ActiveDropPodInfo info, FactionDefExtension extension) { ThingDef ActiveDropPod = ThingDefOf.ActiveDropPod; ThingDef DropPodIncoming = ThingDefOf.DropPodIncoming; if (extension != null) { ActiveDropPod = extension.ActiveDropPod; DropPodIncoming = extension.DropPodIncoming; } ActiveDropPod activeDropPod = (ActiveDropPod)ThingMaker.MakeThing(ActiveDropPod, null); activeDropPod.Contents = info; SkyfallerMaker.SpawnSkyfaller(DropPodIncoming, activeDropPod, c, map); }
public void AddPod(ActiveDropPodInfo contents, bool justLeftTheMap) { contents.parent = null; pods.Add(contents); var innerContainer = contents.innerContainer; for (var i = 0; i < innerContainer.Count; i++) { if (innerContainer[i] is Pawn pawn && !pawn.IsWorldPawn()) { if (!Spawned) { Log.Warning("Passing pawn " + pawn + " to world, but the TravelingTransportPod is not spawned. This means that WorldPawns can discard this pawn which can cause bugs."); } if (justLeftTheMap) { pawn.ExitMap(false, Rot4.Random); } else { Find.WorldPawns.PassToWorld(pawn); } } if (innerContainer[i] is PawnFlyer pawnFlyer && !pawnFlyer.IsWorldPawn()) { if (!Spawned) { Log.Warning("Passing pawn " + pawnFlyer + " to world, but the TravelingTransportPod is not spawned. This means that WorldPawns can discard this pawn which can cause bugs."); } if (justLeftTheMap) { pawnFlyer.ExitMap(false, Rot4.Random); } else { Find.WorldPawns.PassToWorld(pawnFlyer); } } } contents.savePawnsWithReferenceMode = true; }
// Token: 0x0600271E RID: 10014 RVA: 0x00129D34 File Offset: 0x00128134 protected override void LeaveMap() { if (this.alreadyLeft) { base.LeaveMap(); return; } if (this.groupID < 0) { Log.Error("Drop pod left the map, but its group ID is " + this.groupID, false); this.Destroy(DestroyMode.Vanish); return; } if (this.destinationTile < 0) { Log.Error("Drop pod left the map, but its destination tile is " + this.destinationTile, false); this.Destroy(DestroyMode.Vanish); return; } Lord lord = TransporterUtility.FindLord(this.groupID, base.Map); if (lord != null) { base.Map.lordManager.RemoveLord(lord); } TravelingTransportPods travelingTransportPods = (TravelingTransportPods)WorldObjectMaker.MakeWorldObject(DefDatabase <WorldObjectDef> .GetNamed("TravelingHelicopters", true)); travelingTransportPods.Tile = base.Map.Tile; travelingTransportPods.SetFaction(Faction.OfPlayer); travelingTransportPods.destinationTile = this.destinationTile; travelingTransportPods.arrivalAction = this.arrivalAction; Find.WorldObjects.Add(travelingTransportPods); HelicopterLeaving.tmpActiveDropPods.Clear(); HelicopterLeaving.tmpActiveDropPods.AddRange(base.Map.listerThings.ThingsInGroup(ThingRequestGroup.ActiveDropPod)); for (int i = 0; i < HelicopterLeaving.tmpActiveDropPods.Count; i++) { HelicopterLeaving HelicopterLeaving = HelicopterLeaving.tmpActiveDropPods[i] as HelicopterLeaving; if (HelicopterLeaving != null && HelicopterLeaving.groupID == this.groupID) { HelicopterLeaving.alreadyLeft = true; travelingTransportPods.AddPod(HelicopterLeaving.Contents, true); HelicopterLeaving.Contents = null; HelicopterLeaving.Destroy(DestroyMode.Vanish); } } }
public static bool Prefix(IntVec3 c, Map map, ActiveDropPodInfo info) { for (int index = 0; index < info.innerContainer.Count; index++) { if (info.innerContainer[index].TryGetComp <CompLaunchableHelicopter>() != null) { Thing helicopter = info.innerContainer[index]; ActiveDropPod activeDropPod = (ActiveDropPod)ThingMaker.MakeThing(ThingDef.Named("ActiveHelicopter"), null); activeDropPod.Contents = info; EnsureInBounds(ref c, info.innerContainer[index].def, map); SkyfallerMaker.SpawnSkyfaller(ThingDef.Named("HelicopterIncoming"), activeDropPod, c, map); return(false); } } return(true); }
// Token: 0x06002762 RID: 10082 RVA: 0x0012C458 File Offset: 0x0012A858 public static void MakeTeleportAt(IntVec3 c, Map map, ActiveDropPodInfo info, FactionDefExtension extension) { WeatherEvent @event = new WeatherEvent_DeepStrike_Teleport(map, c, boltstring: (extension != null ? extension.TeleportBoltTexPath : "")); map.weatherManager.eventHandler.AddEvent(@event); ThingDef TunnelDef = DefDatabase <ThingDef> .GetNamed("OG_AMA_Teleporter"); // Log.Message(string.Format("making teleportSpawner: {0}, @: {1}, {2}, {3}", TunnelDef, c, map, info.innerContainer.ContentsString)); TeleportSpawner teleportSpawner = (TeleportSpawner)ThingMaker.MakeThing(TunnelDef, null); foreach (Thing item in info.innerContainer) { teleportSpawner.GetDirectlyHeldThings().TryAddOrTransfer(item, false); } GenSpawn.Spawn(teleportSpawner, c, map); //-- SkyfallerMaker.SpawnSkyfaller(ThingDefOf.DropPodIncoming, tunnelSpawner, c, map); }
public static void MakeTeleportAt(IntVec3 c, Map map, ActiveDropPodInfo info, FactionDefExtension extension = null) { /* * WeatherEvent @event = new WeatherEvent_DeepStrike_Teleport(map, c, boltstring: (extension !=null ? extension.TeleportBoltTexPath : "")); * map.weatherManager.eventHandler.AddEvent(@event); */ ThingDef TunnelDef = DefDatabase <ThingDef> .GetNamed("OG_AMA_Teleporter"); TeleportSpawner teleportSpawner = (TeleportSpawner)ThingMaker.MakeThing(TunnelDef, null); foreach (Thing item in info.innerContainer) { teleportSpawner.GetDirectlyHeldThings().TryAddOrTransfer(item, false); } teleportSpawner.extFaction = extension; GenSpawn.Spawn(teleportSpawner, c, map); }
// Token: 0x060011D5 RID: 4565 RVA: 0x000EC6D0 File Offset: 0x000EA8D0 public static bool Prefix(IntVec3 c, Map map, ActiveDropPodInfo info) { bool result = true; List <Thing> list = new List <Thing>(); for (int i = 0; i < info.innerContainer.Count; i++) { Thing t = info.innerContainer[i]; if (t?.Faction?.def.GetModExtensionFast <FactionDefExtension>() != null) { list.Add(t); } } if (!list.NullOrEmpty()) { Thing thing = list.RandomElement(); FactionDefExtension extension = thing.Faction.def.GetModExtensionFast <FactionDefExtension>(); if (thing.Faction.IsPlayer || extension.DropPodOverride == DeepStrikeType.DropPod && extension.DropPodIncoming == ThingDefOf.DropPodIncoming) { return(result); } if (extension.DropPodOverride == DeepStrikeType.DropPod) { DeepStrikeUtility.MakeDropPodAt(c, map, info, extension); result = false; } else if (extension.DropPodOverride == DeepStrikeType.Fly) { DeepStrikeUtility.MakeFlyerLandAt(c, map, info, extension); result = false; } else if (extension.DropPodOverride == DeepStrikeType.Teleport) { DeepStrikeUtility.MakeTeleportAt(c, map, info, extension); result = false; } else if (extension.DropPodOverride == DeepStrikeType.Tunnel) { DeepStrikeUtility.MakeTunnelAt(c, map, info, extension); result = false; } } return(result); }
public static bool Prefix(IntVec3 c, Map map, ActiveDropPodInfo info) { for (int index = 0; index < info.innerContainer.Count; index++) { if (info.innerContainer[index].TryGetComp <CompLaunchableSRTS>() != null) { Thing ship = info.innerContainer[index]; string shipType = ship.def.defName; ActiveDropPod activeDropPod = (ActiveDropPod)ThingMaker.MakeThing(ThingDef.Named(shipType + "_Active"), (ThingDef)null); activeDropPod.Contents = info; EnsureInBoundsSRTS(ref c, info.innerContainer[index].def, map); SRTSIncoming incomingSRTS = (SRTSIncoming)SkyfallerMaker.SpawnSkyfaller(ThingDef.Named(shipType + "_Incoming"), (Thing)activeDropPod, c, map); incomingSRTS.SRTSRotation = ship.Rotation; return(false); } } return(true); }
protected override bool TryExecuteWorker(IncidentParms parms) { Map map = (Map)parms.target; List <Thing> things = ThingSetMakerDefOf.RefugeePod.root.Generate(); IntVec3 intVec = DropCellFinder.RandomDropSpot(map); Pawn pawn = this.FindPawn(things); pawn.guest.getRescuedThoughtOnUndownedBecauseOfPlayer = true; string label = "LetterLabelRefugeePodCrash".Translate(); string text = "RefugeePodCrash".Translate(pawn.Named("PAWN")).AdjustedFor(pawn, "PAWN"); text += "\n\n"; if (pawn.Faction == null) { text += "RefugeePodCrash_Factionless".Translate(pawn.Named("PAWN")).AdjustedFor(pawn, "PAWN"); } else if (pawn.Faction.HostileTo(Faction.OfPlayer)) { text += "RefugeePodCrash_Hostile".Translate(pawn.Named("PAWN")).AdjustedFor(pawn, "PAWN"); } else { text += "RefugeePodCrash_NonHostile".Translate(pawn.Named("PAWN")).AdjustedFor(pawn, "PAWN"); } PawnRelationUtility.TryAppendRelationsWithColonistsInfo(ref text, ref label, pawn); if (Quote != null) { text += "\n\n"; text += Quote; } Find.LetterStack.ReceiveLetter(label, text, LetterDefOf.NeutralEvent, new TargetInfo(intVec, map, false), null, null); ActiveDropPodInfo activeDropPodInfo = new ActiveDropPodInfo(); activeDropPodInfo.innerContainer.TryAddRangeOrTransfer(things, true, false); activeDropPodInfo.openDelay = 180; activeDropPodInfo.leaveSlag = true; DropPodUtility.MakeDropPodAt(intVec, map, activeDropPodInfo); return(true); }
protected override bool TryExecuteWorker(IncidentParms parms) { var map = (Map)parms.target; var things = ThingSetMakerDefOf.RefugeePod.root.Generate(); var intVec = DropCellFinder.RandomDropSpot(map); var pawn = FindPawn(things); pawn.guest.getRescuedThoughtOnUndownedBecauseOfPlayer = true; var label = "LetterLabelRefugeePodCrash".Translate(); var text = "RefugeePodCrash".Translate(pawn.Named("PAWN")).AdjustedFor(pawn); text += "\n\n"; if (pawn.Faction == null) { text += "RefugeePodCrash_Factionless".Translate(pawn.Named("PAWN")).AdjustedFor(pawn); } else if (pawn.Faction.HostileTo(Faction.OfPlayer)) { text += "RefugeePodCrash_Hostile".Translate(pawn.Named("PAWN")).AdjustedFor(pawn); } else { text += "RefugeePodCrash_NonHostile".Translate(pawn.Named("PAWN")).AdjustedFor(pawn); } PawnRelationUtility.TryAppendRelationsWithColonistsInfo(ref text, ref label, pawn); Find.LetterStack.ReceiveLetter(label, text, LetterDefOf.NeutralEvent, new TargetInfo(intVec, map)); var activeDropPodInfo = new ActiveDropPodInfo(); activeDropPodInfo.innerContainer.TryAddRangeOrTransfer(things); activeDropPodInfo.openDelay = 180; activeDropPodInfo.leaveSlag = true; DropPodUtility.MakeDropPodAt(intVec, map, activeDropPodInfo); //Give the pawn the Scuttlebug Infection var torso = pawn.health.hediffSet.GetNotMissingParts().First(bpr => bpr.def == BodyPartDefOf.Torso); var unused = pawn.health.hediffSet.GetNotMissingParts().First(bpr => bpr.def == BodyPartDefOf.Head); pawn.health.AddHediff(HediffDef.Named("ScuttlebugInfection"), torso); return(true); }