private static void Postfix(ref Door __instance, ZNetView ___m_nview) { if (!AutomaticDoorModPlugin.isEnabled.Value || // when mod is disabled __instance.m_keyItem != null || // when target door needs keyItem (e.g. CryptKey) isInsideCrypt || // when player is in Crypt !toggleSwitch) // when a player manually disables a mod { return; } IEnumerator enumerator = DoorCloseDelay(AutomaticDoorModPlugin.waitForDoorToCloseSeconds.Value, () => { ___m_nview.GetZDO().Set("state", 0); }); ___m_nview.StopAllCoroutines(); ___m_nview.StartCoroutine(enumerator); }