From 4b95e705e74031c60eb97714f4545890192b49c8 Mon Sep 17 00:00:00 2001 From: Ferdinando Date: Fri, 21 Aug 2026 11:22:52 +0200 Subject: [PATCH] warvulture --- JotunnModStub/Package/manifest.json | 4 +- JotunnModStub/RaceMenuWard.cs | 8 +- JotunnModStub/RacesOfValheim.cs | 29 +- JotunnModStub/Trenta/TrentaComposter.cs | 1 + JotunnModStub/Trenta/TrentaConfig.cs | 59 ++++ .../Trenta/TrentaConfigManagement.cs | 19 ++ JotunnModStub/Trenta/TrentaElderRoot.cs | 306 ++++++++++++++++++ JotunnModStub/Trenta/TrentaRace.cs | 1 + README.md | 3 +- 9 files changed, 418 insertions(+), 12 deletions(-) create mode 100644 JotunnModStub/Trenta/TrentaElderRoot.cs diff --git a/JotunnModStub/Package/manifest.json b/JotunnModStub/Package/manifest.json index 7ae2ba9..91e2556 100644 --- a/JotunnModStub/Package/manifest.json +++ b/JotunnModStub/Package/manifest.json @@ -1,7 +1,7 @@ { "name": "RacesOfValheim", - "description": "A Valheim mod that adds nine custom playable races (Aswid, Draugh, Dvergar, Fenrir, Furling, Skadi, Skeleton, Trenta, Trol) each with unique abilities, traits, and a deep boss-driven progression system.", - "version_number": "1.4.0", + "description": "A Valheim mod that adds ten custom playable races (Aswid, Draugh, Dvergar, Fenrir, Furling, Skadi, Skeleton, Sverm, Trenta, Trol) each with unique abilities, traits, race stations and a deep boss-driven progression system.", + "version_number": "1.4.6", "website_url": "", "dependencies": [ "denikson-BepInExPack_Valheim-5.4.2333", diff --git a/JotunnModStub/RaceMenuWard.cs b/JotunnModStub/RaceMenuWard.cs index 59c6201..b564d26 100644 --- a/JotunnModStub/RaceMenuWard.cs +++ b/JotunnModStub/RaceMenuWard.cs @@ -280,12 +280,18 @@ namespace RacesOfValheim Refresh(); }); - AddButton("ResetBtn", "Reset Race", new Vector2(0, -110), new Color(0.5f, 0.25f, 0.2f, 1f), () => + AddButton("ResetRaceBtn", "Reset Race", new Vector2(-170, -110), new Color(0.5f, 0.25f, 0.2f, 1f), () => { Close(); RacesOfValheim.ResetRace(); }); + AddButton("ResetProgressionBtn", "Reset Progression", new Vector2(170, -110), new Color(0.5f, 0.4f, 0.2f, 1f), () => + { + RacesOfValheim.ResetProgression(); + Refresh(); + }); + AddButton("CloseBtn", "Close", new Vector2(0, -200), new Color(0.3f, 0.3f, 0.3f, 1f), Close); GUIManager.BlockInput(true); diff --git a/JotunnModStub/RacesOfValheim.cs b/JotunnModStub/RacesOfValheim.cs index 5bed9da..f74d342 100644 --- a/JotunnModStub/RacesOfValheim.cs +++ b/JotunnModStub/RacesOfValheim.cs @@ -15,7 +15,7 @@ namespace RacesOfValheim { public const string PluginGUID = "com.nandor.racesofvalheim"; public const string PluginName = "Races Of Valheim"; - public const string PluginVersion = "1.4.5"; + public const string PluginVersion = "1.4.6"; private readonly Harmony harmony = new Harmony(PluginGUID); @@ -123,6 +123,25 @@ namespace RacesOfValheim } } + /// + /// Clears the boss-progression override and falls back to the natural world state. + /// Shared by the resetprogression console command and the Race Menu Ward. + /// + public static int ResetProgression() + { + BossProgressionManager.DebugState = -1; + int state = BossProgressionManager.GetCurrentProgressionState(); + + Player player = Player.m_localPlayer; + if (player != null) + { + player.Message(MessageHud.MessageType.Center, $"Progression reset to: {state}"); + Traverse.Create(player).Method("SetupEquipment").GetValue(); + } + + return state; + } + /// /// Strips whatever body-part weapon the outgoing race grew. The Aswid/Fenrir claws /// (RaceClawSet) and the Sverm's Chitin Claws (SvermClawSlot) are quest items a player can @@ -1238,14 +1257,8 @@ namespace RacesOfValheim public override void Run(string[] args) { - BossProgressionManager.DebugState = -1; - int state = BossProgressionManager.GetCurrentProgressionState(); + int state = RacesOfValheim.ResetProgression(); Console.instance.Print($"[DEBUG] Progression state reset to natural world state: {state}"); - if (Player.m_localPlayer != null) - { - Player.m_localPlayer.Message(MessageHud.MessageType.Center, $"Progression reset to: {state}"); - Traverse.Create(Player.m_localPlayer).Method("SetupEquipment").GetValue(); - } } } } diff --git a/JotunnModStub/Trenta/TrentaComposter.cs b/JotunnModStub/Trenta/TrentaComposter.cs index b245c2e..92ddd18 100644 --- a/JotunnModStub/Trenta/TrentaComposter.cs +++ b/JotunnModStub/Trenta/TrentaComposter.cs @@ -461,6 +461,7 @@ namespace RacesOfValheim if (__instance != Player.m_localPlayer) return; TrentaComposter.EnsureKnown(__instance); TrentaHeartwoodGrove.EnsureKnown(__instance); + TrentaElderRoot.EnsureKnown(__instance); FurlingCrops.EnsureKnown(__instance); } } diff --git a/JotunnModStub/Trenta/TrentaConfig.cs b/JotunnModStub/Trenta/TrentaConfig.cs index a44b93c..f395a6e 100644 --- a/JotunnModStub/Trenta/TrentaConfig.cs +++ b/JotunnModStub/Trenta/TrentaConfig.cs @@ -444,6 +444,65 @@ namespace RacesOfValheim public static readonly Color RotSeedTint = new Color(0.16f, 0.12f, 0.08f, 1f); + // ─── Root of the Elder (item progression, defensive) ────────────────── + // Race-locked, hammer-only, permanent: a piece that heals itself and, once a minute, heals + // every player-built thing within reach of it too. Full design in Trenta_ElderRoot.txt. + // + // No crafting station, same reasoning as the Composter/Grove chain's own station-free entry + // point would need if it had one: this is a race identity piece, not a purchase from + // someone else's bench (see the War Totem's own note on the same choice). + public const string ElderRootPieceName = "TrentaElderRoot"; + public const string ElderRootDisplayName = "Root of the Elder"; + + public const int ElderRootUnlockState = 3; // The Elder dead + + public const string ElderRootRecipeGuck = "Guck"; + public const int ElderRootRecipeGuckAmount = 5; + public const string ElderRootRecipeFineWood = "FineWood"; + public const int ElderRootRecipeFineWoodAmount = 10; + + // Source of the borrowed model - swamp scenery, already safe to strip under ModelBorrow's + // rules (no MonoBehaviour worth stripping in the first place, unlike a living prefab). + // THE ELDER'S SUMMONED ROOT - the thing that claws its way out of the ground and attacks + // whoever comes near during the boss fight. Verified by its path in manifest_extended: + // Assets/Characters/Greydwarf_king/TentaRoot + // "Assets/Characters/..." means CREATURE (the same path convention Trol_WarTotem.txt sez. + // 2.1 wrote down after the GoblinTotem item/piece mix-up), and "Greydwarf_king" is The + // Elder. Its whole kit sits in the same folder - misc/spawn_roots (the emergence), + // misc/tentaroot_attack, animation/tentaroot, fx_tentaroot_death, sfx_tentaroot_attack. + // The Mistlands Staff of Green Roots summons the same creature (staff_greenroots_tentaroot), + // which is the second confirmation that this is a summon and not decoration. + // + // TWO WRONG PICKS BEFORE THIS ONE, both found by searching the manifest for a word instead + // of asking what the boss actually spawns: + // "Vines" - unrelated swamp scenery, inert. + // "gdking_root_projectile" - the spike the Elder SHOOTS. A projectile/vfx, not the + // summon. Still correctly used further down for Muspell's + // ranged attack, which is what it really is. + // + // BORROWING FROM THIS IS NOT LIKE BORROWING SCENERY: it carries a Character, and + // ModelBorrow strips in a single pass, which is the exact shape of the bug that once broke + // the hammer for every piece in the game. TrentaElderRoot.ResolveModelSource walks to the + // "Visual" child first - the same thing FenrirRace and SkadiRace do for their forms - so + // no Character is ever handed to ModelBorrow. + public const string ElderRootModelSourcePrefab = "TentaRoot"; + + /// Child of a creature prefab that holds only mesh and animator, no Character. + public const string CreatureVisualChildName = "Visual"; + + // Height in metres of the borrowed model's largest dimension. NOT a guess any more: the + // mesh measures (0.48, 4.51, 0.47) at native size - a tall, thin root - and the first two + // tries in game (1.2 then 1.6) both came out about 70% too short. 2.7 m is roughly 60% of + // the creature's own height and stands a good head above the player. + public const float ElderRootModelSize = 2.7f; + + // Forward to TrentaConfigManagement (BepInEx ConfigEntry) - see that class. + public static float ElderRootHealth => TrentaConfigManagement.ElderRootHealth.Value; + public static float ElderRootSelfHealDelay => TrentaConfigManagement.ElderRootSelfHealDelay.Value; + public static float ElderRootSelfHealPercentPerSecond => TrentaConfigManagement.ElderRootSelfHealPercentPerSecond.Value; + public static float ElderRootRepairRadius => TrentaConfigManagement.ElderRootRepairRadius.Value; + public static float ElderRootRepairInterval => TrentaConfigManagement.ElderRootRepairInterval.Value; + // ─── Heartwood Grove (item progression, tier 2) ────────────────────── // Plant a seed, wait, and the tree that comes up fertilises what surrounds it, stings what // approaches it, and fills a chest with honey. Three independent functions on one piece. diff --git a/JotunnModStub/Trenta/TrentaConfigManagement.cs b/JotunnModStub/Trenta/TrentaConfigManagement.cs index 6b058b3..081a808 100644 --- a/JotunnModStub/Trenta/TrentaConfigManagement.cs +++ b/JotunnModStub/Trenta/TrentaConfigManagement.cs @@ -50,6 +50,13 @@ namespace RacesOfValheim public static ConfigEntry LastStandMaxArmorBonus; public static ConfigEntry ThornsReflectPercent; + // ─── Root of the Elder (tier 3+, defensive piece) ───────────────────── + public static ConfigEntry ElderRootHealth; + public static ConfigEntry ElderRootSelfHealDelay; + public static ConfigEntry ElderRootSelfHealPercentPerSecond; + public static ConfigEntry ElderRootRepairRadius; + public static ConfigEntry ElderRootRepairInterval; + // ─── Homecoming Portal (tier 6+) ────────────────────────────────────── public static ConfigEntry PortalCooldown; public static ConfigEntry PortalLifetime; @@ -113,6 +120,18 @@ namespace RacesOfValheim ThornsReflectPercent = config.Bind(lastStand, "Thorns Reflect Percent", 0.2f, new ConfigDescription("Fraction of every hit taken reflected back at the attacker, tier 5+.", new AcceptableValueRange(0f, 1f))); + const string elderRoot = "Trenta - Root of the Elder"; + ElderRootHealth = config.Bind(elderRoot, "Health", 300f, + new ConfigDescription("Max structural health of the piece itself.", new AcceptableValueRange(50f, 2000f))); + ElderRootSelfHealDelay = config.Bind(elderRoot, "Self-Heal Delay", 10f, + new ConfigDescription("Seconds without taking a hit before the piece starts healing itself.", new AcceptableValueRange(0f, 60f))); + ElderRootSelfHealPercentPerSecond = config.Bind(elderRoot, "Self-Heal Percent Per Second", 0.02f, + new ConfigDescription("Fraction of max health regained per second once healing starts.", new AcceptableValueRange(0f, 1f))); + ElderRootRepairRadius = config.Bind(elderRoot, "Repair Radius", 5f, + new ConfigDescription("Meters from the piece within which every player-built thing gets repaired.", new AcceptableValueRange(1f, 30f))); + ElderRootRepairInterval = config.Bind(elderRoot, "Repair Interval", 60f, + new ConfigDescription("Seconds between repair pulses.", new AcceptableValueRange(5f, 600f))); + const string portal = "Trenta - Homecoming Portal"; PortalCooldown = config.Bind(portal, "Cooldown", 300f, new ConfigDescription("Seconds between casts, tier 6+.", new AcceptableValueRange(0f, 3600f))); diff --git a/JotunnModStub/Trenta/TrentaElderRoot.cs b/JotunnModStub/Trenta/TrentaElderRoot.cs new file mode 100644 index 0000000..5f0fba8 --- /dev/null +++ b/JotunnModStub/Trenta/TrentaElderRoot.cs @@ -0,0 +1,306 @@ +using HarmonyLib; +using Jotunn.Configs; +using Jotunn.Entities; +using Jotunn.Managers; +using UnityEngine; + +namespace RacesOfValheim +{ + /// + /// The Trenta's defensive piece: a gnarled root left over from the Elder, permanent once + /// planted, that heals itself and, once a minute, heals everything a player built within reach + /// of it too. + /// + /// Full design in Trenta_ElderRoot.txt. Two facts from that document matter for reading this + /// file: + /// + /// - WearNTear.Repair() and WearNTear.ApplyDamage(float, HitData) are both read from IL, not + /// guessed. Repair() is the same full-heal-and-broadcast the hammer itself uses. + /// ApplyDamage subtracts its float argument from current health and broadcasts the result - + /// a NEGATIVE amount heals, which is how the self-heal below works without a second RPC. + /// - Piece.IsPlacedByPlayer() is the filter, copied from Sverm/SvermWorker.cs (the mod's own + /// precedent for "heal player buildings in a radius"). Without it this piece would also try + /// to mend ruins, troll-cave walls and any other scenery that happens to carry a WearNTear. + /// + /// The clone base and the strip pattern are TrolTotem's, unchanged: piece_workbench is a real + /// Piece (unlike the item-prefab trap that piece's own file documents), stripped to + /// Piece/ZNetView/WearNTear and given a borrowed look instead of the bench's own mesh. + /// + public static class TrentaElderRoot + { + public static void Register() + { + GameObject prefab = PrefabManager.Instance.CreateClonedPrefab( + TrentaConfig.ElderRootPieceName, "piece_workbench"); + if (prefab == null) + { + Jotunn.Logger.LogWarning("[Trenta] Could not clone piece_workbench; the Root of the Elder is not registered."); + return; + } + + // Strip the workbench down to a placeable shell: no station, no crafting, no furniture. + // The look comes from the borrowed Vines model below. + foreach (MonoBehaviour behaviour in prefab.GetComponentsInChildren(true)) + { + if (behaviour == null) continue; + if (behaviour is Piece || behaviour is ZNetView || behaviour is WearNTear) continue; + Object.DestroyImmediate(behaviour); + } + foreach (Renderer renderer in prefab.GetComponentsInChildren(true)) + { + if (renderer != null) renderer.enabled = false; // the bench's own mesh, hidden + } + + AswidBloodRefinery.StripOffensive(prefab, TrentaConfig.ElderRootPieceName); + + GameObject modelSource = ResolveModelSource(); + if (modelSource != null) + { + ModelBorrow.Attach(prefab.transform, "RootModel", modelSource, + Vector3.zero, Quaternion.identity, TrentaConfig.ElderRootModelSize, "Trenta"); + } + + // Belt as well as braces, exactly as SvermHive.Register does after its own guard: even + // though ResolveModelSource never hands a Character to ModelBorrow, anything that could + // still act alive comes off the finished piece. This is the line that keeps the + // hammer-breaking failure (see ResolveModelSource) impossible rather than merely + // unlikely. + SvermHive.StripLife(prefab); + + WearNTear wear = prefab.GetComponent(); + if (wear != null) + { + wear.m_health = TrentaConfig.ElderRootHealth; + wear.m_materialType = WearNTear.MaterialType.Wood; + } + + prefab.AddComponent(); + + Sprite icon = BorrowIcon(TrentaConfig.ElderRootRecipeGuck); + + Piece piece = prefab.GetComponent() ?? prefab.AddComponent(); + piece.m_craftingStation = null; + piece.m_resources = new Piece.Requirement[0]; + piece.m_name = TrentaConfig.ElderRootDisplayName; + piece.m_canBeRemoved = true; + piece.m_groundPiece = true; + piece.m_groundOnly = true; + piece.m_icon = icon; + + Piece template = PrefabManager.Cache.GetPrefab("piece_workbench"); + if (template != null && template.m_placeEffect != null) piece.m_placeEffect = template.m_placeEffect; + + PieceManager.Instance.AddPiece(new CustomPiece(prefab, fixReference: false, new PieceConfig + { + Name = TrentaConfig.ElderRootDisplayName, + Description = "What the Elder left behind, still growing. Mends itself, and " + + "everything a player built close enough to it.", + PieceTable = PieceTables.Hammer, + Category = PieceCategories.Crafting, + Icon = icon, + Requirements = new[] + { + new RequirementConfig(TrentaConfig.ElderRootRecipeGuck, TrentaConfig.ElderRootRecipeGuckAmount, 0, true), + new RequirementConfig(TrentaConfig.ElderRootRecipeFineWood, TrentaConfig.ElderRootRecipeFineWoodAmount, 0, true), + } + })); + + Jotunn.Logger.LogInfo($"[Trenta] Registered '{TrentaConfig.ElderRootPieceName}' " + + $"({TrentaConfig.ElderRootDisplayName}) on the hammer's Crafting page."); + } + + /// + /// The model to borrow, with the creature carefully left behind. + /// + /// TentaRoot is a CHARACTER (verified by its manifest path, Assets/Characters/...), and + /// handing a Character to ModelBorrow is the precise bug that once stopped the hammer + /// working for every piece in the game: ModelBorrow strips in ONE pass over + /// GetComponentsInChildren<MonoBehaviour>, and Unity refuses to destroy a component + /// another one still requires - "Can't remove Humanoid because CharacterDrop depends on + /// it". The Humanoid survives, every placement ghost wakes one, and + /// Character.GetCharactersInRange throws inside Player.UpdatePlacementGhost. + /// + /// So the creature is never borrowed from directly. Its "Visual" child is - the node that + /// holds mesh and animator and nothing alive - which is the same route FenrirRace and + /// SkadiRace already take for every one of their transformations. If that child is missing + /// the answer is to attach nothing and say so, NOT to fall back to the creature: an + /// invisible piece is a cosmetic bug, a live Humanoid on a building is a broken hammer. + /// + private static GameObject ResolveModelSource() + { + string sourceName = TrentaConfig.ElderRootModelSourcePrefab; + GameObject source = PrefabManager.Cache.GetPrefab(sourceName); + if (source == null) + { + Jotunn.Logger.LogWarning($"[Trenta] No '{sourceName}' to borrow the Root's model from; " + + "the piece is registered without a model."); + return null; + } + + Transform visual = source.transform.Find(TrentaConfig.CreatureVisualChildName); + if (visual != null) + { + Jotunn.Logger.LogInfo($"[Trenta] Root model taken from '{sourceName}/" + + $"{TrentaConfig.CreatureVisualChildName}' - the creature itself is left alone."); + return visual.gameObject; + } + + // No Visual child. If the prefab is harmless scenery after all we can still use it; + // if it is alive we refuse, loudly, and the piece comes up invisible. + if (SvermHive.IsSafeScenery(source, sourceName)) + { + Jotunn.Logger.LogInfo($"[Trenta] '{sourceName}' has no '{TrentaConfig.CreatureVisualChildName}' " + + "child but carries nothing alive; borrowing from it whole."); + return source; + } + + Jotunn.Logger.LogWarning($"[Trenta] '{sourceName}' is alive and has no " + + $"'{TrentaConfig.CreatureVisualChildName}' child to borrow safely. " + + "The Root is registered WITHOUT a model rather than risking a live " + + "Character on a building - run `dumpelder " + sourceName + "` in the " + + "console to see its real hierarchy and name the right child here."); + return null; + } + + private static Sprite BorrowIcon(string prefabName) + { + ItemDrop drop = PrefabManager.Cache.GetPrefab(prefabName); + Sprite[] icons = drop != null && drop.m_itemData != null && drop.m_itemData.m_shared != null + ? drop.m_itemData.m_shared.m_icons + : null; + return icons != null && icons.Length > 0 ? icons[0] : null; + } + + /// + /// Teaches the piece to the local player. Every dynamically cloned hammer piece in this mod + /// needs this - see the shared OnSpawned postfix in TrentaComposter.cs, which now calls this + /// too. + /// + public static void EnsureKnown(Player player) + { + if (player == null) return; + + GameObject prefab = PrefabManager.Instance.GetPrefab(TrentaConfig.ElderRootPieceName); + Piece piece = prefab != null ? prefab.GetComponent() : null; + if (piece == null) return; + + Traverse traverse = Traverse.Create(player); + traverse.Method("AddKnownPiece", piece).GetValue(); + traverse.Method("UpdateAvailablePiecesList").GetValue(); + } + } + + /// + /// Lives on the placed piece. Two independent jobs, both on the same tick cadence rules as the + /// rest of the mod: no coroutine, just Time.time comparisons in Update. + /// + public class TrentaElderRootBehaviour : MonoBehaviour + { + private WearNTear m_wear; + private float m_lastHitTime = -9999f; + private float m_nextRepairTick; + + private void Start() + { + m_wear = GetComponent(); + if (m_wear != null) m_wear.m_onDamaged += OnHit; + + m_nextRepairTick = Time.time + TrentaConfig.ElderRootRepairInterval; + } + + private void OnDestroy() + { + if (m_wear != null) m_wear.m_onDamaged -= OnHit; + } + + private void OnHit() + { + m_lastHitTime = Time.time; + } + + private void Update() + { + TickSelfHeal(); + + if (Time.time >= m_nextRepairTick) + { + m_nextRepairTick = Time.time + TrentaConfig.ElderRootRepairInterval; + RunRepairPulse(); + } + } + + /// + /// The piece's own regeneration: unhurt for a while, then a fraction of max health back + /// every second. Cannot reuse SkeletonSentryBehaviour - that class heals a Character, and + /// this is a WearNTear, exactly the distinction SkeletonSentry.cs's own header explains for + /// why the Bound Sentry is cloned from a live creature rather than built as a piece. + /// + /// ApplyDamage(float, HitData) has no built-in cap against m_health (read from its IL), so + /// the clamp against the remaining gap happens here, not inside the engine call. + /// + private void TickSelfHeal() + { + if (m_wear == null) return; + ZNetView nview = m_wear.GetComponent(); + if (nview == null || !nview.IsValid() || !nview.IsOwner()) return; + if (Time.time - m_lastHitTime < TrentaConfig.ElderRootSelfHealDelay) return; + + float current = nview.GetZDO().GetFloat(ZDOVars.s_health, m_wear.m_health); + if (current >= m_wear.m_health) return; + + float healThisFrame = TrentaConfig.ElderRootSelfHealPercentPerSecond * m_wear.m_health * Time.deltaTime; + healThisFrame = Mathf.Min(healThisFrame, m_wear.m_health - current); + if (healThisFrame > 0f) m_wear.ApplyDamage(-healThisFrame, null); + } + + /// + /// Everything in range, in one pass - deliberately not the one-piece-per-tick pacing + /// Sverm/SvermWorker.cs uses for the same kind of aura. Kept different on purpose; see + /// Trenta_ElderRoot.txt sez. 4.2 before "fixing" this to match that precedent. + /// + private void RunRepairPulse() + { + foreach (Collider collider in Physics.OverlapSphere(transform.position, TrentaConfig.ElderRootRepairRadius)) + { + if (collider == null) continue; + + WearNTear otherWear = collider.GetComponentInParent(); + if (otherWear == null || otherWear == m_wear) continue; + + Piece piece = otherWear.GetComponent(); + if (piece == null || !piece.IsPlacedByPlayer()) continue; + + otherWear.Repair(); + } + } + } + + /// + /// Race lock plus the boss gate, in one prefix - same shape as TrolTotemRaceLockPatch, with a + /// second refusal added for the progression check the Root also needs. + /// + [HarmonyPatch(typeof(Player), "PlacePiece", + new[] { typeof(Piece), typeof(Vector3), typeof(Quaternion), typeof(bool) })] + public static class TrentaElderRootPlacementPatch + { + public static bool Prefix(Player __instance, Piece __0) + { + if (__instance != Player.m_localPlayer || __0 == null) return true; + if (Utils.GetPrefabName(__0.gameObject) != TrentaConfig.ElderRootPieceName) return true; + + if (!TrentaRace.IsTrenta()) + { + __instance.Message(MessageHud.MessageType.Center, "The root will not take hold for you."); + return false; + } + + if (BossProgressionManager.GetCurrentProgressionState() < TrentaConfig.ElderRootUnlockState) + { + __instance.Message(MessageHud.MessageType.Center, "The Elder has not fallen yet."); + return false; + } + + return true; + } + } +} diff --git a/JotunnModStub/Trenta/TrentaRace.cs b/JotunnModStub/Trenta/TrentaRace.cs index eac4cca..491fe62 100644 --- a/JotunnModStub/Trenta/TrentaRace.cs +++ b/JotunnModStub/Trenta/TrentaRace.cs @@ -34,6 +34,7 @@ namespace RacesOfValheim // before that catalogue is read. TrentaComposter.Register(); TrentaHeartwoodGrove.Register(); + TrentaElderRoot.Register(); } /// diff --git a/README.md b/README.md index bacba17..e39985e 100644 --- a/README.md +++ b/README.md @@ -282,7 +282,7 @@ Every race has a buildable station of its own, gated by a reagent bought from it - **Skadi — Crystal Golem & Bone Cook:** a stonecutter-bound guardian on a leash. Skadi (and Trol) may also build inside any troll cave in the world. The Cook is Skadi's own half of the [Bone Servants](#skeleton--skadi--bone-servants). - **Skeleton — Bound Bone Pile, Bound Sentry & Bone Smith:** pay once per slot and that slot refills itself forever, because an army you re-buy after every fight is one nobody takes out of the house. The Sentry is a bound archer that cannot walk, regenerates when left alone, and hands its parts back when it falls. The Smith is Skeleton and Skadi's shared half of the [Bone Servants](#skeleton--skadi--bone-servants). - **Sverm — Brood Mound & Hive Market:** see [The Colony](#race-progressions-level-by-level). -- **Trenta — Composter & Heartwood Grove:** the Composter rots raw flesh into Fertilizer, which grows any plant on the spot. The Grove is a tree that fertilises what surrounds it, stings what approaches it, and fills a chest with honey. +- **Trenta — Composter, Heartwood Grove & Root of the Elder:** the Composter rots raw flesh into Fertilizer, which grows any plant on the spot. The Grove is a tree that fertilises what surrounds it, stings what approaches it, and fills a chest with honey. The Root is one of the Elder's own summoned roots, planted for good: it knits its own wounds shut, and once a minute it repairs every player-built thing within five meters of it — anyone's, not just the Trenta's. Race locked, and only after the Elder falls. - **Trol — War Totem:** hires warbands of trolls and greydwarves for coin. Race locked — the hammer refuses it to anyone who is not a Trol. A dead warband is money spent. ### Dvergar — Contract Bank @@ -405,6 +405,7 @@ The **Sverm** belongs to no faction. Its Hive Pheromones make every invertebrate ## Changelog ### v1.4.6 +- **NEW - Root of the Elder (Trenta):** one of the Elder's own summoned roots, planted for good instead of fading. Built with the hammer for 5 Guck and 10 Fine Wood once the Elder is down, race locked to the Trenta. It knits its own wounds shut when left alone, and once a minute it repairs **every player-built thing within five meters** — anyone's buildings, not just its owner's. No damage, no armor: the Trenta defends what it has built rather than fighting for it. - **Fix - Race truces in multiplayer:** every race's mob-truce check (Fenrir/wolves, Aswid, Draugh, Trenta, Sverm, and Skadi/Fenrir/Dvergar's Montagna set including the Drake) read the player's race from a local-only field that is never populated for anyone but your own client. On a dedicated server, or whenever another player ended up owning a mob's AI, the check silently failed and the "neutral" mob stayed hostile — this is why Skadi players were seeing Drakes attack them. Both hostility patches now read the race from the ZDO copy that actually replicates over the network, falling back to the local field only when the ZDO isn't available yet. ### v1.4.5