Skip to content

Commit

Permalink
Allow modded decor objects that require power (such as lamps) to have…
Browse files Browse the repository at this point in the history
… positive decor even when turned off while Decor Reimagined is enabled. Also adds a missing call to PVersionCheck.
  • Loading branch information
peterhaneve committed Dec 1, 2021
1 parent a60bd80 commit 4780f8d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion DecorReimagined/DecorReimagined.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<AssemblyTitle>Decor Reimagined</AssemblyTitle>
<FileVersion>4.2.0.0</FileVersion>
<FileVersion>4.3.0.0</FileVersion>
<RootNamespace>ReimaginationTeam.DecorRework</RootNamespace>
<Description>Reworks decor, making an attractive colony a better colony.</Description>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
Expand Down
2 changes: 2 additions & 0 deletions DecorReimagined/DecorReimaginedPatches.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
}
Expand Down
8 changes: 4 additions & 4 deletions DecorReimagined/DecorSplatNew.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/// <summary>
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 4780f8d

Please sign in to comment.