[1.5] HugsLib (11.0.3) Lightweight modding library

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

Previous topic - Next topic

Craftysune

Thank's for the advice. I should have been more informative. I installed HugsLib_2.4.3 into my mods folder & when I opened the game I got the message - Mods HugsLib_2.4.3 has incorrectly formatted target version 'Unknown'. For the current version, write <targetVersion> 0.16.1393</targetVersion> - I'm fairly sure I installed it correctly. I've downloaded the game directly from Ludeon. Is my version of the game not compatible with the current HugsLib that's available? Is that what I'm reading from the Debug log. Thank you for helping me out. Much appreciated.

UnlimitedHugs

Quote from: Craftysune on April 24, 2017, 01:03:41 PM
Thank's for the advice. I should have been more informative. I installed HugsLib_2.4.3 into my mods folder & when I opened the game I got the message - Mods HugsLib_2.4.3 has incorrectly formatted target version 'Unknown'. For the current version, write <targetVersion> 0.16.1393</targetVersion> - I'm fairly sure I installed it correctly. I've downloaded the game directly from Ludeon. Is my version of the game not compatible with the current HugsLib that's available? Is that what I'm reading from the Debug log. Thank you for helping me out. Much appreciated.

Hmm... this might be caused by an incorrect folder structure. I would make sure that I did not install the mod twice or accidentally extracted it into another mod's folder.
If all else fails, you could just wipe your Mods folder (except Core) and extract all mods anew.
HugsLib - AllowTool - Remote Tech - Map Reroll - Defensive Positions: Github, Steam

Craftysune

I did as you advised & took all the mods out. I deleted any of my saved plays & I even did the old 'shut down & restart'. When I installed just the Hugslib I still got the same message. The Mods tab when you open Rimworld says that - This mod was not made for this version. I should have stated that I downloaded my copy of the game in the last 12 hours....maybe that makes a difference. Yes! I'm grasping at straws.  :P

UnlimitedHugs

Quote from: Craftysune on April 24, 2017, 08:26:06 PM
I did as you advised & took all the mods out. I deleted any of my saved plays & I even did the old 'shut down & restart'. When I installed just the Hugslib I still got the same message. The Mods tab when you open Rimworld says that - This mod was not made for this version. I should have stated that I downloaded my copy of the game in the last 12 hours....maybe that makes a difference. Yes! I'm grasping at straws.  :P

Puzzling.
Just to make sure, you are installing this version, and your folder structure after the extraction looks like "Rimworld/Mods/HugsLib/...".
I'm running the same version of the game you are (except on Steam), and cannot reproduce the issue. In fact, you're the first to report this type of problem.
I'll let you know if I get any more ideas on the matter.
It'll work eventually- no way you'll miss out on all those sweet mods :)
HugsLib - AllowTool - Remote Tech - Map Reroll - Defensive Positions: Github, Steam

Craftysune

There's no installation process to Rimworld is there? I've just be clicking the Application button in my Windows (C:)>Program Files (x86)>RimWorld1393Win (Pinned icon to taskbar)
I'm running Windows 8. I've successfully played the game from the above folder as well as my external hard drive.
I've put the following HugsLib folders in my Mods folder - (C:)>Program Files (x86)>RimWorld1393Win/Mods
*HugsLib 2.4.3
*Source code (zip)
*Source code (tar.gz)
*HugsLib Master

I'm running the following mods successfully;
BatteriesStuffed
Mad Skills
RBSE Hardcore Edition
Smooth Stone Walls
Rot Tick Fix

Could one of these mods be conflicting with HugsLib?

I've dragged these files up & down the Mods list incase it was a priority issue. I've run all these files seperately, together, combined.....no joy.

I feel like I'm missing something really obvious & I'm going to head-desk into oblivion when it becomes apparent  :-[

Thank you all so much for your patience & advice.  :)

UnlimitedHugs

Quote from: Craftysune on April 25, 2017, 12:27:59 AM
- snip -

There should be only one HugsLib folder in Mods.
Make sure you extract the zip, and the folders look look like this: "Rimworld/Mods/HugsLib/About/About.xml". Only the HugsLib_2.4.3.zip file must be downloaded and extracted- the rest is the source code for other developers.
HugsLib - AllowTool - Remote Tech - Map Reroll - Defensive Positions: Github, Steam


UnlimitedHugs

Quote from: Wishmaster on May 06, 2017, 10:20:22 AM
Any ETA for the A17 version of hugslib now that A17 is public ?

I'm just hearing this now- I guess I should get some better sources.
I'll start porting tomorrow. Shouldn't take long, since the Harmony integration stuff is already done.
Much excite.
HugsLib - AllowTool - Remote Tech - Map Reroll - Defensive Positions: Github, Steam

UnlimitedHugs

#188
Well hello there!
I am pleased to report that the A17 update has been completed- it's been a load of work, and there are significant changes to the library.

Most notably, all detour-related features have been axed and the Harmony library is now taking their place. The library will from now on come included with HugsLib.
You can include the Harmony dll in your own mod if you choose to, and there will be no conflicts.
I have prepared a wiki page to ease the transition and help migrate existing detours to harmony patches. Check it out if you're interested: Introduction to patching.

On the vanilla side, stock mod options have been added- and while a bit rough right now, they will be a welcome addition to those who choose not to use the HugsLib settings.
Myself, I will continue to update and improve the HugsLib settings system, since it's more convenient. And prettier. Though, I am biased, of course.
I have integrated the vanilla mod settings into the HugsLib Mod Settings dialog, so both should work together nicely.

I have converted some event hooks to Harmony patches, so there will be slight timing differences on the ModBase events- it shouldn't affect your mod in most cases.
Automatic Harmony patching for library mods has also been added. If you have a class that extends ModBase in your assembly, your Harmony patches marked with attributes will be applied automatically before your mod is initialized. This can be turned off by overriding ModBase.HarmonyAutoPatch. Your mod's Harmony instance can be accessed using ModBase.HarmonyInstance.

Here are some other noteworthy changes:
- GUI injection has been removed.
   This was a feature designed to mitigate the detour proliferation issue, but should no longer be necessary now that Harmony is around. Just make a postfix for DoWindowContents on the window of your choosing, and you're good to go.
   There is an issue with placing new buttons over vanilla buttons at the moment, but I'll see if I can figure something out.
- Added full Harmony patch information to the log publisher
   Every Harmony patch should be listed, so when diagnosing bugs this might be a good place to start.
- Dropped some junk lines from the published logs for better readability
- Added optional platform information to the log publisher (CPU, RAM, OS)
   Hidden by default for privacy and stuff- have the player hold Shift when publishing the log if you need that information.
- Added MapDiscarded callback to ModBase
   A new callback for anything you need to do when a map is abandoned- such as an encounter or player home map. Useful for cleaning up old data to avoid clogging up the save file.
- ModBase.OnGUI is now called during UIRoot.UIRootOnGUI and already has UI scaling applied
   Also, OnGUI will no longer be called during loading screens.
- ModBase.ComponentsInitializing is now called after all components have been instantiated
- Added error and warning prefixes to the logger for better readability on text logs
- Moved controller initialization to the earliest point possible
   The controller will now initialize when Verse.Mod's are instantiated, so reflection for non-library mods should be easier.
- Removed mods dialog auto-restarter
   Vanilla now includes an automatic restart feature when the mod configuration is changed.
- Added automatic restart on language change
   However, it should also restart when the language is changed, as a Def reload is triggered (thanks Skyarkhangel).
- Removed short hash collision resolver
   The fix has been rolled into vanilla- it's not ideal, but it should do.
- Added IntVec3 extension methods for designations
   HugsLibUtility methods for quickly managing designations on tiles.
- Long settings handle names will now wrap around and display properly
- Removed Log window copy button
   Vanilla now includes text selection and a "copy all" button.
- Removed WindowReplacer (use Harmony)
- Added EntryName parameter to ModSettingsManager.GetModSettings
   This will allow you to add a mod name to display in the Mod Settings dialog, if you're adding settings via reflection.
- Fixed exception if a map failed to load due to an error in another mod
- Converted all comments to XML docs for reading during code completion

That should about cover it. Tons of changes, so bugs are likely. Please let me know if you find any.
Happy modding!
HugsLib - AllowTool - Remote Tech - Map Reroll - Defensive Positions: Github, Steam

Brrainz

Damn. This is some fine work there, Sir Unlimited!
I salute you. o7

PS: to everyone enjoying this - if you want you can support Harmony
by staring the project on github.
Here's the link: https://github.com/pardeike/Harmony

UnlimitedHugs

Updated A16 branch to 2.4.4

Switching game language will now prompt the player to restart the game- or restart automatically if the appropriate option is set. This should help avoid any sneaky bugs caused by unhandled def reloads. This feature is implemented in the A17 version, as well, so this is a backport, if you will.
Thank you Skyarkhangel for the report.
HugsLib - AllowTool - Remote Tech - Map Reroll - Defensive Positions: Github, Steam


UnlimitedHugs

Quote from: Wishmaster on May 10, 2017, 08:59:36 AM
Is there a way to use the old attributes form the A16 version in the A17 version ?

Well, I kept the attribute callback system, even though it is currently unused- though you're probably asking about patching. In which case- kind of. Harmony has its own attribute system as detailed here.
I'll see if I can write that page about migration tomorrow- hopefully it will help you have an easier time with the transition.
HugsLib - AllowTool - Remote Tech - Map Reroll - Defensive Positions: Github, Steam

UnlimitedHugs

As promised, I prepared a wiki page on the topic of patching. These are just the basics, but should get you well on your way with the new system.
I hope you will find it helpful.

Introduction to Patching NEW
HugsLib - AllowTool - Remote Tech - Map Reroll - Defensive Positions: Github, Steam

Wishmaster

Quote from: UnlimitedHugs on May 10, 2017, 12:53:12 PM
Quote from: Wishmaster on May 10, 2017, 08:59:36 AM
Is there a way to use the old attributes form the A16 version in the A17 version ?

Well, I kept the attribute callback system, even though it is currently unused- though you're probably asking about patching. In which case- kind of. Harmony has its own attribute system as detailed here.
I'll see if I can write that page about migration tomorrow- hopefully it will help you have an easier time with the transition.

I just wanted to be able to use that old [ DetourMethod(...)] attribute just like before. But I've read your wiki page and now I know why it's not possible anymore.

Thank you anyway to you and pardeike for your time and efforts.