Skip to content

Commit e292a57

Browse files
committed
also show durability of raw knife
1 parent f8070a7 commit e292a57

File tree

4 files changed

+17
-3
lines changed

4 files changed

+17
-3
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ For support or to discuss any other modding related topic you can join our [Star
1616

1717
## Changelog
1818

19+
0.0.4:
20+
21+
- include raw knife (the first tool you craft)
22+
1923
0.0.3:
2024

2125
- fix wrong durability value for iron axe

ShowDurability/Patches/Dynamic/Slot_Patch.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ namespace ShowDurability.Patches.Dynamic
77
[HarmonyPatch(typeof(Slot))]
88
class Slot_Patch
99
{
10+
static float MAX_HEALTH_PRIMITIVE = 200f;
1011
static float MAX_HEALTH_WOOD = 300f;
1112
static float MAX_HEALTH_IRON = 600f;
1213

@@ -30,6 +31,15 @@ public static void Refresh_Postfix(Slot __instance)
3031

3132
bar.SetFillAmount(__instance.CurrentItem.GetPropertyValue("Durability").Float.Current / MAX_HEALTH_IRON);
3233

34+
__instance.Refreshed.Send(__instance);
35+
}
36+
else if(__instance?.CurrentItem?.Name == "RAW KNIFE")
37+
{
38+
DurabilityBar bar = (DurabilityBar)AccessTools.Field(typeof(Slot), "m_DurabilityBar").GetValue(__instance);
39+
bar.SetActive(true);
40+
41+
bar.SetFillAmount(__instance.CurrentItem.GetPropertyValue("Durability").Float.Current / MAX_HEALTH_PRIMITIVE);
42+
3343
__instance.Refreshed.Send(__instance);
3444
}
3545
}

ShowDurability/ShowDurability.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
namespace ShowDurability
88
{
9-
[BepInPlugin("com.sp00ktober.ShowDurability", "ShowDurability", "0.0.3")]
9+
[BepInPlugin("com.sp00ktober.ShowDurability", "ShowDurability", "0.0.4")]
1010
public class ShowDurability : BaseUnityPlugin
1111
{
1212
private void Awake()
@@ -20,7 +20,7 @@ private static void InitPatches()
2020

2121
try
2222
{
23-
Debug.Log("Applying patches from ShowDurability 0.0.3");
23+
Debug.Log("Applying patches from ShowDurability 0.0.4");
2424

2525
Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "com.sp00ktober.de");
2626

ShowDurability/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "ShowDurability",
33
"description": "BepInEx mod for Starsand to show the durability of some tools which have it normally hidden.",
4-
"version_number": "0.0.3",
4+
"version_number": "0.0.4",
55
"dependencies": [
66
"BepInEx-BepInExPack_Starsand-5.4.16"
77
],

0 commit comments

Comments
 (0)