Ludeon Forums

Ludeon Forums

  • September 21, 2018, 12:14:48 AM
  • Welcome, Guest
Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1] 2 3 ... 24

Author Topic: [B19] HugsLib (5.0.2) Lightweight modding library  (Read 285020 times)

UnlimitedHugs

  • Super Modder
  • Colonist
  • ***
  • Posts: 538
    • View Profile
[B19] HugsLib (5.0.2) Lightweight modding library
« on: December 15, 2016, 02:20:14 PM »



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
  • The B19 update is out! For a detailed list of changes please refer to this post.
  • HugsLib must be installed as a separate mod by the players. The library itself is not to be included with your mods. You can, however, include the checker assembly to ensure that the player will be notified if they are missing the necessary version of the library (HugsLibChecker).




Features
  • Mod foundation: Base class to build mods on. Extending classes have access to custom logging, settings, and receive the following events from the library controller: Initialize, DefsLoaded, Tick, Update, FixedUpdate, OnGUI, WorldLoaded, MapComponentsInitializing, MapGenerated, MapLoaded, MapDiscarded, SceneLoaded, SettingsChanged.
  • Persistent in-game settings: Implementing mods can create custom settings of various types that can be changed by the player in the new Mod Settings menu. Settings are stored in a file in the user folder.
  • Mod update news: Mods can provide a message for each version they release, highlighting new features. These messages will be shown once to the player the next time he starts the game. This is a good way to ensure that new mod features do not go unnoticed by the majority of players. This is especially true on Steam, where the player may not have even read the description before subscribing. Messages include support for images and basic formatting.
  • Log publisher: Adds a keyboard shortcut (Ctrl+F12) to publish the logs from within the game. Returns a URL that you can share with others or send to a mod author. The published logs also include the list of running mods and their versions, as well as the full list of active Harmony patches. This is a great way for a mod author to get the logs from a player who is experiencing an issue with his mod.
  • Quickstarter: Load a save file or generate a new map with a given scenario and size right after the game is started. Also allows to generate a new map with one click. Settings dialog included.
  • 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. A dialog is displayed if a problem is detected, helping the player to resolve the issue. This is how the library stays up to date. See HugsLibChecker for more info.
  • UtilityWorldObjects: A convenient way to store your data in a save file. Since A16 MapComponents are no longer a reliable way to store your data, and UWO's are designed to be a drop-in replacement.
  • Custom tick scheduling: Includes tools for executing callbacks with a specified tick delay, and registering recurring ticks with non-standard intervals. Recurring ticks are distributed uniformly across the time spectrum, to minimize the performance impact of the ticking entity.
  • Auto-restarter: Automatically restarts the game when the language is changed.
  • Log window additions: Adds a menu to find common files: open the log file and browse the user data and mods folders.
  • Harmony library: HugsLib includes the Harmony library by Andreas Pardeike.

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

Documentation
ModBase reference (start here)
Adding mod settings
World data storage
Mod update news
Introduction to Patching
Custom Tick Scheduling
Development Utilities

Deprecated features (A16)
Detouring
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

How to install
To install using Steam:
  • Click the Subscribe button on the workshop page. Steam will do the rest.
To install manually:
  • Download the latest release using the link below (you want the HugsLib_X.X.X.zip file).
  • Extract to your Rimworld/Mods folder, like any other mod.
  • Enable in the Mods menu. HugsLib should be loaded right after Core.

Download
Latest for B19
Legacy version for B18

Also available on the Steam Workshop:
Official version for B19
Legacy version for B18

Also available on NuGet:
HugsLib, HugsLibChecker
« Last Edit: August 29, 2018, 12:12:05 PM by UnlimitedHugs »
Logged
HugsLib - AllowTool - Remote Tech - Map Reroll - Defensive Positions: Github, Steam

UnlimitedHugs

  • Super Modder
  • Colonist
  • ***
  • Posts: 538
    • View Profile
Re: [A16U] HugsLib (2.0.0) Lightweight modding library
« Reply #1 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:



Code: [Select]
[url=https://ludeon.com/forums/index.php?topic=28066][img]http://i.imgur.com/9L4f8u7.png[/img][/url]
« Last Edit: January 26, 2017, 07:18:51 AM by UnlimitedHugs »
Logged
HugsLib - AllowTool - Remote Tech - Map Reroll - Defensive Positions: Github, Steam

UnlimitedHugs

  • Super Modder
  • Colonist
  • ***
  • Posts: 538
    • View Profile
Re: [A16U] HugsLib (2.0.0) Lightweight modding library
« Reply #2 on: December 15, 2016, 02:21:11 PM »

Reserved.
« Last Edit: December 23, 2016, 01:48:53 AM by UnlimitedHugs »
Logged
HugsLib - AllowTool - Remote Tech - Map Reroll - Defensive Positions: Github, Steam

joaonunes

  • Colonist
  • ***
  • Posts: 483
  • Demacia!!
    • View Profile
Re: [A16U] HugsLib (2.0.0) Lightweight modding library
« Reply #3 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 :)
Logged
Do you want your colonists to look manlier?
Get a free mustache sample here!

UnlimitedHugs

  • Super Modder
  • Colonist
  • ***
  • Posts: 538
    • View Profile
Re: [A16U] HugsLib (2.0.0) Lightweight modding library
« Reply #4 on: December 15, 2016, 03:08:35 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.
« Last Edit: December 15, 2016, 03:11:40 PM by UnlimitedHugs »
Logged
HugsLib - AllowTool - Remote Tech - Map Reroll - Defensive Positions: Github, Steam

joaonunes

  • Colonist
  • ***
  • Posts: 483
  • Demacia!!
    • View Profile
Re: [A16U] HugsLib (2.0.0) Lightweight modding library
« Reply #5 on: December 15, 2016, 03:18:04 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
« Last Edit: December 15, 2016, 03:25:15 PM by joaonunes »
Logged
Do you want your colonists to look manlier?
Get a free mustache sample here!

UnlimitedHugs

  • Super Modder
  • Colonist
  • ***
  • Posts: 538
    • View Profile
Re: [A16U] HugsLib (2.0.0) Lightweight modding library
« Reply #6 on: December 15, 2016, 03:35:20 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.
Logged
HugsLib - AllowTool - Remote Tech - Map Reroll - Defensive Positions: Github, Steam

joaonunes

  • Colonist
  • ***
  • Posts: 483
  • Demacia!!
    • View Profile
Re: [A16U] HugsLib (2.0.0) Lightweight modding library
« Reply #7 on: December 15, 2016, 04:40:43 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?
Logged
Do you want your colonists to look manlier?
Get a free mustache sample here!

UnlimitedHugs

  • Super Modder
  • Colonist
  • ***
  • Posts: 538
    • View Profile
Re: [A16U] HugsLib (2.0.0) Lightweight modding library
« Reply #8 on: December 15, 2016, 05:23:15 PM »

Check is over here- separate project for the companion assembly.

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.
Logged
HugsLib - AllowTool - Remote Tech - Map Reroll - Defensive Positions: Github, Steam

Dingo

  • Colonist
  • ***
  • Posts: 494
  • Mod Author
    • View Profile
    • Steam Profile
Re: [A16U] HugsLib (2.0.0) Lightweight modding library
« Reply #9 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.

joaonunes

  • Colonist
  • ***
  • Posts: 483
  • Demacia!!
    • View Profile
Re: [A16U] HugsLib (2.0.0) Lightweight modding library
« Reply #10 on: December 15, 2016, 07:21:47 PM »

I forgot that feature basically exists in the steam workshop xD
Logged
Do you want your colonists to look manlier?
Get a free mustache sample here!

faltonico

  • Guest
Re: [A16U] HugsLib (2.0.0) Lightweight modding library
« Reply #11 on: December 15, 2016, 08:24:59 PM »

Keep up the good work!
Try to keep it simple always ;)
Logged

joaonunes

  • Colonist
  • ***
  • Posts: 483
  • Demacia!!
    • View Profile
Re: [A16U] HugsLib (2.0.0) Lightweight modding library
« Reply #12 on: December 15, 2016, 09:26:04 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
« Last Edit: December 15, 2016, 09:27:38 PM by joaonunes »
Logged
Do you want your colonists to look manlier?
Get a free mustache sample here!

UnlimitedHugs

  • Super Modder
  • Colonist
  • ***
  • Posts: 538
    • View Profile
Re: [A16U] HugsLib (2.0.0) Lightweight modding library
« Reply #13 on: December 16, 2016, 03:47:26 PM »

Added a wiki page on how to get started with the library: ModBase reference
Logged
HugsLib - AllowTool - Remote Tech - Map Reroll - Defensive Positions: Github, Steam

UnlimitedHugs

  • Super Modder
  • Colonist
  • ***
  • Posts: 538
    • View Profile
Re: [A16U] HugsLib (2.1.0) Lightweight modding library
« Reply #14 on: December 16, 2016, 05:27:36 PM »

Updated to 2.1.0

Added the "Detour by attribute" feature contributed by Fluffy.
Logged
HugsLib - AllowTool - Remote Tech - Map Reroll - Defensive Positions: Github, Steam
Pages: [1] 2 3 ... 24