diff --git a/Languages/English/Keyed/Keys.xml b/Languages/English/Keyed/Keys.xml
index 5cee97c..fed95ca 100644
--- a/Languages/English/Keyed/Keys.xml
+++ b/Languages/English/Keyed/Keys.xml
@@ -34,6 +34,10 @@
Fuel consumption multiplier: {0}%
Injector hum volume: {0}%
Enable easter eggs:
+Enable custom pathfinding:
+Beams do damage:
+Performance
+It is highly recommended to disable beam damage if you disable custom pathfinding. Otherwise pawns will walk through deadly laser beams!
Open console
diff --git a/Source/AntimatterAnnihilation/Buildings/Building_AntimatterReactor.cs b/Source/AntimatterAnnihilation/Buildings/Building_AntimatterReactor.cs
index 7f953ff..75e4027 100644
--- a/Source/AntimatterAnnihilation/Buildings/Building_AntimatterReactor.cs
+++ b/Source/AntimatterAnnihilation/Buildings/Building_AntimatterReactor.cs
@@ -272,17 +272,20 @@ public float UpdateOutputBeam(float maxDst)
avoidance.Add((posUpper, AI_AvoidGrid.WEIGHT_ENERGY_BEAM));
bool done = false;
- var pawn = Map.thingGrid.ThingAt(posLower, ThingCategory.Pawn);
- if (pawn != null && !(pawn as Pawn).Downed) // Don't damage downed pawns, because it's too punishing.
+ if (Settings.DoBeamDamage)
{
- done = true;
- tempThings.Add(pawn);
- }
- var pawn2 = Map.thingGrid.ThingAt(posUpper, ThingCategory.Pawn);
- if (pawn2 != null && !(pawn2 as Pawn).Downed)
- {
- done = true;
- tempThings.Add(pawn2);
+ var pawn = Map.thingGrid.ThingAt(posLower, ThingCategory.Pawn);
+ if (pawn != null && !(pawn as Pawn).Downed) // Don't damage downed pawns, because it's too punishing.
+ {
+ done = true;
+ tempThings.Add(pawn);
+ }
+ var pawn2 = Map.thingGrid.ThingAt(posUpper, ThingCategory.Pawn);
+ if (pawn2 != null && !(pawn2 as Pawn).Downed)
+ {
+ done = true;
+ tempThings.Add(pawn2);
+ }
}
if (done)
@@ -315,6 +318,9 @@ public float UpdateOutputBeam(float maxDst)
break;
}
+ if (!Settings.DoBeamDamage)
+ return i;
+
foreach (var thing in tempThings)
{
if (thing.def.defName == "AntimatterReactorPowerConverter_AA")
diff --git a/Source/AntimatterAnnihilation/Buildings/Building_Megumin.cs b/Source/AntimatterAnnihilation/Buildings/Building_Megumin.cs
index 7357511..eec4823 100644
--- a/Source/AntimatterAnnihilation/Buildings/Building_Megumin.cs
+++ b/Source/AntimatterAnnihilation/Buildings/Building_Megumin.cs
@@ -4,10 +4,9 @@
using AntimatterAnnihilation.ThingComps;
using AntimatterAnnihilation.Utils;
using RimWorld;
+using RimWorld.Planet;
using System;
using System.Collections.Generic;
-using System.Linq;
-using RimWorld.Planet;
using UnityEngine;
using Verse;
using Verse.Sound;
diff --git a/Source/AntimatterAnnihilation/Buildings/Building_ReactorInjector.cs b/Source/AntimatterAnnihilation/Buildings/Building_ReactorInjector.cs
index 7dabd90..48dc9f8 100644
--- a/Source/AntimatterAnnihilation/Buildings/Building_ReactorInjector.cs
+++ b/Source/AntimatterAnnihilation/Buildings/Building_ReactorInjector.cs
@@ -339,17 +339,20 @@ public float UpdateDamageAndInjection(float maxDst)
avoidance.Add((posUpper, AI_AvoidGrid.WEIGHT_INJECTOR_BEAM));
bool done = false;
- var pawn = Map.thingGrid.ThingAt(posLower, ThingCategory.Pawn);
- if (pawn != null && !(pawn as Pawn).Downed) // Don't damage downed pawns, because it's too punishing.
+ if (Settings.DoBeamDamage)
{
- done = true;
- tempThings.Add(pawn);
- }
- var pawn2 = Map.thingGrid.ThingAt(posUpper, ThingCategory.Pawn);
- if (pawn2 != null && !(pawn2 as Pawn).Downed)
- {
- done = true;
- tempThings.Add(pawn2);
+ var pawn = Map.thingGrid.ThingAt(posLower, ThingCategory.Pawn);
+ if (pawn != null && !(pawn as Pawn).Downed) // Don't damage downed pawns, because it's too punishing.
+ {
+ done = true;
+ tempThings.Add(pawn);
+ }
+ var pawn2 = Map.thingGrid.ThingAt(posUpper, ThingCategory.Pawn);
+ if (pawn2 != null && !(pawn2 as Pawn).Downed)
+ {
+ done = true;
+ tempThings.Add(pawn2);
+ }
}
if (done)
@@ -427,7 +430,8 @@ public float UpdateDamageAndInjection(float maxDst)
if (thingIsReactor && isInLine)
damage *= 0.05f; // Do much less damage to reactor if lined up with input/output, for situations where the power is cut to the reactor and AT field cannot be formed.
- thing.TakeDamage(new DamageInfo(AADefOf.Annihilate_AA, damage, 15, instigator: this));
+ if(Settings.DoBeamDamage)
+ thing.TakeDamage(new DamageInfo(AADefOf.Annihilate_AA, damage, 15, instigator: this));
}
return i;
diff --git a/Source/AntimatterAnnihilation/Patches/Patch_AvoidGrid.cs b/Source/AntimatterAnnihilation/Patches/Patch_AvoidGrid.cs
index 0374b03..4a2233e 100644
--- a/Source/AntimatterAnnihilation/Patches/Patch_AvoidGrid.cs
+++ b/Source/AntimatterAnnihilation/Patches/Patch_AvoidGrid.cs
@@ -11,7 +11,8 @@ static class Patch_AvoidGrid
[HarmonyPriority(Priority.Last)]
static void Postfix(Pawn p, ref ByteGrid __result)
{
- AI_AvoidGrid.DoAvoidGrid(p, ref __result);
+ if(Settings.EnableCustomPathfinding)
+ AI_AvoidGrid.DoAvoidGrid(p, ref __result);
}
}
}
diff --git a/Source/AntimatterAnnihilation/Settings.cs b/Source/AntimatterAnnihilation/Settings.cs
index b59267e..d0285fa 100644
--- a/Source/AntimatterAnnihilation/Settings.cs
+++ b/Source/AntimatterAnnihilation/Settings.cs
@@ -9,6 +9,8 @@ public class Settings : ModSettings
public static float FuelConsumeRate = 1f;
public static float InjectorHumVolume = 1f;
public static bool EnableEasterEggs = true;
+ public static bool EnableCustomPathfinding = true;
+ public static bool DoBeamDamage = true;
public override void ExposeData()
{
@@ -35,6 +37,16 @@ public static void DoWindow(Rect window)
Widgets.CheckboxLabeled(new Rect(window.x, window.y, 350, 32), "AA.EnableEasterEggs".Translate(), ref EnableEasterEggs, placeCheckboxNearText: true);
MoveDown(32 + 5f);
+ Widgets.CheckboxLabeled(new Rect(window.x, window.y, 350, 32), "AA.BeamsDoDamage".Translate(), ref DoBeamDamage, placeCheckboxNearText: true);
+ MoveDown(32 + 5f);
+
+ Widgets.CheckboxLabeled(new Rect(window.x, window.y, 350, 32), "AA.EnableCustomPathfinding".Translate(), ref EnableCustomPathfinding, placeCheckboxNearText: true);
+ MoveDown(32 + 5f);
+ if (DoBeamDamage && !EnableCustomPathfinding)
+ {
+ DoLabel("" + "AA.BeamWarning".Translate() + "");
+ }
+
void DoLabel(string label)
{
const float HEIGHT = 32;