Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d0f7a156c7 | ||
|
|
cb93f20b18 | ||
|
|
2291d1c162 |
@@ -15,6 +15,7 @@ using System.Xml;
|
|||||||
using TMPro;
|
using TMPro;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
|
using static MxValheim.Patch.Doors_Patch;
|
||||||
|
|
||||||
[BepInPlugin(ModGUID, ModName, ModVersion)]
|
[BepInPlugin(ModGUID, ModName, ModVersion)]
|
||||||
public class MxValheimMod : BaseUnityPlugin
|
public class MxValheimMod : BaseUnityPlugin
|
||||||
@@ -25,7 +26,7 @@ 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";
|
||||||
public const string ModVersion = "1.5.6";
|
public const string ModVersion = "1.5.8";
|
||||||
|
|
||||||
public static ConfigEntry<bool> Config_Locked;
|
public static ConfigEntry<bool> Config_Locked;
|
||||||
public static ConfigEntry<int> Config_OreMultiplier;
|
public static ConfigEntry<int> Config_OreMultiplier;
|
||||||
@@ -38,7 +39,9 @@ public class MxValheimMod : BaseUnityPlugin
|
|||||||
|
|
||||||
public static string modPath = Path.Combine(Paths.PluginPath, "MxValheim");
|
public static string modPath = Path.Combine(Paths.PluginPath, "MxValheim");
|
||||||
public static string internalConfigsPath = Path.Combine(modPath, "Configs");
|
public static string internalConfigsPath = Path.Combine(modPath, "Configs");
|
||||||
private static string WeightConfigPath => Path.Combine(internalConfigsPath, "items_weight.json");
|
public static string WeightConfigPath => Path.Combine(internalConfigsPath, "items_weight.json");
|
||||||
|
public static string AutoDoorConfigPath => Path.Combine(internalConfigsPath, "auto_doors.json");
|
||||||
|
public static DoorRoot CachedConfig;
|
||||||
public static Dictionary<string, float> WeightSettings = new Dictionary<string, float>();
|
public static Dictionary<string, float> WeightSettings = new Dictionary<string, float>();
|
||||||
|
|
||||||
// Data structures
|
// Data structures
|
||||||
@@ -86,6 +89,7 @@ public class MxValheimMod : BaseUnityPlugin
|
|||||||
|
|
||||||
LoadLocalization();
|
LoadLocalization();
|
||||||
LoadJsonConfig();
|
LoadJsonConfig();
|
||||||
|
LoadDoorConfig();
|
||||||
|
|
||||||
_doorTimer = MxValheimMod.Config_autoDoorClose.Value;
|
_doorTimer = MxValheimMod.Config_autoDoorClose.Value;
|
||||||
|
|
||||||
@@ -304,6 +308,15 @@ public class MxValheimMod : BaseUnityPlugin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void LoadDoorConfig()
|
||||||
|
{
|
||||||
|
if (System.IO.File.Exists(AutoDoorConfigPath))
|
||||||
|
{
|
||||||
|
string json = System.IO.File.ReadAllText(AutoDoorConfigPath);
|
||||||
|
CachedConfig = JsonConvert.DeserializeObject<DoorRoot>(json);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
internal static void ShowKillMessage(string v)
|
internal static void ShowKillMessage(string v)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
using BepInEx;
|
using BepInEx;
|
||||||
using HarmonyLib;
|
using HarmonyLib;
|
||||||
|
using Newtonsoft.Json;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.Diagnostics;
|
using UnityEngine.Diagnostics;
|
||||||
using static MxValheimMod;
|
using static MxValheimMod;
|
||||||
@@ -9,6 +12,11 @@ namespace MxValheim.Patch
|
|||||||
{
|
{
|
||||||
public class Doors_Patch
|
public class Doors_Patch
|
||||||
{
|
{
|
||||||
|
public class DoorRoot
|
||||||
|
{
|
||||||
|
public List<string> ignoreList { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
[HarmonyPatch(typeof(Door), nameof(Door.Interact))]
|
[HarmonyPatch(typeof(Door), nameof(Door.Interact))]
|
||||||
public static class DoorTracker
|
public static class DoorTracker
|
||||||
{
|
{
|
||||||
@@ -21,14 +29,15 @@ namespace MxValheim.Patch
|
|||||||
int prefabHash = nview.GetZDO().GetPrefab();
|
int prefabHash = nview.GetZDO().GetPrefab();
|
||||||
string prefabName = ZNetScene.instance.GetPrefab(prefabHash).name;
|
string prefabName = ZNetScene.instance.GetPrefab(prefabHash).name;
|
||||||
|
|
||||||
if (prefabName == "piece_crypt_door") return;
|
if (MxValheimMod.CachedConfig?.ignoreList != null)
|
||||||
|
if (MxValheimMod.CachedConfig.ignoreList.Contains(prefabName)) return;
|
||||||
|
|
||||||
if (hold || alt || ___m_nview == null || !___m_nview.IsValid()) return;
|
if (hold || alt || ___m_nview == null || !___m_nview.IsValid()) return;
|
||||||
|
|
||||||
// Get state: 0 is closed
|
// Get state: 0 is closed
|
||||||
int state = ___m_nview.GetZDO().GetInt("state");
|
int state = ___m_nview.GetZDO().GetInt("state");
|
||||||
|
|
||||||
if (state == 0) return;
|
if (state == 0) return;
|
||||||
|
|
||||||
lock (_doorQueueNview)
|
lock (_doorQueueNview)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -16,8 +16,8 @@ Official **MxValheim Server** Mod.
|
|||||||
- Auto close doors after a specified amount of time. (Enable/Disable and configure desired time in the generated config.)
|
- Auto close doors after a specified amount of time. (Enable/Disable and configure desired time in the generated config.)
|
||||||
|
|
||||||
## How-To Install
|
## How-To Install
|
||||||
1. Download the latest dll.
|
1. Download the latest zip.
|
||||||
2. Copy it to your (Client/Server) "BepInEx\plugins\MxValheim\".
|
2. Copy the zip content to your (Client/Server) "BepInEx\plugins\MxValheim\".
|
||||||
3. Run your (Client/Server) at least one time.
|
3. Run your (Client/Server) at least one time.
|
||||||
4. Tweaks the config in "BepInEx\config\ovh.mxdev.mxvalheim.cfg" to your liking.
|
4. Tweaks the config in "BepInEx\config\ovh.mxdev.mxvalheim.cfg" to your liking.
|
||||||
5. Enjoy!
|
5. Enjoy!
|
||||||
Reference in New Issue
Block a user