From 4780f8db0d5bc6d86f8228fa9fc998f921510f4c Mon Sep 17 00:00:00 2001 From: Peter Han Date: Wed, 1 Dec 2021 13:26:34 -0800 Subject: [PATCH] Allow modded decor objects that require power (such as lamps) to have positive decor even when turned off while Decor Reimagined is enabled. Also adds a missing call to PVersionCheck. --- DecorReimagined/DecorReimagined.csproj | 2 +- DecorReimagined/DecorReimaginedPatches.cs | 2 ++ DecorReimagined/DecorSplatNew.cs | 8 ++++---- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/DecorReimagined/DecorReimagined.csproj b/DecorReimagined/DecorReimagined.csproj index 79d28d4a..652ddd23 100644 --- a/DecorReimagined/DecorReimagined.csproj +++ b/DecorReimagined/DecorReimagined.csproj @@ -2,7 +2,7 @@ Decor Reimagined - 4.2.0.0 + 4.3.0.0 ReimaginationTeam.DecorRework Reworks decor, making an attractive colony a better colony. 4.0.0.0 diff --git a/DecorReimagined/DecorReimaginedPatches.cs b/DecorReimagined/DecorReimaginedPatches.cs index 4739fc30..54627848 100644 --- a/DecorReimagined/DecorReimaginedPatches.cs +++ b/DecorReimagined/DecorReimaginedPatches.cs @@ -19,6 +19,7 @@ using Database; using HarmonyLib; using Klei.AI; +using PeterHan.PLib.AVC; using PeterHan.PLib.Core; using PeterHan.PLib.Database; using PeterHan.PLib.Options; @@ -96,6 +97,7 @@ public override void OnLoad(Harmony harmony) { ImaginationLoader.Instance.Register(typeof(DecorReimaginedPatches)); new POptions().RegisterOptions(this, typeof(DecorReimaginedOptions)); new PPatchManager(harmony).RegisterPatchClass(typeof(DecorReimaginedPatches)); + new PVersionCheck().Register(this, new SteamVersionChecker()); PatchParks(); PatchRecBuildings(); } diff --git a/DecorReimagined/DecorSplatNew.cs b/DecorReimagined/DecorSplatNew.cs index 05a585fa..5945e20d 100644 --- a/DecorReimagined/DecorSplatNew.cs +++ b/DecorReimagined/DecorSplatNew.cs @@ -117,18 +117,18 @@ private void AddDecor(int cell, float decor, Extents extents) { protected override void OnCleanUp() { RemoveDecor(); - Unsubscribe((int)GameHashes.OperationalFlagChanged, OnOperationalFlagChanged); + Unsubscribe((int)GameHashes.FunctionalChanged, OnFunctionalChanged); base.OnCleanUp(); } - private void OnOperationalFlagChanged(object argument) { + private void OnFunctionalChanged(object argument) { if (gameObject != null) RefreshDecor(); } protected override void OnSpawn() { base.OnSpawn(); - Subscribe((int)GameHashes.OperationalFlagChanged, OnOperationalFlagChanged); + Subscribe((int)GameHashes.FunctionalChanged, OnFunctionalChanged); } /// @@ -188,7 +188,7 @@ internal void RefreshDecor() { var happiness = glumStatus?.attributes?.Get(DecorCellManager.Instance. HappinessAttribute); // Entombed/disabled = 0 decor, broken = use value in DecorTuning for broken - bool disabled = (operational != null && !operational.IsOperational) || + bool disabled = (operational != null && !operational.IsFunctional) || (happiness != null && happiness.GetTotalValue() < 0.0f); bool broken = breakStatus != null && breakStatus.IsBroken; RefreshCells(broken, disabled);