| 12345678910111213141516171819202122232425262728293031323334353637 |
- using System;
- using System.Collections;
- using GadgetCore.API;
- using HarmonyLib;
- using UnityEngine;
- namespace PlatformBlock.Patches
- {
- [HarmonyPatch(typeof(KylockeStand))]
- [HarmonyPatch("Awake")]
- [HarmonyGadget("PlatformBlock")]
- 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, -5.99f, 0.19f), instance.transform.rotation, 0));
- obj.GetComponent<KylockeStand>().GetComponent<NetworkView>().RPC("Set", RPCMode.AllBuffered, new object[] { new int[] { Core.itemPlatformId, 1000 } });
- }
- }
- yield break;
- }
- }
- }
|