DysonSphereMod / QOL

64 stars 34 forks source link

[BetterStats] New patch breaks mod #117

Closed heliostellar closed 3 years ago

heliostellar commented 3 years ago

The new patch released today (0.8.20.7962) broke the mod. The patch adds a new menu for system performance, which is probably why the mod conflicts with it. I am only getting the default stats layout now.

altmank commented 3 years ago

I confirm. Also they now hide some items with no production/consumption, which may be something undesired by people using the better stats mod.

burdoto commented 3 years ago

Working on a fix now.

Here is a not optimized fix that only adds the display/sec option again. Discord Message

heliostellar commented 3 years ago

Thanks for the quick turnaround!

burdoto commented 3 years ago

I would love to open a pull request, but for some reason my Fork seems to be unavailable right now. The new code for this is now actually very simple:

        [HarmonyPostfix, HarmonyPatch(typeof(UIProductEntry), "_OnUpdate")]
        public static void UIProductEntry_Update(UIProductEntry __instance)
        {
            if (!displaySec || __instance.productionStatWindow.timeLevel == 5 ||
                !__instance.productionStatWindow.isProductionTab)
            {
                __instance.productUnitLabel.text = __instance.consumeUnitLabel.text = "/min";
                return;
            }
            __instance.productUnitLabel.text = __instance.consumeUnitLabel.text = "/sec";
            var data = __instance.entryData;
            data.consumption /= 60;
            data.production /= 60;
            __instance.ShowInText(__instance.productionStatWindow.timeLevel);
        }

Of course, the old syntax needs to be adjusted as well.

brokenmass commented 3 years ago

fixed in 1.3.1