feat(sverm): enforce the beehive cap, and put the aura and the nest limits in config
"Beehives per Aura" was bound into the config and then read by nobody. SvermConfigManagement.Beehives had no callers and neither did the constant behind it, so the entry described a limit that did not exist and a player could raise thirty hives in one aura and get thirty workers. SweepAura is two passes now, with the cap between them. The first applies to hives already taken and counts them - that maintenance is not skippable, it is what survives a zone reload - and only then are new candidates considered. One pass would have let the order the physics query happens to return decide whether a hive counted against the cap or was measured by it. The minute keeps running on a hive that does not fit today, so when a taken hive is destroyed the one that has waited longest is claimed on the next sweep instead of starting over; lowering the cap never hands a hive back. Three limits are now the player's: Aura Radius, Nests per Radius and Nest Spacing Radius. PieceDensityLimit.Register takes a snapshot of its numbers, so the Hive Market and the Brood Mound both watch their entries and re-register when one moves - Register replaces an entry rather than stacking a second limit on the same piece. All three are clamped, and the reason is not tidiness: Register REFUSES a radius of zero or a maximum below one, and a refused limit is no limit at all. A player typing 0 into "Nests per Radius" to mean "no nests" would have been handed unlimited nests. Every player-facing string that stated the old numbers now reads the live ones - the two build refusals, the orphaned market's message and hover, and the two Compendium lines. The nest's hover shows the cap next to the count, so moving the knob has visible effect. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
parent
fcb6cae3ee
commit
7ac7f99287
6 changed files with 165 additions and 30 deletions
|
|
@ -60,6 +60,9 @@ namespace RacesOfValheim
|
|||
public static ConfigEntry<int> CapFarmers;
|
||||
public static ConfigEntry<int> CapHaulers;
|
||||
public static ConfigEntry<int> CapBeehives;
|
||||
public static ConfigEntry<float> AuraRadiusValue;
|
||||
public static ConfigEntry<float> NestRadiusValue;
|
||||
public static ConfigEntry<int> NestMaxValue;
|
||||
|
||||
// ─── The nest and its mark ───────────────────────────────────────────
|
||||
public static ConfigEntry<float> WorkerChestRangeValue;
|
||||
|
|
@ -137,7 +140,7 @@ namespace RacesOfValheim
|
|||
|
||||
MarketSizeValue = config.Bind(nest, "Market Bench Size", SvermConfig.MarketSize,
|
||||
"How big the Hive Market bench is, in metres. It is a building you raise inside a " +
|
||||
"hive's ten metres, not a part of the nest.");
|
||||
"hive's aura, not a part of the nest - see 'Aura Radius' under Colony Caps.");
|
||||
|
||||
DigestRateValue = config.Bind(nest, "Digestion Rate", SvermConfig.BiomassDigestRate,
|
||||
"How much biomass moves from digestion into the hive's spendable bank each second. " +
|
||||
|
|
@ -178,9 +181,29 @@ namespace RacesOfValheim
|
|||
"nearby chests into the hive. Separate pool from the farmers.");
|
||||
|
||||
CapBeehives = config.Bind(caps, "Beehives per Aura", SvermConfig.HiveAuraBeehiveMax,
|
||||
"How many beehives may stand in one nest's ten metres. Every one of them ends up " +
|
||||
"infected and producing a worker, so this is the number that really decides how " +
|
||||
"busy a base gets.");
|
||||
"How many beehives one nest will take over. Every taken hive ends up producing a " +
|
||||
"worker, so this is the number that really decides how busy a base gets. Hives past " +
|
||||
"the cap are left alone and stay the player's; 0 stops the takeover entirely. " +
|
||||
"Lowering it never hands a hive BACK - what is already the colony's stays taken.");
|
||||
|
||||
AuraRadiusValue = config.Bind(caps, "Aura Radius", SvermConfig.HiveAuraRadius,
|
||||
"Metres around a nest that count as its aura. It is one circle doing three jobs: " +
|
||||
"which beehives get taken over, how far a Hive Market may stand from its nest, and " +
|
||||
"how far a market looks to find one. Takes effect immediately - beehives that fall " +
|
||||
"outside a shrunk aura simply stop being swept, but a market already built stays " +
|
||||
"where it is.");
|
||||
|
||||
NestMaxValue = config.Bind(caps, "Nests per Radius", SvermConfig.HiveDensityMax,
|
||||
"How many Brood Mounds may stand within 'Nest Spacing Radius' of each other. The " +
|
||||
"default pair, over the default radius, is two nests per square mile. Minimum 1 - " +
|
||||
"for practical purposes 'no limit' is a large number here, not zero. Only checked " +
|
||||
"when a nest is PLACED: lowering it leaves nests already standing where they are.");
|
||||
|
||||
NestRadiusValue = config.Bind(caps, "Nest Spacing Radius", SvermConfig.HiveDensityRadius,
|
||||
"Metres over which 'Nests per Radius' is counted. 908 m is not an arbitrary figure: " +
|
||||
"it is the radius of a circle with the area of one square mile, which is how the " +
|
||||
"rule was written down. Counted over ZDOs rather than loaded objects, so a nest on " +
|
||||
"the far side of the world still counts.");
|
||||
|
||||
// FOUND IN PLAY: 180, the figure that fixed the flying Deathsquito, faces the Seeker
|
||||
// Brute straight at the camera - its own forward already matches the player's, unlike
|
||||
|
|
@ -248,6 +271,46 @@ namespace RacesOfValheim
|
|||
public static int Haulers => CapHaulers?.Value ?? SvermConfig.CapHaulers;
|
||||
public static int Beehives => CapBeehives?.Value ?? SvermConfig.HiveAuraBeehiveMax;
|
||||
|
||||
/// <summary>
|
||||
/// The aura, in metres. Clamped above zero because it is fed straight into an OverlapSphere
|
||||
/// and into PieceDensityLimit.Register, which refuses a radius of zero and would leave the
|
||||
/// market uncapped rather than infinitely capped - a typed 0 must not be the one value that
|
||||
/// turns a limit off.
|
||||
/// </summary>
|
||||
public static float AuraRadius
|
||||
{
|
||||
get
|
||||
{
|
||||
float value = AuraRadiusValue?.Value ?? SvermConfig.HiveAuraRadius;
|
||||
return value > 0.01f ? value : SvermConfig.HiveAuraRadius;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// How far apart nests must be spread, and how many fit. Clamped for the same reason
|
||||
/// AuraRadius is, and it bites harder here: PieceDensityLimit.Register refuses a radius of
|
||||
/// zero OR a maximum below one and logs a warning, and a refused limit is not a strict limit
|
||||
/// - it is NO limit. Typing 0 to mean "no nests" would hand the player unlimited nests,
|
||||
/// which is the exact opposite of what they asked for.
|
||||
/// </summary>
|
||||
public static float NestRadius
|
||||
{
|
||||
get
|
||||
{
|
||||
float value = NestRadiusValue?.Value ?? SvermConfig.HiveDensityRadius;
|
||||
return value > 0.01f ? value : SvermConfig.HiveDensityRadius;
|
||||
}
|
||||
}
|
||||
|
||||
public static int NestMax
|
||||
{
|
||||
get
|
||||
{
|
||||
int value = NestMaxValue?.Value ?? SvermConfig.HiveDensityMax;
|
||||
return value >= 1 ? value : 1;
|
||||
}
|
||||
}
|
||||
|
||||
public static float ChestRange => WorkerChestRangeValue?.Value ?? SvermConfig.WorkerChestRange;
|
||||
public static bool WorkerDebug => WorkerDebugValue?.Value ?? false;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue