Is it possible to override assemblies?

Started by roenais, December 22, 2017, 07:46:09 PM

Previous topic - Next topic

roenais

Not sure if I worded that title correctly, but what I mean is this: can you create .cs files that share a name with ones that come within Assembly-CSharp to automatically replace things, like how you do with defs? Say I wanted to change every instance of "Male" to "Boy" or something. I've tried just copying over the code into a new Visual Basic project,  but when I go to build I get the error "The namespace 'Verse' already contains a definition for 'Gender'. Is it genuinely not possible, or am I going about it wrong?

Jaxxa

No, Yes, Maybe but its not as simple as that.
You cant just copy and replace something as you have found out.

You can however use Harmony Patches to Patch calls to Methods, this can replace calls to the method with whatever code you want.
Have a look in the thread and read the wiki /example programs for how it works.

https://ludeon.com/forums/index.php?topic=29517.0

CannibarRechter

> Is it genuinely not possible, or am I going about it wrong?

I'm confused about what you are trying to achieve. Are you trying to make the core itself use different classes? If you are, you would have to update all the calling references in the core, not just the definitions.

If you genuinely want a copy of something, you can totally do that, but you have to rename the instances of everything you copied, otherwise you will get the errors you saw.
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