private void ZNetView_Awake(ZNetView self) { if (_isModEnabled.Value && (ZNetView.m_forceDisableInit || ZDOMan.instance == null)) { Logger.LogWarning($"ZNetView of {self.name} will self-destruct"); } }
public static void Postfix(bool picked, ZNetView ___m_nview, bool ___m_picked, ref PickState __state) { if (__state.picked == ___m_picked) { ___m_nview.GetZDO().Set("picked_time", __state.picked_time); } }
private void UndoSpawn() { Debug.Log("Easyspawner: Undo spawn action"); if (spawnActions.Count <= 0) { return; } List <GameObject> spawnedGameObjects = spawnActions.Pop(); Debug.Log("Easyspawner: Destroying " + spawnedGameObjects.Count + " objects"); string objectName = "objects"; foreach (GameObject GO in spawnedGameObjects) { if (GO != null) { objectName = GO.name.Remove(GO.name.Length - 7); ZNetView zNetV = GO.GetComponent <ZNetView>(); if (zNetV && zNetV.IsValid() && zNetV.IsOwner()) { zNetV.Destroy(); } } } Player.m_localPlayer.Message(MessageHud.MessageType.Center, "Undo spawn of " + spawnedGameObjects.Count + " " + objectName); Debug.Log("Easyspawner: Spawn undone"); }
static void Postfix(CookingStation __instance, ZNetView ___m_nview) { if (!modEnabled.Value || !___m_nview.IsValid() || !___m_nview.IsOwner() || !EffectArea.IsPointInsideArea(__instance.transform.position, EffectArea.Type.Burning, 0.25f)) { return; } for (int i = 0; i < __instance.m_slots.Length; i++) { string itemName = ___m_nview.GetZDO().GetString("slot" + i, ""); float num = ___m_nview.GetZDO().GetFloat("slot" + i, 0f); if (itemName != "" && itemName != __instance.m_overCookedItem.name && itemName != null) { CookingStation.ItemConversion itemConversion = Traverse.Create(__instance).Method("GetItemConversion", new object[] { itemName }).GetValue <CookingStation.ItemConversion>(); if (num > itemConversion.m_cookTime && itemName == itemConversion.m_to.name) { if (autoPop.Value) { Traverse.Create(__instance).Method("SpawnItem", new object[] { itemName }).GetValue(); ___m_nview.GetZDO().Set("slot" + i, ""); ___m_nview.GetZDO().Set("slot" + i, 0f); ___m_nview.InvokeRPC(ZNetView.Everybody, "SetSlotVisual", new object[] { i, "" }); } else if (preventBurning.Value) { ___m_nview.GetZDO().Set("slot" + i, itemConversion.m_cookTime); } } } } }
static void Postfix(Container __instance, ZNetView ___m_nview) { if ((__instance.name.StartsWith("piece_chest") || __instance.name.StartsWith("Container")) && __instance.GetInventory() != null) { containerList.Add(__instance); } }
// Token: 0x06000E98 RID: 3736 RVA: 0x00068730 File Offset: 0x00066930 private void SetSpawned(bool doSpawn) { if (!doSpawn) { base.gameObject.SetActive(false); using (List <ZNetView> .Enumerator enumerator = this.m_childNetViews.GetEnumerator()) { while (enumerator.MoveNext()) { ZNetView znetView = enumerator.Current; znetView.gameObject.SetActive(false); } goto IL_62; } } if (this.m_nview == null) { base.gameObject.SetActive(true); } IL_62: if (this.m_OffObject != null) { this.m_OffObject.SetActive(!doSpawn); } }
public static void DeleteTMod(TerrainModifier modifier) { ZNetView znview = modifier.gameObject.GetComponent <ZNetView>(); if (!znview || znview.GetZDO() == null) { return; } bool has_copy = false; foreach (ZDO item in zdos_to_save) { if (item.m_uid == znview.GetZDO().m_uid) { has_copy = true; break; } } if (!has_copy) { zdos_to_save.Add(znview.GetZDO().Clone()); } modifier.enabled = false; znview.ClaimOwnership(); if (!new string[3] { "mud_road(Clone)", "digg(Clone)", "path(Clone)" }.Contains(modifier.name)) { Debug.LogWarning("Deleting " + modifier.name); } Debug.Log("Deleting " + modifier.name); ZNetScene.instance.Destroy(modifier.gameObject); }
static void Prefix(ref HitData hit, ZNetView ___m_nview, Piece ___m_piece) { if (!modEnabled.Value) { return; } damaging = true; //Dbgl($"attacker: {hit.m_attacker.userID}, creator { ___m_nview.IsOwner()}"); if (!hit.m_attacker.IsNone()) { if (___m_piece.GetCreator() == 0) { lastMult = uncreatedDamageMult.Value; } else if (hit.m_attacker.userID == ___m_piece.GetCreator()) { lastMult = creatorDamageMult.Value; } else { lastMult = nonCreatorDamageMult.Value; } } else { lastMult = naturalDamageMult.Value; } MultiplyDamage(ref hit, lastMult); }
// Token: 0x06000E57 RID: 3671 RVA: 0x00066910 File Offset: 0x00064B10 private void Grow() { if (this.m_status != Plant.Status.Healthy) { if (this.m_destroyIfCantGrow) { this.Destroy(); } return; } GameObject original = this.m_grownPrefabs[UnityEngine.Random.Range(0, this.m_grownPrefabs.Length)]; Quaternion quaternion = Quaternion.Euler(0f, UnityEngine.Random.Range(0f, 360f), 0f); GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(original, base.transform.position, quaternion); ZNetView component = gameObject.GetComponent <ZNetView>(); float num = UnityEngine.Random.Range(this.m_minScale, this.m_maxScale); component.SetLocalScale(new Vector3(num, num, num)); TreeBase component2 = gameObject.GetComponent <TreeBase>(); if (component2) { component2.Grow(); } this.m_nview.Destroy(); this.m_growEffect.Create(base.transform.position, quaternion, null, num); }
static void Postfix(ZNetView ___m_nview) { if (Time.time - m_callHomeKeyTimer < m_callHomeKeyDelay) { return; } if (Input.GetKey(m_callHomeKey)) { Common.Dbgl($"CallHome command"); m_callHomeKeyTimer = Time.time; ___m_nview.InvokeRPC(ZNetView.Everybody, Constants.Z_CallHomeCommand, Player.m_localPlayer.transform.position); var charsInRange = new List <Character>(); var m_nview = typeof(Character).GetField("m_nview", BindingFlags.Instance | BindingFlags.NonPublic); Character.GetCharactersInRange(Player.m_localPlayer.transform.position, 190, charsInRange); foreach (var character in charsInRange) { var nview = m_nview.GetValue(character) as ZNetView; var uniqueId = nview.GetZDO().GetString(Constants.Z_CharacterId); if (MobManager.IsAliveMob(uniqueId)) { MobManager.AliveMobs[uniqueId].Follow(Player.m_localPlayer); } } } }
private void Start() { var prefab = this.gameObject; ZNetView znv = prefab.GetComponent <ZNetView>(); ZDO zdo = prefab.GetComponent <ZNetView>().GetZDO(); DestroyImmediate(prefab.GetComponent <ZNetView>()); DestroyImmediate(prefab.GetComponent <ZSyncAnimation>()); DestroyImmediate(prefab.GetComponent <ZSyncTransform>()); DestroyImmediate(prefab.GetComponent <MonsterAI>()); DestroyImmediate(prefab.GetComponent <VisEquipment>()); DestroyImmediate(prefab.GetComponent <CharacterDrop>()); DestroyImmediate(prefab.GetComponent <Humanoid>()); DestroyImmediate(prefab.GetComponent <FootStep>()); DestroyImmediate(prefab.GetComponent <Rigidbody>()); foreach (var comp in gameObject.GetComponents <Component>()) { if (!(comp is Transform) && !(comp is OdinShaman) && !(comp is CapsuleCollider)) { DestroyImmediate(comp); } } var a = Traverse.Create(ZNetScene.instance).Field <Dictionary <ZDO, ZNetView> >("m_instances").Value; a.Remove(zdo); ZDOMan.instance.DestroyZDO(zdo); prefab.gameObject.transform.Rotate(0, 30f, 0); }
static void Postfix(ZNetView ___m_nview) { if (___m_nview.IsValid()) { ___m_nview.Register <Vector3>(Constants.Z_CallHomeCommand, RPC_CallHome); } }
// Token: 0x06000887 RID: 2183 RVA: 0x00041908 File Offset: 0x0003FB08 private void RemoveObjects(List <ZDO> currentNearObjects, List <ZDO> currentDistantObjects) { int frameCount = Time.frameCount; foreach (ZDO zdo in currentNearObjects) { zdo.m_tempRemoveEarmark = frameCount; } foreach (ZDO zdo2 in currentDistantObjects) { zdo2.m_tempRemoveEarmark = frameCount; } this.m_tempRemoved.Clear(); foreach (ZNetView znetView in this.m_instances.Values) { if (znetView.GetZDO().m_tempRemoveEarmark != frameCount) { this.m_tempRemoved.Add(znetView); } } for (int i = 0; i < this.m_tempRemoved.Count; i++) { ZNetView znetView2 = this.m_tempRemoved[i]; ZDO zdo3 = znetView2.GetZDO(); znetView2.ResetZDO(); UnityEngine.Object.Destroy(znetView2.gameObject); if (!zdo3.m_persistent && zdo3.IsOwner()) { ZDOMan.instance.DestroyZDO(zdo3); } this.m_instances.Remove(zdo3); } }
private static IEnumerator DropNow(Ragdoll ragdoll, ZNetView nview, EffectList removeEffect) { if (dropDelay.Value < 0) { context.StartCoroutine(DestroyNow(ragdoll, nview, removeEffect)); yield break; } Dbgl($"delaying dropping loot"); yield return(new WaitForSeconds(dropDelay.Value)); if (!modEnabled.Value) { yield break; } if (!nview.IsValid() || !nview.IsOwner()) { context.StartCoroutine(DropNow(ragdoll, nview, removeEffect)); yield break; } Dbgl($"dropping loot"); Vector3 averageBodyPosition = ragdoll.GetAverageBodyPosition(); Traverse.Create(ragdoll).Method("SpawnLoot", new object[] { averageBodyPosition }).GetValue(); context.StartCoroutine(DestroyNow(ragdoll, nview, removeEffect)); }
public static void Postfix(ref Character __instance, ref ZNetView ___m_nview) { var zdo = ___m_nview.GetZDO(); if (zdo == null) { return; } var customName = zdo.GetString($"{Plugin.GUID}-name"); var customTamed = zdo.GetBool($"{Plugin.GUID}-tamed"); if (customName.Length > 0) { __instance.m_name = customName; } if (customTamed) { //Log.Info($"Add tamed character -> {customName}"); var humanoid = __instance.GetComponent <Humanoid>(); humanoid.m_faction = Character.Faction.Players; tamedCharacters.Add(__instance); Prefab.SetTameable(___m_nview, __instance.gameObject); __instance.m_name = Prefab.GetTamedName(customName, true); } }
public static bool Prefix(Player __instance) { long playerID = __instance.GetPlayerID(); HardcoreData hardcoreProfile = Hardcore.GetHardcoreDataForProfileID(playerID); if (hardcoreProfile != null && hardcoreProfile.isHardcore) { hardcoreProfile.hasDied = true; Traverse tPlayer = Traverse.Create(__instance); tPlayer.Field <bool>("m_firstSpawn").Value = true; ZNetView nview = tPlayer.Field <ZNetView>("m_nview").Value; nview.GetZDO().Set("dead", true); nview.InvokeRPC(ZNetView.Everybody, "OnDeath", Array.Empty <object>()); tPlayer.Method("CreateDeathEffects").GetValue(new object[] { }); tPlayer.Field <GameObject>("m_visual").Value.SetActive(false); tPlayer.Field <List <Player.Food> >("m_foods").Value.Clear(); __instance.UnequipAllItems(); __instance.GetInventory().RemoveAll(); if (Hardcore.Settings.ClearCustomSpawn.Value) { Game.instance.GetPlayerProfile().ClearCustomSpawnPoint(); } Game.instance.RequestRespawn(10f); Gogan.LogEvent("Game", "Death", "biome: " + __instance.GetCurrentBiome().ToString(), 0L); return(false); } return(true); }
/// <summary> /// Registers a new prefab that's an empty primitive, with just a ZNetView component /// </summary> /// <param name="name"></param> /// <returns></returns> public GameObject CreatePrefab(string name) { if (string.IsNullOrEmpty(name)) { Debug.LogError("Failed to create prefab with invalid name: " + name); return(null); } if (GetPrefab(name)) { Debug.LogError("Failed to create prefab, name already exists: " + name); return(null); } GameObject prefab = GameObject.CreatePrimitive(PrimitiveType.Cube); prefab.name = name; prefab.transform.parent = PrefabContainer.transform; // Add ZNetView and make prefabs persistent by default ZNetView newView = prefab.AddComponent <ZNetView>(); newView.m_persistent = true; Prefabs.Add(name, prefab); return(prefab); }
private void Awake() { m_nview = gameObject.GetComponent <ZNetView>(); m_container = gameObject.GetComponent <Container>(); var zdo = m_nview.GetZDO(); if (Placing) { zdo.Set("QuestID", m_id); zdo.Set("QuestSphy", m_sphy); zdo.Set("QuestOwener", m_ownerName); return; } else { m_id = zdo.GetString("QuestID", "public"); m_sphy = zdo.GetBool("QuestSphy", true); m_ownerName = zdo.GetString("QuestOwener", "public"); } if (!m_sphy) { DestroyImmediate(this.GetComponent <StaticPhysics>()); } /* if (ZNet.instance.IsServer() && ZNet.instance.IsDedicated()) * { * Destroy(gameObject); * } */ }
private void Awake() { //add m_nview = GetComponent <ZNetView>(); if (m_nview.GetZDO() == null) { DBG.blogWarning("Mark Report zdo null"); return; } if (m_nview.GetZDO().GetBool("LocMarkUsed", false)) { MarkList.Remove(ID); Destroy(this); return; } else { ID = ZoneSystem.instance.GetZone(transform.position).Pak(); if (MarkList.ContainsKey(ID)) { DubList.Add(ID, this); } else { MarkList.Add(ID, this); } DBG.blogInfo("locmark placed at zone : " + ID); } }
/// <summary> /// Prefix which returns false every time to skip the original method and other prefixes so that we're not /// needlessly setting fuel value twice /// </summary> /// <param name="__instance"></param> /// <param name="___m_nview"></param> /// <returns>false</returns> private static bool Prefix(ref Fireplace __instance, ref ZNetView ___m_nview) { if (!__instance.m_nview.IsValid()) { return(false); // don't run other prefixes or original } if (__instance.m_nview.IsOwner()) { if (Configuration.Current.Fireplace.IsEnabled) { FireplaceExtension.ApplyFuel(__instance, ref ___m_nview); } else { // original method float num1 = __instance.m_nview.GetZDO().GetFloat("fuel"); double timeSinceLastUpdate = __instance.GetTimeSinceLastUpdate(); if (__instance.IsBurning()) { float num2 = (float)timeSinceLastUpdate / __instance.m_secPerFuel; float num3 = num1 - num2; if ((double)num3 <= 0.0) { num3 = 0.0f; } __instance.m_nview.GetZDO().Set("fuel", num3); } } } __instance.UpdateState(); return(false); // don't run other prefixes or original }
public void Awake() { if (m_forceDisableInit) { Object.Destroy(this); return; } if (!originalPiece) { InvalidPlanPiece(); return; } //logger.LogInfo("Prefab loaded for " + name + " -> " + originalPrefab.name); DisablePiece(gameObject); //logger.LogInfo("PlanPiece awake: " + gameObject.GetInstanceID()); m_wearNTear = GetComponent <WearNTear>(); m_nView = GetComponent <ZNetView>(); if (m_nView.IsOwner()) { m_nView.GetZDO().Set("support", 0f); } m_nView.Register <bool>("Refund", RPC_Refund); m_nView.Register <string, int>("AddResource", RPC_AddResource); m_nView.Register("SpawnPieceAndDestroy", RPC_SpawnPieceAndDestroy); UpdateHoverText(); }
static void Prefix(ZNetView ___m_nview) { if (___m_nview) { if (___m_nview.GetPrefabName() == "portal_wood") { if (ZNet.instance.IsServer()) { ZDO temp_zdo = ___m_nview.GetZDO(); Minimap.PinData temp_data = Minimap.instance.AddPin(___m_nview.transform.position, portal_pin_type, GetLocalizedString(configPortalNamePrefix.Value) + "unnamed", false, false); tp_list.Add(temp_zdo, temp_data); ZDOMan.instance.ForceSendZDO(temp_zdo.m_uid); } else { ZDO temp_zdo = ___m_nview.GetZDO(); var list = (List <int>)GetInstanceField(ZDOMan.instance, "m_peers"); logger.LogWarning("portal placed "); logger.LogWarning("m_peers count: " + list.Count); ZDOMan.instance.ForceSendZDO(temp_zdo.m_uid); //ZRoutedRpc.instance.InvokeRoutedRPC("RequestPortalZDOs", new object[] { new ZPackage() }); } } } }
public static void Prefix(float v, Player __instance, ZNetView ___m_nview) { try { var progress = ___m_nview.GetZDO().GetFloat("hearty_progress", 0f); //adjust the amount by the multiplier progress += v; if (progress > skillGainIncrement.Value) { var ratio = progress / __instance.GetMaxStamina(); __instance.RaiseSkill((Skills.SkillType)SKILL_TYPE, ratio * configSkillIncrease.Value); ___m_nview.GetZDO().Set("hearty_progress", 0f); } else { ___m_nview.GetZDO().Set("hearty_progress", progress); } } catch (Exception e) { Debug.LogError("[Zomb Hearty] Failed to augement hearty skill."); Debug.LogError(e.ToString()); } }
public static IEnumerator AutoCloseEnumerator(Door __instance, ZNetView ___m_nview) { while (true) { // 一定時間待機 yield return(new WaitForSeconds(0.2f)); if (!toggleSwitch) // トグルスイッチでMODが無効化されている { coroutinePairs.Remove(___m_nview.GetHashCode()); yield break; } // ドア種別ごとの設定値 String doorName = ___m_nview.GetPrefabName(); float distanceSetting = Utils.GetSettingRangeByDoor(doorName, false); // プレイヤーとの距離を取得し、指定された範囲より離れているときはドアを閉じる float distance = Utils.GetPlayerDistance(__instance.m_doorObject); if (distance > distanceSetting) { yield return(new WaitForSeconds(waitForDoorToCloseSeconds.Value)); ___m_nview.GetZDO().Set("state", 0); coroutinePairs.Remove(___m_nview.GetHashCode()); yield break; } } }
private static void Postfix( ref Character __instance, ref ZNetView ___m_nview ) { var name = __instance.m_name; if (name == "Dvorah") { var prefab = ZNetScene.instance.GetPrefab("MiniSquito"); var rotation = Quaternion.Euler(0.0f, UnityEngine.Random.Range(0.0f, 360f), 0.0f); var vector3 = UnityEngine.Random.insideUnitSphere * 6f; vector3.y = 2f; var gameObject = UnityEngine.Object.Instantiate <GameObject>(prefab, __instance.transform.localPosition + vector3, rotation); var gameObject2 = UnityEngine.Object.Instantiate <GameObject>(prefab, __instance.transform.localPosition + vector3, rotation); var insideUnitSphere = UnityEngine.Random.insideUnitSphere; if ((double)insideUnitSphere.y < 0.0) { insideUnitSphere.y = -insideUnitSphere.y; } gameObject.GetComponent <Rigidbody>().AddForce(insideUnitSphere * 2f, (ForceMode)2); gameObject.GetComponent <Character>().SetLevel(1); gameObject.GetComponent <Tameable>().Tame(); gameObject2.GetComponent <Rigidbody>().AddForce(insideUnitSphere * 2f, (ForceMode)2); gameObject2.GetComponent <Character>().SetLevel(1); gameObject2.GetComponent <Tameable>().Tame(); } else { return; } }
static void Postfix(Bed __instance, ref string __result, ZNetView ___m_nview) { if (__instance.IsMine() && (___m_nview.GetZDO().GetLong("owner", 0L) != 0) || Traverse.Create(__instance).Method("IsCurrent").GetValue <bool>()) { __result += Localization.instance.Localize($"\n[<color=yellow><b>P</b></color>] Set hearthstone"); } }
static void Postfix(Container __instance, ZNetView ___m_nview) { if (!isOn.Value || !__instance.IsOwner()) { return; } Vector3 position = __instance.transform.position + Vector3.up; foreach (Collider collider in Physics.OverlapSphere(position, ContainerRange(__instance), LayerMask.GetMask(new string[] { "item" }))) { if (collider?.attachedRigidbody) { ItemDrop item = collider.attachedRigidbody.GetComponent <ItemDrop>(); //Dbgl($"nearby item name: {item.m_itemData.m_dropPrefab.name}"); if (item?.GetComponent <ZNetView>()?.IsValid() != true) { continue; } if (DisallowItem(__instance, item.m_itemData)) { continue; } Dbgl($"auto storing {item.m_itemData.m_dropPrefab.name} from ground"); while (item.m_itemData.m_stack > 1 && __instance.GetInventory().CanAddItem(item.m_itemData, 1)) { item.m_itemData.m_stack--; Traverse.Create(item).Method("Save").GetValue(); ItemDrop.ItemData newItem = item.m_itemData.Clone(); newItem.m_stack = 1; __instance.GetInventory().AddItem(newItem); typeof(Container).GetMethod("Save", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(__instance, new object[] { }); typeof(Inventory).GetMethod("Changed", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(__instance.GetInventory(), new object[] { }); } if (item.m_itemData.m_stack == 1 && __instance.GetInventory().CanAddItem(item.m_itemData, 1)) { ItemDrop.ItemData newItem = item.m_itemData.Clone(); item.m_itemData.m_stack = 0; Traverse.Create(item).Method("Save").GetValue(); if (___m_nview.GetZDO() == null) { DestroyImmediate(item.gameObject); } else { ZNetScene.instance.Destroy(item.gameObject); } __instance.GetInventory().AddItem(newItem); typeof(Container).GetMethod("Save", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(__instance, new object[] { }); typeof(Inventory).GetMethod("Changed", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(__instance.GetInventory(), new object[] { }); } } } }
private void Awake() { this.m_myIndex = ItemDrop.m_instances.Count; ItemDrop.m_instances.Add(this); GameObject itemPrefab = ObjectDB.instance.GetItemPrefab(this.GetPrefabName(this.gameObject.name)); this.m_itemData.m_dropPrefab = itemPrefab; if (Application.isEditor) { this.m_itemData.m_shared = itemPrefab.GetComponent <ItemDrop>().m_itemData.m_shared; } Rigidbody component = this.GetComponent <Rigidbody>(); if ((bool)(UnityEngine.Object)component) { component.set_maxDepenetrationVelocity(1f); } this.m_spawnTime = Time.time; this.m_nview = this.GetComponent <ZNetView>(); if (!(bool)(UnityEngine.Object) this.m_nview || !this.m_nview.IsValid()) { return; } if (this.m_nview.IsOwner() && new DateTime(this.m_nview.GetZDO().GetLong("SpawnTime", 0L)).Ticks == 0L) { this.m_nview.GetZDO().Set("SpawnTime", ZNet.instance.GetTime().Ticks); } this.m_nview.Register("RequestOwn", new Action <long>(this.RPC_RequestOwn)); this.Load(); this.InvokeRepeating("SlowUpdate", UnityEngine.Random.Range(1f, 2f), 10f); }
/// <summary> /// Create a new prefab from an empty primitive. /// </summary> /// <param name="name">The name of the new GameObject</param> /// <param name="addZNetView" > /// When true a ZNetView component is added to the new GameObject for ZDO generation and networking. Default: true /// </param> /// <returns>The newly created empty prefab</returns> public GameObject CreateEmptyPrefab(string name, bool addZNetView = true) { if (string.IsNullOrEmpty(name)) { Logger.LogWarning($"Failed to create prefab with invalid name: {name}"); return(null); } if (GetPrefab(name)) { Logger.LogWarning($"Failed to create prefab, name already exists: {name}"); return(null); } GameObject prefab = GameObject.CreatePrimitive(PrimitiveType.Cube); prefab.name = name; prefab.transform.parent = PrefabContainer.transform; if (addZNetView) { // Add ZNetView and make prefabs persistent by default ZNetView newView = prefab.AddComponent <ZNetView>(); newView.m_persistent = true; } return(prefab); }
public static Tameable SetTameable(ZNetView znview, GameObject go) { if (go.GetComponent <MonsterAI>() == null) { Log.Warning(go.name + " is not tamable"); return(null); } Tameable tame; if (!go.TryGetComponent(out tame)) { tame = go.AddComponent <Tameable>(); } var tameable = ZNetScene.instance.GetPrefab("Wolf").GetComponent <Tameable>(); tame.m_petEffect = tameable.m_petEffect; tame.m_tamingTime = tameable.m_tamingTime; tame.m_commandable = tameable.m_commandable; tame.m_fedDuration = tameable.m_fedDuration; tame.m_tamedEffect = tameable.m_tamedEffect; tame.m_sootheEffect = tameable.m_sootheEffect; return(tame); }