Editing Module:Test/data/doc

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:
 
== Transformation rules ==
 
== Transformation rules ==
  
=== RimWorld version ===
+
=== RimWorld vesion ===
Version is added to the beginning of each generated Lua table.
+
Vesion is added to the beginning of each generated data file.
  
 
<pre>
 
<pre>
Line 17: Line 17:
 
<defName> is used as part of the index for the main Def table.
 
<defName> is used as part of the index for the main Def table.
  
Additional attributes added: "DLC", "FileName".
+
Additional attribute added: "DLC".
  
 
<pre>
 
<pre>
Line 26: Line 26:
 
</pre>
 
</pre>
  
transforms to:
+
becomes
  
 
<pre>
 
<pre>
Line 40: Line 40:
 
</pre>
 
</pre>
  
Parent (abstract) Def:
+
Parent (absctact) Def that gets inherited:
  
 
<pre>
 
<pre>
Line 50: Line 50:
 
</pre>
 
</pre>
  
transforms to:
+
becomes
  
 
<pre>
 
<pre>
Line 67: Line 67:
 
</pre>
 
</pre>
  
=== List elements without children ===
+
=== Descriptions ===
 +
 
 +
Because of some exceptions in Royalty Defs, <description> content has to be wrapped in double square brackets (Lua multiline syntax).
 +
 
 +
=== <nowiki><li></nowiki> elements without children ===
 
Get transformed into ordered lists (numerically indexed Lua tables).
 
Get transformed into ordered lists (numerically indexed Lua tables).
  
Line 77: Line 81:
 
</pre>
 
</pre>
  
transforms to:
+
becomes
  
 
<pre>
 
<pre>
Line 88: Line 92:
 
Note: a comma after the last item in a list is not flagged as an error in Lua.
 
Note: a comma after the last item in a list is not flagged as an error in Lua.
  
=== List elements with children ===
+
=== <nowiki><li></nowiki> elements with children ===
  
 
<pre>
 
<pre>
Line 107: Line 111:
 
</pre>
 
</pre>
  
transforms to:
+
becomes
  
 
<pre>
 
<pre>
Line 126: Line 130:
 
</pre>
 
</pre>
  
=== List elements with a single attribute Class ===
+
=== <nowiki><li></nowiki> elements with a single attribute "Class" ===
 
The value of the "Class" attribute is used to rename the <nowiki><li></nowiki>.
 
The value of the "Class" attribute is used to rename the <nowiki><li></nowiki>.
  
 
<pre>
 
<pre>
<comps>
+
comps = {
   <li Class="CompProperties_Glower">
+
   {
     <glowRadius>10</glowRadius>
+
    _ = {
 +
      Class = "CompProperties_Glower",
 +
    },
 +
     glowRadius = 10,
 
...
 
...
 
</pre>
 
</pre>
  
transforms to:
+
becomes
  
 
<pre>
 
<pre>
Line 145: Line 152:
 
</pre>
 
</pre>
  
=== Components ===
+
NOTE: The first sample already underwent the transformation of attributes to a subelement.
 
 
It would be useful to have some of the more used components. They can then be queried for additional functionality that some game objects have.
 
 
 
They can be numbered tables or, as in some of the examples above, string indexed. String indexes, in general, are simpler to use. Numeric tables I have to search through.
 
 
 
See [[#List elements with a single attribute Class]]
 
  
 
=== Ranges (1~2) ===
 
=== Ranges (1~2) ===
<pre><overdoseSeverityOffset>0.18~0.35</overdoseSeverityOffset></pre>
+
: TODO
transforms to:
 
<pre>overdoseSeverityOffset = { ["<"]=0.18, [">"]=0.35 },</pre>
 
  
 
=== Curve points ===
 
=== Curve points ===
Line 174: Line 173:
 
</pre>
 
</pre>
  
transforms to:
+
becomes
  
 
<pre>
 
<pre>
Line 187: Line 186:
 
</pre>
 
</pre>
  
=== Descriptions ===
+
=== Components ===
 +
 
 +
It would be useful to have some of the more used components. They can then be queried for additional functionality that some game objects have.
 +
 
 +
They can be numbered tables or, as in some of the examples above, string indexed. String indexes, in general, are simpler to use. Numeric tables I have to search through.
  
Because of some exceptions in Royalty Defs, <description> content has to be wrapped in double square brackets (Lua multiline syntax).
+
See
  
=== MayRequire attribute ===
+
'''TODO:''' implement filtering
Removed.
 
  
 
== Issues ==
 
== Issues ==
Line 209: Line 211:
 
=== Inheritance (interaction with parser) ===
 
=== Inheritance (interaction with parser) ===
 
Inheritance can be handled by the parser or the module. If the parser handles it, then for any change the dataset needs to be recreated so I'm leaning towards letting the module take care of that. In this case the only purpose of the parser is to filter data and transform it into something Lua can use.
 
Inheritance can be handled by the parser or the module. If the parser handles it, then for any change the dataset needs to be recreated so I'm leaning towards letting the module take care of that. In this case the only purpose of the parser is to filter data and transform it into something Lua can use.
 
== TODO ==
 
* Implement filtering for components (any list item that follows the same pattern)
 
 
<includeonly>[[Category:Module]]</includeonly>
 
<noinclude>[[Category:Module documentation]]</noinclude>
 

Please note that all contributions to RimWorld Wiki are considered to be released under the CC BY-SA 3.0 (see RimWorld Wiki:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!

Cancel Editing help (opens in new window)