diff --git a/scripts/Addicted/Config.reds b/scripts/Addicted/Config.reds index 8a0ce4ad..bd543a0e 100644 --- a/scripts/Addicted/Config.reds +++ b/scripts/Addicted/Config.reds @@ -1,17 +1,4 @@ // inspired from DJ_Kovrik -enum AddictedMode { - Normal = 0, - Hard = 1, -} - -public class AddictedConfig { - @runtimeProperty("ModSettings.mod", "Addicted") - @runtimeProperty("ModSettings.displayName", "Mod-Addicted-Mode") - @runtimeProperty("ModSettings.displayValues.Normal", "Mod-Addicted-Mode-Normal") - @runtimeProperty("ModSettings.displayValues.Hard", "Mod-Addicted-Mode-Hard") - public let mode: AddictedMode = AddictedMode.Normal; -} - // Replace false with true to show full debug logs in CET console public static func ShowDebugLogsAddicted() -> Bool = false diff --git a/scripts/Addicted/System.reds b/scripts/Addicted/System.reds index fd10c859..90317a0f 100644 --- a/scripts/Addicted/System.reds +++ b/scripts/Addicted/System.reds @@ -29,8 +29,6 @@ public class AddictedSystem extends ScriptableSystem { private let timeSystem: ref; private let callbackSystem: ref; - private let config: ref; - private let onoManager: ref; private let stimulantManager: ref; private let blacklaceManager: ref; @@ -113,7 +111,6 @@ public class AddictedSystem extends ScriptableSystem { this.RefreshStats(this.player); this.RegisterListeners(this.player); - this.RefreshConfig(); } else { F(s"no player found!"); } } @@ -131,15 +128,11 @@ public class AddictedSystem extends ScriptableSystem { if !IsDefined(this.consumptions) { this.consumptions = new Consumptions(); } - - OnAddictedPostAttach(this); } private func OnDetach() -> Void { E(s"on detach system"); this.UnregisterListeners(this.player); - - OnAddictedPostDetach(this); } private func OnRestored(saveVersion: Int32, gameVersion: Int32) -> Void { @@ -150,15 +143,6 @@ public class AddictedSystem extends ScriptableSystem { private cb func OnPreSave(event: ref) { this.ShrinkDoses(); } - - public func RefreshConfig() -> Void { - E(s"refresh config"); - this.config = new AddictedConfig(); - } - - public func OnModSettingsChange() -> Void { - this.RefreshConfig(); - } public final static func GetInstance(gameInstance: GameInstance) -> ref { let container = GameInstance.GetScriptableSystemsContainer(gameInstance); @@ -535,7 +519,11 @@ public class AddictedSystem extends ScriptableSystem { GameInstance.GetUISystem(this.player.GetGame()).QueueEvent(event); } - public func IsHard() -> Bool { return Equals(EnumInt(this.config.mode), EnumInt(AddictedMode.Hard)); } + public func IsHard() -> Bool { + let difficulty = GameInstance.GetStatsDataSystem(this.GetGameInstance()).GetDifficulty(); + return Equals(difficulty, gameDifficulty.Hard) + || Equals(difficulty, gameDifficulty.VeryHard); + } public func UnderInfluence(id: TweakDBID) -> Bool { let effect = StatusEffectHelper.GetStatusEffectByID(this.player, id); @@ -714,16 +702,6 @@ public class AddictedSystem extends ScriptableSystem { } } -@if(!ModuleExists("ModSettingsModule")) -private func OnAddictedPostAttach(_: ref) -> Void {} -@if(ModuleExists("ModSettingsModule")) -private func OnAddictedPostAttach(system: ref) -> Void { ModSettings.RegisterListenerToModifications(system); } - -@if(!ModuleExists("ModSettingsModule")) -private func OnAddictedPostDetach(_: ref) -> Void {} -@if(ModuleExists("ModSettingsModule")) -private func OnAddictedPostDetach(system: ref) -> Void { ModSettings.UnregisterListenerToModifications(system); } - struct Consumed { let amount: Int32; let hint: Bool;