Modding:Collectible Behavior GroundStorable

From Vintage Story Wiki
Revision as of 22:01, 27 July 2024 by Bluelightning32 (talk | contribs) (→‎Usage: fix syntaxhighlight typo)

Purpose

This behavior allows the block/item to be stored in groundstorage blocks. A groundstorage block is like a chest with invisible walls, in the sense that it renders its contents. It has no GUI and clicking it directly places or picks up items. The groundstorage block only exists as a placed block; there is no way for the player to end up with one in their inventory (aside from the /giveblock command).

When the player tries to right click a ground storable item or block on the ground, then the behavior tries to add the item to the groundstorage block. If the groundstorage block does not exist yet at that location, then the behavior will try to create it before adding the block/item to it.

Used by blocks

  • agedfirewood
  • axe
  • backpack
  • basket
  • beeswax
  • blade
  • bone
  • book
  • boss
  • bow
  • bowl
  • bowl-meal
  • bugnet
  • burnedbrick
  • chisel
  • clayplanter
  • claypot
  • cleaver
  • cloth
  • clothes
  • club
  • clutter
  • crock
  • crucible
  • crystalizedore
  • dirtyclaypot
  • egg
  • fat
  • feather
  • firestarter
  • firewood
  • flaxfibers
  • flowerpot
  • gem
  • hammer
  • helvehammerhead
  • hide
  • hoe
  • hoop
  • hunterbackpack
  • ingot
  • ingotmold
  • inkandquill
  • jonasframes
  • jonasparts
  • jug
  • knife
  • largegear
  • linensack
  • lore
  • metal
  • metalbit
  • metalnailsandstrips
  • metalplate
  • miningbag
  • nightvisionupgrades
  • nugget
  • oar
  • ore
  • paper
  • pickaxe
  • pineapple
  • plank
  • plumbandsquare
  • powder
  • prospectingpick
  • pumpkin
  • quiver
  • rawbrick
  • refractorybrick
  • resin
  • returnbase
  • returndeath
  • rope
  • rot
  • sail
  • saw
  • schematic
  • scythe
  • sewingkit
  • shears
  • shield
  • shingle
  • shovel
  • sieve
  • solderbar
  • solderingiron
  • spear
  • stick
  • stonebrick
  • storagevessel
  • textureflipper
  • tongs
  • toolmold
  • tuningcylinder
  • wateringcan
  • wrench

Usage

Add it to the to the behaviors, field and set the GroundStorageProperties. The first item to create the groundstorage block at a location will copy its GroundStorageProperties into the block entity at that location. Different kinds of items can be placed in the same ground storage block, if their layouts match, and they are added to different inventory slots. For example, a flax fiber, piece of fat, and stick can all be placed into the same ground storage block, because they all have the Quadrants layout. However, an ingot mold cannot be placed into the same groundstorage as a stick, because the ingot mold has the Halves layout.

Example:

  behaviors: [{
      name: "GroundStorable",
      properties: {
        layout: 'WallHalves',
        wallOffY: 2,
        sprintKey: true,
        selectionBox: { x1: 0, y1: 0, z1: 0, x2: 1, y2: 0.1, z2: 1 },
        collisionBox: { x1: 0, y1: 0, z1: 0, x2: 0, y2: 0, z2: 0 },
      },
  }]

Properties

Layout: (EnumGroundStorageLayout, default: SingleCenter)
WallOffY: (int, default: 1, Recommended minimum: 1)
PlaceRemoveSound: (asset, default: "sounds/player/build")
RandomizeSoundPitch: (bool, unused)
TessQuantityElements: (int, deprecated)
SprintKey: (bool, default: false)
CollisionBox: (Cuboidf, default: first collision box of the block that created the storageblock, otherwise {x1: 0, y1: 0, z1: 0, x2:1, y2:0.25f, z2:1})
SelectionBox: (Cuboidf, default: CollisionBox value)

Stacking layout only properties

ModelItemsToStackSizeRatio: (float, default: 1)
StackingTextures: (asset dictionary, default: empty)
TransferQuantity: (int, default: 1)
BulkTransferQuantity: (int, default: 4)
UpSolid: (bool, default: false)
CbScaleYByLayer: (float, default: 0)
MaxFireable: (int, default: 9999)
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 ItemEntityBlockBlock BehaviorsBlock ClassesBlock EntitiesBlock Entity 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