Now only player must kill drifter and added onDeathStabilityRecovery existance check

This commit is contained in:
2025-07-19 14:25:59 +03:00
parent 458c65ba78
commit a47963003a

View File

@ -22,14 +22,13 @@ internal class TemporalStabilityPatches
var tempest = api.ModLoader.GetModSystem<TemporalTempestLightModSystem>();
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;
}