FAQ
I'm using inventory which is not supported by 5s_lib
Go to 5s_building/server/editable/inventory.lua and replace functions with those from your inventory
For example, core-inventory:
function getItemCount(source, itemName)
return exports.core_inventory:getItemCount(source, itemName)
end
function removeItem(source, itemName, count)
local itemCount = getItemCount(source, itemName)
assert(
itemCount >= count,
locale("server_insufficient_item")
.. count
.. " of "
.. itemName
.. " but only have "
.. itemCount
)
exports.core_inventory:removeItem(source, itemName, count)
end
function addItem(source, itemName, count)
exports.core_inventory:addItem(source, itemName, count)
end
Can I add additional buildable items?
The building system supports two types of constructions that can be added:
Item-based – e.g. chairs, boxes, etc. These require a specific inventory item to place (for example,
chair).Resource-based (toolbox) – e.g. walls, barricades, foundations. These consume materials from your inventory (like wood, metal, etc.) when built.
All new buildable items must be added inside Config.specialModels = {}
[GetHashKey("prop_old_wood_chair")] = {
type = "chair", -- chair
item = "chair", -- Required inventory item
health = 100, -- Chair health points
requireFoundation = false, -- Must be on foundation
requireAttach = false, -- Doesn't need attachment
offset = { x = 0.0, y = 0.0, z = 0.25 }, -- placement offset
canFreeRotate = true, -- Allow rotation
canFreeMove = true, -- Allow free movement up and down
returnItem = true, -- Return item when removed
events = {
place = {
client = "5s_building:createChair",
},
remove = {
client = "5s_building:removeChair",
},
},
ui = {
name = "Chair",
description = "A chair",
image = "./images/chair.webp",
},
includedInToolBox = true, -- if true, the object will be included in the toolbox and will be placed with resources not item
resources = {
["wood"] = {label = "Wood", amount = 1},
},
},Last updated