Modding:Item Json Properties: Difference between revisions

From Vintage Story Wiki
(7 intermediate revisions by 2 users not shown)
Line 2: Line 2:
== Overview ==
== Overview ==
A complete list of all available properties
A complete list of all available properties
Definitions:
'''Key''' - The name of the property, which should be used as it appears in the column.
'''Value''' - A component of a property.
'''Array''' - A list of objects or values that can be referenced in code.
'''String''' - A sequence of characters that can be used as an identifier in code. Essentially a word that can be referenced and assigned to something. Generally does not use numbers.
'''Boolean''' - A true or false value, essentially "on" or "off".
'''Int''' - An integer, or whole number. Cannot use decimal values.
'''Float''' - A decimal, specifically one that does not exceed more than 1 significant digit
'''Object''' - This is a bit more complex, but essentially objects are the items, blocks and entities that can be interacted with. In most cases, when an "object" type appears it means you must use a specific item variant code, which follows the "itemcode-variant_1-variant_2-variant_n" style of naming.


<table id="treeviewtable" class="table table-bordered tt-table" style='table-layout: fixed'>
<table id="treeviewtable" class="table table-bordered tt-table" style='table-layout: fixed'>
Line 48: Line 68:
   <tr>
   <tr>
     <td scope="row"><div class="tt" data-tt-id="p_variantgroups" data-tt-parent="root">variantgroups</div></td>
     <td scope="row"><div class="tt" data-tt-id="p_variantgroups" data-tt-parent="root">variantgroups</div></td>
     <td>array of object</td>
     <td>array of objects</td>
     <td>-</td>
     <td>-</td>
     <td>Allows you define multiple variants of the same item.</td>
     <td>Allows you define multiple variants of the same item.</td>
Line 213: Line 233:
   <tr>
   <tr>
   <td scope="row"><div class="tt" data-tt-id="p_enabled" data-tt-parent="root">allowedVariants</div></td>
   <td scope="row"><div class="tt" data-tt-id="p_enabled" data-tt-parent="root">allowedVariants</div></td>
   <td>array</td>
   <td>array of objects</td>
   <td>-</td>
   <td>-</td>
   <td>Used to trim unnecessary items generated by combined variants. </td>
   <td>Used to trim unnecessary items generated by combined variants. </td>
Line 220: Line 240:
<tr>
<tr>
   <td scope="row"><div class="tt" data-tt-id="p_enabled" data-tt-parent="root">skipVariants</div></td>
   <td scope="row"><div class="tt" data-tt-id="p_enabled" data-tt-parent="root">skipVariants</div></td>
   <td>array</td>
   <td>array of object</td>
   <td>-</td>
   <td>-</td>
   <td>Similar to allowedVariants, but instead skips the creation of listed variants rather than assigning which are allowed. </td>
   <td>Similar to allowedVariants, but instead skips the creation of listed variants rather than assigning which are allowed. </td>
Line 372: Line 392:
  <tr>
  <tr>
     <td scope="row"><div class="tt" data-tt-id="p_attributes_list" data-tt-parent="root">attributes</div></td>
     <td scope="row"><div class="tt" data-tt-id="p_attributes_list" data-tt-parent="root">attributes</div></td>
     <td>key: string, value: object</td>
     <td>-</td>
     <td>-</td>
     <td>-</td>
     <td>Custom Attributes associated with this item.</td>
     <td>Custom Attributes associated with this item.</td>
Line 500: Line 520:
<tr>
<tr>
   <td scope="row"><div class="tt" data-tt-id="p_alist_liquidcontain" data-tt-parent="p_alist_waterprops">containable</div></td>
   <td scope="row"><div class="tt" data-tt-id="p_alist_liquidcontain" data-tt-parent="p_alist_waterprops">containable</div></td>
   <td>true</td>
   <td>boolean</td>
   <td>-</td>
   <td>-</td>
   <td>IF true, the liquid can be placed into liquid containers, such as barrels and buckets.</td>
   <td>If true, the liquid can be placed into liquid containers, such as barrels and buckets.</td>
   <td>waterportion, limewaterportion</td>
   <td>waterportion, limewaterportion</td>
</tr>
</tr>
<tr>
<tr>
   <td scope="row"><div class="tt" data-tt-id="p_alist_iperlitre" data-tt-parent="p_alist_waterprops">itemsPerLitre</div></td>
   <td scope="row"><div class="tt" data-tt-id="p_alist_iperlitre" data-tt-parent="p_alist_waterprops">itemsPerLitre</div></td>
   <td>number</td>
   <td>number (int)</td>
   <td>-</td>
   <td>-</td>
   <td>The number of itemstack items required to make a litre of liquid. Generally this value is 1:1, but concentrated items like honey can be 4:1.</td>
   <td>The number of itemstack items required to make a litre of liquid. Generally this value is 1:1, but concentrated items like honey can be 4:1.</td>
Line 528: Line 548:
<tr>
<tr>
   <td scope="row"><div class="tt" data-tt-id="p_alist_tindex" data-tt-parent="p_alist_waterprops">tintIndex</div></td>
   <td scope="row"><div class="tt" data-tt-id="p_alist_tindex" data-tt-parent="p_alist_waterprops">tintIndex</div></td>
  <td>number (0,1 or 2)</td>
    <td>integer</td>
  <td>-</td>
    <td>0</td>
  <td>An optional liquid property that tints the color of a liquid when in a container. Available options are 0(red), 1(green) and 2(blue).</td>
    <td>Tints the color of the item if it's ever drawn as a block: '''''0''''' for no tint, '''''1''''' for plant climate tint, '''''2''''' for water climate tint.</td>
    <td>-</td>
   <td>waterportion, limewater</td>
   <td>waterportion, limewater</td>
</tr>
</tr>
Line 563: Line 584:
<tr>
<tr>
   <td scope="row"><div class="tt" data-tt-id="p_alist_spillstack" data-tt-parent="p_alist_whenspill">stack</div></td>
   <td scope="row"><div class="tt" data-tt-id="p_alist_spillstack" data-tt-parent="p_alist_whenspill">stack</div></td>
   <td>string</td>
   <td>-</td>
   <td>-</td>
   <td>-</td>
   <td>The block or item dropped when spilled. if the "PlaceBlock" action is chosen a block is placed, if "DropContents" is used an item is generated.</td>
   <td>The block or item dropped when spilled. if the "PlaceBlock" action is chosen a block is placed, if "DropContents" is used an item is generated.</td>
Line 575: Line 596:
   <td>waterportion, limewater</td>
   <td>waterportion, limewater</td>
</tr>
</tr>


<tr>
<tr>
<td scope="row"><div class="tt" data-tt-id="p_attributes_equip" data-tt-parent="root">(Equipment Attributes)</div></td>
<td scope="row"><div class="tt" data-tt-id="p_attributes_info" data-tt-parent="p_alist_waterprops" data-invisible="true"></div></td>
<td colspan="4">
<td colspan="4">
Attributes primarily used with equipment and armor.
 
We'll look at an example of how this property is utilized by water item:
 
<syntaxhighlight lang="json">
waterTightContainerProps: {
  containable: true,
  itemsPerLitre: 1,
  texture: { base: "block/liquid/waterportion" },
  tintIndex: 2,
  whenSpilled: {
    action: "PlaceBlock",
    stack: { type: "block", code: "water-still-3" },
    stackByFillLevel: {
      "10": { type: "block", code: "water-still-7" }
    }
  }
}
</syntaxhighlight>
 
Most is self explanatory, but we can see that it has a some unique features, such as allowing a player to generate a water block when the "fill level" of the container used to spill the fluid. We can also see that the texture for it has a tintIndex of 2, which heightens the blue coloration of the water texture while in a bucket.
</tr>
 
<tr>
<td scope="row"><div class="tt" data-tt-id="p_attributes_equip" data-tt-parent="root">(Equipment Attributes)</div></td>
<td colspan="4">
Attributes primarily used with equipment and armor.
</tr>
</tr>
<tr>
<tr>
Line 616: Line 661:
   <td>Changes the background color of the additional slots provided by the bag. Requires a HEX color code, which you can find with any generic color picker</td>
   <td>Changes the background color of the additional slots provided by the bag. Requires a HEX color code, which you can find with any generic color picker</td>
   <td>miningbag</td>
   <td>miningbag</td>
</tr>
<tr>
  <td scope="row"><div class="tt" data-tt-id="p_alist_clothesinit" data-tt-parent="p_attributes_equip">clothesallowinitialselect</div></td>
  <td>Boolean</td>
  <td>false</td>
  <td>(Unsure, set to false for all armor types).</td>
  <td>armor</td>
</tr>
</tr>
<tr>
<tr>
Line 641: Line 679:
<tr>
<tr>
   <td scope="row"><div class="tt" data-tt-id="p_alist_defprotloss" data-tt-parent="p_attributes_equip">defaultProtLoss</div></td>
   <td scope="row"><div class="tt" data-tt-id="p_alist_defprotloss" data-tt-parent="p_attributes_equip">defaultProtLoss</div></td>
  <td>number</td>
   <td>-</td>
   <td>-</td>
   <td>Defines the default protection loss for incoming damage that is of a higher tier than the armor. Requires the usage of perTierRelativeProtectionLoss and perTIerFlatDamageReductionLoss properties.</td>
  <td>-</td>
   <td>Defines the default protection loss for incoming damage that is of a higher tier than the armor. Requires the usage of perTierRelativeProtectionLoss and perTierFlatDamageReductionLoss properties.</td>
   <td>armor</td>
   <td>armor</td>
</tr>
</tr>
Line 724: Line 762:
The tier of incoming damage is not just a contest of values, but is actually looped through multiple times depending on the tier value to reduce the effectiveness of an armor. For example, tier 4 damage will loop four times and reduces the armor effectiveness each loop, while tier 1 damage will loop only once.  
The tier of incoming damage is not just a contest of values, but is actually looped through multiple times depending on the tier value to reduce the effectiveness of an armor. For example, tier 4 damage will loop four times and reduces the armor effectiveness each loop, while tier 1 damage will loop only once.  


The looped value starts as 1 and As the value increases up to the damage tier it is compared to the tier of the armor. If this increasing value is greater than the armor tier the second second value is used in the perTier function, otherwise the first value is used. Additionally, if the armor has the highDamageTierResistant property set to true then every loop which is higher than the armor will have it's armor reduction halved.  
The looped value starts as 1 and as the value increases up to the damage tier it is compared to the tier of the armor. If this increasing value is greater than the armor tier the second second value is used in the perTier function, otherwise the first value is used. Additionally, if the armor has the highDamageTierResistant property set to true then every loop which is higher than the armor will have it's armor reduction halved.  


Lets look at an example of this using an armor with the following stats:
Lets look at an example of this using an armor with the following stats:
Line 804: Line 842:
<tr>
<tr>
   <td scope="row"><div class="tt" data-tt-id="p_alist_wearattach" data-tt-parent="p_attributes_equip">wearableAttachment</div></td>
   <td scope="row"><div class="tt" data-tt-id="p_alist_wearattach" data-tt-parent="p_attributes_equip">wearableAttachment</div></td>
   <td>-</td>
   <td>boolean</td>
   <td>-</td>
   <td>-</td>
   <td>Designates the item as a wearable object.</td>
   <td>Designates the item as a wearable object.</td>
Line 817: Line 855:
<tr>
<tr>
   <td scope="row"><div class="tt" data-tt-id="p_hlist_exclude" data-tt-parent="p_attributes_handbook">exclude</div></td>
   <td scope="row"><div class="tt" data-tt-id="p_hlist_exclude" data-tt-parent="p_attributes_handbook">exclude</div></td>
   <td>-</td>
   <td>boolean</td>
   <td>-</td>
   <td>-</td>
   <td>If true, removes the item from the handbook. Can be used with the "ByType" functionality to remove large amounts of variants.</td>
   <td>If true, removes the item from the handbook. Can be used with the "ByType" functionality to remove large amounts of variants.</td>
Line 828: Line 866:
   <td>(Needs more info).</td>
   <td>(Needs more info).</td>
   <td>-</td>
   <td>-</td>
</tr>
<tr>
  <td scope="row"><div class="tt" data-tt-id="p_hlist_include" data-tt-parent="p_attributes_handbook">include</div></td>
  <td>boolean</td>
  <td>-</td>
  <td>Allows the toggling of the handbook entry.</td>
  <td>burnedbrick</td>
</tr>
</tr>
<tr>
<tr>
Line 864: Line 909:
   <td>-</td>
   <td>-</td>
</tr>
</tr>
<tr>
<td scope="row"><div class="tt" data-tt-id="p_attributes_info" data-tt-parent="p_attributes_handbook" data-invisible="true"></div></td>
<td colspan="4">


The plumb and square is a good example of how a handbook section is added to the game:
<syntaxhighlight lang="json">
handbook: {
  include: true,
  extraSections: [
    { title: "plumbandsquare-handbook-help-title", text: "plumbandsquare-handbook-help-text" }
  ]
}
</syntaxhighlight>
</tr>




Line 1,520: Line 1,579:
     <td>object</td>
     <td>object</td>
     <td>item default</td>
     <td>item default</td>
     <td>Used for scaling, rotation or offseting the item when rendered in guis.</td>
     <td>Used for scaling, rotation or offsetting the item when rendered in guis.</td>
     <td>Any Item</td>
     <td>Any Item</td>
   </tr>
   </tr>
Line 1,527: Line 1,586:
     <td>object</td>
     <td>object</td>
     <td>item default</td>
     <td>item default</td>
     <td>Used for scaling, rotation or offseting the item when rendered in the first person mode hand.</td>
     <td>Used for scaling, rotation or offsetting the item when rendered in the first person mode hand.</td>
     <td>Any Item</td>
     <td>Any Item</td>
   </tr>
   </tr>
Line 1,534: Line 1,593:
     <td>object</td>
     <td>object</td>
     <td>item default</td>
     <td>item default</td>
     <td>Used for scaling, rotation or offseting the item when rendered in the third person mode hand.</td>
     <td>Used for scaling, rotation or offsetting the item when rendered in the third person mode hand.</td>
     <td>Any Item</td>
     <td>Any Item</td>
   </tr>
   </tr>
Line 1,541: Line 1,600:
     <td>object</td>
     <td>object</td>
     <td>item default</td>
     <td>item default</td>
     <td>Used for scaling, rotation or offseting the rendered as a dropped item on the ground.</td>
     <td>Used for scaling, rotation or offsetting the rendered as a dropped item on the ground.</td>
     <td>Any Item</td>
     <td>Any Item</td>
   </tr>
   </tr>
Line 1,579: Line 1,638:
     <td>strawdummy</td>
     <td>strawdummy</td>
   </tr>
   </tr>
<tr>
<td scope="row"><div class="tt" data-tt-id="p_attributes_info" data-tt-parent="root" data-invisible="true"></div></td>
<td colspan="4">
The following are available animations used by items in the game:
''axe, breaktool, hoe, holdbothhandslarge, holdunderarm, knap, scythe, shears, shoveldig, smithing, spearhit, swordhit, twohandplaceblock, water.


</tr>




219

edits