diff --git a/MxValheim/KillFeed/Patch.cs b/MxValheim/KillFeed/Patch.cs index 561b076..a533911 100644 --- a/MxValheim/KillFeed/Patch.cs +++ b/MxValheim/KillFeed/Patch.cs @@ -24,6 +24,8 @@ namespace MxValheim.KillFeed ZNet zn = new ZNet(); if (zn.IsDedicated()) return; + if (attacker == "The World") return; + string finalMsg = (type == 1) ? $"☠ {victim} a été tué par {attacker}" : (type == 2) ? $"{attacker} a tué {victim}" : $"{attacker} a tué {victim}"; diff --git a/MxValheim/MxValheim.cs b/MxValheim/MxValheim.cs index af2ca11..7fe5463 100644 --- a/MxValheim/MxValheim.cs +++ b/MxValheim/MxValheim.cs @@ -19,7 +19,7 @@ public class MxValheimMod : BaseUnityPlugin private const string ModGUID = "ovh.mxdev.mxvalheim"; private const string ModName = "MxValheim"; - private const string ModVersion = "1.5.0"; + private const string ModVersion = "1.5.1"; public static ConfigEntry Config_Locked; public static ConfigEntry Config_OreMultiplier; diff --git a/MxValheim/Patch/Doors.cs b/MxValheim/Patch/Doors.cs index 39c209f..0de84af 100644 --- a/MxValheim/Patch/Doors.cs +++ b/MxValheim/Patch/Doors.cs @@ -13,20 +13,27 @@ namespace MxValheim.Patch { static void Postfix(Door __instance, Humanoid character, bool hold, bool alt, ZNetView ___m_nview) { - string prefabName = ___m_nview.GetPrefabName(); + ZNetView nview = __instance.GetComponent(); - if (hold || alt || ___m_nview == null || !___m_nview.IsValid()) return; - // Prevent closing of swamp iron gate - if (prefabName == "piece_crypt_door") return; - - // Get state: 0 is closed - int state = ___m_nview.GetZDO().GetInt("state"); - - if (state != 0) + if (nview != null && nview.IsValid()) { - // Start coroutine on the door object itself - __instance.StartCoroutine(CloseDoorAfterDelay(__instance, ___m_nview)); - } + // Get the prefab hash and look up the name in the master list + int prefabHash = nview.GetZDO().GetPrefab(); + string prefabName = ZNetScene.instance.GetPrefab(prefabHash).name; + + if (prefabName == "piece_crypt_door") return; + + if (hold || alt || ___m_nview == null || !___m_nview.IsValid()) return; + + // Get state: 0 is closed + int state = ___m_nview.GetZDO().GetInt("state"); + + if (state != 0) + { + // Start coroutine on the door object itself + __instance.StartCoroutine(CloseDoorAfterDelay(__instance, ___m_nview)); + } + } } static IEnumerator CloseDoorAfterDelay(Door door, ZNetView nview)