Json block behaviors HorizontalUpDownOrientable: Difference between revisions

From Vintage Story Wiki
update
(→‎Purpose: worldvariantgroups link)
(update)
Line 1: Line 1:
== Purpose ==
== Purpose ==
The behavior selects an orientation variant of a block when the block is placed. The orientation variant is selected based on the orientation of the player. The orientation type includes all 4 horizontal directions. In addition to having variants for all 4 horizontal directions with the block right side up, the orientation type includes an additional 4 horizontal directions with the blocks upside down. So the orientation type has a total of 8 states.


Used for:
When the block is broken, the "up" "north" variant is dropped.
* angledgearbox
 
Requires variant groups loaded from the <code>abstract/verticalorientation</code> and <code>abstract/horizontalorientation</code> [[Json:block:worldvariantgroups|world properties]]:
== Used by blocks ==
 
This behavior is not used by any of the vanilla blocks.
 
== Usage ==
 
The second to last variant group of the block must include the "up" and "down" states. The last variant group of the block must include the 4 cardinal directions. The variant groups must be the last 2 in the block, but the codes of the variant groups do not matter for this behavior.
 
The variant states can be specified directly via the <code>states</code> field, is cleaner to load them from the <code>abstract/verticalorientation</code> and <code>abstract/horizontalorientation</code> [[Json:block:worldvariantgroups|world properties]]:
<syntaxhighlight lang="json">
<syntaxhighlight lang="json">
variantgroups: [
variantgroups: [
{ loadFromProperties: "abstract/verticalorientation" },
{ code:"v", loadFromProperties: "abstract/verticalorientation" }
{ loadFromProperties: "abstract/horizontalorientation" }
{ code:"side", loadFromProperties: "abstract/horizontalorientation" }
],
],
</syntaxhighlight>
</syntaxhighlight>


== Properties ==
none


{{Navbox/modding|Vintage Story}}
{{Navbox/modding|Vintage Story}}
Confirmedusers
261

edits