public void FactionManagerTick() { SettlementProximityGoodwillUtility.CheckSettlementProximityGoodwillChange(); for (int i = 0; i < this.allFactions.Count; i++) { this.allFactions[i].FactionTick(); } }
protected override void DoNext() { int selTile = Find.WorldInterface.SelectedTile; SettlementProximityGoodwillUtility.CheckConfirmSettle(selTile, delegate { Find.GameInitData.startingTile = selTile; this.< DoNext > __BaseCallProxy0(); });
static bool Prefix() { if (Find.TickManager.TicksGame == 0 || Find.TickManager.TicksGame % 900000 > RefcellRespeedConfig.currentTimeMultiplier - 1) { return(false); } List <Settlement> settlements = Find.WorldObjects.Settlements; SettlementProximityGoodwillUtility.tmpGoodwillOffsets.Clear(); for (int index = 0; index < settlements.Count; ++index) { Settlement settlement = settlements[index]; if (settlement.Faction == Faction.OfPlayer) { SettlementProximityGoodwillUtility.AppendProximityGoodwillOffsets(settlement.Tile, SettlementProximityGoodwillUtility.tmpGoodwillOffsets, true, false); } } if (!SettlementProximityGoodwillUtility.tmpGoodwillOffsets.Any <Pair <Settlement, int> >()) { return(false); } SettlementProximityGoodwillUtility.SortProximityGoodwillOffsets(SettlementProximityGoodwillUtility.tmpGoodwillOffsets); List <Faction> factionsListForReading = Find.FactionManager.AllFactionsListForReading; bool flag = false; TaggedString text = "LetterFactionBaseProximity".Translate() + "\n\n" + SettlementProximityGoodwillUtility.ProximityGoodwillOffsetsToString(SettlementProximityGoodwillUtility.tmpGoodwillOffsets); for (int index1 = 0; index1 < factionsListForReading.Count; ++index1) { Faction faction = factionsListForReading[index1]; if (faction != Faction.OfPlayer) { int goodwillChange = 0; for (int index2 = 0; index2 < SettlementProximityGoodwillUtility.tmpGoodwillOffsets.Count; ++index2) { if (SettlementProximityGoodwillUtility.tmpGoodwillOffsets[index2].First.Faction == faction) { goodwillChange += SettlementProximityGoodwillUtility.tmpGoodwillOffsets[index2].Second; } } FactionRelationKind playerRelationKind = faction.PlayerRelationKind; if (faction.TryAffectGoodwillWith(Faction.OfPlayer, goodwillChange, false, false)) { flag = true; faction.TryAppendRelationKindChangedInfo(ref text, playerRelationKind, faction.PlayerRelationKind); } } } if (!flag) { return(false); } Find.LetterStack.ReceiveLetter((string)"LetterLabelFactionBaseProximity".Translate(), (string)text, LetterDefOf.NegativeEvent); return(false); }
public void FactionManagerTick() { SettlementProximityGoodwillUtility.CheckSettlementProximityGoodwillChange(); for (int i = 0; i < allFactions.Count; i++) { allFactions[i].FactionTick(); } for (int num = toRemove.Count - 1; num >= 0; num--) { Faction faction = toRemove[num]; toRemove.Remove(faction); Remove(faction); Find.QuestManager.Notify_FactionRemoved(faction); } }
public static bool FactionManagerTick(FactionManager __instance) { SettlementProximityGoodwillUtility.CheckSettlementProximityGoodwillChange(); RimThreaded.allFactions = allFactions(__instance); RimThreaded.allFactionsTicks = allFactions(__instance).Count; for (int num = toRemove(__instance).Count - 1; num >= 0; num--) { Faction faction = toRemove(__instance)[num]; toRemove(__instance).Remove(faction); Remove2(__instance, faction); Find.QuestManager.Notify_FactionRemoved(faction); } return(false); }
public static bool FactionManagerTick(FactionManager __instance) { SettlementProximityGoodwillUtility.CheckSettlementProximityGoodwillChange(); allFactionsTickList = __instance.allFactions; allFactionsTicks = allFactionsTickList.Count; lock (__instance) { List <Faction> newList = __instance.toRemove; for (int num = newList.Count - 1; num >= 0; num--) { Faction faction = newList[num]; newList.Remove(faction); __instance.toRemove = newList; __instance.Remove(faction); Find.QuestManager.Notify_FactionRemoved(faction); } } return(false); }
public override IEnumerable <Gizmo> GetGizmos() { foreach (Gizmo gizmo in base.GetGizmos()) { yield return(gizmo); } if (IsPlayerControlled) { if (vehicle.CompFueledTravel != null) { yield return(vehicle.CompFueledTravel.FuelCountGizmo); foreach (Gizmo fuelGizmo in vehicle.CompFueledTravel.DevModeGizmos()) { yield return(fuelGizmo); } } if (!vehicle.CompVehicleLauncher.inFlight && Find.WorldObjects.SettlementAt(Tile) is Settlement settlement2) { yield return(GizmoHelper.AerialVehicleTradeCommand(this, settlement2.Faction, settlement2.TraderKind)); } if (vehicle.CompVehicleLauncher.ControlInFlight || !vehicle.CompVehicleLauncher.inFlight) { Command_Action launchCommand = new Command_Action() { defaultLabel = "CommandLaunchGroup".Translate(), defaultDesc = "CommandLaunchGroupDesc".Translate(), icon = VehicleTex.LaunchCommandTex, alsoClickIfOtherInGroupClicked = false, action = delegate() { LaunchTargeter.Instance.BeginTargeting(vehicle, new Func <GlobalTargetInfo, float, bool>(ChoseTargetOnMap), this, true, VehicleTex.TargeterMouseAttachment, false, null, (GlobalTargetInfo target, List <FlightNode> path, float fuelCost) => vehicle.CompVehicleLauncher.launchProtocol.TargetingLabelGetter(target, Tile, path, fuelCost)); } }; if (vehicle.CompFueledTravel.EmptyTank) { launchCommand.Disable("VehicleLaunchOutOfFuel".Translate()); } yield return(launchCommand); } if (!vehicle.CompVehicleLauncher.inFlight) { foreach (Settlement settlement in Find.WorldObjects.ObjectsAt(flightPath.First.tile).Where(o => o is Settlement).Cast <Settlement>()) { yield return(GizmoHelper.ShuttleTradeCommand(this, settlement)); if (WorldHelper.CanOfferGiftsTo(this, settlement)) { yield return(new Command_Action { defaultLabel = "CommandOfferGifts".Translate(), defaultDesc = "CommandOfferGiftsDesc".Translate(), icon = VehicleTex.OfferGiftsCommandTex, action = delegate() { Pawn playerNegotiator = WorldHelper.FindBestNegotiator(vehicle, null, null); Find.WindowStack.Add(new Dialog_Trade(playerNegotiator, settlement, true)); } }); } } Command_Settle commandSettle = new Command_Settle { defaultLabel = "CommandSettle".Translate(), defaultDesc = "CommandSettleDesc".Translate(), icon = SettleUtility.SettleCommandTex, action = delegate() { SoundDefOf.Tick_High.PlayOneShotOnCamera(null); void settleHere() { SettlementVehicleUtility.Settle(this); }; SettlementProximityGoodwillUtility.CheckConfirmSettle(Tile, settleHere); } }; if (!TileFinder.IsValidTileForNewSettlement(Tile, tmpSettleFailReason)) { commandSettle.Disable(tmpSettleFailReason.ToString()); } else if (SettleUtility.PlayerSettlementsCountLimitReached) { if (Prefs.MaxNumberOfPlayerSettlements > 1) { commandSettle.Disable("CommandSettleFailReachedMaximumNumberOfBases".Translate()); } else { commandSettle.Disable("CommandSettleFailAlreadyHaveBase".Translate()); } } yield return(commandSettle); } if (Prefs.DevMode) { yield return(new Command_Action { defaultLabel = "Debug: Land at Nearest Player Settlement", action = delegate() { List <Settlement> playerSettlements = Find.WorldObjects.Settlements.Where(s => s.Faction == Faction.OfPlayer).ToList(); Settlement nearestSettlement = playerSettlements.MinBy(s => Ext_Math.SphericalDistance(s.DrawPos, DrawPos)); LaunchProtocol launchProtocol = vehicle.CompVehicleLauncher.launchProtocol; Rot4 vehicleRotation = launchProtocol.landingProperties.forcedRotation ?? Rot4.Random; IntVec3 cell = CellFinderExtended.RandomCenterCell(nearestSettlement.Map, (IntVec3 cell) => !MapHelper.VehicleBlockedInPosition(vehicle, Current.Game.CurrentMap, cell, vehicleRotation)); VehicleSkyfaller_Arriving skyfaller = (VehicleSkyfaller_Arriving)ThingMaker.MakeThing(vehicle.CompVehicleLauncher.Props.skyfallerIncoming); skyfaller.vehicle = vehicle; GenSpawn.Spawn(skyfaller, cell, nearestSettlement.Map, vehicleRotation); Destroy(); } }); yield return(new Command_Action { defaultLabel = "Debug: Initiate Crash Event", action = delegate() { InitiateCrashEvent(null); } }); } } }