feat(dvergar): add Fire Construct base-defense piece (Mountain faction feature)

Stationary Hammer piece cloned from DvergerMageFire: scans a configurable
radius for hostile, non-Mountain-faction, non-player Characters and fires its
own fireball (real attack data pulled off Humanoid.m_defaultItems, grounded in
an in-game dumpelder dump, not guessed).

Fire-only for this first pass; Ice/Support are a later append to the same
pattern. Several in-game fixes along the way: a missing piece icon (Jotunn
silently drops any piece without one), a missing known-piece teach on spawn
(same fix RaceMenuWard already needed), a kinematic Rigidbody fighting
Character's own velocity writes, and MonsterAI needing to be disabled rather
than destroyed - several vanilla systems (EnemyHud, most likely damage
registration too) assume any combat-relevant Character has one.

FactionHostilityPatch gains a public IsMountainFactionMob accessor so the
construct's target filter shares the same Mountain roster as the rest of
Factions instead of a second hand-maintained list.
This commit is contained in:
kanym 2026-08-07 08:23:04 +02:00
commit 2e31f98380
5 changed files with 291 additions and 0 deletions

View file

@ -57,6 +57,13 @@ namespace RacesOfValheim
public static ConfigEntry<float> RunicOverchargeWindow;
public static ConfigEntry<float> RunicOverchargeCooldown;
// ─── Fire Construct (placeable turret) ─────────────────────────────────
// See DvergarFireConstruct.cs. Fire-only for this first pass; Ice/Support are a later
// append to the same piece/recipe pattern, not a redesign.
public static ConfigEntry<float> ConstructScanRadius;
public static ConfigEntry<float> ConstructScanInterval;
public static ConfigEntry<float> ConstructFireCooldown;
public static void Bind(ConfigFile config)
{
const string keybinds = "Dvergar - Keybinds";
@ -106,6 +113,14 @@ namespace RacesOfValheim
new ConfigDescription("Seconds a loaded charge is held before it lapses unused.", new AcceptableValueRange<float>(1f, 60f)));
RunicOverchargeCooldown = config.Bind(overcharge, "Cooldown", 60f,
new ConfigDescription("Seconds between casts.", new AcceptableValueRange<float>(0f, 300f)));
const string construct = "Dvergar - Fire Construct";
ConstructScanRadius = config.Bind(construct, "Scan Radius", 10f,
new ConfigDescription("Meters within which the construct looks for a target. Kept close to the fireball's own 7m attack range so it doesn't open fire on something it can't actually hit yet.", new AcceptableValueRange<float>(3f, 30f)));
ConstructScanInterval = config.Bind(construct, "Scan Interval", 0.5f,
new ConfigDescription("Seconds between target scans.", new AcceptableValueRange<float>(0.1f, 5f)));
ConstructFireCooldown = config.Bind(construct, "Fire Cooldown", 3f,
new ConfigDescription("Seconds between shots once a target is found.", new AcceptableValueRange<float>(0.5f, 15f)));
}
}
}