Skip to content

Commit

Permalink
v3.0.1 fixes corpses disappear (configurable now) and an index error
Browse files Browse the repository at this point in the history
  • Loading branch information
pardeike committed May 12, 2024
1 parent 943e279 commit 7e459ca
Show file tree
Hide file tree
Showing 16 changed files with 49 additions and 15 deletions.
Binary file modified 1.5/Assemblies/CameraPlus.dll
Binary file not shown.
2 changes: 1 addition & 1 deletion About/About.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
</li>
</modDependencies>
<packageId>brrainz.cameraplus</packageId>
<modVersion>3.0.0.0</modVersion>
<modVersion>3.0.1.0</modVersion>
<steamAppId>867467808</steamAppId>
<url>https://github.com/pardeike/CameraPlus</url>
<description>You want more zoom and different paning?
Expand Down
2 changes: 1 addition & 1 deletion About/Manifest.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Manifest>
<identifier>net.pardeike.rimworld.mod.cameraplus</identifier>
<version>3.0.0.0</version>
<version>3.0.1.0</version>
<targetVersions>
<li>1.0.0</li>
<li>1.1.0</li>
Expand Down
14 changes: 7 additions & 7 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<Project>
<PropertyGroup>
<ModName>Camera+</ModName>
<ModFileName>CameraPlus</ModFileName>
<Repository>https://github.com/pardeike/CameraPlus</Repository>
<ModVersion>3.0.0.0</ModVersion>
<ProjectGuid>{AC5EE7A1-16EA-498D-B21A-83ACF78F0E5A}</ProjectGuid>
</PropertyGroup>
<PropertyGroup>
<ModName>Camera+</ModName>
<ModFileName>CameraPlus</ModFileName>
<Repository>https://github.com/pardeike/CameraPlus</Repository>
<ModVersion>3.0.1.0</ModVersion>
<ProjectGuid>{AC5EE7A1-16EA-498D-B21A-83ACF78F0E5A}</ProjectGuid>
</PropertyGroup>
</Project>
1 change: 1 addition & 0 deletions Languages/ChineseSimplified/Keyed/Text.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
<Pixel>像素</Pixel>
<HidePawnLabelBelow>隐藏的小人标签:</HidePawnLabelBelow>
<HideThingLabelBelow>隐藏的堆叠标签:</HideThingLabelBelow>
<HideDeadPawnsBelow>隐藏下方的死亡棋子: </HideDeadPawnsBelow>
<ShowMarkerBelow>显示的标记:</ShowMarkerBelow>
<DotStyle>点样式</DotStyle>
<VanillaDefault>原版默认</VanillaDefault>
Expand Down
1 change: 1 addition & 0 deletions Languages/ChineseTraditional/Keyed/Text.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
<Pixel>像素</Pixel>
<HidePawnLabelBelow>隱藏的小人標籤:</HidePawnLabelBelow>
<HideThingLabelBelow>隱藏的堆疊標籤:</HideThingLabelBelow>
<HideDeadPawnsBelow>隱藏下方的死亡棋子: </HideDeadPawnsBelow>
<ShowMarkerBelow>顯示的標記:</ShowMarkerBelow>
<DotStyle>點樣式</DotStyle>
<VanillaDefault>原版默認</VanillaDefault>
Expand Down
1 change: 1 addition & 0 deletions Languages/English/Keyed/Text.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
<Pixel>Pixel</Pixel>
<HidePawnLabelBelow>Hide pawn labels below: </HidePawnLabelBelow>
<HideThingLabelBelow>Hide stack labels below: </HideThingLabelBelow>
<HideDeadPawnsBelow>Hide dead pawns below: </HideDeadPawnsBelow>
<ShowMarkerBelow>Show as marker below: </ShowMarkerBelow>
<DotStyle>Dot Style</DotStyle>
<VanillaDefault>Vanilla default</VanillaDefault>
Expand Down
1 change: 1 addition & 0 deletions Languages/French/Keyed/Text.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
<Pixel>Pixel</Pixel>
<HidePawnLabelBelow>Masquer les étiquettes de personnages ci-dessous: </HidePawnLabelBelow>
<HideThingLabelBelow>Masquer les étiquettes de stockage ci-dessous: </HideThingLabelBelow>
<HideDeadPawnsBelow>Masquer les pions morts ci-dessous : </HideDeadPawnsBelow>
<ShowMarkerBelow>Afficher comme marqueur ci-dessous: </ShowMarkerBelow>
<DotStyle>Style de point</DotStyle>
<VanillaDefault>Défaut vanille</VanillaDefault>
Expand Down
1 change: 1 addition & 0 deletions Languages/German/Keyed/Text.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
<Pixel>Pixel</Pixel>
<HidePawnLabelBelow>Labels von Spielfiguren verstecken, wenn kleiner als: </HidePawnLabelBelow>
<HideThingLabelBelow>Labels von Objekten verstecken, wenn kleiner als: </HideThingLabelBelow>
<HideDeadPawnsBelow>Verstecke tote Spielfiguren unten: </HideDeadPawnsBelow>
<ShowMarkerBelow>Spielfiguren als Marker darstellen, wenn kleiner als: </ShowMarkerBelow>
<DotStyle>Punktstil</DotStyle>
<VanillaDefault>Vanilla-Standard</VanillaDefault>
Expand Down
1 change: 1 addition & 0 deletions Languages/Japanese/Keyed/Text.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
<Pixel>ピクセル</Pixel>
<HidePawnLabelBelow>以下にポーン名を非表示にします: </HidePawnLabelBelow>
<HideThingLabelBelow>以下にモノのラベルを非表示にします: </HideThingLabelBelow>
<HideDeadPawnsBelow>以下の死んだポーンを隠す: </HideDeadPawnsBelow>
<ShowMarkerBelow>マーカーとして表示: </ShowMarkerBelow>
<DotStyle>ドットスタイル</DotStyle>
<VanillaDefault>バニラデフォルト</VanillaDefault>
Expand Down
1 change: 1 addition & 0 deletions Languages/Russian/Keyed/Text.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
<Pixel>Пиксель</Pixel>
<HidePawnLabelBelow>Скрыть метки пешек ниже:</HidePawnLabelBelow>
<HideThingLabelBelow>Скрыть метки стека ниже:</HideThingLabelBelow>
<HideDeadPawnsBelow>Скрыть мертвые пешки ниже: </HideDeadPawnsBelow>
<ShowMarkerBelow>Показать как маркер ниже:</ShowMarkerBelow>
<DotStyle>Стиль точек</DotStyle>
<VanillaDefault>Стандарт Vanilla</VanillaDefault>
Expand Down
1 change: 1 addition & 0 deletions Languages/Spanish/Keyed/Text.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
<Pixel>Píxel</Pixel>
<HidePawnLabelBelow>Ocultar las etiquetas de los peones a continuación: </HidePawnLabelBelow>
<HideThingLabelBelow>Ocultar cosa etiquetas a continuación: </HideThingLabelBelow>
<HideDeadPawnsBelow>Ocultar peones muertos debajo: </HideDeadPawnsBelow>
<ShowMarkerBelow>Mostrar como círculo a continuación: </ShowMarkerBelow>
<DotStyle>Estilo de punto</DotStyle>
<VanillaDefault>Por defecto de vainilla</VanillaDefault>
Expand Down
1 change: 1 addition & 0 deletions Languages/SpanishLatin/Keyed/Text.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
<Pixel>Píxel</Pixel>
<HidePawnLabelBelow>Ocultar las etiquetas de los peones a continuación: </HidePawnLabelBelow>
<HideThingLabelBelow>Ocultar cosa etiquetas a continuación: </HideThingLabelBelow>
<HideDeadPawnsBelow>Ocultar peones muertos debajo: </HideDeadPawnsBelow>
<ShowMarkerBelow>Mostrar como círculo a continuación: </ShowMarkerBelow>
<DotStyle>Estilo de punto</DotStyle>
<VanillaDefault>Por defecto de vainilla</VanillaDefault>
Expand Down
19 changes: 19 additions & 0 deletions Source/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,10 @@ public static bool Prefix(Pawn ___pawn)
{
if (skipCustomRendering)
return true;

if (___pawn.Dead)
return FastUI.CurUICellSize > Settings.hideDeadPawnsBelow;

return Tools.ShouldShowMarker(___pawn, true) == false;
}
}
Expand All @@ -145,6 +149,18 @@ public static bool Prefix(object obj)
}
}

[HarmonyPatch(typeof(OverlayDrawer), nameof(OverlayDrawer.RenderForbiddenOverlay))]
static class DrawAllOverlaysPatch
{
[HarmonyPriority(10000)]
public static bool Prefix(Thing t)
{
if (t is not Corpse)
return true;
return FastUI.CurUICellSize > Settings.hideDeadPawnsBelow;
}
}

[HarmonyPatch(typeof(PawnUIOverlay), nameof(PawnUIOverlay.DrawPawnGUIOverlay))]
static class PawnUIOverlay_DrawPawnGUIOverlay_Patch
{
Expand All @@ -154,6 +170,9 @@ public static bool Prefix(Pawn ___pawn)
if (skipCustomRendering)
return true;

if (___pawn.Dead)
return FastUI.CurUICellSize > Settings.hideDeadPawnsBelow;

if (Tools.GetMarkerColors(___pawn, out _, out _) == false)
return true;

Expand Down
11 changes: 6 additions & 5 deletions Source/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public class CameraPlusSettings : ModSettings
public int dotSize = 9;
public int hidePawnLabelBelow = 9;
public int hideThingLabelBelow = 32;
public int hideDeadPawnsBelow = 9;
public bool mouseOverShowsLabels = true;
public bool edgeIndicators = true;
public LabelStyle customNameStyle = LabelStyle.AnimalsDifferent;
Expand Down Expand Up @@ -86,6 +87,7 @@ public override void ExposeData()
Scribe_Values.Look(ref dotSize, "dotSize", defaults.dotSize);
Scribe_Values.Look(ref hidePawnLabelBelow, "hidePawnLabelBelow", defaults.hidePawnLabelBelow);
Scribe_Values.Look(ref hideThingLabelBelow, "hideThingLabelBelow", defaults.hideThingLabelBelow);
Scribe_Values.Look(ref hideDeadPawnsBelow, "hideDeadPawnsBelow", defaults.hideDeadPawnsBelow);
Scribe_Values.Look(ref mouseOverShowsLabels, "mouseOverShowsLabels", defaults.mouseOverShowsLabels);
Scribe_Values.Look(ref edgeIndicators, "edgeIndicators", defaults.edgeIndicators);
Scribe_Values.Look(ref customNameStyle, "customNameStyle", defaults.customNameStyle);
Expand Down Expand Up @@ -225,11 +227,10 @@ public void DoWindowContents(Rect inRect)
list.Gap(4f);

var pixel = "Pixel".Translate();
var label1 = "HidePawnLabelBelow".Translate();
list.Slider(ref hidePawnLabelBelow, 0, 128, () => label1 + (hidePawnLabelBelow == 0 ? "Never".Translate() : hidePawnLabelBelow + " " + pixel));
var label2 = "HideThingLabelBelow".Translate();
list.Slider(ref hideThingLabelBelow, 0, 128, () => label2 + (hideThingLabelBelow == 0 ? "Never".Translate() : hideThingLabelBelow + " " + pixel));
list.Slider(ref dotSize, 1, 32, () => "ShowMarkerBelow".Translate() + dotSize + " " + "Pixel".Translate());
list.Slider(ref hidePawnLabelBelow, 0, 64, () => "HidePawnLabelBelow".Translate() + (hidePawnLabelBelow == 0 ? "Never".Translate() : hidePawnLabelBelow + " " + pixel));
list.Slider(ref hideThingLabelBelow, 0, 64, () => "HideThingLabelBelow".Translate() + (hideThingLabelBelow == 0 ? "Never".Translate() : hideThingLabelBelow + " " + pixel));
list.Slider(ref hideDeadPawnsBelow, 0, 64, () => "HideDeadPawnsBelow".Translate() + (hideDeadPawnsBelow == 0 ? "Never".Translate() : hideDeadPawnsBelow + " " + pixel));
list.Slider(ref dotSize, 1, 64, () => "ShowMarkerBelow".Translate() + dotSize + " " + "Pixel".Translate());

list.Gap(12f);

Expand Down
7 changes: 6 additions & 1 deletion Source/Tools.cs
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,14 @@ public static Color GetMainColor(Pawn pawn)
.OrderByDescending(group => group.Count())
.Select(group => (color: group.Key, hsl: HSL(group.Key), count: group.Count()))
.ToArray();
if (combinedColors.Length == 0)
{
color = Color.clear;
goto SET_COLOR;
}

var colorIndex = combinedColors.FirstIndexOf(tuple => tuple.hsl.s > 0.2 && tuple.hsl.l < 0.8 && tuple.hsl.l > 0.2);
if (colorIndex == 1 && combinedColors[0].hsl.s < 0.2)
if (combinedColors.Length > 0 && colorIndex == 1 && combinedColors[0].hsl.s < 0.2)
color = combinedColors[1].color;
else
color = combinedColors[0].color;
Expand Down

0 comments on commit 7e459ca

Please sign in to comment.