added workbench range multiplier
This commit is contained in:
@@ -1,3 +1,3 @@
|
|||||||
<Solution>
|
<Solution>
|
||||||
<Project Path="MxValheim/MxValheim.csproj" />
|
<Project Path="MxValheim/MxValheim.csproj" Id="49a57ac4-1a2b-4603-8559-af3cb950b40e" />
|
||||||
</Solution>
|
</Solution>
|
||||||
|
|||||||
@@ -9,9 +9,10 @@ public class MxValheimMod : BaseUnityPlugin
|
|||||||
{
|
{
|
||||||
private const string ModGUID = "ovh.mxdev.mxvalheim";
|
private const string ModGUID = "ovh.mxdev.mxvalheim";
|
||||||
private const string ModName = "MxValheim";
|
private const string ModName = "MxValheim";
|
||||||
private const string ModVersion = "1.0.0";
|
private const string ModVersion = "1.1.0";
|
||||||
|
|
||||||
public static ConfigEntry<int> OreMultiplier;
|
public static ConfigEntry<int> OreMultiplier;
|
||||||
|
public static ConfigEntry<float> rangeMultiplier;
|
||||||
|
|
||||||
// Set your multiplier here
|
// Set your multiplier here
|
||||||
public static int Multiplier = 3;
|
public static int Multiplier = 3;
|
||||||
@@ -19,10 +20,9 @@ public class MxValheimMod : BaseUnityPlugin
|
|||||||
void Awake()
|
void Awake()
|
||||||
{
|
{
|
||||||
OreMultiplier = Config.Bind("General","OreMultiplier",3,"How many items should drop for every 1 ore/scrap found.");
|
OreMultiplier = Config.Bind("General","OreMultiplier",3,"How many items should drop for every 1 ore/scrap found.");
|
||||||
|
rangeMultiplier = Config.Bind("General", "CraftingRangeMultiplier",2.0f,"Multiplier for the workbench build/crafting range. Default is 2x.");
|
||||||
|
|
||||||
Harmony harmony = new Harmony(ModGUID);
|
Harmony harmony = new Harmony(ModGUID);
|
||||||
harmony.PatchAll();
|
harmony.PatchAll();
|
||||||
|
|
||||||
Logger.LogInfo($"{ModName} loaded with multiplier: {OreMultiplier.Value}x");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -54,9 +54,14 @@
|
|||||||
<Reference Include="UnityEngine.CoreModule">
|
<Reference Include="UnityEngine.CoreModule">
|
||||||
<HintPath>E:\SteamLibrary\steamapps\common\Valheim\Valheim_Data\Managed\UnityEngine.CoreModule.dll</HintPath>
|
<HintPath>E:\SteamLibrary\steamapps\common\Valheim\Valheim_Data\Managed\UnityEngine.CoreModule.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
<Reference Include="UnityEngine.PhysicsModule, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
|
<SpecificVersion>False</SpecificVersion>
|
||||||
|
<HintPath>E:\SteamLibrary\steamapps\common\Valheim\Valheim_Data\Managed\UnityEngine.PhysicsModule.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="MxValheim.cs" />
|
<Compile Include="MxValheim.cs" />
|
||||||
|
<Compile Include="Patch\CraftingStation.cs" />
|
||||||
<Compile Include="Patch\Ores.cs" />
|
<Compile Include="Patch\Ores.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|||||||
25
MxValheim/Patch/CraftingStation.cs
Normal file
25
MxValheim/Patch/CraftingStation.cs
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
using BepInEx;
|
||||||
|
using HarmonyLib;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace MxValheim.Patch
|
||||||
|
{
|
||||||
|
public class CraftingStation_Patch
|
||||||
|
{
|
||||||
|
[HarmonyPatch(typeof(CraftingStation), "Start")]
|
||||||
|
static class CraftingStation_Start_Patch
|
||||||
|
{
|
||||||
|
static void Postfix(CraftingStation __instance)
|
||||||
|
{
|
||||||
|
var rangeField = Traverse.Create(__instance).Field("m_rangeBuild");
|
||||||
|
|
||||||
|
if (rangeField.FieldExists())
|
||||||
|
{
|
||||||
|
float currentRange = rangeField.GetValue<float>();
|
||||||
|
rangeField.SetValue(currentRange * MxValheimMod.rangeMultiplier.Value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user