Harvestable
Represents a harvestable object in the game.
Values:
-
angularVelocity[ Vec3 ]Get: Returns the angular velocity of the harvestable.
-
Get: (Client-Only) Returns client public data from a harvestable.Set: (Client-Only) Sets client public data on a harvestable.
-
Get: Returns the id of a harvestable.
-
-
Get: Gets the initial hash of a kinematic. The initial hash identifies the kinematic by its initial world position, uuid and world id.
Result: The initial hash. Returns 0 if the harvestable is not kinematic.This can be used to match kinematics spawned from the same entity in a tile even though each loaded kinematic is technically a different object.
-
-
initialPosition[ Vec3 ]Get: Returns the initial world coordinates of a kinematic.
-
initialRotation[ Quat ]Get: Returns the initial quaternion rotation of a harvestable.
-
Get: Returns the mass of a harvestable. The mass scales with the harvestable's scale.
-
Get: Returns the material name of a harvestable.
-
Get: Returns the material id of a harvestable.
-
Get: Returns the name of a harvestable.
-
Get: (Server-Only) Returns (server) public data from a harvestable.Set: (Server-Only) Sets (server) public data on a harvestable.
-
Get: Returns the type of a harvestable.
-
uuid[ Uuid ]Get: Returns the Uuid of the harvestable.
-
velocity[ Vec3 ]Get: Returns the velocity of the harvestable.
-
worldPosition[ Vec3 ]Get: Returns the world coordinates of a harvestable.
-
worldRotation[ Quat ]Get: Returns the quaternion rotation of a harvestable.
Operations:
| Operation | Returns | Description |
|---|---|---|
Harvestable == Harvestable |
boolean | Checks if two instances of Harvestable refer to the same Harvestable. |
Server + Client
getAabb
harvestable:getAabb( )
Returns the axis aligned world space bounds of the harvestable.
Parameters:
| Name | Type | Description |
|---|---|---|
harvestable |
Harvestable | The harvestable. |
Returns:
getAngularVelocity
harvestable:getAngularVelocity( )
Returns the angular velocity of the harvestable.
Parameters:
| Name | Type | Description |
|---|---|---|
harvestable |
Harvestable | The harvestable. |
Returns:
| Type | Description |
|---|---|
| Vec3 | The angular velocity. |
getColor
harvestable:getColor( )
Returns the color of the harvestable.
Parameters:
| Name | Type | Description |
|---|---|---|
harvestable |
Harvestable | The harvestable. |
Returns:
| Type | Description |
|---|---|
| Color | The color. |
getData
harvestable:getData( )
Get the script data from a harvestable.
Parameters:
| Name | Type | Description |
|---|---|---|
harvestable |
Harvestable | The harvestable. |
Returns:
| Name | Type | Description |
|---|---|---|
data |
table | The script data. |
getId
harvestable:getId( )
Returns the id of a harvestable.
Parameters:
| Name | Type | Description |
|---|---|---|
harvestable |
Harvestable | The harvestable. |
Returns:
| Type | Description |
|---|---|
| integer | The harvestable id. |
getInitialHash
harvestable:getInitialHash( )
Gets the initial hash of a kinematic. The initial hash identifies the kinematic by its initial world position, uuid and world id.
This can be used to match kinematics spawned from the same entity in a tile even though each loaded kinematic is technically a different object.
Parameters:
| Name | Type | Description |
|---|---|---|
harvestable |
Harvestable | The kinematic to get the initial hash from. |
Returns:
| Type | Description |
|---|---|
| number | The initial hash. Returns 0 if the harvestable is not kinematic. |
getLocalAabb
harvestable:getLocalAabb( )
Returns the axis aligned local space bounds of the harvestable.
Parameters:
| Name | Type | Description |
|---|---|---|
harvestable |
Harvestable | The harvestable. |
Returns:
getMass
harvestable:getMass( )
Returns the mass of a harvestable. The mass scales with the harvestable's scale.
Parameters:
| Name | Type | Description |
|---|---|---|
harvestable |
Harvestable | The harvestable. |
Returns:
| Type | Description |
|---|---|
| number | The mass. |
getMaterial
harvestable:getMaterial( )
Returns the material name of a harvestable.
Parameters:
| Name | Type | Description |
|---|---|---|
harvestable |
Harvestable | The harvestable. |
Returns:
| Type | Description |
|---|---|
| string | The name of the material. |
getMaterialId
harvestable:getMaterialId( )
Returns the material id of a harvestable.
Parameters:
| Name | Type | Description |
|---|---|---|
harvestable |
Harvestable | The harvestable. |
Returns:
| Type | Description |
|---|---|
| integer | The id of the material. |
getName
harvestable:getName( )
Returns the name of a harvestable.
Parameters:
| Name | Type | Description |
|---|---|---|
harvestable |
Harvestable | The harvestable. |
Returns:
| Type | Description |
|---|---|
| string | The harvestable name. |
getPosition
harvestable:getPosition( )
Returns the world coordinates of a harvestable.
Parameters:
| Name | Type | Description |
|---|---|---|
harvestable |
Harvestable | The harvestable. |
Returns:
| Type | Description |
|---|---|
| Vec3 | The position. |
getRotation
harvestable:getRotation( )
Returns the quaternion rotation of a harvestable.
Parameters:
| Name | Type | Description |
|---|---|---|
harvestable |
Harvestable | The harvestable. |
Returns:
| Type | Description |
|---|---|
| Quat | The rotation. |
getScale
harvestable:getScale( )
Returns the scale of the harvestable.
Parameters:
| Name | Type | Description |
|---|---|---|
harvestable |
Harvestable | The harvestable. |
Returns:
| Type | Description |
|---|---|
| Vec3 | The scale. |
getSeatCharacter
harvestable:getSeatCharacter( )
Returns the Character that is seated in the kinematic.
Parameters:
| Name | Type | Description |
|---|---|---|
kinematic |
Harvestable | The kinematic. |
Returns:
| Type | Description |
|---|---|
| Character | The character. |
getType
harvestable:getType( )
Returns the type of a harvestable.
Parameters:
| Name | Type | Description |
|---|---|---|
harvestable |
Harvestable | The harvestable. |
Returns:
| Type | Description |
|---|---|
| string | The harvestable's type. |
getUuid
harvestable:getUuid( )
Returns the Uuid of the harvestable.
Parameters:
| Name | Type | Description |
|---|---|---|
harvestable |
Harvestable | The harvestable. |
Returns:
| Type | Description |
|---|---|
| Uuid | The uuid. |
getVelocity
harvestable:getVelocity( )
Returns the velocity of the harvestable.
Parameters:
| Name | Type | Description |
|---|---|---|
harvestable |
Harvestable | The harvestable. |
Returns:
| Type | Description |
|---|---|
| Vec3 | The velocity. |
getWorld
harvestable:getWorld( )
Returns the world a harvestable exists in.
Parameters:
| Name | Type | Description |
|---|---|---|
harvestable |
Harvestable | The harvestable. |
Returns:
| Type | Description |
|---|---|
| World | The world the harvestable exists in. |
hasSeat
harvestable:hasSeat( )
Returns true if kinematic has a seat component.
Parameters:
| Name | Type | Description |
|---|---|---|
kinematic |
Harvestable | The kinematic. |
Returns:
| Type | Description |
|---|---|
| boolean | The result. |
isCellKinematic
harvestable:isCellKinematic( )
Check if a kinematic comes from a cell or is created from a script.
Parameters:
| Name | Type | Description |
|---|---|---|
harvestable |
Harvestable | The harvestable to check. |
Returns:
| Type | Description |
|---|---|
| boolean | True if it is a kinematic from a cell, false if it is not. Nil if it is not a kinematic. |
isKinematic
harvestable:isKinematic( )
Check if a harvestable is kinematic
Parameters:
| Name | Type | Description |
|---|---|---|
harvestable |
Harvestable | The harvestable. |
Returns:
| Type | Description |
|---|---|
| boolean | Return true if the harvestable is kinematic. |
setPosition
harvestable:setPosition( position )
Set the world coordinates of a harvestable. Can only be used on kinematic harvestables.
Parameters:
| Name | Type | Description |
|---|---|---|
harvestable |
Harvestable | The harvestable. |
position |
Vec3 | The position. |
setRotation
harvestable:setRotation( rotation )
Set the quaternion rotation of a harvestable. Can only be used on kinematic harvestables.
Parameters:
| Name | Type | Description |
|---|---|---|
harvestable |
Harvestable | The harvestable. |
rotation |
Quat | The rotation. |
setSeatCharacter
harvestable:setSeatCharacter( character )
Requests to seat a Character in the kinematic.
Parameters:
| Name | Type | Description |
|---|---|---|
kinematic |
Harvestable | The kinematic. |
character |
Character | The character. |
transformDirection
harvestable:transformDirection( direction )
Transforms a direction in the world into a local direction of the harvestable
Parameters:
| Name | Type | Description |
|---|---|---|
harvestable |
Harvestable | The harvestable. |
direction |
Vec3 | The world direction. |
Returns:
| Type | Description |
|---|---|
| Vec3 | The local direction. |
transformLocalPoint
harvestable:transformLocalPoint( vector )
Transform a local point to world space.
local worldPos = self.harvestable:transformLocalPoint( localPos )
Parameters:
| Name | Type | Description |
|---|---|---|
harvetable |
Harvestable | The harvestable. |
vector |
Vec3 | The local point. |
Returns:
| Type | Description |
|---|---|
| Vec3 | The world point. |
transformPoint
harvestable:transformPoint( vector )
Transform a world point to the local harvestable transform.
local localPos = self.harvestable:transformPoint( worldPos )
Parameters:
| Name | Type | Description |
|---|---|---|
harvestable |
Harvestable | The harvestable. |
vector |
Vec3 | The world point. |
Returns:
| Type | Description |
|---|---|
| Vec3 | The local point. |
Server-only
destroy
harvestable:destroy( )
Destroys a harvestable.
Parameters:
| Name | Type | Description |
|---|---|---|
harvestable |
Harvestable | The harvestable. |
getPublicData
harvestable:getPublicData( )
Returns (server) public data from a harvestable.
Parameters:
| Name | Type | Description |
|---|---|---|
harvestable |
Harvestable | The harvestable. |
Returns:
| Type | Description |
|---|---|
| table | The public data. |
setParams
harvestable:setParams( data )
Sets param data for a harvestable.
Parameters:
| Name | Type | Description |
|---|---|---|
harvestable |
Harvestable | The harvestable. |
data |
any | The param data. |
setPublicData
harvestable:setPublicData( data )
Sets (server) public data on a harvestable.
Parameters:
| Name | Type | Description |
|---|---|---|
harvestable |
Harvestable | The harvestable. |
data |
table | The public data. |
Client-only
applyShakeImpulse
harvestable:applyShakeImpulse( shake )
Applies a shake impulse to the harvestable.
Parameters:
| Name | Type | Description |
|---|---|---|
harvestable |
Harvestable | The harvestable. |
shake |
number | The shake impulse value. |
getClientPublicData
harvestable:getClientPublicData( )
Returns client public data from a harvestable.
Parameters:
| Name | Type | Description |
|---|---|---|
harvestable |
Harvestable | The harvestable. |
Returns:
| Type | Description |
|---|---|
| table | The client public data. |
getPoseWeight
harvestable:getPoseWeight( index )
Returns the pose weight of the pose in the given index.
Parameters:
| Name | Type | Description |
|---|---|---|
harvestable |
Harvestable | The harvestable. |
index |
integer | The index. |
Returns:
| Type | Description |
|---|---|
| number | The pose weight. |
getUvFrameIndex
harvestable:getUvFrameIndex( )
Returns the index of the current UV animation frame
Parameters:
| Name | Type | Description |
|---|---|---|
harvestable |
Harvestable | The harvestable. |
Returns:
| Type | Description |
|---|---|
| integer | The uv frame. |
setAllSubMeshVisible
harvestable:setAllSubMeshVisible( visible )
Set the visibility of all submeshes
Parameters:
| Name | Type | Description |
|---|---|---|
harvestable |
Harvestable | The harvestable. |
visible |
boolean | True if the submeshes should be visible. |
setClientPublicData
harvestable:setClientPublicData( data )
Sets client public data on a harvestable.
Parameters:
| Name | Type | Description |
|---|---|---|
harvestable |
Harvestable | The harvestable. |
data |
table | The client public data. |
setColor
harvestable:setColor( color )
Sets the color of the harvestable.
Parameters:
| Name | Type | Description |
|---|---|---|
harvestable |
Harvestable | The harvestable. |
color |
Color | The color. |
setPoseWeight
harvestable:setPoseWeight( index, value )
Set the pose weight of the pose in the given index.
Parameters:
| Name | Type | Description |
|---|---|---|
harvestable |
Harvestable | The harvestable. |
index |
integer | The index. |
value |
number | The pose weight. |
setSubMeshVisible
harvestable:setSubMeshVisible( name, visible )
Set the visibility of a submesh
Parameters:
| Name | Type | Description |
|---|---|---|
harvestable |
Harvestable | The harvestable. |
name |
string | Name of the submesh. |
visible |
boolean | True if the submesh should be visible. |
setUvFrameIndex
harvestable:setUvFrameIndex( index )
Sets the UV animation frame with the given index.
Parameters:
| Name | Type | Description |
|---|---|---|
harvestable |
Harvestable | The harvestable. |
index |
integer | The index. |