Yorum satırlarını ve çıktı mesajlarını türkçeleştir: -- ServerScript local…
- User
Yorum satırlarını ve çıktı mesajlarını türkçeleştir:
-- ServerScript
local ReplicatedStorage = game:GetService("ReplicatedStorage") local spawnAreas = workspace:WaitForChild("GrassSpawnAreas") local ServerFunctions_sample = require(game.ServerScriptService.Scripts.GeneralFunctions_sample)
local Config = require(ReplicatedStorage:WaitForChild("ClickFarmConfig")) local ClickFarmStorage = ReplicatedStorage:WaitForChild("ClickFarmStorage")
-- Tables to store grass templates and configurations local grassTemplates = {} local grassNameToConfig = {} local grassObjects = {} -- Maps GrassID to grass instances local grassIDCounter = 0 -- Counter for unique GrassIDs
-- Load grass templates for areaName, config in pairs(Config.GrassAreas) do local grassName = config.GrassName local bonusGrassName = config.BonusGrassName
-- Load standard grass if not grassTemplates[grassName] then grassTemplates[grassName] = ClickFarmStorage:WaitForChild(grassName) end -- Load bonus grass if bonusGrassName and not grassTemplates[bonusGrassName] then grassTemplates[bonusGrassName] = ClickFarmStorage.BonusGrass:WaitForChild(bonusGrassName) end -- Map grass names to their configurations grassNameToConfig[grassName] = {config = config, is_bonus = false, areaName = areaName} if bonusGrassName then grassNameToConfig[bonusGrassName] = {config = config, is_bonus = true, areaName = areaName} endend
local grassDestroyedEvent = ReplicatedStorage:WaitForChild("GrassDestroyedEvent") local grassEffectsEvent = ReplicatedStorage:WaitForChild("GrassEffectsEvent") -- RemoteEvent
local function initializeGrassGrid(areaName, config) local spawnArea = spawnAreas:FindFirstChild(areaName) if not spawnArea then warn("Spawn area not found: " .. areaName) return {} end
local grassSpawnArea = spawnArea:FindFirstChild("GrassSpawnArea") if not grassSpawnArea then warn("GrassSpawnArea not found: " .. areaName) return {} end local areaPosition = grassSpawnArea.Position local areaSize = grassSpawnArea.Size local totalGrassCount = config.GrassCount or 1400 local areaWidth = areaSize.X local areaLength = areaSize.Z -- Calculate grid dimensions local gridArea = areaWidth * areaLength local gridSpacing = math.sqrt(gridArea / totalGrassCount) local gridCountX = math.max(1, math.floor(areaWidth / gridSpacing)) local gridCountZ = math.max(1, math.floor(areaLength / gridSpacing)) local adjustedGridSpacingX = areaWidth / gridCountX local adjustedGridSpacingZ = areaLength / gridCountZ local grassGrid = {} for i = 0, gridCountX - 1 do for j = 0, gridCountZ - 1 do local posX = areaPosition.X - (areaWidth / 2) + (i + 0.5) * adjustedGridSpacingX local posZ = areaPosition.Z - (areaLength / 2) + (j + 0.5) * adjustedGridSpacingZ table.insert(grassGrid, Vector3.new(posX, areaPosition.Y, posZ)) end end return grassGridend
local function spawnGrass(position, grassTemplate, areaName, bonusGrassTemplate, bonusChance) local grass if math.random() <= bonusChance and bonusGrassTemplate then grass = bonusGrassTemplate:Clone() else grass = grassTemplate:Clone() end grass.Position = position
- Assistant