bugfix 05/10/26
This commit is contained in:
parent
9690d4d2a1
commit
7a863b07a6
1 changed files with 22 additions and 0 deletions
|
|
@ -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))]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue