/// <summary> Initialize the helper </summary> public void Initialize() { if (allomancyTree == null) { // The entity doesn't have any allomantic properties registered, so we add them. Entity.WatchedAttributes.SetAttribute("allomancy", allomancyTree = new TreeAttribute()); allomancyTree.SetAttribute("powers", new TreeAttribute()); allomancyTree.SetAttribute("metals", new TreeAttribute()); allomancyTree.SetAttribute("status", new TreeAttribute()); allomancyTree.SetAttribute("toggle", new TreeAttribute()); allomancyTree.SetString("selectedMetal", "none"); allomancyTree.SetFloat("pewterFatigue", 0); // Make the entity a random misting. string chosenPower = MistModSystem.METALS[RNG.Next(0, MistModSystem.METALS.Length)]; AllomanticPowers.SetBool(chosenPower, true); Entity.WatchedAttributes.MarkPathDirty("allomancy"); return; } }
/// <summary> Set a specific allomantic power for this entity </summary> /// <param id="metal"> The name of the metal power to be set </param> public void SetPower(string metal, bool value) { AllomanticPowers.SetBool(metal, value); Entity.WatchedAttributes.MarkPathDirty("allomancy"); }