File size: 7,938 Bytes
0712d5f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
-- src/ServerScriptService/MapManager.server.lua

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local CollectionService = game:GetService("CollectionService")

local GameConfig = require(ReplicatedStorage:WaitForChild("Shared"):WaitForChild("GameConfig"))

local worldFolder = workspace:WaitForChild("WorldStructures")

-- Create market area
local function createMarketArea()
	local marketFolder = Instance.new("Folder")
	marketFolder.Name = "Market"
	marketFolder.Parent = worldFolder

	-- Market building floor
	local floor = Instance.new("Part")
	floor.Name = "MarketFloor"
	floor.Size = GameConfig.MarketSize
	floor.Position = GameConfig.MarketPosition
	floor.Anchored = true
	floor.Material = Enum.Material.Cobblestone
	floor.BrickColor = BrickColor.new("Dark stone grey")
	floor.TopSurface = Enum.SurfaceType.Smooth
	floor.Parent = marketFolder

	-- Market walls (3 walls, open front)
	local wallHeight = 10
	local wallThickness = 1
	local marketPos = GameConfig.MarketPosition
	local mSize = GameConfig.MarketSize

	local walls = {
		{name = "BackWall", pos = Vector3.new(marketPos.X, marketPos.Y + wallHeight/2, marketPos.Z - mSize.Z/2), size = Vector3.new(mSize.X, wallHeight, wallThickness)},
		{name = "LeftWall", pos = Vector3.new(marketPos.X - mSize.X/2, marketPos.Y + wallHeight/2, marketPos.Z), size = Vector3.new(wallThickness, wallHeight, mSize.Z)},
		{name = "RightWall", pos = Vector3.new(marketPos.X + mSize.X/2, marketPos.Y + wallHeight/2, marketPos.Z), size = Vector3.new(wallThickness, wallHeight, mSize.Z)},
	}

	for _, wallData in ipairs(walls) do
		local wall = Instance.new("Part")
		wall.Name = wallData.name
		wall.Size = wallData.size
		wall.Position = wallData.pos
		wall.Anchored = true
		wall.Material = Enum.Material.WoodPlanks
		wall.BrickColor = BrickColor.new("Burlap")
		wall.Parent = marketFolder
	end

	-- Roof
	local roof = Instance.new("Part")
	roof.Name = "MarketRoof"
	roof.Size = Vector3.new(mSize.X + 4, 1, mSize.Z + 4)
	roof.Position = Vector3.new(marketPos.X, marketPos.Y + wallHeight, marketPos.Z)
	roof.Anchored = true
	roof.Material = Enum.Material.WoodPlanks
	roof.BrickColor = BrickColor.new("Reddish brown")
	roof.Parent = marketFolder

	-- Market dropoff zone
	local dropoff = Instance.new("Part")
	dropoff.Name = "MarketDropoffZone"
	dropoff.Size = Vector3.new(15, 3, 15)
	dropoff.Position = GameConfig.MarketPosition + Vector3.new(0, 2, 10)
	dropoff.Anchored = true
	dropoff.CanCollide = false
	dropoff.Transparency = 0.7
	dropoff.BrickColor = BrickColor.new("Bright green")
	dropoff.Material = Enum.Material.ForceField
	CollectionService:AddTag(dropoff, "MarketDropoff")
	dropoff.Parent = marketFolder

	-- Market sign
	local signPart = Instance.new("Part")
	signPart.Name = "MarketSign"
	signPart.Size = Vector3.new(12, 3, 0.5)
	signPart.Position = Vector3.new(marketPos.X, marketPos.Y + wallHeight + 2.5, marketPos.Z + mSize.Z/2)
	signPart.Anchored = true
	signPart.Material = Enum.Material.Wood
	signPart.BrickColor = BrickColor.new("Dark orange")
	signPart.Parent = marketFolder

	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 = "LUMBER MARKET"
	signLabel.TextColor3 = Color3.new(1, 1, 1)
	signLabel.TextScaled = true
	signLabel.Font = Enum.Font.GothamBold
	signLabel.Parent = signGui

	print("Market area created")
end

-- Create shop area
local function createShopArea()
	local shopFolder = Instance.new("Folder")
	shopFolder.Name = "Shop"
	shopFolder.Parent = worldFolder

	local shopPos = GameConfig.ShopPosition
	local sSize = GameConfig.ShopSize

	-- Shop floor
	local floor = Instance.new("Part")
	floor.Name = "ShopFloor"
	floor.Size = sSize
	floor.Position = shopPos
	floor.Anchored = true
	floor.Material = Enum.Material.WoodPlanks
	floor.BrickColor = BrickColor.new("Burlap")
	floor.TopSurface = Enum.SurfaceType.Smooth
	floor.Parent = shopFolder

	-- Shop walls
	local wallHeight = 12
	local wallThickness = 1

	local walls = {
		{name = "BackWall", pos = Vector3.new(shopPos.X, shopPos.Y + wallHeight/2, shopPos.Z - sSize.Z/2), size = Vector3.new(sSize.X, wallHeight, wallThickness)},
		{name = "LeftWall", pos = Vector3.new(shopPos.X - sSize.X/2, shopPos.Y + wallHeight/2, shopPos.Z), size = Vector3.new(wallThickness, wallHeight, sSize.Z)},
		{name = "RightWall", pos = Vector3.new(shopPos.X + sSize.X/2, shopPos.Y + wallHeight/2, shopPos.Z), size = Vector3.new(wallThickness, wallHeight, sSize.Z)},
	}

	for _, wallData in ipairs(walls) do
		local wall = Instance.new("Part")
		wall.Name = wallData.name
		wall.Size = wallData.size
		wall.Position = wallData.pos
		wall.Anchored = true
		wall.Material = Enum.Material.Brick
		wall.BrickColor = BrickColor.new("Reddish brown")
		wall.Parent = shopFolder
	end

	-- Roof
	local roof = Instance.new("Part")
	roof.Name = "ShopRoof"
	roof.Size = Vector3.new(sSize.X + 4, 1, sSize.Z + 4)
	roof.Position = Vector3.new(shopPos.X, shopPos.Y + wallHeight, shopPos.Z)
	roof.Anchored = true
	roof.Material = Enum.Material.Slate
	roof.BrickColor = BrickColor.new("Dark stone grey")
	roof.Parent = shopFolder

	-- Shop counter
	local counter = Instance.new("Part")
	counter.Name = "ShopCounter"
	counter.Size = Vector3.new(10, 3, 3)
	counter.Position = shopPos + Vector3.new(0, 1.5, -5)
	counter.Anchored = true
	counter.Material = Enum.Material.WoodPlanks
	counter.BrickColor = BrickColor.new("Pine Cone")
	CollectionService:AddTag(counter, "ShopCounter")
	counter.Parent = shopFolder

	-- Shop sign
	local signPart = Instance.new("Part")
	signPart.Name = "ShopSign"
	signPart.Size = Vector3.new(10, 3, 0.5)
	signPart.Position = Vector3.new(shopPos.X, shopPos.Y + wallHeight + 2.5, shopPos.Z + sSize.Z/2)
	signPart.Anchored = true
	signPart.Material = Enum.Material.Wood
	signPart.BrickColor = BrickColor.new("Bright blue")
	signPart.Parent = shopFolder

	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 = "SUE'S SUPPLY SHOP"
	signLabel.TextColor3 = Color3.new(1, 1, 1)
	signLabel.TextScaled = true
	signLabel.Font = Enum.Font.GothamBold
	signLabel.Parent = signGui

	print("Shop area created")
end

-- Create roads connecting major areas
local function createRoads()
	local roadFolder = Instance.new("Folder")
	roadFolder.Name = "Roads"
	roadFolder.Parent = worldFolder

	-- Main road from spawn toward market
	local roads = {
		{from = GameConfig.SpawnPosition, to = GameConfig.MarketPosition, width = 8},
		{from = GameConfig.MarketPosition, to = GameConfig.ShopPosition, width = 6},
	}

	for i, roadData in ipairs(roads) do
		local midpoint = (roadData.from + roadData.to) / 2
		local direction = (roadData.to - roadData.from)
		local length = direction.Magnitude

		local roadPart = Instance.new("Part")
		roadPart.Name = "Road_" .. i
		roadPart.Size = Vector3.new(roadData.width, 0.3, length)
		roadPart.CFrame = CFrame.lookAt(midpoint, roadData.to) + Vector3.new(0, 0.2, 0)
		roadPart.Anchored = true
		roadPart.Material = Enum.Material.Cobblestone
		roadPart.Color = Color3.fromRGB(120, 110, 100)
		roadPart.TopSurface = Enum.SurfaceType.Smooth
		roadPart.Parent = roadFolder
	end

	print("Roads created")
end

-- Wait for world folder to be ready then build structures
task.spawn(function()
	task.wait(1) -- Brief delay to ensure BiomeGeneratorManager creates the folder

	createMarketArea()
	createShopArea()
	createRoads()

	print("=== Map Structures Complete ===")
end)