diff --git a/Languages/English/Keyed/Text.xml b/Languages/English/Keyed/Text.xml
index b46b0ae..086ea97 100644
--- a/Languages/English/Keyed/Text.xml
+++ b/Languages/English/Keyed/Text.xml
@@ -21,6 +21,7 @@
Animals have the same marker
Animals have a different marker
Animals have no marker
+ Include untamed animals
Zoom to mouse
Mouse reveals labels
Left Shift
diff --git a/Languages/German/Keyed/Text.xml b/Languages/German/Keyed/Text.xml
index 0681178..e982343 100644
--- a/Languages/German/Keyed/Text.xml
+++ b/Languages/German/Keyed/Text.xml
@@ -22,6 +22,7 @@
Tiere haben den gleichen Marker
Tiere haben einen anderen Marker
Tiere haben keinen Marker
+ Auch ungezähmte Tiere
Zoom an die Maus
Maus zeigt Labels
Left Shift
diff --git a/Languages/Japanese/Keyed/Text.xml b/Languages/Japanese/Keyed/Text.xml
index 8386c8f..914262d 100644
--- a/Languages/Japanese/Keyed/Text.xml
+++ b/Languages/Japanese/Keyed/Text.xml
@@ -23,6 +23,7 @@
動物は同じマーカーを持っています
動物は別のマーカーを持っています
動物にはマーカーがありません
+ 飼いならされていない動物を含める
マウスポインタにズーム
左Shift
左Alt
diff --git a/Languages/Spanish/Keyed/Text.xml b/Languages/Spanish/Keyed/Text.xml
index 4fd819d..f2de81f 100644
--- a/Languages/Spanish/Keyed/Text.xml
+++ b/Languages/Spanish/Keyed/Text.xml
@@ -22,6 +22,7 @@
Los animales tienen el mismo marcador
Los animales tienen un marcador diferente
Los animales no tienen marcador
+ Incluir animales indómitos
Acercar al mouse
El mouse revela etiquetas
Left Shift
diff --git a/Languages/SpanishLatin/Keyed/Text.xml b/Languages/SpanishLatin/Keyed/Text.xml
index 4fd819d..f2de81f 100644
--- a/Languages/SpanishLatin/Keyed/Text.xml
+++ b/Languages/SpanishLatin/Keyed/Text.xml
@@ -22,6 +22,7 @@
Los animales tienen el mismo marcador
Los animales tienen un marcador diferente
Los animales no tienen marcador
+ Incluir animales indómitos
Acercar al mouse
El mouse revela etiquetas
Left Shift
diff --git a/Source/CameraPlus.csproj b/Source/CameraPlus.csproj
index 1f2b5d7..9617405 100644
--- a/Source/CameraPlus.csproj
+++ b/Source/CameraPlus.csproj
@@ -47,8 +47,8 @@
-
- ..\packages\Lib.Harmony.2.0.0.8\lib\net472\0Harmony.dll
+
+ ..\packages\Lib.Harmony.2.0.1\lib\net472\0Harmony.dll
False
diff --git a/Source/Main.cs b/Source/Main.cs
index 2f38959..a68efa0 100644
--- a/Source/Main.cs
+++ b/Source/Main.cs
@@ -16,7 +16,7 @@ public class CameraPlusMain : Mod
public static float orthographicSize = -1f;
// for other mods: set temporarily to true to skip any hiding
- public static bool renderEverything = false;
+ public static bool skipCustomRendering = false;
public CameraPlusMain(ModContentPack content) : base(content)
{
@@ -38,7 +38,7 @@ public override string SettingsCategory()
}
[HarmonyPatch(typeof(Game))]
- [HarmonyPatch("FinalizeInit")]
+ [HarmonyPatch(nameof(Game.FinalizeInit))]
static class Game_FinalizeInit_Patch
{
static void Postfix()
@@ -48,7 +48,7 @@ static void Postfix()
}
[HarmonyPatch(typeof(CameraDriver))]
- [HarmonyPatch("Update")]
+ [HarmonyPatch(nameof(CameraDriver.Update))]
static class CameraDriver_Update_Patch
{
static readonly MethodInfo m_SetRootSize = SymbolExtensions.GetMethodInfo(() => SetRootSize(null, 0f));
@@ -98,7 +98,7 @@ static IEnumerable Transpiler(IEnumerable inst
}
[HarmonyPatch(typeof(TimeControls))]
- [HarmonyPatch("DoTimeControlsGUI")]
+ [HarmonyPatch(nameof(TimeControls.DoTimeControlsGUI))]
static class TimeControls_DoTimeControlsGUI_Patch
{
static void Prefix()
@@ -119,13 +119,13 @@ static void Postfix(ref Vector2 __result)
}
[HarmonyPatch(typeof(MoteMaker))]
- [HarmonyPatch("ThrowText")]
+ [HarmonyPatch(nameof(MoteMaker.ThrowText))]
[HarmonyPatch(new Type[] { typeof(Vector3), typeof(Map), typeof(string), typeof(Color), typeof(float) })]
static class MoteMaker_ThrowText_Patch
{
static bool Prefix(Vector3 loc)
{
- if (CameraPlusMain.renderEverything)
+ if (CameraPlusMain.skipCustomRendering)
return true;
if (CameraPlusMain.Settings.hideNamesWhenZoomedOut == false)
@@ -143,14 +143,14 @@ static bool Prefix(Vector3 loc)
}
[HarmonyPatch(typeof(PawnRenderer))]
- [HarmonyPatch("RenderPawnAt")]
+ [HarmonyPatch(nameof(PawnRenderer.RenderPawnAt))]
[HarmonyPatch(new Type[] { typeof(Vector3), typeof(RotDrawMode), typeof(bool), typeof(bool) })]
static class PawnRenderer_RenderPawnAt_Patch
{
[HarmonyPriority(10000)]
static bool Prefix(Pawn ___pawn)
{
- if (CameraPlusMain.renderEverything)
+ if (CameraPlusMain.skipCustomRendering)
return true;
var cameraDelegate = Tools.GetCachedCameraDelegate(___pawn);
@@ -173,8 +173,32 @@ static void Postfix(Pawn ___pawn)
}
}
+ [HarmonyPatch(typeof(PawnUIOverlay))]
+ [HarmonyPatch(nameof(PawnUIOverlay.DrawPawnGUIOverlay))]
+ static class PawnUIOverlay_DrawPawnGUIOverlay_Patch
+ {
+ [HarmonyPriority(10000)]
+ public static bool Prefix(Pawn ___pawn)
+ {
+ if (CameraPlusMain.skipCustomRendering)
+ return true;
+
+ if (Tools.IncludeNonTamedAnimals() == false)
+ return true;
+
+ if (!___pawn.Spawned || ___pawn.Map.fogGrid.IsFogged(___pawn.Position))
+ return true;
+ if (___pawn.RaceProps.Humanlike)
+ return true;
+ if (___pawn.Name != null)
+ return true;
+
+ return GenMapUI_DrawPawnLabel_Patch.HandlePawn(___pawn);
+ }
+ }
+
[HarmonyPatch(typeof(GenMapUI))]
- [HarmonyPatch("DrawPawnLabel")]
+ [HarmonyPatch(nameof(GenMapUI.DrawPawnLabel))]
[HarmonyPatch(new Type[] { typeof(Pawn), typeof(Vector2), typeof(float), typeof(float), typeof(Dictionary), typeof(GameFont), typeof(bool), typeof(bool) })]
[StaticConstructorOnStartup]
static class GenMapUI_DrawPawnLabel_Patch
@@ -184,15 +208,8 @@ static class GenMapUI_DrawPawnLabel_Patch
static readonly Color downedColor = new Color(0.9f, 0f, 0f);
static readonly Color draftedColor = new Color(0f, 0.5f, 0f);
- [HarmonyPriority(10000)]
- public static bool Prefix(Pawn pawn, float truncateToWidth)
+ public static bool HandlePawn(Pawn pawn)
{
- if (CameraPlusMain.renderEverything)
- return true;
-
- if (truncateToWidth != 9999f)
- return true; // use label
-
Tools.ShouldShowLabel(pawn.DrawPos, true, out var showLabel, out var showDot);
if (showLabel)
return true;
@@ -233,13 +250,25 @@ public static bool Prefix(Pawn pawn, float truncateToWidth)
// skip label
return false;
}
+
+ [HarmonyPriority(10000)]
+ public static bool Prefix(Pawn pawn, float truncateToWidth)
+ {
+ if (CameraPlusMain.skipCustomRendering)
+ return true;
+
+ if (truncateToWidth != 9999f)
+ return true; // use label
+
+ return HandlePawn(pawn);
+ }
}
// if we zoom in a lot, tiny font labels look very out of place
// so we make them bigger with the available fonts
//
[HarmonyPatch(typeof(GenMapUI))]
- [HarmonyPatch("DrawThingLabel")]
+ [HarmonyPatch(nameof(GenMapUI.DrawThingLabel))]
[HarmonyPatch(new Type[] { typeof(Vector2), typeof(string), typeof(Color) })]
static class GenMapUI_DrawThingLabel_Patch
{
@@ -255,7 +284,7 @@ static GameFont GetAdaptedGameFont(float rootSize)
[HarmonyPriority(10000)]
public static bool Prefix(Vector2 screenPos)
{
- if (CameraPlusMain.renderEverything)
+ if (CameraPlusMain.skipCustomRendering)
return true;
Tools.ShouldShowLabel(screenPos, false, out var showLabel, out _);
@@ -285,7 +314,7 @@ static IEnumerable Transpiler(IEnumerable inst
// map our new camera settings to meaningful enum values
//
[HarmonyPatch(typeof(CameraDriver))]
- [HarmonyPatch("CurrentZoom", MethodType.Getter)]
+ [HarmonyPatch(nameof(CameraDriver.CurrentZoom), MethodType.Getter)]
static class CameraDriver_CurrentZoom_Patch
{
static bool Prefix(ref CameraZoomRange __result, float ___rootSize)
@@ -350,7 +379,7 @@ static IEnumerable Transpiler(IEnumerable inst
// the beginning of this method and replace every "this.rootSize" witn "lerpedRootSize"
//
[HarmonyPatch(typeof(CameraDriver))]
- [HarmonyPatch("CurrentViewRect", MethodType.Getter)]
+ [HarmonyPatch(nameof(CameraDriver.CurrentViewRect), MethodType.Getter)]
static class CameraDriver_CurrentViewRect_Patch
{
static readonly MethodInfo m_Main_LerpRootSize = SymbolExtensions.GetMethodInfo(() => Tools.LerpRootSize(0f));
diff --git a/Source/Settings.cs b/Source/Settings.cs
index cf22723..09ad32f 100644
--- a/Source/Settings.cs
+++ b/Source/Settings.cs
@@ -45,6 +45,7 @@ public class CameraPlusSettings : ModSettings
public int hideThingLabelBelow = 32;
public bool mouseOverShowsLabels = true;
public LabelStyle customNameStyle = LabelStyle.AnimalsDifferent;
+ public bool includeNotTamedAnimals = true;
public KeyCode[] cameraSettingsMod = new[] { KeyCode.LeftShift, KeyCode.None };
public KeyCode cameraSettingsKey = KeyCode.Tab;
@@ -82,6 +83,7 @@ public override void ExposeData()
Scribe_Values.Look(ref hideThingLabelBelow, "hideThingLabelBelow", 32);
Scribe_Values.Look(ref mouseOverShowsLabels, "mouseOverShowsLabels", true);
Scribe_Values.Look(ref customNameStyle, "customNameStyle", LabelStyle.AnimalsDifferent);
+ Scribe_Values.Look(ref includeNotTamedAnimals, "includeNotTamedAnimals", true);
Scribe_Values.Look(ref cameraSettingsMod[0], "cameraSettingsMod1", KeyCode.LeftShift);
Scribe_Values.Look(ref cameraSettingsMod[1], "cameraSettingsMod2", KeyCode.None);
Scribe_Values.Look(ref cameraSettingsKey, "cameraSettingsKey", KeyCode.Tab);
@@ -94,6 +96,12 @@ public override void ExposeData()
{
minRootResult = zoomedInPercent * 2;
maxRootResult = zoomedOutPercent * 2;
+
+ if (includeNotTamedAnimals && Prefs.AnimalNameMode != AnimalNameDisplayMode.TameAll)
+ {
+ Prefs.AnimalNameMode = AnimalNameDisplayMode.TameAll;
+ Prefs.Save();
+ }
}
}
@@ -229,6 +237,13 @@ public void DoWindowContents(Rect inRect)
var val = (LabelStyle)Enum.Parse(typeof(LabelStyle), label);
if (list.RadioButton(label.Translate(), customNameStyle == val, 8f)) customNameStyle = val;
}
+ var oldIncludeNotTamedAnimals = includeNotTamedAnimals;
+ list.CheckboxLabeled("IncludeNotTamedAnimals".Translate(), ref includeNotTamedAnimals);
+ if (oldIncludeNotTamedAnimals == false || includeNotTamedAnimals == true)
+ {
+ Prefs.AnimalNameMode = AnimalNameDisplayMode.TameAll;
+ Prefs.Save();
+ }
}
list.Gap(28f);
@@ -250,6 +265,7 @@ public void DoWindowContents(Rect inRect)
hideThingLabelBelow = 32;
mouseOverShowsLabels = true;
customNameStyle = LabelStyle.AnimalsDifferent;
+ includeNotTamedAnimals = true;
cameraSettingsMod[0] = KeyCode.LeftShift;
cameraSettingsMod[1] = KeyCode.None;
cameraSettingsKey = KeyCode.Tab;
diff --git a/Source/Tools.cs b/Source/Tools.cs
index 3233058..63a1bc1 100644
--- a/Source/Tools.cs
+++ b/Source/Tools.cs
@@ -142,6 +142,11 @@ class Tools : CameraPlusSettings
return color;
}
+ public static bool IncludeNonTamedAnimals()
+ {
+ return CameraPlusMain.Settings.includeNotTamedAnimals && Prefs.AnimalNameMode == AnimalNameDisplayMode.TameAll;
+ }
+
// shameless copy of vanilla
public static bool PawnHasNoLabel(Pawn pawn)
{
@@ -149,6 +154,9 @@ public static bool PawnHasNoLabel(Pawn pawn)
return true;
if (!pawn.RaceProps.Humanlike)
{
+ if (IncludeNonTamedAnimals())
+ return false;
+
var animalNameMode = Prefs.AnimalNameMode;
if (animalNameMode == AnimalNameDisplayMode.None)
return true;
@@ -241,6 +249,7 @@ public static CameraDelegates GetCachedCameraDelegate(Pawn pawn)
}
// returning true will prefer markers over labels
+ static readonly Color dangerousAnimalColor = new Color(0.62f, 0f, 0.05f);
public static bool GetMarkerColors(Pawn pawn, out Color innerColor, out Color outerColor)
{
var cameraDelegate = GetCachedCameraDelegate(pawn);
@@ -269,7 +278,11 @@ public static bool GetMarkerColors(Pawn pawn, out Color innerColor, out Color ou
innerColor = PawnNameColorUtility.PawnNameColorOf(pawn);
if (pawn.RaceProps.Animal)
- innerColor = GetMainColor(pawn) ?? innerColor;
+ {
+ var stateDef = pawn.mindState.mentalStateHandler.CurStateDef;
+ var isDangerous = stateDef == MentalStateDefOf.ManhunterPermanent || stateDef == MentalStateDefOf.Manhunter;
+ innerColor = isDangerous ? dangerousAnimalColor : (GetMainColor(pawn) ?? innerColor);
+ }
outerColor = Find.Selector.IsSelected(pawn) ? Color.black : Color.white;
return true;
}
diff --git a/Source/packages.config b/Source/packages.config
index c1dc9e9..0ab5df8 100644
--- a/Source/packages.config
+++ b/Source/packages.config
@@ -1,4 +1,4 @@
-
+
\ No newline at end of file
diff --git a/v1.1/Assemblies/CameraPlus.dll b/v1.1/Assemblies/CameraPlus.dll
index 312f32f..9b489de 100644
Binary files a/v1.1/Assemblies/CameraPlus.dll and b/v1.1/Assemblies/CameraPlus.dll differ