Skip to content

Commit

Permalink
Added rotation support, default enabled when using [url=https://steam…
Browse files Browse the repository at this point in the history
…community.com/sharedfiles/filedetails/?id=3302328100]Nice Hands Retexture[/url]

Used DeepL to update translations for ChineseSimplified, French, German, Russian
  • Loading branch information
emipa606 committed Aug 29, 2024
1 parent 9df3ec6 commit 6a1d925
Show file tree
Hide file tree
Showing 18 changed files with 238 additions and 41 deletions.
Binary file modified 1.5/Assemblies/ShowMeYourHands.dll
Binary file not shown.
2 changes: 1 addition & 1 deletion 1.5/Defs/ThingDefs/Core.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- (x,y,z)
x(horizontal)
y(altitude layer,0 is weapon texture layer, lower numbers are under weapon texures, higher value than 0 is over weapon texture)
y(altitude layer,0 is weapon texture layer, lower numbers are under weapon textures, higher value than 0 is over weapon texture)
z(vertical)-->
<Defs>
<WHands.ClutterHandsTDef>
Expand Down
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.7</modVersion>
<modVersion IgnoreIfNoMatchingField="True">1.5.8</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.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


1.5.7 - Added settings for the rest of the Guns Galore-mods. Also added copy and paste buttons.
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.7</version>
<version>1.5.8</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.7</Version>
<Version>1.5.8</Version>
<SaveBreaking>False</SaveBreaking>
<Host name="Github">
<Owner>emipa606</Owner>
Expand Down
6 changes: 6 additions & 0 deletions Languages/ChineseSimplified/Keyed/Mod_Settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,10 @@
<SMYH.copyone.button>复制设置</SMYH.copyone.button>
<SMYH.paste.info>粘贴的设置</SMYH.paste.info>
<SMYH.copy.info>复制的设置</SMYH.copy.info>
<SMYH.rotation.label>启用旋转支持</SMYH.rotation.label>
<SMYH.rotation.tooltip>允许自定义旋转指针,只有在使用非标准指针纹理时才会生效</SMYH.rotation.tooltip>
<SMYH.mainhandrotation.label>主手旋转</SMYH.mainhandrotation.label>
<SMYH.offhandrotation.label>离手旋转</SMYH.offhandrotation.label>
<SMYH.degree>{0}°</SMYH.degree>
<SMYH.rotate>使用滚轮旋转指针,按住 SHIFT 键可加快旋转速度</SMYH.rotate>
</LanguageData>
8 changes: 7 additions & 1 deletion Languages/English/Keyed/Mod_Settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
<SMYH.resetselected.button>Reset selected</SMYH.resetselected.button>
<SMYH.logging.label>Enable verbose logging</SMYH.logging.label>
<SMYH.logging.tooltip>Shows verbose logging, for finding errors</SMYH.logging.tooltip>
<SMYH.rotation.label>Enable rotation support</SMYH.rotation.label>
<SMYH.rotation.tooltip>Allows defining custom rotation of hands, this will only have effect when using a non-standard hand-texture</SMYH.rotation.tooltip>
<SMYH.matchartificiallimb.label>Try to match replaced hands</SMYH.matchartificiallimb.label>
<SMYH.matchartificiallimb.tooltip>If the pawns hands are replaced with an artificial hand, it will try to show the color of the artificial limb instead</SMYH.matchartificiallimb.tooltip>
<SMYH.matchhandamounts.label>Dont show missing hands</SMYH.matchhandamounts.label>
Expand All @@ -43,9 +45,12 @@
<SMYH.nohands.label>Uses no hands</SMYH.nohands.label>
<SMYH.mainhandhorizontal.label>Main hand horizontal</SMYH.mainhandhorizontal.label>
<SMYH.mainhandvertical.label>Main hand vertical</SMYH.mainhandvertical.label>
<SMYH.mainhandrotation.label>Main hand rotation</SMYH.mainhandrotation.label>
<SMYH.renderbehind.label>Render behind weapon</SMYH.renderbehind.label>
<SMYH.offhandhorizontal.label>Off hand horizontal</SMYH.offhandhorizontal.label>
<SMYH.offhandvertical.label>Off hand vertical</SMYH.offhandvertical.label>
<SMYH.offhandrotation.label>Off hand rotation</SMYH.offhandrotation.label>
<SMYH.degree>{0}°</SMYH.degree>
<SMYH.reset.button>Reset</SMYH.reset.button>
<SMYH.undo.button>Undo</SMYH.undo.button>
<SMYH.save.button>Save</SMYH.save.button>
Expand All @@ -56,5 +61,6 @@
<SMYH.weaponrow.red>Uses the default settings</SMYH.weaponrow.red>
<SMYH.weaponrow.cyan>Has custom settings included in the mod</SMYH.weaponrow.cyan>
<SMYH.weaponrow.green>Has personal settings defined by the player</SMYH.weaponrow.green>
<SMYH.draginfo>NOTE: You can also left-click drag to set the main-hand position, right-click drag to set the off-hand position</SMYH.draginfo>
<SMYH.draginfo>Left-click drag to set the main-hand position, right-click drag to set the off-hand position.</SMYH.draginfo>
<SMYH.rotate>Use the scroll wheel to rotate the hands, hold SHIFT for faster rotation</SMYH.rotate>
</LanguageData>
6 changes: 6 additions & 0 deletions Languages/French/Keyed/Mod_Settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,10 @@
<SMYH.copyone.button>Paramètres de copie</SMYH.copyone.button>
<SMYH.paste.info>Paramètres collés</SMYH.paste.info>
<SMYH.copy.info>Paramètres copiés</SMYH.copy.info>
<SMYH.rotation.label>Activer la prise en charge de la rotation</SMYH.rotation.label>
<SMYH.rotation.tooltip>Permet de définir une rotation personnalisée des mains, qui n'aura d'effet que lors de l'utilisation d'une texture de main non standard.</SMYH.rotation.tooltip>
<SMYH.mainhandrotation.label>Rotation de la main principale</SMYH.mainhandrotation.label>
<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>
6 changes: 6 additions & 0 deletions Languages/German/Keyed/Mod_Settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,10 @@
<SMYH.copyone.button>Einstellungen kopieren</SMYH.copyone.button>
<SMYH.paste.info>Einstellungen eingefügt</SMYH.paste.info>
<SMYH.copy.info>Einstellungen kopiert</SMYH.copy.info>
<SMYH.rotation.label>Unterstützung der Rotation aktivieren</SMYH.rotation.label>
<SMYH.rotation.tooltip>Ermöglicht die Definition einer benutzerdefinierten Drehung der Hände, dies hat nur Auswirkungen, wenn eine Nicht-Standard-Hand-Textur verwendet wird</SMYH.rotation.tooltip>
<SMYH.mainhandrotation.label>Rotation der Haupthand</SMYH.mainhandrotation.label>
<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>
6 changes: 6 additions & 0 deletions Languages/Russian/Keyed/Mod_Settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,10 @@
<SMYH.copyone.button>Настройки копирования</SMYH.copyone.button>
<SMYH.paste.info>Настройки вставлены</SMYH.paste.info>
<SMYH.copy.info>Копирование настроек</SMYH.copy.info>
<SMYH.rotation.label>Включите поддержку вращения</SMYH.rotation.label>
<SMYH.rotation.tooltip>Позволяет задать пользовательское вращение рук, это будет иметь эффект только при использовании нестандартной текстуры рук</SMYH.rotation.tooltip>
<SMYH.mainhandrotation.label>Вращение основной руки</SMYH.mainhandrotation.label>
<SMYH.offhandrotation.label>Вращение без помощи рук</SMYH.offhandrotation.label>
<SMYH.degree>{0}°</SMYH.degree>
<SMYH.rotate>Используйте колесо прокрутки для поворота стрелок, удерживайте SHIFT для ускорения вращения.</SMYH.rotate>
</LanguageData>
2 changes: 2 additions & 0 deletions Source/ShowMeYourHands/ClutterHandsTDef.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ public class CompTargets
{
public readonly List<string> ThingTargets = [];
public Vector3 MainHand = Vector3.zero;
public float MainRotation = 0f;
public Vector3 SecHand = Vector3.zero;
public float SecRotation = 0f;
}
}
15 changes: 10 additions & 5 deletions Source/ShowMeYourHands/HandDrawer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ public class HandDrawer : ThingComp
public Vector3 ItemHeldLocation;
private int LastDrawn;
private Vector3 MainHand;
private float MainHandRotation;
private Vector3 OffHand;
private float OffHandRotation;

private Color HandColor
{
Expand Down Expand Up @@ -110,11 +112,15 @@ private void DrawHandsOnWeapon(Pawn pawn)
{
MainHand = compProperties.MainHand;
OffHand = compProperties.SecHand;
MainHandRotation = compProperties.MainRotation;
OffHandRotation = compProperties.SecRotation;
}
else
{
OffHand = Vector3.zero;
MainHand = Vector3.zero;
MainHandRotation = 0f;
OffHandRotation = 0f;
}

ThingWithComps offhandWeapon = null;
Expand Down Expand Up @@ -316,8 +322,7 @@ public void DrawHandsOnItem(Pawn pawn)
}

private void DrawHandsOnWeapon(Thing mainHandWeapon, float aimAngle, Pawn pawn, Thing offHandWeapon = null,
bool idle = false,
bool aiming = false)
bool idle = false, bool aiming = false)
{
var flipped = false;
var skipMainHand = false;
Expand Down Expand Up @@ -510,7 +515,7 @@ private void DrawHandsOnWeapon(Thing mainHandWeapon, float aimAngle, Pawn pawn,

Graphics.DrawMesh(mesh,
mainWeaponLocation + new Vector3(x, y + mainMeleeExtra, z).RotatedBy(mainHandAngle),
Quaternion.AngleAxis(mainHandAngle, Vector3.up), y >= 0 ? matSingle : offSingle, 0);
Quaternion.AngleAxis(mainHandAngle + MainHandRotation, Vector3.up), y >= 0 ? matSingle : offSingle, 0);
}

if (OffHand == Vector3.zero || skipOffHand || ShowMeYourHandsMain.pawnsMissingAHand.ContainsKey(pawn) &&
Expand Down Expand Up @@ -559,7 +564,7 @@ private void DrawHandsOnWeapon(Thing mainHandWeapon, float aimAngle, Pawn pawn,

Graphics.DrawMesh(mesh,
offhandWeaponLocation + new Vector3(x2, y2 + offMeleeExtra, z2).RotatedBy(offHandAngle),
Quaternion.AngleAxis(offHandAngle, Vector3.up),
Quaternion.AngleAxis(offHandAngle + OffHandRotation, Vector3.up),
y2 >= 0 ? matSingle : offSingle, 0);
return;
}
Expand All @@ -571,7 +576,7 @@ private void DrawHandsOnWeapon(Thing mainHandWeapon, float aimAngle, Pawn pawn,

Graphics.DrawMesh(mesh,
mainWeaponLocation + new Vector3(x2, y2 + offMeleeExtra, z2).RotatedBy(mainHandAngle),
Quaternion.AngleAxis(mainHandAngle, Vector3.up), y2 >= 0 ? matSingle : offSingle, 0);
Quaternion.AngleAxis(mainHandAngle + OffHandRotation, Vector3.up), y2 >= 0 ? matSingle : offSingle, 0);
}

private Vector3 AdjustRenderOffsetFromDir(Pawn pawn, ThingWithComps weapon)
Expand Down
19 changes: 18 additions & 1 deletion Source/ShowMeYourHands/RimWorld_MainMenuDrawer_MainMenuOnGUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ private static void LoadFromSettings()
.ToVector3()
: Vector3.zero
};

weapon.comps.Add(compProps);
}
else
Expand All @@ -248,6 +249,18 @@ private static void LoadFromSettings()
: Vector3.zero;
}

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

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

doneWeapons.Add(weapon);
}
}
Expand Down Expand Up @@ -300,14 +313,18 @@ public static void LoadFromDefs(ThingDef specificDef = null)
{
compClass = typeof(WhandComp),
MainHand = weaponSets.MainHand,
SecHand = weaponSets.SecHand
SecHand = weaponSets.SecHand,
MainRotation = weaponSets.MainRotation,
SecRotation = weaponSets.SecRotation
};
weapon.comps.Add(compProps);
}
else
{
compProps.MainHand = weaponSets.MainHand;
compProps.SecHand = weaponSets.SecHand;
compProps.MainRotation = weaponSets.MainRotation;
compProps.SecRotation = weaponSets.SecRotation;
}

ShowMeYourHandsMod.DefinedByDef.Add(weapon.defName);
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.7</FileVersion>
<FileVersion>1.5.8</FileVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Krafs.Rimworld.Ref">
Expand Down
Loading

0 comments on commit 6a1d925

Please sign in to comment.