feat(trenta): composter and heartwood grove
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
parent
b67a324cb8
commit
1a741978bf
7 changed files with 1659 additions and 19 deletions
|
|
@ -200,7 +200,6 @@ namespace RacesOfValheim
|
|||
// Source of the buzz: the ambient bee-swarm effect a placed Beehive plays, read for its
|
||||
// AudioClip only - never instantiated, so nothing about how it looks ever enters this
|
||||
// ability, matching "la sua unica componente visiva sarà le mosche" literally.
|
||||
public const string HornetsNestBeehivePrefab = "Beehive";
|
||||
|
||||
// ─── Muspell (Fader) ─────────────────────────────────────────────────
|
||||
// A toggled transformation, the same shape as FenrirRace's own G/H/J forms: press J to
|
||||
|
|
@ -387,7 +386,163 @@ namespace RacesOfValheim
|
|||
return lookup;
|
||||
}
|
||||
|
||||
// ─── Composter (item progression, tier 1) ────────────────────────────
|
||||
// The Trenta's half of the per-race station system the Aswid's Blood Refinery started.
|
||||
// Full design in Trenta_Composter.txt; every number it settles on lives here.
|
||||
//
|
||||
// The chain: a Rot Seed bought from the Greydwarf faction bench gates the Composter, the
|
||||
// Composter rots raw flesh into Fertilizer, and Fertilizer grows any plant on the spot.
|
||||
public const string ComposterPieceName = "TrentaComposter";
|
||||
public const string ComposterDisplayName = "Composter";
|
||||
|
||||
public const string FertilizerName = "Fertilizer";
|
||||
public const string FertilizerDisplayName = "Fertilizer";
|
||||
|
||||
public const string RotSeedName = "RotSeed";
|
||||
public const string RotSeedDisplayName = "Rot Seed";
|
||||
|
||||
// Same band as the Aswid's Blood Core, which does the same job for the same reason.
|
||||
public const int RotSeedPrice = 500;
|
||||
|
||||
// "Slightly smaller than a fermenter" - the vanilla barrel is already human-sized, so this
|
||||
// is a shave rather than the halving the (enormous) eitr refinery needed.
|
||||
public const float ComposterScale = 0.85f;
|
||||
|
||||
// One batch: 100 units of flesh in, 20 Fertilizer out after the compost time, so 5 units
|
||||
// of flesh per Fertilizer. Flesh is valued by AswidBloodRefinery.FleshValue.
|
||||
public const float ComposterCapacity = 100f;
|
||||
public const float ComposterCompostSeconds = 2400f; // as a normal fermenter
|
||||
public const int ComposterYield = 20;
|
||||
|
||||
// Where the Draugr's flies and green gas hang over the lid. The scaled barrel is roughly a
|
||||
// metre tall; this is an eyeball figure and is meant to be adjusted in game.
|
||||
public static readonly Vector3 ComposterVfxLocalPosition = new Vector3(0f, 1f, 0f);
|
||||
|
||||
// Same prefab TrentaHornetsNest and DraughVisuals already read their particles off. The
|
||||
// Composter keeps the same subset DraughVisuals keeps - flies plus the green smoke - which
|
||||
// is why the swarm on a Heartwood Grove and the haze over a Composter match by default.
|
||||
public const string ComposterVfxSourcePrefab = "Draugr";
|
||||
|
||||
// Entrails, darkened to loam. Only the world/held model takes the tint - the inventory
|
||||
// icon is an atlas sprite and cannot be repainted (proven the hard way on the Aswid's
|
||||
// Blood Essence), so the icon is borrowed from Guck instead: green-black reads as
|
||||
// "compost" without reading as "intestine".
|
||||
public static readonly Color FertilizerTint = new Color(0.18f, 0.13f, 0.09f, 1f);
|
||||
public const string FertilizerIconSource = "Guck";
|
||||
|
||||
public static readonly Color RotSeedTint = new Color(0.16f, 0.12f, 0.08f, 1f);
|
||||
|
||||
// ─── 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.
|
||||
public const string GroveSeedName = "HeartwoodSeed";
|
||||
public const string GroveSeedDisplayName = "Heartwood Seed";
|
||||
public const string GroveSaplingPieceName = "TrentaHeartwoodSapling";
|
||||
public const string GroveSaplingDisplayName = "Heartwood Sapling";
|
||||
public const string GrovePieceName = "TrentaHeartwoodGrove";
|
||||
public const string GroveDisplayName = "Heartwood Grove";
|
||||
|
||||
// A grove costs exactly one full Composter batch. That is the whole balance argument.
|
||||
public const int GroveSeedFertilizerCost = ComposterYield;
|
||||
|
||||
// World time, not session time: Plant.TimeSincePlanted reads ZNet's clock, so a sapling
|
||||
// keeps growing with the zone unloaded and the game shut, same as the Composter's timer.
|
||||
public const float GroveGrowSeconds = 7200f;
|
||||
|
||||
// One radius for both halves on purpose - the grove defends exactly the ground it farms,
|
||||
// and the player only has to learn one number. Matches PurpleRainRadius.
|
||||
public const float GroveRadius = 8f;
|
||||
|
||||
// One plant per tick, not the whole radius: 20 Fertilizer is then 20 minutes of autonomy.
|
||||
// Growing everything at once would empty the trough in a single tick.
|
||||
public const float GroveFertilizeInterval = 60f;
|
||||
public const int GroveFertilizerCapacity = ComposterYield;
|
||||
|
||||
// The honey rate is not invented: m_secPerUnit and m_maxHoney are read off the vanilla
|
||||
// Beehive at registration. Only the capacity is scaled - a whole tree of bees has to last
|
||||
// while the player is away, where a hive only has to last until they walk past it.
|
||||
public const int GroveHoneyCapacityFactor = 5;
|
||||
|
||||
// Honey accrues day and night, exactly as a vanilla hive's does.
|
||||
//
|
||||
// This used to be a GroveHoneyAtNight knob defaulting to false, on the reading that
|
||||
// Beehive.m_effectOnlyInDaylight meant "bees only work in daylight". It does not: by its
|
||||
// name and by the only method that touches it (Beehive.UpdateBees), it gates m_beeEffect -
|
||||
// the buzz and the particles - not production. Vanilla hives make honey overnight.
|
||||
//
|
||||
// Getting that wrong did not merely slow the grove down, it starved it. The night was
|
||||
// discarded by resetting the accrual stamp, which meant a whole m_secPerUnit had to fit
|
||||
// inside one unbroken stretch of daylight - and m_secPerUnit is of the same order as a
|
||||
// Valheim day is long (a full cycle is EnvMan.m_dayLengthSec, 1800s by default, of which
|
||||
// roughly 1260s is not night). So honey was somewhere between rare and arithmetically
|
||||
// impossible depending on the hive's real rate and what time it was when the tree matured.
|
||||
//
|
||||
// If the "bees sleep at night" flavour is ever wanted, it belongs where vanilla puts it:
|
||||
// on the swarm's buzz, not on the honey.
|
||||
|
||||
// Only the model is taken off this prefab, never its TreeBase or its log drop - the same
|
||||
// discipline the VFX borrowing follows. A Yggdrasil shoot reads as "grown from a root of
|
||||
// the world" rather than as any old beech, and matches YggdrasilWood being in the recipe.
|
||||
public const string GroveModelPrefab = "YggaShoot_small1";
|
||||
public const float GroveModelScale = 1f;
|
||||
|
||||
// Cloned for the sapling stage; must be a prefab that carries a Plant component.
|
||||
public const string GroveSaplingSourcePrefab = "Beech_Sapling";
|
||||
|
||||
// The grove's swarm is the Hornet's Nest swarm with a different anchor - deliberately not
|
||||
// a second copy of that code, so a change to the sting is a change to both. It therefore
|
||||
// reads HornetsNestDamagePerTick / HornetsNestTickInterval and has no damage of its own.
|
||||
//
|
||||
// A grove is a piece, not a Character, so BaseAI.IsEnemy cannot be asked directly the way
|
||||
// the player-anchored swarm asks it. The fallback rule lives in TrentaHornetSwarm.
|
||||
public const float GroveStingRadius = GroveRadius;
|
||||
|
||||
// Density cap, enforced by PieceDensityLimit. Without one, a field of groves is a carpet of
|
||||
// bees that kills anything that comes near, and this was a known open point for two rounds.
|
||||
//
|
||||
// More permissive than the Draugh body pile's five, on the reading that a grove is a farm
|
||||
// rather than an army and costs a Composter batch rather than a 500-coin bone. Unlike almost
|
||||
// every other number in this file it has no vanilla equivalent to be read off, so it IS a
|
||||
// guess - change it freely, it is one line and nothing else depends on it.
|
||||
public const int GroveMaxInRange = 10;
|
||||
public const float GroveDensityAreaKm2 = 1.6f; // the same frame the body pile uses
|
||||
|
||||
// ─── The vanilla beehive ─────────────────────────────────────────────
|
||||
// Two features read this prefab: the grove borrows its honey rate and capacity, and the
|
||||
// Hornet's Nest borrows the AudioClip off its bee effect.
|
||||
//
|
||||
// Both used to look up "Beehive" and both silently got nothing - confirmed from the BepInEx
|
||||
// log, which is the whole reason those lookups now warn instead of returning quietly. There is
|
||||
// a Beehive.prefab in the asset manifest, but it is not what PrefabManager resolves under that
|
||||
// name; the buildable hive is "piece_beehive", and that is the one carrying the tuned Beehive
|
||||
// component. Both names are tried in order so a game update that moves it cannot silence this
|
||||
// again without saying so.
|
||||
public static readonly string[] BeehiveSourcePrefabs = { "piece_beehive", "Beehive" };
|
||||
|
||||
// ─── Helpers ─────────────────────────────────────────────────────────
|
||||
|
||||
/// <summary>
|
||||
/// The vanilla Beehive component, or null. Shared by the grove and the Hornet's Nest so the
|
||||
/// two cannot disagree about where it lives.
|
||||
/// </summary>
|
||||
public static Beehive FindVanillaBeehive()
|
||||
{
|
||||
foreach (string name in BeehiveSourcePrefabs)
|
||||
{
|
||||
GameObject prefab = Jotunn.Managers.PrefabManager.Cache.GetPrefab<GameObject>(name);
|
||||
Beehive hive = prefab != null ? prefab.GetComponent<Beehive>() : null;
|
||||
if (hive != null)
|
||||
{
|
||||
Jotunn.Logger.LogInfo($"[Trenta] Vanilla beehive resolved from '{name}'.");
|
||||
return hive;
|
||||
}
|
||||
}
|
||||
|
||||
Jotunn.Logger.LogWarning("[Trenta] No vanilla beehive found under any of: " +
|
||||
string.Join(", ", BeehiveSourcePrefabs));
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>Clamped table lookup, so a state outside 1..8 can never index out of range.</summary>
|
||||
public static float Lookup(float[] table, int state)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue