Skip to main content

Harvestable

Associated namespace: sm.harvestable

Represents a harvestable object in the game.

Values:

  • clientPublicData [ table ]

    • Get: (Client-Only) The harvestable's client public data.
    • Set: (Client-Only) Sets the harvestable's client public data.
  • id [ int ]

    • Get: The harvestable's id.
  • initialPosition [ vec3 ]

    • Get: The harvestable's initial world position.
  • initialRotation [ quat ]

    • Get: The harvestable's initial world rotation.
  • mass [ number ]

    • Get: The harvestable's mass.
  • material [ string ]

    • Get: The harvestable's material name.
  • materialId [ int ]

    • Get: The harvestable's material id.
  • name [ string ]

    • Get: The harvestable's name.
  • publicData [ table ]

    • Get: (Server-Only) The harvestable's server public data.
    • Set: (Server-Only) Sets the harvestable's server public data.
  • type [ string ]

    • Get: The harvestable's type.
  • uuid [ uuid ]

    • Get: The harvestable's uuid.
  • worldPosition [ vec3 ]

    • Get: The harvestable's world position.
  • worldRotation [ quat ]

    • Get: The harvestable's world rotation.

Operations:

OperationDescription
Harvestable == HarvestableChecks if two instances of Harvestable refer to the same Harvestable.

Functions

destroy

harvestable:destroy()

Server-Only

Destroys the harvestable.

Parameters:


getAabb

harvestable:getAabb()

Returns the bounds of the harvestable shape.

Parameters:

Returns:

  • (Vec3): The max bounds.
  • (Vec3): The min bounds.

getClientPublicData

harvestable:getClientPublicData()

Client-Only

Returns the harvestable's client public data.

Parameters:

Returns:

  • (table): The public data.

getColor

harvestable:getColor()

Returns the harvestable's color.

Parameters:

Returns:


getData

harvestable:getData()

Returns the harvestable's script data.

Parameters:

Returns:

  • (table): The script data.

getId

harvestable:getId()

Returns the harvestable's id.

Parameters:

Returns:

  • (int): The id.

getMass

harvestable:getMass()

Returns the harvestable's mass.

Parameters:

Returns:

  • (number): The mass.

getMaterial

harvestable:getMaterial()

Returns the harvestable's material name.

Parameters:

Returns:

  • (string): The material name.

getMaterialId

harvestable:getMaterialId()

Returns the harvestable's material id.

Parameters:

Returns:

  • (int): The material id.

getName

harvestable:getName()

Returns the harvestable's name.

Parameters:

Returns:

  • (string): The name.

getPoseWeight

harvestable:getPoseWeight( index )

Client-Only

Returns the pose weight of the pose in the given index.

Parameters:

  • harvestable (Harvestable): The harvestable.
  • index (int): The index.

Returns:

  • (number): The pose weight.

getPosition

harvestable:getPosition()

Returns the harvestable's world position.

Parameters:

Returns:

  • (Vec3): The world position.

getPublicData

harvestable:getPublicData()

Server-Only

Returns the harvestable's server public data.

Parameters:

Returns:

  • (table): The public data.

getRotation

harvestable:getRotation()

Returns the harvestable's rotation.

Parameters:

Returns:

  • (Quat): The rotation.

getScale

harvestable:getScale()

Returns the harvestable's scale.

Parameters:

Returns:


getType

harvestable:getType()

Returns the harvestable's type.

Parameters:

Returns:

  • (string): The type.

getUuid

harvestable:getUuid()

Returns the harvestable's uuid.

Parameters:

Returns:


getUvFrameIndex

harvestable:getUvFrameIndex()

Client-Only

Returns the harvestable's current UV animation frame.

Parameters:

Returns:

  • (int): The UV frame.

getWorld

harvestable:getWorld()

Returns the harvestable's world.

Parameters:

Returns:


hasSeat

kinematic:hasSeat()

Returns whether the kinematic has a seat component.

Parameters:

Returns:

  • (boolean): Whether the kinematic has a seat component or not.

isKinematic

harvestable:isKinematic()

Returns whether the harvestable is a kinematic.

Parameters:

Returns:

  • (boolean): Whether the harvestable is a kinematic or not.

setClientPublicData

harvestable:setClientPublicData( data )

Client-Only

Sets the harvestable's client public data.

Parameters:

  • harvestable (Harvestable): The harvestable.
  • data (table): The data to set.

setColor

harvestable:setColor( color )

Client-Only

Sets the harvestable's color.

Parameters:


setParams

harvestable:setParams( data )

Server-Only

Sets the harvestable's param data.

Parameters:

  • harvestable (Harvestable): The harvestable.
  • data (any): The data.

setPoseWeight

harvestable:setPoseWeight( index, value )

Client-Only

Set the pose weight of the pose in the given index.

Parameters:

  • harvestable (Harvestable): The harvestable.
  • index (int): The index.
  • value (number): The pose weight.

setPosition

kinematic:setPosition( position )

Set the harvestable's world position.
Can only be used on kinematic harvestables.

Parameters:

  • kinematic (Harvestable): The kinematic.
  • position (Vec3): The world position.

setPublicData

harvestable:setPublicData( data )

Server-Only

Set the harvestable's server public data.

Parameters:

  • harvestable (Harvestable): The harvestable.
  • data (table): The data to set.

setRotation

kinematic:setRotation( rotation )

Set the harvestable's rotation.
Can only be used on kinematic harvestables.

Parameters:


setUvFrameIndex

harvestable:setUvFrameIndex( index )

Client-Only

Sets the UV animation frame with the given index.

Parameters:

  • harvestable (Harvestable): The harvestable.
  • index (int): The index.