Config

Config = {}

-- ================================================================
-- GENERAL BUILDING SETTINGS
-- Core mechanics and distance configurations
-- ================================================================

-- Attachment and placement 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)

-- Building validation settings
Config.minOverlap = { -- Minimum overlap required for building pieces
	x = 50, -- X-axis overlap percentage
	y = 50, -- Y-axis overlap percentage
	z = 50, -- Z-axis overlap percentage
}

-- Editor and interface settings
Config.targetResource = "ox_target" -- Target resource for interactions ox_target or qb-target
Config.editorWait = 15 -- Wait time in editor mode (milliseconds)
Config.rayCastCacheTime = 25 -- Ray casting cache duration (milliseconds)
Config.percentageOfObjectOnFoundation = 85.0 -- Required percentage of object on foundation
Config.freeRotateSpeed = 1.0 -- Speed of rotation (0.2 = 5 degrees per second)
Config.freeRotateStep = 5.0 -- Step of rotation (5.0 = 5 degrees)
Config.freeRotateDelay = 10 -- Delay between rotations (150 = 150ms)
Config.editorBaseObject = GetHashKey("5s_building_twig_base") -- Default base object for editor
Config.canClimbOnWalls = false -- Can players climb on walls
Config.adminMenuCommand = "adminbuilding" -- Command to open the admin menu | authentication is in server/editable/auth.lua
Config.drawBuildingMarker = true -- Draw building markers in editor

-- ================================================================
-- OBJECT STREAMING SYSTEM
-- Performance optimization for large building areas
-- ================================================================

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

	-- Type-specific streaming distances for performance optimization
	typeDistances = {
		foundation = 150.0, -- Foundation pieces (highest priority)
		wall = 150.0, -- Wall pieces
		door = 150.0, -- Door and doorway pieces
		floor = 130.0, -- Roof pieces
		stairs = 110.0, -- Stair pieces
		other = 100.0, -- Other building elements
	},
}

Config.destroyNotOwnedBuilding = {
	enabled = true,
	time = 5, -- Time (in hours) after which an object will be destroyed if it is not within the TC (Tool Cupboard) area
}

Config.disableDoorCollisionDuringOpen = true -- Disable door collision during open
Config.logActivitiesEnabled = true -- Enable logging activities. This is used to log activities to the database.

-- ================================================================
-- RESTRICTED BUILDING ZONES
-- Areas where building is prohibited
-- ================================================================


Config.buildOnlyInWhitelistedZones = false -- Enable/disable building only in whitelisted zones
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 SETTINGS
-- Removal, repair, and maintenance configurations
-- ================================================================

-- Structure removal settings
Config.removeStructure = {
	returnItem = true, -- Return materials when removing structures
	costPercent = 50, -- Percentage of materials returned (50%)
}

-- Structure repair settings
Config.repairStructure = {
	costPercent = 50, -- Percentage of original cost to repair (50%)
	repairPercent = 100, -- Percentage of health restored per repair (100%)
}

-- Tool Cupboard (TC) settings
Config.tc = {
	ownedRadius = 30.0, -- Radius of area controlled by TC
}

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

-- ================================================================
-- DAMAGE SYSTEM CONFIGURATION
-- Structure damage from weapons and explosions
-- ================================================================

Config.structureDamage = {
	enabled = true, -- Enable/disable damage system

	-- Damage from different explosion types
	explosionsDamage = {
		[0] = -10, -- Grenade damage
		[1] = -15, -- Grenade launcher damage
		[2] = -500, -- Tank shell damage
		[4] = -250, -- Car explosion damage
	},

	-- Damage from specific weapons
	weaponsDamage = {
		[GetHashKey("WEAPON_PISTOL")] = -10,
		[GetHashKey("WEAPON_MARKSMANPISTOL")] = -10,
		[GetHashKey("WEAPON_NAVYREVOLVER")] = -10,
		[GetHashKey("WEAPON_GADGETPISTOL")] = -10,
		[GetHashKey("WEAPON_MINISMG")] = -10,
		[GetHashKey("WEAPON_REVOLVER_MK2")] = -10,
		[GetHashKey("WEAPON_GUSENBERG")] = -10,
		[GetHashKey("WEAPON_SMG")] = -10,
	},
}

-- Damage when failing to enter correct code
Config.DamageOnFailCode = {
	enable = true, -- Enable damage on failed code attempts
	amount = 10, -- Damage amount per failed attempt
}

-- ================================================================
-- DECAY SYSTEM
-- Natural deterioration of structures over time
-- ================================================================

Config.decayUpkeepPeriod = 1 -- hours
Config.decayCheckInterval = 5 -- minutes

Config.decayData = {
	twig = {
		cost = 2.5, -- cost of upkeep on Config.decayUpkeepPeriod time
		decayTime = 60, -- time in minutes to destroy when object has max health
	},
	wood = {
		cost = 7.5, -- cost of upkeep on decayUpkeepPeriod time
		decayTime = 180, -- time in minutes to destroy when object has max health
	},
	stone = {
		cost = 5, -- cost of upkeep on decayUpkeepPeriod time
		decayTime = 300, -- time in minutes to destroy when object has max health
	},
	metal = {
		cost = 2.5, -- cost of upkeep on decayUpkeepPeriod time
		decayTime = 400, -- time in minutes to destroy when object has max health
	},
	hqm = {
		cost = 0.5, -- cost of upkeep on decayUpkeepPeriod time
		decayTime = 720, -- time in minutes to destroy when object has max health
	},
}

-- ================================================================
-- VISUAL EFFECTS SYSTEM
-- Particle effects for building interactions
-- ================================================================

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 SYSTEM
-- Available materials and their properties
-- ================================================================

Config.materials = {
	twig = {
		type = "twig",
		item = "wood",
		label = "Twig",
		image = "./images/wood.webp",
		decayData = Config.decayData.twig,
	},
	wood = {
		type = "wood",
		item = "wood", -- Item name in inventory
		label = "Wood", -- Display name
		image = "./images/wood.webp",
		decayData = Config.decayData.wood,
	},
	stone = {
		type = "stone",
		item = "stone",
		label = "Stone",
		image = "./images/stone.webp",
		decayData = Config.decayData.stone,
	},
	metal = {
		type = "metal",
		item = "metal",
		label = "Metal",
		image = "./images/metal.webp",
		decayData = Config.decayData.metal,
	},
	hqm = {
		type = "hqm",
		item = "hqm",
		label = "HQM", -- High Quality Metal
		image = "./images/hqm.webp",
		decayData = Config.decayData.hqm,
	},
}
-- ================================================================
-- BUILDING PIECES CONFIGURATION
-- All available building structures and their properties
-- ================================================================

Config.models = {

	-- ============================================================
	-- TWIG TIER STRUCTURES (Tier 1 - Weakest)
	-- ============================================================

	-- Twig Foundation (Square)
	[GetHashKey("5s_building_twig_base")] = {
		basic = true, -- Available from start
		type = "foundation", -- Structure type
		material = Config.materials.twig, -- Required material
		cost = 20, -- Material cost
		health = 50, -- Maximum health points
		upgrade = { -- Available upgrades
			GetHashKey("5s_building_wood_base"),
			GetHashKey("5s_building_stone_base"),
			GetHashKey("5s_building_metal_base"),
			GetHashKey("5s_building_hqmetal_base"),
		},
		offset = { x = 0.0, y = 0.0, z = 0.0 }, -- Placement offset
		canFreeRotate = true, -- Allow free rotation
		applyWeaponDamage = true, -- Take weapon damage
		applyExplosionDamage = true, -- Take explosion damage
		ui = {
			name = "Twig Base",
			description = "A base made of twig",
			image = "./images/-2055079445.webp",
		},
	},

	-- Twig Foundation (Triangle)
	[GetHashKey("5s_building_twig_base_triangle")] = {
		type = "foundation",
		subType = "triangle", -- Triangle variant
		basic = true,
		material = Config.materials.twig,
		cost = 20,
		health = 50,
		upgrade = {
			GetHashKey("5s_building_wood_base_triangle"),
			GetHashKey("5s_building_stone_base_triangle"),
			GetHashKey("5s_building_metal_base_triangle"),
			GetHashKey("5s_building_hqmetal_base_triangle"),
		},
		applyWeaponDamage = true,
		applyExplosionDamage = true,
		canFreeRotate = true,
		offset = { x = 0.0, y = 0.0, z = 0.0 },
		ui = {
			name = "Twig Base Triangle",
			description = "A triangular base made of twig",
			image = "./images/1625316909.webp",
		},
	},

	-- Twig Wall (Full Height)
	[GetHashKey("5s_building_twig_wall")] = {
		basic = true,
		type = "wall",
		material = Config.materials.twig,
		cost = 20,
		health = 50,
		upgrade = {
			GetHashKey("5s_building_wood_wall"),
			GetHashKey("5s_building_stone_wall"),
			GetHashKey("5s_building_metal_wall"),
			GetHashKey("5s_building_hqmetal_wall"),
		},
		offset = { x = 0.0, y = 0.0, z = 0.0 },
		applyWeaponDamage = true,
		applyExplosionDamage = true,
		ui = {
			name = "Twig Wall",
			description = "A wall made of twig",
			image = "./images/-936107535.webp",
		},
	},

	-- Twig Wall (Half Height)
	[GetHashKey("5s_building_twig_wallH")] = {
		basic = true,
		type = "wall",
		subType = "half", -- Half-height variant
		material = Config.materials.twig,
		cost = 20,
		health = 50,
		upgrade = {
			GetHashKey("5s_building_wood_wallH"),
			GetHashKey("5s_building_stone_wallH"),
			GetHashKey("5s_building_metal_wallH"),
			GetHashKey("5s_building_hqmetal_wallH"),
		},
		offset = { x = 0.0, y = 0.0, z = 0.0 },
		applyWeaponDamage = true,
		applyExplosionDamage = true,
		ui = {
			name = "Twig Wall Half",
			description = "A half-height wall made of twig",
			image = "./images/646523580.webp",
		},
	},

	-- Twig Doorway
	[GetHashKey("5s_building_twig_doorway")] = {
		basic = true,
		type = "doorframe",
		material = Config.materials.twig,
		cost = 20,
		health = 50,
		upgrade = {
			GetHashKey("5s_building_wood_doorway"),
			GetHashKey("5s_building_stone_doorway"),
			GetHashKey("5s_building_metal_doorway"),
			GetHashKey("5s_building_hqmetal_doorway"),
		},
		offset = { x = 0.0, y = 0.0, z = 0.0 },
		applyWeaponDamage = true,
		applyExplosionDamage = true,
		ui = {
			name = "Twig Doorway",
			description = "A doorway frame made of twig",
			image = "./images/-1322035059.webp",
		},
	},

	-- Twig Stairs
	[GetHashKey("5s_building_twig_stairs")] = {
		basic = true,
		type = "stair",
		material = Config.materials.twig,
		cost = 20,
		health = 50,
		upgrade = {
			GetHashKey("5s_building_wood_stairs"),
			GetHashKey("5s_building_stone_stairs"),
			GetHashKey("5s_building_metal_stairs"),
			GetHashKey("5s_building_hqmetal_stairs"),
		},
		offset = { x = 0.0, y = 0.0, z = 0.9 }, -- Elevated placement
		applyWeaponDamage = true,
		applyExplosionDamage = true,
		ui = {
			name = "Twig Stairs",
			description = "Stairs made of twig",
			image = "./images/557865093.webp",
		},
	},

	-- Twig Floor (Square)
	[GetHashKey("5s_building_twig_top")] = {
		basic = true,
		type = "floor",
		material = Config.materials.twig,
		cost = 20,
		health = 50,
		upgrade = {
			GetHashKey("5s_building_wood_top"),
			GetHashKey("5s_building_stone_top"),
			GetHashKey("5s_building_metal_top"),
			GetHashKey("5s_building_hqmetal_top"),
		},
		offset = { x = 0.0, y = 0.0, z = 0.0 },
		applyWeaponDamage = true,
		applyExplosionDamage = true,
		ui = {
			name = "Twig Floor",
			description = "A floor made of twig",
			image = "./images/-914402743.webp",
		},
	},

	-- Twig Floor (Triangle)
	[GetHashKey("5s_building_twig_top_triangle")] = {
		basic = true,
		type = "floor",
		subType = "triangle",
		material = Config.materials.twig,
		cost = 20,
		health = 50,
		upgrade = {
			GetHashKey("5s_building_wood_top_triangle"),
			GetHashKey("5s_building_stone_top_triangle"),
			GetHashKey("5s_building_metal_top_triangle"),
			GetHashKey("5s_building_hqmetal_top_triangle"),
		},
		offset = { x = 0.0, y = 0.0, z = 0.0 },
		applyWeaponDamage = true,
		applyExplosionDamage = true,
		ui = {
			name = "Twig Floor Triangle",
			description = "A triangular floor made of twig",
			image = "./images/1328870292.webp",
		},
	},

	-- ============================================================
	-- WOOD TIER STRUCTURES (Tier 2)
	-- ============================================================

	-- Wood Foundation (Square)
	[GetHashKey("5s_building_wood_base")] = {
		type = "foundation", -- Structure type
		material = Config.materials.wood, -- Required material
		cost = 200, -- Material cost
		health = 500, -- Maximum health points
		upgrade = { -- Available upgrades
			GetHashKey("5s_building_stone_base"),
			GetHashKey("5s_building_metal_base"),
			GetHashKey("5s_building_hqmetal_base"),
		},
		offset = { x = 0.0, y = 0.0, z = 0.0 }, -- Placement offset
		canFreeRotate = true, -- Allow free rotation
		applyWeaponDamage = true, -- Take weapon damage
		applyExplosionDamage = true, -- Take explosion damage
		ui = {
			name = "Wood Base",
			description = "A base made of wood",
			image = "./images/square-foundation.webp",
		},
	},

	-- Wood Foundation (Triangle)
	[GetHashKey("5s_building_wood_base_triangle")] = {
		type = "foundation",
		subType = "triangle", -- Triangle variant
		material = Config.materials.wood,
		cost = 100,
		health = 500,
		upgrade = {
			GetHashKey("5s_building_stone_base_triangle"),
			GetHashKey("5s_building_metal_base_triangle"),
			GetHashKey("5s_building_hqmetal_base_triangle"),
		},
		applyWeaponDamage = true,
		applyExplosionDamage = true,
		canFreeRotate = true,
		offset = { x = 0.0, y = 0.0, z = 0.0 },
		ui = {
			name = "Wood Base Triangle",
			description = "A triangular base made of wood",
			image = "./images/triangle-foundation.webp",
		},
	},

	-- Wood Wall (Full Height)
	[GetHashKey("5s_building_wood_wall")] = {
		type = "wall",
		material = Config.materials.wood,
		cost = 200,
		health = 500,
		upgrade = {
			GetHashKey("5s_building_stone_wall"),
			GetHashKey("5s_building_metal_wall"),
			GetHashKey("5s_building_hqmetal_wall"),
		},
		offset = { x = 0.0, y = 0.0, z = 0.0 },
		applyWeaponDamage = true,
		applyExplosionDamage = true,
		ui = {
			name = "Wood Wall",
			description = "A wall made of wood",
			image = "./images/wall.webp",
		},
	},

	-- Wood Wall (Half Height)
	[GetHashKey("5s_building_wood_wallH")] = {
		type = "wall",
		subType = "half", -- Half-height variant
		material = Config.materials.wood,
		cost = 200,
		health = 500,
		upgrade = {
			GetHashKey("5s_building_stone_wallH"),
			GetHashKey("5s_building_metal_wallH"),
			GetHashKey("5s_building_hqmetal_wallH"),
		},
		offset = { x = 0.0, y = 0.0, z = 0.0 },
		applyWeaponDamage = true,
		applyExplosionDamage = true,
		ui = {
			name = "Wood Wall Half",
			description = "A half-height wall made of wood",
			image = "./images/half-wall.webp",
		},
	},

	-- Wood Doorway
	[GetHashKey("5s_building_wood_doorway")] = {
		type = "doorframe",
		material = Config.materials.wood,
		cost = 100,
		health = 500,
		upgrade = {
			GetHashKey("5s_building_stone_doorway"),
			GetHashKey("5s_building_metal_doorway"),
			GetHashKey("5s_building_hqmetal_doorway"),
		},
		offset = { x = 0.0, y = 0.0, z = 0.0 },
		applyWeaponDamage = true,
		applyExplosionDamage = true,
		ui = {
			name = "Wood Doorway",
			description = "A doorway frame made of wood",
			image = "./images/doorway.webp",
		},
	},

	-- Wood Stairs
	[GetHashKey("5s_building_wood_stairs")] = {
		type = "stair",
		material = Config.materials.wood,
		cost = 100,
		health = 500,
		upgrade = {
			GetHashKey("5s_building_stone_stairs"),
			GetHashKey("5s_building_metal_stairs"),
			GetHashKey("5s_building_hqmetal_stairs"),
		},
		offset = { x = 0.0, y = 0.0, z = 0.9 }, -- Elevated placement
		applyWeaponDamage = true,
		applyExplosionDamage = true,
		ui = {
			name = "Wood Stairs",
			description = "Stairs made of wood",
			image = "./images/stairs.webp",
		},
	},

	-- Wood Floor (Square)
	[GetHashKey("5s_building_wood_top")] = {
		type = "floor",
		material = Config.materials.wood,
		cost = 100,
		health = 500,
		upgrade = {
			GetHashKey("5s_building_stone_top"),
			GetHashKey("5s_building_metal_top"),
			GetHashKey("5s_building_hqmetal_top"),
		},
		offset = { x = 0.0, y = 0.0, z = 0.0 },
		applyWeaponDamage = true,
		applyExplosionDamage = true,
		ui = {
			name = "Wood Floor",
			description = "A floor made of wood",
			image = "./images/square-floor.webp",
		},
	},

	-- Wood Floor (Triangle)
	[GetHashKey("5s_building_wood_top_triangle")] = {
		type = "floor",
		subType = "triangle",
		material = Config.materials.wood,
		cost = 50,
		health = 500,
		upgrade = {
			GetHashKey("5s_building_stone_top_triangle"),
			GetHashKey("5s_building_metal_top_triangle"),
			GetHashKey("5s_building_hqmetal_top_triangle"),
		},
		offset = { x = 0.0, y = 0.0, z = 0.0 },
		applyWeaponDamage = true,
		applyExplosionDamage = true,
		ui = {
			name = "Wood Floor Triangle",
			description = "A triangular floor made of wood",
			image = "./images/triangle-floor.webp",
		},
	},

	-- ============================================================
	-- STONE TIER STRUCTURES (Tier 3)
	-- ============================================================

	-- Stone Foundation (Square)
	[GetHashKey("5s_building_stone_base")] = {
		type = "foundation",
		material = Config.materials.stone,
		cost = 300,
		health = 1000,
		upgrade = {
			GetHashKey("5s_building_wood_base"),
			GetHashKey("5s_building_metal_base"),
			GetHashKey("5s_building_hqmetal_base"),
		},
		offset = { x = 0.0, y = 0.0, z = 0.0 },
		canFreeRotate = true,
		applyWeaponDamage = true,
		applyExplosionDamage = true,
		ui = {
			name = "Stone Base",
			description = "A sturdy base made of stone",
			image = "./images/square-foundation.webp",
		},
	},

	-- Stone Foundation (Triangle)
	[GetHashKey("5s_building_stone_base_triangle")] = {
		type = "foundation",
		subType = "triangle",
		material = Config.materials.stone,
		cost = 150,
		health = 1000,
		upgrade = {
			GetHashKey("5s_building_wood_base_triangle"),
			GetHashKey("5s_building_metal_base_triangle"),
			GetHashKey("5s_building_hqmetal_base_triangle"),
		},
		canFreeRotate = true,
		applyWeaponDamage = true,
		applyExplosionDamage = true,
		offset = { x = 0.0, y = 0.0, z = 0.0 },
		ui = {
			name = "Stone Base Triangle",
			description = "A triangular base made of stone",
			image = "./images/triangle-foundation.webp",
		},
	},

	-- Stone Wall
	[GetHashKey("5s_building_stone_wall")] = {
		type = "wall",
		material = Config.materials.stone,
		cost = 300,
		health = 1000,
		upgrade = {
			GetHashKey("5s_building_wood_wall"),
			GetHashKey("5s_building_metal_wall"),
			GetHashKey("5s_building_hqmetal_wall"),
		},
		offset = { x = 0.0, y = 0.0, z = 0.0 },
		applyWeaponDamage = true,
		applyExplosionDamage = true,
		ui = {
			name = "Stone Wall",
			description = "A durable wall made of stone",
			image = "./images/wall.webp",
		},
	},

	-- Stone Doorway
	[GetHashKey("5s_building_stone_doorway")] = {
		type = "doorframe",
		material = Config.materials.stone,
		cost = 150,
		health = 1000,
		upgrade = {
			GetHashKey("5s_building_wood_doorway"),
			GetHashKey("5s_building_metal_doorway"),
			GetHashKey("5s_building_hqmetal_doorway"),
		},
		offset = { x = 0.0, y = 0.0, z = 0.0 },
		applyWeaponDamage = true,
		applyExplosionDamage = true,
		ui = {
			name = "Stone Doorway",
			description = "A doorway frame made of stone",
			image = "./images/doorway.webp",
		},
	},

	-- Stone Stairs
	[GetHashKey("5s_building_stone_stairs")] = {
		type = "stair",
		material = Config.materials.stone,
		cost = 150,
		health = 1000,
		upgrade = {
			GetHashKey("5s_building_wood_stairs"),
			GetHashKey("5s_building_metal_stairs"),
			GetHashKey("5s_building_hqmetal_stairs"),
		},
		offset = { x = 0.0, y = 0.0, z = 0.9 },
		applyWeaponDamage = true,
		applyExplosionDamage = true,
		ui = {
			name = "Stone Stairs",
			description = "Stairs made of stone",
			image = "./images/stairs.webp",
		},
	},

	-- Stone Wall Half
	[GetHashKey("5s_building_stone_wallH")] = {
		type = "wall",
		subType = "half",
		material = Config.materials.stone,
		cost = 300,
		health = 1000,
		upgrade = {
			GetHashKey("5s_building_wood_wallH"),
			GetHashKey("5s_building_metal_wallH"),
			GetHashKey("5s_building_hqmetal_wallH"),
		},
		offset = { x = 0.0, y = 0.0, z = 0.0 },
		applyWeaponDamage = true,
		applyExplosionDamage = true,
		ui = {
			name = "Stone Wall Half",
			description = "A half-height wall made of stone",
			image = "./images/half-wall.webp",
		},
	},

	-- Stone Floor (Square)
	[GetHashKey("5s_building_stone_top")] = {
		type = "floor",
		material = Config.materials.stone,
		cost = 150,
		health = 1000,
		upgrade = {
			GetHashKey("5s_building_wood_top"),
			GetHashKey("5s_building_metal_top"),
			GetHashKey("5s_building_hqmetal_top"),
		},
		offset = { x = 0.0, y = 0.0, z = 0.0 },
		applyWeaponDamage = true,
		applyExplosionDamage = true,
		ui = {
			name = "Stone Floor",
			description = "A floor made of stone",
			image = "./images/square-floor.webp",
		},
	},

	-- Stone Floor (Triangle)
	[GetHashKey("5s_building_stone_top_triangle")] = {
		type = "floor",
		subType = "triangle",
		material = Config.materials.stone,
		cost = 75,
		health = 1000,
		upgrade = {
			GetHashKey("5s_building_wood_top_triangle"),
			GetHashKey("5s_building_metal_top_triangle"),
			GetHashKey("5s_building_hqmetal_top_triangle"),
		},
		offset = { x = 0.0, y = 0.0, z = 0.0 },
		applyWeaponDamage = true,
		applyExplosionDamage = true,
		ui = {
			name = "Stone Floor Triangle",
			description = "A triangular floor made of stone",
			image = "./images/triangle-floor.webp",
		},
	},

	-- ============================================================
	-- METAL TIER STRUCTURES (Tier 4)
	-- ============================================================

	-- Metal Foundation (Square)
	[GetHashKey("5s_building_metal_base")] = {
		type = "foundation",
		material = Config.materials.metal,
		cost = 200,
		health = 2000,
		upgrade = {
			GetHashKey("5s_building_wood_base"),
			GetHashKey("5s_building_stone_base"),
			GetHashKey("5s_building_hqmetal_base"),
		},
		offset = { x = 0.0, y = 0.0, z = 0.0 },
		canFreeRotate = true,
		applyWeaponDamage = true,
		applyExplosionDamage = true,
		ui = {
			name = "Metal Base",
			description = "A strong base made of metal",
			image = "./images/square-foundation.webp",
		},
	},

	-- Metal Foundation (Triangle)
	[GetHashKey("5s_building_metal_base_triangle")] = {
		type = "foundation",
		subType = "triangle",
		material = Config.materials.metal,
		cost = 100,
		health = 2000,
		upgrade = {
			GetHashKey("5s_building_wood_base_triangle"),
			GetHashKey("5s_building_stone_base_triangle"),
			GetHashKey("5s_building_hqmetal_base_triangle"),
		},
		canFreeRotate = true,
		applyWeaponDamage = true,
		applyExplosionDamage = true,
		offset = { x = 0.0, y = 0.0, z = 0.0 },
		ui = {
			name = "Metal Base Triangle",
			description = "A triangular base made of metal",
			image = "./images/triangle-foundation.webp",
		},
	},

	-- Metal Wall
	[GetHashKey("5s_building_metal_wall")] = {
		type = "wall",
		material = Config.materials.metal,
		cost = 200,
		health = 2000,
		upgrade = {
			GetHashKey("5s_building_wood_wall"),
			GetHashKey("5s_building_stone_wall"),
			GetHashKey("5s_building_hqmetal_wall"),
		},
		offset = { x = 0.0, y = 0.0, z = 0.0 },
		applyWeaponDamage = true,
		applyExplosionDamage = true,
		ui = {
			name = "Metal Wall",
			description = "A reinforced wall made of metal",
			image = "./images/wall.webp",
		},
	},

	-- Metal Doorway
	[GetHashKey("5s_building_metal_doorway")] = {
		type = "doorframe",
		material = Config.materials.metal,
		cost = 100,
		health = 2000,
		upgrade = {
			GetHashKey("5s_building_wood_doorway"),
			GetHashKey("5s_building_stone_doorway"),
			GetHashKey("5s_building_hqmetal_doorway"),
		},
		offset = { x = 0.0, y = 0.0, z = 0.0 },
		applyWeaponDamage = true,
		applyExplosionDamage = true,
		ui = {
			name = "Metal Doorway",
			description = "A doorway frame made of metal",
			image = "./images/doorway.webp",
		},
	},

	-- Metal Stairs
	[GetHashKey("5s_building_metal_stairs")] = {
		type = "stair",
		material = Config.materials.metal,
		cost = 200,
		health = 2000,
		upgrade = {
			GetHashKey("5s_building_wood_stairs"),
			GetHashKey("5s_building_stone_stairs"),
			GetHashKey("5s_building_hqmetal_stairs"),
		},
		offset = { x = 0.0, y = 0.0, z = 0.9 },
		applyWeaponDamage = true,
		applyExplosionDamage = true,
		ui = {
			name = "Metal Stairs",
			description = "Stairs made of metal",
			image = "./images/stairs.webp",
		},
	},

	-- Metal Wall Half
	[GetHashKey("5s_building_metal_wallH")] = {
		type = "wall",
		subType = "half",
		material = Config.materials.metal,
		cost = 200,
		health = 2000,
		upgrade = {
			GetHashKey("5s_building_wood_wallH"),
			GetHashKey("5s_building_stone_wallH"),
			GetHashKey("5s_building_hqmetal_wallH"),
		},
		offset = { x = 0.0, y = 0.0, z = 0.0 },
		applyWeaponDamage = true,
		applyExplosionDamage = true,
		ui = {
			name = "Metal Wall Half",
			description = "A half-height wall made of metal",
			image = "./images/half-wall.webp",
		},
	},

	-- Metal Floor (Square)
	[GetHashKey("5s_building_metal_top")] = {
		type = "floor",
		material = Config.materials.metal,
		cost = 100,
		health = 2000,
		upgrade = {
			GetHashKey("5s_building_wood_top"),
			GetHashKey("5s_building_stone_top"),
			GetHashKey("5s_building_hqmetal_top"),
		},
		offset = { x = 0.0, y = 0.0, z = 0.0 },
		applyWeaponDamage = true,
		applyExplosionDamage = true,
		ui = {
			name = "Metal Floor",
			description = "A floor made of metal",
			image = "./images/square-floor.webp",
		},
	},

	-- Metal Floor (Triangle)
	[GetHashKey("5s_building_metal_top_triangle")] = {
		type = "floor",
		subType = "triangle",
		material = Config.materials.metal,
		cost = 50,
		health = 2000,
		upgrade = {
			GetHashKey("5s_building_wood_top_triangle"),
			GetHashKey("5s_building_stone_top_triangle"),
			GetHashKey("5s_building_hqmetal_top_triangle"),
		},
		offset = { x = 0.0, y = 0.0, z = 0.0 },
		applyWeaponDamage = true,
		applyExplosionDamage = true,
		ui = {
			name = "Metal Floor Triangle",
			description = "A triangular floor made of metal",
			image = "./images/triangle-floor.webp",
		},
	},

	-- ============================================================
	-- HIGH QUALITY METAL TIER STRUCTURES (Tier 5 - Strongest)
	-- ============================================================

	-- HQM Foundation (Square)
	[GetHashKey("5s_building_hqmetal_base")] = {
		type = "foundation",
		material = Config.materials.hqm,
		cost = 25,
		health = 4000,
		upgrade = {
			GetHashKey("5s_building_wood_base"),
			GetHashKey("5s_building_stone_base"),
			GetHashKey("5s_building_metal_base"),
		},
		offset = { x = 0.0, y = 0.0, z = 0.0 },
		canFreeRotate = true,
		applyWeaponDamage = true,
		applyExplosionDamage = true,
		ui = {
			name = "HQ Metal Base",
			description = "An armored base made of high quality metal",
			image = "./images/square-foundation.webp",
		},
	},

	-- HQM Foundation (Triangle)
	[GetHashKey("5s_building_hqmetal_base_triangle")] = {
		type = "foundation",
		subType = "triangle",
		material = Config.materials.hqm,
		cost = 25,
		health = 4000,
		upgrade = {
			GetHashKey("5s_building_wood_base_triangle"),
			GetHashKey("5s_building_stone_base_triangle"),
			GetHashKey("5s_building_metal_base_triangle"),
		},
		canFreeRotate = true,
		applyWeaponDamage = true,
		applyExplosionDamage = true,
		offset = { x = 0.0, y = 0.0, z = 0.0 },
		ui = {
			name = "HQ Metal Base Triangle",
			description = "A triangular base made of high quality metal",
			image = "./images/triangle-foundation.webp",
		},
	},

	-- HQM Wall
	[GetHashKey("5s_building_hqmetal_wall")] = {
		type = "wall",
		material = Config.materials.hqm,
		cost = 25,
		health = 4000,
		upgrade = {
			GetHashKey("5s_building_wood_wall"),
			GetHashKey("5s_building_stone_wall"),
			GetHashKey("5s_building_metal_wall"),
		},
		offset = { x = 0.0, y = 0.0, z = 0.0 },
		applyWeaponDamage = true,
		applyExplosionDamage = true,
		ui = {
			name = "HQ Metal Wall",
			description = "An armored wall made of high quality metal",
			image = "./images/wall.webp",
		},
	},

	-- HQM Doorway
	[GetHashKey("5s_building_hqmetal_doorway")] = {
		type = "doorframe",
		material = Config.materials.hqm,
		cost = 25,
		health = 4000,
		upgrade = {
			GetHashKey("5s_building_wood_doorway"),
			GetHashKey("5s_building_stone_doorway"),
			GetHashKey("5s_building_metal_doorway"),
		},
		offset = { x = 0.0, y = 0.0, z = 0.0 },
		applyWeaponDamage = true,
		applyExplosionDamage = true,
		ui = {
			name = "HQ Metal Doorway",
			description = "A doorway frame made of high quality metal",
			image = "./images/doorway.webp",
		},
	},

	-- HQM Stairs
	[GetHashKey("5s_building_hqmetal_stairs")] = {
		type = "stair",
		material = Config.materials.hqm,
		cost = 25,
		health = 4000,
		upgrade = {
			GetHashKey("5s_building_wood_stairs"),
			GetHashKey("5s_building_stone_stairs"),
			GetHashKey("5s_building_metal_stairs"),
		},
		offset = { x = 0.0, y = 0.0, z = 0.9 },
		applyWeaponDamage = true,
		applyExplosionDamage = true,
		ui = {
			name = "HQ Metal Stairs",
			description = "Stairs made of high quality metal",
			image = "./images/stairs.webp",
		},
	},

	-- HQM Wall Half
	[GetHashKey("5s_building_hqmetal_wallH")] = {
		type = "wall",
		subType = "half",
		material = Config.materials.hqm,
		cost = 25,
		health = 4000,
		upgrade = {
			GetHashKey("5s_building_wood_wallH"),
			GetHashKey("5s_building_stone_wallH"),
			GetHashKey("5s_building_metal_wallH"),
		},
		offset = { x = 0.0, y = 0.0, z = 0.0 },
		applyWeaponDamage = true,
		applyExplosionDamage = true,
		ui = {
			name = "HQ Metal Wall Half",
			description = "A half-height wall made of high quality metal",
			image = "./images/half-wall.webp",
		},
	},

	-- HQM Floor (Square)
	[GetHashKey("5s_building_hqmetal_top")] = {
		type = "floor",
		material = Config.materials.hqm,
		cost = 13,
		health = 4000,
		upgrade = {
			GetHashKey("5s_building_wood_top"),
			GetHashKey("5s_building_stone_top"),
			GetHashKey("5s_building_metal_top"),
		},
		offset = { x = 0.0, y = 0.0, z = 0.0 },
		applyWeaponDamage = true,
		applyExplosionDamage = true,
		ui = {
			name = "HQ Metal Floor",
			description = "A floor made of high quality metal",
			image = "./images/square-floor.webp",
		},
	},

	-- HQM Floor (Triangle)
	[GetHashKey("5s_building_hqmetal_top_triangle")] = {
		type = "floor",
		subType = "triangle",
		material = Config.materials.hqm,
		cost = 7,
		health = 4000,
		upgrade = {
			GetHashKey("5s_building_wood_top_triangle"),
			GetHashKey("5s_building_stone_top_triangle"),
			GetHashKey("5s_building_metal_top_triangle"),
		},
		offset = { x = 0.0, y = 0.0, z = 0.0 },
		applyWeaponDamage = true,
		applyExplosionDamage = true,
		ui = {
			name = "HQ Metal Floor Triangle",
			description = "A triangular floor made of high quality metal",
			image = "./images/triangle-floor.webp",
		},
	},
}

-- ================================================================
-- SPECIAL STRUCTURES CONFIGURATION
-- Deployable items, doors, locks, and functional objects
-- ================================================================

Config.specialModels = {

	-- Wooden Door
	[GetHashKey("5s_doors_wood_door")] = {
		type = "door", -- Special door type
		item = "wood-door", -- Required inventory item
		health = 400, -- Door health points
		requireFoundation = false, -- Doesn't need foundation
		requireAttach = true, -- Must attach to doorway
		offset = { x = -0.04, y = -0.04, z = -0.42 }, -- Precise door placement
		returnItem = true, -- Return item when removed
		applyWeaponDamage = true,
		applyExplosionDamage = true,
		events = { -- Custom event handlers
			place = {
				client = "5s_building:createDoor",
				server = "5s_building:placeDoor",
			},
			remove = {
				client = "5s_building:removeDoor",
				server = "5s_building:removeDoor",
			},
		},

		ui = {
			name = "Wooden Door",
		},
	},

	-- Metal Door
	[GetHashKey("5s_doors_metal_door")] = {
		type = "door", -- Special door type
		item = "metal-door", -- Required inventory item
		health = 500, -- Door health points
		requireFoundation = false, -- Doesn't need foundation
		requireAttach = true, -- Must attach to doorway
		offset = { x = -0.04, y = -0.04, z = -0.42 }, -- Precise door placement
		returnItem = true, -- Return item when removed
		applyWeaponDamage = true,
		applyExplosionDamage = true,
		events = { -- Custom event handlers
			place = {
				client = "5s_building:createDoor",
				server = "5s_building:placeDoor",
			},
			remove = {
				client = "5s_building:removeDoor",
				server = "5s_building:removeDoor",
			},
		},

		ui = {
			name = "Metal Door",
		},
	},

	-- HQ Metal Door
	[GetHashKey("5s_doors_hqmetal_door")] = {
		type = "door", -- Special door type
		item = "hqm-door", -- Required inventory item
		health = 2000, -- Door health points
		requireFoundation = false, -- Doesn't need foundation
		requireAttach = true, -- Must attach to doorway
		offset = { x = -0.04, y = -0.04, z = -0.42 }, -- Precise door placement
		returnItem = true, -- Return item when removed
		applyWeaponDamage = true,
		applyExplosionDamage = true,
		events = { -- Custom event handlers
			place = {
				client = "5s_building:createDoor",
				server = "5s_building:placeDoor",
			},
			remove = {
				client = "5s_building:removeDoor",
				server = "5s_building:removeDoor",
			},
		},

		ui = {
			name = "HQ Metal Door",
		},
	},

	-- Code Lock
	[GetHashKey("5s_doors_codelock")] = {
		type = "codelock", -- Lock mechanism
		item = "codelock", -- Required inventory item
		health = 500, -- Lock health points
		requireFoundation = false, -- Doesn't need foundation
		requireAttach = true, -- Must attach to door
		offset = { x = 0.0, y = 0.0, z = 0.0 }, -- Lock placement offset
		returnItem = true, -- Return item when removed
		events = {
			place = {
				server = "5s_building:createCodeLock",
			},
			remove = {
				server = "5s_building:removeCodeLock",
			},
		},

		ui = {
			name = "Code Lock",
		},
	},

	-- Tool Cupboard (TC)
	[GetHashKey("5s_tc")] = {
		type = "tc", -- Territory control
		item = "tc", -- Required inventory item
		health = 200, -- TC health points
		requireFoundation = true, -- Must be on foundation
		requireAttach = false, -- Doesn't need attachment
		offset = { x = 0.0, y = 0.0, z = 0.0 }, -- TC placement offset
		canFreeRotate = true, -- Allow rotation
		returnItem = true, -- Return item when removed
		applyWeaponDamage = true,
		applyExplosionDamage = true,
		events = {
			place = {
				client = "5s_building:createTc",
				server = "5s_building:createTc",
			},
			remove = {
				client = "5s_building:removeTc",
				server = "5s_building:removeTc",
			},
		},

		ui = {
			name = "Tool Cupboard",
		},
	},

	-- Storage Chest
	[GetHashKey("m23_1_prop_m31_crate_tech_01a")] = {
		type = "chest", -- Storage container
		item = "chest", -- Required inventory item
		health = 600, -- Chest health points
		requireFoundation = true, -- Must be on foundation
		requireAttach = false, -- Doesn't need attachment
		offset = { x = 0.0, y = 0.0, z = 0.0 }, -- Chest placement offset
		canFreeRotate = true, -- Allow rotation
		returnItem = true, -- Return item when removed
		slots = 30, -- Storage slots
		weight = 100000, -- Weight capacity (grams)
		events = {
			place = {
				client = "5s_building:createChest",
				server = "5s_building:createChest",
			},
			remove = {
				client = "5s_building:removeChest",
				server = "5s_building:removeChest",
			},
		},

		ui = {
			name = "Storage Chest",
		},
	},
}

Config.upgradeAdmin = { -- don't change this
	["foundation"] = {
		GetHashKey("5s_building_twig_base"),
		GetHashKey("5s_building_wood_base"),
		GetHashKey("5s_building_stone_base"),
		GetHashKey("5s_building_metal_base"),
		GetHashKey("5s_building_hqmetal_base"),
	},
	["foundation-triangle"] = {
		GetHashKey("5s_building_twig_base_triangle"),
		GetHashKey("5s_building_wood_base_triangle"),
		GetHashKey("5s_building_stone_base_triangle"),
		GetHashKey("5s_building_metal_base_triangle"),
		GetHashKey("5s_building_hqmetal_base_triangle"),
	},
	["wall"] = {
		GetHashKey("5s_building_twig_wall"),
		GetHashKey("5s_building_wood_wall"),
		GetHashKey("5s_building_stone_wall"),
		GetHashKey("5s_building_metal_wall"),
		GetHashKey("5s_building_hqmetal_wall"),
	},
	["wall-half"] = {
		GetHashKey("5s_building_twig_wallH"),
		GetHashKey("5s_building_wood_wallH"),
		GetHashKey("5s_building_stone_wallH"),
		GetHashKey("5s_building_metal_wallH"),
		GetHashKey("5s_building_hqmetal_wallH"),
	},
	["doorframe"] = {
		GetHashKey("5s_building_twig_doorway"),
		GetHashKey("5s_building_wood_doorway"),
		GetHashKey("5s_building_stone_doorway"),
		GetHashKey("5s_building_metal_doorway"),
		GetHashKey("5s_building_hqmetal_doorway"),
	},
	["stair"] = {
		GetHashKey("5s_building_twig_stairs"),
		GetHashKey("5s_building_wood_stairs"),
		GetHashKey("5s_building_stone_stairs"),
		GetHashKey("5s_building_metal_stairs"),
		GetHashKey("5s_building_hqmetal_stairs"),
	},
	["floor"] = {
		GetHashKey("5s_building_twig_top"),
		GetHashKey("5s_building_wood_top"),
		GetHashKey("5s_building_stone_top"),
		GetHashKey("5s_building_metal_top"),
		GetHashKey("5s_building_hqmetal_top"),
	},
	["floor-triangle"] = {
		GetHashKey("5s_building_twig_top_triangle"),
		GetHashKey("5s_building_wood_top_triangle"),
		GetHashKey("5s_building_stone_top_triangle"),
		GetHashKey("5s_building_metal_top_triangle"),
		GetHashKey("5s_building_hqmetal_top_triangle"),
	},
}

Last updated