Getting an error when trying to patch another mod (Vanilla Animals Expanded)

Started by Lime_time, September 23, 2020, 02:25:54 PM

Previous topic - Next topic

Lime_time

I am trying to change the type of leather that the Indian Elephant drops in the Vanilla Expanded series. I made a mod that patched the regular core Elephant to drop a new type of leather, and removed Elephant leather from the game. However, even with my mod loaded at the bottom of the order, I keep getting an error message when the Indian Elephant tries to load Elephant leather. What gives? I thought with the patch order, the leather won't be removed until the very last thing. In my patch, the Indian Elephant is patched to drop the new leather, so I don't know why I'm getting an error. Any help would be lovely.

RawCode


Lime_time

Error Log

Could not resolve cross-reference: No Verse.ThingDef named Leather_Elephant found to give to Verse.RaceProperties Verse.RaceProperties
Verse.Log:Error(String, Boolean)
Verse.WantedRefForObject:TryResolve(FailMode)
Verse.<>c__DisplayClass15_1:<ResolveAllWantedCrossReferences>b__0(WantedRef)
Verse.<>c__DisplayClass6_1`1:<ParallelForEach>b__0(Object)
System.Threading.QueueUserWorkItemCallback:WaitCallback_Context(Object)
System.Threading.ExecutionContext:RunInternal(ExecutionContext, ContextCallback, Object, Boolean)
System.Threading.ExecutionContext:Run(ExecutionContext, ContextCallback, Object, Boolean)
System.Threading.QueueUserWorkItemCallback:System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
System.Threading.ThreadPoolWorkQueue:Dispatch()
System.Threading._ThreadPoolWaitCallback:PerformWaitCallback()

Code itself

https://github.com/trublucaribou/optimized-leathers

Shortened modlist

Removed all the ones that are working fine and not throwing an error.

Harmony
Core
Mod Manager
Vanilla Animals Expanded - Tropical Swamp (contains the elephant)
Optimized Leathers (removes the elephant leather)


RawCode

you remove def in use
you get error for it

solution is simple
no not remove it

Lime_time

I don't find that reply very helpful. The def should *not* be in use as my mod patches over the VAE to not need it. I am removing it so it doesn't spawn in traders / gear for raiders / etc.

LWM

The way defs go is this:
First round of defs are loaded.
Patches are run
Crossreferences are resolved  <----error is happening here.

(Somewhere in there, magic defs are generated, including a lot of leather defs and meat)

I think something is referencing the old elephant leather, so when you remove the def, when it gets around to step 3, it goes looking for the def and can't find it.

Search all xml for references to elephant leather to find what else might need patching?  Or maybe something weird is happening in regards the generated defs?

--LWM

ps - mod order doesn't matter.  All it means is that your patches run after VExpanded's patches....which they probably don't bother having.

AileTheAlien

If you want to totally "remove" elephant leather from the game and have elephants drop a new leather, can you patch the elephant leather def to have all the properties of the new leather instead? Description, name, market value, clothing values, etc. If the elephant and leather work similarly to the base game, that should work without errors.

RawCode

there are no reasons to remove defs at all.

what purpose of this action?
to boost performance or what?

Lime_time

I run dozens of mods, including several that add dozens of animals into the game. Rather than have them all drop new leathers, I have consolidated the list down to about 13. I am grouping elephant, rhino, and a few other animals with similar skin into a new group called Thick Leather.


RawCode

Quote from: Lime_time on September 25, 2020, 08:25:55 AM
I run dozens of mods, including several that add dozens of animals into the game. Rather than have them all drop new leathers, I have consolidated the list down to about 13. I am grouping elephant, rhino, and a few other animals with similar skin into a new group called Thick Leather.

this done by single injection that alter implied defs generation and turn all animal specific leather (and meat and other stuff related to butchery) stuff into "GRADE A-B-C-D-E-F Leather".

i asked question, why are you REMOVING defs, instead of replacing them, any reason behind this, or "i made things wrong intentionally and it does not work please help"?


LWM

One advantage of removing the def entirely: it doesn't accidentally show up somewhere in game because there was an unknown reference - you *KNOW* there's another reference because it breaks  ;D ::) :laughs:

Another really nice advantage: it doesn't show up in ThingFilters for storage - if you're trying to store all your leathers by category, having to wade through a dozen Elephant/Gopher/Lynx/Giant Moth/Armadillo/Giant Snail/Tapir/Sloth/Python/Reindeer/Crocodile/Hippo/Macaw/Sea Lion/Meerkat/Auroch/Pug/LLama/Pheasant/Hermit Crab/Space Amoeba/Lion/Wildebeest/Skunk/... what was I saying?