public static void CheckTreeHatred(GameObject treeLogObject) { TreeLog treeLog = treeLogObject.GetComponent <TreeLog>(); Player player = Player.GetClosestPlayer(treeLog.transform.position, 20f); if (!player) { return; } TreeHatredLevel level = GetTreeHatredLevel(player); if (level != null) { Debug.Log(string.Format("A{1} {0} tree is seeking vengence!", level.description, "aeiouAEIOU".IndexOf(level.description) >= 0 ? "n" : "")); VengefulTree vengefulTree = treeLogObject.AddComponent <VengefulTree>(); vengefulTree.player = player; // Give it some fat 5x loot treeLog.m_dropWhenDestroyed.m_dropMin *= 5; treeLog.m_dropWhenDestroyed.m_dropMax *= 5; // Don't let it get stuck in the stump, move it up a bit treeLog.transform.position = treeLog.transform.position + .5f * Vector3.up; // Drop the velocity applied by the axe hit Rigidbody rigidbody = treeLog.GetComponent <Rigidbody>(); rigidbody.ResetInertiaTensor(); vengefulTree.StartCoroutine(vengefulTree.SeekVengence(forceMultiplier * level.force, level.duration)); } }
public void AddTreeLog(TreeLog x) { using (var context = new MonkeyDbContext()) { context.TreeLogs.Add(x); context.SaveChanges(); } }
static bool Prefix(TreeLog __instance, ref HitData hit, ZNetView ___m_nview) { if (___m_nview != null) { if (PrivateArea.CheckInPrivateArea(__instance.transform.position)) { ApplyDamageReduction(ref hit, configFloraDamageReduction.Value); } } return(true); }
private static bool Prefix(ref TreeLog __instance, ref long sender, ref HitData hit) { if (VACPlugin.AntiParams_IsEnabled.Value) { if (VACPlugin.debugmode.Value) { ZLog.LogWarning("Damage to TreeBase"); } return(Damage_Rule.Execute(hit)); } else { return(true); } }
public static void Prefix(TreeLog __instance, HitData hit) { if (WorldofValheimZones.ServerMode) { return; } if (Util.RestrictionCheck("nodamagetotrees")) { float multiplier = 0f; hit.m_damage.m_damage *= multiplier; hit.m_damage.m_blunt *= multiplier; hit.m_damage.m_slash *= multiplier; hit.m_damage.m_pierce *= multiplier; hit.m_damage.m_chop *= multiplier; hit.m_damage.m_pickaxe *= multiplier; hit.m_damage.m_fire *= multiplier; hit.m_damage.m_frost *= multiplier; hit.m_damage.m_lightning *= multiplier; hit.m_damage.m_poison *= multiplier; hit.m_damage.m_spirit *= multiplier; Util.DoAreaEffect(Player.m_localPlayer.transform.position + Vector3.up * 0.5f); MessageHud.instance.ShowMessage(MessageHud.MessageType.TopLeft, "This is a Private Area", 0, null); } else if (Util.RestrictionCheck("damagemultipliertotrees")) { float multiplier = Util.RestrictionCheckFloatReturn("damagemultipliertotrees"); hit.m_damage.m_damage *= multiplier; hit.m_damage.m_blunt *= multiplier; hit.m_damage.m_slash *= multiplier; hit.m_damage.m_pierce *= multiplier; hit.m_damage.m_chop *= multiplier; hit.m_damage.m_pickaxe *= multiplier; hit.m_damage.m_fire *= multiplier; hit.m_damage.m_frost *= multiplier; hit.m_damage.m_lightning *= multiplier; hit.m_damage.m_poison *= multiplier; hit.m_damage.m_spirit *= multiplier; } }
private static void SetLink(TreeLog __instance) { CreateLink(__instance.m_dropWhenDestroyed, __instance.gameObject); }
private void MainForm_Shown(object sender, EventArgs e) { TreeLog.ExpandAll(); // This method seems to have no affect during contructor or Activated event }