Confirmedusers
261
edits
(Update the description.) |
No edit summary |
||
Line 1: | Line 1: | ||
== Purpose == | == Purpose == | ||
Enables right click to harvest the block. After the block is harvested, it is replaced with the one specified by the <code>harvestedBlockCode</code> property. | |||
== Used by blocks == | |||
* bigberrybush | |||
* saguarocactus | |||
* smallberrybush | |||
* log-resin | |||
== Usage == | |||
The player begins harvesting the block by holding right click. The player can be holding any tool while harvesting the block (the behavior ignores what the player is holding). <code>harvestingSound</code> is played when the harvesting starts and again randomly during the harvest. During the harvest, particles are randomly spawned and the attack animation is shown. | |||
After <code>harvestTime</code> seconds have elapsed, the block is replaced with <code>harvestedBlockCode</code>. <code>harvestedStack</code> is placed in the player inventory if they have room, otherwise it is dropped on the ground. If the block has the <code>forageStatAffected</code> attribute, then the dropped stack size is affected by the player's forageDropRate trait (comes from their class). | |||
Example: | |||
<syntaxhighlight lang="json"> | |||
{ | |||
name: "Harvestable", properties: { | |||
harvestTime: 1, | |||
harvestedStack: { type: "item", code: "resin", quantity: { avg: 1 } }, | |||
harvestedBlockCode: "log-resinharvested-{wood}-ud" | |||
} | |||
} | |||
</syntaxhighlight> | |||
The "onitemcollected" event is fired after the block is harvested. Nothing in vanilla VS listens to the event, but a mod could be created to listen to it. It is not possible for such an event handler to block the item from getting dropped. | |||
Alone this behavior does not support making the block harvestable again after a fixed time period. So the Transient block entity class is often assigned to the harvested block type, which does replace the harvested block after a configurable time period. | |||
== Properties == | |||
; <code>harvestTime</code> (float, seconds, default: 0) | |||
: The number of seconds it takes to harvest the block. | |||
; <code>harvestedStack</code> (BlockDropItemStack) | |||
: The item stack to drop when the block is harvested. | |||
; <code>harvestingSound</code> (path from sounds folder) | |||
: Sound that is played when harvesting begins and randomly during harvesting. | |||
; <code>harvestedBlockCode</code> (block code) | |||
: The harvestable block is replaced with this when harvesting is done. Typically this is an unharvestable block that converts back to harvestable block after a while using the Transient block entity class. | |||
{{Navbox/modding|Vintage Story}} | {{Navbox/modding|Vintage Story}} |