Ludeon Forums

RimWorld => Mods => Releases => Topic started by: UnlimitedHugs on December 15, 2016, 02:20:14 PM

Title: [1.5] HugsLib (11.0.3) Lightweight modding library
Post by: UnlimitedHugs on December 15, 2016, 02:20:14 PM
(http://i.imgur.com/W8wAiTm.png)

Description:
HugsLib is a lightweight shared mod library for Rimworld. It is designed to provide a foundation for mods and deliver shared functionality.
I initially developed this for my own mods, but decided to make it publicly available after people showed interest in using the library for their own work.

Notice

(http://i.imgur.com/9w7Faoh.png) (http://i.imgur.com/9w7Faoh.png) (http://i.imgur.com/0k6igKb.png) (http://i.imgur.com/0k6igKb.png) (https://i.imgur.com/iOItRhL.png) (https://i.imgur.com/iOItRhL.png)
(http://i.imgur.com/diBJzKO.png) (http://i.imgur.com/oUBTZSl.png)

Features

Included translations: Russian (by anonymous, dragomano), Simplified Chinese (by cainiaowu), Traditional Chinese (by duduluu, shiuanyue, CuteLasty), Polish (by Kunegard), Spanish (by nahuen89, PelucheKawaii, 53N4), Japanese (by Proxyer), Korean (by urty5656), French (kaptain-kavern), German (maculator).

Dependency tags
If your mod depends on HugsLib, it is recommended to include these tags in your About.xml file:
<modDependencies>
    <li>
        <packageId>UnlimitedHugs.HugsLib</packageId>
        <displayName>HugsLib</displayName>
        <downloadUrl>https://github.com/UnlimitedHugs/RimworldHugsLib/releases/latest</downloadUrl>
        <steamWorkshopUrl>steam://url/CommunityFilePage/818773962</steamWorkshopUrl>
    </li>
</modDependencies>
<loadAfter>
    <li>UnlimitedHugs.HugsLib</li>
</loadAfter>

Documentation
Rimworld 1.1 update guide (https://github.com/UnlimitedHugs/RimworldHugsLib/wiki/HugsLib-7.0-for-Rimworld-1.1-update-guide)

ModBase reference (https://github.com/UnlimitedHugs/RimworldHugsLib/wiki/ModBase-reference) (start here)
Adding mod settings (https://github.com/UnlimitedHugs/RimworldHugsLib/wiki/Adding-mod-settings)
World data storage (https://github.com/UnlimitedHugs/RimworldHugsLib/wiki/World-data-storage)
Mod update news (https://github.com/UnlimitedHugs/RimworldHugsLib/wiki/Mod-update-news)
Introduction to Patching (https://github.com/UnlimitedHugs/RimworldHugsLib/wiki/Introduction-to-Patching)
Custom Tick Scheduling (https://github.com/UnlimitedHugs/RimworldHugsLib/wiki/Custom-Tick-Scheduling)
Development Utilities (https://github.com/UnlimitedHugs/RimworldHugsLib/wiki/Development-Utilities#quickstarter)

Deprecated features (A16)
Detouring (https://github.com/UnlimitedHugs/RimworldHugsLib/wiki/Detouring)
GUI injection (https://github.com/UnlimitedHugs/RimworldHugsLib/wiki/GUI-Injection)

If there is something missing, feel free to look through the code, or message me if you need more info.

Contributions
Detour by attribute feature added by Fluffy
Detour safety checks contributed by 1000101 and Zhentar
HubsLib badge contributed by Alistaire
Shell commands contributed by scuba156

Honorable mentions go to Andreas Pardeike for the lovely Harmony library.

Pack policy
Feel free to use and include wherever. Credit is optional.

Source
Github (https://github.com/UnlimitedHugs/RimworldHugsLib)

How to install
To install using Steam:
To install manually:

Download
The Harmony mod is required and must also be installed: Latest version (https://github.com/pardeike/HarmonyRimWorld/releases/latest)

HugsLib: Latest version (https://github.com/UnlimitedHugs/RimworldHugsLib/releases/latest)

Also available on the Steam Workshop (http://steamcommunity.com/sharedfiles/filedetails/?id=818773962)

Also available on NuGet (https://www.nuget.org/packages/UnlimitedHugs.Rimworld.HugsLib/)
Title: Re: [A16U] HugsLib (2.0.0) Lightweight modding library
Post by: UnlimitedHugs on December 15, 2016, 02:20:45 PM
Library badge
If your mod or modpack uses HugsLib, and you're in the market for a fancy badge, you can use this one to link back to this thread:

(http://i.imgur.com/9L4f8u7.png) (https://ludeon.com/forums/index.php?topic=28066)

[url=https://ludeon.com/forums/index.php?topic=28066][img]http://i.imgur.com/9L4f8u7.png[/img][/url]
Title: Re: [A16U] HugsLib (2.0.0) Lightweight modding library
Post by: UnlimitedHugs on December 15, 2016, 02:21:11 PM
Reserved.
Title: Re: [A16U] HugsLib (2.0.0) Lightweight modding library
Post by: joaonunes on December 15, 2016, 02:45:48 PM
soooooo is this supposed to be something like CCL but with features like "Version Checker" from Starsector or "AVC" from Kerbal Space Program? (a.k.a. mod version checker)
If yes, then this can potentially be one of the best mods that ever existed for this game, it only depends on the will of the other modders to include a file regarding mod version.

However, the other mods I referred, which are for other games, do not need a dll to do that, they use a xml file (the one for Starsector has a ".version" extension but it's xml if you open it :P)... May I ask why you chose to go with the dll?

And if this is not only about version checking but also having some CCL features will it be compatible with other mods or just not with CCL? Does it work with CCL? Is this meant to be a replacement for CCL?

Sorry for all the questions but I am really curious about this mod :)
Title: Re: [A16U] HugsLib (2.0.0) Lightweight modding library
Post by: UnlimitedHugs on December 15, 2016, 03:08:35 PM
Quote from: joaonunes on December 15, 2016, 02:45:48 PM
soooooo is this supposed to be something like CCL but with features like "Version Checker" from Starsector or "AVC" from Kerbal Space Program? (a.k.a. mod version checker)
If yes, then this can potentially be one of the best mods that ever existed for this game, it only depends on the will of the other modders to include a file regarding mod version.

However, the other mods I referred, which are for other games, do not need a dll to do that, they use a xml file (the one for Starsector has a ".version" extension but it's xml if you open it :P)... May I ask why you chose to go with the dll?

And if this is not only about version checking but also having some CCL features will it be compatible with other mods or just not with CCL? Does it work with CCL? Is this meant to be a replacement for CCL?

Sorry for all the questions but I am really curious about this mod :)

This is not going to replace CCL, just make modding easier and provide some common facilities for those mods that want to use them. Mods that don't will be elminated are still compatible, of course. So, similar purposes, you could say. It is compatible with CCL and there is even some integration.
The difference is that I want to keep the library light and simple, so that it can be updated within a few days of a new release. Which means I'm not going to include a lot of useful xml stuff and detours that CCL provides.

As for the version checking, the companion assembly will only check the version of the library, not that of other mods. I chose to go for the assembly because it will give a clear error dialog to the player when the library is missing. It would be hard to figure out the problem otherwise.

I hope that helps.
Title: Re: [A16U] HugsLib (2.0.0) Lightweight modding library
Post by: joaonunes on December 15, 2016, 03:18:04 PM
Quote from: UnlimitedHugs on December 15, 2016, 03:08:35 PM
This is not going to replace CCL, just make modding easier and provide some common facilities for those mods that want to use them. Mods that don't will be elminated are still compatible, of course. So, similar purposes, you could say. It is compatible with CCL and there is even some integration.
The difference is that I want to keep the library light and simple, so that it can be updated within a few days of a new release. Which means I'm not going to include a lot of useful xml stuff and detours that CCL provides.

As for the version checking, the companion assembly will only check the version of the library, not that of other mods. I chose to go for the assembly because it will give a clear error dialog to the player when the library is missing. It would be hard to figure out the problem otherwise.

I hope that helps.

Ahh, I misunderstood the sentence "-Checker assembly: A small dll designed to be included with your mod, that ensures the player is running at least the version of the library you specify.".

Thank you for clarifying my doubts!


You should think about it though xD
Title: Re: [A16U] HugsLib (2.0.0) Lightweight modding library
Post by: UnlimitedHugs on December 15, 2016, 03:35:20 PM
Quote from: joaonunes on December 15, 2016, 03:18:04 PM
You should think about it though xD

Oh, I did- even planned out parts of it. It's a massive chunk of work, though.
Gotta pick your battles- and I figured I'd rather make some mods in that time.
Title: Re: [A16U] HugsLib (2.0.0) Lightweight modding library
Post by: joaonunes on December 15, 2016, 04:40:43 PM
Quote from: UnlimitedHugs on December 15, 2016, 03:35:20 PM
Quote from: joaonunes on December 15, 2016, 03:18:04 PM
You should think about it though xD

Oh, I did- even planned out parts of it. It's a massive chunk of work, though.
Gotta pick your battles- and I figured I'd rather make some mods in that time.

I bet it is. Looking at your code I can see you know what you are doing, and I actually tried to find any piece of code that could be related to the version check :P my quick scan found nothing and I had too much hunger to keep looking xD

It would be an awesome mod though... Made a post with a suggestion for a version checker mod just in case ;)

Did you write all the code in this mod or did you have some help/copy-paste from other sources?
Title: Re: [A16U] HugsLib (2.0.0) Lightweight modding library
Post by: UnlimitedHugs on December 15, 2016, 05:23:15 PM
Check is over here (https://github.com/UnlimitedHugs/RimworldHugsLibChecker/blob/master/Source/HugsLibChecker.cs#L25)- separate project for the companion assembly.

Quote from: joaonunes on December 15, 2016, 04:40:43 PM
Did you write all the code in this mod or did you have some help/copy-paste from other sources?

I took the detouring code from CCL, but the rest I accumulated over the past couple of months. Most of it was to make working on my own mods easier.
Title: Re: [A16U] HugsLib (2.0.0) Lightweight modding library
Post by: Dingo on December 15, 2016, 07:09:39 PM
Post for tracking purposes. I of course plan to continue using this lib for my personal mods.
Title: Re: [A16U] HugsLib (2.0.0) Lightweight modding library
Post by: joaonunes on December 15, 2016, 07:21:47 PM
I forgot that feature basically exists in the steam workshop xD
Title: Re: [A16U] HugsLib (2.0.0) Lightweight modding library
Post by: faltonico on December 15, 2016, 08:24:59 PM
Keep up the good work!
Try to keep it simple always ;)
Title: Re: [A16U] HugsLib (2.0.0) Lightweight modding library
Post by: joaonunes on December 15, 2016, 09:26:04 PM
Quote from: faltonico on December 15, 2016, 08:24:59 PM
Keep up the good work!
Try to keep it simple always ;)

The KISS method is the best method!
"Keep It Simple, Stupid!" - had a teacher that kept saying this to us because we liked to fill out all of the "what if's" when coding any piece of s... code :P
Title: Re: [A16U] HugsLib (2.0.0) Lightweight modding library
Post by: UnlimitedHugs on December 16, 2016, 03:47:26 PM
Added a wiki page on how to get started with the library: ModBase reference (https://github.com/UnlimitedHugs/RimworldHugsLib/wiki/ModBase-reference)
Title: Re: [A16U] HugsLib (2.1.0) Lightweight modding library
Post by: UnlimitedHugs on December 16, 2016, 05:27:36 PM
Updated to 2.1.0

Added the "Detour by attribute" feature contributed by Fluffy.
Title: Re: [A16U] HugsLib (2.1.0) Lightweight modding library
Post by: Adventurer on December 16, 2016, 08:09:02 PM
Thank god!
Title: Re: [A16U] HugsLib (2.1.0) Lightweight modding library
Post by: Wishmaster on December 17, 2016, 12:04:14 PM
Isn't there a A15 version of this or a similar mod ?
Title: Re: [A16U] HugsLib (2.1.0) Lightweight modding library
Post by: UnlimitedHugs on December 17, 2016, 12:26:16 PM
Quote from: Wishmaster on December 17, 2016, 12:04:14 PM
Isn't there a A15 version of this or a similar mod ?

There is- it used to come packaged with the mods that made use of it. There were some issues with that approach, though, so now it is distributed separately.
Title: Re: [A16U] HugsLib (2.1.2) Lightweight modding library
Post by: Thundercraft on December 18, 2016, 10:31:22 PM
PTW  8)
Title: Re: [A16U] HugsLib (2.1.2) Lightweight modding library
Post by: scuba156 on December 19, 2016, 01:32:21 AM
I'm trying to use HugsLib WindowReplacer to replace Verse.Page_CreateWorldParams (The window during create a new colony where you select the parameters for world generation) and I'm having a few problems. Once the window is replaced, it breaks the new colony process.

Take the following page that simply changes the windows title for example:

using RimWorld;

namespace Blah
{
    public class Page_CreateWorldParamsExtended : Page_CreateWorldParams
    {
        public override string PageTitle
        {
          get
          {
            return "Blah";
          }
        }
    }
}


It will replace the window fine and show the new title, but pressing back will close the window and return to the main menu instead of going back a page to the story teller selection page, and pressing generate looks like it triggers a world to generate but not show the select landing site page and instead just returns to the main menu. It seems like a scene/scenario issue and I've been trying to find what I'm missing for a bit too long now. Any Ideas?
Title: Re: [A16U] HugsLib (2.1.2) Lightweight modding library
Post by: UnlimitedHugs on December 19, 2016, 08:47:27 AM
Quote from: scuba156 on December 19, 2016, 01:32:21 AM
- WindowReplacer issue -

WindowReplacer is a good choice for basic windows that don't require much setup. Still, you could make it work by restoring the links to the other pages after your window opens.
Take a look at Scenario.GetFirstConfigPage(), where the original window is created. You would likely need a reference to the window you're replacing- I could make the replacer store that, if it helps.
Title: Re: [A16U] HugsLib (2.1.2) Lightweight modding library
Post by: scuba156 on December 19, 2016, 09:37:58 AM
Thanks, but I can already get it. TBH, I'm actually just editing HugsLibs WindowReplacer Class at the moment as it's easier to look for what I need on the OnGUI method. I've added a ReplacePage method to it, and will do a pull request once I have it working since this happens for all page classes.

I checked out Scenario.GetFirstConfigPage() but I could only get Page_ConfigureStartingPawn. I think I know where I might of gone wrong. I'm about to start coding now so I'll test some things. Thank you.

Update: Well I got lazy for now and just decided to detour GetFirstConfigPage and insert my page in the originals place :/. I got GetFirstConfigPage confused with ScenPart.GetConfigPages, but had looked at it before. As I thought I went wrong earlier, I wasn't going through the pages next property. Should be easy enough to get the "GameStartDialog" Part, copy prev/next/next act and replace the page. I may do it soon but I would like to continue on my project for now :)
Title: Re: [A16U] HugsLib (2.1.2) Lightweight modding library
Post by: Wishmaster on December 20, 2016, 09:18:34 AM
How I do make my mod to check for updates ?
Title: Re: [A16U] HugsLib (2.1.2) Lightweight modding library
Post by: UnlimitedHugs on December 20, 2016, 09:43:28 AM
Quote from: Wishmaster on December 20, 2016, 09:18:34 AM
How I do make my mod to check for updates ?

Checking for mod updates is not a feature (yet?). The only version the checker looks for is the library itself, since a newer version may be required for that mod to work properly.
Title: Re: [A16] HugsLib (2.1.2) Lightweight modding library
Post by: Jaxxa on December 20, 2016, 08:33:46 PM
Looks awesome.
At the very least I will be using this for my mods that require Detours.
Title: Re: [A16] HugsLib (2.1.2) Lightweight modding library
Post by: lllMWNlll on December 22, 2016, 01:53:04 PM
I can't start new game

Exception from asynchronous event: System.MissingMethodException: No constructor found for HugsLib.MapComponent_HugsProxy::.ctor(Verse.Map)
  at System.Activator.CreateInstance (System.Type type, BindingFlags bindingAttr, System.Reflection.Binder binder, System.Object[] args, System.Globalization.CultureInfo culture, System.Object[] activationAttributes) [0x00000] in <filename unknown>:0
  at System.Activator.CreateInstance (System.Type type, System.Object[] args, System.Object[] activationAttributes) [0x00000] in <filename unknown>:0
  at System.Activator.CreateInstance (System.Type type, System.Object[] args) [0x00000] in <filename unknown>:0
  at Verse.Map.ConstructComponents () [0x00000] in <filename unknown>:0
  at Verse.MapGenerator.GenerateMap (IntVec3 mapSize, Int32 tile, RimWorld.Planet.MapParent parent, System.Action`1 extraInitBeforeContentGen, Verse.MapGeneratorDef mapGenerator) [0x00000] in <filename unknown>:0
  at Verse.Game.InitNewGame () [0x00000] in <filename unknown>:0
  at Verse.Root_Play.<Start>m__737 () [0x00000] in <filename unknown>:0
  at Verse.LongEventHandler.RunEventFromAnotherThread (System.Action action) [0x00000] in <filename unknown>:0
Verse.Log:Error(String)
Verse.LongEventHandler:RunEventFromAnotherThread(Action)
Verse.LongEventHandler:<UpdateCurrentAsynchronousEvent>m__733()
Title: Re: [A16] HugsLib (2.1.2) Lightweight modding library
Post by: UnlimitedHugs on December 22, 2016, 02:08:11 PM
Quote from: lllMWNlll on December 22, 2016, 01:53:04 PM
Exception from asynchronous event: System.MissingMethodException: No constructor found for HugsLib.MapComponent_HugsProxy::.ctor(Verse.Map)

Looks like you're trying to run HugsLib for A15 on A16. HugsLib used to come packaged with the mods that use it- look for the file $HugsLib.dll (including the dollar sign), and you can find out which mod forgot to remove it.
Title: Re: [A16] HugsLib (2.1.2) Lightweight modding library
Post by: DaemonDeathAngel on December 22, 2016, 02:28:18 PM
Does this assembly make it possible to hide aspects of yhe core files, such as all research and/or structures/buildings?

I have no C# knowledge so I am trying to find a workaround.
Title: Re: [A16] HugsLib (2.1.2) Lightweight modding library
Post by: UnlimitedHugs on December 22, 2016, 02:50:59 PM
Quote from: DaemonDeathAngel on December 22, 2016, 02:28:18 PM
Does this assembly make it possible to hide aspects of yhe core files, such as all research and/or structures/buildings?

The library wouldn't be required for that. You can already override Core Defs with your own, using xml. If you are looking for more flexibility in that department, there is Mod Friendly Overrides (https://github.com/notfood/RimWorld-MFO) scheduled to be released sometime soon.
Title: Re: [A16] HugsLib (2.1.4) Lightweight modding library
Post by: UnlimitedHugs on December 24, 2016, 02:46:48 AM
Updated to 2.1.4

Two significant changes:
- Strict detouring checks. Detours will now be checked for parameter and return type compatibility, as well as some other potential issues. These will be displayed as warnings in the interest of compatibility, but are there to help prevent serious and difficult to diagnose problems.
- Shorthash collision resolution. Due to an issue in the vanilla game, modded defs can end up being assigned the same hash. This will cause errors on loading a saved game. The fix resolves these conflicts for all mods (including those not directly referencing the library) by assigning new hashes to offending defs.
Title: Re: [A16] HugsLib (2.1.4) Lightweight modding library
Post by: DaemonDeathAngel on December 24, 2016, 09:48:19 AM
Now that I know what this system is capable of, it is a life saver. One feature I really like is the gist upload feature for error logs.
Title: Re: [A16] HugsLib (2.1.4) Lightweight modding library
Post by: System.Linq on December 26, 2016, 10:45:02 AM
Would you kindly detour the FoodUtility code to make it so that more than one ingestThought can be put on a food item? I'd do it myself but it's so tangential to my mod I thought it might be better as part of the library.
Title: Re: [A16] HugsLib (2.1.4) Lightweight modding library
Post by: UnlimitedHugs on December 26, 2016, 05:54:54 PM
Quote from: Psychology on December 26, 2016, 10:45:02 AM
Would you kindly detour the FoodUtility code to make it so that more than one ingestThought can be put on a food item? I'd do it myself but it's so tangential to my mod I thought it might be better as part of the library.

No can do. I'd like to avoid making detours in the library itself, if I can help it. Also, this is unnecessary bloat that I would have to support from now on.
Title: Re: [A16] HugsLib (2.1.6) Lightweight modding library
Post by: Wishmaster on December 28, 2016, 01:02:01 PM
I used the detour lib of HugsLibs. It's amazing, convenient and safer.
I wish more mods use it.
Good work.
Title: Re: [A16] HugsLib (2.1.6) Lightweight modding library
Post by: System.Linq on December 28, 2016, 02:51:38 PM
How do you recommend handling compatibility for two mods that detour the same methods? With CCL it seemed like you could just load one after the other and it would overwrite that mod's detour with the new one.
Title: Re: [A16] HugsLib (2.1.6) Lightweight modding library
Post by: UnlimitedHugs on December 28, 2016, 07:55:19 PM
Quote from: Wishmaster on December 28, 2016, 01:02:01 PM
I used the detour lib of HugsLibs. It's amazing, convenient and safer.

Thank you. I'm glad this makes your modding experience easier.

Quote from: Psychology on December 28, 2016, 02:51:38 PM
How do you recommend handling compatibility for two mods that detour the same methods? With CCL it seemed like you could just load one after the other and it would overwrite that mod's detour with the new one.

Looks like you're right, CCL allows detours to be overwritten. I will add that to the library.
Of course, the way of properly resolving the situation is slightly more complex. I see three options:
Title: Re: [A16] HugsLib (2.1.6) Lightweight modding library
Post by: System.Linq on December 28, 2016, 08:08:46 PM
What I ended up doing was removing the DetourMethodAttributes and instead detouring the methods using TryCompatibleDetour() on DefsLoaded(), and disabling certain parts of the mod if those detours could not be made.

The only downside is the new annoying yellow warning message about a dangerous detour on Pawn_RelationsTracker, which shows up with TryCompatibleDetour() but not with a DetourMethodAttribute.

I think that not allowing overwriting by default is probably the superior solution, since it will draw attention immediately to conflicts which might otherwise be subtle and insidious. You just need to document how to handle it.

Or perhaps the best solution is to overwrite it by default, and log a warning message about it, since that's what most mod authors will end up doing anyway.
Title: Re: [A16] HugsLib (2.1.6) Lightweight modding library
Post by: UnlimitedHugs on December 28, 2016, 08:29:46 PM
Quote from: Psychology on December 28, 2016, 08:08:46 PM
What I ended up doing was removing the DetourMethodAttributes and instead detouring the methods using TryCompatibleDetour() on DefsLoaded()

At the moment that's a good way to run fallback code when a detour fails.

Quote from: Psychology on December 28, 2016, 08:08:46 PM
The only downside is the new annoying yellow warning message about a dangerous detour on Pawn_RelationsTracker, which shows up with TryCompatibleDetour() but not with a DetourMethodAttribute.

That warning should appear in both cases- it is meant to highlight a problem with the target method signature or its parent type. Could you show me your implemetation of the detour? I'd like to replicate the discrepancy.

As for overwriting by default, it doesn't really matter which mod gets their detour in when there's a conflict. But there should be a way for the mod to detect the collision and run some fallback code. Perhaps adding a callback method to the attribute is the way to go.

Title: Re: [A16] HugsLib (2.1.6) Lightweight modding library
Post by: System.Linq on December 28, 2016, 09:19:45 PM
Quote from: UnlimitedHugs on December 28, 2016, 08:29:46 PM
That warning should appear in both cases- it is meant to highlight a problem with the target method signature or its parent type. Could you show me your implemetation of the detour? I'd like to replicate the discrepancy.


namespace Psychology.Detour
{
    internal static class _Pawn_RelationsTracker
    {
        internal static FieldInfo _pawn;

        internal static Pawn GetPawn(this Pawn_RelationsTracker _this)
        {
            if (_Pawn_RelationsTracker._pawn == null)
            {
                _Pawn_RelationsTracker._pawn = typeof(Pawn_RelationsTracker).GetField("pawn", BindingFlags.Instance | BindingFlags.NonPublic);
                if (_Pawn_RelationsTracker._pawn == null)
                {
                    Log.ErrorOnce("Unable to reflect Pawn_RelationsTracker.pawn!", 305432421);
                }
            }
            return (Pawn)_Pawn_RelationsTracker._pawn.GetValue(_this);
        }

        [DetourMethod(typeof(Pawn_RelationsTracker),"Notify_RescuedBy")]
        internal static void _Notify_RescuedBy(this Pawn_RelationsTracker t, Pawn rescuer)
        {

            if (rescuer.RaceProps.Humanlike && t.canGetRescuedThought)
            {
                t.GetPawn().needs.mood.thoughts.memories.TryGainMemoryThought(ThoughtDefOf.RescuedMe, rescuer);
                t.canGetRescuedThought = false;
                rescuer.needs.mood.thoughts.memories.TryGainMemoryThought(ThoughtDefOfPsychology.RescuedBleedingHeart, t.GetPawn());
            }
        }
       
        internal static float _SecondaryRomanceChanceFactor(this Pawn_RelationsTracker t, Pawn otherPawn)
        {
            Pawn pawn = t.GetPawn();
            if (pawn.def != otherPawn.def || pawn == otherPawn)
            {
                return 0f;
            }
            Rand.PushSeed();
            Rand.Seed = pawn.HashOffset();
            bool flag = Rand.Value < 0.015f;
            Rand.PopSeed();
            float num = 1f;
            float num2 = 1f;
            float ageBiologicalYearsFloat = pawn.ageTracker.AgeBiologicalYearsFloat;
            float ageBiologicalYearsFloat2 = otherPawn.ageTracker.AgeBiologicalYearsFloat;
            PsychologyPawn realPawn = pawn as PsychologyPawn;
            if (PsychologyBase.ActivateKinsey() && realPawn != null)
            {
                flag = true;
                float kinsey = 3 - realPawn.sexuality.kinseyRating;
                float homo = (pawn.gender == otherPawn.gender) ? 1f : -1f;
                num2 = Mathf.InverseLerp(3f, 0f, kinsey * homo);
            }
            if (pawn.gender == Gender.Male)
            {
                if (!flag)
                {
                    if (pawn.RaceProps.Humanlike && pawn.story.traits.HasTrait(TraitDefOf.Gay))
                    {
                        if (otherPawn.gender == Gender.Female)
                        {
                            return 0f;
                        }
                    }
                    else if (otherPawn.gender == Gender.Male)
                    {
                        return 0f;
                    }
                }
                num2 = GenMath.FlatHill(0f, 16f, 20f, ageBiologicalYearsFloat, ageBiologicalYearsFloat + 15f, 0.07f, ageBiologicalYearsFloat2);
                if (pawn.RaceProps.Humanlike && pawn.story.traits.HasTrait(TraitDefOfPsychology.OpenMinded))
                {
                    num2 = 1f;
                }
            }
            else if (pawn.gender == Gender.Female)
            {
                if (!flag)
                {
                    if (pawn.RaceProps.Humanlike && pawn.story.traits.HasTrait(TraitDefOf.Gay))
                    {
                        if (otherPawn.gender == Gender.Male)
                        {
                            return 0f;
                        }
                    }
                    else if (otherPawn.gender == Gender.Female)
                    {
                        num = 0f;
                    }
                }
                if ((ageBiologicalYearsFloat2 < ageBiologicalYearsFloat - 10f) && (pawn.story.traits.HasTrait(TraitDefOfPsychology.OpenMinded)))
                {
                    return 0f;
                }
                if (ageBiologicalYearsFloat2 < ageBiologicalYearsFloat - 3f)
                {
                    num2 = Mathf.InverseLerp(ageBiologicalYearsFloat - 10f, ageBiologicalYearsFloat - 3f, ageBiologicalYearsFloat2) * 0.2f;
                }
                else
                {
                    num2 = GenMath.FlatHill(0.2f, ageBiologicalYearsFloat - 3f, ageBiologicalYearsFloat, ageBiologicalYearsFloat + 10f, ageBiologicalYearsFloat + 30f, 0.1f, ageBiologicalYearsFloat2);
                }
                if (pawn.RaceProps.Humanlike && pawn.story.traits.HasTrait(TraitDefOfPsychology.OpenMinded))
                {
                    num2 = 1f;
                }
            }
            float num3 = 1f;
            num3 *= Mathf.Lerp(0.2f, 1f, otherPawn.health.capacities.GetEfficiency(PawnCapacityDefOf.Talking));
            num3 *= Mathf.Lerp(0.2f, 1f, otherPawn.health.capacities.GetEfficiency(PawnCapacityDefOf.Manipulation));
            num3 *= Mathf.Lerp(0.2f, 1f, otherPawn.health.capacities.GetEfficiency(PawnCapacityDefOf.Moving));
            if (pawn.RaceProps.Humanlike && pawn.story.traits.HasTrait(TraitDefOfPsychology.OpenMinded))
            {
                num3 = 1f;
            }
            float num4 = 1f;
            foreach (PawnRelationDef current in pawn.GetRelations(otherPawn))
            {
                num4 *= current.attractionFactor;
            }
            int num5 = 0;
            if (otherPawn.RaceProps.Humanlike)
            {
                num5 = otherPawn.story.traits.DegreeOfTrait(TraitDefOf.Beauty);
            }
            if (pawn.RaceProps.Humanlike && pawn.story.traits.HasTrait(TraitDefOfPsychology.OpenMinded))
            {
                num5 = 0;
            }
            float num6 = 1f;
            if (num5 < 0)
            {
                num6 = 0.3f;
            }
            else if (num5 > 0)
            {
                num6 = 2.3f;
            }
            float num7 = Mathf.InverseLerp(15f, 18f, ageBiologicalYearsFloat);
            float num8 = Mathf.InverseLerp(15f, 18f, ageBiologicalYearsFloat2);
            return num * num2 * num3 * num4 * num7 * num8 * num6;
        }
    }
}


Quote from: UnlimitedHugs on December 28, 2016, 08:29:46 PM
As for overwriting by default, it doesn't really matter which mod gets their detour in when there's a conflict. But there should be a way for the mod to detect the collision and run some fallback code. Perhaps adding a callback method to the attribute is the way to go.

As long as you document how to use it!
Title: Re: [A16] HugsLib (2.1.6) Lightweight modding library
Post by: RemingtonRyder on December 29, 2016, 04:01:10 AM
I used HugsLib for a simple ThingDef stat value changer. It's super effective. :)
Title: Re: [A16] HugsLib (2.2.0) Lightweight modding library
Post by: UnlimitedHugs on December 29, 2016, 05:49:34 AM
Updated to 2.2.0

I have implemented a new attribute: DetourFallback.
It complements the existing detour by attribute system by allowing a method to be designated as a callback for when a detour fails. This can happen due to another mod being the first to detour the same method, or the method in question becoming unavailable.
You can read up on the new system on the wiki (https://github.com/UnlimitedHugs/RimworldHugsLib/wiki/Detouring#handling-detour-failures).

@Psychology
I wasn't able to replicate the discrepancy with the warnings, but then again I didn't have your manual detour implementation.
@MarvinKosh
I'm glad it worked out for you :)
Title: Re: [A16] HugsLib (2.2.0) Lightweight modding library
Post by: System.Linq on December 29, 2016, 06:59:35 AM
Would you kindly make Logger internal and not protected? It's unclear how you're supposed to use it outside ModBase.

e: I guess I don't have to in this case.

e2: DetourFallback works perfectly. Good work!
Title: Re: [A16] HugsLib (2.2.0) Lightweight modding library
Post by: UnlimitedHugs on December 29, 2016, 07:40:26 AM
Quote from: Psychology on December 29, 2016, 06:59:35 AM
Would you kindly make Logger internal and not protected? It's unclear how you're supposed to use it outside ModBase.

This is how I expose the logger in my own mods:

internal new ModLogger Logger {
    get { return base.Logger; }
}
Title: Re: [A16] HugsLib (2.2.0) Lightweight modding library
Post by: scuba156 on December 29, 2016, 08:35:50 AM
I'm currently using HugsLib and HugsLibChecker in my wip mod, detours work great. I've tried to link back to HugsLib where appropriate.

Any chance of getting pastebin (http://pastebin.com/api) support? Possibly default to pastebin if an apikey has been set in modbase?
Title: Re: [A16] HugsLib (2.2.0) Lightweight modding library
Post by: UnlimitedHugs on December 29, 2016, 09:07:14 AM
Quote from: scuba156 on December 29, 2016, 08:35:50 AM
Any chance of getting pastebin (http://pastebin.com/api) support? Possibly default to pastebin if an apikey has been set in modbase?

What would be the advantage of using Pastebin over the GitHub gists?
Title: Re: [A16] HugsLib (2.2.1) Lightweight modding library
Post by: System.Linq on December 30, 2016, 05:08:27 AM
It would appear that, when you detour a method that a class inherits from its parent, but doesn't actually override, it detours the parent's method instead. Any way around this?

e: Also, it's a shame there's no documentation for UpdateFeatureDef.
Title: Re: [A16] HugsLib (2.2.1) Lightweight modding library
Post by: UnlimitedHugs on December 30, 2016, 07:17:18 AM
Quote from: Psychology on December 30, 2016, 05:08:27 AM
It would appear that, when you detour a method that a class inherits from its parent, but doesn't actually override, it detours the parent's method instead. Any way around this?

I don't quite see the problem here. Would you rather have it generate an error?

Quote from: Psychology on December 30, 2016, 05:08:27 AM
e: Also, it's a shame there's no documentation for UpdateFeatureDef.

Yeah, I've been meaning to add a page about that. Gotta wait for inspiration to hit, though.
In the meantime, The code of UpdateFeatureDef has some comments on the formatting options. Also, Allow Tool and Defensive Positions both make use of this system if you're looking for practical examples.
Title: Re: [A16] HugsLib (2.2.1) Lightweight modding library
Post by: Trinan on December 30, 2016, 07:31:40 AM
Hello I have this problem, since English is not my native language. Maybe you can help me. Hugsmod comes directly to Core

[HugsLib] Exception during ApplyNewDetours: System.TypeLoadException: Could not load type 'System.Runtime.Serialization.DataContractAttribute' from assembly 'System.Runtime.Serialization, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
  at (wrapper managed-to-native) System.Reflection.MonoMethodInfo:get_method_info (intptr,System.Reflection.MonoMethodInfo&)
  at System.Reflection.MonoMethodInfo.GetMethodInfo (IntPtr handle) [0x00000] in <filename unknown>:0
  at System.Reflection.MonoMethod.GetPseudoCustomAttributes () [0x00000] in <filename unknown>:0
  at System.MonoCustomAttrs.GetPseudoCustomAttributes (ICustomAttributeProvider obj, System.Type attributeType) [0x00000] in <filename unknown>:0
  at System.MonoCustomAttrs.GetCustomAttributesBase (ICustomAttributeProvider obj, System.Type attributeType) [0x00000] in <filename unknown>:0
  at System.MonoCustomAttrs.GetCustomAttributes (ICustomAttributeProvider obj, System.Type attributeType, Boolean inherit) [0x00000] in <filename unknown>:0
  at System.Reflection.MonoMethod.GetCustomAttributes (System.Type attributeType, Boolean inherit) [0x00000] in <filename unknown>:0
  at Verse.GenAttribute.TryGetAttribute[DetourMethodAttribute] (System.Reflection.MemberInfo memberInfo, HugsLib.Source.Detour.DetourMethodAttribute& customAttribute) [0x00000] in <filename unknown>:0
  at Verse.GenAttribute.HasAttribute[DetourMethodAttribute] (System.Reflection.MemberInfo memberInfo) [0x00000] in <filename unknown>:0
  at HugsLib.Source.Detour.Helpers.<DoDetours>b__8 (System.Reflection.MethodInfo m) [0x00000] in <filename unknown>:0
  at System.Linq.Enumerable+<CreateWhereIterator>c__Iterator1D`1[System.Reflection.MethodInfo].MoveNext () [0x00000] in <filename unknown>:0
  at HugsLib.Source.Detour.Helpers.DoDetours () [0x00000] in <filename unknown>:0
  at HugsLib.HugsLibController.ApplyNewDetours () [0x00000] in <filename unknown>:0
Verse.Log:Error(String)
HugsLib.Utils.ModLogger:ReportException(Exception, String, Boolean, String)
HugsLib.HugsLibController:ApplyNewDetours()
HugsLib.HugsLibController:LoadReloadInitialize()
HugsLib.HugsLibController:Initalize()
HugsLib.Core.UnityProxyComponent:Start()
Title: Re: [A16] HugsLib (2.2.1) Lightweight modding library
Post by: UnlimitedHugs on December 30, 2016, 08:12:27 AM
Updated to 2.2.2

@Trinan
I've added some more safety checks to the detouring system that should solve this issue.
Title: Re: [A16] HugsLib (2.2.2) Lightweight modding library
Post by: Trinan on December 30, 2016, 08:27:02 AM
thank you but i have to test it later :(
Title: Re: [A16] HugsLib (2.2.1) Lightweight modding library
Post by: System.Linq on December 30, 2016, 05:34:07 PM
Quote from: UnlimitedHugs on December 30, 2016, 07:17:18 AM
I don't quite see the problem here. Would you rather have it generate an error?

I'd rather have it detour the method in the class I'm trying to detour it in, rather than having the detoured code apply to all of that parent's children. Hence why I asked if there was a different way to do that.
Title: Re: [A16] HugsLib (2.2.2) Lightweight modding library
Post by: Zhentar on December 30, 2016, 06:03:55 PM
So Class A is inherited by Classes B and C. You want to detour a method only for Class B, but that method is defined in Class A and not overridden in Class B.

In that case, the answer is no, you cannot; that goes far beyond the capabilities of the current detouring code. While it is technically not impossible, it would be extremely difficult to implement.
Title: Re: [A16] HugsLib (2.2.2) Lightweight modding library
Post by: System.Linq on December 30, 2016, 06:51:44 PM
Alright, figured as much. I solved the problem by using _this.GetType() == typeof(ClassIWant).
Title: Re: [A16] HugsLib (2.2.2) Lightweight modding library
Post by: lllMWNlll on December 30, 2016, 07:57:16 PM
I got a lot of log problems!

https://gist.github.com/d2d4baf2a35a61278be070b38b8bff15

I just updated. I'm using several mods, some of them are 15 yet this are the "15" ones:
A Dog Said...
CorePanda
Efficient Light 
Extended Medicine
Extended Fabrics
Expanded Power
Cupro's Drinks 
DE Surgeries   
RimFridge     
TrueMods   
Misc Mods
{ Core, Robots, RobotsX, RobotsXX

Hope i did help in something.
Title: Re: [A16] HugsLib (2.2.2) Lightweight modding library
Post by: UnlimitedHugs on December 30, 2016, 11:51:04 PM
Quote from: lllMWNlll on December 30, 2016, 07:57:16 PM
- snip -

I can't help you if you are using A15 mods on A16. Also, please make sure your game language is set to English when you submit your log- that makes it much easier to read.
Title: Re: [A16] HugsLib (2.2.2) Lightweight modding library
Post by: rawrfisher on December 31, 2016, 08:21:48 PM
Does Anyone know what this error means?

Got ThingsListAt out of bounds: (400, 0, 221)
Verse.Log:Error(String)
Verse.Log:ErrorOnce(String, Int32)
Verse.ThingGrid:ThingsListAt(IntVec3)
Verse.GridsUtility:GetThingList(IntVec3, Map)
Blueprints.BuildableInfo:CanPlace(IntVec3)
Blueprints.BuildableInfo:DrawGhost(IntVec3)
Blueprints.Blueprint:DrawGhost(IntVec3)
Blueprints.Designator_Blueprint:SelectedUpdate()
Verse.DesignatorManager:DesignatorManagerUpdate()
RimWorld.MapInterface:MapInterfaceUpdate()
RimWorld.UIRoot_Play:UIRootUpdate()
Verse.Root:Update()
Verse.Root_Play:Update()
Title: Re: [A16] HugsLib (2.2.2) Lightweight modding library
Post by: System.Linq on December 31, 2016, 09:10:46 PM
It means that your game is trying to load a specific Thing from the Things list, but there aren't that many Things in the list. You're going to need to provide more context.
Title: Re: [A16] HugsLib (2.2.2) Lightweight modding library
Post by: rawrfisher on January 01, 2017, 01:17:01 AM
I wish I could thats all the error log said
Title: Re: [A16] HugsLib (2.2.2) Lightweight modding library
Post by: RawCode on January 01, 2017, 02:10:10 AM
Quote from: Zhentar on December 30, 2016, 06:03:55 PM
So Class A is inherited by Classes B and C. You want to detour a method only for Class B, but that method is defined in Class A and not overridden in Class B.

In that case, the answer is no, you cannot; that goes far beyond the capabilities of the current detouring code. While it is technically not impossible, it would be extremely difficult to implement.

StackTrace st = new StackTrace ();
MethodBase calle = st.GetFrames () [1].GetMethod ();


if specialequals(callee, specificmethodreferencelist)
do x
else
do y


it's not ever close to "difficult", you just need to think self and not rely on random not very wise tutorials scattered all over the forum.
and yes, you will need to set injection whitelist SELF and reimplement entire vanilla method or copy x86 or assemble trampoline code.



Title: Re: [A16] HugsLib (2.2.2) Lightweight modding library
Post by: UnlimitedHugs on January 01, 2017, 08:22:03 AM
Quote from: rawrfisher on December 31, 2016, 08:21:48 PM
Does Anyone know what this error means?

Seems like this was caused by the Blueprints mod. Perhaps caused by an attempt to place a large blueprint on a smaller map.
It's a good idea to report this in Fluffy's thread.

Quote from: RawCode on January 01, 2017, 02:10:10 AM
- snip -

Not sure I understand your solution.
As Zhentar said, we can't detour a method that does not exist. Perhaps an override could be created using DynamicMethod, but I wouldn't trust that enough to put it in the library.
Title: Re: [A16] HugsLib (2.2.2) Lightweight modding library
Post by: lllMWNlll on January 01, 2017, 02:42:01 PM
https://gist.github.com/0d7bfa4a57a09d2ed5529419c1db15cf

Hey, i get some XML errors from [SD] mods, i have copy them right there.
I'm not using A15 mods anymore, i hope the report comes in English.

Those XML errors only happens after i put SD mods. Hope you can fix it.
Title: Re: [A16] HugsLib (2.2.2) Lightweight modding library
Post by: Wishmaster on January 01, 2017, 02:45:12 PM
Is there a way to dynamically hide/show some options ? My mod has many options and I would like to have a "show more options" button.
Title: Re: [A16] HugsLib (2.2.2) Lightweight modding library
Post by: UnlimitedHugs on January 01, 2017, 03:06:53 PM
Quote from: lllMWNlll on January 01, 2017, 02:42:01 PM
https://gist.github.com/0d7bfa4a57a09d2ed5529419c1db15cf

Thank you, that is much easier to read.
Search for the file TraderKinds_Orbital_Misc.xml - the mod that adds it is causing the issue. I can't fix someone else's mod, of course, but you could show that log to that mod's author.

Quote from: Wishmaster on January 01, 2017, 02:45:12 PM
Is there a way to dynamically hide/show some options ? My mod has many options and I would like to have a "show more options" button.

Props to you for being considerate and not overflowing the menu :)
You could use SettingHandle.CustomDrawer to make buttons that expand categories.
Set SettingHandle.VisibilityPredicate on the settings you wish to hide- returning false in that delegate will prevent that setting from being drawn.
Title: Re: [A16] HugsLib (2.2.2) Lightweight modding library
Post by: lllMWNlll on January 01, 2017, 04:55:30 PM
Quote from: UnlimitedHugs on January 01, 2017, 03:06:53 PM
Quote from: lllMWNlll on January 01, 2017, 02:42:01 PM
https://gist.github.com/0d7bfa4a57a09d2ed5529419c1db15cf

Ok, i will show to him, thanks for this :)

Title: Re: [A16] HugsLib (2.2.2) Lightweight modding library
Post by: System.Linq on January 01, 2017, 04:57:15 PM
Hugs, it seems like UpdateFeatureDef is throwing an error when given an assemblyVersion with four parts, despite the error message saying "between 2 and 4." 17.1.1 works, but not 17.1.1.3. And if I set it to 17.1.1, it won't actually show it if the version is 17.1.1.3.
Title: Re: [A16] HugsLib (2.2.2) Lightweight modding library
Post by: UnlimitedHugs on January 02, 2017, 01:57:59 AM
Quote from: Psychology on January 01, 2017, 04:57:15 PM
Hugs, it seems like UpdateFeatureDef is throwing an error when given an assemblyVersion with four parts, despite the error message saying "between 2 and 4." 17.1.1 works, but not 17.1.1.3. And if I set it to 17.1.1, it won't actually show it if the version is 17.1.1.3.

Must be a typo, it should be "between 2 and 3". I chose to discard the build number portion of the version to make things a bit clearer for the player.
Not saying it's the right way to do version numbering, but that's how the system is set up at the moment.
Also, it's a good idea to only highlight major additions to a mod using the news system. I'll write more on this once I get around to making that wiki page.
Title: Re: [A16] HugsLib (2.2.2) Lightweight modding library
Post by: System.Linq on January 02, 2017, 03:35:19 AM
But the modder chooses what versions to display news for. It doesn't tell the player on every update. My numbering system is based on how many times that day I've updated. 17.1.1.3 could be a far more important update than 17.1.2. I should get to decide what numbers are important.
Title: Re: [A16] HugsLib (2.2.2) Lightweight modding library
Post by: UnlimitedHugs on January 02, 2017, 04:40:48 AM
Quote from: Psychology on January 02, 2017, 03:35:19 AM
I should get to decide what numbers are important.

Tough toenails. Deal with it.
Title: Re: [A16] HugsLib (2.2.2) Lightweight modding library
Post by: System.Linq on January 02, 2017, 05:04:34 AM
It's a dumb choice. I see no sound logic behind it and it makes that feature unusable for me. If you're making a modding library, shouldn't you put a little thought into it besides "I chose to do it this way, deal with it"?
Title: Re: [A16] HugsLib (2.2.2) Lightweight modding library
Post by: UnlimitedHugs on January 02, 2017, 06:02:39 AM
Quote from: Psychology on January 02, 2017, 05:04:34 AM
It's a dumb choice.

Right, let's go be demanding and criticize the the guy's work, that'll get him to cooperate.
Now excuse me, I have a half-written wiki page to go throw out.
Title: Re: [A16] HugsLib (2.2.2) Lightweight modding library
Post by: System.Linq on January 02, 2017, 06:19:24 AM
I really don't understand your reasoning, you seem like you're being really petty. You're making a modder's resource, and yet you won't budge on things that would give modders more options when using it. Now you're going to bin something that would help other modders (and notably not me, because I obviously figured out how to use it already since I'm running into this problem) in response to criticism?

Your response to feature requests shouldn't be to pick up your ball and go home. That's childish. I'm not being demanding, you are making a library to serve modders. I'm a modder. I'd like to use your library a way that's not currently allowed but I see no reason why it shouldn't be. What are you going to do now, take it down entirely?
Title: Re: [A16] HugsLib (2.2.3) Lightweight modding library
Post by: UnlimitedHugs on January 02, 2017, 09:12:02 AM
Updated to 2.2.3

I've added two minor things to setting handles- a callback for when a handle value changes and a field you can set to expand the row height of the setting when using CustomDrawer.
Title: Re: [A16] HugsLib (2.3.0) Lightweight modding library
Post by: UnlimitedHugs on January 03, 2017, 08:31:54 AM
Updated to 2.3.0

I've added a brand new system that allows to inject code into any window in the game. And yes, it also uses attributes :)
I have done some internal reworking of the detouring system, so please let me know if everything is still working as expected for you (it should). I'll push the Steam update later if all is well.

Here are the new docs: GUI injection (https://github.com/UnlimitedHugs/RimworldHugsLib/wiki/GUI-Injection)
Title: Re: [A16] HugsLib (2.3.0) Lightweight modding library
Post by: UnlimitedHugs on January 04, 2017, 10:11:35 AM
@Psychology
I feel like I could have handled that situation better, so let me reword my response to you.

I will no stand for disrespect and attitudes of entitlement.

My work here is an act of service, but it is a service I choose to render on my own terms and at my own discretion.
Title: Re: [A16] HugsLib (2.3.0) Lightweight modding library
Post by: Fluffy (l2032) on January 04, 2017, 10:31:38 AM
@Psychology; given that semantic versioning is more or less a standard practice, it makes sense to base a versioning tool on it.
Title: Re: [A16] HugsLib (2.3.0) Lightweight modding library
Post by: UnlimitedHugs on January 04, 2017, 11:59:48 AM
I've added the "Mod update news" wiki page (https://github.com/UnlimitedHugs/RimworldHugsLib/wiki/Mod-update-news).

Also, 2.3.0 is now out on Steam.
Title: Re: [A16] HugsLib (2.3.0) Lightweight modding library
Post by: Alistaire on January 04, 2017, 05:14:05 PM
Hey, I made an icon which you may be interested in:

(http://i1032.photobucket.com/albums/a409/wingbull/HugsLibIcon_zpsqbxan5dk.png) (https://ludeon.com/forums/index.php?topic=28066.0)

Thanks for the library by the way!
Title: Re: [A16] HugsLib (2.3.0) Lightweight modding library
Post by: UnlimitedHugs on January 05, 2017, 10:29:05 AM
Quote from: Alistaire on January 04, 2017, 05:14:05 PM
Hey, I made an icon which you may be interested in

Hey, that looks neat. Nicely done :)
Added it as the library badge to the main post.
Title: Re: [A16] HugsLib (2.3.0) Lightweight modding library
Post by: System.Linq on January 06, 2017, 05:52:45 AM
Quote from: UnlimitedHugs on January 04, 2017, 10:11:35 AM
@Psychology
I feel like I could have handled that situation better, so let me reword my response to you.

I will no stand for disrespect and attitudes of entitlement.

My work here is an act of service, but it is a service I choose to render on my own terms and at my own discretion.

Respect goes both ways. I asked for a feature, you told me to choke on it, so I was less than understanding. "I should get to decide what version numbers are important" isn't an attitude of entitlement. I'm a modder, control over how my mod works is important. Rimworld has a thriving modding community because Tynan allows you to do pretty much whatever you want to the base game. If I ran into arbitrary walls all over, like the one you put up for reasons you refused to adequately explain, I would give up and stop modding. If I came off as demanding as a result of my frustration, I apologize. Of course any resource you provide is on your terms, but I felt disrespected as well and responded in kind. Ultimately the feature doesn't matter much, it was more the circumstances of the conversation.
Title: Re: [A16] HugsLib (2.3.0) Lightweight modding library
Post by: Keeper on January 07, 2017, 05:48:02 AM
Just a quick question regarding the Detour feature.

I was playing around with it and tried a basic test of changing the year date to a static "5555".

I followed the wiki and made

        [DetourMethod(typeof(GenDate), "Year")]
        public static int Year(long absTicks, float longitude)
        {
            int num = absTicks + longitude //Serves no purpose this line
            return 5500 + 55;
        }

However "GenDate" is reporting conflicts with the original version.
Am I using this correctly or not because the date within Rimworld still remains at 5500 and there are no errors in runtime.

The Widgets button example worked fine as an additional note.

Title: Re: [A16] HugsLib (2.3.0) Lightweight modding library
Post by: scuba156 on January 07, 2017, 07:26:11 AM
Quote from: Keeper on January 07, 2017, 05:48:02 AM
Just a quick question regarding the Detour feature.

I was playing around with it and tried a basic test of changing the year date to a static "5555".

I followed the wiki and made

        [DetourMethod(typeof(GenDate), "Year")]
        public static int Year(long absTicks, float longitude)
        {
            int num = absTicks + longitude //Serves no purpose this line
            return 5500 + 55;
        }

However "GenDate" is reporting conflicts with the original version.
Am I using this correctly or not because the date within Rimworld still remains at 5500 and there are no errors in runtime.

The Widgets button example worked fine as an additional note.
I don't have an answer other than StartingYear in Verse.TickManager may be another option?
Title: Re: [A16] HugsLib (2.3.0) Lightweight modding library
Post by: UnlimitedHugs on January 07, 2017, 09:29:07 AM
Quote from: Keeper on January 07, 2017, 05:48:02 AM
Just a quick question regarding the Detour feature.

Tried it, and the detour is working properly- 5555 appears on the ingame calendar. I only removed the line with the comment.
Title: Re: [A16] HugsLib (2.3.0) Lightweight modding library
Post by: Zhentar on January 07, 2017, 02:05:12 PM
Did you name your detour class GenDate too? If you did, then typeof(GenDate) will choose the detour class instead of the RimWorld class, you either have to use typeof(Verse.GenDate) or rename your class.

Signed, someone who has definitely never made this mistake.
Title: Re: [A16] HugsLib (2.3.2) Lightweight modding library
Post by: Keeper on January 07, 2017, 06:34:36 PM
Thank you its working now   :D

Zhentar solution plus UnlimitedHugs confirming the Detour did worked eventually revealed another file that was blocking the Detour.
Title: Re: [A16] HugsLib (2.3.2) Lightweight modding library
Post by: Keeper on January 08, 2017, 01:25:38 AM
Does the Detouring work for Overloaded methods?

If so could an example be provided?
Title: Re: [A16] HugsLib (2.3.2) Lightweight modding library
Post by: Wishmaster on January 08, 2017, 06:20:44 AM
I'm asking the same question for constructors.
Aswell as is there a way to detour a method without "damaging" it ? For example if you want to call the original method.
Title: Re: [A16] HugsLib (2.3.2) Lightweight modding library
Post by: Fluffy (l2032) on January 08, 2017, 11:28:28 AM
Detouring overloads is not a problem, the attribute method will try to determine the correct overload based on arguments of the target method. If, for some reason that doesn't work you can always 'manually' get the MethodInfo objects and do the detour the old fashioned way.

Non-destructive detouring is a completely different can of worms. It's theoretically possible, but it's a lot more fiddly, and to the best of my knowledge no-one has come up with a stable cross-platform solution yet.
Title: Re: [A16] HugsLib (2.3.2) Lightweight modding library
Post by: UnlimitedHugs on January 08, 2017, 12:40:49 PM
Quote from: Keeper on January 08, 2017, 01:25:38 AM
Does the Detouring work for Overloaded methods?
If so could an example be provided?

As Fluffy said, it works the same as for non-overloaded methods.
Just specify the same parameters in your destination method as the parameters in the method you are detouring, and the correct method will be selected. Otherwise you will get a "not found" error.
If your destination method is an extension method, you will need the latest version (2.3.2) for the source method to be properly detected.

Quote from: Wishmaster on January 08, 2017, 06:20:44 AM
I'm asking the same question for constructors.
Aswell as is there a way to detour a method without "damaging" it ? For example if you want to call the original method.

Looked into the constructor detouring, and it seems our usual detouring code won't work on them. Maybe someone else can chip in of this.
As for the non-destructive detouring, that's kind of like the holy grail of Rimworld modding at the moment. Eventually, someone will probably come up with a reliable way to do that, though.
Title: Re: [A16] HugsLib (2.3.2) Lightweight modding library
Post by: Zhentar on January 08, 2017, 12:47:15 PM
Coincidentally, I was just detouring a constructor yesterday.

HugsLib would need one small change to support detouring constructors: The parameters to Detourprovider.TryIndependentDetour have to be changed from type MethodInfo to MethodBase.

After that, it's quite easy:

ConstructorInfo method1 = typeof(CompProperties_Ingredients).GetConstructor( new Type[] {});
ConstructorInfo method2 = typeof(CompProperties_TaintedIngredients).GetConstructor(new Type[] {});
if (!Detours.TryDetourFromToInt(method1, method2)) { Log.Error("YOU FAILED"); }


edit: You don't have to detour to another constructor, either. Full credit goes to ZorbaTHut: https://github.com/zorbathut/stepaway/blob/master/Bootstrap.cs
Title: Re: [A16] HugsLib (2.3.2) Lightweight modding library
Post by: Zhentar on January 08, 2017, 01:02:57 PM
And as long as I'm sharing crazy things ZorbaTHut has figured out, here's how to call the base class from a detoured override: https://github.com/zorbathut/icanfixit/blob/master/Building_Detour.cs
Title: Re: [A16] HugsLib (2.3.2) Lightweight modding library
Post by: UnlimitedHugs on January 08, 2017, 01:25:45 PM
Quote from: Zhentar on January 08, 2017, 12:47:15 PM
HugsLib would need one small change to support detouring constructors: The parameters to Detourprovider.TryIndependentDetour have to be changed from type MethodInfo to MethodBase.

Since that would break part of the API, I'll schedule it for the next update.
Also, that base call is crazy. But I guess you do what you gotta do. Props to him for the idea, though.

@Wishmaster
In the meantime, you could copy the TryIndepentDetour method to your mod and change the parameter types as Zhentar said, if there's no way around that detour.
Title: Re: [A16] HugsLib (2.3.2) Lightweight modding library
Post by: notfood on January 08, 2017, 03:11:44 PM
Quote from: Zhentar on January 08, 2017, 01:02:57 PM
And as long as I'm sharing crazy things ZorbaTHut has figured out, here's how to call the base class from a detoured override: https://github.com/zorbathut/icanfixit/blob/master/Building_Detour.cs

Nice find. This must be stickied in the Help subforum somewhere.
Title: Re: [A16] HugsLib (2.3.3) Lightweight modding library
Post by: lllMWNlll on January 13, 2017, 10:09:07 AM
https://gist.github.com/ba9bc685af36733bc8f381d8ffccdc71

Hey, Hugs...

I'm testing several mods, i just closed and opened again Rimworld.exe from testing mods and i did have this log with some bugs.
Hope i can help with something. I still going to test 17 mods more, i also will post this to the other mods that shows up there.
Title: Re: [A16] HugsLib (2.3.3) Lightweight modding library
Post by: faltonico on January 13, 2017, 10:33:40 AM
Please PLEASE don't do an update for a single translation =S
Title: Re: [A16] HugsLib (2.3.3) Lightweight modding library
Post by: UnlimitedHugs on January 13, 2017, 04:48:24 PM
Quote from: lllMWNlll on January 13, 2017, 10:09:07 AM
I'm testing several mods, i just closed and opened again Rimworld.exe from testing mods and i did have this log with some bugs.

You probably mean the warning.
It's caused by one of Fluffy's mods, he already knows about it and might have already released a fix. In any case, this particular one won't cause trouble.

Quote from: faltonico on January 13, 2017, 10:33:40 AM
Please PLEASE don't do an update for a single translation =S

What's wrong with releasing an update?
You don't have to update if you installed manually, and Steam will just update automatically.
Title: Re: [A16] HugsLib (2.3.3) Lightweight modding library
Post by: gendalf on January 13, 2017, 10:54:37 PM
no minimap ?
Title: Re: [A16] HugsLib (2.3.3) Lightweight modding library
Post by: UnlimitedHugs on January 13, 2017, 11:56:35 PM
Quote from: gendalf on January 13, 2017, 10:54:37 PM
no minimap ?

Sorry, that's way out of the scope of this library :)
A minimap would fare much better as a standalone mod, since it's not a feature other mods rely on.
Title: Re: [A16] HugsLib (2.3.3) Lightweight modding library
Post by: faltonico on January 14, 2017, 12:28:13 AM
Quote from: UnlimitedHugs on January 13, 2017, 04:48:24 PM
Quote from: faltonico on January 13, 2017, 10:33:40 AM
Please PLEASE don't do an update for a single translation =S

What's wrong with releasing an update?
You don't have to update if you installed manually, and Steam will just update automatically.
Well i was kind of disappointed.. like "only for that?!" XD
But you are right sry :p
Title: Re: [A16] HugsLib (2.3.3) Lightweight modding library
Post by: Brrainz on January 14, 2017, 03:48:10 AM
Hi everyone,

I would like to introduce a new library I wrote for the community. It is called Harmony and I have created a thread in Tools about it: https://ludeon.com/forums/index.php?topic=29517.0

The purpose of this lib is to take Detour() to the next level. My goal here was:

- keep the original method intact
- include methods where the class cannot be subclassed
- allow more than one patch for the same method
- define priorities so users don't have to reorder mods
- have mods identify themselves so they can look up who patched what
- have no global state
- have no external mod that users need to install separately
- have the code open and accessible to the public
- to be compatible with all the platforms and other versions of Harmony in the future

All this said, I want to say that I don't want to compete with HugsLib. Instead, I wish we could incorporate Harmony into HugsLib and replace the old Detour(). I will advocate this even to other potential clients like CCL. I also want people to test the living hell out of it - I have only tested it on 64bit Intel Win10 and my new MacBook. The tricky part in it is based on the work of Michael Turutanov with this great AsmHelper and this is already in use by Achtung and works for a lot of people but I had a friend report that it gives an access violation on this AMD/Win10 machine.

The library itself exists on GitHub here: https://github.com/pardeike/Harmony and I made a small example mod that toys with the Unity camera (A16) and uses Harmony here: https://github.com/pardeike/CameraPlus

Let me know if this sounds interesting so we can either discuss this here or in its own thread.

Cheers,
Andreas Pardeike
Title: Re: [A16] HugsLib (2.3.3) Lightweight modding library
Post by: notfood on January 14, 2017, 11:57:44 AM
Sounds sweet. I hope you two can agree.
Title: Re: [A16] HugsLib (2.3.3) Lightweight modding library
Post by: UnlimitedHugs on January 14, 2017, 12:05:03 PM
Quote from: pardeike on January 14, 2017, 03:48:10 AM
I would like to introduce a new library I wrote for the community. It is called Harmony and I have created a thread in Tools about it: https://ludeon.com/forums/index.php?topic=29517.0

Yesss, you made it! Kudos to you for your dedication and hard work.
Looks like we have lots of testing to do. Once it's stable, it could be distributed with HugsLib and integrated with the existing attribute system- for those who want to use it. The classic detour could be kept as a fallback, perhaps activated with a command line argument.
Title: Re: [A16] HugsLib (2.3.3) Lightweight modding library
Post by: Brrainz on January 14, 2017, 01:37:06 PM
Keeping the old Detour can proof to be tricky. The whole point of retiring it is to not replicate original game code when you patch things. So Harmony introduces prefix and postfix methods. A bit hard to have a fallback to the old way.
Title: Re: [A16] HugsLib (2.3.3) Lightweight modding library
Post by: System.Linq on January 14, 2017, 03:14:09 PM
In some cases, replicating old game code is necessary if you mean to replace functionality. Postfix/prefix for new content is a very welcome addition, however.
Title: Re: [A16] HugsLib (2.3.3) Lightweight modding library
Post by: Brrainz on January 14, 2017, 03:19:24 PM
Since a prefix can return false to suppress the execution of the original, you can have the replacement functionality too. Plus others can still prefix or postfix your patch too.
Title: Re: [A16] HugsLib (2.3.3) Lightweight modding library
Post by: System.Linq on January 14, 2017, 03:29:57 PM
Oh, in that case, well done. I look forward to seeing it incorporated into HugsLib and ushering in a new era of compatibility.
Title: Re: [A16] HugsLib (2.3.3) Lightweight modding library
Post by: UnlimitedHugs on January 14, 2017, 04:25:41 PM
Quote from: pardeike on January 14, 2017, 01:37:06 PM
Keeping the old Detour can proof to be tricky. The whole point of retiring it is to not replicate original game code when you patch things. So Harmony introduces prefix and postfix methods. A bit hard to have a fallback to the old way.

Right, because the mods would no longer duplicate the original functionality in their detour. Well, never mind that, then.
Title: Re: [A16] HugsLib (2.3.3) Lightweight modding library
Post by: scuba156 on January 15, 2017, 12:02:15 AM
Really looking forward to seeing it incorporated, it will make my current work so much easier. Thanks!
Title: Re: [A16] HugsLib (2.3.3) Lightweight modding library
Post by: Brrainz on January 15, 2017, 04:40:25 AM
Quote from: scuba156 on January 15, 2017, 12:02:15 AM
Really looking forward to seeing it incorporated, it will make my current work so much easier. Thanks!
I think that you need to start putting it into an experimental version of your mod. It's not that some global mod will put it in and you benefit from it directly. Why not help and give it a whirl if you have some spare time, then come back with feedback or bugs. It's hard to get started from scratch but how else would we get there?
Title: Re: [A16] HugsLib (2.3.3) Lightweight modding library
Post by: scuba156 on January 16, 2017, 01:59:37 AM
Quote from: pardeike on January 15, 2017, 04:40:25 AM
Quote from: scuba156 on January 15, 2017, 12:02:15 AM
Really looking forward to seeing it incorporated, it will make my current work so much easier. Thanks!
I think that you need to start putting it into an experimental version of your mod. It's not that some global mod will put it in and you benefit from it directly. Why not help and give it a whirl if you have some spare time, then come back with feedback or bugs. It's hard to get started from scratch but how else would we get there?
I already have a build of Mod List Backup that replaces the HugsLib GUI Injection with a Harmony postfix instead, just having issues with the lib which I have posted in Harmony's thread. I'll definitely help where I can.

Regarding HugsLib, few idea. Would you be interested in adding custom Widgets? Was doing up a ImageButton that draws the button background too and thought it would be nice to have a lib with extra widgets, whether its HugsLib or a separate lib.

How about Steam Cloud support? Files can be synced with steam by simply adding the .rws extension to the file, directory will be retained. It would be convenient to have something manage them and pass a corrected filepath or something.
Title: Re: [A16] HugsLib (2.3.3) Lightweight modding library
Post by: UnlimitedHugs on January 17, 2017, 04:00:24 AM
Quote from: scuba156 on January 16, 2017, 01:59:37 AM
I already have a build of Mod List Backup that replaces the HugsLib GUI Injection with a Harmony postfix instead, just having issues with the lib which I have posted in Harmony's thread. I'll definitely help where I can.

Once Harmony is added to the library, the GUI injection system can be removed, as it would become redundant- but for now it's a good way to save a few detours here and there.

Quote from: scuba156 on January 16, 2017, 01:59:37 AM
Regarding HugsLib, few idea. Would you be interested in adding custom Widgets? Was doing up a ImageButton that draws the button background too and thought it would be nice to have a lib with extra widgets, whether its HugsLib or a separate lib.

More widgets would be a viable addition, since they would not require any changes when the game updates. However, the new part of the library would need more features to make it a worthwhile addition- otherwise it's better to just copy and paste a snippet of code to get the feature you are looking for.

Quote from: scuba156 on January 16, 2017, 01:59:37 AM
How about Steam Cloud support? Files can be synced with steam by simply adding the .rws extension to the file, directory will be retained. It would be convenient to have something manage them and pass a corrected filepath or something.

What would be the use case for that? Also, are the Rimworld saves and configuration files synched to the cloud?
Title: Re: [A16] HugsLib (2.3.3) Lightweight modding library
Post by: scuba156 on January 17, 2017, 04:50:00 AM
Quote from: UnlimitedHugs on January 17, 2017, 04:00:24 AM
Once Harmony is added to the library, the GUI injection system can be removed, as it would become redundant- but for now it's a good way to save a few detours here and there.
GUI Injection made my life a lot easier.
Quote
More widgets would be a viable addition, since they would not require any changes when the game updates. However, the new part of the library would need more features to make it a worthwhile addition- otherwise it's better to just copy and paste a snippet of code to get the feature you are looking for.
I didn't have anything specific in mind. The only custom widget I have is as I said above, a ImageButton with a background. (That also scales the image). I don't think it is significant enough to include without other custom widgets.
(http://i.imgur.com/uwSemDi.png)
(http://i.imgur.com/TkWblbR.png)

Quote
What would be the use case for that? Also, are the Rimworld saves and configuration files synched to the cloud?
The best use case IMO is syncing mod settings across devices. I sync users save slots for Mod List Backup using steam cloud, which I store in "%APPDATA%\..\LocalLow\Ludeon Studios\RimWorld by Ludeon Studios\ModListBackup\". The only thing I do to make this happen is add ".rws" on the end of the file name.

RimWorld saves are sync'd but configuration files are not.
Title: Re: [A16] HugsLib (2.3.3) Lightweight modding library
Post by: UnlimitedHugs on January 17, 2017, 08:15:36 AM
Quote from: scuba156 on January 17, 2017, 04:50:00 AM
The best use case IMO is syncing mod settings across devices. I sync users save slots for Mod List Backup using steam cloud, which I store in "%APPDATA%\..\LocalLow\Ludeon Studios\RimWorld by Ludeon Studios\ModListBackup\". The only thing I do to make this happen is add ".rws" on the end of the file name.

RimWorld saves are sync'd but configuration files are not.

I can see how that would be useful, but I doubt it would make for a popular addition.
Synching mod settings would make sense if the vanilla configs were also synched. Also, it has the potential to mess up mods when switching between beta branches.
Still, I do applaud your desire to improve the usability of your mods :)
Thanks for the info, I may tie into that system in the future somehow.
Title: Re: [A16] HugsLib (2.3.3) Lightweight modding library
Post by: Zhentar on January 20, 2017, 06:00:22 PM
For anyone who might be interested, I figured out how to use HugsLib settings while keeping HugsLib as an optional dependency, you can check out the source for my implementation here: https://github.com/Zhentar/ZhentarTweaks/blob/3da46894781c851b2260a8ef7933665a5e03436b/Source/LetterStackDetour.cs
Title: Re: [A16] HugsLib (2.3.3) Lightweight modding library
Post by: scuba156 on January 24, 2017, 08:06:17 PM
I have two more features to offer, more than happy to make pull requests for them as well.

First one is a method to restart RimWorld. It works on all platforms afaik and will also check if it was launched using steam or not. Implementation can be seen in Mod List Backup.

Second is to add an update feature for HugsLib non-workshop installs(ie manual installs). I'm half way through having working code for this one but it would include download and extraction of the latest zipped release of HugsLib from github, and then restart RimWorld to cleanly apply the update.

I can do pull requests once I have the update code ready if you are interested.
Title: Re: [A16] HugsLib (2.3.3) Lightweight modding library
Post by: UnlimitedHugs on January 25, 2017, 02:28:21 AM
Quote from: scuba156 on January 24, 2017, 08:06:17 PM
I have two more features to offer, more than happy to make pull requests for them as well.
First one is a method to restart RimWorld.

That sounds handy- I guess it could be used to add a "Restart now" button to the dialog shown after you change your mod configuration.

Quote from: scuba156 on January 24, 2017, 08:06:17 PM
Second is to add an update feature for HugsLib non-workshop installs.

That would be a cool feature to have, I admit.
It could come with a setting to disable update checking, if necessary, and a dialog that notifies you of an available update at startup.

Pull requests would be nice- that way you also get the credit on GitHub.
Title: Re: [A16] HugsLib (2.3.3) Lightweight modding library
Post by: scuba156 on January 25, 2017, 03:44:12 AM
Quote from: UnlimitedHugs on January 25, 2017, 02:28:21 AM
*snip*
Pull requests would be nice- that way you also get the credit on GitHub.
I'll submit them in a day or two, whenever I have them ready.

I'm changing the restart code to make it more modular, so instead of just having a hard coded restart command (https://github.com/scuba156/ModListBackup/blob/master/ModListBackup/src/Handlers/PlatformHandler.cs#L32), it will have a 'RestartCommand' class that inherits a 'Command' class with a DoCommand() method that executes the platform specific command in the base class.

Other commands could then be easily added by creating a new class that inherits 'Command' to allow extra functionality such as sending data to an external program or open the log in the systems default texteditor for example.

Updating will also be modular and thread-safe. I'll include a method that will update HugsLib itself only and one to update all HugsLib compatible mods. I'll do a check for HugsLib only updates on HugLib Init, and leave the update all method as a public method that you can do whatever with. Mods using HugsLib that have overrideVersion and gitHubRepository set (Oh yeah, I will have to add gitHubRepository to VersionFile.cs, already have the code) in their Version.xml can check for and download updates in their ModBase using something like :
if(HugsLib.CheckForUpdate(Instance.ModIdentifier)) {
Instance.DoUpdate();
}
Title: Re: [A16] HugsLib (2.3.3) Lightweight modding library
Post by: UnlimitedHugs on January 25, 2017, 04:49:58 AM
Quote from: scuba156 on January 25, 2017, 03:44:12 AM
- snip -

The command stuff sounds good. Do it as you see fit, I'll move things around, if necessary.

Auto-updates for compatible mods is a great feature to have, even if it's restricted to GitHub releases. I'll have to do some thinking on how to organize it so that it's unobtrusive and easy to use for both modders and players.
Title: Re: [A16] HugsLib (2.3.3) Lightweight modding library
Post by: scuba156 on January 25, 2017, 02:19:11 PM
Quote from: UnlimitedHugs on January 25, 2017, 04:49:58 AM
Quote from: scuba156 on January 25, 2017, 03:44:12 AM
- snip -

The command stuff sounds good. Do it as you see fit, I'll move things around, if necessary.

Auto-updates for compatible mods is a great feature to have, even if it's restricted to GitHub releases. I'll have to do some thinking on how to organize it so that it's unobtrusive and easy to use for both modders and players.
Good Idea!

I am trying to keep the code inline with your style and making comments were needed, if anything sucks or needs changing just let me know or feel free to do it, I take no offense :)

I've made a fork on github (https://github.com/scuba156/RimworldHugsLib) and I'm just cleaning up the restart/command code before I commit it, I will do the pull requests once the update stuff is finished, just in case of changes. More error checking may be needed, unsure yet The command stuff is simple, just let me know if another example is needed.

Edit:
I've incorporated the code I had done for update checking into HugsLib and commited it to a new branch (https://github.com/scuba156/RimworldHugsLib/tree/dev-scuba156), including checking for an update on init (just outputs a message to the log; see attachment), changing logpublisher to use the new github class, adding githubRepository to versionFile and using the user agent/token for log uploading for github queries. Currently it uses the token twice each update check but I should be able to get that down to once.

[attachment deleted by admin due to age]
Title: Re: [A16] HugsLib (2.3.3) Lightweight modding library
Post by: scuba156 on January 26, 2017, 10:16:38 AM
Quite happy now. I just got zip extraction working after messing around with it all day. Mono 2.0 which i believe is used for RimWorld has a bug with missing I18N.dll and I18N.West.dll causing encoding issues related to code page 437 when trying to unzip using many libraries or dotNet 3.5's terrible zip support.

SharpZipLib (https://github.com/icsharpcode/SharpZipLib) is the only one I could get to work and even then a line in the source has to be changed (http://stackoverflow.com/a/15734543/1362310). This adds about 200kb to the mod, and the source is about 2mb.
Title: Re: [A16] HugsLib (2.3.3) Lightweight modding library
Post by: scuba156 on January 26, 2017, 01:20:15 PM
Sorry to spam the thread, I have working code here (https://github.com/scuba156/RimworldHugsLib/tree/dev-scuba156) which includes downloading, prompting the user to install and extraction of the latest zip. Tested working on Windows, OSX and Ubuntu. Still need to move things around and clean up.
Title: Re: [A16] HugsLib (2.3.3) Lightweight modding library
Post by: UnlimitedHugs on January 26, 2017, 02:55:49 PM
Quote from: scuba156 on January 26, 2017, 01:20:15 PM
I have working code here (https://github.com/scuba156/RimworldHugsLib/tree/dev-scuba156) which includes downloading, prompting the user to install and extraction of the latest zip.

Well, including a dependency is not ideal, but we could deal with it, if there is no way around it.
There is another issue, though. I saw that the updater makes calls to the GitHub search API. There is a rate limit of 10 calls per hour for unauthenticated users, which is acceptable for the library updater alone, but puts a damper on updating other mods.
All in all, this makes me wonder if the whole updater addition is worth the trouble. Ideally, of course, we would have a program external to Rimworld that would act as a package manager and would be capable of installing and updating mods- think CKAN from KSP. If we have that, the library updater would also become unnecessary.

In short, I feel like including that zipping library just to automatically update HugsLib is a risk and a debt not worth taking. Especially, considering that "lightweight" is one of the key points of the library.
Still, your code may not be entirely wasted and could go towards a different kind of updater, if you're interested in exploring that option.
Title: Re: [A16] HugsLib (2.3.3) Lightweight modding library
Post by: Zhentar on January 26, 2017, 05:31:05 PM
It looks like Unity 5.5 has a functioning GZipStream, so it could be implemented without the dependency whenever Tynan upgrades again.
Title: Re: [A16] HugsLib (2.3.3) Lightweight modding library
Post by: scuba156 on January 26, 2017, 08:27:35 PM
Regarding the search API, its authenticated which gives us 30 calls a minute, but I also plan to attempt looking for the Version.XML in some common paths. HugsLib itself will not use a search call since we know the path, just have to add it.

Regarding the zip dependency, I agree. I had tried to find a working library that was just a single cs file but had issues as I said. I may be able to get one working now I have this current implementation working.

Zhentar is correct that unity 5.5 has GZipStream but I believe it still has the same issue as its related to mono missing files for the encoding. I'll submit this a RimWorld bug and hopefully we can see it fixed in the future.

If the update feature does not end up in HugsLib then I will use it in my mod anyway so it won't go to waste.

Edit: Also the zip issue is unique to Windows and Linux only. OSX works fine.

I have submitted this as a bug (https://ludeon.com/forums/index.php?topic=29995.0)
Title: Re: [A16] HugsLib (2.3.3) Lightweight modding library
Post by: UnlimitedHugs on January 27, 2017, 03:55:27 AM
Quote from: scuba156 on January 26, 2017, 08:27:35 PM
- snip -

When we get the Unity update we'll know for sure, and maybe we can revisit the whole updater concept. It would be neat to have, provided we can include it cleanly.

30 calls a minute may be enough- hard to tell. If we store some metadata for the repos- like the last seen commit hash- the check could be lowered to one request per mod.
Ideally, the checker would tell if there is an update just by requesting info about the latest release. That may require cutting some corners, though.

Sorry to shut down your ideas, I take no pleasure in this :)
I will add the restarter, though, since I think it would make a good addition to the Mods menu.
Title: Re: [A16] HugsLib (2.3.3) Lightweight modding library
Post by: scuba156 on January 27, 2017, 04:44:25 AM
I would prefer to have it working cleanly. Using the edited SharpZipLib also breaks its zip creation too, so its a lot of code for only extraction.

30 calls a min is one call every five seconds across every HugsLib user. I can check if a file in the repo exists by path without needing to use an api call, I should be able to check if an update is available for about 9 out of every 10 mods without using a single api call. Using the latest release would rely on tags being used, or versioning present in zip files names, I would have to check what data is available to use in that call.

No problem at all, I will still continue work on it regardless as it's still usable code.

I'm going to code up another command, one that opens the log file just to make sure it works with other commands easily enough. Might need renaming though as I realized there is Verse.Command, so we shouldn't have HugsLib.Commands.Command. Technically they are processes but ProcessRestart isn't as intuitive, any preference for the namespace?
Title: Re: [A16] HugsLib (2.3.3) Lightweight modding library
Post by: UnlimitedHugs on January 27, 2017, 05:21:52 AM
Quote from: scuba156 on January 27, 2017, 04:44:25 AM
Any preference for the namespace?

Shell would be appropriate.
Also, Skully pointed out that CCL also has as restarter built in (https://github.com/RimWorldCCLTeam/CommunityCoreLibrary/blob/2fdc8946bd25b7c6429150113c3645ce9aa7356d/DLL_Project/Controller/Controller_MainMonoBehaviour.cs#L219), if you want to take a look.

By the way, kudos for testing things on other platforms.
Title: Re: [A16] HugsLib (2.3.3) Lightweight modding library
Post by: scuba156 on January 27, 2017, 03:17:26 PM
Quote from: UnlimitedHugs on January 27, 2017, 05:21:52 AM
Quote from: scuba156 on January 27, 2017, 04:44:25 AM
Any preference for the namespace?

Shell would be appropriate.
Also, Skully pointed out that CCL also has as restarter built in (https://github.com/RimWorldCCLTeam/CommunityCoreLibrary/blob/2fdc8946bd25b7c6429150113c3645ce9aa7356d/DLL_Project/Controller/Controller_MainMonoBehaviour.cs#L219), if you want to take a look.

By the way, kudos for testing things on other platforms.
CCL's method of parsing the argument's looks better. I thought about the args when I started it but forgot half when I was actually doing it, whoops!

Having a issue getting the OSX open log shell to play nice, but the base code seems to work fine. Will do the above changes and submit the pull request.

Appreciated. I typically develop on a Macbook using Teamviewer to connect to a Win 10 PC that has an ubuntu VM, so I have them easily accessible.
Title: Re: [A16] HugsLib (2.3.3) Lightweight modding library
Post by: scuba156 on January 28, 2017, 10:05:45 PM
I just submitted a pull request (https://github.com/UnlimitedHugs/RimworldHugsLib/pull/13) on the shell commands.

I've adapted the CCL code, which actually doesn't work on OSX or linux, so that's fixed. I've also added more error checking and cleaned it up.

Edit: I came across a small issue while doing a third example. Will update with the fix and new example when I get a chance to.

Edit2: I have updated the pull request
Title: Re: [A16] HugsLib (2.3.3) Lightweight modding library
Post by: suramraja on January 30, 2017, 09:09:57 AM
hi,, i got error

Exception filling window for Verse.EditWindow_DebugInspector: System.NullReferenceException: Object reference not set to an instance of an object
  at Verse.Find.get_VisibleMap () [0x00000] in <filename unknown>:0
  at Verse.EditWindow_DebugInspector.CurrentDebugString () [0x00000] in <filename unknown>:0
  at Verse.EditWindow_DebugInspector.DoWindowContents (Rect inRect) [0x00000] in <filename unknown>:0
  at HugsLib.GuiInject.WindowDetour+<>c__DisplayClass1.<_WindowOnGUI>b__0 (Int32 x) [0x00000] in <filename unknown>:0
Verse.Log:Error(String)
HugsLib.GuiInject.<>c__DisplayClass1:<_WindowOnGUI>b__0(Int32)
UnityEngine.GUI:CallWindowDelegate(WindowFunction, Int32, GUISkin, Int32, Single, Single, GUIStyle)
Title: Re: [A16] HugsLib (2.3.3) Lightweight modding library
Post by: UnlimitedHugs on January 31, 2017, 07:20:35 AM
Quote from: suramraja on January 30, 2017, 09:09:57 AM
hi,, i got error

That looks like it might be a vanilla bug. How can this be reproduced?
Title: Re: [A16] HugsLib (2.4.0) Lightweight modding library
Post by: UnlimitedHugs on January 31, 2017, 07:34:23 AM
Updated to 2.4.0

Stand by for goodie delivery :)
Got a couple of new things:
- Added a prompt to the Mods dialog that allows the player to easily restart the game after making changes to the mods config. It will detect the change even when mods are just reordered, contrary to vanilla. An auto-restart option is also available. Closing the prompt will do the usual vanilla reload instead.
This should cut back on bug reports related to improperly loaded mods.
- Added a button to the log window to access useful files and folders: opening the log file, as well as browsing the mods and user data folders.
- Added keyboard shortcuts for opening the log and restarting the game. These are useful for development and must be assigned to use them.
- Minor fixes: detour by attribute will now properly report the method that the source was already detoured to.

This update was made possible by scuba156's contribution, so props to him.

Also, I made minor additions to the wiki: GUI injection now has a section on replacing GUI elements (https://github.com/UnlimitedHugs/RimworldHugsLib/wiki/GUI-Injection#replacing-gui-elements), and the settings page now includes Zenthar's code for optional settings (https://github.com/UnlimitedHugs/RimworldHugsLib/wiki/Adding-mod-settings#optional-settings-advanced). About the optional settings- I've made a small fix to allow the displayed mod name to be specified when adding settings without using ModBase.
Title: Re: [A16] HugsLib (2.3.3) Lightweight modding library
Post by: suramraja on January 31, 2017, 09:27:19 AM
Quote from: UnlimitedHugs on January 31, 2017, 07:20:35 AM
Quote from: suramraja on January 30, 2017, 09:09:57 AM
hi,, i got error

That looks like it might be a vanilla bug. How can this be reproduced?

idk haha ,, btw , the error only in main menu screen ,,,   :)
Title: Re: [A16] HugsLib (2.4.0) Lightweight modding library
Post by: scuba156 on January 31, 2017, 05:55:52 PM
Quote from: UnlimitedHugs on January 31, 2017, 07:34:23 AM
Updated to 2.4.0
-snip-
Looks good. I haven't tested 2.4 yet but a quick glance at the code looks like the auto restarter can be disabled? Thanks, this works well for me since I am currently working on a mod menu overhaul.

Quote from: suramraja on January 31, 2017, 09:27:19 AM
idk haha ,, btw , the error only in main menu screen ,,,   :)
Are you writing code or using just attempting to use another mod that requires HugsLib? Whichever the case, Verse.VisibleMap will be null if no map is visible which is causing this error.
Title: Re: [A16] HugsLib (2.4.0) Lightweight modding library
Post by: UnlimitedHugs on January 31, 2017, 06:14:16 PM
Quote from: scuba156 on January 31, 2017, 05:55:52 PM
Looks good. I haven't tested 2.4 yet but a quick glance at the code looks like the auto restarter can be disabled? Thanks, this works well for me since I am currently working on a mod menu overhaul.

The automatic restart can be disabled, but the prompt dialog will still show up. If you want to get rid of that, too, you could call WindowInjectionManager.RemoveInjection().
Title: Re: [A16] HugsLib (2.4.0) Lightweight modding library
Post by: System.Linq on January 31, 2017, 06:22:34 PM
Quote from: UnlimitedHugs on January 31, 2017, 07:34:23 AM
- Minor fixes: detour by attribute will now properly report the method that the source was already detoured to.

That explains it. Less Arbitrary Surgery got a lot of confusing bug reports because of this.
Title: Re: [A16] HugsLib (2.4.0) Lightweight modding library
Post by: scuba156 on January 31, 2017, 06:28:21 PM
Quote from: UnlimitedHugs on January 31, 2017, 06:14:16 PM
The automatic restart can be disabled, but the prompt dialog will still show up. If you want to get rid of that, too, you could call WindowInjectionManager.RemoveInjection().
If I remember correctly, your prompt dialog detours Page_ModsConfig PostClose method, which is fine as I am inserting a new page class by detouring the main menu.

Thank you.
Title: Re: [A16] HugsLib (2.4.0) Lightweight modding library
Post by: UnlimitedHugs on January 31, 2017, 06:30:56 PM
Quote from: Linq on January 31, 2017, 06:22:34 PM
That explains it. Less Arbitrary Surgery got a lot of confusing bug reports because of this.

Yep, got a couple myself. Thankfully, a persistent player helped in tracking this one down.

Quote from: scuba156 on January 31, 2017, 06:28:21 PM
If I remember correctly, your prompt dialog detours Page_ModsConfig PostClose method, which is fine as I am inserting a new page class by detouring the main menu.

No detour, it just uses the GUI injector to hook into Page_ModsConfig. It doesn't affect other windows, of course.
Title: Re: [A16] HugsLib (2.4.0) Lightweight modding library
Post by: System.Linq on January 31, 2017, 06:31:32 PM
Thanks for getting it fixed!
Title: Re: [A16] HugsLib (2.4.0) Lightweight modding library
Post by: danielee on February 04, 2017, 03:12:54 PM
Updated Chinese translation files https://www.dropbox.com/s/mabe9r2tnhhbyvx/ChineseSimplified.zip?dl=0
Title: Re: [A16] HugsLib (2.4.0) Lightweight modding library
Post by: UnlimitedHugs on February 04, 2017, 07:12:02 PM
Quote from: danielee on February 04, 2017, 03:12:54 PM
Updated Chinese translation files https://www.dropbox.com/s/mabe9r2tnhhbyvx/ChineseSimplified.zip?dl=0

Thank you, I'll include these in the next release.
Title: Re: [A16] HugsLib (2.4.1) Lightweight modding library
Post by: Rock5 on February 07, 2017, 10:25:52 PM
Can I get some advice on how to do this detour thing? I want to detour the pathfinding in the game. I think the method is call FindPath but it uses private fields of it's parent class Pathfinder. How do I access the parents fields? Or should I detour the whole PathFinder? But Pathfinder is a class. Please point me in the right direction.
Title: Re: [A16] HugsLib (2.4.1) Lightweight modding library
Post by: UnlimitedHugs on February 08, 2017, 07:49:42 AM
Quote from: Rock5 on February 07, 2017, 10:25:52 PM
Can I get some advice on how to do this detour thing? I want to detour the pathfinding in the game. I think the method is call FindPath but it uses private fields of it's parent class Pathfinder. How do I access the parents fields? Or should I detour the whole PathFinder? But Pathfinder is a class. Please point me in the right direction.

Using just HugsLib, you would have to use reflection to access the private fields. This is not ideal, since the pathfinder
is a performance-critical piece, and reflection is fairly slow. You could use Expressions to compile accessor methods to access the fields in a performance-friendly manner, at the cost of added complexity.

Your best bet might be to go with the Harmony library (https://github.com/pardeike/Harmony/wiki) and add a prefix/postfix for that method. Harmony even allows to replace specific calls in the method body.
HugsLib detouring will be moved over to Harmony in the next alpha update, so you would save yourself some updating work there.

Also, Zenthar has a mod that already makes modifications to the pathfinder, so it's a good idea to keep compatibility in mind.
Title: Re: [A16] HugsLib (2.4.1) Lightweight modding library
Post by: Brrainz on February 08, 2017, 07:59:29 AM
It all depends on how often the modification is called. Detouring is one overhead and accessing the private fields another. If you patch the part that only gets called at the beginning of path finding it does not matter and I would not go with premature optimization. If you on the other hand have a method that is called 100x per game tick your best bet is to use Harmony and not use any pre/post patches at all and instead add or modify the original code with an IL code processor. This requires some knowledge on CIL but is quite straight forward.
Title: Re: [A16] HugsLib (2.4.1) Lightweight modding library
Post by: Rock5 on February 08, 2017, 08:17:31 AM
Will the harmony library allow me to access the parents private fields?

I think Better Pathfinding uses it's own detouring, not a library. I didn't want to use my own implementation until I understood it better but I guess it's an option. I could just make a copy of Better Pathfinding and modify the algorithm. If I can figure it out.


@pardeike. How do I use Harmony to replace the code "and not use any pre/post patches"? I thought that's all it did. And I don't now any CIL.
Title: Re: [A16] HugsLib (2.4.1) Lightweight modding library
Post by: Brrainz on February 08, 2017, 09:50:31 AM
Quote from: Rock5 on February 08, 2017, 08:17:31 AM
Will the harmony library allow me to access the parents private fields?

I think Better Pathfinding uses it's own detouring, not a library. I didn't want to use my own implementation until I understood it better but I guess it's an option. I could just make a copy of Better Pathfinding and modify the algorithm. If I can figure it out.


@pardeike. How do I use Harmony to replace the code "and not use any pre/post patches"? I thought that's all it did. And I don't now any CIL.
If you are not familiar with CIL which is an intermediate token language designed to produce assembler, I don't recommend diving right into it. But if you feel for a challenge I would recommend to start with an ILProcessor implementation that prepends a few tokens that read the private field. Write a method that accesses a private field and decompile it into IL code and see how the code looks like.

Most likely you will see something like

LDFLD fieldinfo_here

which is the code for "load content of field onto the stack".
Title: Re: [A16] HugsLib (2.4.1) Lightweight modding library
Post by: Zhentar on February 08, 2017, 12:02:09 PM
The HugsLib equivalent to Better Pathfinding's archaic standalone detours functionality would be [DetourMethod(typeof(PathFinder),"FindPath")] on the PathFinderDetour.FindPath method. In that method, it uses a compiled accessor function to get the PathFinder instance's private map field (reflection would work too) and then calls the NewPathFinder instance associated with that map (using a MapComponent to tie the NewPathFinder instance to the map's lifecycle).

Even if it were possible to easily/efficiently get & set all of the pathfinder's fields, you still wouldn't want to go that route because it wouldn't let you change their type definitions; I've changed the PathFinderNodeFast fields up quite a bit.

re: figuring out the Better Pathfinding algorithm, I've started going through it and adding some comments in an attempt to make it at least slightly comprehensible to other people. I've still got quite a bit left to go on that, but please let me know which parts particularly opaque, especially if there already are comments attempting to explain it.
Title: Re: [A16] HugsLib (2.4.1) Lightweight modding library
Post by: Rock5 on February 08, 2017, 03:29:37 PM
ARGH!!! Just lost my post.

@Takes a moment to do a search on how to permanently disable backspace going back a page.@

Ok, that's done. Now let me see if I can remember everything I wrote.
Title: Re: [A16] HugsLib (2.4.1) Lightweight modding library
Post by: Rock5 on February 08, 2017, 03:53:05 PM
I understand a little better but it's still too complicated for me. I don't know why I'm having so much time figuring out C#. It's the hardest language I've ever learned. I think it's the IDE. I'm not used to so much happening behind the scenes. I'd love it if there was a bare bones course for C# that didn't use VS and you had to do everything manually.

Anyway, I think the best chance I have of succeeding is if I make a copy of Better Pathfinding and change the parts I'm interested in. That way i wouldn't need to know how the rest of it works. It would help to know, basically, how all the classes tie together.

This is what I can make out so far:
- DetourInjector "runs" first. It uses the methods in Detours to detour FindPath and DebugCell. Why do you detour DebugCell? Has it something to do with drawing the path?
- So now when an instance of FindPath (or is it PathFinder) is created it runes PathFinderDetour.PathFind.
- This in turn gets the map. Hm... I'm not quite sure what it does with it but I'm assuming it makes it available to NewPathFinder.FindPath which it then runs.
- RegionPathCostHeuristics is used to calculate the heuristics and it looks like it uses RegionLinkDijkstra.
- I assume BpmxFastPriortyQueue is the queue implementation you use to manage the nodes.

Is that right?

BTW, am i hijacking this post? Should we continue this elsewhere?
Title: Re: [A16] HugsLib (2.4.1) Lightweight modding library
Post by: UnlimitedHugs on February 09, 2017, 01:58:09 AM
Quote from: Rock5 on February 08, 2017, 03:53:05 PM
I understand a little better but it's still too complicated for me. I don't know why I'm having so much time figuring out C#. It's the hardest language I've ever learned. I think it's the IDE. I'm not used to so much happening behind the scenes. I'd love it if there was a bare bones course for C# that didn't use VS and you had to do everything manually.

If you're just starting out, you might have a more enjoyable time working on something simpler- the pathfinder is one of the more complicated parts of Rimworld, and detouring increases the complexity significantly.
As for VS, it absolutely is your friend when working with C#, because it will point out errors without the need to compile. You could use a plain text editor, but you would miss out on many features that are designed to make our work easier.

Quote from: Rock5 on February 08, 2017, 03:53:05 PM
BTW, am i hijacking this post? Should we continue this elsewhere?

It's fine- this is somewhat related to the library, and others might benefit, as well.
Title: Re: [A16] HugsLib (2.4.1) Lightweight modding library
Post by: Zhentar on February 09, 2017, 03:27:27 PM
Quote from: Rock5 on February 08, 2017, 03:53:05 PM
This is what I can make out so far:
- DetourInjector "runs" first. It uses the methods in Detours to detour FindPath and DebugCell. Why do you detour DebugCell? Has it something to do with drawing the path?
- So now when an instance of FindPath (or is it PathFinder) is created it runes PathFinderDetour.PathFind.
- This in turn gets the map. Hm... I'm not quite sure what it does with it but I'm assuming it makes it available to NewPathFinder.FindPath which it then runs.
- RegionPathCostHeuristics is used to calculate the heuristics and it looks like it uses RegionLinkDijkstra.
- I assume BpmxFastPriortyQueue is the queue implementation you use to manage the nodes.

Is that right?

BTW, am i hijacking this post? Should we continue this elsewhere?

That's about right. Note that DetourInjector gets run first because of the [StaticConstructorOnStartup] attribute on the class - this is a RimWorld modding feature that will run your static constructor during mod initialization.

I detour DebugCell to make the label area larger than it is in Vanilla, so that I can print out more lines of debug code. Since I managed to get ison to implement off screen clipping in A16, it doesn't help anything in release builds so I should wrap that in a #if DEBUG now.
Title: Re: [A16] HugsLib (2.4.1) Lightweight modding library
Post by: nahuen89 on February 12, 2017, 04:37:14 PM
Hi, this is the translation for Spanish Latin and Spanish:

<?xml version="1.0" encoding="utf-8" ?>
<LanguageData>

<HugsLib_settings_btn>Ajustes de mod</HugsLib_settings_btn>
<HugsLib_settings_windowTitle>Ajustes de mod</HugsLib_settings_windowTitle>
<HugsLib_settings_resetValue>resetear ajustes por default</HugsLib_settings_resetValue>
<HugsLib_settings_resetAll>Resetear todo</HugsLib_settings_resetAll>
<HugsLib_settings_resetAll_prompt>¿Restablecer todos los ajustes de modificación a sus valores originales?</HugsLib_settings_resetAll_prompt>
<HugsLib_settings_noSettings>No se cargan mods con ajustes configurables.</HugsLib_settings_noSettings>

<HugsLib_ownSettingsName>Otros</HugsLib_ownSettingsName>
<HugsLib_setting_showNews_label>Mostrar noticias de actualizaciones de mods</HugsLib_setting_showNews_label>
<HugsLib_setting_showNews_desc>Permite que los mods recién instalados resalten sus nuevas funciones en una ventana emergente al iniciar el juego.</HugsLib_setting_showNews_desc>
<HugsLib_setting_allNews_label>Todas las noticias de actualización de mod</HugsLib_setting_allNews_label>
<HugsLib_setting_allNews_desc>Muestra todas las noticias de actualización de mod disponibles, incluidas las que ya se han mostrado.</HugsLib_setting_allNews_desc>
<HugsLib_setting_allNews_button>Mostrar ahora</HugsLib_setting_allNews_button>
<HugsLib_setting_allNews_fail>Ninguno de los mods activos tiene noticias de actualización que mostrar.</HugsLib_setting_allNews_fail>

<HugsLib_features_title>Nuevas funciones de modificación</HugsLib_features_title>
<HugsLib_features_description>Se han instalado las siguientes actualizaciones de modificación y éstas son las nuevas características y mejoras incluidas en ellas. \nPuede deshabilitar este diálogo en Opciones &gt; Mod Settings</HugsLib_features_description>
<HugsLib_features_update>{0} v{1}</HugsLib_features_update>
<HugsLib_features_link>Enlace</HugsLib_features_link>
<HugsLib_features_linkDesc>Abre su navegador en una página donde puede obtener más información sobre esta actualización..\nDireccion: {0}</HugsLib_features_linkDesc>

<HugsLib_copiedToClipboard>Copiado al portapapeles.</HugsLib_copiedToClipboard>

<HugsLib_logs_copy>Copiar</HugsLib_logs_copy>
<HugsLib_logs_shareBtn>Compartir registros</HugsLib_logs_shareBtn>
<HugsLib_logs_shareConfirmTitle>Confirmar</HugsLib_logs_shareConfirmTitle>
<HugsLib_logs_shareConfirmMessage>Subir los registros ahora?\n\nEsto publicará los registros de su juego en un servidor público y le dará el enlace para compartir con otros. Esto es útil si necesita ayuda para solucionar un problema o desea informar de un problema a un autor de modificaciones.\n\nNo se compartirá información privada.</HugsLib_logs_shareConfirmMessage>
<HugsLib_logs_publisherTitle>Editor de registro</HugsLib_logs_publisherTitle>
<HugsLib_logs_uploading>Cargando{0}</HugsLib_logs_uploading>
<HugsLib_logs_shortening>Obteniendo URL{0}</HugsLib_logs_shortening>
<HugsLib_logs_uploaded>Carga completa!</HugsLib_logs_uploaded>
<HugsLib_logs_uploadError>Error en carga: {0}</HugsLib_logs_uploadError>
<HugsLib_logs_abortBtn>Abortar</HugsLib_logs_abortBtn>
<HugsLib_logs_retryBtn>Reintentar</HugsLib_logs_retryBtn>
<HugsLib_logs_browseBtn>Abrir en el navegador</HugsLib_logs_browseBtn>

<HugsLib_logs_filesBtn>Archivos</HugsLib_logs_filesBtn>
<HugsLib_logs_openLogFile>Abrir archivo de registro</HugsLib_logs_openLogFile>
<HugsLib_logs_openSaveDir>Abrir carpeta de guardar</HugsLib_logs_openSaveDir>
<HugsLib_logs_openModsDir>Abrir carpeta de Mods</HugsLib_logs_openModsDir>

<HugsLib_restart_title>Reiniciar juego</HugsLib_restart_title>
<HugsLib_restart_text>Los cambios han sido guardados.\n\nPara activar la nueva configuración de modificación, se recomienda reiniciar el juego.</HugsLib_restart_text>
<HugsLib_restart_restartNowBtn>Reiniciar ahora</HugsLib_restart_restartNowBtn>
<HugsLib_restart_autoToggle>Reiniciar automáticamente</HugsLib_restart_autoToggle>
<HugsLib_restart_restarting>Reiniciando</HugsLib_restart_restarting>
<HugsLib_setting_autoRestart_label>Reiniciar después de cambiar el menú Mods</HugsLib_setting_autoRestart_label>
<HugsLib_setting_autoRestart_desc>Reinicia automáticamente el juego después de haber realizado cambios en el menú Mods.</HugsLib_setting_autoRestart_desc>

<test_enumSetting_DefaultValue>Valor por defecto</test_enumSetting_DefaultValue>
<test_enumSetting_ValueOne>Valor Uno</test_enumSetting_ValueOne>
<test_enumSetting_ValueTwo>Valor Dos</test_enumSetting_ValueTwo>

</LanguageData>
Title: Re: [A16] HugsLib (2.4.1) Lightweight modding library
Post by: UnlimitedHugs on February 13, 2017, 05:40:34 AM
Quote from: nahuen89 on February 12, 2017, 04:37:14 PM
Hi, this is the translation for Spanish Latin and Spanish

Thank you, I'll include this in the next release.
Title: Re: [A16] HugsLib (2.4.2) Lightweight modding library
Post by: UnlimitedHugs on February 14, 2017, 09:28:52 AM
Updated to 2.4.2

This should fix the automatic restart failing for some players, or so I hope, since I couldn't reproduce it myself.
Also, a special case of detour warning should be fixed.
@nahuen89, your translation is also included in this release.
Title: Re: [A16] HugsLib (2.4.2) Lightweight modding library
Post by: Wishmaster on February 19, 2017, 08:03:30 AM
Can I use HugsLib to show a custom dialog window ?

I've used Dialog_MessageBox but I can't figure out how to actually show up
Title: Re: [A16] HugsLib (2.4.2) Lightweight modding library
Post by: Sspec7aR on February 19, 2017, 11:20:16 AM
Hey guys ... I installed the mod and the game told me (when I loaded my save) that now it is running with Core and HugsLib mods /// my question is reallllllly stupid but like a newbie in this game ... how I can start this mod ... I mean ... to see the library ? o_O pls help me ... I will appreciate it ... and sry for this stupid question but I really dont know :(
Title: Re: [A16] HugsLib (2.4.2) Lightweight modding library
Post by: UnlimitedHugs on February 21, 2017, 12:22:11 PM
Quote from: Wishmaster on February 19, 2017, 08:03:30 AM
Can I use HugsLib to show a custom dialog window ?
I've used Dialog_MessageBox but I can't figure out how to actually show up

The dialog must be added to the window stack to be displayed. Try this:

Find.WindowStack.Add(new Dialog_MessageBox("Heyo"))


Quote from: Sspec7aR on February 19, 2017, 11:20:16 AM
-snip-

I think you are looking for a feature that HugsLib doesn't have.
The library is a set of tools that other mods can use to make development easier- it's not something players can use.
If you are looking for mods to install, you could check out the Rimworld workshop on Steam (http://steamcommunity.com/app/294100/workshop/).
Title: Re: [A16] HugsLib (2.4.3) Lightweight modding library
Post by: UnlimitedHugs on February 26, 2017, 09:25:20 AM
Updated to 2.4.3

The log uploader should now work properly on the Linux build of the game.
Title: Re: [A16] HugsLib (2.4.3) Lightweight modding library
Post by: Wishmaster on February 27, 2017, 07:51:04 PM
Is destructive detouring implementation with Harmony planned ?

Also is there a way to use a custom setting like an enum with creating a customdrawer ? I want to make a dynamical options list.
Title: Re: [A16] HugsLib (2.4.3) Lightweight modding library
Post by: UnlimitedHugs on February 28, 2017, 08:01:54 AM
Quote from: Wishmaster on February 27, 2017, 07:51:04 PM
Will non destructive detouring implementation with Harmony is planned ?
Also is there a way to use a custom setting like an enum with creating a customdrawer ? I want to make a dynamical options list.

I plan to include Harmony in the A17 release of HugsLib. There will be a migration guide on how to refit existing detours to make use of Harmony instead.

If you're using customdrawer, you have a lot more flexibility- you don't have to use an enum. For a dynamic drop-down list you would probably use a string-typed setting handle to store the currently selected option. Here's the method that draws the control for enum handles (https://github.com/UnlimitedHugs/RimworldHugsLib/blob/master/Source/Settings/Dialog_ModSettings.cs#L262)- feel free to adapt it to your own case. 
If you require more pointers, let me know.
Title: Re: [A16] HugsLib (2.4.3) Lightweight modding library
Post by: Wishmaster on March 05, 2017, 04:29:08 PM
So I've done what you said. But I've found no way to save the setting value.
I've read on your documentation.
QuoteMake sure to assign SettingHandle.Value when the setting changes so that it may be properly saved.

But I guess I have to do it with SettingHandle<T>.OnValueChanged = ... right ?
Well I can't trigger it with my custom drawer.

I've assigned this function of mine bellow to SettingHandle.  CustomDrawer and it works fine but for some reasons it never returns true when I change the setting (I guess this is what triggers OnValueChanged and or makes HugsLib save the setting).
I assign a local variable "bool settingChanged" that is used as a return value, and a member "activePolicy" that is the value I want to be set (this works perfectly).
But settingChanged is always false !

Can you help me again ?
Did I miss something regarding how to save settings ?


              public bool DrawHandleInputEnum(Rect controlRect)
             {
                 bool settingChanged = false;
                 //if (info.enumNames == null) return false;
                 var readableValue = ToString();
                 if (Widgets.ButtonText(controlRect, readableValue))
                 {
                     var floatOptions = new List<FloatMenuOption>();

                     floatOptions.Add(new FloatMenuOption(Policies.Unrestricted.label, () =>
                     {
                         activePolicy = null;
                     }));
                     foreach (var policyOption in this.pawnMask.RelatedPolicies)
                     {
                         floatOptions.Add(new FloatMenuOption(policyOption.label, () =>
                         {
                             // this is confirmed to attribute the variable as I want...
                             activePolicy = policyOption;
                             // ... but this will never make the function return true.
                             settingChanged = true;
                         }));
                     }
                     Find.WindowStack.Add(new FloatMenu(floatOptions));
                 }
                 //if (info.validationScheduled)
                 //{
                 //    info.validationScheduled = false;
                 //    return true;
                 //}
                 return settingChanged;
             }

Title: Re: [A16] HugsLib (2.4.3) Lightweight modding library
Post by: UnlimitedHugs on March 05, 2017, 06:22:53 PM
Quote from: Wishmaster on March 05, 2017, 04:29:08 PM
- snip -

I made the same mistake here! :D
Basically, when your float menu option is selected, the drawer method has already returned- which means it always returns false, and thus your setting is never saved. This is why I set validationScheduled to true- that way the change can be detected the next time the control is drawn.
Title: Re: [A16] HugsLib (2.4.3) Lightweight modding library
Post by: Wishmaster on March 05, 2017, 07:19:55 PM
I did not even think about using my validationScheduled member...
Now the drawer returns true but that doesn't trigger OnValueChanged.
I'm not sure how to save the setting.

First I do this to create the handle Settings.GetHandle<MyCustomSetting>(settingId, settingLabel, settingDesc, new MyCustomSettingHandle());

Should the latest parameter be that or a MyCustomSetting object ? Should I create an implicit conversion then ?

Please forgive my amateurishness in coding.
Title: Re: [A16] HugsLib (2.4.3) Lightweight modding library
Post by: UnlimitedHugs on March 06, 2017, 03:55:43 AM
Quote from: Wishmaster on March 05, 2017, 07:19:55 PM
Now the drawer returns true but that doesn't trigger OnValueChanged.

OnValueChanged is called when SettingHandle.Value is assigned a different value. Setting saving happens when the settings window is closed and at least one setting reported to have been changed.
So, to have the setting saved when the window closes, you would have to assign SettingHandle.Value when the user picks a new option and have the custom drawer return true.
I'm not sure what MyCustomSetting and MyCustomSettingHandle are in your example are- but if you are trying to use a custom data type to store your value, I would use null as the default value (the 4th parameter). If you link me to your full code, I could give you more specific pointers.
Also, no worries- we are here to help each other.
Title: Re: [A16] HugsLib (2.4.3) Lightweight modding library
Post by: Wishmaster on March 06, 2017, 06:56:52 AM
Yes, it is a custom type.
Now I realize that 4th parameter's type is a unique value for all possible settings, right ?
When I set it to null as a default value, obviously I get a NullReferenceException when opening mod settings because the reference for ToString() does not exist.

At first I wanted to use a single instance of MyCustomSettingHandle to deal with all combinations of the related setting.
Then to update the SettingHandle.Value from inside the CustomDrawer, I've found no other way but to add a SettingHandle<MyCustomSetting> member to my MyCustomSettingHandle, and assign the value created by Settings.GetHandle in DefsLoaded().
Then I can assign SettingHandle.Value. But what value should I assign ? SettingHandle.Value = this does not assign a different value

Note: I'm making a dynamic list of settings. I have one or more MyCustomSetting*** depending on the user.

I don't show up all my code but try to make a summary of it instead. I hope it makes easier to understand the related issues i have.

edit I've found a dirty way to somehow fix it:
now the Value is saved and OnValueChanged is triggered.

in my MyCustomSettingHandle class

         public override bool Equals(object obj)
         {
             return false;
         }
Title: Re: [A16] HugsLib (2.4.3) Lightweight modding library
Post by: UnlimitedHugs on March 06, 2017, 11:50:02 AM
Quote from: Wishmaster on March 06, 2017, 06:56:52 AM
- snip -

The problem is probably due to to the fact that handle values that equal its default value are not saved.
The 4th parameter (the default value) should be null for custom setting types- otherwise you would end up with the same object in both the Value and DefaultValue fields when the player resets the setting. Of course, that implies the need to check for null in the Value field, and assign it a new object. And no, the default value is specific only to the handle it is passed to.
Overriding Equals() should not be necessary neither in the handle, nor in the data type- unless I missed something in my implementation.
OnValueChanged would not be called in this case, but it doesn't need to- since you are using a custom drawer and are notified of the change anyway. All that should be necessary for a successful save is returning true in the drawer, and the Value of the handle not being equal to the default value.
Hope this helps.
Title: Re: [A16] HugsLib (2.4.3) Lightweight modding library
Post by: Wishmaster on March 06, 2017, 03:31:39 PM
So I managed to deal with that null default value


// one mask = one setting

  mask.settingHandle = Settings.GetHandle<PolicySetting>(settingId, settingLabel, settingDesc, null);

mask.settingHandle.CustomDrawer = PolicySetting.GetCustomDrawer(mask);


(almost) Everything seem to work know, including settings save!
However to assign a value to  settingHandle.Value I had to create an implicit conversion that looks somehow wrong to my eyes.
Am I supposed to create a new instance of PolicySetting every time I change a setting ?


  public static implicit operator PolicySetting(Policy obj)
{
    return new PolicySetting() { ActivePolicy = obj };
}

Title: Re: [A16] HugsLib (2.4.3) Lightweight modding library
Post by: UnlimitedHugs on March 07, 2017, 01:50:35 PM
Quote from: Wishmaster on March 06, 2017, 03:31:39 PM
(almost) Everything seem to work know, including settings save!
However to assign a value to  settingHandle.Value I had to create an implicit conversion that looks somehow wrong to my eyes.
Am I supposed to create a new instance of PolicySetting every time I change a setting ?

Glad to hear it!
You don't need to assign a new object on each change- just when Value is null. After that, changing the fields of the existing object should allow the setting to be saved just fine.
Hard to tell without seeing the rest of it, but that conversion looks alright. Whatever works for you.
Title: Re: [A16] HugsLib (2.4.3) Lightweight modding library
Post by: Wishmaster on March 14, 2017, 11:40:09 AM
Hello, it's me again.

I want to modify the Needs pawn inspect tab. Am I doing it right without using Hugs GUI injection, knowing that it does not inherits from Window ? (ITab_Pawn_Needs)

Also I wanted to create a Keybinding to toggle on/off a vanilla development option.
That would be really great if HugsLib provide a method to override in ModBase like OnUiUpdate() !
So far, RawCode suggested I use UnityEngine...
Title: Re: [A16] HugsLib (2.4.3) Lightweight modding library
Post by: UnlimitedHugs on March 14, 2017, 12:28:51 PM
Quote from: Wishmaster on March 14, 2017, 11:40:09 AM
I want to modify the Needs pawn inspect tab. Am I doing it right without using Hugs GUI injection, knowing that it does not inherits from Window ? (ITab_Pawn_Needs)

Tabs are drawn inside an ImmediateWindow, which can be injected into- the window is drawn during InspectTabBase.DoTabGUI. The trouble is identifying which tab you are drawing into, since all tabs share the same immediate window Id.
I see two options:
1) Creating a new tab that inherits from ITab_Pawn_Needs and replace the original tab during DefsLoaded. This is, arguably, the more compatible option.
2) Detouring ITab_Pawn_Needs.FillTab. In A17 detours will have to be converted to Harmony patches, so you would have good compatibility eventually, as well.

Quote from: Wishmaster on March 14, 2017, 11:40:09 AM
Also I wanted to create a Keybinding to toggle on/off a vanilla development option.
That would be really great if HugsLib provide a method to override in ModBase like OnUiUpdate() !

You can override the OnGUI method in ModBase for this. The wiki has an example (https://github.com/UnlimitedHugs/RimworldHugsLib/wiki/ModBase-reference#ongui) on how to listen to a key binding.
Title: Re: [A16] HugsLib (2.4.3) Lightweight modding library
Post by: Wishmaster on March 14, 2017, 01:11:04 PM
Quote1) Creating a new tab that inherits from ITab_Pawn_Needs and replace the original tab during DefsLoaded. This is, arguably, the more compatible option.

What I've done at first. But it would required to rewrite or copy the entire tree of calls to what I want to change.
But then I tried only to detour a method that is called in the "tree" of ITab_Pawn_Needs( NeedsCardUtility.DoNeeds() ).

Hopefully, no other modder will detour this one !

QuoteYou can override the OnGUI method in ModBase for this. The wiki has an example (https://github.com/UnlimitedHugs/RimworldHugsLib/wiki/ModBase-reference#ongui) on how to listen to a key binding.

Didn't see that... trying now.
Title: Re: [A16] HugsLib (2.4.3) Lightweight modding library
Post by: UnlimitedHugs on March 18, 2017, 02:08:12 PM
As you may know, Alpha 17 is scheduled to be released in the near future.
I am doing some preliminary work on the library to prepare for the update. If you have any compatibility-breaking API changes you would like to suggest, this is a good time.
Title: Re: [A16] HugsLib (2.4.3) Lightweight modding library
Post by: Wishmaster on March 29, 2017, 07:23:31 PM
Hello again !

I can't something with OnGUI() properly. It keeps blinking, just like I was using the wrong way to draw something (using Tick() for example).
While capturing keys works very fine, this does not.

          public override void OnGUI()
         {
             if (Find.Selector == null)
                 return;
             
             var t = Find.Selector.SingleSelectedThing;
//draws something
             if (t is Plant)
             {
                 var group = ((RimWorld.Plant)t).GroupOf();

                 if (group != null)
                 {
                     GenDraw.DrawFieldEdges(group.plants.Select(arg => arg.Position).ToList(),SimpleColor.Red.ToUnityColor());
                 }
             }
         }
Title: Re: [A16] HugsLib (2.4.3) Lightweight modding library
Post by: UnlimitedHugs on March 29, 2017, 08:17:21 PM
Quote from: Wishmaster on March 29, 2017, 07:23:31 PM
I can't something with OnGUI() properly. It keeps blinking, just like I was using the wrong way to draw something (using Tick() for example).
While capturing keys works very fine, this does not.

This is due to how Unity's OnGUI works. It's not called on every frame, only when the GUI actually needs redrawing- such as when an input event occurs. I think this is because Rimworld does not use a camera, but all drawing happens directly to screen.
Anyway, if you put your code inside the Update() method instead, the outlines should draw consistently.
Title: Re: [A16] HugsLib (2.4.3) Lightweight modding library
Post by: CutiesDeathCab on March 29, 2017, 09:41:18 PM
Hello, I am asking for permission to place your mod into a database I am working on for RimWorld mod Listings. I plan on keeping it updated with the help of some others. The post will contain the following
[Version, Title, Author, Direct Topic Link, Direct Download Link (From the topic)]
Either PM me, Or reply to this message. Thank you. :)
P.S: The Database will have its own topic once I have a decent amount in the database.
Title: Re: [A16] HugsLib (2.4.3) Lightweight modding library
Post by: Wishmaster on March 29, 2017, 09:45:03 PM
Yeah that works thank you again !
Title: Re: [A16] HugsLib (2.4.3) Lightweight modding library
Post by: UnlimitedHugs on March 29, 2017, 10:01:19 PM
Quote from: CutiesDeathCab on March 29, 2017, 09:41:18 PM
Hello, I am asking for permission to place your mod into a database I am working on for RimWorld mod Listings.

Of course, that's all right with me. Same goes for my other mods, should you choose to include them.
Title: Re: [A16] HugsLib (2.4.3) Lightweight modding library
Post by: CutiesDeathCab on March 29, 2017, 10:04:03 PM
Quote from: UnlimitedHugs on March 29, 2017, 10:01:19 PM
Quote from: CutiesDeathCab on March 29, 2017, 09:41:18 PM
Hello, I am asking for permission to place your mod into a database I am working on for RimWorld mod Listings.

Of course, that's all right with me. Same goes for my other mods, should you choose to include them.

Thanks ^_^ I'm still figuring out a good way of sorting them, I'll PM you when I have a better setup ready.
Title: Re: [A16] HugsLib (2.4.3) Lightweight modding library
Post by: Craftysune on April 24, 2017, 12:22:34 PM
I hope it's okay to post a general question here. But could someone help this noob out & please tell me where I'm supposed to put Libhugs when I've downloaded it.  :-[ I'm dying to use it because it looks amazing. I've tried to find out independently &  I've had no joy. Any help would be greatly appreciated. Cheers. :)
Title: Re: [A16] HugsLib (2.4.3) Lightweight modding library
Post by: Canute on April 24, 2017, 12:35:01 PM
Could you read
[A16] HELP: How to Install and Update All Types of Mods
https://ludeon.com/forums/index.php?topic=6223.0

??
Title: Re: [A16] HugsLib (2.4.3) Lightweight modding library
Post by: UnlimitedHugs on April 24, 2017, 12:44:45 PM
Quote from: Craftysune on April 24, 2017, 12:22:34 PM
I hope it's okay to post a general question here. But could someone help this noob out & please tell me where I'm supposed to put Libhugs when I've downloaded it.  :-[ I'm dying to use it because it looks amazing. I've tried to find out independently &  I've had no joy. Any help would be greatly appreciated. Cheers. :)

Like all other mods, just extract the zip file to your "/Rimworld/Mods/" folder and you should be good to go.
If you're playing on Steam, you might have an easier time installing the mod from the Workshop (http://steamcommunity.com/sharedfiles/filedetails/?id=818773962).
Title: Re: [A16] HugsLib (2.4.3) Lightweight modding library
Post by: 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.
Title: Re: [A16] HugsLib (2.4.3) Lightweight modding library
Post by: UnlimitedHugs on April 24, 2017, 01:12:26 PM
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.
Title: Re: [A16] HugsLib (2.4.3) Lightweight modding library
Post by: 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
Title: Re: [A16] HugsLib (2.4.3) Lightweight modding library
Post by: UnlimitedHugs on April 24, 2017, 08:57:35 PM
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 (https://github.com/UnlimitedHugs/RimworldHugsLib/releases/tag/v2.4.3), 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 :)
Title: Re: [A16] HugsLib (2.4.3) Lightweight modding library
Post by: Craftysune on April 25, 2017, 12:27:59 AM
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.  :)
Title: Re: [A16] HugsLib (2.4.3) Lightweight modding library
Post by: UnlimitedHugs on April 25, 2017, 04:13:07 PM
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.
Title: Re: [A16] HugsLib (2.4.3) Lightweight modding library
Post by: Wishmaster on May 06, 2017, 10:20:22 AM
Any ETA for the A17 version of hugslib now that A17 is public ?
Title: Re: [A16] HugsLib (2.4.3) Lightweight modding library
Post by: UnlimitedHugs on May 06, 2017, 11:39:52 AM
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.
Title: Re: [A17] HugsLib (3.0.0) Lightweight modding library
Post by: UnlimitedHugs on May 09, 2017, 09:33:32 AM
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 (https://github.com/UnlimitedHugs/RimworldHugsLib/wiki/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!
Title: Re: [A17] HugsLib (3.0.0) Lightweight modding library
Post by: Brrainz on May 09, 2017, 10:12:32 AM
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 (https://github.com/pardeike/Harmony)
Title: Re: [A17] HugsLib (3.0.0) Lightweight modding library
Post by: UnlimitedHugs on May 10, 2017, 03:36:26 AM
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.
Title: Re: [A17] HugsLib (3.0.0) Lightweight modding library
Post by: 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 ?
Title: Re: [A17] HugsLib (3.0.0) Lightweight modding library
Post by: 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 (https://github.com/pardeike/Harmony/wiki/Target-Method-Annotations).
I'll see if I can write that page about migration tomorrow- hopefully it will help you have an easier time with the transition.
Title: Re: [A17] HugsLib (3.0.0) Lightweight modding library
Post by: UnlimitedHugs on May 11, 2017, 07:25:31 AM
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 (https://github.com/UnlimitedHugs/RimworldHugsLib/wiki/Introduction-to-Patching) NEW
Title: Re: [A17] HugsLib (3.0.0) Lightweight modding library
Post by: Wishmaster on May 11, 2017, 08:26:33 AM
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 (https://github.com/pardeike/Harmony/wiki/Target-Method-Annotations).
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.
Title: Re: [A17] HugsLib (3.0.0) Lightweight modding library
Post by: PeteTimesSix on May 12, 2017, 10:01:30 PM
So the mod settings screen seems to be broken? I get this exception spammed every frame while its open, and it renders nothing other than an empty window box (well, the close button is still there)...

Exception filling window for HugsLib.Settings.Dialog_ModSettings: System.MissingMethodException: Method not found: 'Verse.Widgets.BeginScrollView'.
  at Verse.Window+<WindowOnGUI>c__AnonStorey2C3.<>m__1B3 (Int32 x) [0x001ff] in C:\Dev\RimWorld\Assets\Scripts\Verse\UI\Windows\Window.cs:192
Verse.Log:Error(String) (at C:\Dev\RimWorld\Assets\Scripts\Verse\Utility\Debug\Log\Log.cs:48)
Verse.<WindowOnGUI>c__AnonStorey2C3:<>m__1B3(Int32) (at C:\Dev\RimWorld\Assets\Scripts\Verse\UI\Windows\Window.cs:196)
UnityEngine.GUI:CallWindowDelegate(WindowFunction, Int32, GUISkin, Int32, Single, Single, GUIStyle) (at C:\buildslave\unity\build\Runtime\IMGUI\Managed\GUI.cs:1896)


Happens even with no other mods loaded. Using unstable branch on Steam and HugsLib 3.0.0 (installed in mods folder, not the workshop version). Ive even reinstalled both just to be sure.
Title: Re: [A17] HugsLib (3.0.1) Lightweight modding library
Post by: UnlimitedHugs on May 13, 2017, 10:10:26 AM
Updated to 3.0.1

Minor maintenance release.
Rimworld update broke something, which caused the Mod Options window errors.
Among other things, SettingHandles now have a DisplayOrder property that allows them to be displayed in a different order, than that, in which they were created. More here (https://github.com/UnlimitedHugs/RimworldHugsLib/wiki/Adding-Mod-Settings#displayorder).
I also added LogWindowExtensions- a way to draw your own controls in the Log window, if you need to. Used like so:


LogWindowExtensions.AddLogWindowWidget((window, rect, message, row) => {
row.ButtonText("Praise be");
});


This auspicious day also marks the return of the Log window Copy button, which, I'm sure, was dearly missed. At least by me.
Finally, the docs XML file is now also included with the library. If you keep it next to the dll, you will get method and type documentation on HugsLib stuff in your code completion window.
Thank you Proxyer for contributing the Japanese translation for the library.
Title: Re: [A17] HugsLib (3.0.1) Lightweight modding library
Post by: Skcuske_Lobuk on May 19, 2017, 09:05:23 AM
I'm trying to patch a basic function like described in the wiki, but the patching isn't working. Am I missing somethíng?

The method to detour:
// RimWorld.ColonistBar
public void MarkColonistsDirty()
{
this.entriesDirty = true;
}


my code below.
using UnityEngine;
using Verse;

namespace ColonistBarMod
{    [HarmonyPatch(typeof(ColonistBar), "MarkColonistsDirty")]
    public static class MarkColonistsDirtyPatch
    {
        [HarmonyPrefix]
        public static void MarkThemDirty()
        {
            Log.Message("Colonists marked dirty.x02");
        }
    }
}


//EDIT: The mod uses the ModBase extension, the following code works and is correctly logged.
    [HarmonyPatch(typeof(FloatMenuMakerMap), "AddHumanlikeOrders")]
    [HarmonyPatch(new Type[] { typeof(Vector3), typeof(Pawn), typeof(List<FloatMenuOption>) })]
    static class FloatMenuMakerMap_AddHumanLikeOrders_Postfix
    {
        [HarmonyPostfix]
        private static void AddHumanlikeOrders(Vector3 clickPos, Pawn pawn, List<FloatMenuOption> opts)
        {
            Log.Message("PATCHED HUMAN LIKE ORDERS");

        }
    }

Title: Re: [A17] HugsLib (3.0.1) Lightweight modding library
Post by: UnlimitedHugs on May 19, 2017, 11:44:31 AM
Quote from: Montezuma on May 19, 2017, 09:05:23 AM
I'm trying to patch a basic function like described in the wiki, but the patching isn't working. Am I missing somethíng?

I've run a bunch of tests and talked it over with pardeike. Looks like you've hit an edge case, so- congrats! :D
We suspect the method is being inlined by the JIT compiler, and thus is never called.
Your best bet is probably to get a patch on CheckRecacheEntries() in the same class, depending on what your goal is.
Title: Re: [A17] HugsLib (3.0.1) Lightweight modding library
Post by: DariusWolfe on May 19, 2017, 02:33:31 PM
Can you change the link on the first page? I ran into a problem when I tried to "update" and it ended up being the same version I already had; Changing the link manually from 3.0.0 to 3.0.1 worked, though.
Title: Re: [A17] HugsLib (3.0.1) Lightweight modding library
Post by: UnlimitedHugs on May 19, 2017, 02:43:41 PM
Quote from: DariusWolfe on May 19, 2017, 02:33:31 PM
Can you change the link on the first page? I ran into a problem when I tried to "update" and it ended up being the same version I already had; Changing the link manually from 3.0.0 to 3.0.1 worked, though.

Should already be fixed back to "latest". Thank you for the tip, though.
Title: Re: [A17] HugsLib (3.0.1) Lightweight modding library
Post by: DariusWolfe on May 19, 2017, 02:52:45 PM
Gotcha! It was last night when I did the update, started a new colony and wanted to try a new mod that required it; Didn't get back on to the forums until today.
Title: Re: [A17] HugsLib (3.0.1) Lightweight modding library
Post by: UnlimitedHugs on May 25, 2017, 07:29:03 AM
Just as a heads-up: HugsLib is now updated to A17 on the official workshop page. I've also added a new page for the good old A16 version.

The A16 version has also been updated with the french translation contributed by Aquila Terra.
Title: Re: [A17] HugsLib (3.0.1) Lightweight modding library
Post by: Wishmaster on May 25, 2017, 01:13:07 PM
How can I deal with methods that have "out" fields, in case the prefix I made returns false and therefore I want Postfix method to output its own return value and its own out arguments.
Are the "out" arguments support in the PostFix ? If so, what should I do in the case the original method was executed (prefix returns true) and thus I don't have execute my patch method ?

The method I talk about is

public static bool TryFindBestFoodSourceFor(Pawn getter, Pawn eater, bool desperate, out Thing foodSource, out ThingDef foodDef, bool canRefillDispenser = true, bool canUseInventory = true, bool allowForbidden = false, bool allowCorpse = true, bool allowSociallyImproper = false)

Here is what I did so far.

          [HarmonyPostfix]
         public static void Postfix(ref bool __result,Pawn getter, Pawn eater, bool desperate, out Thing foodSource, out ThingDef foodDef, bool canRefillDispenser , bool canUseInventory , bool allowForbidden , bool allowCorpse, Policy forcedPolicy)
         {
             if (original)
                 return; // Obviously won't compile because no values are assigned, but the original method has been executed (original = true)
             
             try
             {
                 bool result = false;
                 result = _TryFindBestFoodSourceFor(getter, eater, desperate, out foodSource, out foodDef, canRefillDispenser, canUseInventory, allowForbidden, allowCorpse, forcedPolicy);
                 return;
             }
             catch (Exception ex)
             {
                 throw new Exception(string.Format("{0}: Exception when fetching. (getter={1} eater={2})\n{3}\n{4}", ModCore.modname, getter, eater, ex, ex.StackTrace), ex);
             }
         }
Title: Re: [A17] HugsLib (3.0.1) Lightweight modding library
Post by: UnlimitedHugs on May 25, 2017, 02:10:22 PM
Quote from: Wishmaster on May 25, 2017, 01:13:07 PM
How can I deal with methods that have "out" fields, in case the prefix I made returns false and therefore I want Postfix method to output its own return value and its own out arguments.
Are the "out" arguments support in the PostFix ? If so, what should I do in the case the original method was executed (prefix returns true) and thus I don't have execute my patch method ?

If I'm getting you correctly, you have both a prefix and a postfix on the same method.
There are no "out" parameters, but you can make "ref" parameters. The one you want in the postfix is "__result", to modify the return value. To see if the prefix has cancelled, you could use the "__state" parameter to pass a value from the prefix to the postfix. According to the wiki, any parameter can be declared as "ref".
Title: Re: [A17] HugsLib (3.1.0) Lightweight modding library
Post by: Wishmaster on May 28, 2017, 07:39:46 AM
How can I check if a method already has a postfix or a prefix ? Even with non destructive detouring, there is a method that should not be patched several times.

I swear I've been looking on the wiki before asking this...

Otherwise everything seem to work fine, I could update my mods using the new harmony stuff.
Also non destructive detouring has been very useful to detour "Thing.SpawnSetup()" safely. It seem to have done miracles for my mod "Too Many Leathers" compared to destructive detouring.
Title: Re: [A17] HugsLib (3.1.0) Lightweight modding library
Post by: UnlimitedHugs on May 28, 2017, 07:44:57 AM
Updated to 3.1.0

Why hello there, gentlefolk!
Got another feature update for your consideration-- and convenience.
Introducing- the Quickstarter:

(https://i.imgur.com/LnMPWwW.png)

(https://i.imgur.com/iOItRhL.png) (https://i.imgur.com/iOItRhL.png)

If you work on mods, this one should warm your heart. It allows to load a save or generate a map with the given settings immediately after starting the game. This allows to iterate faster, test more, and click less.
More details on the wiki page: Development Utilities (https://github.com/UnlimitedHugs/RimworldHugsLib/wiki/Development-Utilities#quickstarter) NEW

Other update features:
Happy devepoin'.
Title: Re: [A17] HugsLib (3.1.0) Lightweight modding library
Post by: UnlimitedHugs on May 28, 2017, 07:50:44 AM
Quote from: Wishmaster on May 28, 2017, 07:39:46 AM
How can I check if a method already has a postfix or a prefix ? Even with non destructive detouring, there is a method that should not be patched several times.

HarmonyInstance.IsPatched() should be what you're looking for.
Also, I agree- patches are really working out great and making our work easier. I'm getting way too carried away making new ones. New feature? Let's make a patch for that! ;D
Title: Re: [A17] HugsLib (3.1.0) Lightweight modding library
Post by: kaptain_kavern on May 28, 2017, 01:58:25 PM
The quickstart option is a lifesaver for mod dev.

Here have some cakes

(https://www.yabiladi.com/files/719b201be7a557d845b9f64057510028.JPG)


A thousand time thank you :p
Title: Re: [A17] HugsLib (3.1.0) Lightweight modding library
Post by: Brrainz on May 28, 2017, 02:42:08 PM
Quote from: Wishmaster on May 28, 2017, 07:39:46 AM
How can I check if a method already has a postfix or a prefix ? Even with non destructive detouring, there is a method that should not be patched several times.
Actually, Harmony (I wrote it) does not multi-patch the same method. It will re-patch it and you won't loose any speed or stability because it basically rewrite the whole method every time someone adds something.
Just my 2c
Title: Re: [A17] HugsLib (3.1.0) Lightweight modding library
Post by: scuba156 on May 29, 2017, 01:28:10 AM
Awesome update, the quickstarter is really useful. I don't know if your interested in this but thought I would share the idea since its what I do :)

You can read a save files mod identifiers with this function:
        public static List<string> ReadModIDs(string filepath) {
            Scribe.loader.InitLoadingMetaHeaderOnly(filepath);
            ScribeMetaHeaderUtility.LoadGameDataHeader(ScribeMetaHeaderUtility.ScribeHeaderMode.Map, false);
            Scribe.loader.FinalizeLoading();
            return ScribeMetaHeaderUtility.loadedModIdsList;
        }


Then you can activate those mods with something like:

List<string> modIDs = ReadModIDs(file);

ModsConfig.Reset();
foreach (string identifier in modIDs) {
    ModsConfig.SetActive(identifier, true);
}
ModsConfig.Save();


If you want to preserve the active mods after the restart, just copy the ModsConfig.xml file before setting the mods and copy it back after the restart loads the mods.
Title: Re: [A17] HugsLib (3.1.0) Lightweight modding library
Post by: UnlimitedHugs on May 29, 2017, 08:38:19 AM
Quote from: kaptain_kavern on May 28, 2017, 01:58:25 PM
Here have some cakes
A thousand time thank you :p

You monster, I'm on a no-carb diet ;D
But it's the thought that counts, so you are most welcome :)

Quote from: scuba156 on May 29, 2017, 01:28:10 AM
Awesome update, the quickstarter is really useful. I don't know if your interested in this but thought I would share the idea since its what I do :)
You can read a save files mod identifiers with this function:

Hey, that's really cool. I'll stash it for later- maybe adding a "Match mod config" button to the load warning dialog would be useful to have.
Perhaps we could even subscribe to missing mods by making some calls to the Steamworks API. Pretty sizeable feature, but worth considering.
Title: Re: [A17] HugsLib (3.1.0) Lightweight modding library
Post by: scuba156 on May 29, 2017, 01:28:28 PM
Quote from: UnlimitedHugs on May 29, 2017, 08:38:19 AM
Perhaps we could even subscribe to missing mods by making some calls to the Steamworks API. Pretty sizeable feature, but worth considering.
Well here you go :)


protected Callback<ItemInstalled_t> m_ItemInstalled;

void OnItemInstalled(ItemInstalled_t pCallback) {
    Logger.Message("[" + ItemInstalled_t.k_iCallback + " - ItemInstalled] - " + pCallback.m_unAppID + " -- " + pCallback.m_nPublishedFileId);
    }


Init the Callback
m_ItemInstalled = Callback<ItemInstalled_t>.Create(OnItemInstalled);

Then you can subscribe to missing mods by their identifier (if its a steam mod) with

SteamUGC.SubscribeItem(new PublishedFileId_t(modIdentifier));


If you need to force the download after subscribing, then you can use the following:
       
protected Callback<DownloadItemResult_t> m_DownloadItemResult;

void OnDownloadItemResult(DownloadItemResult_t pCallback) {
    Logger.Message("[" + DownloadItemResult_t.k_iCallback + " - DownloadItemResult] - " + pCallback.m_unAppID + " -- " + pCallback.m_nPublishedFileId + " -- " + pCallback.m_eResult);
}

m_DownloadItemResult = Callback<DownloadItemResult_t>.Create(OnDownloadItemResult);
SteamUGC.DownloadItem(new PublishedFileId_t(modIdentifier));


You could store a list<PublishedFileId_t> of the mods needed, then just List.Remove(pCallback.m_nPublishedFileId) in the callback and then restart when the list is empty.
Title: Re: [A17] HugsLib (3.1.0) Lightweight modding library
Post by: UnlimitedHugs on May 29, 2017, 02:07:56 PM
Quote from: scuba156 on May 29, 2017, 01:28:28 PM
Well here you go :)

Ask and ye shall receive, eh? :D
Very nice work. If you want, you could take this further and tie everything together in a controller for this feature. I'll put a UI on it an we'll fire it up. If not- that's all right, I'll get to it eventually.
I think this thing would benefit both players and devs alike- players can easily exchange saves, while devs could ask for a save to reliably reproduce a problem with a mod.
Title: Re: [A17] HugsLib (3.1.0) Lightweight modding library
Post by: scuba156 on May 29, 2017, 02:42:36 PM
Quote from: UnlimitedHugs on May 29, 2017, 02:07:56 PM
Ask and ye shall receive, eh? :D
Very nice work. If you want, you could take this further and tie everything together in a controller for this feature. I'll put a UI on it an we'll fire it up. If not- that's all right, I'll get to it eventually.
I think this thing would benefit both players and devs alike- players can easily exchange saves, while devs could ask for a save to reliably reproduce a problem with a mod.
Only sometimes :p

I'm happy to do that, I think it would be useful to everyone, could put a check in on game load too. I'll start on it tomorrow as its 4:30am atm. Would you prefer a static class or create an instance when required? I think I might also be able to get the download status as a ulong, but I haven't tried that yet.
Title: Re: [A17] HugsLib (3.1.0) Lightweight modding library
Post by: UnlimitedHugs on May 29, 2017, 03:08:38 PM
Quote from: scuba156 on May 29, 2017, 02:42:36 PM
I'm happy to do that, I think it would be useful to everyone, could put a check in on game load too. I'll start on it tomorrow as its 4:30am atm. Would you prefer a static class or create an instance when required? I think I might also be able to get the download status as a ulong, but I haven't tried that yet.

There is no rush- I have plenty of other modding work to keep me occupied at the moment.
I would go for an instance- we can always stick it in a singleton if need be. Also, easier to run automated tests on.
Download status might be nice, but optional- mods are small, and we could fill a progress bar by simply counting them.
Title: Re: [A17] HugsLib (3.1.0) Lightweight modding library
Post by: scuba156 on May 30, 2017, 06:12:16 AM
Quote from: UnlimitedHugs on May 29, 2017, 03:08:38 PM
There is no rush- I have plenty of other modding work to keep me occupied at the moment.
I would go for an instance- we can always stick it in a singleton if need be. Also, easier to run automated tests on.
Download status might be nice, but optional- mods are small, and we could fill a progress bar by simply counting them.
Too late, I've already started :) It will probably be a week or two till I finish it and submit a pull request anyway.

I've done most of the important parts, and have a semi-working prototype. For whatever reason the callback isn't triggering atm, but it still subscribes to and downloads the mods. I might have to use a worker thread for it as each steamworks subscribe call locks the main thread for about half a second which quickly adds up. I agree about the download status, I've just added an int DownloadsRemaining property to get the progress for now.

I just had an thought, I wonder if it's possible to trigger steam to change to current RimWorld version. It might be possible to switch RimWorld versions between restarts, might need an external process to handle it though. Might be complicated but I might just have a look to see if its possible at some point.

I've never actually looked at the steamworks api before, it's quite interesting. It looks like it would be quite possible to have a mod that calculates a score based on survivors/days survived/faction relations/stockpile/etc and puts it on a leaderboard :D
Title: Re: [A17] HugsLib (3.1.0) Lightweight modding library
Post by: UnlimitedHugs on May 30, 2017, 10:42:26 AM
Quote from: scuba156 on May 30, 2017, 06:12:16 AM
Too late, I've already started :) It will probably be a week or two till I finish it and submit a pull request anyway.

I've done most of the important parts, and have a semi-working prototype. For whatever reason the callback isn't triggering atm, but it still subscribes to and downloads the mods. I might have to use a worker thread for it as each steamworks subscribe call locks the main thread for about half a second which quickly adds up. I agree about the download status, I've just added an int DownloadsRemaining property to get the progress for now.

I just had an thought, I wonder if it's possible to trigger steam to change to current RimWorld version. It might be possible to switch RimWorld versions between restarts, might need an external process to handle it though. Might be complicated but I might just have a look to see if its possible at some point.

I've never actually looked at the steamworks api before, it's quite interesting. It looks like it would be quite possible to have a mod that calculates a score based on survivors/days survived/faction relations/stockpile/etc and puts it on a leaderboard :D

To be frank, I'm having second thoughts about the mod downloading. It might be a better fit for a separate mod, seeing how non-steam players won't be able to take advantage of it.
How about we start with a basic mod config matcher for saves, and see where it goes from there. If mods are missing, it could give the player a list and offer to load anyway. We could include clickable links if it's a workshop mod.

Changing version sounds like a heap 'o trouble- even though I would appreciate that ability without the extra download in between. It's not something for the library, though.
Leaderboards are pretty neat- I also had a thought about making custom achievements for mods- which would be pretty cool, but Tynan would likely not be as enthusiastic about that :D

On a side note, I recall Zen saying something to the effect of workshop items being able to be downloaded without a Steam login. Sounds a bit shady, but might be interesting to investigate.
Title: Re: [A17] HugsLib (3.1.0) Lightweight modding library
Post by: scuba156 on May 30, 2017, 06:41:56 PM
Its up to you of course. I will continue as its something I can use and could put it in its own separate mod if that's what we decide. It is possible to check if steam is active via Verse.SteamManager.HasInit && IsActive. I've also fixed the performance issue. RimWorld already has callbacks which it was rebuilding the list of steam mods every time, can just use a harmony patch to stop the rebuild if the callback is intended for us.

I'll write up a mod config matcher, and build links for it. I agree about the version changer, I'll have a look at it though, If Its too trouble then I'm not going to bother but would be neat.
Achievements would be really cool actually, I don't think you can create official steam achievements through steamworks but everything else about them is there. Just add a button in settings that displays them like mod settings.

AFAIK it's not possible with RimWorld as Tynan has it turned off, unless Zen knows of a different way.
http://steamworkshopdownloader.com/view/818773962
Title: Re: [A17] HugsLib (3.1.0) Lightweight modding library
Post by: UnlimitedHugs on May 31, 2017, 01:23:15 PM
Quote from: scuba156 on May 30, 2017, 06:41:56 PM
Its up to you of course. I will continue as its something I can use and could put it in its own separate mod if that's what we decide. It is possible to check if steam is active via Verse.SteamManager.HasInit && IsActive. I've also fixed the performance issue. RimWorld already has callbacks which it was rebuilding the list of steam mods every time, can just use a harmony patch to stop the rebuild if the callback is intended for us.

I'll write up a mod config matcher, and build links for it. I agree about the version changer, I'll have a look at it though, If Its too trouble then I'm not going to bother but would be neat.
Achievements would be really cool actually, I don't think you can create official steam achievements through steamworks but everything else about them is there. Just add a button in settings that displays them like mod settings.

AFAIK it's not possible with RimWorld as Tynan has it turned off, unless Zen knows of a different way.
http://steamworkshopdownloader.com/view/818773962

Interesting, thank you for looking into all that.
An in-game achievement framework would be nice, and could even be synched with Steam cloud. Problem is that we don't really have that many beefy content mods for Rimworld yet that would leverage that system. Maybe sometime eventually.
A thought I had about the mod downloader: the matcher, once roller into HugsLib, could produce an event that the downloader mod would listen to- and rather than showing the missing mod list, the whole download sequence would happen. It's your project though, so I shouldn't poke my nose into it :)
Also, that link is a great find either way.
Title: Re: [A17] HugsLib (3.1.0) Lightweight modding library
Post by: scuba156 on May 31, 2017, 03:15:37 PM
Quote from: UnlimitedHugs on May 31, 2017, 01:23:15 PM
Interesting, thank you for looking into all that.
An in-game achievement framework would be nice, and could even be synched with Steam cloud. Problem is that we don't really have that many beefy content mods for Rimworld yet that would leverage that system. Maybe sometime eventually.
A thought I had about the mod downloader: the matcher, once roller into HugsLib, could produce an event that the downloader mod would listen to- and rather than showing the missing mod list, the whole download sequence would happen. It's your project though, so I shouldn't poke my nose into it :)
Also, that link is a great find either way.
I'm actually liking the achievement idea more and more, It might encourage some bigger mods, better custom scenarios/storytellers, some more content oriented mods rather than skins. It won't have a massive impact but more features available is always good. Could have a Def in the mod that defines the achievement details, and just have a method TriggerAchievement("nameofachievement").
I'll be writing a steam cloud sync manager soon anyway so I can always incorporate that into HugsLib once its finished, and use it for achievement sync.

Nice idea for the downloader, it should work nicely. The downloader will have Hugslib as a dependency anyway so it could use the trigger from there all the time. The downloader will have to have a restart function using Huglibs restarter anyway so I can pass any parameters to that. Always poke your nose in because it helps :)
Title: Re: [A17] HugsLib (3.1.0) Lightweight modding library
Post by: UnlimitedHugs on May 31, 2017, 04:11:42 PM
Quote from: scuba156 on May 31, 2017, 03:15:37 PM
I'm actually liking the achievement idea more and more, It might encourage some bigger mods, better custom scenarios/storytellers, some more content oriented mods rather than skins. It won't have a massive impact but more features available is always good. Could have a Def in the mod that defines the achievement details, and just have a method TriggerAchievement("nameofachievement").
I'll be writing a steam cloud sync manager soon anyway so I can always incorporate that into HugsLib once its finished, and use it for achievement sync.

Nice idea for the downloader, it should work nicely. The downloader will have Hugslib as a dependency anyway so it could use the trigger from there all the time. The downloader will have to have a restart function using Huglibs restarter anyway so I can pass any parameters to that. Always poke your nose in because it helps :)

I have to be careful what I say- I might accidentally commit to a few weeks of work here :D
Just so we're clear- we're just tossing ideas around.
I do like the idea of the achievements- I have a few things in the pipe that might benefit from them. They do need more interesting features than just showing popups with pictures, though. The biggest attraction of the Steam ones, I think, is the social factor- it's a great conversation starter. Also, a point of pride as you get to admire them in a gallery and be inspired to get the rest of them.
Title: Re: [A17] HugsLib (3.1.0) Lightweight modding library
Post by: scuba156 on June 01, 2017, 01:59:52 AM
Quote from: UnlimitedHugs on May 31, 2017, 04:11:42 PM
I have to be careful what I say- I might accidentally commit to a few weeks of work here :D
Just so we're clear- we're just tossing ideas around.
I do like the idea of the achievements- I have a few things in the pipe that might benefit from them. They do need more interesting features than just showing popups with pictures, though. The biggest attraction of the Steam ones, I think, is the social factor- it's a great conversation starter. Also, a point of pride as you get to admire them in a gallery and be inspired to get the rest of them.
Haha of course. Everything here can be used as a reference if we end up doing it.

Each achievement could have an image, a title, a short description, and a value. In Settings, have a button to show an achievement UI which has tabs at the top and a close button. The achievement pop up should have an onclick action to show the UI.
First tab can be overall progress which shows things like percentage of total achievements gained and other things for users to show off. Second Tab could be a list of all available achievements sorted by unlocked ones. Another tab could show achievements per mod, with a floatmenu button to swap between mods.

If the community got involved, could provide a service for people to display their progress in their ludeon forums signature.

Could give it a leaderboard to increase the social aspect of it. Might have to protect it with a maximum number of mods that can register per developer or something so someone doesn't just create a heap of mods to inflate their score.

Edit:*Ahem* (https://github.com/scuba156/RimworldHugsLib/tree/achievements) Can get an idea of what would be required and if it's better in a separate mod etc.
Title: Re: [A17] HugsLib (3.1.0) Lightweight modding library
Post by: scuba156 on June 01, 2017, 08:20:18 AM
I ended up getting a bit carried away... complete with an OnClick event, and even animation to make it scroll up from the bottom of the screen, wait for a few seconds and then scroll back down.

[attachment deleted by admin due to age]
Title: Re: [A17] HugsLib (3.1.0) Lightweight modding library
Post by: Love on June 01, 2017, 09:34:31 AM
I suggest incorporating this function into HugsLib

https://github.com/cuproPanda/STN/blob/master/Source/CuprosStones/PatchOperationFindMod.cs
Title: Re: [A17] HugsLib (3.1.0) Lightweight modding library
Post by: UnlimitedHugs on June 01, 2017, 10:06:54 AM
Quote from: scuba156 on June 01, 2017, 08:20:18 AM
I ended up getting a bit carried away... complete with an OnClick event, and even animation to make it scroll up from the bottom of the screen, wait for a few seconds and then scroll back down.

That looks pretty cool! I did wonder if achievements should give points- what would one unlock with them, though? Perhaps the the mods that make use of them could also provide some cosmetic unlocks, or something- like golden icons, reskinned things, cheat options, and the like.
A window that lists all achievements could also be used to unlock and toggle the rewards.

Quote from: Love on June 01, 2017, 09:34:31 AM
I suggest incorporating this function into HugsLib
https://github.com/cuproPanda/STN/blob/master/Source/CuprosStones/PatchOperationFindMod.cs

Could be useful, but I wouldn't rely on mod names too much- the author might add a version to the name, or something. It's generally more reliable to reflect the main class of the mod you're checking for, like so:
if(GenTypes.GetTypeInAnyAssembly("ModNamespace.ModController")!=null)
Title: Re: [A17] HugsLib (3.1.0) Lightweight modding library
Post by: scuba156 on June 01, 2017, 12:58:21 PM
Quote from: UnlimitedHugs on June 01, 2017, 10:06:54 AM
That looks pretty cool! I did wonder if achievements should give points- what would one unlock with them, though? Perhaps the the mods that make use of them could also provide some cosmetic unlocks, or something- like golden icons, reskinned things, cheat options, and the like.
A window that lists all achievements could also be used to unlock and toggle the rewards.
I attached a gif of the popup animating, hopefully it works.
Rewards would be pretty cool, maybe have point tiers that when reached would display a different coloured badge to show off (like bronze, silver, gold, diamond etc)

Edit: I've added an achievement def, here's an example (https://github.com/scuba156/RimworldHugsLib/blob/achievements/Mods/HugsLib/Defs/Achievements/achievements.xml), the test achievement can be triggered with       
Instance.Achievements.Trigger_AchievementEarned("Test");

[attachment deleted by admin due to age]
Title: Re: [A17] HugsLib (3.1.0) Lightweight modding library
Post by: scuba156 on June 02, 2017, 04:43:59 PM
I know you said we were just tossing around ideas but I've still being working on it. So far I've done:
The popup notification controller queues all notifications and only allows X amount of popups to be drawn at a time. The next queued popup will start to draw when another closes. Each popup is drawn at the first free position available vertically (if there are were 8 popups total, and the first 4 have closed, it will draw the next popup in place of the first closed popup instead of above the the popup). A popup will scroll all the way off screen before it closes. Its a bit buggy with drawing some popups on top of each other at the moment but it basically works.

The controller could be adapted to host a toast notification system if you like? It could allow mods to queue toast messages of their own, display messages/images/progress bars/buttons (anything a Window can draw) with an OnClick event and multiple styles like fade in/out or scroll in/out from any screen side. Sounds like it could be really useful, and most of the code is already there.
Title: Re: [A17] HugsLib (3.1.0) Lightweight modding library
Post by: UnlimitedHugs on June 02, 2017, 05:00:02 PM
Quote from: scuba156 on June 02, 2017, 04:43:59 PM
- snip -

Sounds like you're really getting into it :)
I probably won't be adding your version to the library, though, since I'm looking forward to working on it myself when the time comes. I'm still debating wether achievements should be part of the library in the first place- might be a better fit for a standalone library.
In any case, variety and options are always nice- so I hope my plans don't deter your enthusiasm. After all, it's about the process, not the result :P
Title: Re: [A17] HugsLib (3.1.0) Lightweight modding library
Post by: scuba156 on June 03, 2017, 02:58:18 AM
Quote from: UnlimitedHugs on June 02, 2017, 05:00:02 PM
Sounds like you're really getting into it :)
I probably won't be adding your version to the library, though, since I'm looking forward to working on it myself when the time comes. I'm still debating wether achievements should be part of the library in the first place- might be a better fit for a standalone library.
In any case, variety and options are always nice- so I hope my plans don't deter your enthusiasm. After all, it's about the process, not the result :P
It does deter me from continuing with achievements as I don't think 2 different standards would be healthy but its not a bad thing at all, as there is now a code reference and I've learnt a lot (I now know how to write harmony transpilers which I'll need for the steam downloads) and I've decided to continue with the Toast Message controller in a seperate mod. You can always use the toast messages to display achievements. I do think that achievements should be in a separate mod
Title: Re: [A17] HugsLib (3.1.0) Lightweight modding library
Post by: UnlimitedHugs on June 03, 2017, 02:30:25 PM
Quote from: scuba156 on June 03, 2017, 02:58:18 AM
It does deter me from continuing with achievements as I don't think 2 different standards would be healthy but its not a bad thing at all, as there is now a code reference and I've learnt a lot (I now know how to write harmony transpilers which I'll need for the steam downloads) and I've decided to continue with the Toast Message controller in a seperate mod. You can always use the toast messages to display achievements. I do think that achievements should be in a separate mod

I see. Well, whatever you enjoy working on most- at least that's how I pick my battles.
As for the separate mod, my idea was to make it a Harmony-style library: include your own copy, but only the most recent version will do the GUI work. This wouldn't fly for HugsLib, as it's way too complex, but with a small feature set it's quite viable.
Also, yay for transpiler. Those things are so much fun!
Title: Re: [A17] HugsLib (3.1.0) Lightweight modding library
Post by: ChairmanPoo on June 03, 2017, 03:20:16 PM
Hello, I'm getting this bug at worldgen. I'm seeing mentions to Harmony in it. I assume it's related?


Exception from asynchronous event: System.TypeInitializationException: An exception was thrown by the type initializer for CompVehicle.HarmonyCompPilotable ---> System.ArgumentNullException: Argument cannot be null.
Parameter name: key
  at System.Collections.Generic.Dictionary`2[System.Reflection.MethodBase,System.Byte[]].TryGetValue (System.Reflection.MethodBase key, System.Byte[]& value) [0x00000] in <filename unknown>:0
  at Harmony.GeneralExtensions.GetValueSafe[MethodBase,Byte[]] (System.Collections.Generic.Dictionary`2 dictionary, System.Reflection.MethodBase key) [0x00000] in <filename unknown>:0
  at Harmony.HarmonySharedState.GetPatchInfo (System.Reflection.MethodBase method) [0x00000] in <filename unknown>:0
  at Harmony.PatchProcessor.Patch () [0x00000] in <filename unknown>:0
  at Harmony.HarmonyInstance.Patch (System.Reflection.MethodBase original, Harmony.HarmonyMethod prefix, Harmony.HarmonyMethod postfix, Harmony.HarmonyMethod transpiler) [0x00000] in <filename unknown>:0
  at CompVehicle.HarmonyCompPilotable..cctor () [0x00000] in <filename unknown>:0
  --- End of inner exception stack trace ---
  at (wrapper managed-to-native) System.Runtime.CompilerServices.RuntimeHelpers:RunClassConstructor (intptr)
  at System.Runtime.CompilerServices.RuntimeHelpers.RunClassConstructor (RuntimeTypeHandle type) [0x00000] in <filename unknown>:0
  at Verse.StaticConstructorOnStartupUtility.CallAll () [0x00000] in <filename unknown>:0
  at Verse.PlayDataLoader.<DoPlayLoad>m__80F () [0x00000] in <filename unknown>:0
  at Verse.LongEventHandler.ExecuteToExecuteWhenFinished () [0x00000] in <filename unknown>:0
Verse.Log:Error(String)
Verse.LongEventHandler:RunEventFromAnotherThread(Action)
Verse.LongEventHandler:<UpdateCurrentAsynchronousEvent>m__84C()

Title: Re: [A17] HugsLib (3.1.0) Lightweight modding library
Post by: UnlimitedHugs on June 03, 2017, 03:38:36 PM
Quote from: ChairmanPoo on June 03, 2017, 03:20:16 PM
Hello, I'm getting this bug at worldgen. I'm seeing mentions to Harmony in it. I assume it's related?

Heyo. I think this is caused by Jec's tools. Seems the author has already been notified.
This comment thread (https://steamcommunity.com/sharedfiles/filedetails/?id=932008009) will probably be updated once a fix is out.
Title: Re: [A17] HugsLib (3.1.0) Lightweight modding library
Post by: Nqshou on June 04, 2017, 07:53:14 AM
Hello,

Is HugsLib updated for A17b?

Many thanks.
Title: Re: [A17] HugsLib (3.1.0) Lightweight modding library
Post by: Stormfox on June 04, 2017, 10:23:04 AM
Btw, I get a harmony.log.txt on my desktop every time I start rimworld. I guess for some reason harmony cannot find the correct directory to place that logfile in? I reinstalled the newest HugsLib, did not help. Its only a minor annoyance, but it would be nifty if this disappeared sometime in the future.
Title: Re: [A17] HugsLib (3.1.0) Lightweight modding library
Post by: UnlimitedHugs on June 04, 2017, 11:34:04 AM
Quote from: Nqshou on June 04, 2017, 07:53:14 AM
Hello, Is HugsLib updated for A17b?
Many thanks.

I've seen no conflicts or other problems since the update.
You should be fine using the same version of HugsLib.

Quote from: Stormfox on June 04, 2017, 10:23:04 AM
Btw, I get a harmony.log.txt on my desktop every time I start rimworld. I guess for some reason harmony cannot find the correct directory to place that logfile in? I reinstalled the newest HugsLib, did not help. Its only a minor annoyance, but it would be nifty if this disappeared sometime in the future.

It should be on the desktop- one of your mods forgot to turn off debug mode for Harmony. No easy way to find out which one, though.
I'll poke pardeike to add the id of the mod to the log file, but for now looks like you're on recycle bin duty.
Title: Re: [A17] HugsLib (3.1.0) Lightweight modding library
Post by: Wishmaster on June 04, 2017, 04:15:56 PM
Hello again.
I would to save something I similar to World data storage object but I want it to be persistent, like mod settings.

I can easily save those settings by using ExposeData() but SettingHandleConvertible does not provide such a feature.
I want to save a list of objects that have their ExposeData() method.
Perhaps I could convert them to a string (and then use SettingHandleConvertible) but that does not seem to be the best way I think.

(those objects are food policies, similar to drug policies).

Do you recommend something ?
Title: Re: [A17] HugsLib (3.1.0) Lightweight modding library
Post by: UnlimitedHugs on June 05, 2017, 10:19:33 AM
Quote from: Wishmaster on June 04, 2017, 04:15:56 PM
Do you recommend something ?

I would probably store them in a SettingHandleConvertible and pack/unpack them using DirectXmlSaver and DirectXmlToObject.
Since your objects need to be IExposable, I assume they are also stored in the save file- in which case I would just store their ids and resolve the references at load time. This may or may not be applicable in your case, though.
Title: Re: [A17] HugsLib (3.1.0) Lightweight modding library
Post by: Wishmaster on June 05, 2017, 02:23:46 PM
Quote from: UnlimitedHugs on June 05, 2017, 10:19:33 AM
Quote from: Wishmaster on June 04, 2017, 04:15:56 PM
Do you recommend something ?

I would probably store them in a SettingHandleConvertible and pack/unpack them using DirectXmlSaver and DirectXmlToObject.
Since your objects need to be IExposable, I assume they are also stored in the save file- in which case I would just store their ids and resolve the references at load time. This may or may not be applicable in your case, though.

I wanted to store something persistent like settings but do it easily using IExpose.
But know I guess I have to do direct xml conversion.
Title: Re: [A17] HugsLib (3.1.0) Lightweight modding library
Post by: scuba156 on June 09, 2017, 11:01:04 AM
Hey I haven't forgotten about hugslib or the the active mod checker, I've had a few other mods to work on for a bit, still have a few more in progress :-X
But I've been thinking of the best way to check for active/missing mods might be to do something similar to HugsLibChecker, a replacement basically.  It would be a completely separate mod without a hugslib dependency.

A mod can add a dependencies.xml file similar to version.xml which lists any other mods by name/steam id (might even be able to do a steam lookup) that it depends on. It would harmony patch the mod loading and/or saved game loading sequence, check for any missing dependencies, compile a list of whats not active/installed and display a prompt similar to HugsLibChecker with the list of links for missing mods and an activate/restart button.

I'm thinking this way because I have mods that have dependencies on another core mod of mine, and I need to make sure it is active, so it would be better to have something universal rather than a library per dependency. By patching both the mod loading and save game loading, it should suit the purpose of checking mods with the quickstarter but also checking mod dependencies all in one swift kick.
Title: Re: [A17] HugsLib (3.1.0) Lightweight modding library
Post by: UnlimitedHugs on June 09, 2017, 07:23:02 PM
Quote from: scuba156 on June 09, 2017, 11:01:04 AM
- snip -

That sounds quite handy. I might drop my checker for that, once it's stable.
Being a separate mod, you could make the additions you like without anyone poking at your ideas ;)
If it does become a thing, I would include a mechanism that runs only the latest version of this checker of all those available among the loaded mods- that way it will be easy to make updates and fix things.
Title: Re: [A17] HugsLib (3.1.0) Lightweight modding library
Post by: Fregrant on June 12, 2017, 03:49:48 PM
"Share logs" not working. Was it moved elsewhere?

[HugsLib][ERR] Exception during PrepareLogData: System.IO.FileNotFoundException: Log file not found:C:/Games/RimWorld/RimWorldWin_Data\output_log.txt
Title: Re: [A17] HugsLib (3.1.0) Lightweight modding library
Post by: UnlimitedHugs on June 12, 2017, 04:27:49 PM
Quote from: Fregrant on June 12, 2017, 03:49:48 PM
"Share logs" not working. Was it moved elsewhere?

This is quite odd. Are you playing on Windows? What are your command line options?
Title: Re: [A17] HugsLib (3.1.0) Lightweight modding library
Post by: Fregrant on June 13, 2017, 03:40:15 AM
Not sure. Maybe it was deleted by a cleaner tool)
Title: Re: [A17] HugsLib (3.1.0) Lightweight modding library
Post by: scuba156 on June 13, 2017, 04:20:35 AM
Quote from: UnlimitedHugs on June 09, 2017, 07:23:02 PM
That sounds quite handy. I might drop my checker for that, once it's stable.
Being a separate mod, you could make the additions you like without anyone poking at your ideas ;)
If it does become a thing, I would include a mechanism that runs only the latest version of this checker of all those available among the loaded mods- that way it will be easy to make updates and fix things.
I'll let you know when its ready, I don't know when it will be though. I have 3-4 projects going atm, I seem to be more efficient working on multiple than one as I switch between them when I feel like doing another.
Haha Ideas are always welcome, and that actually is a good idea. I'm not sure how I'll only execute from the latest assembly yet, have to think about how best to achieve it without slowing down start times too much.
Off the top of my head I'll probably just hold a variable of an assembly somewhere and compare versions to each assembly init, then execute on that assembly.

Quote from: Fregrant on June 12, 2017, 03:49:48 PM
"Share logs" not working. Was it moved elsewhere?

[HugsLib][ERR] Exception during PrepareLogData: System.IO.FileNotFoundException: Log file not found:C:/Games/RimWorld/RimWorldWin_Data\output_log.txt
Also check you have write permissions in that folder.
Title: Re: [A17] HugsLib (3.1.1) Lightweight modding library
Post by: UnlimitedHugs on June 13, 2017, 12:48:49 PM
Updated to 3.1.1

- Added a ModBase callback for the recent MapGenerated (https://github.com/UnlimitedHugs/RimworldHugsLib/wiki/ModBase-Reference#mapgenerated) event.
- Added a fix for the log uploader when running in low integrity mode. Contributed by debugzxcv.
- Merged translation updates by PelucheKawaii, 53N4, and dragomano.
Title: Re: [A17] HugsLib (3.1.0) Lightweight modding library
Post by: UnlimitedHugs on June 13, 2017, 12:55:29 PM
Quote from: scuba156 on June 13, 2017, 04:20:35 AM
- snip -

Multiple projects are great for keeping your creative flow up. The non-profit nature of the projects is also a nice boost, I find.
As for executing only the latest version, that's what I do in the checker- just compare versions against all other matching assemblies, then execute and leave behind a GameObject that prevents multiple executions.
Title: Re: [A17] HugsLib (3.1.0) Lightweight modding library
Post by: scuba156 on June 13, 2017, 01:49:22 PM
Quote from: UnlimitedHugs on June 13, 2017, 12:55:29 PM
-snip-
I should of looked at that before I started haha. I've got it finding the latest assembly, and executing it directly but unloading all the other assemblies will add a bit of bulk so I might just "borrow" your code for holding a GameObject if you don't mind of course.
Title: Re: [A17] HugsLib (3.1.0) Lightweight modding library
Post by: UnlimitedHugs on June 13, 2017, 01:56:53 PM
Quote from: scuba156 on June 13, 2017, 01:49:22 PM
I should of looked at that before I started haha. I've got it finding the latest assembly, and executing it directly but unloading all the other assemblies will add a bit of bulk so I might just "borrow" your code for holding a GameObject if you don't mind of course.

By all means. Everything is always up for grabs.
Title: Re: [A17] HugsLib (3.1.0) Lightweight modding library
Post by: scuba156 on June 13, 2017, 02:37:37 PM
Quote from: UnlimitedHugs on June 13, 2017, 01:56:53 PM
By all means. Everything is always up for grabs.
Thank you. I might end up using a large portion of it and adapting it to what I need.
Title: Re: [A17] HugsLib (3.1.1) Lightweight modding library
Post by: scuba156 on June 15, 2017, 04:16:22 PM
I've got some base code down and can find and store the latest assembly of my mod within a GameObject component and execute on the latest assembly. I also store the mod Identifier for each mod with an assembly in the same way. It should be enough information stored to allow future updates with as much compatibility as possible I think. I need to get this part correct from the start for maximum compatibility.

The ability to easily store data within a GameObject could go in HugsLib too if your interested in that feature. The code is only 2-3 files, should come under 100 lines when I finish it, and can store any data type. It would allow mods to easily store/retrieve data across different mods, instances of a mod, or even just a single instance. The code might even be useful for achievements somehow.
Title: Re: [A17] HugsLib (3.1.1) Lightweight modding library
Post by: UnlimitedHugs on June 15, 2017, 06:04:20 PM
Quote from: scuba156 on June 15, 2017, 04:16:22 PM
- snip -

GO's have somewhat limited utility in Rimworld- but they're easy to make if a mod needs them. They are quite handy as an event provider- but even that almost falls into the "meh" category, now that we have patches. So, not really worth adding to the library, methinks.
Title: Re: [A17] HugsLib (3.1.1) Lightweight modding library
Post by: scuba156 on June 19, 2017, 06:35:58 AM
Quote from: UnlimitedHugs on June 15, 2017, 06:04:20 PM
GO's have somewhat limited utility in Rimworld- but they're easy to make if a mod needs them. They are quite handy as an event provider- but even that almost falls into the "meh" category, now that we have patches. So, not really worth adding to the library, methinks.
I shouldn't post ideas at 6am :)

I dropped my laptop on a hard floor the other day, killed the windows install, luckily my data was safe but I'm still reinstalling everything. I only had to finish up the UI and some more work on the missing/inactive/outdated mods parsing and it should be done. I've got a few projects waiting on it.
Title: Re: [A17] HugsLib (3.1.1) Lightweight modding library
Post by: Nok_ on June 23, 2017, 09:55:26 PM
I'm getting an error wherein the share log function can't find the logs file. [HugsLib][ERR] Exception during PrepareLogData: System.IO.FileNotFoundException: Log file not found:~/Library/Logs/Unity/Player.log

I'm on a mac, if that makes a difference.

Edit: And I have also made sure that I have read/write permissions on the file and folder.
Title: Re: [A17] HugsLib (3.1.1) Lightweight modding library
Post by: UnlimitedHugs on June 23, 2017, 11:03:18 PM
Quote from: Nok_ on June 23, 2017, 09:55:26 PM
I'm getting an error wherein the share log function can't find the logs file. [HugsLib][ERR] Exception during PrepareLogData: System.IO.FileNotFoundException: Log file not found:~/Library/Logs/Unity/Player.log
I'm on a mac, if that makes a difference.

Unfortunately I don't have the required fruity hardware to diagnose this one. Perhaps scuba156 can chime in on this.
Title: Re: [A17] HugsLib (3.1.1) Lightweight modding library
Post by: scuba156 on June 24, 2017, 03:41:52 AM
Confirmed FileNotFoundException when uploading or opening the log on OS X. Currently my dev Windows and OSX install are on the same machine and VS17 for Mac isn't playing nice with dotNet 3.5. I'll have to remote into my other pc, install Visual Studio, build the source and copy to my fruity hardware to test  :'( I'll make a pull request when I fix it.

Edit: Pull request created (https://github.com/UnlimitedHugs/RimworldHugsLib/pull/34) and tested :)
Title: Re: [A17] HugsLib (3.1.2) Lightweight modding library
Post by: UnlimitedHugs on June 24, 2017, 10:40:40 PM
Updated to 3.1.2

The log uploader should now properly find the log file when running on OSX.
Also, this includes the French translation kindly contributed by Kaptain Kavern.

@scuba156
That was quick- thank you for looking into this :)
Title: Re: [A17] HugsLib (3.1.2) Lightweight modding library
Post by: scuba156 on June 26, 2017, 05:15:30 AM
Lucky I did it quick as my macbook hard drive died on me so its out of action until I can afford a new one :/
Title: Re: [A17] HugsLib (3.1.2) Lightweight modding library
Post by: Ser Kitteh on July 07, 2017, 09:55:57 PM
Uh yeah, I've an issue?

I usually download all the mods from the forums. So I'm downloading HugsLibs but both the Master version and the 3.1.2 version are marked reddish in the mod list. Am I doing something wrong here? Can't use Psychology and Hospitality without it.
Title: Re: [A17] HugsLib (3.1.2) Lightweight modding library
Post by: UnlimitedHugs on July 08, 2017, 11:29:27 AM
Quote from: Ser Kitteh on July 07, 2017, 09:55:57 PM
So I'm downloading HugsLibs but both the Master version and the 3.1.2 version are marked reddish in the mod list. Am I doing something wrong here? Can't use Psychology and Hospitality without it.

Only reason I can think of is you're running A16- you can check your version in the upper left corner of the screen when you start the game. If so, there is a link to the latest version for A16 in the main post.
Title: Re: [A17] HugsLib (3.1.2) Lightweight modding library
Post by: scuba156 on July 13, 2017, 03:57:28 PM
I've still been working on the dependency checker, slowly but surely. If you're still interested in it replacing HugsLibChecker, I would appreciate feedback on the UI (https://ludeon.com/forums/index.php?topic=34379.0) as I'm having a little bit of trouble with it.

I've only got that UI issue and a few things to sort out with determining issues and it should be done. I've tried to keep the dll as small as possible, it's currently 28kb with translation files embedded and hugslib version file support, I could get it slightly smaller with a code cleanup.
Title: Re: [A17] HugsLib (3.1.2) Lightweight modding library
Post by: UnlimitedHugs on July 14, 2017, 12:32:55 PM
Quote from: scuba156 on July 13, 2017, 03:57:28 PM
I've still been working on the dependency checker, slowly but surely. If you're still interested in it replacing HugsLibChecker, I would appreciate feedback on the UI (https://ludeon.com/forums/index.php?topic=34379.0) as I'm having a little bit of trouble with it.

Looks like you really went all out- even a config editor and everything :)
I'll probably use it for my own mods, but the required configuration is always a bit of a barrier for potential adopters.
Replied with some ideas in the thread.
Title: Re: [A17] HugsLib (3.1.2) Lightweight modding library
Post by: scuba156 on July 15, 2017, 06:18:33 AM
Quote from: UnlimitedHugs on July 14, 2017, 12:32:55 PM
Looks like you really went all out- even a config editor and everything :)
I'll probably use it for my own mods, but the required configuration is always a bit of a barrier for potential adopters.
Replied with some ideas in the thread.
Thanks for replying with ideas, it helps a lot to bounce ideas.

The configuration is the biggest hurdle. I've tried to make it as easy as I can to set up. The windows app will have a button to add HugsLib and other common dependencies to a config file in one click. A basic config file can be shared as well.

I have thought about going through the loaded assemblies, see what libraries they reference and seeing if they are loaded without the need for a config file but I think that would be a bit slow and add too much time to RimWorlds start up time, especially for older machines.
Title: Re: [A17] HugsLib (3.1.2) Lightweight modding library
Post by: UnlimitedHugs on July 15, 2017, 06:14:16 PM
Quote from: scuba156 on July 15, 2017, 06:18:33 AM
I have thought about going through the loaded assemblies, see what libraries they reference and seeing if they are loaded without the need for a config file but I think that would be a bit slow and add too much time to RimWorlds start up time, especially for older machines.

Could work, though if it were up to me, I would include the config tool right in the game. If started without a config file, it could give the user a popup, where they can select their dependencies among the available mods. The choices are then written to the file and read on following runs.
It's extra GUI work, but having to only drop a single dll file into your project is a solid selling point.
Title: Re: [A17] HugsLib (3.1.2) Lightweight modding library
Post by: AngleWyrm on July 16, 2017, 03:32:57 AM
Quote from: scuba156 on July 15, 2017, 06:45:47 AM
Quote from: AngleWyrm on July 15, 2017, 03:22:58 AM
What if I (the user) can't or won't change the status of a given issue? Will this become an extra pop-up box that I'll have to close every time I start the game?

Yes, but the only issues it detects are missing or incorrect dependencies. If the issue isn't fixed then the mod in question won't work correctly, or most likely won't work at all.

A good place to put this problem finder could be as a diagnosis/help button on the error-log window.
Title: Re: [A17] HugsLib (3.1.2) Lightweight modding library
Post by: faltonico on July 26, 2017, 10:16:39 PM
Hi there!
Can you please add a "Force reload" feature?
For when you modify a mod with a game running and don't want to restart the whole game. Or is that already possible to do?
Thank you in advance!
Title: Re: [A17] HugsLib (3.1.2) Lightweight modding library
Post by: UnlimitedHugs on July 27, 2017, 11:51:52 AM
Quote from: faltonico on July 26, 2017, 10:16:39 PM
Hi there!
Can you please add a "Force reload" feature?

Hey. I could make the game reload all defs and load any added mods- but mods can't really be unloaded once they're running, and reloading defs breaks at least half of the dll mods out there.
I could add this as a dev feature, but I'm wondering if it's more trouble than it's worth at this point. The mandatory restart is a good thing- it reduces complexity for mod developers and the number of bugs players have to deal with.
Title: Re: [A17] HugsLib (3.1.2) Lightweight modding library
Post by: SpaceDorf on July 27, 2017, 11:57:38 AM
We could always use less mods ..

well you could ..

try
Title: Re: [A17] HugsLib (3.1.2) Lightweight modding library
Post by: UnlimitedHugs on July 27, 2017, 01:15:12 PM
Quote from: SpaceDorf on July 27, 2017, 11:57:38 AM
We could always use less mods ..
well you could ..
try

Blasphemy!
Title: Re: [A17] HugsLib (3.1.2) Lightweight modding library
Post by: maculator on September 02, 2017, 06:53:13 AM
If anybody thought: "Verdammt, ich wünschte die paar Zeilen Sprache die HugsLib liefert wären in Deutsch!"
I made a German.xml for personal use but maybe someone else can make a use of it too.
https://github.com/maculator/Alles
Title: Re: [A17] HugsLib (3.1.2) Lightweight modding library
Post by: UnlimitedHugs on September 02, 2017, 07:18:59 AM
Quote from: maculator on September 02, 2017, 06:53:13 AM
If anybody thought: "Verdammt, ich wünschte die paar Zeilen Sprache die HugsLib liefert wären in Deutsch!"
I made a German.xml for personal use but maybe someone else can make a use of it too.
https://github.com/maculator/Alles

I could include this in the next update if you want to send me a pull request.
Title: Re: [A17] HugsLib (3.1.2) Lightweight modding library
Post by: maculator on September 02, 2017, 10:24:45 AM
I "guess" I did a pull request (I'm not familiar with github, hope it worked.
Title: Re: [A17] HugsLib (3.1.2) Lightweight modding library
Post by: SpaceDorf on October 05, 2017, 07:48:27 AM
A advanced user question :

Is it possible to use Custom Scenarios for the Quickstart Option ?

I can only see the basic three, even though I created several custom scenarios now.
Title: Re: [A17] HugsLib (3.1.2) Lightweight modding library
Post by: UnlimitedHugs on October 06, 2017, 04:37:40 AM
Quote from: SpaceDorf on October 05, 2017, 07:48:27 AM
Is it possible to use Custom Scenarios for the Quickstart Option ?
I can only see the basic three, even though I created several custom scenarios now.

Turns out, the quickstarter only considers scenarios loaded from XML defs at the moment.
I'll see if I can enable custom and workshop scenarios, as well.
Thank you for letting me know.
Title: Re: [A17] HugsLib (3.1.2) Lightweight modding library
Post by: SpaceDorf on October 06, 2017, 04:58:20 AM
Quote from: UnlimitedHugs on October 06, 2017, 04:37:40 AM
Turns out, the quickstarter only considers scenarios loaded from XML defs at the moment.
I'll see if I can enable custom and workshop scenarios, as well.
Thank you for letting me know.

My pleasure. It would make testing a lot easier, if I can start with everything I need allready enabled and dropped at my feet.

Thats would be very efficient and stands in no correlation to me being lazy.
Soooo .. whats the name of the Defs ? ;D
Title: Re: [A17] HugsLib (3.1.2) Lightweight modding library
Post by: UnlimitedHugs on October 06, 2017, 05:10:43 AM
Quote from: SpaceDorf on October 06, 2017, 04:58:20 AM
Thats would be very efficient and stands in no correlation to me being lazy.
Soooo .. whats the name of the Defs ? ;D

I wear my laziness as a badge of honor- it's a sign of professionalism :D
As for the defs, check out Core/Defs/Scenarios/Scenarios_Classic.xml- you should be able to turn your custom scenario into a def by copying it from your save folder. It's mostly the same format.
Title: Re: [A17] HugsLib (3.1.2) Lightweight modding library
Post by: SpaceDorf on October 06, 2017, 05:30:25 AM
Quote from: UnlimitedHugs on October 06, 2017, 05:10:43 AM
I wear my laziness as a badge of honor- it's a sign of professionalism :D
As for the defs, check out Core/Defs/Scenarios/Scenarios_Classic.xml- you should be able to turn your custom scenario into a def by copying it from your save folder. It's mostly the same format.

I was counting on that :) Thank you.
Title: Re: [A17] HugsLib (3.1.2) Lightweight modding library
Post by: vaultdweller123 on October 21, 2017, 01:42:23 AM
can someone explain me what this mod do? im new to installing mods. but this is the 2nd to the most subscribed list. im not sure what this does.
Title: Re: [A17] HugsLib (3.1.2) Lightweight modding library
Post by: tonsrd on October 21, 2017, 02:18:46 AM
Quote from: vaultdweller123 on October 21, 2017, 01:42:23 AM
can someone explain me what this mod do? im new to installing mods. but this is the 2nd to the most subscribed list. im not sure what this does.
its a library mod, other mods need it.
place it 2nd in modlist  just aftere "core" and any mod that needs it will work.

place it last and ull get errors/crashs maybe...
Title: Re: [A17] HugsLib (3.1.2) Lightweight modding library
Post by: Wishmaster on October 24, 2017, 12:18:21 PM
Hello.
Are you updating this to A18 ?
Title: Re: [A17] HugsLib (3.1.2) Lightweight modding library
Post by: UnlimitedHugs on October 24, 2017, 07:38:18 PM
Quote from: Wishmaster on October 24, 2017, 12:18:21 PM
Hello.
Are you updating this to A18 ?

For sure. I should have a build out in the next few days.
Title: Re: [A17] HugsLib (3.1.2) Lightweight modding library
Post by: Wishmaster on October 25, 2017, 07:22:21 AM
Can't wait !
Title: Re: [A18U] HugsLib (4.0.0) Lightweight modding library
Post by: UnlimitedHugs on October 26, 2017, 05:51:05 AM
Updated to 4.0.0
There we go, the A18 update is done. This one was fairly mild, since not a lot has really changed in the base game.
- I reworked the DistributedTickScheduler and CallbackScheduler (now TickDelayScheduler). Both have been made safer and more convenient to use. I plan to add a wiki page on custom tick scheduling in the coming days.
- Made a spelling pass on the code. The only public member to change is InjectedDefHasher.GiveShortHasToDef > GiveShortHashToDef
- The quickstarter will now work with custom and workshop scenarios.

I uploaded this version to the workshop (http://steamcommunity.com/sharedfiles/filedetails/?id=1181070440) as a temporary item- It'll be up until A18 officially releases.

As always, let me know if you find any bugs or have any suggestions.
Have a nice update!
Title: Re: [A18U] HugsLib (4.0.0) Lightweight modding library
Post by: SpaceDorf on October 26, 2017, 09:21:37 AM
A18 .. prepare to be modded ..
Title: Re: [A18U] HugsLib (4.0.0) Lightweight modding library
Post by: kaptain_kavern on October 26, 2017, 01:23:02 PM
Ok now I can begin A18 mods updates and dev.

Thanks a ton !
Title: Re: [A18U] HugsLib (4.0.0) Lightweight modding library
Post by: Belgrath on October 28, 2017, 04:16:05 AM
Sweet A18 Work already.
Thanks for the great work!
Title: Re: [A18U] HugsLib (4.0.0) Lightweight modding library
Post by: Fluffy (l2032) on October 29, 2017, 12:54:57 PM
thanks a bunch! The quick restart is an absolute godsend when modding
Title: Re: [A18U] HugsLib (4.0.0) Lightweight modding library
Post by: Fluffy (l2032) on October 29, 2017, 01:26:45 PM
although, there seems to be something odd going on; restarting with the keybinding either doesn't close the current RW, or opens two sessions of RW. Whenever I restart, an extra RW opens up.
Title: Re: [A18U] HugsLib (4.0.0) Lightweight modding library
Post by: UnlimitedHugs on October 30, 2017, 12:52:34 AM
Quote from: Fluffy (l2032) on October 29, 2017, 01:26:45 PM
although, there seems to be something odd going on; restarting with the keybinding either doesn't close the current RW, or opens two sessions of RW. Whenever I restart, an extra RW opens up.

Hm, seems to work fine on my end.
1) Does it also happen when restarting after a mod config change?
2) Did you have the same issue on the A17 build?
3) Are you running through steam, of standalone?
4) Are you running on Linux?
Title: Re: [A18U] HugsLib (4.0.0) Lightweight modding library
Post by: Fluffy (l2032) on October 30, 2017, 10:03:11 AM
1) no
2) no
3) steam (but directly calling the exe)
4) no (win10 education, which afaik is basically enterprise)
Title: Re: [A18U] HugsLib (4.0.0) Lightweight modding library
Post by: UnlimitedHugs on October 30, 2017, 10:28:30 AM
Quote from: Fluffy (l2032) on October 30, 2017, 10:03:11 AM
1) no
2) no
3) steam (but directly calling the exe)
4) no (win10 education, which afaik is basically enterprise)

Well, I'm drawing a blank. Both make the same call, and that part has not changed during the update.
Since I'm on Win7, I can't duplicate that either.
I'll try something the next time I update, maybe it'll help.
Title: Re: [A18U] HugsLib (4.0.1) Lightweight modding library
Post by: UnlimitedHugs on November 01, 2017, 04:29:21 AM
Updated to 4.0.1
Minor maintenance release to optimize the revamped DistributedTickScheduler a bit.
Also includes an experimental fix for the restart hotkey issue.

As promised, I published a new page on the wiki about the new tick scheduling tools: Custom Tick Scheduling (https://github.com/UnlimitedHugs/RimworldHugsLib/wiki/Custom-Tick-Scheduling) NEW
Title: Re: [A18] HugsLib (4.0.1) Lightweight modding library
Post by: UnlimitedHugs on November 03, 2017, 08:40:58 AM
I have updated HugsLibChecker for A18, as well.
Looks like mod assemblies are no longer loaded in the main thread, which was causing the included Unity calls to raise an exception. I replaced them with a reflection-based approach, which should fix the issue.
Title: Re: [B18] HugsLib (4.0.1) Lightweight modding library
Post by: Monzer on November 24, 2017, 06:55:07 PM
I'm on 0.18.1722 and getting an error .
Title: Re: [B18] HugsLib (4.0.1) Lightweight modding library
Post by: UnlimitedHugs on November 24, 2017, 08:38:03 PM
Quote from: Monzer on November 24, 2017, 06:55:07 PM
I'm on 0.18.1722 and getting an error .

Press Ctrl+F12 after you see the error and post the link- I'll take a look.
Title: Re: [B18] HugsLib (4.0.1) Lightweight modding library
Post by: Rock5 on December 01, 2017, 02:00:02 AM
I got some questions about the update news feature.

1. To set it up I only need to extends ModBase and overrides the ModIdentifier, and add the UpdateFeatures.xml file? Nothing else?

2. When specifying the version for the news item do I use the current version or the version it's updating from? Example: say my first version is version 1 and my new version is version 2 and I want to add a news update about the changes, do I use version 2 to indicate the version at which it should display the news update or do I use version 1 to indicate the version you update from?

3. Is 4 part version numbers supported?

4. Does version update work only with steam or does it also work with manual downloads?

5. Is there a way to test the update news feature before uploading to steam?

Thank you in advance.
Title: Re: [B18] HugsLib (4.0.1) Lightweight modding library
Post by: UnlimitedHugs on December 01, 2017, 02:40:00 AM
Quote from: Rock5 on December 01, 2017, 02:00:02 AM
I got some questions about the update news feature.

1. Correct. You will also need to increment the version of your assembly or use the Version.xml file.
2. You would specify version 2 in the news item. When you will eventually update to version 3, and make a news item for that, a player who has not seen the v2 news yet will be shown both the v2 and the v3 news items.
3. Currently, only 3-part version numbers are supported.
4. Since the feature is not related to any Steam functionality, news will trigger on both Steam and standalone games.
5. You can inspect all news items using a button in the Mod Options dialog. To test it in action, you can modify or delete the HugsLib/LastSeenNews.xml file in your save folder.
Title: Re: [B18] HugsLib (4.0.1) Lightweight modding library
Post by: Rock5 on December 01, 2017, 03:22:42 AM
Thanks for the very clear and helpful answers. I'm still having problems getting it to work so it would be nice to find that LastSeenNews.xml file. I can't find it though.

Also, if my previous version has a 4 part version number will that mean I can't make the current version show the news update? Can I use the version.xml file to force it to show perhaps?

Edit: Never mind about LastSeenNews.xml. I found it in the user account AppData sub folder. My mod wasn't listed yet.
Title: Re: [B18] HugsLib (4.0.1) Lightweight modding library
Post by: UnlimitedHugs on December 01, 2017, 03:34:21 AM
Quote from: Rock5 on December 01, 2017, 03:22:42 AM
Also, if my previous version has a 4 part version number will that mean I can't make the current version show the news update? Can I use the version.xml file to force it to show perhaps?
Edit: Never mind about LastSeenNews.xml. I found it in the user account AppData sub folder. My mod wasn't listed yet.

The 4th part of the version number is simply not considered. I may change that in the future.
Are you specifying the same mod identifier in the Def, as you used in the mod assembly?
For extra reference, here's the news file used by Allow Tool (https://github.com/UnlimitedHugs/RimworldAllowTool/blob/master/Mods/AllowTool/Defs/UpdateFeatureDefs/UpdateFeatures.xml).
Title: Re: [B18] HugsLib (4.0.1) Lightweight modding library
Post by: Rock5 on December 01, 2017, 04:03:13 AM
Ah, I see what I did wrong. I thought I had to change the HugsLib. references in the file to my mod name. Anyway, I've changed them back and it worked.

Thanks for your help.
Title: Re: [B18] HugsLib (4.0.1) Lightweight modding library
Post by: UnlimitedHugs on December 01, 2017, 05:44:57 AM
Quote from: Rock5 on December 01, 2017, 04:03:13 AM
Ah, I see what I did wrong. I thought I had to change the HugsLib. references in the file to my mod name. Anyway, I've changed them back and it worked.
Thanks for your help.

Happy to help :)
Title: Re: [B18] HugsLib (4.0.1) Lightweight modding library
Post by: Torann on December 06, 2017, 12:54:26 AM
Ive just started using HugsLib and I'm having trouble getting adjustable mod settings to save or to reference those settings elsewhere in the mod.
I can adjust the setting values in the mod options and they appear to save, but anytime I reference those values, I always get a return of the "default" value, ie the value I have hardcoded when initiating the variable:
public float pawnDeathChance = 0.67f;
public float animalDeathChance = 0.47f;


I've tried leaving the value unspecified, but all that seems to do is give me whatever the field held before i make the change.
I'm trying to reference these values from within a harmony prefix:
public static bool Prefix(Pawn_HealthTracker __instance, DamageInfo?, Hediff hediff)
{
..
Settings CDR = new Settings();
float num = CDR.pawnDeathChance;
..
}


I've been struggling with this for awhile, so I figured I'd just ask to see if anyone had any thoughts.  I get the impression each time the prefix is called, it creates a new instance of Settings with the default variables.  Not sure if that's right though, so any help on what I need to look for would be appreciated.
Title: Re: [B18] HugsLib (4.0.1) Lightweight modding library
Post by: UnlimitedHugs on December 06, 2017, 01:15:20 AM
Quote from: Torann on December 06, 2017, 12:54:26 AM
Ive just started using HugsLib and I'm having trouble getting adjustable mod settings to save or to reference those settings elsewhere in the mod.
- snip -

Hello! I'm not convinced it is the HugsLib settings you are trying to implement.
Did you take a look at the Adding Mod Settings (https://github.com/UnlimitedHugs/RimworldHugsLib/wiki/Adding-mod-settings) wiki page?
Title: Re: [B18] HugsLib (4.0.1) Lightweight modding library
Post by: Fluffy (l2032) on December 06, 2017, 06:49:06 AM
Also, you probably shouldn't be creating the Settings object inside the actual prefix. Use a static class with all the initialization required (shouldn't be much), then reference that.

Title: Re: [B18] HugsLib (4.0.1) Lightweight modding library
Post by: Harry_Dicks on January 01, 2018, 03:05:05 PM
Does it matter if you load this before or after Jecs Tools? Is there a sort of "general" load order that people go by? For example, Core->HugsLib->JecsTools->AlienRaceFramework->Certain mods that need to be early->User Interface->Bundles of mod groups->Small QoL mods->big content mods->small content mods->certain mods that need to go towards the end

Any help would be greatly appreciated, up to 280ish mods, and I finally got it down to only a few yellows and 1 red error. I've honestly been working on all the mods for about an hour a day over the past 5-6 weeks, starting from 0!
Title: Re: [B18] HugsLib (4.0.1) Lightweight modding library
Post by: SpaceDorf on January 02, 2018, 06:44:27 AM
Quote from: Harry_Dicks on January 01, 2018, 03:05:05 PM
Does it matter if you load this before or after Jecs Tools? Is there a sort of "general" load order that people go by? For example, Core->HugsLib->JecsTools->AlienRaceFramework->Certain mods that need to be early->User Interface->Bundles of mod groups->Small QoL mods->big content mods->small content mods->certain mods that need to go towards the end

Exactly Like you said with following addition :

Mod-E -> Core -> HugsLib -> ModSwitch -> JecsTools ->AlienRaceFramework -> ArchitectSense -> AllowTool ->

( basic must have modlist )

later I just tack on what I find interesting, and I am down to a few warnings and no errors.

Title: Re: [B18] HugsLib (4.0.1) Lightweight modding library
Post by: bravelittletoreador on February 20, 2018, 01:54:21 PM
Hi, could I get a quick 'Hugs for Dummies?' I'm not a modder, but a mod I want to use (Children and Pregnancy (https://ludeon.com/forums/index.php?PHPSESSID=8f7b3a27e8853532405ee0fd3a237bc5&topic=28747.0)) needs it and I can't figure out how to install it.
The first post doesn't have any information on how to add it except that it doesn't go in the mods folder. I tried just dumping the contents of the RimworldHugsLib-master folder in my root Rimworld folder (since several folder names matched I figured it was a solid guess) and hugslib showed up properly in the mods in game, but I couldn't start a new colony. When I try to generate a new world it just thinks for a minute and then dumps me back on the create world page. It kept doing that even after deactivating all mods. I had to do a clean install to get it to run properly again, so I can only assume copying over the hugslib folder that way overwrote something it shouldn't have.
So, clearly, I'm an idiot. Can you explain where I'm supposed to put the hugslib folders to me like I'm five?
Title: Re: [B18] HugsLib (4.0.1) Lightweight modding library
Post by: Kori on February 20, 2018, 02:15:17 PM
HugsLib needs to be installed like any other mod in the mods folder, you can also subscribe it on steam.
The only important thing is that it should be the first mod in your load order. :)
Title: Re: [B18] HugsLib (4.0.1) Lightweight modding library
Post by: bravelittletoreador on February 20, 2018, 02:26:31 PM
I think I figured out what dumb thing I did =w=; I clicked the 'clone or download' button on github instead of directly on the zip file. I don't use github often and I am, as previously mentioned, an idiot. I have what I think is the correct file now, so I'm going to slink away in shame.
It might be advantageous in the future to add a short little install section to the first post for nervous idiots like me. something like "Install directions: 1. Goes in the mod file like any other mod. 2. Make sure you have the right file and not the source code. 3. Don't be an idiot."
Title: Re: [B18] HugsLib (4.0.1) Lightweight modding library
Post by: wwWraith on February 20, 2018, 02:31:00 PM
Quote from: Kori on February 20, 2018, 02:15:17 PM
the first mod
after Core ;)

Also you should read How to Install and Update All Types of Mods (https://ludeon.com/forums/index.php?topic=6223.0).
Title: Re: [B18] HugsLib (4.0.1) Lightweight modding library
Post by: Kori on February 20, 2018, 02:31:46 PM
 ;D
There is an About folder in every mod. When everything is installed correctly, this folder's path should look like this:
RimWorld\Mods\HugsLib\About
Title: Re: [B18] HugsLib (4.0.1) Lightweight modding library
Post by: Harry_Dicks on February 20, 2018, 02:52:40 PM
Quote from: bravelittletoreador on February 20, 2018, 02:26:31 PM
and I am, as previously mentioned, an idiot.

You stop that right now, mister. If anyone's the village idiot around here, it's ME dammit!
Title: Re: [B18] HugsLib (4.0.1) Lightweight modding library
Post by: Canute on February 20, 2018, 04:34:28 PM
bravelittletoreador,
follow the download link from the first posting, and don't download the master.
Title: Re: [B18] HugsLib (4.0.1) Lightweight modding library
Post by: UnlimitedHugs on February 21, 2018, 09:21:17 AM
Quote from: bravelittletoreador on February 20, 2018, 01:54:21 PM
- snip -

Don't be so hard on yourself :) This can be tricky and this question does come up fairly often.
I've added a section to the main post with some pointers.
Title: Re: [B18] HugsLib (4.0.1) Lightweight modding library
Post by: FrodoOf9Fingers on February 21, 2018, 11:34:48 PM
Hey, can this be used with a different version of Harmony that is not bundled with HugsLib?
Title: Re: [B18] HugsLib (4.0.1) Lightweight modding library
Post by: UnlimitedHugs on February 22, 2018, 12:51:44 AM
Quote from: FrodoOf9Fingers on February 21, 2018, 11:34:48 PM
Hey, can this be used with a different version of Harmony that is not bundled with HugsLib?

Sure thing. Just include your own version with your mod. The two should not conflict with each other in any way.
Did pardeike release a new update?
Title: Re: [B18] HugsLib (4.0.1) Lightweight modding library
Post by: FrodoOf9Fingers on February 22, 2018, 01:55:10 AM
Quote from: UnlimitedHugs on February 22, 2018, 12:51:44 AM
Quote from: FrodoOf9Fingers on February 21, 2018, 11:34:48 PM
Hey, can this be used with a different version of Harmony that is not bundled with HugsLib?

Sure thing. Just include your own version with your mod. The two should not conflict with each other in any way.
Did pardeike release a new update?

Nope, just need more functionality than is currently available.

I'm having some difficulty then. If I try to run a revised Harmony dll in my references and assemblies folder, I get an error along the lines of "classes could not be loaded". However, if I change out Hugslib's version of Harmony with my own, the error goes away. Trying to debug it is hard, as Rimworld isn't very descriptive.
Title: Re: [B18] HugsLib (4.0.1) Lightweight modding library
Post by: UnlimitedHugs on February 22, 2018, 02:02:40 AM
[quote author=FrodoOf9Fingers link=topic=28066.msg399066#msg399066
Nope, just need more functionality than is currently available.
I'm having some difficulty then. If I try to run a revised Harmony dll in my references and assemblies folder, I get an error along the lines of "classes could not be loaded". However, if I change out Hugslib's version of Harmony with my own, the error goes away. Trying to debug it is hard, as Rimworld isn't very descriptive.
[/quote]

Did you change the assembly version of your custom build? You probably already know that assemblies with the same version are only loaded once.
Also, which assembly is failing to load, HugsLib, or your mod?
Title: Re: [B18] HugsLib (4.0.1) Lightweight modding library
Post by: UnlimitedHugs on March 01, 2018, 12:33:33 AM
Hello gents.
As you may have noticed, the HugsLib log uploader has recently stopped working. This is due to GitHub (where the logs are posted) upgrading their https encryption, making Unity unable to communicate with them using its built-in web request capabilities.
The question is, where to go from here. Plain http is a no-go on GitHub. Switching to another provider might be an option, though pastebin is phasing out http, as well. It might be possible to include a library to perform the requests, though I have yet to find one for net3.5. The third option is setting up a server to bounce the upload requests off of, which would, however, add another moving part to the equation.

So, if you have any insight or ideas on the matter, or if you would be able to contribute a bit of server capacity, please let me know.
Title: Re: [B18] HugsLib (4.1.0) Lightweight modding library
Post by: UnlimitedHugs on March 02, 2018, 03:30:06 AM
Updated to 4.1.0
Well, feel free to disregard my previous post :D
Turns out, Unity comes with its own web client, which seems to work just fine for our humble purposes. An thus:
Also, HugsLib is now available on NuGet... if you're into that sort of thing: HugsLib (https://www.nuget.org/packages/UnlimitedHugs.Rimworld.HugsLib/), HugsLibChecker (https://www.nuget.org/packages/UnlimitedHugs.Rimworld.HugsLibChecker/)
Title: Re: [B18] HugsLib (4.1.0) Lightweight modding library
Post by: Canute on March 02, 2018, 04:16:59 AM
Puhhhh thanks,
these share log ability is realy usefull for us non-modder to share error logs with the author. I wouldn't miss it.
Title: Re: [B18] HugsLib (4.1.1) Lightweight modding library
Post by: UnlimitedHugs on March 02, 2018, 10:05:04 AM
Updated to 4.1.1

Minor fix to allow the DoLaterScheduler (https://github.com/UnlimitedHugs/RimworldHugsLib/wiki/Custom-Tick-Scheduling/_edit#related-feature-dolaterscheduler) callbacks to be re-registered when they are called. This allows to set up temporary event listeners.
Title: Re: [B18] HugsLib (4.1.1) Lightweight modding library
Post by: Harry_Dicks on March 02, 2018, 10:13:13 AM
Thanks Mister Hugs!

Also, what is NuGet? I skimmed over it for a moment - is it a distribution platform similar to GitHub?
Title: Re: [B18] HugsLib (4.1.1) Lightweight modding library
Post by: UnlimitedHugs on March 02, 2018, 10:35:44 AM
Quote from: Harry_Dicks on March 02, 2018, 10:13:13 AM
Thanks Mister Hugs!
Also, what is NuGet? I skimmed over it for a moment - is it a distribution platform similar to GitHub?

It's a package manager, mostly used by Visual Studio, where we do our coding. When your code depends on some other library, it offers a convenient way to download and keep track of it.
Title: Re: [B18] HugsLib (4.1.1) Lightweight modding library
Post by: Canute on March 02, 2018, 11:23:05 AM
At last my favoured download tool (jdownloader) don't like Nuget, all the releases are shown as offline.
But i still can use github. :-)
Title: Re: [B18] HugsLib (4.1.1) Lightweight modding library
Post by: Harry_Dicks on March 06, 2018, 03:56:18 PM
With the new version of HugsLib, if I ever launch a quickstart game, it ends up enabling quickstart as the startup option. And I keep forgetting that it keeps turning it on, which is frustrating, because I'm doing a bunch of little test games messing around with stuff, and half the time when I launch the game it will quickstart for me when I might not want it to.

Am I not doing this right? With the new version, the button has changed location to "launch" a quickstart game in the quickstart menu. However, I'm not trying to have the mod always start my game into this, I just want to do it this specific time. Is this feature not meant to be used in such a way? Or is there a way I can disable the mod from continuously enabling the "quickstart from launch" option when I just want an individual quickstart?

Thanks! :)
Title: Re: [B18] HugsLib (4.1.1) Lightweight modding library
Post by: UnlimitedHugs on March 11, 2018, 01:08:22 PM
Quote from: Harry_Dicks on March 06, 2018, 03:56:18 PM
With the new version of HugsLib, if I ever launch a quickstart game, it ends up enabling quickstart as the startup option.

Yep, two options here: you can shift-click the quickstart icon, or shift-click the "Generate now" and "Load now" buttons. Either way, it will generate or load your map without activating it on startup.
Title: Re: [B18] HugsLib (4.1.1) Lightweight modding library
Post by: orgre45 on June 08, 2018, 04:07:24 AM
I've been using your mod for a long time now. I just made an account to say I appreciate your work.
Title: Re: [B18] HugsLib (4.1.1) Lightweight modding library
Post by: UnlimitedHugs on June 08, 2018, 09:11:10 AM
Quote from: orgre45 on June 08, 2018, 04:07:24 AM
I've been using your mod for a long time now. I just made an account to say I appreciate your work.

I appreciate the kind words :)
Title: Re: [B18] HugsLib (4.1.1) Lightweight modding library
Post by: Mehni on June 10, 2018, 09:17:55 AM
I have a request: Move the mod settings for each individual mod behind a button, vanilla style. Some of the mods implementing HugsLib settings take up three scroll windows, and I don't think that's particularly user-friendly.

Suggestion: Implement the same Show settings button vanilla has, but instead of taking people to a new page, make it fold out the settings below. Hit the button again to Hide settings. So the button label would be Show settings when collapsed, and Hide settings when unfolded. This keeps things neat and tidy.

Quick mock-up:
(https://i.imgur.com/GGepXGZ.png)
Title: Re: [B18] HugsLib (4.1.1) Lightweight modding library
Post by: UnlimitedHugs on June 10, 2018, 10:03:42 AM
Quote from: Mehni on June 10, 2018, 09:17:55 AM
I have a request: Move the mod settings for each individual mod behind a button, vanilla style. Some of the mods implementing HugsLib settings take up three scroll windows, and I don't think that's particularly user-friendly.

That's a good idea. I'll include it in the upcoming update.
Title: Re: [B18] HugsLib (4.1.1) Lightweight modding library
Post by: Roolo on June 19, 2018, 10:35:09 AM
Any ETA on when a Hugslib version is released that supports Rimworld 1.0 experimental?
I really don't want to rush you, but it's just useful for me to know more or less when I can start updating Giddy-up and RunAndGun.

By the way, I love your work :) Really useful for me as a modder.
Title: Re: [B18] HugsLib (4.1.1) Lightweight modding library
Post by: UnlimitedHugs on June 19, 2018, 03:36:20 PM
Quote from: Roolo on June 19, 2018, 10:35:09 AM
Any ETA on when a Hugslib version is released that supports Rimworld 1.0 experimental?
I really don't want to rush you, but it's just useful for me to know more or less when I can start updating Giddy-up and RunAndGun.
By the way, I love your work :) Really useful for me as a modder.

Mostly done, I'll probably release tomorrow.
Thank you, I'm happy to help where I can :)
Title: Re: [B18] HugsLib (4.1.1) Lightweight modding library
Post by: Brrainz on June 20, 2018, 03:05:09 AM
Can we try to get Harmony 1.1.1 into HugsLib when I release it on Monday next week?
Title: Re: [1.0] HugsLib (5.0.0) Lightweight modding library
Post by: UnlimitedHugs on June 20, 2018, 09:35:57 AM
Quote from: Brrainz on June 20, 2018, 03:05:09 AM
Can we try to get Harmony 1.1.1 into HugsLib when I release it on Monday next week?

Of course. I'll push an update once your new build is out.
Title: Re: [1.0] HugsLib (5.0.0) Lightweight modding library
Post by: UnlimitedHugs on June 20, 2018, 09:36:14 AM
Updated to 5.0.0

There you go folks, the 1.0 update is here :) Here's a summary of the changes:

As last time, I published a temporary workshop item (https://steamcommunity.com/sharedfiles/filedetails/?id=1417078111) with this version. Once 1.0 goes live, the main HugsLib item will be updated, as well.
As always, let me know if you find issues or have suggestions. 1.0 is still being updated, so issues can still come up.
Happy modding! ;)

Important: make sure to also grab the updated HugsLib checker (https://github.com/UnlimitedHugs/RimworldHugsLibChecker) if you use it.
Title: Re: [1.0] HugsLib (5.0.0) Lightweight modding library
Post by: Roolo on June 20, 2018, 02:00:30 PM
Great! Thanks!
Title: Re: [1.0] HugsLib (5.0.0) Lightweight modding library
Post by: Kiame on June 21, 2018, 04:51:27 AM
Added support for Version.xml in ModSync RW (https://ludeon.com/forums/index.php?topic=41634.0). Anyone that uses that can now be informed of when this mod is updated via changes to the Version (by comparing their local file's version number to the github's file's version number)
Title: Re: [1.0] HugsLib (5.0.0) Lightweight modding library
Post by: Brrainz on July 22, 2018, 10:28:43 AM
While testing all my mod updates for rw1.0, I tried this to speed up test-launching. It doesn't work. RimWorld stays at Initializing forever when it gets combined with any of my new versions. :-/
Title: Re: [1.0] HugsLib (5.0.0) Lightweight modding library
Post by: UnlimitedHugs on July 23, 2018, 09:21:44 AM
Quote from: Brrainz on July 22, 2018, 10:28:43 AM
While testing all my mod updates for rw1.0, I tried this to speed up test-launching. It doesn't work. RimWorld stays at Initializing forever when it gets combined with any of my new versions. :-/

I'll see you on Discord- I'm sure we'll work it out.
Title: Re: [1.0] HugsLib (5.0.1) Lightweight modding library
Post by: UnlimitedHugs on July 28, 2018, 12:38:35 PM
Updated to 5.0.1

This release updates the included Harmony library to 1.1.1b. The update should be fully backwards-compatible, so no changes in your mods should be necessary. I still recommend checking over your projects to be sure, though.
I also included a ModSync config file to allow for update checking from within the game.

Edit: False alarm. Harmony still needs some last-minute fixes. I'll make a new update in the next few days.
Title: Re: [1.0] HugsLib (5.0.0) Lightweight modding library
Post by: Brrainz on July 28, 2018, 01:04:58 PM
Oops. Small bug in Harmony that makes this Update bogus. Sorry for that. It will be fixed on Monday.
Title: Re: [1.0] HugsLib (5.0.0) Lightweight modding library
Post by: Kiame on July 28, 2018, 04:37:33 PM
Thanks for including ModSync  :D
Title: Re: [1.0] HugsLib (5.0.0) Lightweight modding library
Post by: rawrfisher on July 30, 2018, 11:46:42 AM
@unlimitedhugs  If you have a spare moment can you look into an error?  I have no idea what to tell the mod author lol

[HugsLib][ERR] WhatTheHack caused an exception during OnPlayingStateEntered: System.MissingFieldException: Field 'Verse.RecipeDef.requireBed' not found.
  at HugsLib.HugsLibController.OnPlayingStateEntered () [0x00000] in <filename unknown>:0
Verse.Log:Error(String, Boolean) (at C:\Dev\RimWorld\Assets\Scripts\Verse\Utility\Debug\Log\Log.cs:78)
HugsLib.Utils.ModLogger:ReportException(Exception, String, Boolean, String)
HugsLib.HugsLibController:OnPlayingStateEntered()
HugsLib.Patches.Game_FinalizeInit_Patch:WorldLoadedHook()
Verse.Game:FinalizeInit_Patch1(Object)
Verse.Game:InitNewGame_Patch1(Object)
Verse.Root_Play:<Start>m__1() (at C:\Dev\RimWorld\Assets\Scripts\Verse\Global\Root\Root_Play.cs:60)
Verse.LongEventHandler:RunEventFromAnotherThread(Action) (at C:\Dev\RimWorld\Assets\Scripts\Verse\Global\LongEventHandler.cs:455)
Verse.LongEventHandler:<UpdateCurrentAsynchronousEvent>m__1() (at C:\Dev\RimWorld\Assets\Scripts\Verse\Global\LongEventHandler.cs:367)
Title: Re: [1.0] HugsLib (5.0.0) Lightweight modding library
Post by: UnlimitedHugs on July 30, 2018, 12:16:34 PM
Quote from: rawrfisher on July 30, 2018, 11:46:42 AM
@unlimitedhugs  If you have a spare moment can you look into an error?  I have no idea what to tell the mod author lol

A game update broke one of your mods. The mod is What The Hack, the author should check their WorldLoaded function.
The bright side is that these update bugs are super easy to diagnose :)
Title: Re: [1.0] HugsLib (5.0.0) Lightweight modding library
Post by: rawrfisher on July 30, 2018, 01:03:45 PM
I knew the update broke what the hack i just didnt know where to suggest they start looking
Title: Re: [1.0] HugsLib (5.0.0) Lightweight modding library
Post by: Canute on July 31, 2018, 03:01:33 AM
Many mod's use hugslib.
So when you just get the error from one mod (in this time easy to see and find) just mention it at these mods.
If multiple mod's get trouble with hugslib i think the error message would be different.

But in case you realy have no cluse, report it at both mod topics ! :-)
Title: Re: [1.0] HugsLib (5.0.0) Lightweight modding library
Post by: rawrfisher on August 06, 2018, 10:19:03 AM

System.NullReferenceException: Object reference not set to an instance of an object
  at RimWorld.LordToil_Siege.CanBeBuilder (Verse.Pawn p) [0x0000c] in C:\Dev\RimWorld\Assets\Scripts\RimWorld\AI\Lord\LordToil\LordToil_Siege.cs:258
  at RimWorld.LordToil_Siege+<UpdateAllDuties>c__AnonStorey2.<>m__1 (Verse.Pawn pa) [0x0001d] in C:\Dev\RimWorld\Assets\Scripts\RimWorld\AI\Lord\LordToil\LordToil_Siege.cs:211
  at System.Linq.Enumerable+<CreateWhereIterator>c__Iterator1D`1[Verse.Pawn].MoveNext () [0x00000] in <filename unknown>:0
  at System.Collections.Generic.List`1[Verse.Pawn].AddEnumerable (IEnumerable`1 enumerable) [0x0001a] in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Collections.Generic/List.cs:128
  at System.Collections.Generic.List`1[Verse.Pawn]..ctor (IEnumerable`1 collection) [0x00025] in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Collections.Generic/List.cs:65
  at System.Linq.Enumerable.ToList[Pawn] (IEnumerable`1 source) [0x00000] in <filename unknown>:0
  at Verse.GenCollection.TryRandomElement[Pawn] (IEnumerable`1 source, Verse.Pawn& result) [0x0004a] in C:\Dev\RimWorld\Assets\Scripts\Verse\Utility\Gen\GenCollection.cs:99
  at RimWorld.LordToil_Siege.UpdateAllDuties () [0x00182] in C:\Dev\RimWorld\Assets\Scripts\RimWorld\AI\Lord\LordToil\LordToil_Siege.cs:211
  at RimWorld.LordToil_Siege.LordToilTick () [0x0002e] in C:\Dev\RimWorld\Assets\Scripts\RimWorld\AI\Lord\LordToil\LordToil_Siege.cs:305
  at Verse.AI.Group.Lord.LordTick () [0x00018] in C:\Dev\RimWorld\Assets\Scripts\Verse\AI\Group\Lord.cs:327
  at Verse.AI.Group.LordManager.LordManagerTick () [0x00015] in C:\Dev\RimWorld\Assets\Scripts\Verse\AI\Group\LordManager.cs:41
  at Verse.Map.MapPostTick () [0x000e6] in C:\Dev\RimWorld\Assets\Scripts\Verse\Map\Map.cs:581
Verse.Log:Error(String, Boolean) (at C:\Dev\RimWorld\Assets\Scripts\Verse\Utility\Debug\Log\Log.cs:78)
Verse.Map:MapPostTick() (at C:\Dev\RimWorld\Assets\Scripts\Verse\Map\Map.cs:582)
Verse.TickManager:DoSingleTick() (at C:\Dev\RimWorld\Assets\Scripts\Verse\Game\Ticking\TickManager.cs:358)
Verse.TickManager:TickManagerUpdate() (at C:\Dev\RimWorld\Assets\Scripts\Verse\Game\Ticking\TickManager.cs:267)
Verse.Game:UpdatePlay() (at C:\Dev\RimWorld\Assets\Scripts\Verse\Game\Game.cs:512)
Verse.Root_Play:Update() (at C:\Dev\RimWorld\Assets\Scripts\Verse\Global\Root\Root_Play.cs:99)


I read over this a couple times and cant find the cultprit mod.  Could I get some help finding who to report this to?
The error itself  auto corrects after a bit and can be fixed by simply hitting unforbid everything when using allow tool

https://git.io/fN1gU  My output log
Title: Re: [1.0] HugsLib (5.0.0) Lightweight modding library
Post by: Roolo on August 21, 2018, 11:04:07 AM
Hi UnlimitedHugs,

I'm adding HugslibChecker to one of my Rimworld v0.19 projects, and I downloaded the latest HugsLibChecker (for Hugslib 5.x). When I tested it, I noticed that the download button that pops up when a user hasn't installed HugsLib still points to HugsLib v4.x, which is for B18. Because of this, end-users will end up downloading the wrong HugsLib version. Could you take a look at it?

Quote from: rawrfisher on August 06, 2018, 10:19:03 AM

System.NullReferenceException: Object reference not set to an instance of an object
  at RimWorld.LordToil_Siege.CanBeBuilder (Verse.Pawn p) [0x0000c] in C:\Dev\RimWorld\Assets\Scripts\RimWorld\AI\Lord\LordToil\LordToil_Siege.cs:258
  at RimWorld.LordToil_Siege+<UpdateAllDuties>c__AnonStorey2.<>m__1 (Verse.Pawn pa) [0x0001d] in C:\Dev\RimWorld\Assets\Scripts\RimWorld\AI\Lord\LordToil\LordToil_Siege.cs:211
  at System.Linq.Enumerable+<CreateWhereIterator>c__Iterator1D`1[Verse.Pawn].MoveNext () [0x00000] in <filename unknown>:0
  at System.Collections.Generic.List`1[Verse.Pawn].AddEnumerable (IEnumerable`1 enumerable) [0x0001a] in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Collections.Generic/List.cs:128
  at System.Collections.Generic.List`1[Verse.Pawn]..ctor (IEnumerable`1 collection) [0x00025] in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Collections.Generic/List.cs:65
  at System.Linq.Enumerable.ToList[Pawn] (IEnumerable`1 source) [0x00000] in <filename unknown>:0
  at Verse.GenCollection.TryRandomElement[Pawn] (IEnumerable`1 source, Verse.Pawn& result) [0x0004a] in C:\Dev\RimWorld\Assets\Scripts\Verse\Utility\Gen\GenCollection.cs:99
  at RimWorld.LordToil_Siege.UpdateAllDuties () [0x00182] in C:\Dev\RimWorld\Assets\Scripts\RimWorld\AI\Lord\LordToil\LordToil_Siege.cs:211
  at RimWorld.LordToil_Siege.LordToilTick () [0x0002e] in C:\Dev\RimWorld\Assets\Scripts\RimWorld\AI\Lord\LordToil\LordToil_Siege.cs:305
  at Verse.AI.Group.Lord.LordTick () [0x00018] in C:\Dev\RimWorld\Assets\Scripts\Verse\AI\Group\Lord.cs:327
  at Verse.AI.Group.LordManager.LordManagerTick () [0x00015] in C:\Dev\RimWorld\Assets\Scripts\Verse\AI\Group\LordManager.cs:41
  at Verse.Map.MapPostTick () [0x000e6] in C:\Dev\RimWorld\Assets\Scripts\Verse\Map\Map.cs:581
Verse.Log:Error(String, Boolean) (at C:\Dev\RimWorld\Assets\Scripts\Verse\Utility\Debug\Log\Log.cs:78)
Verse.Map:MapPostTick() (at C:\Dev\RimWorld\Assets\Scripts\Verse\Map\Map.cs:582)
Verse.TickManager:DoSingleTick() (at C:\Dev\RimWorld\Assets\Scripts\Verse\Game\Ticking\TickManager.cs:358)
Verse.TickManager:TickManagerUpdate() (at C:\Dev\RimWorld\Assets\Scripts\Verse\Game\Ticking\TickManager.cs:267)
Verse.Game:UpdatePlay() (at C:\Dev\RimWorld\Assets\Scripts\Verse\Game\Game.cs:512)
Verse.Root_Play:Update() (at C:\Dev\RimWorld\Assets\Scripts\Verse\Global\Root\Root_Play.cs:99)


I read over this a couple times and cant find the cultprit mod.  Could I get some help finding who to report this to?
The error itself  auto corrects after a bit and can be fixed by simply hitting unforbid everything when using allow tool

https://git.io/fN1gU  My output log

This was an issue in What the Hack, it's solved for a while now. If you're encountering problems and you don't know which mod is the cause, it's likely best to just post it in the bugs and issues thread on the Rimworld Discord. In case you don't use Discord, there's also this thread: https://ludeon.com/forums/index.php?board=23.0.
Title: Re: [1.0] HugsLib (5.0.2) Lightweight modding library
Post by: UnlimitedHugs on August 25, 2018, 09:15:34 AM
Updated to 5.0.2
Folks were getting triggered by the red color in the Mods menu, so I thought I'd fix that ;)
No other changes, other than a recompile against the latest build.

If you're wondering what happened to the promised Harmony update, I've got news.
Due to an oversight on my part, updating Harmony would break every mod that uses HugsLib. That is why I plan to skip the Harmony updates until the next major game update- when we have to fix our stuff anyway. There are not critical issues that we have found, so it's not a big issue.
But you are welcome to download and include an updated Harmony version in your own mod if you like- there are some neat features in the latest (https://github.com/pardeike/Harmony/releases) versions. The different versions are designed to run side by side, so no conflicts should pop up.
Do post your thoughts on the matter, I'd like to hear your opinions.
Title: Re: [1.0] HugsLib (5.0.2) Lightweight modding library
Post by: Brrainz on August 25, 2018, 11:39:33 AM
I am watching this thread so I am listening to your Harmony feedback too.
Title: Re: [B19] HugsLib (5.0.2) Lightweight modding library
Post by: UnlimitedHugs on August 29, 2018, 12:17:11 PM
Steam workshop items have been updated:
Main item (https://steamcommunity.com/sharedfiles/filedetails/?id=818773962) is now updated to B19, and there is a new page with the legacy version (https://steamcommunity.com/sharedfiles/filedetails/?id=1495940024) for B18.
Title: Re: [B19] HugsLib (5.0.2) Lightweight modding library (1.0 build available)
Post by: UnlimitedHugs on October 11, 2018, 02:23:27 AM
Updated to 6.0.0

Hello gents.
This is the test release for Rimworld 1.0.
I updated the included Harmony library to 1.2.0.1- no changes other than that.
The preview will not be on Steam this time, since release is only a few days away.

Also, I plan to update HugsLib (and my other mods) on Steam in-place, despite what Tynan suggested in his blog post. This means that the B19 version will be uploaded to a separate workshop item, as usual.
Title: Re: [B19] HugsLib (5.0.2) Lightweight modding library (1.0 build available)
Post by: spyderwebsc on October 11, 2018, 12:27:44 PM
6.0.0's about.xml has 0.19.0 as the target version and shows up red in the 1.0(unstable) mods menu.

I editted the target version to 1.0.0 and that took care of that.
Title: Re: [B19] HugsLib (5.0.2) Lightweight modding library (1.0 build available)
Post by: UnlimitedHugs on October 12, 2018, 03:14:24 AM
Quote from: spyderwebsc on October 11, 2018, 12:27:44 PM
6.0.0's about.xml has 0.19.0 as the target version and shows up red in the 1.0(unstable) mods menu.
I editted the target version to 1.0.0 and that took care of that.

Updated to 6.0.1 (https://github.com/UnlimitedHugs/RimworldHugsLib/releases/tag/v6.0.1)
Thank you, should fixed now.
Title: Re: [B19] HugsLib (5.0.2) Lightweight modding library (1.0 build available)
Post by: xion1088 on October 12, 2018, 12:39:02 PM
Now that you mention it can you make "Haul Urgently" work on food in prison cells? Like If a meal or raw food is set to "Haul Urgently" pawns will ignore the "Reserved for prisoners" thing.
Title: Re: [B19] HugsLib (5.0.2) Lightweight modding library (1.0 build available)
Post by: UnlimitedHugs on October 13, 2018, 04:25:48 AM
Quote from: xion1088 on October 12, 2018, 12:39:02 PM
Now that you mention it can you make "Haul Urgently" work on food in prison cells? Like If a meal or raw food is set to "Haul Urgently" pawns will ignore the "Reserved for prisoners" thing.

I was about to poke at you for the off-topic, but then I noticed I have unread posts in the Allow Tool thread. I think the forum hasn't been sending me notifications.
Title: Re: [B19] HugsLib (5.0.2) Lightweight modding library (1.0 build available)
Post by: xion1088 on October 13, 2018, 10:45:12 AM
Quote from: UnlimitedHugs on October 13, 2018, 04:25:48 AM
Quote from: xion1088 on October 12, 2018, 12:39:02 PM
Now that you mention it can you make "Haul Urgently" work on food in prison cells? Like If a meal or raw food is set to "Haul Urgently" pawns will ignore the "Reserved for prisoners" thing.

I was about to poke at you for the off-topic, but then I noticed I have unread posts in the Allow Tool thread. I think the forum hasn't been sending me notifications.

Yeah sorry for that I just wanted to have a bit more of exposure, I'll explain what I mean in the Allow Tool topic.
Title: Re: [1.0] HugsLib (6.0.1) Lightweight modding library
Post by: SlabBulkhead on October 24, 2018, 12:58:45 AM
Has anyone made mention of HugsLib and compatible mods in 1.0 not showing their options? All mods which use hugslib to show mod options are blank for me, and the console throws an error a thousand times over.

Exception filling window for RimWorld.Dialog_VanillaModSettings: System.TypeLoadException: Could not load type 'Verse.NamedArgument' from assembly 'HugsLib'.
Title: Re: [1.0] HugsLib (6.0.1) Lightweight modding library
Post by: UnlimitedHugs on October 24, 2018, 02:46:41 AM
Quote from: SlabBulkhead on October 24, 2018, 12:58:45 AM
Has anyone made mention of HugsLib and compatible mods in 1.0 not showing their options? All mods which use hugslib to show mod options are blank for me, and the console throws an error a thousand times over.
Exception filling window for RimWorld.Dialog_VanillaModSettings: System.TypeLoadException: Could not load type 'Verse.NamedArgument' from assembly 'HugsLib'.

Must be some odd mod conflict. Open and close the mod settings window that is causing the errors, and publish a Ctrl+F12 log for me. Also, if it's a specific one, which mod's settings trigger this?
Title: Re: [1.0] HugsLib (6.1.0) Lightweight modding library
Post by: UnlimitedHugs on November 01, 2018, 06:09:14 AM
Updated to 6.1.0 (https://github.com/UnlimitedHugs/RimworldHugsLib/releases/tag/v6.1.0)

Hey folks. Been a while since I added any new features- let's remedy that!

That about covers it. Do try it out (before your players get to it) and let me know if you have any suggestions.
Steam update tomorrow, assuming all is well.
Title: Re: [1.0] HugsLib (6.1.1) Lightweight modding library
Post by: UnlimitedHugs on November 03, 2018, 09:33:27 AM
Updated to 6.1.1 (https://github.com/UnlimitedHugs/RimworldHugsLib/releases/tag/v6.1.1)

Got a couple of fixes for the last update.
Also, I disabled the new "update news for mods without assemblies" feature for now. It's not going to work properly for workshop mods, so I'll see if I can redesign it using a different approach.
Title: Re: [1.0] HugsLib (6.1.1) Lightweight modding library
Post by: carlzxc on March 19, 2019, 09:43:43 AM
Hello, is this incompatible with AlienRaces? I can't play when AlienRaces is allowed
Title: Re: [1.0] HugsLib (6.1.1) Lightweight modding library
Post by: hauvega on March 19, 2019, 10:14:54 AM
I use Huglibs with Alien Race Framework and have no problems.  I have a race mod so do know hugs at the top under core with the HAF later in the mod order.  Sounds like a conflict or improper mod load order.
Title: Re: [1.0] HugsLib (6.1.1) Lightweight modding library
Post by: UncleIROH on March 28, 2019, 02:34:29 PM
I'm having issues attempting to do mod processing after other mods load their defs.

This code appears to handle a large number of cases
LongEventHandler.QueueLongEvent(() => {
     // Code to run after mods
}, ....);


But it doesn't fire after the HugsLib late method fire. Maybe OnDefsLoaded?

Is there a way to modify my existing code so that it fires after HugsLib. Or a way for me to bind to the HubsLib event sequence but only if HugsLib is present. ( i.e. My mod does not require HugsLib as a dependency )
Title: Re: [1.0] HugsLib (6.1.1) Lightweight modding library
Post by: UnlimitedHugs on March 30, 2019, 04:21:11 AM
Quote from: UncleIROH on March 28, 2019, 02:34:29 PM
I'm having issues attempting to do mod processing after other mods load their defs.

This code appears to handle a large number of cases
LongEventHandler.QueueLongEvent(() => {
     // Code to run after mods
}, ....);


But it doesn't fire after the HugsLib late method fire. Maybe OnDefsLoaded?

Is there a way to modify my existing code so that it fires after HugsLib. Or a way for me to bind to the HubsLib event sequence but only if HugsLib is present. ( i.e. My mod does not require HugsLib as a dependency )

HugsLib initializes in two stages- when Verse.Mod instances are created and again at StaticConstructorOnStartup. So, if you put a [StaticConstructorOnStartup] attribute on your controller and use LongEventHandler.QueueLongEvent you should get a callback once all HugsLib mods are initialized.
Title: Re: [1.0] HugsLib (6.1.2) Lightweight modding library
Post by: UnlimitedHugs on May 12, 2019, 04:22:01 AM
Updated to 6.1.2 (https://github.com/UnlimitedHugs/RimworldHugsLib/releases/tag/v6.1.2)

Minor update to disable log publisher url shortening by default. This should get around Steam automatically removing short urls. You can still have your url shortened if you hold Ctrl while publishing.
Also fixed the deprecated version format warning on startup.
Title: Re: [1.0] HugsLib (6.1.3) Lightweight modding library
Post by: UnlimitedHugs on May 14, 2019, 04:59:30 AM
Updated to 6.1.3 (https://github.com/UnlimitedHugs/RimworldHugsLib/releases/tag/v6.1.3)

Some additional tweaks to the log uploader. The confirmation window now has toggles to configure the publishing process. Also, logs are now limited to 10K lines by default to help upload long longs on slower connections.
Title: Re: [1.1] HugsLib (6.2.0) Lightweight modding library
Post by: UnlimitedHugs on February 20, 2020, 11:25:08 AM
Updated to 6.2.0 (https://github.com/UnlimitedHugs/RimworldHugsLib/releases/tag/v6.2.0)

Hey folks, the 1.1 update is live.
Important! This is only a preliminary update to get the ball rolling and let people update and use the log publisher.
A compatibility-breaking update is coming a bit later- hopefully before 1.1 goes live on the stable branch. I have some outstanding API changes I want to make.
If you have any suggestions on HugsLib features that need changing, this is a good time to speak up.

Extra kudos go to diddily and Tobe-Continued on GitHub for their pull requests and doing most of my work for me ;)
Title: Re: [1.1] HugsLib (6.2.0) Lightweight modding library
Post by: Knight on February 21, 2020, 10:51:16 AM
Not sure if I'm being stupid or not but I think HugsLibChecker might be broken for 1.1. I haven't actually played or programmed for Rimworld for a while now so, again, could just be me being stupid. Still, getting the following on startup (when purposely excluding HugsLib - required for my mod):

RimWorld 1.1.2551 rev1075
Verse.Log:Message(String, Boolean)
RimWorld.VersionControl:LogVersionNumber()
Verse.Root:CheckGlobalInit()
Verse.Root:Start()
Verse.Root_Entry:Start()

ReflectionTypeLoadException getting types in assembly UseYourGun: System.Reflection.ReflectionTypeLoadException: Exception of type 'System.Reflection.ReflectionTypeLoadException' was thrown.
  at (wrapper managed-to-native) System.Reflection.Assembly.GetTypes(System.Reflection.Assembly,bool)
  at System.Reflection.Assembly.GetTypes () [0x00000] in <567df3e0919241ba98db88bec4c6696f>:0
  at Verse.ModAssemblyHandler.AssemblyIsUsable (System.Reflection.Assembly asm) [0x00000] in <b8131242147c4f5bbc580697f7726377>:0

Loader exceptions:
   => System.TypeLoadException: Could not resolve type with token 01000018 (from typeref, class/assembly HugsLib.Settings.SettingHandleConvertible, HugsLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null)
   => System.TypeLoadException: Could not resolve type with token 0100001f (from typeref, class/assembly HugsLib.ModBase, HugsLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null)

Verse.Log:Error(String, Boolean)
Verse.ModAssemblyHandler:AssemblyIsUsable(Assembly)
Verse.ModAssemblyHandler:ReloadAll()
Verse.ModContentPack:ReloadContent()
Verse.LoadedModManager:LoadModContent()
Verse.LoadedModManager:LoadAllActiveMods()
Verse.PlayDataLoader:DoPlayLoad()
Verse.PlayDataLoader:LoadAllPlayData(Boolean)
Verse.<>c:<Start>b__6_1()
Verse.LongEventHandler:RunEventFromAnotherThread(Action)
Verse.<>c:<UpdateCurrentAsynchronousEvent>b__27_0()
System.Threading.ThreadHelper:ThreadStart_Context(Object)
System.Threading.ExecutionContext:RunInternal(ExecutionContext, ContextCallback, Object, Boolean)
System.Threading.ExecutionContext:Run(ExecutionContext, ContextCallback, Object, Boolean)
System.Threading.ExecutionContext:Run(ExecutionContext, ContextCallback, Object)
System.Threading.ThreadHelper:ThreadStart()

An exception was caused by the HugsLibChecker assembly. Exception was: System.MissingMethodException: void Verse.LongEventHandler.QueueLongEvent(System.Action,string,bool,System.Action`1<System.Exception>)
  at HugsLibChecker.HugsLibChecker.RunAllChecks () [0x00056] in <17e0364003f64863ad8732cb22ef5516>:0
Verse.Log:Error(String, Boolean)
HugsLibChecker.HugsLibChecker:RunAllChecks()
HugsLibChecker.HugsLibChecker:.ctor(ModContentPack)
System.Reflection.MonoCMethod:InternalInvoke(Object, Object[], Exception&)
System.Reflection.MonoCMethod:InternalInvoke(Object, Object[])
System.Reflection.MonoCMethod:DoInvoke(Object, BindingFlags, Binder, Object[], CultureInfo)
System.Reflection.MonoCMethod:Invoke(BindingFlags, Binder, Object[], CultureInfo)
System.RuntimeType:CreateInstanceImpl(BindingFlags, Binder, Object[], CultureInfo, Object[], StackCrawlMark&)
System.Activator:CreateInstance(Type, BindingFlags, Binder, Object[], CultureInfo, Object[])
System.Activator:CreateInstance(Type, Object[])
Verse.LoadedModManager:CreateModClasses()
Verse.LoadedModManager:LoadAllActiveMods()
Verse.PlayDataLoader:DoPlayLoad()
Verse.PlayDataLoader:LoadAllPlayData(Boolean)
Verse.<>c:<Start>b__6_1()
Verse.LongEventHandler:RunEventFromAnotherThread(Action)
Verse.<>c:<UpdateCurrentAsynchronousEvent>b__27_0()
System.Threading.ThreadHelper:ThreadStart_Context(Object)
System.Threading.ExecutionContext:RunInternal(ExecutionContext, ContextCallback, Object, Boolean)
System.Threading.ExecutionContext:Run(ExecutionContext, ContextCallback, Object, Boolean)
System.Threading.ExecutionContext:Run(ExecutionContext, ContextCallback, Object)
System.Threading.ThreadHelper:ThreadStart()
Title: Re: [1.1] HugsLib (6.2.0) Lightweight modding library
Post by: UnlimitedHugs on February 23, 2020, 02:17:49 PM
Quote from: Knight on February 21, 2020, 10:51:16 AM
I think HugsLibChecker might be broken for 1.1.

Right! Forgot to mention the checker.
Since 1.1 it is deprecated, on account of being no longer needed- the base game will check for (and possibly automatically download) any dependencies you specify for your mod, including HugsLib.
See ModUpdating.txt in you game folder and the update guide by Pardeike (https://gist.github.com/pardeike/08ff826bf40ee60452f02d85e59f32ff) to figure out the syntax to make that happen.
Here's what I believe your About.xml file should include if the mod requires HugsLib:


<modDependencies>
<li>
<packageId>UnlimitedHugs.HugsLib</packageId>
<displayName>HugsLib</displayName>
<downloadUrl>https://github.com/UnlimitedHugs/RimworldHugsLib/releases/latest</downloadUrl>
<steamWorkshopUrl>steam://url/CommunityFilePage/818773962</steamWorkshopUrl>
</li>
</modDependencies>
<loadAfter>
<li>UnlimitedHugs.HugsLib</li>
</loadAfter>


Not tested, but looks about right (famous last words!).
I'll put a deprecation warning on the checker wiki page later.
Title: Re: [1.1] HugsLib (6.2.1) Lightweight modding library
Post by: UnlimitedHugs on February 26, 2020, 12:27:23 AM
Updated to 6.2.1 (https://github.com/UnlimitedHugs/RimworldHugsLib/releases/tag/v6.2.1)

Minor update to fix load order When the Royalty DLC is present.
Also, updated Harmony library to 2.0.0.6.
Title: Re: [1.1] HugsLib (7.0.0) Lightweight modding library
Post by: UnlimitedHugs on February 27, 2020, 03:02:54 PM
Update 7.0.0 pre-release (https://github.com/UnlimitedHugs/RimworldHugsLib/releases/tag/v7.0.0)

Hey fellas.
After much pressing of the keys, the 7.0 update for Rimworld 1.1 is available.
Unlike previously announced, this update does not break compatibility with existing mods for 1.1.
However, some minor fixes may be necessary, and some improvements can be made.
I have prepared an update guide to highlight the key points and save you some time: HugsLib 7.0 for Rimworld 1.1 update guide (https://github.com/UnlimitedHugs/RimworldHugsLib/wiki/HugsLib-7.0-for-Rimworld-1.1-update-guide)

The update is planned to go live on Steam tomorrow.
Do let me know if everything is working for your particular mods as it should.

Extra props to Fluffy for taking care of part of this update- the non-library news loading.
Hugs out.
Title: Re: [1.1] HugsLib (7.0.1) Lightweight modding library
Post by: UnlimitedHugs on February 28, 2020, 07:39:46 AM
Updated to 7.0.1 (https://github.com/UnlimitedHugs/RimworldHugsLib/releases/tag/v7.0.1)

A minor update to bring Harmony up to the latest version.
This update is now live on Steam.
Title: Re: [1.1] HugsLib (7.0.1) Lightweight modding library
Post by: falconne on February 28, 2020, 04:08:26 PM
After I updated my BetterWorkbenchManagement mod to 1.1 and HugsLib 6.2.1, a number of players are getting this error (https://pastebin.com/SEErM9Zu). Only some people get it, others are reporting it's working fine. My first instinct was conflicting versions of Harmony. Do you think this is related to issues you've had with the recent update?

I'm fetching HugsLib v6.2.1 via NuGet, which brings in Lib.Harmony 2.0.0.6. Can you advise what versions of the two I should build against? Should I update to the latest of each or are those still problematic?

For reference this (https://github.com/Falconne/ImprovedWorkbenches/blob/c272aae3f114907b8b1ccba8f4146c6b255b7ede/src/ImprovedWorkbenches/Detours/Bill_DoInterface_Detour.cs) is the patch class here the issue arises.
Title: Re: [1.1] HugsLib (7.0.1) Lightweight modding library
Post by: UnlimitedHugs on February 28, 2020, 04:28:00 PM
Quote from: falconne on February 28, 2020, 04:08:26 PM
Only some people get it, others are reporting it's working fine. My first instinct was conflicting versions of Harmony.
Your instinct is right!

Here is the situation: with the new .NET version we are using in Rimworld 1.1, assembly versions are no longer considered as a criteria to differentiate between them. This means that in previous versions multiple versions of Harmony could coexist, but now only the first one to be loaded is used.

The recommendation is to use Harmony 2.0.0.7 for the duration of Rimworld 1.1.
As before, shipping the Harmony assembly with your mod is only necessary if you don't have a dependency on HugsLib.
Title: Re: [1.1] HugsLib (7.0.1) Lightweight modding library
Post by: falconne on February 28, 2020, 06:17:06 PM
Quote from: UnlimitedHugs on February 28, 2020, 04:28:00 PM
The recommendation is to use Harmony 2.0.0.7 for the duration of Rimworld 1.1.
As before, shipping the Harmony assembly with your mod is only necessary if you don't have a dependency on HugsLib.

Thanks, I'll update the Harmony version I build against. Should I also build against the latest 7.x version of HugsLib? I noticed the versions have gone back and forth a bit.

And yes, I don't ship and bundled version of Harmony or HugsLib. I guess this issue is caused by mods that did and now some people have multiple versions?
Title: Re: [1.1] HugsLib (7.0.1) Lightweight modding library
Post by: UnlimitedHugs on February 29, 2020, 05:55:42 AM
Quote from: falconne on February 28, 2020, 06:17:06 PM
Should I also build against the latest 7.x version of HugsLib? I noticed the versions have gone back and forth a bit.

Yes, HugsLib 7.0.1+ is here to stay. The reverting on Steam was just me scrambling to identify the cause of the conflicts :D
Now that we know what the issue was, so no more reverts.

Quote from: falconne on February 28, 2020, 06:17:06 PM
And yes, I don't ship and bundled version of Harmony or HugsLib. I guess this issue is caused by mods that did and now some people have multiple versions?

Essentially, yes. 2.0.0.7 might have made breaking changes to its API, and once it became the first (and only one) to be loaded, the mods built against 2.0.0.6 were in conflict. Or, the other way around- mods built against 2.0.0.7 were in conflict as their calls were routed to the 2.0.0.6 version (which seems more likely).
Title: Re: [1.1] HugsLib (7.0.1) Lightweight modding library
Post by: IHateRegistering on February 29, 2020, 07:03:37 AM
Something broke my entire 1.0 modlist. Was it the harmony/hugslib thingy that's going on? If so, why? The updates should only affect 1.1 or am I understanding something wrong?
Title: Re: [1.1] HugsLib (7.0.1) Lightweight modding library
Post by: UnlimitedHugs on February 29, 2020, 03:51:42 PM
Updated to 7.0.2 (https://github.com/UnlimitedHugs/RimworldHugsLib/releases/tag/v7.0.2)

Minor update to fix an issue that was preventing setting handles from saving when reset to their default values.

Quote from: IHateRegistering on February 29, 2020, 07:03:37 AM
Something broke my entire 1.0 modlist. Was it the harmony/hugslib thingy that's going on? If so, why? The updates should only affect 1.1 or am I understanding something wrong?

Seems unlikely the 1.1 releases would affect 1.0, unless one of the mods mixed up their assemblies when releasing an update. Post a Ctrl+F12 log- maybe I can tell you more.
Title: Re: [1.1] HugsLib (7.0.2) Lightweight modding library
Post by: falconne on February 29, 2020, 11:35:02 PM
I'm not sure if this is related to HugsLib, but after updating from 6.x, in the Mod Settings dialog, some of my mods randomly show up as "Unnamed Mod". I can force the correct name by adding a Settings.EntryName = "My Mod Name" line into DefsLoaded() but I didn't need to do that before, it always read the Mod name correctly. Could this be related to changes to the Settings handling in the update notes?
Title: Re: [1.1] HugsLib (7.1.0) Lightweight modding library
Post by: UnlimitedHugs on March 01, 2020, 01:24:14 PM
Updated to 7.1.0 (https://github.com/UnlimitedHugs/RimworldHugsLib/releases/tag/v7.1.0)

Important compatibility update.
Unfortunately, the Harmony compatibility issues proved too great to manage. So, the Harmony library is no longer distributed with HugsLib and must be downloaded by the players as a separate mod.
If your mod is dependent on HugsLib, no changes should be necessary, as HugsLib takes care of the dependency tags.
I have added the link to download the mod version of Harmony to the main post.

Quote from: falconne on February 29, 2020, 11:35:02 PM
I'm not sure if this is related to HugsLib, but after updating from 6.x, in the Mod Settings dialog, some of my mods randomly show up as "Unnamed Mod"
Thank you for the report.
Turned out to be an issue on my side, now fixed. No special changes necessary.
Title: Re: [1.1] HugsLib (7.1.0) Lightweight modding library
Post by: ImAllen on March 02, 2020, 05:44:32 AM
Forgive my Noobness its been a year or so. How do I get the Harmony mod to work. Im sure I could remember if I tinkered with it for awhile, but I thought I should ask just in case.
Title: Re: [1.1] HugsLib (7.1.0) Lightweight modding library
Post by: Canute on March 02, 2020, 08:20:10 AM
UnlimitedHugs,
could you please use the link babgozd posted instead of
https://github.com/pardeike/Harmony
because at that github project is no useable mod for noob player.
And please adjust How to install, that it reflect to install and activate Harmony before hugslib.
Title: Re: [1.1] HugsLib (7.1.0) Lightweight modding library
Post by: UnlimitedHugs on March 04, 2020, 08:18:08 AM
Quote from: Canute on March 02, 2020, 08:20:10 AM
could you please use the link babgozd posted
And please adjust How to install, that it reflect to install and activate Harmony before hugslib.

Thanks, got the wrong link. Fixed now.

Quote from: ImAllen on March 02, 2020, 05:44:32 AM
Forgive my Noobness its been a year or so. How do I get the Harmony mod to work. Im sure I could remember if I tinkered with it for awhile, but I thought I should ask just in case.

If you are still wondering, please check the updated "How to install" steps in the main post.
Title: Re: [1.1] HugsLib (7.1.0) Lightweight modding library
Post by: ImAllen on March 04, 2020, 05:32:47 PM
Thanks that got it working. I was trying to put the files in the Hugs mod., Derp.
Title: Re: [1.1] HugsLib (7.1.1) Lightweight modding library
Post by: UnlimitedHugs on March 24, 2020, 07:34:25 AM
Updated to 7.1.1 (https://github.com/UnlimitedHugs/RimworldHugsLib/releases/tag/v7.1.1)

Minor update to address some issues related to the changed mod update news system.
Title: Re: [1.1] HugsLib (7.1.2) Lightweight modding library
Post by: UnlimitedHugs on March 29, 2020, 09:25:06 AM
Updated to 7.1.2 (https://github.com/UnlimitedHugs/RimworldHugsLib/releases/tag/v7.1.2)

This update fixes an issue that was causing the log publisher to ignore the LoadFolders configuration when reporting the assembly file version for loaded assemblies (av, fv).
As a result, the assembly version was being reported correctly, while the assembly file version was read from the same assembly for the 1.0 version of the game.
Also, assembly file version and assembly version will now be logged separately unless they are the same version. Before, assembly file version would only be logged if it was the higher one.
Title: Re: [1.1] HugsLib (7.1.3) Lightweight modding library
Post by: UnlimitedHugs on March 29, 2020, 09:00:50 PM
Updated to 7.1.3 (https://github.com/UnlimitedHugs/RimworldHugsLib/releases/tag/v7.1.3)

Minor fix for a log publisher issue introduced in the previous update.
Title: Re: [1.1] HugsLib (7.1.4) Lightweight modding library
Post by: UnlimitedHugs on April 02, 2020, 05:27:34 AM
Updated to 7.1.4 (https://github.com/UnlimitedHugs/RimworldHugsLib/releases/tag/v7.1.4)

Minor fix for an issue related to translating UpdateFeatureDefs.
Title: HugsLib 7.2 pre-release
Post by: UnlimitedHugs on May 12, 2020, 11:15:11 AM
Updated to 7.2.0 (pre-release) (https://github.com/UnlimitedHugs/RimworldHugsLib/releases/tag/v7.2.0)

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:
The full details and modder-specific changes are available on the HugsLib wiki:
https://github.com/UnlimitedHugs/RimworldHugsLib/wiki/HugsLib-7.2-Update-Notes (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.
Title: Re: [1.1] HugsLib (7.2.0) Lightweight modding library
Post by: falconne on May 20, 2020, 09:11:05 PM
After the 7.2.0 update I have an issue in my Heat Map (https://steamcommunity.com/sharedfiles/filedetails/?id=947972722) 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?
Title: Re: [1.1] HugsLib (7.2.1) Lightweight modding library
Post by: UnlimitedHugs on May 21, 2020, 09:45:14 AM
Updated to 7.2.1 (https://github.com/UnlimitedHugs/RimworldHugsLib/releases/tag/v7.2.1)

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

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 (https://steamcommunity.com/sharedfiles/filedetails/?id=947972722) 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.
Title: Re: [1.1] HugsLib (7.2.1) Lightweight modding library
Post by: falconne on May 22, 2020, 06:49:01 AM
Thanks, yes it works now. Thanks for spotting the HugsLibChecker, I think I forgot to remove the NuGet package from this mod.
Title: Re: [1.2] HugsLib (8.0.0) Lightweight modding library
Post by: UnlimitedHugs on August 12, 2020, 09:12:48 AM
Updated to 8.0.0 (https://github.com/UnlimitedHugs/RimworldHugsLib/releases/tag/v8.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.
Title: Re: [1.2] HugsLib (8.0.0) Lightweight modding library
Post by: LWM on August 12, 2020, 11:22:36 AM
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.
Title: Re: [1.2] HugsLib (8.0.0) Lightweight modding library
Post by: UnlimitedHugs on August 12, 2020, 05:08:04 PM
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.
Title: Re: [1.2] HugsLib (8.0.0) Lightweight modding library
Post by: Kiame on August 12, 2020, 10:39:36 PM
Maybe have it "error" if dev mode is enabled; "warning" otherwise?
Title: Re: [1.2] HugsLib (8.0.1) Lightweight modding library
Post by: UnlimitedHugs on August 15, 2020, 11:48:19 AM
Updated to 8.0.1 (https://github.com/UnlimitedHugs/RimworldHugsLib/releases/tag/v8.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.
Title: Re: [1.2] HugsLib (8.0.1) Lightweight modding library
Post by: LWM on August 15, 2020, 06:39:21 PM
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.

Title: Re: [1.2] HugsLib (8.0.1) Lightweight modding library
Post by: 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?
Title: Re: [1.2] HugsLib (8.0.1) Lightweight modding library
Post by: UnlimitedHugs on August 23, 2020, 06:11:29 PM
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.
Title: Re: [1.2] HugsLib (8.0.1) Lightweight modding library
Post by: 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?
Title: Re: [1.2] HugsLib (8.0.1) Lightweight modding library
Post by: LWM on August 24, 2020, 12:04:52 AM
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...
Title: Re: [1.2] HugsLib (8.0.1) Lightweight modding library
Post by: UnlimitedHugs on August 24, 2020, 03:51:47 AM
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
Title: Re: [1.3] HugsLib (9.0.0) Lightweight modding library
Post by: UnlimitedHugs on July 17, 2021, 03:24:55 AM
Updated to 9.0.0 (https://github.com/UnlimitedHugs/RimworldHugsLib/releases/tag/v9.0.0)

Hey folks!
With Rimworld 1.3 being just around the corner, here's the matching HugsLib update.
Notable changes:
There are a few minor breaking changes, refer to this wiki page for a full list:
HugsLib 9.0 for Rimworld 1.3 API Changes (https://github.com/UnlimitedHugs/RimworldHugsLib/wiki/HugsLib-9.0-for-Rimworld-1.3-API-Changes)
Take care, and as always, let me know if you find any issues.
Title: Re: [1.3] HugsLib (9.0.0) Lightweight modding library
Post by: silentfox12312 on July 29, 2021, 12:53:19 AM
Hello there I had a well an issue with the mod i try disable some mods and try fix the load order but it did not help the game still well not respond when it hits this file "RecipeDef_MultiStage" and then it well crash if u or anyone can help me with this issue it well be apprised  :)
Title: Re: [1.3] HugsLib (9.0.0) Lightweight modding library
Post by: Varsia on August 16, 2021, 08:30:29 AM
I've noticed since the latest Rimworld update that the 'extract tree' option seems to produce an unselectable object and I think that it is because of this.
Title: Re: [1.3] HugsLib (9.0.0) Lightweight modding library
Post by: jolimoliver on August 24, 2021, 08:08:55 AM
Hey, man.

I'm having an issue, whereby, I'm unable to right-click on anything. It just throws an error, and the action menu never appears. I've loaded Visual Exceptions to determine which mod is giving me grief, and it indicates that HugsLib is the one throwing an error (check the logs at the bottom). Here is a link to the error log. Any assistance would be greatly appreciated!

https://gist.github.com/HugsLibRecordKeeper/8daf3ae6f36d322c414e3b0f8c8e69e0
Title: Re: [1.3] HugsLib (9.0.0) Lightweight modding library
Post by: Canute on August 25, 2021, 03:30:33 AM
jolimoliver,
and you think that problem is based on hugslib ? I don't think so.
Read the 2. link from my signature and start to clean up your modlist and forget your savegame.
Title: Re: [1.3] HugsLib (9.0.0) Lightweight modding library
Post by: jolimoliver on August 25, 2021, 05:52:38 AM
That's strange, considering that it's your mod throwing the error. I've not updated anything other than Hugslib, therefore, the issue is related to a change that you would've made. I'll just refer back to a local copy. Thanks for your help.

P.S. I've been modding for years with Rimworld and many other games. It's not my modlist, buddy ;)
Title: Re: [1.3] HugsLib (9.0.0) Lightweight modding library
Post by: Canute on August 25, 2021, 08:16:33 AM
It isn't my mod, i am just a trouble solver at the forum.
Hugslib don't do anything to the game, it is just a libary for other modders, you should know that when you are modding.
There comes 2 possible scenarios in mind that could happen
- old version files inside the mods folder, just complete delete the hugslib folder and install it again.
- not sure what updates are made, but maybe other mod's that need hugslib got trouble with the updates.

But when i look closer to the error there is "FloatMenuMakerMap.AddHumanlikeOrders" these you can find at the patches too. And you will see some mod's are patches these like deep storage,Prison laber, heavy weapon..
Maybe you should look at these things first.

Title: Re: [1.3] HugsLib (9.0.1) Lightweight modding library
Post by: UnlimitedHugs on September 25, 2021, 06:23:29 AM
Updated to 9.0.1 (https://github.com/UnlimitedHugs/RimworldHugsLib/releases/tag/v9.0.1)

Minor fix for the quickstarter- the currently loaded game is now properly cleared before loading a new one. This should help avoid issues during mod development.
Title: Re: [1.3] HugsLib (9.0.0) Lightweight modding library
Post by: semogy on December 03, 2021, 10:33:48 PM
Quote from: jolimoliver on August 25, 2021, 05:52:38 AM
That's strange, considering that it's your mod throwing the error. I've not updated anything other than Hugslib, therefore, the issue is related to a change that you would've made. I'll just refer back to a local copy. Thanks for your help.

P.S. I've been modding for years with Rimworld and many other games. It's not my modlist, buddy ;)
Title: Re: [1.4] HugsLib (10.0.0) Lightweight modding library
Post by: UnlimitedHugs on October 22, 2022, 07:50:25 AM
Updated to 10.0.0 (https://github.com/UnlimitedHugs/RimworldHugsLib/releases/tag/v10.0.0)

Hello folks. The update for RW 1.4 is live.

The most significant changes have been made to the mod settings window. It now displays one mod at a time, and is accessed through the vanilla Options -> Mod options window.
No changes in mods that implement HugsLib settings should be necessary.

Another addition is the support for publishing logs to your own GitHub account. This can be set up by pasting an access token into the input field when unchecking "Use recommended settings" in the Ctrl+F12 window. See the tooltip on the input field for details.

I also removed a few methods that have been annotated as obsolete for a few years now. Hopefully, everyone had time to update their usages.

NuGet update is pending due to login issues. I will try to publish the update there in the coming days.

I appreciate your patience, and as always, let me know if you find any issues.
Title: Re: [1.4] HugsLib (10.0.0) Lightweight modding library
Post by: UnlimitedHugs on October 22, 2022, 10:50:01 AM
Updated to 10.0.1 (https://github.com/UnlimitedHugs/RimworldHugsLib/releases/tag/v10.0.1)

A minor fix for the quickstarter, to allow it to run without being configured first.
Title: Re: [1.4] HugsLib (10.0.1) Lightweight modding library
Post by: lassadar on November 13, 2022, 01:30:10 PM
Sometimes I encounter a bug where pressing the Restart hotkey opens up another instance of the game.
Title: Re: [1.4] HugsLib (10.0.1) Lightweight modding library
Post by: UnlimitedHugs on November 14, 2022, 12:14:46 PM
Quote from: lassadar on November 13, 2022, 01:30:10 PM
Sometimes I encounter a bug where pressing the Restart hotkey opens up another instance of the game.

I noticed that too, although not recently. HugsLib relies on vanilla restart code, so this issue is not something I can easily address from my end.
Title: Re: [1.4] HugsLib (10.0.1) Lightweight modding library
Post by: Multistream on January 14, 2023, 09:24:43 AM
Is it possible to access hugslib log when the ctrl+f12 or ctrl+alt+f12 is not working, or if game crashed?
Title: Re: [1.4] HugsLib (10.0.1) Lightweight modding library
Post by: Canute on January 15, 2023, 08:37:09 AM
Quote from: Multistream on January 14, 2023, 09:24:43 AM
Is it possible to access hugslib log when the ctrl+f12 or ctrl+alt+f12 is not working, or if game crashed?
When the game crash, the normal logfile is the best solution. Use the button at the option to access the logfile location.
To create a hugslib upload you even can use the green button at the error console, but to open the console you need to have developer mode enable, then the top left icon.
Title: Re: [1.4] HugsLib (10.0.1) Lightweight modding library
Post by: Adorablorp on February 27, 2023, 10:08:58 AM
Hi there. Kinda my first time posting a bug report, I hope I'm doing it right and apologies in advance if it doesn't have anything to do with this mod, but I feel like I narrowed it down pretty well.

Modlist:
What happens: When I go into Options>Mod Options and type most, but not all keys into the search bare (i.e. "A"), I get spammed with errors by the debug log. (I usually keep devmode on.) I been having this for months, and finally decided to narrow it down.

This happens when I have HugsLib either by itself (and harmony), or with HugsLib or any other mod installed (i.e. Humanoid Alien Races)

This does not happen when I do not have HugsLib but another mod installed (i.e. HAR (can't exactly access mod options without a mod after all)).

Point is, this happens regardless of whether I have another mod other than Hugslib installed or not. Tested with hHgsLib, HugsLib & HAR, and just HAR. Tested on a completely blank slate game with manual install from GOG and removed localLow files, but it is the same with my Steam install with cluttered game files.

Here's the first of the repeated errors:
QuoteMouse position stack is not empty. There were more calls to BeginScrollView than EndScrollView. Fixing.
UnityEngine.StackTraceUtility:ExtractStackTrace ()
Verse.Log:Error (string)
Verse.Widgets:EnsureMousePositionStackEmpty ()
(wrapper dynamic-method) Verse.Root:Verse.Root.Update_Patch1 (Verse.Root)
Verse.Root_Entry:Update ()
Here's the second of the repeated errors:
QuoteException filling window for RimWorld.Dialog_Options: System.NullReferenceException: Object reference not set to an instance of an object
  at (wrapper dynamic-method) RimWorld.Dialog_Options.RimWorld.Dialog_Options.DoModOptions_Patch0(RimWorld.Dialog_Options,Verse.Listing_Standard)
  at RimWorld.Dialog_Options.DoOptions (Verse.OptionCategoryDef category, UnityEngine.Rect inRect) [0x0011c] in <3f18ad3e53b3425f9e38babcac471e1f>:0
  at RimWorld.Dialog_Options.DoWindowContents (UnityEngine.Rect inRect) [0x000d5] in <3f18ad3e53b3425f9e38babcac471e1f>:0
  at Verse.Window.InnerWindowOnGUI (System.Int32 x) [0x001d3] in <3f18ad3e53b3425f9e38babcac471e1f>:0
UnityEngine.StackTraceUtility:ExtractStackTrace ()
Verse.Log:Error (string)
Verse.Window:InnerWindowOnGUI (int)
UnityEngine.GUI:CallWindowDelegate (UnityEngine.GUI/WindowFunction,int,int,UnityEngine.GUISkin,int,single,single,UnityEngine.GUIStyle)

Here is the pastebin to the full debug log. (https://pastebin.com/7siUXAUz)

Here is the pastebin to the player log. (https://pastebin.com/HUGXp15z)

Here is the pastebin to the "spotted mods" file. (https://pastebin.com/QBfS4dkb)

Maybe it's some weird thing with my own computer only, but I don't have the chance to try another computer at this time. If there's any information I left out that you need please let me know. Not being able to use the mod option's search bar isn't a huge issue but I been dealing with it for a long time and I figured it might have other underlying issues as well.
Title: Re: [1.5] HugsLib (11.0.3) Lightweight modding library
Post by: UnlimitedHugs on March 17, 2024, 03:01:14 PM
Updated to 11.0.3 (https://github.com/UnlimitedHugs/RimworldHugsLib/releases/tag/v11.0.3)

Updated for Rimworld 1.5
- Added mod icon
- Fixed log publisher
Title: Re: [1.5] HugsLib (11.0.3) Lightweight modding library
Post by: Absurdides on March 18, 2024, 12:38:38 PM
Hi Hugs,

I've been unable to load Hugslib successfully since the 1.5 announcement (and I assume there was an accompanying patch, since it was that day this all started).

With a clean mod list except for Harmony & HugsLib (plus Royalty, Ideology, Biotech) I get the following error, which I'll put into a paste.

https://pastebin.com/LYywhahW

I've tried this same clean configuration for every past and the unstable 1.4 versions with the same result.

Please let me know if I can provide further information to track this one down, or if somehow it appears to be operator error some how.

Thanks!
Title: Re: [1.5] HugsLib (11.0.3) Lightweight modding library
Post by: StellarHarbour on March 22, 2024, 11:58:49 PM
[HugsLib][warn] Exception during log publishing (gist creation): System.Exception: HTTP/1.1 400 Bad Request
  at HugsLib.Utils.HugsLibUtility+<>c__DisplayClass22_0.<AwaitUnityWebResponse>b__0 () [0x000a6] in <308e19b03826471faba4b58d6de778a2>:0
UnityEngine.StackTraceUtility:ExtractStackTrace ()
Verse.Log:Warning (string)
HugsLib.Utils.ModLogger:Warning (string,object[])
HugsLib.Logs.LogPublisher:<BeginUpload>b__32_0 (System.Exception)
HugsLib.Utils.HugsLibUtility/<>c__DisplayClass22_0:<AwaitUnityWebResponse>b__0 ()
HugsLib.Utils.DoLaterScheduler:InvokeCallbacks (System.Collections.Generic.Queue`1<System.Action>)
HugsLib.Utils.DoLaterScheduler:OnUpdate ()
HugsLib.HugsLibController:OnUpdate ()
HugsLib.Patches.Root_Patch:UpdateHook ()
(wrapper dynamic-method) MonoMod.Utils.DynamicMethodDefinition:Verse.Root.Update_Patch1 (Verse.Root)
(wrapper dynamic-method) MonoMod.Utils.DynamicMethodDefinition:Verse.Root_Play.Update_Patch0 (Verse.Root_Play)
Title: Re: [1.5] HugsLib (11.0.3) Lightweight modding library
Post by: Yekaterinna on April 12, 2024, 02:35:27 PM
I can generate a log at the beginning of the game but once I click on "New game", I can no longer generate a log because I get the error: HTTP 1.1 400 Bad Request.

This is a log that i generated at the beginning (i don't know if it is useful):

https://gist.github.com/HugsLibRecordKeeper/2cdd1729926229945148ff535e0b84ad