From 5113225981e6ee6dbd6e8b1f272484a6bad93e56 Mon Sep 17 00:00:00 2001 From: Ferdinando Date: Sun, 4 Oct 2026 07:31:16 +0200 Subject: [PATCH] chore(release): v1.5.5 - Sverm Gjall bombs spare the player and the ticks they hatch are tame Co-Authored-By: Claude Sonnet 5.5 --- JotunnModStub/Package/manifest.json | 2 +- JotunnModStub/RacesOfValheim.cs | 2 +- JotunnModStub/Sverm/SvermGjallPatches.cs | 102 +++++++++++++++++++++++ README.md | 9 ++ manifest.json | 2 +- 5 files changed, 114 insertions(+), 3 deletions(-) create mode 100644 JotunnModStub/Sverm/SvermGjallPatches.cs diff --git a/JotunnModStub/Package/manifest.json b/JotunnModStub/Package/manifest.json index d5f4e66..f25edd0 100644 --- a/JotunnModStub/Package/manifest.json +++ b/JotunnModStub/Package/manifest.json @@ -1,7 +1,7 @@ { "name": "RacesOfValheim", "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.5.4", + "version_number": "1.5.5", "website_url": "", "dependencies": [ "denikson-BepInExPack_Valheim-5.4.2333", diff --git a/JotunnModStub/RacesOfValheim.cs b/JotunnModStub/RacesOfValheim.cs index f6ff75c..7d6b88a 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.5.4"; + public const string PluginVersion = "1.5.5"; private readonly Harmony harmony = new Harmony(PluginGUID); diff --git a/JotunnModStub/Sverm/SvermGjallPatches.cs b/JotunnModStub/Sverm/SvermGjallPatches.cs new file mode 100644 index 0000000..0251861 --- /dev/null +++ b/JotunnModStub/Sverm/SvermGjallPatches.cs @@ -0,0 +1,102 @@ +using System.Collections.Generic; +using HarmonyLib; +using UnityEngine; + +namespace RacesOfValheim +{ + /// + /// What a Sverm Gjall's bombs do once they land: no friendly fire, and the ticks they hatch are ours. + /// + /// Two reports in one. The Gjall's bile bomb is an AOE projectile, and Projectile.DoAOE (read off + /// the IL) only spares a victim when m_noDamageFriendly is set on the projectile - the vanilla + /// Gjall never needed it, because nothing it fights has friends. Ours has the player, so a bomb + /// aimed at a turtle killed the player on a boat beside it. And the ticks the bomb spawns + /// (Projectile.SpawnOnHit) are plain wild Ticks, hostile to everyone, the Gjall that threw them + /// included. + /// + /// Both are keyed on the projectile's owner being a Sverm troop (a RaisedThrall that answers to the + /// Sverm race), so a wild Gjall in the Mistlands behaves exactly as before. + /// + public static class SvermGjallPatches + { + /// How long a hatched tick lives. Wild ones never despawn, and ours would pile up. + private const float TickLifetime = 45f; + + private static bool IsSvermTroop(Character owner) + { + if (owner == null) return false; + RaisedThrall thrall = owner.GetComponent(); + return thrall != null && thrall.m_commandingRace == SvermConfig.RaceId; + } + + // ── Friendly fire ──────────────────────────────────────────────────── + + [HarmonyPatch(typeof(Projectile), nameof(Projectile.Setup))] + public static class Sverm_Projectile_Setup_Patch + { + public static void Postfix(Projectile __instance, Character ___m_owner) + { + if (IsSvermTroop(___m_owner)) __instance.m_noDamageFriendly = true; + } + } + + // ── The ticks ──────────────────────────────────────────────────────── + + // Characters that came to life while a Sverm projectile was spawning its payload. Awake has + // run on every component by the time SpawnOnHit returns, which is when they are tamed. + private static bool collecting; + private static readonly List born = new List(); + + [HarmonyPatch(typeof(Projectile), "SpawnOnHit")] + public static class Sverm_Projectile_SpawnOnHit_Patch + { + public static void Prefix(Character ___m_owner) + { + born.Clear(); + collecting = IsSvermTroop(___m_owner); + } + + public static void Postfix() + { + collecting = false; + + foreach (Character spawned in born) + { + if (spawned == null || spawned.IsPlayer() || spawned.IsDead()) continue; + + spawned.SetTamed(true); + spawned.gameObject.AddComponent().m_seconds = TickLifetime; + } + born.Clear(); + } + } + + [HarmonyPatch(typeof(Character), "Awake")] + public static class Sverm_Character_Awake_Patch + { + public static void Postfix(Character __instance) + { + if (collecting) born.Add(__instance); + } + } + } + + /// A tick born of a Sverm Gjall's bomb: tame, and gone after a short while. + public class SvermGjallTickLife : MonoBehaviour + { + public float m_seconds = 45f; + + private void Start() + { + Invoke(nameof(Expire), m_seconds); + } + + private void Expire() + { + ZNetView nview = GetComponent(); + if (nview == null || !nview.IsValid() || !nview.IsOwner()) return; + + ZNetScene.instance.Destroy(gameObject); + } + } +} diff --git a/README.md b/README.md index 76a64b4..c514cc7 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,10 @@ Support the mod: [Patreon — NandorTheModder](https://www.patreon.com/c/NandorT --- +## New in v1.5.5 + +A Sverm Gjall no longer kills you with its own bombs, and the ticks it hatches are on your side. Full details in the [changelog](#v155). + ## New in v1.5.4 Sverm troops no longer crowd you. Following soldiers used to run onto your exact spot, shove each other and push you around, even into the water, and on a boat they drove into the hull and spun it in circles. Each one now keeps its own place around you, and around the hull when you sail. Full details in the [changelog](#v154). @@ -439,6 +443,11 @@ Both halves have an off switch under `Factions` in Configuration Manager: **Fact ## Changelog +### v1.5.5 +- **Fix - a Sverm Gjall's bombs hurt the player:** the Gjall's bile bomb damages everything in its blast unless the projectile is flagged as non-friendly-damaging, which a wild Gjall never needed. A bomb thrown at a turtle killed a player on a boat beside it. Bombs thrown by a Sverm troop now spare the player and the player's tames; wild creatures still take the damage. +- **Fix - the ticks a Sverm Gjall hatches were hostile to everyone:** they were ordinary wild ticks and attacked the player, the tames and the Gjall itself. Ticks hatched by a Sverm Gjall's bomb are now tame, and disappear after 45 seconds. A wild Gjall is unchanged. Thanks to the player who reported it. +- **Not tested in game yet.** + ### v1.5.4 - **Fix - Sverm troops piled onto the player and pushed boats around:** the game sends every follower to the exact spot where you stand and stops it three metres away, so a squad of three converged on one point, shoved each other and shoved you, in one report into the water. On a boat your spot is on the deck, so they drove into the hull and spun the ship in circles. Each troop now has its own place, about 4 m behind you and fanned out from the others, and only walks back to it once it has drifted 3 m away, so it stands still instead of shuffling. While you are on a ship the places lie on a ring 5 m outside the hull. Past 30 m from you a troop stops following and goes home to its nest. Thralls, the Aswid's thralls and skeletons keep the game's own following. Thanks to the player who reported it. - **Not tested in game yet:** the distances are estimates, and `SvermConfig` holds them if they need tuning. diff --git a/manifest.json b/manifest.json index d5f4e66..f25edd0 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "name": "RacesOfValheim", "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.5.4", + "version_number": "1.5.5", "website_url": "", "dependencies": [ "denikson-BepInExPack_Valheim-5.4.2333",