private static void Debug_DoStrike(int count) { if (debug_FirstPoint == null) { debug_FirstPoint = UI.MouseCell(); Messages.Message("First point selected, select second point.", MessageTypeDefOf.NeutralEvent); MoteAt(debug_FirstPoint.Value); } else { var bomb = CECompat.IsCEActive ? CECompat.GetProjectile(RFDefOf.Shell_HighExplosive) : RFDefOf.Shell_HighExplosive.projectileWhenLoaded; DoStrike(null, bomb, debug_FirstPoint.Value, UI.MouseCell(), count); debug_FirstPoint = null; } }
public override void DrawExtraSelectionOverlays() { base.DrawExtraSelectionOverlays(); tempCells.Clear(); tempCells2.Clear(); foreach (var cell in GetLaunchCells()) { tempCells2.Add(cell); if (IsCellBlocked(cell, out _)) { tempCells.Add(cell); } } if (tempCells.Count > 0) { GenDraw.DrawFieldEdges(tempCells2, Color.white); GenDraw.DrawFieldEdges(tempCells, Color.red); } if (!drawAffectedCells) { return; } float radius; if (CECompat.IsCEActive) { radius = CECompat.GetExplosionRadius(CurrentShellDef); } else { radius = CurrentShellDef?.projectileWhenLoaded?.projectile?.explosionRadius ?? -1; } if (firstPosition == null || secondPosition == null) { if (firstPosition != null && LoadedShellCount == 1) { GenAirstrike.DrawStrikePreview(firstPosition.Value, firstPosition.Value, Map, 1, radius); } return; } GenAirstrike.DrawStrikePreview(firstPosition.Value, secondPosition.Value, Map, LoadedShellCount, radius); }
internal static void DoLoadLate() { Core.Log("Doing late load..."); // Necessary to let the game know that we actually have settings to save and load. Core.Instance.GetSettings <Settings>(); // Toggle ore generation. if (!Settings.GenerateCopper) { var def = RFDefOf.RF_MineableCopper; def.building.mineableScatterCommonality = 0f; } if (!Settings.GenerateTin) { var def = RFDefOf.RF_MineableTin; def.building.mineableScatterCommonality = 0f; } if (CECompat.IsCEActive) { try { var original = AccessTools.Method("CombatExtended.CompSuppressable:AddSuppression"); var patchRaw = AccessTools.Method(typeof(Patch_CompSuppressable_AddSuppression), nameof(Patch_CompSuppressable_AddSuppression.Prefix)); var patch = new HarmonyMethod(patchRaw); Core.Instance.HarmonyInstance.Patch(original, prefix: patch); } catch (Exception e) { Core.Error("Failed to patch CombatExtended suppression:", e); } foreach (var item in CECompat.GetCEMortarShells()) { Building_DroneLauncher.LoadableBombs.Add(item); } } }
public void DoStrike() { bool isAntimatter = CurrentShellDef == ThingDefOf.Shell_AntigrainWarhead; if (isAntimatter) { GenericEventTracker.Fire(AchievementEvent.DroneAntimatter); if (LoadedShellCount >= MaxLoadedShellCount) { GenericEventTracker.Fire(AchievementEvent.DroneAntimatterFull); } } GenAirstrike.DoStrike(this, CECompat.IsCEActive ? CECompat.GetProjectile(CurrentShellDef) : CurrentShellDef.projectileWhenLoaded, firstPosition.Value, secondPosition.Value, LoadedShellCount, 200, RFDefOf.RF_Sound_Drone); ClearLoadedShells(); isFlying = true; ticksFlying = 0; SoundInfo info = SoundInfo.InMap(this); RFDefOf.RF_Sound_DroneLaunch.PlayOneShot(info); }