BattletechModders / ModTek

Mod system for HBS's PC game BattleTech.
GNU Lesser General Public License v2.1
121 stars 34 forks source link

Support for CustomResources #122

Closed CptMoore closed 5 years ago

CptMoore commented 5 years ago

In CustomComponents and MechEngineer, ME is adding new configuration entries to CC using static public methods of CC.

Since the base game is configured using json resources anyway (weapons, mechs), mods should have the ability to add custom resources that are handled similar to base game resources. Loading should also be done without a hard dll reference between mods.

The current solution direction discussed on discord is

ok, just a recap, register custom resource type in mod.json, any mod can then define resources of that type in their mod.json, and jsonmerging can apply. then mods can have a ModsLoaded method that ModTek will call once all mods were loaded including the resources merging. That ModLoaded will be given a dictionary of lists for all custom resource types containing all custom resources paths. something like that ~?~ !

Removal of resources would be appreciated but not necessary yet, see #38

mpstark commented 5 years ago

I've got a working prototype in feature branch merged into develop -- I had to do some major cleanup surgery that was a little overdue as well because things were getting very cluttered in ModTek.cs.

CptMoore commented 5 years ago

Cool, Ive looked through the api and that should do it, going to switch MechEngineer to it as en example

CptMoore commented 5 years ago

What happens with advanced json merges? You have to use a target id, but how are those defined for resources without a description.id ?

mpstark commented 5 years ago

ID is first looked for in the JSON, but if nothing found then it defaults to file name without the extension.

mpstark commented 5 years ago

A note, as well, mods will only get the resources that they ask for in their mod.json in their FinishedLoading method.

All of the names are placeholder for now.

CptMoore commented 5 years ago

ok, I'm using it with MechEngineer and CustomComponents and it works without issues

CC registers categories type, ME adds categories, CC processes them