Mods / ArgualCore

Category: #Other
Author: Argual
Side: Both
Created: Apr 21st 2021 at 6:01 PM
Last modified: May 3rd 2021 at 12:43 PM
Downloads: 1261
Follow Unfollow 0

Latest file for v1.14.10:
argualcore_v1.2.1.zip 1-click install


This is a core mod intended to be used in conjunction with other mods.

 

The mod provides some useful functions for modders.

The most important one is a multitool system.
The mod adds the item "Gearstick" by default, and registers a new hotkey named "Gearstick Switch".

The item is easily obtainable, and when the hotkey is triggered while the Gearstick is selected, a dialog opens where the player can select any registered multitool to replace it with. All the other multitools have the same functionality, so by crafting the Gearstick, the player gains access to all other registered multitools.

The main purpose of these multitools is to serve as a "gateway" for mods to introduce recipes without fear of conflicting with other recipes, while avoiding a tool-bloat which would force players to craft and store several such tools in their inventory.

Simply create your own multitool item (without a recipe) and register it in this mod. Then make sure that all recipes you add require that multitool in some way. Either directly or by requiring another item that requires it, and so on. Be sure not to consume the multitool in the recipes.

How to create and register your own multitool:

Reference the .dll in your project, and add this mod as a dependency in the mod config.

Derive your item class from Argual.ArgualCore.MultiTool.ItemMultiTool instead of VintageStory.API.Common.Item.

After registering the item in the api, call RegisterMultiTool(...) from the Argual.ArgualCore.ArgualCoreMod.MultiToolSystem (mod system accessed through api.ModLoader).

Some extra tips:

Instead of hardcoding the language keys or creating duplicates for your own, you can access the keys in this mod's assets through the Argual.ArgualCore.MultiTool.LangKey class.

The item you add does not necessarily need to be a tool, you can simply limit its stack size to 1.

You can add extra functionality to your tool, just derive your own item class from ItemMultiTool and code away.

You can have the attributes on the tool's item stack copied over on switch, just add your attribute's key to the MultiToolSystem via MultiToolSystem.AddWatchedAttributeKey.

You can have customized or tiered multitools. Tools are grouped in a tool family (which you can set when registering a tool).
When a tool switches or is created, it saves its 'family - asset location' combination, and uses it on subsequent switches.

You can create recipes for higher tier tools which require the lower tier tool as ingredient, and when the higher tier tool is created, it will 'remember' the watched attributes from the lower tier one.

Example:

Multitool example (simple, customized, upgradeable)

Finally:

Keep in mind that I'm only a beginner and this is a hobby for me. This may break in the future (or may be broken and I just haven't realized it yet). I do plan to maintain it.

I made this mainly for myself, but if others find it useful, that would be a big bonus for me ;).

Version For Game version Downloads Release date Changelog Download 1-click mod install*
v1.2.1 349 May 3rd 2021 at 12:43 PM Show argualcore_v1.2.1.zip Install now
v1.2.0 317 Apr 27th 2021 at 5:50 PM Show argualcore_v1.2.0.zip Install now
v1.1.0 287 Apr 25th 2021 at 6:36 PM Show argualcore_v1.1.0.zip Install now
v1.0.1 308 Apr 21st 2021 at 6:59 PM Show argualcore_v1.0.1.zip Install now

0 Comments (oldest first | newest first)

(edit comment delete)