increase capacity||doc135674

September 20, 2022

Format

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

Description

Adds capacity to the original tray capacity.


Precautions

  • If the maximum capacity of the tray is set, the newly added capacity plus the capacity of the tray cannot be greater than the maximum capacity, otherwise there will be unexpected consequences

Parameters

Variable name type Description
capacity int increase 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, increase the tray capacity of the tray

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