Modding:Block Json Properties: Difference between revisions

From Vintage Story Wiki
no edit summary
(Undo revision 3841 by CreativeMD (talk))
No edit summary
(9 intermediate revisions by 4 users not shown)
Line 4: Line 4:


<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'>
   <tr style='background-color: gray;'>
   <tr>
     <th width='300' align='left'>Property</th>
     <th width='300' align='left'>Property</th>
     <th width='200' align='left'>Type</th>
     <th width='200' align='left'>Type</th>
Line 17: Line 17:
   </tr>
   </tr>
   <tr>
   <tr>
     <td colspan="4" style='font-size: 14pt; border-bottom: 2pt solid black; padding-left: 100px;'><b>Core (no byType available)</b></td>
     <td colspan="4" class="propHeader"><b>Core (no byType available)</b></td>
   </tr>
   </tr>
   <tr>
   <tr>
Line 89: Line 89:
----
----


Futhermore there are two ways of combining groups together. So far we covered the default combination mode, which is <code>multiplicative</code> (the total count of variants is the product of all states).
Furthermore there are two ways of combining groups together. So far we covered the default combination mode, which is <code>multiplicative</code> (the total count of variants is the product of all states).


Let's take a look at a different example (flowerpot), which uses the <code>additive</code> combination mode:
Let's take a look at a different example (flowerpot), which uses the <code>additive</code> combination mode:
Line 173: Line 173:
"*-south-*-closed-right": 180
"*-south-*-closed-right": 180
}
}
},
</syntaxhighlight>
Since Vintagestory v1.8 it is also possible to use the variantgroup as a placeholder:
<syntaxhighlight lang="json">
variantgroups: [
{ code: "type", states: ["normal", "bamboo"] },
],
textures: {
horizontals: { base: "block/hay/{type}-side" },
verticals: { base: "block/hay/{type}-top" },
},
},
</syntaxhighlight>
</syntaxhighlight>
Line 178: Line 189:
   </tr>
   </tr>
   <tr>
   <tr>
     <td colspan="4" style='font-size: 14pt; border-bottom: 2pt solid black; padding-left: 100px;'><b>Specific</b></td>
     <td colspan="4" class="propHeader"><b>Specific</b></td>
   </tr>
   </tr>
   <tr>
   <tr>
Line 208: Line 219:
     <td>array of object</td>
     <td>array of object</td>
     <td>-</td>
     <td>-</td>
     <td>A behavior adds custom abilities such as falling block..</td>
     <td>A behavior adds custom abilities such as falling block.</td>
   </tr>
   </tr>
   <tr>
   <tr>
     <td scope="row"><div class="tt" data-tt-id="p_behaviors_info" data-tt-parent="p_behaviors" data-invisible="true"></div></td>
     <td scope="row"><div class="tt" data-tt-id="p_behaviors_info" data-tt-parent="p_behaviors" data-invisible="true"></div></td>
     <td colspan="3">
     <td colspan="3">
Here is an overview of all exisiting behaviors, if you want to create your own custom behavior you can read [[Adding Block Behavior]].
Here is an overview of most exisiting behaviors, if you want to create your own custom behavior you can read [[Adding Block Behavior]].
To see all of the current behaviors in the game see [[Json:block:behaviors|All Block Behaviors]]
{{:json:block:behavior}}
{{:json:block:behavior}}
</td>
</td>
Line 285: Line 297:
Same examples of resistance's values used in VintageStory:
Same examples of resistance's values used in VintageStory:
<table class="wikitable">
<table class="wikitable">
   <tr style="background-color: grey;">
   <tr style="background-color: rgba(0,0,0,0.2);">
     <th style="background-color: grey;">Block</th>
     <th style="background-color: rgba(0,0,0,0.2);">Block</th>
     <th style="background-color: grey;">Value</th>
     <th style="background-color: rgba(0,0,0,0.2);">Value</th>
   </tr>
   </tr>
   <tr>
   <tr>
Line 330: Line 342:
     <td colspan="3">
     <td colspan="3">
<table class="wikitable">
<table class="wikitable">
   <tr style="background-color: grey;">
   <tr style="background-color: rgba(0,0,0,0.2);">
     <th style="background-color: grey;">Tier</th>
     <th style="background-color: rgba(0,0,0,0.2);">Tier</th>
     <th style="background-color: grey;">Ores</th>
     <th style="background-color: rgba(0,0,0,0.2);">Ores</th>
   </tr>
   </tr>
   <tr>
   <tr>
Line 479: Line 491:
     <td colspan="3">
     <td colspan="3">
<table class="wikitable">
<table class="wikitable">
   <tr style="background-color: grey;">
   <tr style="background-color: rgba(0,0,0,0.2);">
     <th style="background-color: grey;">Value</th>
     <th style="background-color: rgba(0,0,0,0.2);">Value</th>
     <th style="background-color: grey;">Effect (Blocks)</th>
     <th style="background-color: rgba(0,0,0,0.2);">Effect (Blocks)</th>
   </tr>
   </tr>
   <tr>
   <tr>
Line 520: Line 532:
     <td colspan="3">
     <td colspan="3">
<table class="wikitable">
<table class="wikitable">
   <tr style="background-color: grey;">
   <tr style="background-color: rgba(0,0,0,0.2);">
     <th style="background-color: grey;">Value</th>
     <th style="background-color: rgba(0,0,0,0.2);">Value</th>
     <th style="background-color: grey;">Effect</th>
     <th style="background-color: rgba(0,0,0,0.2);">Effect</th>
   </tr>
   </tr>
   <tr>
   <tr>
Line 549: Line 561:
     <td colspan="3">
     <td colspan="3">
<table class="wikitable">
<table class="wikitable">
   <tr style="background-color: grey;">
   <tr style="background-color: rgba(0,0,0,0.2);">
     <th style="background-color: grey;">Blocks</th>
     <th style="background-color: rgba(0,0,0,0.2);">Blocks</th>
     <th style="background-color: grey;">Value</th>
     <th style="background-color: rgba(0,0,0,0.2);">Value</th>
   </tr>
   </tr>
   <tr>
   <tr>
Line 592: Line 604:
     <td colspan="3">
     <td colspan="3">
<table class="wikitable">
<table class="wikitable">
   <tr style="background-color: grey;">
   <tr style="background-color: rgba(0,0,0,0.2);">
     <th style="background-color: grey;">Blocks</th>
     <th style="background-color: rgba(0,0,0,0.2);">Blocks</th>
     <th style="background-color: grey;">Value</th>
     <th style="background-color: rgba(0,0,0,0.2);">Value</th>
   </tr>
   </tr>
   <tr>
   <tr>
Line 617: Line 629:
     <td colspan="3">
     <td colspan="3">
<table class="wikitable">
<table class="wikitable">
   <tr style="background-color: grey;">
   <tr style="background-color: rgba(0,0,0,0.2);">
     <th style="background-color: grey;">Blocks</th>
     <th style="background-color: rgba(0,0,0,0.2);">Blocks</th>
     <th style="background-color: grey;">Value</th>
     <th style="background-color: rgba(0,0,0,0.2);">Value</th>
   </tr>
   </tr>
   <tr>
   <tr>
Line 658: Line 670:


<table class="wikitable">
<table class="wikitable">
   <tr style="background-color: grey;">
   <tr style="background-color: rgba(0,0,0,0.2);">
     <th style="background-color: grey;">Property</th>
     <th style="background-color: rgba(0,0,0,0.2);">Property</th>
     <th style="background-color: grey;">Default</th>
     <th style="background-color: rgba(0,0,0,0.2);">Default</th>
<th style="background-color: grey;">Explanation</th>
<th style="background-color: rgba(0,0,0,0.2);">Explanation</th>
   </tr>
   </tr>
   <tr>
   <tr>
Line 733: Line 745:
'''''var''''': How much the drop rate can vary. Meaning the drop rate can be <code>avg - var</code> at minimum and <code>age + var</code> at maximum.
'''''var''''': How much the drop rate can vary. Meaning the drop rate can be <code>avg - var</code> at minimum and <code>age + var</code> at maximum.


Futhermore you can also switch between different distribution modes using the '''''dist''''' property.
For more information see [[NatFloat]] page.
 
<table class="wikitable mw-collapsible mw-collapsed">
  <tr>
<th colspan="2">Overview - Distribution modes</th>
  </tr>
  <tr style="background-color: grey;">
    <th style="background-color: grey;">Name</th>
<th style="background-color: grey;">Explanation</th>
  </tr>
  <tr>
    <td>'''uniform'''</td>
<td>''Select completely random numbers within avg-var until avg+var.''</td>
  </tr>
  <tr>
    <td>'''triangle'''</td>
<td>''Select random numbers with numbers near avg being the most commonly selected ones, following a triangle curve.''</td>
  </tr>
  <tr>
    <td>'''gaussian'''</td>
<td>''Select random numbers with numbers near avg being the most commonly selected ones, following a gaussian curve.''</td>
  </tr>
  <tr>
    <td>'''narrowgaussian'''</td>
<td>''Select random numbers with numbers near avg being the most commonly selected ones, following a narrow gaussian curve.''</td>
  </tr>
  <tr>
    <td>'''inversegaussian'''</td>
<td>''Select random numbers with numbers near avg being the least commonly selected ones, following an upside down gaussian curve.''</td>
  </tr>
  <tr>
    <td>'''narrowinversegaussian'''</td>
<td>''Select random numbers with numbers near avg being the least commonly selected ones, following an upside down gaussian curve.''</td>
  </tr>
  <tr>
    <td>'''invexp'''</td>
<td>''Select numbers in the form of avg + var, wheras low value of var are preferred.''</td>
  </tr>
  <tr>
    <td>'''stronginvexp'''</td>
<td>''Select numbers in the form of avg + var, wheras low value of var are strongly preferred.''</td>
  </tr>
  <tr>
    <td>'''strongerinvexp'''</td>
<td>''Select numbers in the form of avg + var, wheras low value of var are very strongly preferred.''</td>
  </tr>
<tr>
    <td>'''dirac'''</td>
<td>''Select completely random numbers within avg-var until avg+var only ONCE and then always 0.''</td>
  </tr>
</table>


----
----
Line 911: Line 873:
   </tr>
   </tr>
   <tr>
   <tr>
     <td colspan="4" style='font-size: 14pt; border-bottom: 2pt solid black; padding-left: 100px;'><b>Common</b></td>
     <td colspan="4" class="propHeader"><b>Common</b></td>
   </tr>
   </tr>
   <tr>
   <tr>
Line 1,002: Line 964:
     <td>key: string, value: object</td>
     <td>key: string, value: object</td>
     <td>-</td>
     <td>-</td>
     <td>Custom Attributes that's always assiociated with this item.</td>
     <td>Custom Attributes associated with this block.</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="3">
     <td colspan="3">
Extra attributes added to a block. Those are final and cannot be modified. It's a good way to keep things oragnized and and modifiable. The '''oreblastingbomb''' for example has attributes, which define its radius and type. These can be used by behaviors and blockentities:
Extra attributes added to a block. Those are final and cannot be modified. It's a good way to keep things organized and and modifiable. The '''oreblastingbomb''' for example has attributes, which define its radius and type. These can be used by behaviors and blockentities:
<syntaxhighlight lang="json">
<syntaxhighlight lang="json">
     attributes: {
     attributes: {
Line 1,087: Line 1,049:
</syntaxhighlight>
</syntaxhighlight>


Futhermore it can be used to define smelting processes. An example would be an '''ingotmold''' which turns into an ingotmold-burned:
Furthermore it can be used to define smelting processes. An example would be an '''ingotmold''' which turns into an ingotmold-burned:
<syntaxhighlight lang="json">
<syntaxhighlight lang="json">
     combustiblePropsByType: {
     combustiblePropsByType: {
Line 1,126: Line 1,088:
   </tr>
   </tr>
   <tr>
   <tr>
     <td colspan="4" style='font-size: 14pt; border-bottom: 2pt solid black; padding-left: 100px;'><b>Rendering</b></td>
     <td colspan="4" class="propHeader"><b>Rendering</b></td>
   </tr>
   </tr>
   <tr>
   <tr>
Line 1,132: Line 1,094:
     <td>key: string, value: object</td>
     <td>key: string, value: object</td>
     <td></td>
     <td></td>
     <td>The texture definitions for the block as seen in the world, when dropped on the ground or held in the hand.</td>
     <td>The texture definitions for the block as seen in the world, when dropped on the ground or held in the hand. Within a mod, to refer to a texture from the base game, prefix the path with "game:" (i.e. base: "game:path/to/texture") </td>
   </tr>
   </tr>
   <tr>
   <tr>
Confirmedusers, Bureaucrats, editor, Administrators
1,778

edits