set maximum capacity||doc135676

September 20, 2022

Format

 tray:set_max_capacity(capacity)
  • The class to which the function belongs:tray

Description

Sets the maximum capacity of the tray.


Precautions

  • The maximum capacity set cannot be smaller than the current capacity of the tray, otherwise there will be unintended consequences

Parameters

Variable name type Description
capacity int Tray maximum capacity


Code Samples

On the server side of the entity templatemount script, add the registration of this type of entity object tray when adding itemCallback, set the maximum capacity of the tray to 20

Trigger.addHandler(this:cfg(), "SETTLE_ITEM", function(context)
    local entity = context.obj1
    local tray = context.tray
    tray:set_max_capacity(20)
end)