Ludeon Forums

RimWorld => Mods => Help => Topic started by: Architect on April 14, 2014, 05:12:58 PM

Title: C# RimWorld info snippets
Post by: Architect on April 14, 2014, 05:12:58 PM
For those interested in C# programming and who may have run into issues you feel could benefit others, I was thinking you all could feel free to post them here. I'd appreciate it if this thread could be limited purely to questions followed by solutions, so no experimental or theoretical things :P

I'll start off with posting the most recent issue I had as it took place here:
Quote from: Tynan on April 14, 2014, 03:57:55 PM
Deconstruction requires that the faction be set. You can only deconstruct your own stuff. Yes, all building have a faction; maybe I should remove this because it's insensible. But anyway.

So just do

Thing t = ThingMaker.MakeThing( def );
t.SetFactionDirect( Faction.OfColony );
GenSpawn.Spawn(t, pos);

Note the use of SetFactionDirect during init.