Private
Public Access
1
0

rename Min/MaxTemperatureGrowth to TemperatureMinimum/Optimal

This commit is contained in:
2026-05-25 09:21:35 +02:00
parent d7ca3f8e99
commit c5d34ec1b5
10 changed files with 76 additions and 31 deletions

View File

@@ -1,5 +1,5 @@
{
"total": 673269,
"total": 676860,
"sessions": [
{
"begin": "2026-01-09T17:26:02+01:00",
@@ -1535,6 +1535,21 @@
"begin": "2026-05-25T05:48:38+02:00",
"end": "2026-05-25T07:50:07+02:00",
"duration": 7288
},
{
"begin": "2026-05-25T07:57:23+02:00",
"end": "2026-05-25T08:19:38+02:00",
"duration": 1334
},
{
"begin": "2026-05-25T08:27:09+02:00",
"end": "2026-05-25T08:50:02+02:00",
"duration": 1373
},
{
"begin": "2026-05-25T09:06:05+02:00",
"end": "2026-05-25T09:20:50+02:00",
"duration": 884
}
]
}

View File

@@ -104,7 +104,7 @@ public readonly record struct BeehiveStats
currentTemperature += 5;
if (OrekiWoofsBeehivesModSystem.IsSteadyGreenhousesLoaded)
return Math.Max(currentTemperature, Config.Instance.MaxTemperatureGrowth);
return Math.Max(currentTemperature, Config.Instance.TemperatureOptimal);
return currentTemperature;
}
@@ -113,13 +113,13 @@ public readonly record struct BeehiveStats
{
var cfg = Config.Instance;
if (currentTemperature >= cfg.MaxTemperatureGrowth)
if (currentTemperature >= cfg.TemperatureOptimal)
return 1.0;
if (currentTemperature <= cfg.MinTemperatureGrowth)
if (currentTemperature <= cfg.TemperatureMinimum)
return 0.0;
float temperatureRange = cfg.MaxTemperatureGrowth - cfg.MinTemperatureGrowth;
return (currentTemperature - cfg.MinTemperatureGrowth) / temperatureRange;
float temperatureRange = cfg.TemperatureOptimal - cfg.TemperatureMinimum;
return (currentTemperature - cfg.TemperatureMinimum) / temperatureRange;
}
private static double CalculateFramesPerDay(BlockEntityReusableBeehive beehive, double temperatureMultiplier)
@@ -161,16 +161,16 @@ public readonly record struct BeehiveStats
private static double GetWinterReverseRamp(float currentTemperature)
{
var cfg = Config.Instance;
if (currentTemperature >= cfg.MaxTemperatureGrowth)
if (currentTemperature >= cfg.TemperatureOptimal)
return 0;
if (currentTemperature <= cfg.MinTemperatureGrowth)
if (currentTemperature <= cfg.TemperatureMinimum)
return 1;
float temperatureRange = cfg.MaxTemperatureGrowth - cfg.MinTemperatureGrowth;
float temperatureRange = cfg.TemperatureOptimal - cfg.TemperatureMinimum;
if (temperatureRange <= 0)
return 1;
return 1.0 - ((currentTemperature - cfg.MinTemperatureGrowth) / temperatureRange);
return 1.0 - ((currentTemperature - cfg.TemperatureMinimum) / temperatureRange);
}
private static double GetEffectiveFlowers(BlockEntityReusableBeehive beehive)

View File

@@ -331,7 +331,7 @@ public class BlockEntityReusableBeehive : BlockEntityContainer, IModEntity
var cfg = Config.Instance;
var ratePerHour = 1.0 / Math.Max(1, cfg.PreSwarmDurationHours);
if (stats.Components.Temperature >= cfg.MaxTemperatureGrowth)
if (stats.Components.Temperature >= cfg.TemperatureOptimal)
PreSwarmProgress += ratePerHour * hoursElapsed;
else
PreSwarmProgress -= ratePerHour * hoursElapsed;

View File

@@ -142,11 +142,11 @@ public class Config
// weather effects
[ProtoMember(15)]
[ConfigCommand(serverSide: true, Min = -20, Max = 20)]
public float MinTemperatureGrowth { get; set; } = 0f;
public float TemperatureMinimum { get; set; } = 0f;
[ProtoMember(16)]
[ConfigCommand(serverSide: true, Min = 0, Max = 40)]
public float MaxTemperatureGrowth { get; set; } = 10f;
public float TemperatureOptimal { get; set; } = 10f;
[ProtoMember(35)]
[ConfigCommand(serverSide: true)]

View File

@@ -96,7 +96,7 @@ public static class BeehiveInfoStringBuilder
}
var cfg = Config.Instance;
var isIncreasing = stats.Components.Temperature >= cfg.MaxTemperatureGrowth;
var isIncreasing = stats.Components.Temperature >= cfg.TemperatureOptimal;
string detail;
if (isIncreasing)
@@ -337,9 +337,9 @@ public static class BeehiveInfoStringBuilder
if (verbosity is >= 1 and < 3)
{
if (temperature <= cfg.MinTemperatureGrowth)
if (temperature <= cfg.TemperatureMinimum)
builder.AppendLine(Lang.Get("orekiwoofsbeehives:beehive-info-temperature-overwintering"));
else if (temperature < cfg.MaxTemperatureGrowth)
else if (temperature < cfg.TemperatureOptimal)
builder.AppendLine(Lang.Get("orekiwoofsbeehives:beehive-info-temperature-cold"));
}
else
@@ -356,7 +356,7 @@ public static class BeehiveInfoStringBuilder
if (cfg.WinterHardMode
&& stats.Components.FilledFramesCount <= 0
&& temperature <= cfg.MinTemperatureGrowth)
&& temperature <= cfg.TemperatureMinimum)
builder.AppendLine($"<font color=\"#ff0000\">{Lang.Get("orekiwoofsbeehives:beehive-info-winter-starving")}</font>");
}

View File

@@ -64,10 +64,11 @@ public partial class OrekiWoofsBeehivesModSystem : ModSystem
Config.Instance ??= new Config();
ConvertOldCropBonus(oldCropBonus, Config.Instance);
var temperatureMigrated = ConvertBackCompatibilityTemperature(api, Config.Instance);
api.StoreModConfig(Config.Instance, config_filename);
if (oldCropBonus is not null && api.ModLoader.IsModEnabled("configlib"))
if ((oldCropBonus is not null || temperatureMigrated) && api.ModLoader.IsModEnabled("configlib"))
ReloadConfigForConfigLib(api);
api.Event.PlayerJoin += OnPlayerJoin;
@@ -176,4 +177,33 @@ public partial class OrekiWoofsBeehivesModSystem : ModSystem
Mod.Logger.Event($"Converted CropBonus:{cropBonus} to YieldBoost:{config.YieldBoost}, SpeedBoost:{config.SpeedBoost}");
}
private bool ConvertBackCompatibilityTemperature(ICoreAPI api, Config config)
{
const string old_min_temperature_growth_key = "MinTemperatureGrowth";
const string old_max_temperature_growth_key = "MaxTemperatureGrowth";
var cfgJson = api.LoadModConfig(config_filename);
if (cfgJson is null)
return false;
var migrated = false;
if (!cfgJson.KeyExists(nameof(Config.TemperatureMinimum)) && cfgJson.KeyExists(old_min_temperature_growth_key))
{
config.TemperatureMinimum = cfgJson[old_min_temperature_growth_key].AsFloat(config.TemperatureMinimum);
migrated = true;
}
if (!cfgJson.KeyExists(nameof(Config.TemperatureOptimal)) && cfgJson.KeyExists(old_max_temperature_growth_key))
{
config.TemperatureOptimal = cfgJson[old_max_temperature_growth_key].AsFloat(config.TemperatureOptimal);
migrated = true;
}
if (migrated)
Mod.Logger.Event($"Converted legacy temperature config values to TemperatureMinimum:{config.TemperatureMinimum}, TemperatureOptimal:{config.TemperatureOptimal}");
return migrated;
}
}

View File

@@ -387,8 +387,8 @@
"title": "Weather Effects"
},
{
"code": "MinTemperatureGrowth",
"comment": "config-desc-MinTemperatureGrowth",
"code": "TemperatureMinimum",
"comment": "config-desc-TemperatureMinimum",
"type": "float",
"default": 0.0,
"range": {
@@ -397,8 +397,8 @@
}
},
{
"code": "MaxTemperatureGrowth",
"comment": "config-desc-MaxTemperatureGrowth",
"code": "TemperatureOptimal",
"comment": "config-desc-TemperatureOptimal",
"type": "float",
"default": 10.0,
"range": {

View File

@@ -112,8 +112,8 @@
"config-desc-WinterHardMode": "Enables winter hard mode for additional winter mechanics.",
"config-desc-WinterDailyBeeDeathsWithoutFood": "Extra daily bee deaths in winter when there are no filled/feed frames. Works only with WinterHardMode enabled.",
"config-desc-WinterFoodConsumptionMultiplier": "Winter food consumption multiplier (0-1). From 10C to 0C this effect ramps up in reverse relative to honey production; below 0C it stays at max. Works only with WinterHardMode enabled.",
"config-desc-MinTemperatureGrowth": "Temperature at which bee growth and honey production stops.",
"config-desc-MaxTemperatureGrowth": "Temperature at which bee growth and honey production reaches maximum.",
"config-desc-TemperatureMinimum": "Temperature at which bee growth and honey production stops.",
"config-desc-TemperatureOptimal": "Temperature at which bee growth and honey production reaches maximum.",
"config-desc-GreenhouseAffectsBeehive": "Whether greenhouses give 5C temperature boost to the beehive.",
"config-desc-BeesPerParticle": "Number of bees represented by each particle group. If this is 1000, there are 5000 bees in a beehive, then the beehive will spawn at most 5 particles.",
"config-desc-BeehiveAlwaysSpawnNumberOfBees": "Will spawn this amount of bees per beehive block, regardless of their population.",
@@ -128,7 +128,7 @@
"blockhelp-beehive-enable-swarm": "Enable swarming",
"blockhelp-beehive-disable-swarm": "Disable swarming",
"config-desc-EnableSwarms": "Whether beehives can produce swarms.",
"config-desc-PreSwarmDurationHours": "Duration in hours for bees to build up their swarm urge (0 to 100%). Progress only increases at MaxTemperatureGrowth or higher; otherwise it decreases.",
"config-desc-PreSwarmDurationHours": "Duration in hours for bees to build up their swarm urge (0 to 100%). Progress only increases at TemperatureOptimal or higher; otherwise it decreases.",
"config-desc-SwarmSettingAfterPlacing": "Whether a newly placed beehive has swarming enabled or disabled. Can be changed with a wrench.",
"setpopulation-desc": "Set bee population of the beehive block you are currently looking at.",
"debugunload-desc": "Enable or disable unload catch-up debug messages in server chat.",

View File

@@ -111,8 +111,8 @@
"config-desc-WinterHardMode": "Включает усложнённый зимний режим с дополнительными зимними механиками.",
"config-desc-WinterDailyBeeDeathsWithoutFood": "Дополнительная ежедневная гибель пчёл зимой, когда нет заполненных/кормовых рамок. Работает только с включенным WinterHardMode.",
"config-desc-WinterFoodConsumptionMultiplier": "Коэффициент потребления зимних продуктов питания (0-1). При температуре от 10° C до 0° C этот эффект увеличивается в обратном направлении относительно производства мёда; при температуре ниже 0° C он остается максимальным. Работает только при включенном режиме WinterHardMode.",
"config-desc-MinTemperatureGrowth": "Температура, при которой прекращается рост пчёл и производство мёда.",
"config-desc-MaxTemperatureGrowth": "Температура, при которой рост пчёл и производство мёда достигают максимума.",
"config-desc-TemperatureMinimum": "Температура, при которой прекращается рост пчёл и производство мёда.",
"config-desc-TemperatureOptimal": "Температура, при которой рост пчёл и производство мёда достигают максимума.",
"config-desc-GreenhouseAffectsBeehive": "Дают ли теплицы повышение температуры в улье на 5°C.",
"config-desc-BeesPerParticle": "Количество пчёл, представленных каждой группой частиц. Если это 1000, а в улье 5000 пчёл, тогда улей породит не более 5 частиц.",
"config-desc-BeehiveAlwaysSpawnNumberOfBees": "Всегда создаёт указанное количество пчёл на блок улья независимо от их численности.",
@@ -127,7 +127,7 @@
"blockhelp-beehive-enable-swarm": "Включить роение",
"blockhelp-beehive-disable-swarm": "Отключить роение",
"config-desc-EnableSwarms": "Определяет, могут ли ульи выпускать рои.",
"config-desc-PreSwarmDurationHours": "Время в часах, за которое у пчёл накапливается готовность к роению (0100%). Прогресс растёт только при MaxTemperatureGrowth или выше, иначе уменьшается.",
"config-desc-PreSwarmDurationHours": "Время в часах, за которое у пчёл накапливается готовность к роению (0100%). Прогресс растёт только при TemperatureOptimal или выше, иначе уменьшается.",
"config-desc-SwarmSettingAfterPlacing": "Будет ли в только что установленном улье включено или отключено роение. Можно изменить гаечным ключом.",
"setpopulation-desc": "Установить численность пчёл в улье, на который вы сейчас смотрите.",
"debugunload-desc": "Включить или отключить отладочные сообщения догоняющей обработки после выгрузки в чате сервера.",

View File

@@ -13,7 +13,7 @@
/beehives BeehiveConsideredEmptyBelowPopulation 500
/beehives PopulationPercentRequirementForSwarm 80
/beehives SwarmPopulationPercentage 0.2
/beehives MaxTemperatureGrowth 10
/beehives TemperatureOptimal 10
```
## 1) Open-for-incoming is always below-threshold
@@ -44,13 +44,13 @@
## 2b) Pre-swarm progress builds at optimal temperature
- Source hive above required percent, cooldown expired.
- Ensure temperature is at or above `MaxTemperatureGrowth`.
- Ensure temperature is at or above `TemperatureOptimal`.
- Expected: block info shows "Bees are preparing to swarm" (v1) or progress % (v2+).
- Expected: progress increases from 0 to 100% over `PreSwarmDurationHours` hours.
## 2c) Pre-swarm progress decreases in cold
- Start with some pre-swarm progress built up.
- Drop temperature below `MaxTemperatureGrowth`.
- Drop temperature below `TemperatureOptimal`.
- Expected: pre-swarm progress decreases back toward 0.
- Expected: swarm does not trigger until progress reaches 100% again.