Skip to content

Commit

Permalink
Fix for existing custom hand-positions with no rotation-info
Browse files Browse the repository at this point in the history
  • Loading branch information
emipa606 committed Aug 29, 2024
1 parent 6a1d925 commit 4cd0807
Show file tree
Hide file tree
Showing 12 changed files with 44 additions and 19 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.8</modVersion>
<modVersion IgnoreIfNoMatchingField="True">1.5.9</modVersion>
</ModMetaData>
3 changes: 3 additions & 0 deletions About/Changelog.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog for ShowMeYourHands

1.5.9 - Fix for existing custom hand-positions with no rotation-info


1.5.8 - Added rotation support, default enabled when using [url=https://steamcommunity.com/sharedfiles/filedetails/?id=3302328100]Nice Hands Retexture[/url]
Used DeepL to update translations for ChineseSimplified, French, German, Russian

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.8</version>
<version>1.5.9</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.8</Version>
<Version>1.5.9</Version>
<SaveBreaking>False</SaveBreaking>
<Host name="Github">
<Owner>emipa606</Owner>
Expand Down
4 changes: 2 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,4 @@
<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>
</LanguageData>
4 changes: 2 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,4 @@
<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>
</LanguageData>
4 changes: 2 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,4 @@
<SMYH.offhandrotation.label>Вращение без помощи рук</SMYH.offhandrotation.label>
<SMYH.degree>{0}°</SMYH.degree>
<SMYH.rotate>Используйте колесо прокрутки для поворота стрелок, удерживайте SHIFT для ускорения вращения.</SMYH.rotate>
</LanguageData>
</LanguageData>
17 changes: 15 additions & 2 deletions Source/ShowMeYourHands/RimWorld_MainMenuDrawer_MainMenuOnGUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,9 @@ public static void FigureOutSpecific(ThingDef weapon)
compProps.MainHand = mainHand;
}
}

compProps.MainRotation = 0;
compProps.SecRotation = 0;
}

private static void FigureOutTheRest()
Expand Down Expand Up @@ -202,6 +205,8 @@ where weapon.IsWeapon && !weapon.destroyOnDrop &&
}
}

compProps.MainRotation = 0;
compProps.SecRotation = 0;
doneWeapons.Add(weapon);
}
}
Expand Down Expand Up @@ -249,17 +254,25 @@ private static void LoadFromSettings()
: Vector3.zero;
}

if (ShowMeYourHandsMod.instance?.Settings?.ManualMainHandRotations.TryGetValue(keyValuePair.Key,
if (ShowMeYourHandsMod.instance?.Settings?.ManualMainHandRotations?.TryGetValue(keyValuePair.Key,
out var mainHandRotation) == true)
{
compProps.MainRotation = mainHandRotation;
}
else
{
compProps.MainRotation = 0;
}

if (ShowMeYourHandsMod.instance?.Settings?.ManualOffHandRotations.TryGetValue(keyValuePair.Key,
if (ShowMeYourHandsMod.instance?.Settings?.ManualOffHandRotations?.TryGetValue(keyValuePair.Key,
out var offHandRotation) == true)
{
compProps.SecRotation = offHandRotation;
}
else
{
compProps.SecRotation = 0;
}

doneWeapons.Add(weapon);
}
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.8</FileVersion>
<FileVersion>1.5.9</FileVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Krafs.Rimworld.Ref">
Expand Down
14 changes: 14 additions & 0 deletions Source/ShowMeYourHands/ShowMeYourHandsMod.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,23 @@ public ShowMeYourHandsMod(ModContentPack content)
if (Settings.ManualMainHandPositions == null)
{
Settings.ManualMainHandPositions = new Dictionary<string, SaveableVector3>();
}

if (Settings.ManualOffHandPositions == null)
{
Settings.ManualOffHandPositions = new Dictionary<string, SaveableVector3>();
}

if (Settings.ManualMainHandRotations == null)
{
Settings.ManualMainHandRotations = new Dictionary<string, float>();
}

if (Settings.ManualOffHandRotations == null)
{
Settings.ManualOffHandRotations = new Dictionary<string, float>();
}

currentVersion =
VersionFromManifest.GetVersionFromModMetaData(content.ModMetaData);
}
Expand Down
9 changes: 2 additions & 7 deletions Source/ShowMeYourHands/WhandComp.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
using UnityEngine;
using Verse;
using Verse;

namespace ShowMeYourHands;

public class WhandComp : ThingComp
{
public Vector3 MHand;
public Vector3 SHand;
}
public class WhandComp : ThingComp;

0 comments on commit 4cd0807

Please sign in to comment.