version 1.0.2

This commit is contained in:
2025-07-26 18:17:43 +03:00
parent 407ef5a723
commit d485841a1a
6 changed files with 39 additions and 4 deletions

View File

@ -1,8 +1,13 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AEntity_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F185df8fd8a7e41f3aa8086976f138a921db000_003F81_003F8963e1a7_003FEntity_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AICoreAPI_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F185df8fd8a7e41f3aa8086976f138a921db000_003F9c_003Fd1964c41_003FICoreAPI_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AICoreServerAPI_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F185df8fd8a7e41f3aa8086976f138a921db000_003F84_003F9c13deda_003FICoreServerAPI_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AIGameCalendar_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F185df8fd8a7e41f3aa8086976f138a921db000_003F15_003F938573ab_003FIGameCalendar_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AIServerEventAPI_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F185df8fd8a7e41f3aa8086976f138a921db000_003Fbd_003Fd2fe3ff1_003FIServerEventAPI_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AIWorldAccessor_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F185df8fd8a7e41f3aa8086976f138a921db000_003Fbc_003Facf979cc_003FIWorldAccessor_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AJsonObject_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F185df8fd8a7e41f3aa8086976f138a921db000_003F95_003Ff521d463_003FJsonObject_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ASystemTemporalStability_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fae66fe3dcb4e4d08b5173bd19fa1fd242b7200_003Fc7_003Fe07d0c83_003FSystemTemporalStability_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ATemporalStormRunTimeData_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fae66fe3dcb4e4d08b5173bd19fa1fd242b7200_003F03_003F0523d017_003FTemporalStormRunTimeData_002Ecs/@EntryIndexedValue">ForceIncluded</s:String></wpf:ResourceDictionary>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ATemporalStormRunTimeData_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fae66fe3dcb4e4d08b5173bd19fa1fd242b7200_003F03_003F0523d017_003FTemporalStormRunTimeData_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/Environment/UnitTesting/UnitTestSessionStore/Sessions/=4c55ae88_002D2e62_002D42f4_002Db958_002Dc3040178f502/@EntryIndexedValue">&lt;SessionState ContinuousTestingMode="0" IsActive="True" Name="All tests from Solution" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session"&gt;&#xD;
&lt;Solution /&gt;&#xD;
&lt;/SessionState&gt;</s:String></wpf:ResourceDictionary>

View File

@ -9,4 +9,6 @@ public class ModConfig
public double InitialKillsForStormEnd = 15;
public double KillsForStormEndGrowthPerYear = 15;
public double KillsForStormEndLimit = 60;
public bool NotifyAboutStormDurationOnKill = false;
}

View File

@ -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<TemporalTempestLightModSystem>();
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");

View File

@ -1,3 +1,3 @@
{
"hello": "hello world!"
"notification.storm_duration": "Storm hours left: {0}."
}

View File

@ -0,0 +1,3 @@
{
"notification.storm_duration": "Часов шторма осталось: {0}."
}

View File

@ -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": ""
}