(1.5.1) KillFeed World Fix + Auto Door Fix

This commit is contained in:
mikx
2026-02-04 15:51:00 -05:00
parent 0310e52867
commit ba2091d6f9
3 changed files with 22 additions and 13 deletions

View File

@@ -24,6 +24,8 @@ namespace MxValheim.KillFeed
ZNet zn = new ZNet();
if (zn.IsDedicated()) return;
if (attacker == "The World") return;
string finalMsg = (type == 1) ? $"<color=#FF3333>☠</color> {victim} a été tué par {attacker}" :
(type == 2) ? $"{attacker} a tué {victim}" :
$"{attacker} a tué {victim}";

View File

@@ -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<bool> Config_Locked;
public static ConfigEntry<int> Config_OreMultiplier;

View File

@@ -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<ZNetView>();
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)