static void Prefix(LordJob_FormAndSendCaravan __instance) { if (VesselManager.CaravanJobIsForVessel(__instance)) { VesselManager.ActivateVesselForming(__instance); } }
static void Postfix(LordJob_FormAndSendCaravan __instance) { if (VesselManager.FormVessel) { VesselManager.DeactivateVesselForming(__instance); } }
static void Postfix(LordJob_FormAndSendCaravan __instance) { if (EmbarkShipUtility.EmbarkUIActive) { VesselManager.AddVesselEmbark(__instance, EmbarkShipUtility.FindShipyardInMap(((MapParent)Find.WorldSelector.SingleSelectedObject).Map)); } }
static bool Prefix(WorldObject o) { if (VesselManager.WorldObjectIsNavigator(o) && VesselManager.FormVessel) { return(false); } return(true); }
static void Postfix(ref bool __result, Caravan __instance) { if (!VesselManager.WorldObjectIsNavigator(__instance)) { return; } __result = false; }
static bool Prefix(ref int __result, Caravan caravan, int start, int end, int?ticksAbs = null) { if (!VesselManager.WorldObjectIsNavigator(caravan)) { return(true); } int caravanTicksPerMove = caravan.TicksPerMove; bool perceivedStatic = false; StringBuilder explanation = null; string caravanTicksPerMoveExplanation = null; if (start == end) { __result = 0; } if (explanation != null) { explanation.Append(caravanTicksPerMoveExplanation); explanation.AppendLine(); } StringBuilder explanation1 = explanation == null ? (StringBuilder)null : new StringBuilder(); float num1 = !perceivedStatic || explanation != null?WorldPathGrid.CalculatedMovementDifficultyAt(end, perceivedStatic, ticksAbs, explanation1) : Find.WorldPathGrid.PerceivedMovementDifficultyAt(end); //float difficultyMultiplier = Find.WorldGrid.GetRoadMovementDifficultyMultiplier(start, end, explanation1); float difficultyMultiplier = 0; if (explanation != null) { explanation.AppendLine(); explanation.Append("TileMovementDifficulty".Translate() + ":"); explanation.AppendLine(); explanation.Append(explanation1.ToString().Indented(" ")); explanation.AppendLine(); explanation.Append(" = " + (num1 * difficultyMultiplier).ToString("0.#")); } int num2 = Mathf.Clamp((int)((double)caravanTicksPerMove * (double)num1 * (double)difficultyMultiplier), 1, 30000); if (explanation != null) { explanation.AppendLine(); explanation.AppendLine(); explanation.Append("FinalCaravanMovementSpeed".Translate() + ":"); int num3 = Mathf.CeilToInt((float)num2 / 1f); explanation.AppendLine(); explanation.Append(" " + (60000f / (float)caravanTicksPerMove).ToString("0.#") + " / " + (num1 * difficultyMultiplier).ToString("0.#") + " = " + (60000f / (float)num3).ToString("0.#") + " " + "TilesPerDay".Translate()); } __result = num2; return(false); }
static bool Prefix(ref bool __result, int tile) { WorldObject selected = Find.WorldSelector.SingleSelectedObject; if (selected == null || EmbarkShipUtility.EmbarkUIActive) { __result = true; return(false); } if (!VesselManager.WorldObjectIsNavigator(selected)) { return(true); } if (!Find.WorldGrid.InBounds(tile)) { __result = false; return(false); } __result = Find.WorldGrid[tile].biome.defName == "Ocean"; return(false); }
static bool Prefix(Caravan caravan, ref Vector3 __result) { if (!VesselManager.WorldObjectIsNavigator(caravan)) { return(true); } WorldGrid worldGrid = Find.WorldGrid; if (!caravan.Spawned) { __result = worldGrid.GetTileCenter(caravan.Tile); return(false); } if (!caravan.pather.Moving) { __result = worldGrid.GetTileCenter(caravan.Tile); return(false); } float num = worldGrid[caravan.pather.nextTile].biome.defName.Equals("Ocean") ? (float)(1.0 - (double)caravan.pather.nextTileCostLeft / (double)caravan.pather.nextTileCostTotal) : 0.0f; int tileID = caravan.pather.nextTile != caravan.Tile || caravan.pather.previousTileForDrawingIfInDoubt == -1 ? caravan.Tile : caravan.pather.previousTileForDrawingIfInDoubt; __result = worldGrid.GetTileCenter(caravan.pather.nextTile) * num + worldGrid.GetTileCenter(tileID) * (1f - num); return(false); }