using System; using System.Collections; using GadgetCore.API; using HarmonyLib; using UnityEngine; namespace AncientReassembler.Patches { [HarmonyPatch(typeof(KylockeStand))] [HarmonyPatch("Awake")] [HarmonyGadget("AncientReassembler")] public static class Patch_KylockeStand_Awake { [HarmonyPrefix] public static void Prefix(KylockeStand __instance) { __instance.StartCoroutine(Patch_KylockeStand_Awake.WaitAndCreate(__instance)); } private static IEnumerator WaitAndCreate(KylockeStand instance) { if (instance.itemID == 2403) { while (!Network.isServer && !Network.isClient) { yield return new WaitForSeconds(0f); } if (Network.isServer) { var obj = ((GameObject)Network.Instantiate(Resources.Load("npc/buildStand"), new Vector3(-250f + 4, -5.99f, 0.19f), instance.transform.rotation, 0)); obj.GetComponent().GetComponent().RPC("Set", RPCMode.AllBuffered, new object[] { new int[] { Core.itemAncientReassemblerId, 1000 } }); } } yield break; } } }