Skip to content

Commit

Permalink
Fixed a bug that allowed players to veinmine (and gain exp) without a…
Browse files Browse the repository at this point in the history
… pickaxe.
  • Loading branch information
diogo.garrett93 committed Sep 21, 2021
1 parent c1e5e57 commit cf49025
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ What does 2 mean, you ask?

It's simple! A standard 2x2 floor piece has a length of 2, exactly like its name suggests.
# Changelog
## 1.2.2
## 1.2.3
- Fixed a bug that allowed players to veinmine (and gain exp) without a pickaxe.
### 1.2.2
- Possible fix for ore drop quantities (Not sure why they weren't correct, as I don't change drop rates)
### 1.2.1
- Compatibility for Hearth and Home;
Expand Down
6 changes: 3 additions & 3 deletions VeinMine/Patches.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public static void MineRock5_Damage_Patch(MineRock5 __instance, ZNetView ___m_nv
{
if (Player.m_localPlayer != null && hit.m_attacker == Player.m_localPlayer.GetZDOID())
{
if (Input.GetKey(VeinMine.veinMineKey.Value))
if (Input.GetKey(VeinMine.veinMineKey.Value) && Player.m_localPlayer.GetCurrentWeapon().GetDamage().m_pickaxe > 0)
{
foreach (var index in __state)
{
Expand Down Expand Up @@ -95,7 +95,7 @@ public static void MineRock5_Damage_Patch(MineRock5 __instance, ZNetView ___m_nv
[HarmonyPatch(typeof(MineRock5), "DamageArea")]
public static bool MineRock5_DamageArea_Prefix(MineRock5 __instance, HitData hit, int hitAreaIndex, ref EffectList ___m_destroyedEffect, ref EffectList ___m_hitEffect, out float __state, ref bool __result)
{
if (!VeinMine.progressiveMode.Value) hit.m_damage.m_pickaxe = __instance.m_health;
if (!VeinMine.progressiveMode.Value && Player.GetClosestPlayer(hit.m_point, 10f).GetCurrentWeapon().GetDamage().m_pickaxe > 0f) hit.m_damage.m_pickaxe = __instance.m_health;
bool isVeinmined = false;
MineRock5.HitArea hitArea = __instance.GetHitArea(hitAreaIndex);
__state = hitArea.m_health;
Expand Down Expand Up @@ -178,7 +178,7 @@ public static bool MineRock5_DamageArea_Prefix(MineRock5 __instance, HitData hit
[HarmonyPatch(typeof(MineRock5), "DamageArea")]
public static void MineRock5_DamageArea_Patch(MineRock5 __instance, HitData hit, float __state, bool __result)
{
if (Input.GetKey(VeinMine.veinMineKey.Value))
if (Input.GetKey(VeinMine.veinMineKey.Value) && Player.m_localPlayer.GetCurrentWeapon().GetDamage().m_pickaxe > 0)
{
if (__state > 0f && hit.m_attacker == Player.m_localPlayer.GetZDOID() && !VeinMine.progressiveMode.Value)
{
Expand Down
4 changes: 2 additions & 2 deletions VeinMine/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.2.2.0")]
[assembly: AssemblyFileVersion("1.2.2.0")]
[assembly: AssemblyVersion("1.2.3.0")]
[assembly: AssemblyFileVersion("1.2.3.0")]
2 changes: 1 addition & 1 deletion VeinMine/VeinMine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class VeinMine : BaseUnityPlugin
{
private const string MOD_ID = "com.wisehorror.Veinmine";
private const string MOD_NAME = "Veinmine";
private const string VERSION = "1.2.2";
private const string VERSION = "1.2.3";

public static ManualLogSource logger = BepInEx.Logging.Logger.CreateLogSource("Veinmine");

Expand Down

0 comments on commit cf49025

Please sign in to comment.