Skip to content

Commit

Permalink
Added separate setting to show hands when crawling. Hand positions wh…
Browse files Browse the repository at this point in the history
…en crawling are now more fitting and have a crawling motion.

Used DeepL to update translations for ChineseSimplified, French, German, Russian
  • Loading branch information
emipa606 committed Sep 23, 2024
1 parent 98cf46f commit daec15b
Show file tree
Hide file tree
Showing 14 changed files with 112 additions and 15 deletions.
Binary file modified 1.5/Assemblies/ShowMeYourHands.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 @@ -91,5 +91,5 @@ Since modding is just a hobby for me I expect no donations to keep modding. If y
[/list]

[url=https://steamcommunity.com/sharedfiles/filedetails/changelog/2475965842][img]https://img.shields.io/github/v/release/emipa606/ShowMeYourHands?label=latest%20version&amp;style=plastic&amp;labelColor=0070cd&amp;color=white[/img][/url]</description>
<modVersion IgnoreIfNoMatchingField="True">1.5.10</modVersion>
<modVersion IgnoreIfNoMatchingField="True">1.5.11</modVersion>
</ModMetaData>
4 changes: 4 additions & 0 deletions About/Changelog.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog for ShowMeYourHands

1.5.11 - Added separate setting to show hands when crawling. Hand positions when crawling are now more fitting and have a crawling motion.
Used DeepL to update translations for ChineseSimplified, French, German, Russian


1.5.10 - Added some handpositions via NyamiFan3. Added rotation-values for all vanilla weapons. Fixed hand-rotation when pawn is facing west.


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>ShowMeYourHands</identifier>
<version>1.5.10</version>
<version>1.5.11</version>
<dependencies />
<incompatibleWith />
<loadBefore />
Expand Down
2 changes: 1 addition & 1 deletion About/ModSync.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<ModSyncNinjaData>
<ID>a5b440f3-8aa2-46ee-8a29-29561bb7087a</ID>
<ModName>Show Me Your Hands</ModName>
<Version>1.5.10</Version>
<Version>1.5.11</Version>
<SaveBreaking>False</SaveBreaking>
<Host name="Github">
<Owner>emipa606</Owner>
Expand Down
2 changes: 2 additions & 0 deletions Languages/ChineseSimplified/Keyed/Mod_Settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,6 @@
<SMYH.offhandrotation.label>离手旋转</SMYH.offhandrotation.label>
<SMYH.degree>{0}°</SMYH.degree>
<SMYH.rotate>使用滚轮旋转指针,按住 SHIFT 键可加快旋转速度</SMYH.rotate>
<SMYH.showcrawling.label>爬行时举手</SMYH.showcrawling.label>
<SMYH.showcrawling.tooltip>当小卒被击倒并爬起时,会举手示意</SMYH.showcrawling.tooltip>
</LanguageData>
2 changes: 2 additions & 0 deletions Languages/English/Keyed/Mod_Settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
<SMYH.matchhandamounts.tooltip>If the pawn is missing a hand, it will only show the main-hand on two-handed weapons</SMYH.matchhandamounts.tooltip>
<SMYH.showwhencarry.label>Show hands when carrying things</SMYH.showwhencarry.label>
<SMYH.showwhencarry.tooltip>Will draw hands when pawns are carrying things</SMYH.showwhencarry.tooltip>
<SMYH.showcrawling.label>Show hands when crawling</SMYH.showcrawling.label>
<SMYH.showcrawling.tooltip>Will show hands when the pawn is knocked down and crawling</SMYH.showcrawling.tooltip>
<SMYH.showothertimes.label>Always show hands</SMYH.showothertimes.label>
<SMYH.showothertimes.tooltip>Will draw static hands at the sides of the pawn when not doing something else with them, some issues have been reported and Im working on a better way of doing this</SMYH.showothertimes.tooltip>
<SMYH.matcharmor.label>Try to match armor color</SMYH.matcharmor.label>
Expand Down
6 changes: 4 additions & 2 deletions Languages/French/Keyed/Mod_Settings.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<LanguageData>
<!--The following translations were generated by https://www.deepl.com/-->
<SMYH.settings>Paramètres</SMYH.settings>
Expand Down Expand Up @@ -64,4 +64,6 @@
<SMYH.offhandrotation.label>Rotation hors main</SMYH.offhandrotation.label>
<SMYH.degree>{0}°</SMYH.degree>
<SMYH.rotate>Utilisez la molette de défilement pour faire tourner les aiguilles, maintenez la touche SHIFT enfoncée pour une rotation plus rapide.</SMYH.rotate>
</LanguageData>
<SMYH.showcrawling.label>Montrer ses mains quand on rampe</SMYH.showcrawling.label>
<SMYH.showcrawling.tooltip>Montre les mains lorsque le pion est renversé et qu'il rampe.</SMYH.showcrawling.tooltip>
</LanguageData>
6 changes: 4 additions & 2 deletions Languages/German/Keyed/Mod_Settings.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<LanguageData>
<!--The following translations were generated by https://www.deepl.com/-->
<SMYH.settings>Einstellungen</SMYH.settings>
Expand Down Expand Up @@ -64,4 +64,6 @@
<SMYH.offhandrotation.label>Drehung aus der Hand</SMYH.offhandrotation.label>
<SMYH.degree>{0}°</SMYH.degree>
<SMYH.rotate>Verwenden Sie das Scrollrad, um die Zeiger zu drehen, halten Sie SHIFT für eine schnellere Drehung</SMYH.rotate>
</LanguageData>
<SMYH.showcrawling.label>Hände zeigen beim Krabbeln</SMYH.showcrawling.label>
<SMYH.showcrawling.tooltip>Zeigt die Hände, wenn der Bauer niedergeschlagen ist und krabbelt</SMYH.showcrawling.tooltip>
</LanguageData>
6 changes: 4 additions & 2 deletions Languages/Russian/Keyed/Mod_Settings.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<LanguageData>
<!--The following translations were generated by https://www.deepl.com/-->
<SMYH.settings>Настройки</SMYH.settings>
Expand Down Expand Up @@ -64,4 +64,6 @@
<SMYH.offhandrotation.label>Вращение без помощи рук</SMYH.offhandrotation.label>
<SMYH.degree>{0}°</SMYH.degree>
<SMYH.rotate>Используйте колесо прокрутки для поворота стрелок, удерживайте SHIFT для ускорения вращения.</SMYH.rotate>
</LanguageData>
<SMYH.showcrawling.label>Показывайте руки, когда ползаете</SMYH.showcrawling.label>
<SMYH.showcrawling.tooltip>Показывает руки, когда пешка сбита с ног и ползет.</SMYH.showcrawling.tooltip>
</LanguageData>
76 changes: 73 additions & 3 deletions Source/ShowMeYourHands/HandDrawer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using UnityEngine;
using Verse;
using static System.Byte;
using Object = UnityEngine.Object;

namespace ShowMeYourHands;

Expand Down Expand Up @@ -220,6 +221,39 @@ public void DrawHandsAllTheTime(Pawn pawn)
var layerOffset = new Vector3(0, 0.0001f, 0);

var basePosition = pawn.DrawPos - heightOffset;
if (pawn.Crawling)
{
var offsetPercent =
Mathf.Clamp(Vector3.Distance(pawn.Drawer.tweener.LastTickTweenedVelocity, Vector3.zero) * 100, 0f,
1f);

var offset = offsetPercent * 0.2f * ShowMeYourHandsMain.pawnBodySizes[pawn];
sideOffset += new Vector3(0.1f, 0, 0);

if (pawn.Rotation == Rot4.West)
{
basePosition += new Vector3(offset, 0, 0);
}

if (pawn.Rotation == Rot4.East)
{
basePosition -= new Vector3(offset, 0, 0);
}

if (pawn.Rotation == Rot4.North)
{
basePosition += heightOffset * 2;
basePosition -= new Vector3(0, 0.1f, 0);
basePosition -= new Vector3(0, 0, offset);
}

if (pawn.Rotation == Rot4.South)
{
basePosition -= heightOffset;
basePosition += new Vector3(0, 0, offset);
}
}

if (pawn.Rotation == Rot4.North)
{
Graphics.DrawMesh(handMesh,
Expand All @@ -233,10 +267,24 @@ public void DrawHandsAllTheTime(Pawn pawn)
}

if (pawn.Rotation == Rot4.East)
{
if (pawn.Crawling)
{
Graphics.DrawMesh(handMesh,
basePosition + sideOffset, new Quaternion(), mainSingle, 0);
}
else
{
Graphics.DrawMesh(handMesh,
basePosition + layerOffset, new Quaternion(), mainSingle, 0);
return;
}
}

if (pawn.Rotation == Rot4.West && pawn.Crawling)
{
Graphics.DrawMesh(handMesh,
basePosition + layerOffset, new Quaternion(), mainSingle, 0);
return;
basePosition - sideOffset, new Quaternion(), mainSingle, 0);
}

if (ShowMeYourHandsMain.pawnsMissingAHand.ContainsKey(pawn) && ShowMeYourHandsMain.pawnsMissingAHand[pawn])
Expand All @@ -258,6 +306,22 @@ public void DrawHandsAllTheTime(Pawn pawn)
return;
}

if (pawn.Crawling)
{
if (pawn.Rotation == Rot4.West)
{
Graphics.DrawMesh(handMesh,
basePosition - (sideOffset * 2), new Quaternion(), mainSingle, 0);
}
else
{
Graphics.DrawMesh(handMesh,
basePosition + (sideOffset * 2), new Quaternion(), mainSingle, 0);
}

return;
}

Graphics.DrawMesh(handMesh,
basePosition + layerOffset, new Quaternion(), offSingle, 0);
}
Expand Down Expand Up @@ -632,12 +696,18 @@ public override void PostDraw()
return;
}

if (!ShowMeYourHandsMod.instance.Settings.ShowOtherTmes || LastDrawn >= GenTicks.TicksAbs - 1 ||
if (!ShowMeYourHandsMod.instance.Settings.ShowOtherTmes && !ShowMeYourHandsMod.instance.Settings.ShowCrawling ||
LastDrawn >= GenTicks.TicksAbs - 1 ||
GenTicks.TicksAbs == 0)
{
return;
}

if (ShowMeYourHandsMod.instance.Settings.ShowCrawling && !pawn.Crawling)
{
return;
}

DrawHandsAllTheTime(pawn);
}

Expand Down
2 changes: 1 addition & 1 deletion Source/ShowMeYourHands/ShowMeYourHands.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
<DebugType>None</DebugType>
<LangVersion>latest</LangVersion>
<FileVersion>1.5.10</FileVersion>
<FileVersion>1.5.11</FileVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Krafs.Rimworld.Ref">
Expand Down
15 changes: 13 additions & 2 deletions Source/ShowMeYourHands/ShowMeYourHandsMod.cs
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,17 @@ private void DrawOptions(Rect rect)
listing_Standard.CheckboxLabeled("SMYH.showothertimes.label".Translate(),
ref Settings.ShowOtherTmes,
"SMYH.showothertimes.tooltip".Translate());
if (Settings.ShowOtherTmes)
{
Settings.ShowCrawling = false;
}
else
{
listing_Standard.CheckboxLabeled("SMYH.showcrawling.label".Translate(),
ref Settings.ShowCrawling,
"SMYH.showcrawling.tooltip".Translate());
}

if (currentVersion != null)
{
listing_Standard.Gap();
Expand All @@ -549,8 +560,8 @@ private void DrawOptions(Rect rect)
listing_Standard.End();

var tabFrameRect = frameRect;
tabFrameRect.y += 400;
tabFrameRect.height -= 400;
tabFrameRect.y += 425;
tabFrameRect.height -= 425;
var tabContentRect = tabFrameRect;
tabContentRect.x = 0;
tabContentRect.y = 0;
Expand Down
2 changes: 2 additions & 0 deletions Source/ShowMeYourHands/ShowMeYourHandsModSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ internal class ShowMeYourHandsModSettings : ModSettings
public bool RepositionHands = true;
public bool ResizeHands = true;
public bool Rotation = ModsConfig.IsActive("andromeda.nicehands");
public bool ShowCrawling;
public bool ShowOtherTmes;
public bool ShowWhenCarry;
public bool VerboseLogging;
Expand All @@ -48,6 +49,7 @@ public override void ExposeData()
Scribe_Values.Look(ref RepositionHands, "RepositionHands", true);
Scribe_Values.Look(ref ShowWhenCarry, "ShowWhenCarry");
Scribe_Values.Look(ref ShowOtherTmes, "ShowOtherTmes");
Scribe_Values.Look(ref ShowCrawling, "ShowCrawling");
Scribe_Collections.Look(ref ManualMainHandPositions, "ManualMainHandPositions", LookMode.Value,
LookMode.Value,
ref manualMainHandPositionsKeys, ref manualMainHandPositionsValues);
Expand Down

0 comments on commit daec15b

Please sign in to comment.