> For the complete documentation index, see [llms.txt](https://5scripts-1.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://5scripts-1.gitbook.io/docs/assets/5s_building/config.md).

# Config

```lua
Config = {}

Config.debug = false -- Enable debug logs in server console

-- ================================================================
-- GENERAL BUILDING SETTINGS
-- ================================================================

-- Distances
Config.minDistanceAttach = 4.0       -- Minimum distance to attach building pieces
Config.maxDistance = 25.0            -- Maximum building distance from player
Config.blockDistancePlace = 8.0      -- Distance to block placement near other objects
Config.distancePlayerToObject = 20.0 -- Maximum distance player can be from object to interact
Config.placeCooldownSeconds = 0.4    -- Cooldown for placing objects (in seconds)

Config.buildingLimits = {
    enabled = true,
    maxObjectsPerPlayer = 250, -- Max objects a single player can own (0 = unlimited)
    maxObjectsPerTC = 250,     -- Max objects within a single TC radius (0 = unlimited)
}

Config.freeRotateSpeed = 0.5                      -- Object rotation speed (degrees per frame)
Config.freeRotateStep = 2.0                       -- Object rotation step (degrees per step)
Config.freeRotateDelay = 10                       -- Object rotation delay (ms)

-- Rotation snapping for pieces that can be rotated (walls, gates, TC, etc.).
--   "free" = smooth rotation while the rotate key is held
--   "step" = each key press snaps rotation by one fixed increment, for clean angles / square corners
Config.rotation = {
    mode = "step", -- "free" or "step"
    step = 15.0,   -- Degrees per key press in "step" mode (e.g. 15 / 45 / 90)
    -- Which piece types snap in "step" mode; every other type (foundations, etc.) keeps smooth
    -- free rotation. Set to false to snap all rotatable pieces.
    stepTypes = { "chest", "tc", "outerwall", "outerframe", "outergarageframe" },
}

-- External (perimeter) wall behaviour
Config.outerWalls = {
    allowSharpCorners = true, -- Let perimeter walls / frames meet at sharp (near-90°) corners
    cornerTolerance = 0.75,   -- How close two piece ends must be to count as a shared corner (metres)
}
Config.editorBaseObject = `5s_building_twig_base` -- Default base object for editor
Config.canClimbOnWalls = false                    -- Can players climb on walls
Config.adminMenuCommand =
"adminbuilding"                                   -- Chat command to open admin menu (auth logic is in server/editable/auth.lua)
Config.drawBuildingMarker = true                  -- Draw building markers in editor

-- ================================================================
-- OBJECT STREAMING
-- Controls when objects appear/disappear based on player distance
-- ================================================================

Config.objectStreamer = {
    streamDistance = 150.0,     -- Distance at which objects are created/loaded
    deleteDistance = 200.0,     -- Distance at which objects are removed/unloaded
    updateInterval = 150,       -- Update interval in milliseconds
    maxObjectsPerUpdate = 1000, -- Maximum objects processed per update cycle
    -- How far each piece type is visible (lower = loads later, saves performance)
    typeDistances = {
        foundation = 150.0,
        wall = 150.0,
        --roof = 150.0,
        door = 150.0,
        floor = 130.0,
        stair = 110.0,
        other = 100.0,
    },
}

-- ABANDONED BUILDINGS (pieces with no Tool Cupboard nearby)
-- This is a SEPARATE system from Decay (see DECAY SYSTEM below).
-- It removes any piece that has no TC within Config.tc.ownedRadius, and it
-- keeps working even when Config.decayEnabled is false. Turning off decay does
-- NOT stop abandoned buildings from being removed - use this setting for that.
Config.destroyNotOwnedBuilding = {
    enabled = true, -- Remove buildings that have no TC protecting them
    time = 5,       -- Hours a piece can exist without a TC before it is removed
}

Config.disableDoorCollisionDuringOpen = true -- Disable door collision during open
Config.logActivitiesEnabled = true           -- Log building actions (place, remove, upgrade, etc.) to the database

-- Periodic cleanup of old activity logs to keep the database lean.
Config.databaseCleanup = {
    enabled = true,
    activityRetentionDays = 7, -- How many days to keep activity logs (0 = keep forever)
    cleanupInterval = 60,      -- How often to run the cleanup (minutes)
}

-- ================================================================
-- BUILDING ZONES
-- ================================================================


Config.buildMode = "free"                  -- "free" = build anywhere, "tc_only" = only within TC radius
Config.buildOnlyInWhitelistedZones = false -- If true, players can ONLY build inside whitelisted zones below
Config.whitelistedZones = {
    {
        coords = vector3(1653.8590, 3239.3254, 40.5445), -- Zone coordinates
        radius = 50.0,                                   -- Zone radius in meters
        debug = false,                                   -- Show debug information

        -- Radius visualization on map
        radiusBlip = {
            enabled = true, -- Show radius circle on map
            color = 5,      -- Circle color
            alpha = 128,    -- Circle transparency
        },

        -- Map blip settings
        blip = {
            enabled = true,          -- Show blip on map
            id = 681,                -- Blip sprite ID
            color = 39,              -- Blip color
            size = 0.8,              -- Blip size
            alpha = 1.0,             -- Blip transparency
            shortRange = true,       -- Only show when close
            label = "Building Zone", -- Blip label
        },
    }
}


Config.noBuildingZones = {
    {
        coords = vector3(1836.0300, 3670.9900, 34.2767), -- Zone coordinates
        radius = 50.0,                                   -- Zone radius in meters
        debug = false,                                   -- Show debug information

        -- Radius visualization on map
        radiusBlip = {
            enabled = true, -- Show radius circle on map
            color = 1,      -- Circle color
            alpha = 128,    -- Circle transparency
        },

        -- Map blip settings
        blip = {
            enabled = true,             -- Show blip on map
            id = 681,                   -- Blip sprite ID
            color = 39,                 -- Blip color
            size = 0.8,                 -- Blip size
            alpha = 1.0,                -- Blip transparency
            shortRange = true,          -- Only show when close
            label = "No Building Zone", -- Blip label
        },
    },
    -- Add more zones here as needed
}

-- ================================================================
-- STRUCTURE MANAGEMENT
-- ================================================================

Config.removeStructure = {
    returnItem = true, -- Give materials back when a player removes their own structure
    costPercent = 50,  -- How much of the original cost is returned (%)
}

Config.repairStructure = {
    costPercent = 50,    -- How much of the original cost to repair (%)
    repairPercent = 100, -- How much health is restored per repair (%)
}

Config.tc = {
    ownedRadius = 40.0, -- How far the TC protects (in game units)
    checkInventorySpace = true, -- Block TC withdrawals when the player's inventory is full
}

Config.stash = {
    open = "server", -- "server" or "client" - where stash logic runs
}

-- ================================================================
-- UI COLORS
-- Used by both Tool Cupboard and Admin Panel interfaces
-- ================================================================

Config.ui = {
    primaryColor = "#e84c3d", -- Main accent (buttons, active states, links)
    successColor = "#4caf50", -- Success states, positive actions
    warningColor = "#f9a825", -- Warnings, caution states
    dangerColor  = "#e84c3d", -- Destructive actions, errors
}

-- ================================================================
-- RAIDING SYSTEM
-- ================================================================

Config.structureDamage = {
    enabled = true, -- Can structures take damage?

    -- Damage per explosion type (negative = damage)
    explosionsDamage = {
        default = -10, -- Fallback for any unlisted explosion type
        [0] = -150,    -- Grenade damage
        [2] = -500,    -- WEAPON_STICKYBOMB explosion damage
        [4] = -250,    -- WEAPON_RPG Rocket explosion damage
    },

    -- Damage archetypes - per-material damage for each weapon class
    -- Balance reference (HP: twig 50 / wood 500 / stone 1000 / metal 2000 / hqm 4000)
    -- Guns are meant to harass twig/wood. Stone+ requires explosives.
    damageArchetypes = {
        pistol  = { twig = -3, wood = -1, stone = -1, metal = -1, hqm = -1 },
        smg     = { twig = -3, wood = -2, stone = -1, metal = -1, hqm = -1 },
        rifle   = { twig = -4, wood = -3, stone = -1, metal = -1, hqm = -1 },
        mg      = { twig = -4, wood = -3, stone = -2, metal = -1, hqm = -1 },
        shotgun = { twig = -8, wood = -6, stone = -3, metal = -1, hqm = -1 },
        sniper  = { twig = -8, wood = -6, stone = -3, metal = -1, hqm = -1 },
    },

    -- Assign each weapon to a damage archetype
    -- For special models (TC, doors, etc.) the "special" fallback column is used (= twig values)
    weaponsDamage = {
        -- Pistols
        [`WEAPON_PISTOL`] = "pistol",
        [`WEAPON_PISTOL_MK2`] = "pistol",
        [`WEAPON_PISTOL50`] = "pistol",
        [`WEAPON_COMBATPISTOL`] = "pistol",
        [`WEAPON_HEAVYPISTOL`] = "pistol",
        [`WEAPON_MARKSMANPISTOL`] = "pistol",
        [`WEAPON_SNSPISTOL`] = "pistol",
        [`WEAPON_SNSPISTOL_MK2`] = "pistol",
        [`WEAPON_APPISTOL`] = "pistol",
        [`WEAPON_VINTAGEPISTOL`] = "pistol",
        [`WEAPON_CERAMICPISTOL`] = "pistol",
        [`WEAPON_GADGETPISTOL`] = "pistol",
        [`WEAPON_PISTOLXM3`] = "pistol",
        [`WEAPON_TECPISTOL`] = "pistol",
        [`WEAPON_NAVYREVOLVER`] = "pistol",
        [`WEAPON_DOUBLEACTION`] = "pistol",
        [`WEAPON_REVOLVER`] = "pistol",
        [`WEAPON_REVOLVER_MK2`] = "pistol",

        -- SMGs
        [`WEAPON_SMG`] = "smg",
        [`WEAPON_SMG_MK2`] = "smg",
        [`WEAPON_MINISMG`] = "smg",
        [`WEAPON_MICROSMG`] = "smg",
        [`WEAPON_MACHINEPISTOL`] = "smg",
        [`WEAPON_ASSAULTSMG`] = "smg",
        [`WEAPON_COMBATPDW`] = "smg",

        -- Rifles
        [`WEAPON_ASSAULTRIFLE`] = "rifle",
        [`WEAPON_ASSAULTRIFLE_MK2`] = "rifle",
        [`WEAPON_CARBINERIFLE`] = "rifle",
        [`WEAPON_CARBINERIFLE_MK2`] = "rifle",
        [`WEAPON_ADVANCEDRIFLE`] = "rifle",
        [`WEAPON_SPECIALCARBINE`] = "rifle",
        [`WEAPON_SPECIALCARBINE_MK2`] = "rifle",
        [`WEAPON_BULLPUPRIFLE`] = "rifle",
        [`WEAPON_BULLPUPRIFLE_MK2`] = "rifle",
        [`WEAPON_COMPACTRIFLE`] = "rifle",
        [`WEAPON_MILITARYRIFLE`] = "rifle",
        [`WEAPON_HEAVYRIFLE`] = "rifle",
        [`WEAPON_TACTICALRIFLE`] = "rifle",
        [`WEAPON_BATTLERIFLE`] = "rifle",

        -- Machine Guns
        [`WEAPON_MG`] = "mg",
        [`WEAPON_COMBATMG`] = "mg",
        [`WEAPON_COMBATMG_MK2`] = "mg",
        [`WEAPON_GUSENBERG`] = "mg",

        -- Shotguns
        [`WEAPON_PUMPSHOTGUN`] = "shotgun",
        [`WEAPON_PUMPSHOTGUN_MK2`] = "shotgun",
        [`WEAPON_SAWNOFFSHOTGUN`] = "shotgun",
        [`WEAPON_BULLPUPSHOTGUN`] = "shotgun",
        [`WEAPON_ASSAULTSHOTGUN`] = "shotgun",
        [`WEAPON_HEAVYSHOTGUN`] = "shotgun",
        [`WEAPON_DBSHOTGUN`] = "shotgun",
        [`WEAPON_AUTOSHOTGUN`] = "shotgun",
        [`WEAPON_COMBATSHOTGUN`] = "shotgun",

        -- Snipers
        [`WEAPON_SNIPERRIFLE`] = "sniper",
        [`WEAPON_HEAVYSNIPER`] = "sniper",
        [`WEAPON_HEAVYSNIPER_MK2`] = "sniper",
        [`WEAPON_MARKSMANRIFLE`] = "sniper",
        [`WEAPON_MARKSMANRIFLE_MK2`] = "sniper",
        [`WEAPON_PRECISIONRIFLE`] = "sniper",
        [`WEAPON_MUSKET`] = "sniper",
    },
}

Config.damageOnFailCode = {
    enabled = true, -- Hurt the player when they enter the wrong door code
    amount = 10,    -- How much damage per wrong attempt
}

Config.tcDefaultCodelock = true    -- TC automatically has a codelock when placed
Config.chestDefaultCodelock = true -- Chest automatically has a codelock when placed
Config.tcAuthSkipCodelock = true   -- TC-authorized players skip codelock on doors/chests in TC radius

-- Prevents or reduces damage to bases when all TC owners are offline
Config.offlineRaidProtection = {
    enabled = true,
    partialDamage = 0.0,   -- 0.0 = no damage at all, 0.5 = half damage, 1.0 = full damage (pointless)
    checkAuthList = true,  -- true = check ALL authorized TC users, false = only check TC owner
    notifyAttacker = true, -- Tell the attacker that the base is protected
}

-- Per-day raid schedule - restrict raiding to specific time windows per day of week
-- Days not listed in the table allow raiding all day
Config.raidSchedule = {
    enabled        = false, -- Set to false to allow raiding at all times
    notifyAttacker = true,  -- Tell the attacker that raiding is not allowed right now
    Monday         = { { start = "18:00", finish = "22:00" } },
    Tuesday        = { { start = "18:00", finish = "22:00" } },
    Wednesday      = { { start = "18:00", finish = "22:00" } },
    Thursday       = { { start = "18:00", finish = "22:00" } },
    Friday         = { { start = "18:00", finish = "23:00" } },
    Saturday       = { { start = "12:00", finish = "23:00" } },
    Sunday         = { { start = "12:00", finish = "22:00" } },
}

Config.raidTime = 15            -- Minutes a base stays "raided" after last player damage (0 = disabled)
Config.raidDamageThreshold = 50 -- Minimum accumulated damage before a base enters "raided" state (0 = any hit triggers raid)
Config.raidDamageWindow = 5     -- Minutes - damage accumulation resets if no damage received within this window
Config.raidBlockBuilding = true -- Prevent placing objects in raided TC zone
Config.raidBlockRepair = true   -- Prevent repairing objects in raided TC zone

Config.raidNotification = true
Config.raidNotificationTimer = 60 -- Seconds cooldown between notifications per TC

Config.storageLootDrop = {
    enabled = true,
    model = `prop_money_bag_01`,
    despawnTime = 300, -- Seconds before loot bag despawns
}

Config.offlineRaidingDisconnectTime = 5 -- How long (minutes) raiding stays possible after last auth player goes offline (0 = protect immediately)
Config.offlineRaidingRaidTime = 15      -- How long (minutes) a raid can continue after auth players log off mid-raid (0 = protect immediately)

-- ================================================================
-- DECAY SYSTEM (upkeep for buildings that HAVE a Tool Cupboard)
-- A TC consumes materials every upkeep period. If it runs empty, the pieces
-- in its radius slowly lose health until it is refilled.
-- This only affects TC-protected buildings. Pieces with NO TC are handled by
-- Config.destroyNotOwnedBuilding above - that is a separate setting, so
-- turning decay off here does not stop abandoned buildings from being removed.
-- ================================================================

Config.decayEnabled = true     -- false = no upkeep is charged and TC-protected buildings never lose health from decay
Config.decayUpkeepPeriod = 1   -- How often upkeep is charged (hours)
Config.decayCheckInterval = 10 -- How often decay damage is applied (minutes)

Config.decayData = {
    twig = {
        cost = 3,       -- Materials consumed per upkeep period
        decayTime = 60, -- Minutes to fully destroy from max health (when decaying)
    },
    wood = {
        cost = 7,
        decayTime = 180,
    },
    stone = {
        cost = 5,
        decayTime = 300,
    },
    metal = {
        cost = 3,
        decayTime = 400,
    },
    hqm = {
        cost = 1,
        decayTime = 720,
    },
}

-- ================================================================
-- TOOL CUPBOARD AUTO-REPAIR
-- A stocked Tool Cupboard can automatically repair damaged structures
-- in its radius, paying with the materials stored inside it (the same
-- stock used for upkeep, so keep extra materials in the cupboard for repairs).
-- ================================================================

Config.autoRepair = {
    enabled = true,       -- Let the Tool Cupboard auto-repair structures within its radius
    interval = 15,        -- How often it repairs (minutes). Use a value that divides 60 evenly (e.g. 5, 10, 15, 20, 30)
    maxHpPercent = 100,   -- Repair each structure up to this % of its max health (100 = fully repaired)
    costMultiplier = 1.0, -- Material cost compared to a manual repair (1.0 = same, 2.0 = twice as expensive)
}

-- ================================================================
-- PARTICLE EFFECTS
-- ================================================================

Config.particle = {
    upgrade = { -- Effect when upgrading structures
        dict = "scr_xm_submarine",
        name = "scr_xm_submarine_surface_explosion",
        scale = 1.0,
    },
    place = { -- Effect when placing structures
        dict = "scr_xm_submarine",
        name = "scr_xm_submarine_surface_explosion",
        scale = 0.6,
    },
    remove = { -- Effect when removing structures
        dict = "des_pro_tree_crash",
        name = "ent_ray_pro_tree_crash",
        scale = 0.7,
    },
    repair = { -- Effect when repairing structures
        dict = "des_pro_tree_crash",
        name = "ent_ray_pro_tree_crash",
        scale = 0.7,
    },
}

-- ================================================================
-- BUILDING MATERIALS
-- ================================================================

Config.materials = {
    twig = {
        type = "twig",
        item = "wood",
        locale = "material_twig",
        excludeFromTcUpkeep = true,
        image = "https://cfx-nui-5s_building/images/wood.webp",
        decayData = Config.decayData.twig,
    },
    wood = {
        type = "wood",
        item = "wood",
        locale = "material_wood",
        color = "#c98a4b",
        image = "https://cfx-nui-5s_building/images/wood.webp",
        decayData = Config.decayData.wood,
        orderInTc = 1,
    },
    stone = {
        type = "stone",
        item = "stone",
        locale = "material_stone",
        color = "#8899aa",
        image = "https://cfx-nui-5s_building/images/stone.webp",
        decayData = Config.decayData.stone,
        orderInTc = 2,
    },
    metal = {
        type = "metal",
        item = "metal",
        locale = "material_metal",
        color = "#5ba3d9",
        image = "https://cfx-nui-5s_building/images/metal.webp",
        decayData = Config.decayData.metal,
        orderInTc = 3,
    },
    hqm = {
        type = "hqm",
        item = "hqm",
        locale = "material_hqm",
        color = "#e8b84b",
        image = "https://cfx-nui-5s_building/images/hqm.webp",
        decayData = Config.decayData.hqm,
        orderInTc = 4,
    },
}

-- ================================================================
-- BUILDING PIECE BALANCE  ->  Config.models
--   material = material it is made of / costs (twig, wood, stone, metal, hqm)
--   cost     = how much of that material
--   health   = max HP
-- The outer walls & frames are placed from an item instead, so they use
-- repairMaterial / repairCost - that material only repairs them.
-- Special objects (doors, TC, chest...) are balanced below in Config.specialBalance.
-- ================================================================
Config.balance = {
    -- TWIG --
    [`5s_building_twig_base`] = { material = "twig", cost = 20, health = 50 },
    [`5s_building_twig_base_triangle`] = { material = "twig", cost = 20, health = 50 },
    [`5s_building_twig_wall`] = { material = "twig", cost = 20, health = 50 },
    [`5s_building_twig_wallH`] = { material = "twig", cost = 20, health = 50 },
    [`5s_building_twig_doorway`] = { material = "twig", cost = 20, health = 50 },
    [`5s_building_twig_stairs`] = { material = "twig", cost = 20, health = 50 },
    [`5s_building_twig_top`] = { material = "twig", cost = 20, health = 50 },
    [`5s_building_twig_top_triangle`] = { material = "twig", cost = 20, health = 50 },
    [`5s_building_twig_ramp`] = { material = "twig", cost = 20, health = 50 },
    [`5s_building_twig_roof`] = { material = "twig", cost = 20, health = 50 },
    [`5s_building_twig_triangle_roof`] = { material = "twig", cost = 20, health = 50 },
    [`5s_building_twig_triangle_wall_1`] = { material = "twig", cost = 20, health = 50 },
    [`5s_building_twig_triangle_wall_2`] = { material = "twig", cost = 20, health = 50 },
    [`5s_building_twig_window`] = { material = "twig", cost = 20, health = 50 },

    -- WOOD --
    [`5s_building_wood_base`] = { material = "wood", cost = 200, health = 500 },
    [`5s_building_wood_base_triangle`] = { material = "wood", cost = 100, health = 500 },
    [`5s_building_wood_wall`] = { material = "wood", cost = 200, health = 500 },
    [`5s_building_wood_wallH`] = { material = "wood", cost = 200, health = 500 },
    [`5s_building_wood_doorway`] = { material = "wood", cost = 100, health = 500 },
    [`5s_building_wood_stairs`] = { material = "wood", cost = 100, health = 500 },
    [`5s_building_wood_top`] = { material = "wood", cost = 100, health = 500 },
    [`5s_building_wood_top_triangle`] = { material = "wood", cost = 50, health = 500 },
    [`5s_building_wood_ramp`] = { material = "wood", cost = 200, health = 500 },
    [`5s_building_wood_roof`] = { material = "wood", cost = 200, health = 500 },
    [`5s_building_wood_triangle_roof`] = { material = "wood", cost = 200, health = 500 },
    [`5s_building_wood_triangle_wall_1`] = { material = "wood", cost = 200, health = 500 },
    [`5s_building_wood_triangle_wall_2`] = { material = "wood", cost = 200, health = 500 },
    [`5s_building_wood_window`] = { material = "wood", cost = 100, health = 500 },

    -- STONE --
    [`5s_building_stone_base`] = { material = "stone", cost = 300, health = 1000 },
    [`5s_building_stone_base_triangle`] = { material = "stone", cost = 150, health = 1000 },
    [`5s_building_stone_wall`] = { material = "stone", cost = 300, health = 1000 },
    [`5s_building_stone_doorway`] = { material = "stone", cost = 150, health = 1000 },
    [`5s_building_stone_stairs`] = { material = "stone", cost = 150, health = 1000 },
    [`5s_building_stone_wallH`] = { material = "stone", cost = 300, health = 1000 },
    [`5s_building_stone_top`] = { material = "stone", cost = 150, health = 1000 },
    [`5s_building_stone_top_triangle`] = { material = "stone", cost = 75, health = 1000 },
    [`5s_building_stone_ramp`] = { material = "stone", cost = 300, health = 1000 },
    [`5s_building_stone_roof`] = { material = "stone", cost = 300, health = 1000 },
    [`5s_building_stone_triangle_roof`] = { material = "stone", cost = 300, health = 1000 },
    [`5s_building_stone_triangle_wall_1`] = { material = "stone", cost = 300, health = 1000 },
    [`5s_building_stone_triangle_wall_2`] = { material = "stone", cost = 300, health = 1000 },
    [`5s_building_stone_window`] = { material = "stone", cost = 150, health = 1000 },

    -- METAL --
    [`5s_building_metal_base`] = { material = "metal", cost = 200, health = 2000 },
    [`5s_building_metal_base_triangle`] = { material = "metal", cost = 100, health = 2000 },
    [`5s_building_metal_wall`] = { material = "metal", cost = 200, health = 2000 },
    [`5s_building_metal_doorway`] = { material = "metal", cost = 100, health = 2000 },
    [`5s_building_metal_stairs`] = { material = "metal", cost = 200, health = 2000 },
    [`5s_building_metal_wallH`] = { material = "metal", cost = 200, health = 2000 },
    [`5s_building_metal_top`] = { material = "metal", cost = 100, health = 2000 },
    [`5s_building_metal_top_triangle`] = { material = "metal", cost = 50, health = 2000 },
    [`5s_building_metal_ramp`] = { material = "metal", cost = 200, health = 2000 },
    [`5s_building_metal_roof`] = { material = "metal", cost = 200, health = 2000 },
    [`5s_building_metal_triangle_roof`] = { material = "metal", cost = 200, health = 2000 },
    [`5s_building_metal_triangle_wall_1`] = { material = "metal", cost = 200, health = 2000 },
    [`5s_building_metal_triangle_wall_2`] = { material = "metal", cost = 200, health = 2000 },
    [`5s_building_metal_window`] = { material = "metal", cost = 100, health = 2000 },

    -- HQM --
    [`5s_building_hqmetal_base`] = { material = "hqm", cost = 25, health = 4000 },
    [`5s_building_hqmetal_base_triangle`] = { material = "hqm", cost = 25, health = 4000 },
    [`5s_building_hqmetal_wall`] = { material = "hqm", cost = 25, health = 4000 },
    [`5s_building_hqmetal_doorway`] = { material = "hqm", cost = 25, health = 4000 },
    [`5s_building_hqmetal_stairs`] = { material = "hqm", cost = 25, health = 4000 },
    [`5s_building_hqmetal_wallH`] = { material = "hqm", cost = 25, health = 4000 },
    [`5s_building_hqmetal_top`] = { material = "hqm", cost = 13, health = 4000 },
    [`5s_building_hqmetal_top_triangle`] = { material = "hqm", cost = 7, health = 4000 },
    [`5s_building_hqmetal_ramp`] = { material = "hqm", cost = 13, health = 4000 },
    [`5s_building_hqmetal_roof`] = { material = "hqm", cost = 25, health = 4000 },
    [`5s_building_hqmetal_triangle_roof`] = { material = "hqm", cost = 25, health = 4000 },
    [`5s_building_hqmetal_triangle_wall_1`] = { material = "hqm", cost = 25, health = 4000 },
    [`5s_building_hqmetal_triangle_wall_2`] = { material = "hqm", cost = 25, health = 4000 },
    [`5s_building_hqmetal_window`] = { material = "hqm", cost = 10, health = 4000 },

    -- Outer pieces --
    [`5s_building_outer_big_wood_wall`] = { repairMaterial = "wood", repairCost = 300, health = 500 },
    [`5s_building_outer_big_metal_wall`] = { repairMaterial = "metal", repairCost = 300, health = 1000 },
    [`5s_building_outer_big_wood_door_frame`] = { repairMaterial = "wood", repairCost = 200, health = 500 },
    [`5s_building_outer_big_metal_door_frame`] = { repairMaterial = "metal", repairCost = 200, health = 1000 },
    [`5s_building_outer_garage_door_frame`] = { repairMaterial = "metal", repairCost = 250, health = 800 },
    [`5s_building_outer_garage_door_frame_s`] = { material = "metal", cost = 150, health = 500 },
}

-- ================================================================
-- SPECIAL OBJECT BALANCE  ->  Config.specialModels
-- Doors, gates, windows, tool cupboard, chest, codelock, chair.
--   repairMaterial + repairCost = what repairing one costs
--   health                      = max HP
-- (they are placed / removed with their inventory item, set in data/models.lua)
-- ================================================================
Config.specialBalance = {
    [`5s_doors_wood_door`] = { repairMaterial = "wood", repairCost = 100, health = 400 },
    [`5s_doors_metal_door`] = { repairMaterial = "metal", repairCost = 125, health = 500 },
    [`5s_doors_hqmetal_door`] = { repairMaterial = "hqm", repairCost = 150, health = 2000 },
    [`5s_doors_codelock`] = { health = 500 },
    [`5s_building_tc`] = { health = 200 },
    [`m23_1_prop_m31_crate_tech_01a`] = { health = 600 },
    [`prop_old_wood_chair`] = { health = 100 },
    [`5s_building_window_breakable`] = { repairMaterial = "metal", repairCost = 100, health = 600 },
    [`5s_building_window_bulletproof`] = { repairMaterial = "metal", repairCost = 120, health = 600 },
    [`5s_building_window_half`] = { repairMaterial = "metal", repairCost = 100, health = 600 },
    [`5s_building_window_wood`] = { repairMaterial = "wood", repairCost = 80, health = 400 },
    [`5s_building_window_metal`] = { repairMaterial = "metal", repairCost = 100, health = 600 },
    [`5s_building_window_hqmetal`] = { repairMaterial = "hqm", repairCost = 120, health = 900 },
    [`5s_building_outer_big_wood_door1`] = { repairMaterial = "wood", repairCost = 200, health = 500 },
    [`5s_building_outer_big_metal_door1`] = { repairMaterial = "metal", repairCost = 300, health = 1000 },
    [`5s_building_outer_garage_door`] = { repairMaterial = "metal", repairCost = 250, health = 800 },
    [`5s_building_outer_garage_door_s`] = { repairMaterial = "metal", repairCost = 150, health = 500 },
}

```

## Building pieces — `data/models.lua`

The building pieces and special objects themselves live in **`data/models.lua`**: their types, sub-types, upgrade paths, models, placement offsets, doors, and — for toolbox objects (`includedInToolBox = true`) — the `resources` they are built from and refunded.

`Config.balance` sets each building piece's **material, cost and health**; `Config.specialBalance` sets each special object's **repairMaterial, repairCost and health**. Leave `data/models.lua` alone unless you want to add, remove, or swap the actual models.
