Modding:Item Json Properties: Difference between revisions

From Vintage Story Wiki
Line 492: Line 492:
     <td>-</td>
     <td>-</td>
     <td>Custom Attributes associated with this item.</td>
     <td>Custom Attributes associated with this item.</td>
    <td>armor, ingot</td>
   </tr>
   </tr>
   <tr>
   <tr>
     <td scope="row"><div class="tt" data-tt-id="p_attributes_info" data-tt-parent="p_attributes" data-invisible="true"></div></td>
     <td scope="row"><div class="tt" data-tt-id="p_attributes_info" data-tt-parent="p_attributes" data-invisible="true"></div></td>
     <td colspan="4">
     <td colspan="4">
Attributes constitute a large number of optional properties that an item can have, many of which are specific to unique items that rely on classes for their functionality. This includes custom values that can be utilized by an item class assigned to your own custom items.
Attributes constitute a large number of custom properties that an item can have, many of which are specific to unique items that rely on classes for their functionality. If you wish to utilize your own custom attributes generally you must have an accompanying class with the item.


Values placed here are final and cannot be modified. For example, if you made a new type of weapon, say a mace that had additional weapon properties (used in an ItemMace class) you could define them here:
Values placed here are final and cannot be modified. For example, if you made a new type of weapon, say a mace that had additional weapon properties (used in an ItemMace class) you could define them here:
Line 502: Line 503:
<syntaxhighlight lang="json">
<syntaxhighlight lang="json">
     attributes: {
     attributes: {
"armordamage": 10,
"armorDamage": 10,
"stunchance": 0.1,
"stunChance": 0.1,
},
},
</syntaxhighlight>
</syntaxhighlight>


Here we have made two new attributes called "armordamage" and "stunchance" and have given them their own static values to be used in code. As is, these cannot do anything without the usage of C# code in a class. Regardless, we can see that this is a convenient way to create new versions of an existing item.  
Here we have made two new attributes called "armorDamage" and "stunChance" and have given them their own static values to be used in code. As is, these cannot do anything without the usage of C# code in a class. Regardless, we can see that this is a convenient way to create extra properties that can be manipulated using variant combinations if desired.  
   </tr>
   </tr>
   <tr>
   <tr>
Line 531: Line 532:
</tr>
</tr>
   <td scope="row"><div class="tt" data-tt-id="p_alist_currency" data-tt-parent="p_attributes_list">currency</div></td>
   <td scope="row"><div class="tt" data-tt-id="p_alist_currency" data-tt-parent="p_attributes_list">currency</div></td>
   <td>array</td>
   <td>-</td>
   <td>-</td>
   <td>-</td>
   <td>Allows an item to be traded as a universal currency.</td>
   <td>Allows an item to be traded as a universal currency.</td>
Line 547: Line 548:
   <td>The ranged damage of a thrown weapon (such as a spear).</td>
   <td>The ranged damage of a thrown weapon (such as a spear).</td>
   <td>spear</td>
   <td>spear</td>
</tr>
  <td scope="row"><div class="tt" data-tt-id="p_alist_dissolve" data-tt-parent="p_attributes_list">dissolveInWater</div></td>
  <td>boolean</td>
  <td>false</td>
  <td>If true, will make an item disappear when dropped into a water block.</td>
  <td>flour, lime, salt</td>
</tr>
  <td scope="row"><div class="tt" data-tt-id="p_alist_fpcon" data-tt-parent="p_attributes_list">firepitConstructable</div></td>
  <td>boolean</td>
  <td>false</td>
  <td>If true, allows an item to be used to construct a firepit.</td>
  <td>firewood, bamboostakes</td>
</tr>
  <td scope="row"><div class="tt" data-tt-id="p_alist_fprops" data-tt-parent="p_attributes_list">fertilizerProps</div></td>
  <td>n: value, p: value, k: value</td>
  <td>-</td>
  <td>Sets the item as a fertilizer and assigns it nitrogen(N), phosphorous(P) and potassium(K) values.</td>
  <td>bonemeal, potash</td>
</tr>
<tr>
<td scope="row"><div class="tt" data-tt-id="p_fert_info" data-tt-parent="p_alist_fprops" data-invisible="true"></div></td>
<td colspan="4">
As an example, we can make a "universal fertilizer" that contributes a decent amount to each element:
<syntaxhighlight lang="json">
fertilizerProps: {n: 20, p: 20, k: 20},
</syntaxhighlight>
</tr>
<tr>
  <td scope="row"><div class="tt" data-tt-id="p_alist_health" data-tt-parent="p_attributes_list">health</div></td>
  <td>health: value</td>
  <td>-</td>
  <td>If the item is a poultice, this is the amount it will heal (requires ItemPoultice class).</td>
  <td>poultice</td>
</tr>
<tr>
  <td scope="row"><div class="tt" data-tt-id="p_alist_playdisc" data-tt-parent="p_attributes_list">isPlayableDisc</div></td>
  <td>boolean</td>
  <td>false</td>
  <td>If true, will be playable on the echo chamber block. Requires a track to be set using the <code>musicTrack</code> property.</td>
  <td>resonancearchive</td>
</tr>
<tr>
  <td scope="row"><div class="tt" data-tt-id="p_alist_knappable" data-tt-parent="p_attributes_list">knappable</div></td>
  <td>boolean</td>
  <td>false</td>
  <td>Allows an item to be "knapped" into primitive toolheads.</td>
  <td>flint, stone</td>
</tr>
<tr>
  <td scope="row"><div class="tt" data-tt-id="p_alist_microchisel" data-tt-parent="p_attributes_list">microBlockChiseling</div></td>
  <td>boolean</td>
  <td>false</td>
  <td>If true, will allow the item to be used for microblock chiseling.
NOTE: Microblock chiseling must also be active in the world settings.
</td>
  <td>chisel</td>
</tr>
<tr>
  <td scope="row"><div class="tt" data-tt-id="p_alist_munits" data-tt-parent="p_attributes_list">metalUnits</div></td>
  <td>number</td>
  <td>-</td>
  <td>Assigns the units of metal the item contributes when it is smelted.
NOTE: An item must be smeltable for this property to be of any use, make sure to check the combustableProps section for more info.
</td>
  <td>resonancearchive</td>
</tr>
<tr>
  <td scope="row"><div class="tt" data-tt-id="p_alist_mtrack" data-tt-parent="p_attributes_list">musicTrack</div></td>
  <td>path to ogg file</td>
  <td>-</td>
  <td>Assigns a path to the ogg file of the music track associated with an item that can be played on the echo chamber block. Will only function if the <code>isPlayableDisc</code> property is set to true.</td>
  <td>resonancearchive</td>
</tr>
<tr>
  <td scope="row"><div class="tt" data-tt-id="p_alist_pigment" data-tt-parent="p_attributes_list">isPlayableDisc</div></td>
  <td>-</td>
  <td>-</td>
  <td>Allows an item to be used as a pigment for coloring.</td>
  <td>resonancearchive</td>
</tr>
<tr>
  <td scope="row"><div class="tt" data-tt-id="p_pigment_name" data-tt-parent="p_alist_pigment">name</div></td>
  <td>string</td>
  <td>-</td>
  <td>Assigns a name to the color of the pigment.</td>
  <td>charcoal</td>
</tr>
<tr>
  <td scope="row"><div class="tt" data-tt-id="p_pigment_rgb" data-tt-parent="p_alist_pigment">color</div></td>
  <td> red:value, green: value, blue: value</td>
  <td>-</td>
  <td>The RGB values of the pigment, which can be found using any generic color picker.</td>
  <td>charcoal</td>
</tr>
<tr>
<td scope="row"><div class="tt" data-tt-id="p_pigment_example" data-tt-parent="p_alist_pigment" data-invisible="true"></div></td>
<td colspan="4">
As an example, let's say you wanted to make a valuable purple pigment from the shell of a rare rock snail:
<syntaxhighlight lang="json">
"pigment": {
          "name": "Tyrian Purple",
          "color": {
            "red": 102,
            "green": 2,
            "blue": 60
            }
          },
</syntaxhighlight>
Here we can see that the pigment will be named "Tyrian Purple", and is made with the three RGB values we found from a wikipedia entry.
</tr>
</tr>
   <tr>
   <tr>
219

edits