Skip to content

Instantly share code, notes, and snippets.

@321nick
Created October 13, 2019 05:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 321nick/248bfe93c15b9f53bcc865607e2aa72d to your computer and use it in GitHub Desktop.
Save 321nick/248bfe93c15b9f53bcc865607e2aa72d to your computer and use it in GitHub Desktop.
Greetings sir or ma'am or however you prefer to be addressed, it seems your mod is currently overwriting BaseWeapon,BaseHumanGun,BaseHumanMakeableGun,BaseMakeableGun,BaseGun,BaseProjectileNeolithic,BaseWeaponNeolithic and it's causing issues for other mods and the people who use both those and yours. I'd like to request that this be changed so that things don't break quuuite as often as they tend to. An explanation of what overwriting bases is and a different way to do inheritance is below. I hope you have a good rest of your day/night/eternal twilight on a stationary planetoid.
Explanation courtesy of Jamaican Castle on the main Rimworld Discord-
"Well, when you set ParentName="whatever" in the XML for a def, it goes for a def with Name="whatever" and puts all of the parent's tags in the child, unless the child overwrites them by having the same tags.
In the distant past, Rimworld wouldn't look outside of your own mod package for Name="whatever", so if there was a standard parent for a type of def - usually called a "base" because most of the vanilla ones have Base somewhere in their names - you'd have to define your own. For instance, vanilla pawns all inherit (directly or through an intermediary) from BasePawn. You couldn't do the same because it wouldn't find it, so many modders defined their own BasePawn.
Nowadays (since, I think, about A17) it correctly finds the named parent wherever it is, so you can inherit directly from vanilla bases. That's good. But it also means that if your mod defines a base with the same name as vanilla, it overwrites the vanilla one, and whatever changes you made propagate to many other things and generally cause problems.
Compounding the problem is that a lot of mods that do overwrite vanilla bases do so because they haven't been updated (or that part of them hasn't been updated) in a long time, so they tend to overwrite with outdated versions of the base.
If you're going to inherit from a vanilla base, just do so. Don't add a definition for that base. For example if I have one pawn, I can just put ParentName="BasePawn" and have done with it. I don't need to (and shouldn't) write my own BasePawn.
If you want to have your own base, name it something different from vanilla, like MyModBasePawn or somesuch."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment