bugfix 05/10/26

This commit is contained in:
Ferdinando 2026-10-05 11:39:38 +02:00
commit 7a863b07a6

View file

@ -29,6 +29,28 @@ namespace RacesOfValheim
return thrall != null && thrall.m_commandingRace == SvermConfig.RaceId;
}
// ── The nest is immune to its own brood ──────────────────────────────
/// <summary>A Sverm troop, or a tick one of them hatched: anything the colony itself put on the field.</summary>
private static bool IsColonyMember(Character attacker)
{
if (attacker == null) return false;
return IsSvermTroop(attacker) || attacker.GetComponent<SvermGjallTickLife>() != null;
}
// RPC_Damage and not Damage: that is where the hit lands on the piece's owner, whoever threw it.
// A raid is where it showed - bombs, ticks' bursts and troop swings all go through here.
[HarmonyPatch(typeof(WearNTear), "RPC_Damage")]
public static class Sverm_Nest_BroodImmunity_Patch
{
public static bool Prefix(WearNTear __instance, HitData hit)
{
if (hit == null || __instance.GetComponent<SvermHiveBehaviour>() == null) return true;
return !IsColonyMember(hit.GetAttacker());
}
}
// ── Friendly fire ────────────────────────────────────────────────────
[HarmonyPatch(typeof(Projectile), nameof(Projectile.Setup))]