private void SendDrop() { GenDate.DayOfYear(ticks, Find.WorldGrid.LongLatOf(map.Tile).x); List <Thing> thingList = new List <Thing>(); thingList.Add(ThingMaker.MakeThing(AvaliDefs.AvaliNexus)); Scribe_Values.Look(ref hasDropped, "hasDropped", false); Map target = map; List <Faction> newFactions = new List <Faction>(); IntVec3 intVec3 = DropCellFinder.TradeDropSpot(target); if (RimValiUtility.PawnOfRaceCount(Faction.OfPlayer, AvaliDefs.RimVali) >= 5 && !hasDropped) { hasDropped = true; for (int a = 0; a < random.Next(2, 5); a++) { Faction faction = FactionGenerator.NewGeneratedFaction(AvaliDefs.AvaliFaction); faction.Name = "IlluminateFactionName".Translate() + ": #" + a.ToString(); faction.SetRelationDirect(Faction.OfPlayer, FactionRelationKind.Ally); newFactions.Add(faction); } DropPodUtility.DropThingsNear(intVec3, target, (IEnumerable <Thing>)thingList); ChoiceLetter choiceLetter = LetterMaker.MakeLetter("IlluminateAirdrop".Translate(), "AirdropEventDesc".Translate(), AvaliMod.AvaliDefs.IlluminateAirdrop, newFactions[random.Next(newFactions.Count)]); Find.LetterStack.ReceiveLetter(choiceLetter, null); } }
protected override bool TryExecuteWorker(IncidentParms parms) { List<Thing> thingList = new List<Thing>(); thingList.Add(ThingMaker.MakeThing(AvaliDefs.AvaliNanoForge)); Map target = (Map)parms.target; IntVec3 intVec3 = DropCellFinder.TradeDropSpot(target); if (RimValiUtility.PawnOfRaceCount(Faction.OfPlayer, AvaliDefs.RimVali) >= 5 && !hasDropped) { hasDropped = true; DropPodUtility.DropThingsNear(intVec3, target, (IEnumerable<Thing>)thingList); this.SendStandardLetter("Illuminate Airdrop", "Illuminate Airdrop", AvaliDefs.IlluminateAirdrop,parms, (LookTargets)new TargetInfo(intVec3, target, false), (NamedArgument[])Array.Empty<NamedArgument>()); } return true; }
public static bool AllowDropWhenPawnCountMet(IncidentParms parms, List <ThingDef> things, ThingDef race, int requiredCount) { List <Thing> thingList = new List <Thing>(); foreach (ThingDef thingDef in things) { thingList.Add(ThingMaker.MakeThing(thingDef)); } Map target = (Map)parms.target; IntVec3 intVec3 = DropCellFinder.TradeDropSpot(target); if (RimValiUtility.PawnOfRaceCount(Faction.OfPlayer, race) >= requiredCount) { DropPodUtility.DropThingsNear(intVec3, target, (IEnumerable <Thing>)thingList); } return(true); }