|
|
|
|
|
|
| local ReplicatedStorage = game:GetService("ReplicatedStorage")
|
| local CollectionService = game:GetService("CollectionService")
|
|
|
| local BiomeConfig = require(ReplicatedStorage:WaitForChild("Shared"):WaitForChild("BiomeConfig"))
|
| local GameConfig = require(ReplicatedStorage:WaitForChild("Shared"):WaitForChild("GameConfig"))
|
|
|
|
|
| local biomeZonesFolder = Instance.new("Folder")
|
| biomeZonesFolder.Name = "BiomeZones"
|
| biomeZonesFolder.Parent = workspace
|
|
|
| local worldFolder = Instance.new("Folder")
|
| worldFolder.Name = "WorldStructures"
|
| worldFolder.Parent = workspace
|
|
|
|
|
| local BiomeColors = {
|
| Forest = Color3.fromRGB(80, 130, 60),
|
| PineWoods = Color3.fromRGB(50, 100, 45),
|
| Swamp = Color3.fromRGB(65, 85, 50),
|
| Desert = Color3.fromRGB(210, 190, 130),
|
| Volcanic = Color3.fromRGB(70, 40, 35),
|
| IcePeak = Color3.fromRGB(190, 210, 230),
|
| TropicalRainforest = Color3.fromRGB(35, 110, 40),
|
| Meadow = Color3.fromRGB(140, 180, 80),
|
| }
|
|
|
| local function createBiomePlate(biomeName, biomeData)
|
| local region = biomeData.Region
|
| local regionWidth = region.MaxX - region.MinX
|
| local regionDepth = region.MaxZ - region.MinZ
|
| local centerX = (region.MinX + region.MaxX) / 2
|
| local centerZ = (region.MinZ + region.MaxZ) / 2
|
|
|
|
|
| local plate = Instance.new("Part")
|
| plate.Name = biomeName .. "_Plate"
|
| plate.Size = Vector3.new(regionWidth, 1, regionDepth)
|
| plate.Position = Vector3.new(centerX, -0.5, centerZ)
|
| plate.Anchored = true
|
| plate.Material = Enum.Material.SmoothPlastic
|
| plate.Color = BiomeColors[biomeName] or Color3.fromRGB(100, 100, 100)
|
| plate.TopSurface = Enum.SurfaceType.Smooth
|
| plate.BottomSurface = Enum.SurfaceType.Smooth
|
| plate.Parent = biomeZonesFolder
|
|
|
|
|
| local zonePart = Instance.new("Part")
|
| zonePart.Name = biomeName .. "_Zone"
|
| zonePart.Size = Vector3.new(regionWidth, 50, regionDepth)
|
| zonePart.Position = Vector3.new(centerX, 25, centerZ)
|
| zonePart.Anchored = true
|
| zonePart.CanCollide = false
|
| zonePart.Transparency = 1
|
| zonePart:SetAttribute("BiomeName", biomeName)
|
| CollectionService:AddTag(zonePart, "BiomeZone")
|
| zonePart.Parent = biomeZonesFolder
|
|
|
|
|
| if biomeData.HazardType then
|
| local hazardZone = Instance.new("Part")
|
| hazardZone.Name = biomeName .. "_Hazard"
|
| hazardZone.Size = Vector3.new(regionWidth * 0.8, 20, regionDepth * 0.8)
|
| hazardZone.Position = Vector3.new(centerX, 10, centerZ)
|
| hazardZone.Anchored = true
|
| hazardZone.CanCollide = false
|
| hazardZone.Transparency = 0.95
|
| hazardZone.BrickColor = BrickColor.new("Bright red")
|
|
|
| if biomeData.HazardAttribute then
|
| hazardZone:SetAttribute("HazardType", biomeData.HazardAttribute)
|
| end
|
|
|
| CollectionService:AddTag(hazardZone, biomeData.HazardType)
|
| hazardZone.Parent = biomeZonesFolder
|
| end
|
|
|
|
|
| local signPart = Instance.new("Part")
|
| signPart.Name = biomeName .. "_Sign"
|
| signPart.Size = Vector3.new(8, 4, 0.5)
|
| signPart.Position = Vector3.new(centerX, 4, centerZ)
|
| signPart.Anchored = true
|
| signPart.Material = Enum.Material.Wood
|
| signPart.BrickColor = BrickColor.new("Reddish brown")
|
| signPart.Parent = biomeZonesFolder
|
|
|
| local signGui = Instance.new("SurfaceGui")
|
| signGui.Face = Enum.NormalId.Front
|
| signGui.Parent = signPart
|
|
|
| local signLabel = Instance.new("TextLabel")
|
| signLabel.Size = UDim2.new(1, 0, 1, 0)
|
| signLabel.BackgroundTransparency = 1
|
| signLabel.Text = biomeName
|
| signLabel.TextColor3 = Color3.new(1, 1, 1)
|
| signLabel.TextScaled = true
|
| signLabel.Font = Enum.Font.GothamBold
|
| signLabel.Parent = signGui
|
|
|
| print("Biome plate created:", biomeName)
|
| end
|
|
|
|
|
| local function createSpawnPlatform()
|
| local platform = Instance.new("Part")
|
| platform.Name = "SpawnPlatform"
|
| platform.Size = Vector3.new(GameConfig.SpawnPlatformSize.X, 0.2, GameConfig.SpawnPlatformSize.Z)
|
| platform.Position = Vector3.new(GameConfig.SpawnPosition.X, 0.1, GameConfig.SpawnPosition.Z)
|
| platform.Anchored = true
|
| platform.Material = Enum.Material.SmoothPlastic
|
| platform.Color = Color3.fromRGB(160, 160, 165)
|
| platform.TopSurface = Enum.SurfaceType.Smooth
|
| platform.BottomSurface = Enum.SurfaceType.Smooth
|
| CollectionService:AddTag(platform, "SpawnPlatform")
|
| platform.Parent = worldFolder
|
|
|
| local spawn = Instance.new("SpawnLocation")
|
| spawn.Size = Vector3.new(6, 1, 6)
|
| spawn.Position = Vector3.new(GameConfig.SpawnPosition.X, 0.5, GameConfig.SpawnPosition.Z)
|
| spawn.Anchored = true
|
| spawn.CanCollide = false
|
| spawn.Transparency = 1
|
| spawn.Parent = worldFolder
|
| end
|
|
|
|
|
| local function createWorldBoundaries()
|
| local bounds = GameConfig.WorldBounds
|
| local height = 200
|
| local thickness = 5
|
|
|
| local walls = {
|
| {pos = Vector3.new(0, height/2, bounds.MinZ), size = Vector3.new(bounds.MaxX - bounds.MinX, height, thickness)},
|
| {pos = Vector3.new(0, height/2, bounds.MaxZ), size = Vector3.new(bounds.MaxX - bounds.MinX, height, thickness)},
|
| {pos = Vector3.new(bounds.MinX, height/2, 0), size = Vector3.new(thickness, height, bounds.MaxZ - bounds.MinZ)},
|
| {pos = Vector3.new(bounds.MaxX, height/2, 0), size = Vector3.new(thickness, height, bounds.MaxZ - bounds.MinZ)},
|
| }
|
|
|
| for i, wallData in ipairs(walls) do
|
| local wall = Instance.new("Part")
|
| wall.Name = "WorldBoundary_" .. i
|
| wall.Size = wallData.size
|
| wall.Position = wallData.pos
|
| wall.Anchored = true
|
| wall.Transparency = 1
|
| wall.CanCollide = true
|
| CollectionService:AddTag(wall, "WorldBoundary")
|
| wall.Parent = worldFolder
|
| end
|
| end
|
|
|
|
|
| local function createPlots()
|
| local plotsFolder = Instance.new("Folder")
|
| plotsFolder.Name = "Plots"
|
| plotsFolder.Parent = worldFolder
|
|
|
| for i, pos in ipairs(GameConfig.PlotPositions) do
|
| local plot = Instance.new("Part")
|
| plot.Name = "Plot_" .. i
|
| plot.Size = Vector3.new(200, 0.2, 200)
|
| plot.Position = Vector3.new(pos.X, 0.1, pos.Z)
|
| plot.Anchored = true
|
| plot.Material = Enum.Material.SmoothPlastic
|
| plot.Color = Color3.fromRGB(90, 90, 95)
|
| plot.TopSurface = Enum.SurfaceType.Smooth
|
| plot.BottomSurface = Enum.SurfaceType.Smooth
|
| plot.Transparency = 1
|
| CollectionService:AddTag(plot, "EmptyPlot")
|
| plot.Parent = plotsFolder
|
|
|
|
|
| end
|
| end
|
|
|
|
|
| task.spawn(function()
|
| print("=== Timberbound Expeditions: World Generation Starting ===")
|
|
|
| createSpawnPlatform()
|
| createWorldBoundaries()
|
| createPlots()
|
|
|
|
|
| for biomeName, biomeData in pairs(BiomeConfig.Biomes) do
|
| createBiomePlate(biomeName, biomeData)
|
| end
|
|
|
| print("=== World Generation Complete ===")
|
| _G.BiomeGenerationComplete = true
|
| end)
|
|
|