diff --git a/TemporalTempestLight.sln.DotSettings.user b/TemporalTempestLight.sln.DotSettings.user
index 6b84784..84e8616 100644
--- a/TemporalTempestLight.sln.DotSettings.user
+++ b/TemporalTempestLight.sln.DotSettings.user
@@ -1,8 +1,13 @@
+ ForceIncluded
ForceIncluded
ForceIncluded
ForceIncluded
ForceIncluded
ForceIncluded
+ ForceIncluded
ForceIncluded
- ForceIncluded
\ No newline at end of file
+ ForceIncluded
+ <SessionState ContinuousTestingMode="0" IsActive="True" Name="All tests from Solution" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session">
+ <Solution />
+</SessionState>
\ No newline at end of file
diff --git a/TemporalTempestLight/TemporalTempestLight/ModConfig.cs b/TemporalTempestLight/TemporalTempestLight/ModConfig.cs
index 582ae3f..afc3c61 100644
--- a/TemporalTempestLight/TemporalTempestLight/ModConfig.cs
+++ b/TemporalTempestLight/TemporalTempestLight/ModConfig.cs
@@ -9,4 +9,6 @@ public class ModConfig
public double InitialKillsForStormEnd = 15;
public double KillsForStormEndGrowthPerYear = 15;
public double KillsForStormEndLimit = 60;
+
+ public bool NotifyAboutStormDurationOnKill = false;
}
\ No newline at end of file
diff --git a/TemporalTempestLight/TemporalTempestLight/Patches/TemporalStabilityPatches.cs b/TemporalTempestLight/TemporalTempestLight/Patches/TemporalStabilityPatches.cs
index 277efa6..a65defd 100644
--- a/TemporalTempestLight/TemporalTempestLight/Patches/TemporalStabilityPatches.cs
+++ b/TemporalTempestLight/TemporalTempestLight/Patches/TemporalStabilityPatches.cs
@@ -2,7 +2,10 @@
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;
@@ -21,8 +24,10 @@ internal class TemporalStabilityPatches
var api = ___api;
var tempest = api.ModLoader.GetModSystem();
+ var onDeathStabilityRecoveryAttrExists =
+ entity.Properties.Attributes?.KeyExists("onDeathStabilityRecovery") ?? false;
- if (!system.StormData.nowStormActive || !entity.Properties.Attributes.Exists) return;
+ if (!system.StormData.nowStormActive || !onDeathStabilityRecoveryAttrExists) return;
var targetIsDrifter =
entity.Properties.Attributes["onDeathStabilityRecovery"].AsFloat(0) > 0;
@@ -31,6 +36,11 @@ internal class TemporalStabilityPatches
if (!targetIsDrifter || !damageSourceIsPlayer) return;
system.StormData.stormActiveTotalDays -= tempest.CurrentStormDurationReduction;
+
+ if (tempest.Config.NotifyAboutStormDurationOnKill)
+ {
+ NotifyAboutStormDuration(system, api);
+ }
}
[HarmonyPostfix]
@@ -57,6 +67,21 @@ internal class TemporalStabilityPatches
}
}
+ private static void NotifyAboutStormDuration(SystemTemporalStability systemTemporalStability, ICoreAPI api)
+ {
+ foreach (var player in api.World.AllOnlinePlayers)
+ {
+ if (player is not IServerPlayer serverPlayer) continue;
+
+ var duration = systemTemporalStability.StormData.stormActiveTotalDays -
+ api.World.Calendar.TotalDays;
+ var roundedDurationInHours = Math.Round(((duration) * 24), 1);
+ var message = Lang.Get("temporaltempestlight:notification.storm_duration", roundedDurationInHours);
+
+ serverPlayer.SendMessage(GlobalConstants.GeneralChatGroup, message, EnumChatType.Notification);
+ }
+ }
+
private static double CalcYearsFromWorldStart(ICoreAPI api)
{
var daysPerMoth = api.World.Config.GetAsInt("daysPerMonth");
diff --git a/TemporalTempestLight/TemporalTempestLight/assets/temporaltempestlight/lang/en.json b/TemporalTempestLight/TemporalTempestLight/assets/temporaltempestlight/lang/en.json
index ed900d8..66e3f47 100644
--- a/TemporalTempestLight/TemporalTempestLight/assets/temporaltempestlight/lang/en.json
+++ b/TemporalTempestLight/TemporalTempestLight/assets/temporaltempestlight/lang/en.json
@@ -1,3 +1,3 @@
{
- "hello": "hello world!"
+ "notification.storm_duration": "Storm hours left: {0}."
}
\ No newline at end of file
diff --git a/TemporalTempestLight/TemporalTempestLight/assets/temporaltempestlight/lang/ru.json b/TemporalTempestLight/TemporalTempestLight/assets/temporaltempestlight/lang/ru.json
new file mode 100644
index 0000000..f6558db
--- /dev/null
+++ b/TemporalTempestLight/TemporalTempestLight/assets/temporaltempestlight/lang/ru.json
@@ -0,0 +1,3 @@
+{
+ "notification.storm_duration": "Часов шторма осталось: {0}."
+}
\ No newline at end of file
diff --git a/TemporalTempestLight/TemporalTempestLight/modinfo.json b/TemporalTempestLight/TemporalTempestLight/modinfo.json
index 4945b35..d2dfa74 100644
--- a/TemporalTempestLight/TemporalTempestLight/modinfo.json
+++ b/TemporalTempestLight/TemporalTempestLight/modinfo.json
@@ -6,7 +6,7 @@
"Dencher12"
],
"description": "Fight like a hero or wait like a slave",
- "version": "1.0.1",
+ "version": "1.0.2",
"dependencies": {
"game": ""
}