Modding:Entity Json Properties: Difference between revisions

From Vintage Story Wiki
no edit summary
No edit summary
No edit summary
Line 7: Line 7:
     <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>
     <th width='120' align='left'>Default</th>
     <th width='150' align='left'>Default</th>
     <th align='left'>Usage</th>
     <th align='left'>Usage</th>
   </tr>
   </tr>
Line 531: Line 531:
     <td colspan="3">
     <td colspan="3">
{{:json:entity:behavior}}
{{:json:entity:behavior}}
public NatFloat GroupSize = NatFloat.createUniform(1, 0);
        public AssetLocation[] Companions = new AssetLocation[0];
        public AssetLocation[] InsideBlockCodes = new AssetLocation[] { new AssetLocation("air") };
        public bool RequireSolidGround = true;
        public bool TryOnlySurface = false;
        public float MinTemp = -40;
        public float MaxTemp = 40;
        public float MinRain = 0f;
        public float MaxRain = 1f;
        public float MinForest = 0;
        public float MaxForest = 1;
        public float MinShrubs = 0;
        public float MaxShrubs = 1;
        public float MinForestOrShrubs = 0;
</td>
</td>
   </tr>
   </tr>
Line 639: Line 658:
     <td></td>
     <td></td>
     <td>Will get you max(sunlight * sunbrightness, blocklight)</td>
     <td>Will get you max(sunlight * sunbrightness, blocklight)</td>
  </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_spawnconditions_runtime_groupsize" data-tt-parent="p_spawnconditions_runtime">GroupSize</div></td>
    <td>object</td>
    <td><code>{ avg: 1, var: 0 } </code></td>
    <td>Determines the size of the group. By default the size of the group is always one.</td>
  </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_spawnconditions_runtime_groupsize_info" data-tt-parent="p_spawnconditions_runtime_groupsize" data-invisible="true"></div></td>
    <td colspan="3"> 
'''''avg''''': Stands for the default drop quantity. If var is 0 or not specified it will always drop the given average.
'''''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.
Furthermore you can also switch between different distribution modes using the '''''dist''''' property.
<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>
    </td>
  </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_spawnconditions_runtime_companions" data-tt-parent="p_spawnconditions_runtime">Companions</div></td>
    <td>array of string</td>
    <td>-</td>
    <td>Codes of all possible companions.</td>
  </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_spawnconditions_runtime_insideblockcodes" data-tt-parent="p_spawnconditions_runtime">InsideBlockCodes</div></td>
    <td>array of string</td>
    <td><code>[ "game:air" ]</code></td>
    <td>The block codes in which the entity can spawn. Entities which can spawn underwater might use <code>[ "game:water" ]</code> instead.</td>
  </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_spawnconditions_runtime_requiresolidground" data-tt-parent="p_spawnconditions_runtime">RequireSolidGround</div></td>
    <td>boolean</td>
    <td>true</td>
    <td>If the entity requires a solid block below it. For example birds and fishes do not require it.</td>
  </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_spawnconditions_runtime_tryonlysurface" data-tt-parent="p_spawnconditions_runtime">TryOnlySurface</div></td>
    <td>boolean</td>
    <td>false</td>
    <td>If false the game will also try to spawn the entity below the surface (in a cave for example). For ordinary animals this should be true so they only spawn on the surface.</td>
  </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_spawnconditions_runtime_mintemp" data-tt-parent="p_spawnconditions_runtime">MinTemp</div></td>
    <td>integer</td>
    <td>-40</td>
    <td>Minimum temperature at which the entity can spawn.</td>
  </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_spawnconditions_runtime_maxtemp" data-tt-parent="p_spawnconditions_runtime">MaxTemp</div></td>
    <td>integer</td>
    <td>40</td>
    <td>Maximum temperature at which the entity can spawn.</td>
  </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_spawnconditions_runtime_minrain" data-tt-parent="p_spawnconditions_runtime">MinRain</div></td>
    <td>decimal number</td>
    <td>0</td>
    <td>Minimum rain average at which the entity can spawn.</td>
  </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_spawnconditions_runtime_maxrain" data-tt-parent="p_spawnconditions_runtime">MaxRain</div></td>
    <td>decimal number</td>
    <td>1</td>
    <td>Maximum rain average at which the entity can spawn.</td>
  </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_spawnconditions_runtime_minforest" data-tt-parent="p_spawnconditions_runtime">MinForest</div></td>
    <td>decimal number</td>
    <td>0</td>
    <td>Minimum forest density at which the entity can spawn.</td>
  </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_spawnconditions_runtime_maxforest" data-tt-parent="p_spawnconditions_runtime">MaxForest</div></td>
    <td>decimal number</td>
    <td>1</td>
    <td>Maximum forest density at which the entity can spawn.</td>
  </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_spawnconditions_runtime_minshrubs" data-tt-parent="p_spawnconditions_runtime">MinShrubs</div></td>
    <td>decimal number</td>
    <td>0</td>
    <td>Minimum shrubs density at which the entity can spawn.</td>
  </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_spawnconditions_runtime_maxshrubs" data-tt-parent="p_spawnconditions_runtime">MaxShrubs</div></td>
    <td>decimal number</td>
    <td>1</td>
    <td>Maximum shrubs density at which the entity can spawn.</td>
  </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_spawnconditions_runtime_minforestorshrubs" data-tt-parent="p_spawnconditions_runtime">MinForestOrShrubs</div></td>
    <td>decimal number</td>
    <td>0</td>
    <td>Minimum shrubs or forest density at which the entity can spawn.</td>
   </tr>
   </tr>


       
   <tr>
   <tr>
     <td colspan="4" style='font-size: 14pt; border-bottom: 2pt solid black; padding-left: 100px;'><b>}</b></td>
     <td colspan="4" style='font-size: 14pt; border-bottom: 2pt solid black; padding-left: 100px;'><b>}</b></td>
Confirmedusers, editor, Administrators
886

edits