[1.5] HugsLib (11.0.3) Lightweight modding library

Started by UnlimitedHugs, December 15, 2016, 02:20:14 PM

Previous topic - Next topic

UnlimitedHugs

#390
Updated to 7.2.0 (pre-release)

Hey folks!
Now that the RW 1.1 update has settled in and things are no longer quite so on fire, I'd like to present you some new HugsLib feature additions.
Worry not, this update should be fully backwards-compatible.

Player-visible changes include:

  • New and fancy Mod Setting window hover menu
  • Option for resetting all settings of one mod at once
  • Option for resetting hidden mod settings
  • Button for filtering mod update news by mod
  • Mods will no longer dump all their update news on you when loaded for the first time
  • Shortcut keys for opening Mod Settings and Mod Update News windows
  • More responsive Mod Settings window
  • Faster game startup
  • Working log publisher on MacOS
The full details and modder-specific changes are available on the HugsLib wiki:
https://github.com/UnlimitedHugs/RimworldHugsLib/wiki/HugsLib-7.2-Update-Notes

As always, let me know if you find any issues.

Steam workshop update will go live in a few days, assuming everything works.
HugsLib - AllowTool - Remote Tech - Map Reroll - Defensive Positions: Github, Steam

falconne

After the 7.2.0 update I have an issue in my Heat Map mod. The mod is designed to display widget on screen (free floating, not inside a dialog) that displays the outdoor temperature. Clicking this widget should toggle a temperature overlay.

After the 7.2.0 update, clicking these free floating widgets does nothing. Manually reverting back to 7.1.4 makes everything work again. You can reproduce this issue by adding this snippet of code into the OnGUI() method of a ModBase derived class:


public override void OnGUI()
{
    if (Widgets.ButtonText(new Rect(100f, 100f, 100f, 100f), "foo"))
    {
        Logger.Message("Here");
    }
}


Clicking this button will not display the log message in 7.2.0 (but will work in 7.1.4).

Any idea what's changed here?

UnlimitedHugs

#392
Updated to 7.2.1

This update fixes some compatibility issues introduced in the 7.2.0 updates.

  • The Dialog_VanillaModSettings namespace change has been reverted. This should fix the Real Ruins settings dialog issues.
  • The OnGUI callback timing change has been reverted. It turns out that besides timing, other GUI state changes are involved, so I restored the hook to its original location. This should fix the unresponsive Heat Map button issue.

Quote from: falconne on May 20, 2020, 09:11:05 PM
After the 7.2.0 update I have an issue in my Heat Map mod.

Fixed, thanks for letting me know.
Also, I noticed you have the HugsLibChecker assembly leaking from the 1.0 version into the 1.1 version of your mod and causing errors. I had the same issue in my own mods, so I just removed the checker from the 1.0 version. It's a slight regression, but the 1.0 versions have mostly just legacy value at this point.
Another option is to compile an empty assembly with the same name and place that into the v1.1 folder to prevent the old assembly from loading in the the 1.1 version of the game.
HugsLib - AllowTool - Remote Tech - Map Reroll - Defensive Positions: Github, Steam

falconne

Thanks, yes it works now. Thanks for spotting the HugsLibChecker, I think I forgot to remove the NuGet package from this mod.

UnlimitedHugs

Updated to 8.0.0

Tagged as 1.2 compatible- seems no changes were required.
Also, an error will now be logged if a mod has Harmony patch on a method marked as [Obsolete]. This tweak has been submitted by Erdelf.
HugsLib - AllowTool - Remote Tech - Map Reroll - Defensive Positions: Github, Steam

LWM

Are those *Errors* or warnings or messages?

Because the last time I checked, vanilla methods were still using some of those "Obsolete" methods, too, so there's not much option sometimes.

UnlimitedHugs

Quote from: LWM on August 12, 2020, 11:22:36 AM
Are those *Errors* or warnings or messages?

Errors, currently. Though the thought did cross my mind.
I could switch them to warnings, but those mostly go unnoticed by the players. Perhaps you have some thoughts on how to better handle the issue.
HugsLib - AllowTool - Remote Tech - Map Reroll - Defensive Positions: Github, Steam

Kiame

Maybe have it "error" if dev mode is enabled; "warning" otherwise?

UnlimitedHugs

Updated to 8.0.1

I switched the patches on deprecated method errors to warnings to be less intrusive. I figure it's not a high-priority issue and someone will pick up on the problem eventually, and the info will find its way to the author of the mod.
Also, I removed the check from the 1.1 version of HugsLib altogether.
HugsLib - AllowTool - Remote Tech - Map Reroll - Defensive Positions: Github, Steam

LWM

Yeah, I think warnings is appropriate.

As a mod author who is using an obsolete method, I get plenty of warnings when I build anyway  ::)   Red errors do freak out some players, and it's not a huge deal...but a warning is fair.


falconne

I see that HugsLib UtilityWorldObject is deprecated and I should move to the built in WorldComponent. If i do this (and update the component loading appropriately), will a WorldComponent automatically read data from the savefile previously saved as HugsLib UtilityWorldObjects? Or do I need to implement migration code?

UnlimitedHugs

Quote from: falconne on August 22, 2020, 07:00:53 PM
I see that HugsLib UtilityWorldObject is deprecated and I should move to the built in WorldComponent. If i do this (and update the component loading appropriately), will a WorldComponent automatically read data from the savefile previously saved as HugsLib UtilityWorldObjects? Or do I need to implement migration code?

You would have to migrate the data manually if you want to preserve it.
If I had to migrate, I would do it first thing during the WorldLoaded event, and add a flag to the UWO to indicate that it has already been migrated. This would also trigger the migration when a new world is created, but that would only "migrate" the default values- so, whatever.
In my own mods I just ditched the UWO's with the old data- that was during a major update, and since most players fired up fresh saves, no one complained.
HugsLib - AllowTool - Remote Tech - Map Reroll - Defensive Positions: Github, Steam

falconne

Ah ok. By major update do you mean the major version changing or minor version changing? I don't know if there is a 2.0 update planned. I haven't played the game since b18... I assume even when the minor version changes, old saved games won't be compatible, so I could do the switch when 1.3 comes out?

LWM

Old save games are often compatible.

I did something similar with mod settings, when I was switching away from HugsLib's settings system:

First, I created a mirror set of settings (or a mirror world object for you), and it had a flag "populatedFromHugsLib" - that set to false.

Then, when someone changed their settings, I set that to true - if yours loads after the HugsLib one, you could simply pull data and populate it.  And you set the flag to true.

Then you ignore the HugsLib world object ;p

After a long time (a month, a year, a minor update (1.3), whatever), you quietly do away with the hugslib one and just move on...

UnlimitedHugs

#404
Quote from: falconne on August 23, 2020, 08:25:37 PM
Ah ok. By major update do you mean the major version changing or minor version changing? I don't know if there is a 2.0 update planned. I haven't played the game since b18... I assume even when the minor version changes, old saved games won't be compatible, so I could do the switch when 1.3 comes out?

Yep, I mean the minor Rimworld version change in this case.
Judging by the unstable branch, Rimworld 1.3 will have quite a few breaking changes, so that might be a good time to organize your "accidental data loss", if you choose to do it that way. :D
HugsLib - AllowTool - Remote Tech - Map Reroll - Defensive Positions: Github, Steam