Json block behaviors OmniAttachable

From Vintage Story Wiki

Purpose

This behavior turns the block into an attachment block that can be attached on any face. Additionally this behavior orients the attachment block to face the parent block.

Used by blocks

  • crystal
  • lantern

Usage

When the block is placed, the behavior will verify that the selected face on the parent block accepts the attachment. If the selected parent face rejects the attachment, then attachment block finds the first neighbor block that accepts the attachment. If all of the neighbors reject the attachment, then placing the attachment block is rejected.

If the parent block changes such that it no longer accepts the attachment, then the attachment block is broken.

If the block passes the attachment checks, then it is oriented to the parent. In order to do so, one of the variant groups must contain all facing codes. By default that variant group uses the orientation code, but a different code selected with the facingCode property.

All of the states of the orientation group can be directly specified, or the abstract/verticalorientation states can be added to the ones from the abstract/horizontalorientation world property:

	variantgroups: [
		{ code:"orientation", loadFromPropertiesCombine: ["abstract/horizontalorientation", "abstract/verticalorientation"] }
	],

When the block is broken, the "up" variant is dropped.

Properties

facingCode: (variant code, default : "orientation")
The code of the variant group of the block that contains all of the facing codes.
attachmentAreas: (facing code -> RotatableCube)
The attachment area (part of the parent block that should be solid) for each face that the block can attach to. This field is optional. If a face is missing, then a null attachment area will be given to the parent block. Most parent blocks ignore the attachment area when deciding whether to accept an attachment.
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