Topic on Talk:Modding Tutorials/ThingComp
Jump to navigation
Jump to search
This is a permanent link to the first version of this post.
You can view later versions on the post history page.
Parents don't have to be long:
<ThingDef Name ="ParentOneWithDefaultCompValues" ParentName ="BaseHumanMakeableGun"> <comps> <li Class "ExampleNameSpace.ExampleCompProperties"> <exampleFloat>0.05</exampleFloat> </li> </comps>
And that's a new XML parent defined. If you want to use the version without the Comp, you'd inherit from one up the chain. In this example BaseHumanMakeableGun.
You mean this part; taking out the last entry of the comp.
MyCompProprtiesWithDefault[] list = this.parent.GetComps<MyCompPropertiesWithDefault>().ToArray(); // Remove everything but the last entry; harmless if only one entry: for (var i = 0; i < list.Length-1; i++) { this.parent.AllComps.Remove(list[i]); }
The code is valid, but for some reason it just doesn't sit right with me. Why add stuff only to remove it again? Why three default values? (C#, compProps #1, and then a third in compProps #3?)