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 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(Door __instance, ref ZNetView ___m_nview) { if (!isEnabled.Value) // MODが無効化されている { return; } // ログイン中はインスタンスが取得できないので何もしない Player localPlayer = Player.m_localPlayer; if (localPlayer == null || __instance == null || ___m_nview == null) { return; } String doorName = ___m_nview.GetPrefabName(); int hashCode = ___m_nview.GetHashCode(); if (__instance.m_keyItem != null || // 対象のドアに鍵が必要 (disableAutomaticDoorOpenInCrypt.Value && isInsideCrypt) || // プレイヤーがCrypt内にいる !toggleSwitch) // トグルスイッチでMODが無効化されている { return; } // すでにドアが開いているときは一定時間後に閉じる処理を起動 if (___m_nview.GetZDO().GetInt("state", 0) != 0) { if (!coroutinePairs.ContainsKey(hashCode) && // まだコルーチンが起動していない !isInsideCrypt && // プレイヤーがCrypt内にいない !doorName.StartsWith("dungeon_")) // ドアのプレハブ名がdungeon_で始まってない { Coroutine coroutine = ___m_nview.StartCoroutine(AutomaticDoorClose.AutoCloseEnumerator(__instance, ___m_nview)); coroutinePairs[hashCode] = coroutine; } return; } // ドア種別ごとのdistanceサポート float distanceSetting = Utils.GetSettingRangeByDoor(doorName, true); // プレイヤーがドアの範囲内にいる、かつ、初めてプレイヤーが近づいたときにドアを開く float distance = Utils.GetPlayerDistance(__instance.m_doorObject); isAlreadyEnteredDict.TryGetValue(hashCode, out bool result); if (distance <= distanceSetting && !result) { __instance.Interact(localPlayer, false); isAlreadyEnteredDict[hashCode] = true; } else if (distance > distanceSetting) { isAlreadyEnteredDict[hashCode] = false; } }
static bool Prefix(MonsterAI __instance, bool alert) { if (!modEnabled.Value || !alert) { return(true); } if (noMonstersAlerted.Value || neverAlertedList.Contains(ZNetView.GetPrefabName(__instance.gameObject))) { return(false); } return(true); }
private void LoadSpawnStrings() { if (ZNetScene.instance == null) { return; } spawnStrings.Clear(); foreach (GameObject go in Traverse.Create(ZNetScene.instance).Field("m_namedPrefabs").GetValue <Dictionary <int, GameObject> >().Values) { spawnStrings.Add(ZNetView.GetPrefabName(go)); } Dbgl($"Loaded {spawnStrings.Count} strings"); }
static bool Prefix(BaseAI __instance) { if (!modEnabled.Value) { return(true); } if (noMonstersFlee.Value || neverFleeList.Contains(ZNetView.GetPrefabName(__instance.gameObject))) { return(false); } return(true); }
static bool Prefix(BaseAI __instance, ref StaticTarget __result) { if (!modEnabled.Value) { return(true); } if (noBuildingTargeting.Value || noBuildingTargetList.Contains(ZNetView.GetPrefabName(__instance.gameObject))) { __result = null; return(false); } return(true); }
static void Postfix(MonsterAI __instance) { if (!modEnabled.Value) { return; } if (allMonstersTame.Value || defaultTamedList.Contains(ZNetView.GetPrefabName(__instance.gameObject))) { __instance.MakeTame(); } if (allMonstersAvoidFire.Value || avoidFireList.Contains(ZNetView.GetPrefabName(__instance.gameObject))) { __instance.m_avoidFire = true; } if (allMonstersFearFire.Value || fearFireList.Contains(ZNetView.GetPrefabName(__instance.gameObject))) { __instance.m_afraidOfFire = true; } }
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(); tp_list.TryGetValue(temp_zdo, out Minimap.PinData temp_data); Minimap.instance.RemovePin(temp_data); tp_list.Remove(temp_zdo); ZDOMan.instance.ForceSendZDO(temp_zdo.m_uid); } //else //{ // ZRoutedRpc.instance.InvokeRoutedRPC("RequestPortalZDOs", new object[] { new ZPackage() }); //} } } }
static bool Prefix(Destructible __instance, ref HitData hit, ZNetView ___m_nview) { if (___m_nview != null) { if (PrivateArea.CheckInPrivateArea(__instance.transform.position)) { if (configPlantsDamageReduction.Value > 0) { var name = ___m_nview.GetPrefabName().ToLower(); if (name.Contains("carrot") || name.Contains("barley") || name.Contains("turnip") || name.Contains("flax")) { ApplyDamageReduction(ref hit, configPlantsDamageReduction.Value); } } else { ApplyDamageReduction(ref hit, configFloraDamageReduction.Value); } } } return(true); }
private void Update() { if (modEnabled.Value && Player.m_localPlayer != null && AedenthornUtils.CheckKeyHeld(modKey.Value, true) && (AedenthornUtils.CheckKeyDown(deleteKey.Value) || AedenthornUtils.CheckKeyDown(checkKey.Value))) { Dbgl($"modkey {AedenthornUtils.CheckKeyHeld(modKey.Value, true)}, del key {AedenthornUtils.CheckKeyDown(deleteKey.Value)}, check key {AedenthornUtils.CheckKeyDown(checkKey.Value)}"); LayerMask layerMask = LayerMask.GetMask(layerMaskString.Value.Split(',')); RaycastHit raycastHit; if (Physics.Raycast(GameCamera.instance.transform.position, GameCamera.instance.transform.forward, out raycastHit, maxDeleteDistance.Value) && Vector3.Distance(raycastHit.point, Player.m_localPlayer.m_eye.position) < maxDeleteDistance.Value) { Transform t = raycastHit.collider.transform; while (t.parent.parent && t.parent.name != "_NetSceneRoot" && !t.name.Contains("(Clone)")) { Dbgl($"name: {t.name}, parent name: {t.parent.name}"); t = t.parent; } string name = ZNetView.GetPrefabName(t.gameObject); if (AedenthornUtils.CheckKeyDown(checkKey.Value)) { Player.m_localPlayer.Message(MessageHud.MessageType.Center, string.Format(checkMessage.Value, name, Vector3.Distance(raycastHit.point, Player.m_localPlayer.m_eye.position))); return; } else if (t.GetComponent <ZNetView>()) { t.GetComponent <ZNetView>().Destroy(); } else { Destroy(t.gameObject); } Player.m_localPlayer.Message(MessageHud.MessageType.Center, string.Format(deletedMessage.Value, name, Vector3.Distance(raycastHit.point, Player.m_localPlayer.m_eye.position))); } } }
static void Postfix(ref List <GameObject> __result) { if (Environment.StackTrace.Contains("MineRock") || (Environment.StackTrace.Contains("DropOnDestroyed") && dropTableObject.Contains("Rock"))) { Dictionary <string, List <GameObject> > typeLootDict = new Dictionary <string, List <GameObject> >(); foreach (GameObject go in __result) { if (go == null) { continue; } if (!typeLootDict.ContainsKey(go.name)) { typeLootDict.Add(go.name, new List <GameObject>()); } typeLootDict[go.name].Add(go); } foreach (var kvp in typeLootDict) { string name = ZNetView.GetPrefabName(kvp.Value[0]); int count = kvp.Value.Count; if (kvp.Key == "Stone") { count = Mathf.RoundToInt(count * stoneDropMult.Value); } else if (kvp.Key.EndsWith("Ore")) { count = Mathf.RoundToInt(count * oreDropMult.Value); } Dbgl($"loot drop had {kvp.Value.Count} {kvp.Value} - changed amount to {count}"); if (kvp.Value.Count < count) { for (int i = kvp.Value.Count; i < count; i++) { __result.Add(kvp.Value[0]); } } else if (count < kvp.Value.Count) { for (int i = count; i < kvp.Value.Count; i++) { __result.Remove(kvp.Value[i]); } } } if (UnityEngine.Random.value < rubyDropChance.Value) { GameObject go = ZNetScene.instance.GetPrefab("Ruby"); __result.Add(go); } if (UnityEngine.Random.value < amberDropChance.Value) { GameObject go = ZNetScene.instance.GetPrefab("Amber"); __result.Add(go); } if (UnityEngine.Random.value < amberPearlDropChance.Value) { GameObject go = ZNetScene.instance.GetPrefab("AmberPearl"); __result.Add(go); } } }
private static GameObject GetCustomGameObject(string name, bool ready = false) { CustomItem customItem = customItems[name]; GameObject baseObject = ObjectDB.instance.GetItemPrefab(customItem.baseItemName); GameObject customObject; ItemDrop itemDrop; creatingObject = true; if (ready) { customObject = Instantiate(baseObject); itemDrop = customObject.GetComponent <ItemDrop>(); } else { customObject = new GameObject(name); itemDrop = customObject.AddComponent <ItemDrop>(); customObject.AddComponent(baseObject.GetComponent <ZNetView>()); if (baseObject.transform.Find("attach")) { Dbgl($"Has attach"); Instantiate(baseObject.transform.Find("attach"), customObject.transform); } else if (baseObject.transform.Find("model")) { Dbgl($"Has model"); Instantiate(baseObject.transform.Find("model"), customObject.transform); } } creatingObject = false; ItemDrop baseItemDrop = baseObject.GetComponent <ItemDrop>(); customObject.name = name; customObject.name = ZNetView.GetPrefabName(customObject); objectsToAdd[customObject.name] = customObject; customObject.AddComponent <DontDestroy>(); customItems[name].gameObject = customObject; DontDestroyOnLoad(customItems[name].gameObject); Dbgl($"baseitemdrop {baseItemDrop?.name} data {baseItemDrop.m_itemData.m_shared.m_name} customObject {customObject?.name}"); GameObject prefab = Instantiate(objectsToAdd[customObject.name]); DontDestroyOnLoad(prefab); itemDrop.m_itemData = baseItemDrop.m_itemData.Clone(); itemDrop.m_itemData.m_dropPrefab = prefab; itemDrop.enabled = true; Dbgl($"itemdrop {itemDrop.m_itemData.m_dropPrefab.name} data {itemDrop.m_itemData.m_shared.m_name} gameobject {itemDrop.gameObject.name}"); itemDrop.m_itemData.m_shared = new ItemDrop.ItemData.SharedData { m_name = "$" + customItem.name_key, m_dlc = customItem.dlc, m_itemType = customItem.itemType, m_attachOverride = customItem.attachOverride, m_description = "$" + customItem.description_key, m_maxStackSize = customItem.maxStackSize, m_maxQuality = customItem.maxQuality, m_weight = customItem.weight, m_value = customItem.value, m_teleportable = customItem.teleportable, m_questItem = customItem.questItem, m_equipDuration = customItem.equipDuration, m_variants = customItem.variants, m_trophyPos = customItem.trophyPos, m_buildPieces = customItem.buildPieces, m_centerCamera = customItem.centerCamera, m_setName = customItem.setName, m_setSize = customItem.setSize, m_setStatusEffect = customItem.setStatusEffect, m_equipStatusEffect = customItem.equipStatusEffect, m_movementModifier = customItem.movementModifier, m_food = customItem.food, m_foodStamina = customItem.foodStamina, m_foodBurnTime = customItem.foodBurnTime, m_foodRegen = customItem.foodRegen, m_foodColor = customItem.foodColor, m_armorMaterial = customItem.armorMaterial, m_helmetHideHair = customItem.helmetHideHair, m_armor = customItem.armor, m_armorPerLevel = customItem.armorPerLevel, m_damageModifiers = customItem.damageModifiers, m_blockPower = customItem.blockPower, m_blockPowerPerLevel = customItem.blockPowerPerLevel, m_deflectionForce = customItem.deflectionForce, m_deflectionForcePerLevel = customItem.deflectionForcePerLevel, m_timedBlockBonus = customItem.timedBlockBonus, m_animationState = customItem.animationState, m_skillType = customItem.skillType, m_toolTier = customItem.toolTier, m_damages = customItem.damages, m_damagesPerLevel = customItem.damagesPerLevel, m_attackForce = customItem.attackForce, m_backstabBonus = customItem.backstabBonus, m_dodgeable = customItem.dodgeable, m_blockable = customItem.blockable, m_attackStatusEffect = customItem.attackStatusEffect, m_spawnOnHit = customItem.spawnOnHit, m_spawnOnHitTerrain = customItem.spawnOnHitTerrain, m_attack = customItem.attack, m_secondaryAttack = customItem.secondaryAttack, m_useDurability = customItem.useDurability, m_destroyBroken = customItem.destroyBroken, m_canBeReparied = customItem.canBeReparied, m_maxDurability = customItem.maxDurability, m_durabilityPerLevel = customItem.durabilityPerLevel, m_useDurabilityDrain = customItem.useDurabilityDrain, m_durabilityDrain = customItem.durabilityDrain, m_holdDurationMin = customItem.holdDurationMin, m_holdStaminaDrain = customItem.holdStaminaDrain, m_holdAnimationState = customItem.holdAnimationState, m_ammoType = customItem.ammoType, m_aiAttackRange = customItem.aiAttackRange, m_aiAttackRangeMin = customItem.aiAttackRangeMin, m_aiAttackInterval = customItem.aiAttackInterval, m_aiAttackMaxAngle = customItem.aiAttackMaxAngle, m_aiWhenFlying = customItem.aiWhenFlying, m_aiWhenWalking = customItem.aiWhenWalking, m_aiWhenSwiming = customItem.aiWhenSwiming, m_aiPrioritized = customItem.aiPrioritized, m_aiTargetType = customItem.aiTargetType, m_hitEffect = customItem.hitEffect, m_hitTerrainEffect = customItem.hitTerrainEffect, m_blockEffect = customItem.blockEffect, m_startEffect = customItem.startEffect, m_holdStartEffect = customItem.holdStartEffect, m_triggerEffect = customItem.triggerEffect, m_trailStartEffect = customItem.trailStartEffect, m_consumeStatusEffect = customItem.consumeStatusEffect, m_icons = baseItemDrop.m_itemData.m_shared.m_icons }; Recipe origRecipe = ObjectDB.instance.GetRecipe(baseItemDrop.m_itemData); Recipe recipe = (Recipe)ScriptableObject.CreateInstance("Recipe"); recipe.m_item = itemDrop; recipe.m_amount = customItem.recipe_amount; recipe.m_minStationLevel = customItem.minStationLevel; recipe.m_craftingStation = origRecipe.m_craftingStation; recipe.m_repairStation = origRecipe.m_repairStation; //Dbgl($"custom reqs {customItem.requirements.Count}"); List <Piece.Requirement> reqs = new List <Piece.Requirement>(); foreach (string str in customItem.requirements) { RequirementData rd = MakeReqData(str); if (rd == null) { continue; } Piece.Requirement req = new Piece.Requirement { m_amount = rd.amount, m_amountPerLevel = rd.amountPerLevel, m_recover = rd.recover, m_resItem = ObjectDB.instance.GetItemPrefab(rd.name)?.GetComponent <ItemDrop>() }; // Dbgl($"adding rd {req.m_resItem?.m_itemData?.m_shared?.m_name}"); reqs.Add(req); } recipe.m_resources = reqs.ToArray(); if (ObjectDB.instance.GetItemPrefab(customObject.name) == null) { Dbgl($"Adding item {customObject.name} to DB"); ObjectDB.instance.m_items.Add(objectsToAdd[customObject.name]); ((Dictionary <int, GameObject>) typeof(ObjectDB).GetField("m_itemByHash", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(ObjectDB.instance)).Add(customObject.name.GetStableHashCode(), objectsToAdd[customObject.name]); Dbgl($"Added new item {ObjectDB.instance.GetItemPrefab(customObject.name).name} to DB"); } if (ObjectDB.instance.GetRecipe(itemDrop.m_itemData) == null) { Dbgl($"Adding recipe {customObject.name} to DB"); ObjectDB.instance.m_recipes.Add(recipe); } return(customObject); }
// Token: 0x060010A8 RID: 4264 RVA: 0x0007686C File Offset: 0x00074A6C public int GetHash() { return(ZNetView.GetPrefabName(base.gameObject).GetStableHashCode()); }
public string GetPrefabName() { return(ZNetView.GetPrefabName(((Component)this).get_gameObject())); }
// Token: 0x060008A5 RID: 2213 RVA: 0x0004219F File Offset: 0x0004039F public string GetPrefabName() { return(ZNetView.GetPrefabName(base.gameObject)); }
static void Postfix(BaseAI __instance, ref Character __result) { if (!modEnabled.Value) { return; } //Dbgl($"{__instance.name} finding target player {__result?.IsPlayer()} cancel {noMonstersTargetPlayers.Value}"); if (__result?.IsPlayer() == true && (noMonstersTargetPlayers.Value || neverTargetPlayersList.Contains(ZNetView.GetPrefabName(__instance.gameObject)))) { __result = null; } }
// Token: 0x06000252 RID: 594 RVA: 0x00012D64 File Offset: 0x00010F64 private void Procreate() { if (!this.m_nview.IsValid() || !this.m_nview.IsOwner()) { return; } if (!this.m_character.IsTamed()) { return; } if (this.m_offspringPrefab == null) { string prefabName = ZNetView.GetPrefabName(this.m_offspring); this.m_offspringPrefab = ZNetScene.instance.GetPrefab(prefabName); int prefab = this.m_nview.GetZDO().GetPrefab(); this.m_myPrefab = ZNetScene.instance.GetPrefab(prefab); } if (this.IsPregnant()) { if (this.IsDue()) { this.ResetPregnancy(); GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(this.m_offspringPrefab, base.transform.position - base.transform.forward * this.m_spawnOffset, Quaternion.LookRotation(-base.transform.forward, Vector3.up)); Character component = gameObject.GetComponent <Character>(); if (component) { component.SetTamed(this.m_character.IsTamed()); component.SetLevel(Mathf.Max(this.m_minOffspringLevel, this.m_character.GetLevel())); } this.m_birthEffects.Create(gameObject.transform.position, Quaternion.identity, null, 1f); return; } } else { if (UnityEngine.Random.value <= this.m_pregnancyChance) { return; } if (this.m_baseAI.IsAlerted()) { return; } if (this.m_tameable.IsHungry()) { return; } int nrOfInstances = SpawnSystem.GetNrOfInstances(this.m_myPrefab, base.transform.position, this.m_totalCheckRange, false, false); int nrOfInstances2 = SpawnSystem.GetNrOfInstances(this.m_offspringPrefab, base.transform.position, this.m_totalCheckRange, false, false); if (nrOfInstances + nrOfInstances2 >= this.m_maxCreatures) { return; } if (SpawnSystem.GetNrOfInstances(this.m_myPrefab, base.transform.position, this.m_partnerCheckRange, false, true) < 2) { return; } this.m_loveEffects.Create(base.transform.position, Quaternion.identity, null, 1f); int num = this.m_nview.GetZDO().GetInt("lovePoints", 0); num++; this.m_nview.GetZDO().Set("lovePoints", num); if (num >= this.m_requiredLovePoints) { this.m_nview.GetZDO().Set("lovePoints", 0); this.MakePregnant(); } } }
static bool Prefix(MonsterAI __instance, Character attacker) { if (!modEnabled.Value) { return(true); } //Dbgl($"{__instance.name} setting target player {attacker.IsPlayer()} cancel {noMonstersTargetPlayers.Value}"); if (attacker?.IsPlayer() == true && (noMonstersTargetPlayers.Value || neverTargetPlayersList.Contains(ZNetView.GetPrefabName(__instance.gameObject)))) { return(false); } return(true); }
public static void Postfix(ref Console __instance) { string[] part = __instance.m_input.text.Trim().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); if (part.Length <= 0) { return; } if (part[0].StartsWith("/")) { part[0] = part[0].Substring(1); } if (part[0] == "help") { __instance.Print("countterrain [radius=max] - count nearby terrain modifications"); __instance.Print("resetterrain [radius=" + Settings.resetRadius.Value + "] [type] - remove nearby terrain modifications"); __instance.Print("undoreset - restore removed terrain modifications"); __instance.Print("debugterrain - visualize terrain modifications"); __instance.Print("debugstrength [new strength] - visualization strength"); __instance.Print("debugdistance [new distance] - visualization distance"); } else if (part[0] == "countterrain") { float radius = float.PositiveInfinity; if (part.Length > 1) { if (!float.TryParse(part[1], out radius)) { __instance.Print("Could not parse radius: " + part[1]); return; } } if (Player.m_localPlayer != null) { Vector3 playerPos = Player.m_localPlayer.transform.position; TerrainModifier[] mods = TerrainModifier.GetAllInstances().Where(x => x != null && x.m_playerModifiction && Utils.DistanceXZ(playerPos, x.transform.position) <= radius ).ToArray(); int levelCount = mods.Where(x => x != null && x.m_level).Count(); int smoothCount = mods.Where(x => x != null && x.m_smooth).Count(); int paintCount = mods.Where(x => x != null && x.m_paintCleared && !x.m_level && !x.m_smooth).Count(); __instance.Print("Counted " + mods.Length + " terrain modifications"); __instance.Print(levelCount + " level modifications"); __instance.Print(smoothCount + " smooth modifications"); __instance.Print(paintCount + " paint modifications"); } else { __instance.Print("This command only works in game"); } } else if (part[0] == "resetterrain") { float radius = Settings.resetRadius.Value; TerrainType type = TerrainType.all; if (part.Length > 1) { if (!float.TryParse(part[1], out radius)) { __instance.Print("Could not parse radius: " + part[1]); return; } } if (part.Length > 2) { if (!Enum.TryParse(part[2].ToLowerInvariant(), out type) || int.TryParse(part[2], out _)) { __instance.Print("Could not parse type: " + part[2]); return; } } if (Player.m_localPlayer != null) { Vector3 playerPos = Player.m_localPlayer.transform.position; TerrainModifier[] mods = TerrainModifier.GetAllInstances().Where(x => x != null && x.m_playerModifiction && Utils.DistanceXZ(playerPos, x.transform.position) <= radius && (type != TerrainType.level || x.m_level) && (type != TerrainType.smooth || x.m_smooth) && (type != TerrainType.paint || (x.m_paintCleared && !x.m_level && !x.m_smooth)) ).ToArray(); TerrainModifier[] mods2 = mods.Where(x => x != null && m_nview(x) != null && m_nview(x).IsValid() && m_nview(x).IsOwner()).ToArray(); List <RestoreData> restoreData = new List <RestoreData>(); foreach (TerrainModifier mod in mods2) { restoreData.Add(new RestoreData(mod.transform.position, ZNetScene.instance.GetPrefab(ZNetView.GetPrefabName(mod.gameObject)), mod.GetCreationTime())); ZNetScene.instance.Destroy(mod.gameObject); } if (restoreData.Count > 0 && Settings.restoreMax.Value > 0) { restoreInfo.Add(restoreData.ToArray()); while (restoreData.Count > Settings.restoreMax.Value) { restoreData.RemoveAt(0); } } __instance.Print("Removed " + mods2.Length + " terrain modifications"); if (mods2.Length < mods.Length) { __instance.Print("Could not remove " + (mods.Length - mods2.Length) + " terrain mods due to ownership"); } } else { __instance.Print("This command only works in game"); } } else if (part[0] == "undoreset") { if (restoreInfo.Count > 0) { RestoreData[] restoreData = restoreInfo.Last(); restoreInfo.Remove(restoreData); int restored = 0; foreach (RestoreData data in restoreData) { GameObject instance = UnityEngine.Object.Instantiate(data.prefab, data.position, Quaternion.identity); ZNetView view = instance.GetComponent <ZNetView>(); view.GetZDO().m_timeCreated = data.creationTime; restored++; } __instance.Print("Restored " + restored + " terrain modifiers"); } else { __instance.Print("No available restore data"); } } else if (part[0] == "debugterrain") { if (DebugToggle(out int count)) { __instance.Print((debugTerrain ? "Enabled" : "Disabled") + " lights on " + count + " terrain modifications"); } else { __instance.Print("This command only works in game"); } } else if (part[0] == "debugstrength") { if (part.Length > 1) { if (float.TryParse(part[1], out float strength)) { Settings.lightStrength.Value = strength; __instance.Print("Light strength set to " + strength); } else { __instance.Print("Could not parse intensity: " + part[1]); } } else { __instance.Print("Current light strength is " + Settings.lightStrength.Value); } } else if (part[0] == "debugdistance") { if (part.Length > 1) { if (float.TryParse(part[1], out float distance)) { Settings.lightDistance.Value = distance; __instance.Print("Light distance set to " + distance); } else { __instance.Print("Could not parse distance: " + part[1]); } } else { __instance.Print("Current light distance is " + Settings.lightDistance.Value); } } }