Editing Modding Tutorials/DefModExtension
Jump to navigation
Jump to search
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 1: | Line 1: | ||
+ | {{stub}} | ||
{{BackToTutorials}} | {{BackToTutorials}} | ||
− | A DefModExtension is a way to add fields to Defs. DefModExtensions are a simple way to extend functionality to a Def | + | A DefModExtension is a way to add fields to Defs. DefModExtensions are a simple way to extend functionality to a Def. |
'''Benefits''':<br/> | '''Benefits''':<br/> | ||
Line 16: | Line 17: | ||
<nowiki>-</nowiki> Can't save data.<br/> | <nowiki>-</nowiki> Can't save data.<br/> | ||
<nowiki>-</nowiki> Only works on Defs.<br/> | <nowiki>-</nowiki> Only works on Defs.<br/> | ||
− | |||
=Requirements= | =Requirements= | ||
Line 28: | Line 28: | ||
<source lang="csharp"> | <source lang="csharp"> | ||
using Verse; | using Verse; | ||
+ | using RimWorld; | ||
namespace ExampleNameSpace | namespace ExampleNameSpace | ||
{ | { | ||
− | public class | + | public class RimQuest_ModExtension : DefModExtension |
{ | { | ||
public bool canBeARimQuest = true; | public bool canBeARimQuest = true; | ||
Line 38: | Line 39: | ||
</source> | </source> | ||
That's it. DefModExtensions can of course contain any field you wish: a C# Type, a Thingfilter, a list -- but for the sake of a simple example, we'll use a bool. | That's it. DefModExtensions can of course contain any field you wish: a C# Type, a Thingfilter, a list -- but for the sake of a simple example, we'll use a bool. | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
=See also= | =See also= | ||
[https://ludeon.com/forums/index.php?topic=46351.0 Ludeon thread on Mod Extensions]<br> | [https://ludeon.com/forums/index.php?topic=46351.0 Ludeon thread on Mod Extensions]<br> | ||
− | [https://github.com/jecrell/RimQuest/commit/54413b821233316c4057db87031aa6e528ab2db6 The pull request | + | [https://github.com/jecrell/RimQuest/commit/54413b821233316c4057db87031aa6e528ab2db6 The pull request the code this article is based on] |
[[Category: Modding]] | [[Category: Modding]] | ||
[[Category: Modding tutorials]] | [[Category: Modding tutorials]] |