From a47963003a06691d9b937e9a58db4cea1615ee95 Mon Sep 17 00:00:00 2001 From: Dencher12 Date: Sat, 19 Jul 2025 14:25:59 +0300 Subject: [PATCH] Now only player must kill drifter and added onDeathStabilityRecovery existance check --- .../Patches/TemporalStabilityPatches.cs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/TemporalTempestLight/TemporalTempestLight/Patches/TemporalStabilityPatches.cs b/TemporalTempestLight/TemporalTempestLight/Patches/TemporalStabilityPatches.cs index 0155c82..277efa6 100644 --- a/TemporalTempestLight/TemporalTempestLight/Patches/TemporalStabilityPatches.cs +++ b/TemporalTempestLight/TemporalTempestLight/Patches/TemporalStabilityPatches.cs @@ -22,14 +22,13 @@ internal class TemporalStabilityPatches var tempest = api.ModLoader.GetModSystem(); - if (!system.StormData.nowStormActive) return; - - var entityIsNotDrifter = - entity.Properties.Attributes["onDeathStabilityRecovery"].AsFloat(0) <= 0; - var damageSourceIsDrifter = - (damageSource.CauseEntity?.Properties?.Attributes["onDeathStabilityRecovery"]?.AsFloat(0) ?? 0) > 0; + if (!system.StormData.nowStormActive || !entity.Properties.Attributes.Exists) return; - if (entityIsNotDrifter || damageSourceIsDrifter) return; + var targetIsDrifter = + entity.Properties.Attributes["onDeathStabilityRecovery"].AsFloat(0) > 0; + var damageSourceIsPlayer = damageSource.SourceEntity is EntityPlayer; + + if (!targetIsDrifter || !damageSourceIsPlayer) return; system.StormData.stormActiveTotalDays -= tempest.CurrentStormDurationReduction; }