Json block behaviors pillar: Difference between revisions

From Vintage Story Wiki
(Created page with "==Purpose== Block can be rotated in three directions. Used for: * Wood log * Pillar * Axle Requires "ud", "ns" and "we" states: <syntaxhighlight lang="json"> variantgroups: [...")
 
No edit summary
 
Line 1: Line 1:
==Purpose==
==Purpose==
Block can be rotated in three directions. Used for:
 
* Wood log
The <code>Pillar</code> [[Modding:Json_Block_Behaviors|behavior]] selects an [[Modding:Block Orientation|orientation variant]] of a block when the block is placed. The behavior is used for blocks like logs with only 3 orientations. The blocks have identical end caps on opposing sides of the block, and the remaining 4 sides are the same. So the only ways to orient those blocks is to change the axis that the end caps are on.
* Pillar
 
* Axle
== Used by blocks ==
Requires "ud", "ns" and "we" states:
* carvedlog
* debarkedlog
* hay
* log
* lognarrow
* planks
* plaster
* quartzpillar
* stackedbamboo
* woodenaxle
 
== Usage ==
 
The block's last variant group must contain the states "ud", "ns" and "we". The variant group must be last, but code of the variant group does not matter.
<syntaxhighlight lang="json">
<syntaxhighlight lang="json">
variantgroups: [
variantgroups: [
        ...
{ code:"orientation", states: ["ud", "ns", "we"] },
{ code:"orientation", states: ["ud", "ns", "we"] },
],
],
</syntaxhighlight>
</syntaxhighlight>
The Pillar behavior does not affect what drops when the block is broken. The <code>drops</code> field on the block should be used to select one specific orientation to drop, no matter which orientation was broken. Otherwise, if the block always drops its own orientation, the block items from the different orientations will not stack in the player inventory.
<syntaxhighlight lang="json">
    drops: [
        { type: "block", code: "quartzpillar-ud", quantity: { avg: 1 }  }
    ],
</syntaxhighlight>
== Properties ==
; <code>invertedPlacement</code> (bool, default&colon; false)
: When false, the placed blocks will be oriented so that the end cap points at the selected block face. This is useful so that the end caps of logs connect together. When true, if the selected block horizontal (up/down face), then the placed block will be of the "we" or "ns" orientation, and the "ud" orientation will be used if the face is horizontal. The axle block uses inverted placement, although the axle block class first searches for any neighbor block that accepts mechanical power, and if there is one, then the class points the axle to that neighbor instead.


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

Latest revision as of 21:04, 15 October 2023

Purpose

The Pillar behavior selects an orientation variant of a block when the block is placed. The behavior is used for blocks like logs with only 3 orientations. The blocks have identical end caps on opposing sides of the block, and the remaining 4 sides are the same. So the only ways to orient those blocks is to change the axis that the end caps are on.

Used by blocks

  • carvedlog
  • debarkedlog
  • hay
  • log
  • lognarrow
  • planks
  • plaster
  • quartzpillar
  • stackedbamboo
  • woodenaxle

Usage

The block's last variant group must contain the states "ud", "ns" and "we". The variant group must be last, but code of the variant group does not matter.

	variantgroups: [
        ...
		{ code:"orientation", states: ["ud", "ns", "we"] },
	],

The Pillar behavior does not affect what drops when the block is broken. The drops field on the block should be used to select one specific orientation to drop, no matter which orientation was broken. Otherwise, if the block always drops its own orientation, the block items from the different orientations will not stack in the player inventory.

    drops: [
        { type: "block", code: "quartzpillar-ud", quantity: { avg: 1 }  }
    ],

Properties

invertedPlacement (bool, default: false)
When false, the placed blocks will be oriented so that the end cap points at the selected block face. This is useful so that the end caps of logs connect together. When true, if the selected block horizontal (up/down face), then the placed block will be of the "we" or "ns" orientation, and the "ud" orientation will be used if the face is horizontal. The axle block uses inverted placement, although the axle block class first searches for any neighbor block that accepts mechanical power, and if there is one, then the class points the axle to that neighbor instead.
Icon Sign.png

Wondering where some links have gone?
The modding navbox is going through some changes! Check out Navigation Box Updates for more info and help finding specific pages.

Modding
Modding Introduction Getting Started Theme Pack
Content Modding Content Mods Developing a Content Mod Basic Tutorials Intermediate Tutorials Advanced Tutorials Content Mod Concepts
Code Modding Code Mods Setting up your Development Environment
Property Overview ItemEntityEntity BehaviorsBlockBlock BehaviorsBlock ClassesBlock EntitiesBlock Entity BehaviorsCollectible BehaviorsWorld properties
Workflows & Infrastructure Modding Efficiency TipsMod-engine compatibilityMod ExtensibilityVS Engine
Additional Resources Community Resources Modding API Updates Programming Languages List of server commandsList of client commandsClient startup parametersServer startup parameters
Example ModsAPI DocsGitHub Repository