New A17 Mod Features

Started by ZorbaTHut, May 23, 2017, 10:46:46 AM

Previous topic - Next topic

ZorbaTHut

Quote from: Rikiki on June 03, 2017, 04:10:37 PM
I am now trying to change the texture of some meat the same way but... it appears that the patches are performed before the implied meat defs generation.
In term of code: in Verse.PlayDataLoader.DoPlayLoad, LoadedModManager.LoadAllActiveMods is called before DefGenerator.GenerateImpliedDefs_PreResolve.

Do you have a solution to this? ::)
Thanks!

Yep, that's true. There isn't any XML-only way to do this; you'd want to either modify the def after implied generation occurs, or use a tool like Harmony to intercept meat def generation and modify it at generation time (this solution is probably better, though more complicated.)

BlackSmokeDMax

Is the use of Mod Options something that is only able to be set with mods using C# or is that something that can be implemented in XML as well?

ZorbaTHut

C# only - there isn't any support in XML for variables or flags, so there isn't really a way for that to function.

BlackSmokeDMax

Quote from: ZorbaTHut on June 12, 2017, 03:16:42 PM
C# only - there isn't any support in XML for variables or flags, so there isn't really a way for that to function.

Thanks for the reply! Guess that will just have to be beyond me for now!

CannibarRechter

Hi, is patch operation test expected to be able to work on ModMetaData? For example:

<Operation Class="PatchOperationSequence">
<success>Always</success>
<operations>

    <li Class="PatchOperationTest">
      <xpath>*/ModMetaData[name = "Something"]</xpath>
    </li>
...


????
CR All Mods and Tools Download Link
CR Total Texture Overhaul : Gives RimWorld a Natural Feel
CR Moddable: make RimWorld more moddable.
CR CompFX: display dynamic effects over RimWorld objects

Nightinggale

Quote from: ZorbaTHut on May 23, 2017, 10:46:46 AM
Mod Class

Mods can now inherit from the class Verse.Mod. All non-abstract classes inheriting from Verse.Mod are constructed immediately after all mods and defs are loaded, and before virtually anything else happens;
That's not true for B18 (not sure about A17). The order is as follows:


  • The list LoadedModManager.runningMods adds ModContentPack for each mod
  • Assemblies are loaded*
  • Verse.Mod class instances are allocated and the constructors are called
  • Defs are loaded and patched
  • Lots of other stuff

*The code has a bit more and does this:
public void ReloadContent()
{
LongEventHandler.ExecuteWhenFinished(delegate
{
this.audioClips.ReloadAll();
this.textures.ReloadAll();
this.strings.ReloadAll();
});
this.assemblies.ReloadAll();
}


Quote from: ZorbaTHut on May 23, 2017, 10:46:46 AMit's a good place to put startup functionality. These are intended as singletons, and are constructed as such.
This is true and in fact it's even more useful the earlier it's called. ModCheck uses Harmony Transpiler to inject code into the Defs loading code to read current mod, file and patch (it's read only, the actual Def loading code behavior is unmodified). Obviously this wouldn't be possible if Verse.Mod constructors were to be called after loading Defs.
ModCheck - boost your patch loading times and include patchmods in your main mod.