private static void Add1000RWP() { int tile = GenWorld.MouseTile(); if (tile < 0 || Find.World.Impassable(tile)) { Messages.Message("Impassable", MessageTypeDefOf.RejectInput, historical: false); } else { RimWorld.Planet.Settlement s = Find.WorldObjects.SettlementAt(tile); if (s != null && s.Faction != Faction.OfPlayer) { RimWarSettlementComp rwsc = WorldUtility.GetRimWarSettlementAtTile(tile); if (rwsc != null && rwsc.parent.Faction != Faction.OfPlayer) { rwsc.RimWarPoints += 1000; } } WarObject rwo = Find.WorldObjects.WorldObjectAt(tile, RimWarDefOf.RW_WarObject) as WarObject; if (rwo != null) { rwo.RimWarPoints += 1000; } } }
void UpdateDictionaryLateralRow(bool toRight) { Dictionary <Coordinates, Cell> oldCells = world.Cells.CreateCopy(); foreach (Coordinates previousCoords in cellsKeys) { Coordinates newCoords = previousCoords; if (previousCoords.face != EFace.up && previousCoords.face != EFace.down) { //get coords same position but next or prev face newCoords.face = (EFace)WorldUtility.SelectIndex((int)previousCoords.face, toRight, 4); //face: front -> right //right -> back //back -> left //left -> front } else { //rotate the row, so change coordinates x and y, but not the face bool rotateToRight = previousCoords.face == EFace.up ? toRight : !toRight; newCoords = UpdateCoordinatesCompleteFace(previousCoords, rotateToRight); } //set new coordinates SetCoordinates(oldCells[previousCoords], newCoords); } }
Coordinates GetAdjacentCoordinates() { //get cells around List <Cell> cellsAround = GameManager.instance.world.GetCellsAround(coordinatesToAttack); //remove coordinates already used foreach (Coordinates coordinates in coordinatesAlreadyUsed) { foreach (Cell cell in cellsAround) { if (cell.coordinates == coordinates) { cellsAround.Remove(cell); } } } //removes coordinates where there are already enemies if (checkNoHitEnemies) { WorldUtility.CheckOverlap(transform.position, coordinatesToAttack.position, cellsAround); } //return random return(cellsAround[Random.Range(0, cellsAround.Count)].coordinates); }
public virtual void ScanAction(float range) { if (interactable) { List <WorldObject> worldObjects = WorldUtility.GetWorldObjectsInRange(this.Tile, range); if (worldObjects != null && worldObjects.Count > 0) { for (int i = 0; i < worldObjects.Count; i++) { WorldObject wo = worldObjects[i]; if (wo.Faction != this.Faction && wo != this.DestinationTarget) { //Log.Message("" + this.Name + " scanned nearby object " + this.targetWorldObject.Label); if (wo is Caravan) //or rimwar caravan, or diplomat, or merchant; ignore scouts and settlements { //Log.Message(this.Label + " engaging nearby warband " + wo.Label); EngageNearbyCaravan(wo as Caravan); break; } else if (wo is WarObject) { EngageNearbyWarObject(wo as WarObject); break; } } } } } else { Log.Message(this.Name + " is not interactable"); } }
public static void DeclareAllianceWith(Faction declaringFaction, Faction withFaction) { RimWarData rwd = WorldUtility.GetRimWarDataForFaction(declaringFaction); if (!rwd.IsAlliedWith(withFaction)) { rwd.AllianceFactions.Add(withFaction); declaringFaction.RelationWith(withFaction).goodwill = 100; declaringFaction.RelationWith(withFaction).kind = FactionRelationKind.Ally; Find.LetterStack.ReceiveLetter("RW_DiplomacyLetter".Translate("RW_DiplomacyLabel_Alliance".Translate()), "RW_DeclareAlliance".Translate(rwd.RimWarFaction.Name, withFaction.Name), RimWarDefOf.RimWar_NeutralEvent); } RimWarData rwdAlly = WorldUtility.GetRimWarDataForFaction(withFaction); if (!rwdAlly.IsAlliedWith(declaringFaction)) { withFaction.RelationWith(declaringFaction).goodwill = 100; withFaction.RelationWith(declaringFaction).kind = FactionRelationKind.Ally; rwdAlly.AllianceFactions.Add(declaringFaction); Find.LetterStack.ReceiveLetter("RW_DiplomacyLetter".Translate("RW_DiplomacyLabel_Alliance".Translate()), "RW_DeclareAlliance".Translate(rwdAlly.RimWarFaction.Name, declaringFaction.Name), RimWarDefOf.RimWar_NeutralEvent); } for (int i = 0; i < rwd.WarFactions.Count; i++) { if (!rwdAlly.IsAtWarWith(rwd.WarFactions[i])) { DeclareWarOn(rwdAlly.RimWarFaction, rwd.WarFactions[i]); //Find.LetterStack.ReceiveLetter("RW_DiplomacyLetter".Translate("RW_DiplomacyLabel_War".Translate()), "RW_DeclareWar".Translate(rwdAlly.RimWarFaction.Name, rwd.WarFactions[i].Name), RimWarDefOf.RimWar_HostileEvent); } } }
private static void DebugResetAllSettlements() { Log.Message("Reseting Rim War Settlement Points..."); int totalSettlements = 0; int initialPoints = GetPointsFromAllSettlements(out totalSettlements); float yearMultiplier = 1f + (GenDate.YearsPassed * .1f); List <RimWarData> rwdList = WorldUtility.Get_WCPT().RimWarData; if (rwdList != null && rwdList.Count > 0) { for (int i = 0; i < rwdList.Count; i++) { List <RimWarSettlementComp> rwscList = rwdList[i].WarSettlementComps; if (rwscList != null && rwscList.Count > 0 && rwdList[i].behavior != RimWarBehavior.Player) { for (int j = 0; j < rwscList.Count; j++) { rwscList[j].RimWarPoints = Mathf.RoundToInt(WorldUtility.CalculateSettlementPoints(rwscList[j].parent, rwscList[j].parent.Faction) * Rand.Range(.5f, 1.5f) * yearMultiplier); } } } } int adjustedPoints = GetPointsFromAllSettlements(out totalSettlements); Log.Message(totalSettlements + " settlements initially with " + initialPoints + "; " + Mathf.RoundToInt(initialPoints / totalSettlements) + " per settlement"); Log.Message(totalSettlements + " settlements adjusted to " + adjustedPoints + "; " + Mathf.RoundToInt(adjustedPoints / totalSettlements) + " per settlement"); }
public static void EndAllianceWith(Faction declaringFaction, Faction withFaction) { List <RimWarData> rwdList = WorldUtility.GetRimWarData(); for (int i = 0; i < rwdList.Count; i++) { RimWarData rwd = rwdList[i]; if (rwd.RimWarFaction == declaringFaction) { if (rwd.IsAlliedWith(withFaction)) { rwd.AllianceFactions.Remove(withFaction); Find.LetterStack.ReceiveLetter("RW_DiplomacyLetter".Translate("RW_DiplomacyLabel_EndAlliance".Translate()), "RW_DeclareAllianceEnd".Translate(rwd.RimWarFaction.Name, withFaction.Name), RimWarDefOf.RimWar_NeutralEvent); } } if (rwd.RimWarFaction == withFaction) { if (rwd.IsAlliedWith(declaringFaction)) { rwd.AllianceFactions.Remove(declaringFaction); Find.LetterStack.ReceiveLetter("RW_DiplomacyLetter".Translate("RW_DiplomacyLabel_EndAlliance".Translate()), "RW_DeclareAllianceEnd".Translate(rwd.RimWarFaction.Name, declaringFaction.Name), RimWarDefOf.RimWar_NeutralEvent); } } } }
public void ReAssignParentSettlement() { this.ValidateParentSettlement(); WorldUtility.Get_WCPT().UpdateFactionSettlements(WorldUtility.GetRimWarDataForFaction(this.Faction)); FindParentSettlement(); this.DestinationTarget = this.ParentSettlement; }
private static void DebugResetAllMobileUnits() { int resetCount = 0; List <WorldObject> woList = Find.WorldObjects.AllWorldObjects; if (woList != null && woList.Count > 0) { for (int i = 0; i < woList.Count; i++) { WarObject rwo = woList[i] as WarObject; if (rwo != null) { RimWarData rwd = WorldUtility.GetRimWarDataForFaction(rwo.Faction); if (rwd != null && rwd.WorldSettlements != null && rwd.WorldSettlements.Count > 0) { resetCount++; RimWorld.Planet.Settlement settlement = rwd.WorldSettlements.RandomElement(); if (settlement != null) { if (settlement.Destroyed) { Log.Warning("Detected destroyed settlement in Rim War data for " + rwd.RimWarFaction.Name); } else { RimWarSettlementComp rwsc = settlement.GetComponent <RimWarSettlementComp>(); if (rwsc != null) { rwsc.RimWarPoints += rwo.RimWarPoints; } else { Log.Warning("Found no Rim War component for settlement " + settlement.Label); Log.Warning("Settlement in faction " + settlement.Faction); Log.Warning("Settlement defname " + settlement.def.defName); } } } else { Log.Warning("Detected null settlement in Rim War data for " + rwd.RimWarFaction.Name); } if (!rwo.Destroyed) { rwo.Destroy(); } } else { Log.Warning("Tried to reset unit but no Faction data exists - cleaning up object."); if (!rwo.Destroyed) { rwo.Destroy(); } } } } Log.Message("Reset " + resetCount + " Rim War units."); } }
public override void PreOpen() { base.PreOpen(); WorldUtility.ValidateFactions(true); tabs.Clear(); tabs.Add(new TabRecord("RW_Relations".Translate(), delegate { curTab = RimWarTab.Relations; }, () => curTab == RimWarTab.Relations)); tabs.Add(new TabRecord("RW_Events".Translate(), delegate { curTab = RimWarTab.Events; }, () => curTab == RimWarTab.Events)); tabs.Add(new TabRecord("RW_Performance".Translate(), delegate { curTab = RimWarTab.Performance; }, () => curTab == RimWarTab.Performance)); historyAutoRecorderGroup = Find.History.Groups().FirstOrDefault((HistoryAutoRecorderGroup x) => x.def.defName == "RimWar_Power"); if (historyAutoRecorderGroup != null) { graphSection = new FloatRange(0f, (float)Find.TickManager.TicksGame / 60000f); } List <Map> maps = Find.Maps; for (int i = 0; i < maps.Count; i++) { maps[i].wealthWatcher.ForceRecount(); } }
public static bool Caravan_Give_Prefix(Caravan caravan, List <ThingCount> demands, List <Pawn> attackers) { List <WarObject> warObject = WorldUtility.GetHostileWarObjectsInRange(caravan.Tile, 1, caravan.Faction); //Log.Message("checking action give"); if (warObject != null && warObject.Count > 0 && attackers != null && attackers.Count > 0) { //Log.Message("found " + warObject.Count + " warObjects"); for (int i = 0; i < warObject.Count; i++) { if (warObject[i].Faction != null)//&& warObject[i].Faction == attackers[0].Faction) { float marketValue = 0; for (int j = 0; j < demands.Count; j++) { marketValue += (demands[j].Thing.MarketValue * demands[j].Count); } //Log.Message("market value of caravan ransom is " + marketValue); int points = warObject[i].RimWarPoints + Mathf.RoundToInt(marketValue / 20); //if (warObject[i].ParentSettlement != null) //{ // ConsolidatePoints reconstitute = new ConsolidatePoints(points, Mathf.RoundToInt(Find.WorldGrid.TraversalDistanceBetween(caravan.Tile, warObject[i].ParentSettlement.Tile) * warObject[i].TicksPerMove) + Find.TickManager.TicksGame); // warObject[i].WarSettlementComp.SettlementPointGains.Add(reconstitute); // warObject[i].ImmediateAction(null); //} warObject[i].interactable = false; break; } } } return(true); }
public static bool CallForAid_Replacement_Patch(Map map, Faction faction) { Faction ofPlayer = Faction.OfPlayer; int goodwillChange = -25; bool canSendMessage = false; string reason = "GoodwillChangedReason_RequestedMilitaryAid".Translate(); faction.TryAffectGoodwillWith(ofPlayer, goodwillChange, canSendMessage, true, reason); IncidentParms incidentParms = new IncidentParms(); incidentParms.target = map; incidentParms.faction = faction; incidentParms.raidArrivalModeForQuickMilitaryAid = true; incidentParms.points = DiplomacyTuning.RequestedMilitaryAidPointsRange.RandomInRange; faction.lastMilitaryAidRequestTick = Find.TickManager.TicksGame; RimWarData rwd = WorldUtility.GetRimWarDataForFaction(faction); RimWarSettlementComp rwdTown = rwd.WorldSettlements.RandomElement().GetComponent <RimWarSettlementComp>(); if (rwdTown != null) { int pts = Mathf.RoundToInt(rwdTown.RimWarPoints / 2); if (rwd.CanLaunch) { WorldUtility.CreateLaunchedWarband(pts, rwd, rwdTown.parent as RimWorld.Planet.Settlement, rwdTown.parent.Tile, Find.WorldObjects.SettlementAt(map.Tile), WorldObjectDefOf.Settlement); } else { WorldUtility.CreateWarband(pts, rwd, rwdTown.parent as RimWorld.Planet.Settlement, rwdTown.parent.Tile, Find.WorldObjects.SettlementAt(map.Tile), WorldObjectDefOf.Settlement); } rwdTown.RimWarPoints = pts; return(false); } return(true); }
public void FindParentSettlement() { ParentSettlement = WorldUtility.GetClosestRimWarSettlementInRWDTo(WorldUtility.GetRimWarDataForFaction(this.Faction), this.Tile); //List<Settlement> rwdTownList = WorldUtility.GetFriendlyRimWarSettlementsInRange(this.Tile, 30, this.Faction, WorldUtility.GetRimWarData(), WorldUtility.GetRimWarDataForFaction(this.Faction)); //if(rwdTownList != null && rwdTownList.Count <= 0) //{ // Log.Message("initial check did not find nearby settlement"); // rwdTownList = WorldUtility.GetFriendlyRimWarSettlementsInRange(this.Tile, 100, this.Faction, WorldUtility.GetRimWarData(), WorldUtility.GetRimWarDataForFaction(this.Faction)); //} //if(rwdTownList != null && rwdTownList.Count > 0) //{ // this.ParentSettlement = rwdTownList.RandomElement(); //WorldUtility.GetFriendlyRimWarSettlementsInRange(this.Tile, 100, this.Faction, WorldUtility.GetRimWarData(), WorldUtility.GetRimWarDataForFaction(this.Faction)).RandomElement(); // Log.Message("found parent at " + this.ParentSettlement.Tile + " current tile is " + this.Tile); // PathToTarget(Find.World.worldObjects.WorldObjectAt(this.ParentSettlement.Tile, WorldObjectDefOf.Settlement)); //} if (this.parentSettlement == null) { //warband is lost, no nearby parent settlement this.Destroy(); if (Find.WorldObjects.Contains(this)) { Find.WorldObjects.Remove(this); } } }
public void ReAssignParentSettlement() { this.ValidateParentSettlement(); WorldUtility.Get_WCPT().UpdateFactionSettlements(WorldUtility.GetRimWarDataForFaction(this.Faction)); FindParentSettlement(); this.DestinationTarget = Find.World.worldObjects.WorldObjectAt(this.ParentSettlement.Tile, WorldObjectDefOf.Settlement); }
public override float PullRecord() { float num = 0f; num = WorldUtility.Get_WCPT().settlementSearches; WorldUtility.Get_WCPT().settlementSearches = 0; return(num); }
public static void AttackNow_SettlementReinforcement_Postfix(SettlementUtility __instance, Caravan caravan, RimWorld.Planet.Settlement settlement) { RimWar.Planet.Settlement rwSettlement = WorldUtility.GetRimWarSettlementAtTile(settlement.Tile); if (rwSettlement != null && rwSettlement.RimWarPoints > 1050) { WorldUtility.CreateWarband((rwSettlement.RimWarPoints - 1000), WorldUtility.GetRimWarDataForFaction(rwSettlement.Faction), rwSettlement, rwSettlement.Tile, rwSettlement.Tile, WorldObjectDefOf.Settlement); } }
public override float PullRecord() { float num = 0f; num = WorldUtility.Get_WCPT().globalActions; WorldUtility.Get_WCPT().globalActions = 0; return(num); }
public override float PullRecord() { float num = 0f; num = WorldUtility.Get_WCPT().creationAttempts; WorldUtility.Get_WCPT().creationAttempts = 0; return(num / 10); }
public override float PullRecord() { float num = 0f; num = WorldUtility.Get_WCPT().objectsCreated; WorldUtility.Get_WCPT().objectsCreated = 0; return(num); }
private static void Postfix(FactionManager __instance, Faction faction) { RimWarData rwd = WorldUtility.GetRimWarDataForFaction(faction); if (rwd != null) { WorldUtility.RemoveRWDFaction(rwd); } }
public static void CallForAid(WarObject rwo, int pts, Map map, Faction faction, int callRelationsCost, RimWarData rwd, Settlement sendingSettlement) { Faction ofPlayer = Faction.OfPlayer; bool canSendMessage = false; string reason = "GoodwillChangedReason_RequestedMilitaryAid".Translate(); faction.TryAffectGoodwillWith(ofPlayer, -callRelationsCost, canSendMessage, true, reason); sendingSettlement.GetComponent <RimWarSettlementComp>().RimWarPoints -= pts; WorldUtility.CreateWarObjectOfType(rwo, pts, rwd, sendingSettlement, sendingSettlement.Tile, Find.WorldObjects.SettlementAt(map.Tile), WorldObjectDefOf.Settlement); }
public override void OnCreated() { base.OnCreated(); var bundles = CollectionPooler <WireBundle, BitVector32> .dictionary.GetObject(); for (int i = 0; i < Int2.edges4.Count; i++) { if (!neighbors[1 << i]) { continue; } Int2 position = mainPosition + Int2.edges4[i]; Wire wire = WorldUtility.GetTile <Wire>(position); WireBundle bundle = wire.Wires; var directions = bundles.TryGetValue(bundle); wire.RecalculateNeighbors(); directions[1 << i] = true; bundles[bundle] = directions; } foreach (KeyValuePair <WireBundle, BitVector32> pair in bundles) { if (Wires == null) { Wires = pair.Key; continue; } Wires.Merge(pair.Key); for (int i = 0; i < Int2.edges4.Count; i++) { if (!pair.Value[1 << i]) { continue; } Int2 position = mainPosition + Int2.edges4[i]; Wire wire = WorldUtility.GetTile <Wire>(position); FloodFill(wire, current => current.Wires = Wires); } } if (bundles.Count == 0) { Wires = new WireBundle(); } CollectionPooler <WireBundle, BitVector32> .dictionary.ReleaseObject(bundles); }
void CheckChangedFace() { //if change face, reselect center cell and move selector EFace face = WorldUtility.SelectFace(transform); if (face != coordinates.face) { coordinates = new Coordinates(face, GameManager.instance.world.worldConfig.CenterCell); GameManager.instance.uiManager.ShowSelector(coordinates); } }
void SelectCell(Vector2 movement) { //check if pressed input or moved analog if (movement.magnitude >= player.deadZoneAnalogs && pressedSelectCell == false) { pressedSelectCell = true; //save previous coordinates Coordinates previousCoordinates = coordinates; //select cell if (Mathf.Abs(movement.y) > Mathf.Abs(movement.x)) { if (movement.y > 0) { coordinates = WorldUtility.SelectCell(coordinates.face, coordinates.x, coordinates.y, WorldUtility.LateralFace(transform), ERotateDirection.up); } else if (movement.y < 0) { coordinates = WorldUtility.SelectCell(coordinates.face, coordinates.x, coordinates.y, WorldUtility.LateralFace(transform), ERotateDirection.down); } } else { if (movement.x > 0) { coordinates = WorldUtility.SelectCell(coordinates.face, coordinates.x, coordinates.y, WorldUtility.LateralFace(transform), ERotateDirection.right); } else if (movement.x < 0) { coordinates = WorldUtility.SelectCell(coordinates.face, coordinates.x, coordinates.y, WorldUtility.LateralFace(transform), ERotateDirection.left); } } //if differents coordinates if (previousCoordinates != coordinates) { //hide old preview and show new one GameManager.instance.world.Cells[previousCoordinates].HidePreview(); GameManager.instance.world.Cells[coordinates].ShowPreview(); } //show selector on new coordinates GameManager.instance.uiManager.ShowSelector(coordinates); } //reset when release input or analog else if (movement.magnitude < player.deadZoneAnalogs) { pressedSelectCell = false; } }
Coordinates GetNewCoordinates(EFace newFace) { //get cells in new face List <Cell> possibleCells = GameManager.instance.world.GetEveryCellInFace(newFace); //removes coordinates where there are already enemies if (checkNoHitEnemies) { WorldUtility.CheckOverlap(transform.position, coordinatesToAttack.position, possibleCells); } //return random return(possibleCells[Random.Range(0, possibleCells.Count)].coordinates); }
public static bool IncidentQueueAdd_Replacement_Prefix(IncidentQueue __instance, IncidentDef def, int fireTick, IncidentParms parms = null, int retryDurationTicks = 0) { if (def == IncidentDefOf.TraderCaravanArrival && fireTick == (Find.TickManager.TicksGame + 120000)) { RimWarSettlementComp rwdTown = WorldUtility.GetClosestSettlementOfFaction(parms.faction, parms.target.Tile, 40); if (rwdTown != null) { WorldUtility.CreateTrader(Mathf.RoundToInt(rwdTown.RimWarPoints / 2), WorldUtility.GetRimWarDataForFaction(rwdTown.parent.Faction), rwdTown.parent as RimWorld.Planet.Settlement, rwdTown.parent.Tile, Find.WorldObjects.SettlementAt(parms.target.Tile), WorldObjectDefOf.Settlement); rwdTown.RimWarPoints = Mathf.RoundToInt(rwdTown.RimWarPoints / 2); return(false); } } return(true); }
public override void Tick() { base.Tick(); if (Find.TickManager.TicksGame % this.searchTick == 0) { //scan for nearby engagements this.searchTick = Rand.Range(1500, 2000); ScanForNearbyEnemy(scanRange); //WorldUtility.GetRimWarDataForFaction(this.Faction).GetEngagementRange() Notify_Player(); if (this.DestinationTarget != null && this.DestinationTarget.Tile != pather.Destination) { PathToTarget(this.DestinationTarget); } if (this.DestinationTarget != null && this.Tile == this.DestinationTarget.Tile) { if (DestinationTarget is WarObject || DestinationTarget is Caravan) { EngageNearbyEnemy(); } } } if (Find.TickManager.TicksGame % (this.searchTick - 10) == 0) { this.ValidateParentSettlement(); } if (true) //Find.TickManager.TicksGame % 60 == 0) { //target is gone; return home if (this.DestinationTarget == null && this.ParentSettlement != null) { this.DestinationTarget = Find.World.worldObjects.WorldObjectAt(this.ParentSettlement.Tile, WorldObjectDefOf.Settlement); if (this.DestinationTarget == null) { this.ValidateParentSettlement(); WorldUtility.Get_WCPT().UpdateFactionSettlements(WorldUtility.GetRimWarDataForFaction(this.Faction)); FindParentSettlement(); this.DestinationTarget = Find.World.worldObjects.WorldObjectAt(this.ParentSettlement.Tile, WorldObjectDefOf.Settlement); } if (DestinationTarget != null && DestinationTarget.Tile != pather.Destination) { pather.StartPath(DestinationTarget.Tile, true, false); } else { //not heading in the right direction; pause then attempt to reroute pather.StopDead(); } } } }
IEnumerator Wave_Coroutine() { //current wave WaveStruct wave = waveConfig.Waves[CurrentWave]; //foreach enemy in this wave, instantiate but deactivate foreach (Enemy enemy in wave.Enemies) { InstantiateNewEnemy(enemy); yield return(null); } //enemies copy(copy because when enemy is killed, it's removed from list) List <Enemy> enemiesCopy = enemies.CreateCopy(); //queue to not spawn on same face Queue <EFace> facesQueue = new Queue <EFace>(); //for every enemy foreach (Enemy enemy in enemiesCopy) { //randomize coordinates to attack EFace face = WorldUtility.GetRandomFace(facesQueue, waveConfig.Waves[CurrentWave].IgnorePreviousFacesAtSpawn); int x = Random.Range(0, GameManager.instance.world.worldConfig.NumberCells); int y = Random.Range(0, GameManager.instance.world.worldConfig.NumberCells); Coordinates coordinatesToAttack = new Coordinates(face, x, y); //get position and rotation Vector3 position; Quaternion rotation; GameManager.instance.world.GetPositionAndRotation(coordinatesToAttack, waveConfig.Waves[CurrentWave].DistanceFromWorld, out position, out rotation); //set enemy position and rotation, then activate enemy.transform.position = position; enemy.transform.rotation = rotation; //instantiate portal at position and rotation if (GameManager.instance.levelManager.generalConfig.PortalPrefab) { Instantiate(GameManager.instance.levelManager.generalConfig.PortalPrefab, position, rotation); } //set enemy destination and activate enemy.Init(coordinatesToAttack); //wait for next enemy yield return(new WaitForSeconds(wave.TimeBetweenSpawns)); } }
public void ValidateParentSettlement() { if (this.ParentSettlement != null) { RimWorld.Planet.Settlement settlement = Find.World.worldObjects.SettlementAt(this.ParentSettlement.Tile); if (settlement == null || settlement.Faction != this.Faction) { if (WorldUtility.GetRimWarDataForFaction(this.Faction).FactionSettlements.Contains(this.ParentSettlement)) { WorldUtility.GetRimWarDataForFaction(this.Faction).FactionSettlements.Remove(this.ParentSettlement); } this.ParentSettlement = null; } } }
public virtual bool ShouldInteractWith(Caravan car, WarObject rwo) { List <CaravanTargetData> ctdList = WorldUtility.Get_WCPT().GetCaravaTargetData; if (ctdList != null && ctdList.Count > 0) { for (int i = 0; i < ctdList.Count; i++) { if (ctdList[i].caravan == car && ctdList[i].caravanTarget == rwo) { return(car.Faction != null && car.Faction == Faction.OfPlayer); } } } return(false); }