Any particular reason you removed the examples of how to access parts of the comp properties? I know those would have been very useful to me when I was first creating a custom comp class.
Topic on Talk:Modding Tutorials/ThingComp
Jump to navigation
Jump to search
Reply to "Removed example?"
https://rimworldwiki.com/wiki/Modding_Tutorials/ThingComp#Accessing_your_CompProperties
Still there, just simplified.
The code on the previous example had some unsafe casting that would've led to runtime exceptions. Not all Things are ThingsWithComps, and even GetComp<> can return null. --Mehni (talk)
I think a more complicated example is actually fairly useful. I see what you mean by the potentially unsafe casting - I wrote the example as if the safety checks had already been done (because for me, they had been), but that checking would be good to have in an example.
I would lean towards putting the "More Complicated" example back in, with safeguards.
Feel free to edit ^^