Decay

Welcome to Decay System

Starting from version 2.2.1, qs-inventory includes an advanced decay system that we can use independently, if we don't want to use it we can ignore this step and its configuration completely.

The decay system allows us to declare certain items that will rot (losing durability) to the point of breaking and not being able to use them, you even have the chance to have them deleted from your inventory after being broken.

The configuration of this is more than simple, in our qs-inventory/shared/items.lua we can add these additional values to the items that we want to have decay:

["created"] = nil, -- Required, but don't touch it, always nil!
["decay"] = 0.01, -- Item duration, less numbers, less duration.
["delete"] = false -- Do we remove the item when it breaks?

By adding this to a certain item, our code will look like this:

['tosti'] =  {
       ['name'] =  'tosti',
       ['label'] =  'Grilled Cheese Sandwich',
       ['weight'] =  200,
       ['type'] =  'item',
       ['image'] =  'tosti.png',
       ['unique'] =  false,
       ['useable'] =  true,
       ['shouldClose'] =  true,
       ['combinable'] =  nil,
       ['description'] =  'Nice to eat',
       ["created"] = nil, -- Required, but don't touch it, always nil!
       ["decay"] = 0.01, -- Item duration, less numbers, less duration.
       ["delete"] = false -- Do we remove the item when it breaks?
}

You can add fewer numbers using 0.005 for example, and the item will break faster!

Last updated