This commit is contained in:
2025-07-13 18:36:51 +03:00
parent 94c09a6727
commit 1670f6fc4c
4 changed files with 11 additions and 22 deletions

View File

@ -1,6 +1,4 @@
using System.ComponentModel;
namespace TemporalTempestLight;
namespace TemporalTempestLight;
public class ModConfig
{
@ -8,7 +6,7 @@ public class ModConfig
public double StormDurationGrowthPerYear = 12;
public double StormDurationLimit = 42;
public double InitialStormDurationReductionMul = 0.2;
public double StormDurationReductionMulDecreasePerYear = 0.09;
public double StormDurationReductionMulLimit = 0.02;
public double InitialKillsForStormEnd = 5;
public double KillsForStormEndGrowthPerYear = 15;
public double KillsForStormEndLimit = 50;
}

View File

@ -1,12 +1,8 @@
using System;
using System.Globalization;
using HarmonyLib;
using Vintagestory.API.Common;
using Vintagestory.API.Common.Entities;
using Vintagestory.API.Config;
using Vintagestory.API.Server;
using Vintagestory.GameContent;
using Vintagestory.Server;
namespace TemporalTempestLight.Patches;
@ -17,7 +13,6 @@ internal class TemporalStabilityPatches
private const int MonthsPerYear = 12;
private const int HoursPerDay = 24;
[HarmonyPostfix]
[HarmonyPatch(typeof(SystemTemporalStability), "Event_OnEntityDeath")]
public static void OnEntityDeathPatch(SystemTemporalStability __instance, ICoreAPI ___api, Entity entity, DamageSource damageSource)
@ -37,10 +32,6 @@ internal class TemporalStabilityPatches
if (entityIsNotDrifter || damageSourceIsDrifter) return;
system.StormData.stormActiveTotalDays -= tempest.CurrentStormDurationReduction;
// TODO REMOVE ON RELEASE
((IServerPlayer)(((EntityPlayer)(damageSource.GetCauseEntity())).Player)).SendMessage(GlobalConstants.GeneralChatGroup, (system.StormData.stormActiveTotalDays - api.World.Calendar.TotalDays).ToString(), EnumChatType.Notification);
((IServerPlayer)(((EntityPlayer)(damageSource.GetCauseEntity())).Player)).SendMessage(GlobalConstants.GeneralChatGroup, (tempest.CurrentStormDurationReduction).ToString(), EnumChatType.Notification);
}
[HarmonyPostfix]
@ -77,7 +68,7 @@ internal class TemporalStabilityPatches
private static double CalcStormReduction(ICoreAPI api, TemporalTempestLightModSystem tempest, double stormActiveDays)
{
return stormActiveDays * CalcStormDurationReductionMul(api, tempest);
return stormActiveDays / CalcKillsForStormEndl(api, tempest);
}
private static double CalcStormActiveDays(ICoreAPI api, TemporalTempestLightModSystem tempest)
@ -89,11 +80,11 @@ internal class TemporalStabilityPatches
return stormActiveInHours / HoursPerDay;
}
private static double CalcStormDurationReductionMul(ICoreAPI api, TemporalTempestLightModSystem tempest)
private static double CalcKillsForStormEndl(ICoreAPI api, TemporalTempestLightModSystem tempest)
{
return Math.Max(
tempest.Config.InitialStormDurationReductionMul - tempest.Config.StormDurationReductionMulDecreasePerYear *
CalcYearsFromWorldStart(api), tempest.Config.StormDurationReductionMulLimit
return Math.Min(
tempest.Config.InitialKillsForStormEnd + tempest.Config.KillsForStormEndGrowthPerYear *
CalcYearsFromWorldStart(api), tempest.Config.KillsForStormEndLimit
);
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.4 KiB

After

Width:  |  Height:  |  Size: 154 KiB

View File

@ -5,7 +5,7 @@
"authors": [
"Dencher12"
],
"description": "To be added",
"description": "Fight like a hero or wait like a slave",
"version": "1.0.0",
"dependencies": {
"game": ""