Having a hard time figuring out how to start

Started by Sarcadistic, July 28, 2021, 02:36:56 PM

Previous topic - Next topic

Sarcadistic

Hey, I'm trying to make a first mod, but even with the tutorials supplied on the wiki, I'm having a hard time figuring things out.
An important part of my mod would be having a melee weapon that only works on mechanoids, and then instantly kills them. I can figure out the XML part, like changing the name, stats and texture, but using C# to check if the thing at the receiving end of the melee attack is a mechanoid? No idea. I've tried decompiling and searching around but I've just got no idea what to look for.

A push in the right direction would be highly appreciated  :)

llunak

Search the decompiled sources for a word or an identifier that should be relevant. In your case, there are several files that have Mechanoid in the name, and looking at QuestGen/QuestNode_IsMechanoid.cs suggests that mechanoids have RaceProperties.IsMechanoid set. And searching for IsMechanoid shows that the check is "pawn.RaceProps.IsMechanoid".

RawCode

alternative check is "canbleed" and treat all pawns that can't bleed as mechanical, helps with mod compatability.