local r=4302981239 local P=game:GetService("\087\111\114\107\115\112\097\099\101")local v=game:GetService("\082\101\112\108\105\099\097\116\101\100\083\116\111\114\097\103\101")local f=require((v:WaitForChild("\080\114\111\106\101\099\116")):WaitForChild("\082\101\112\108\105\099\097\116\101\100\083\116\111\114\097\103\101"))local Q=f:GetResource("\071\101\110\101\114\097\116\105\111\110\046\067\101\108\108\046\066\097\115\101\067\101\108\108")local b=Q:Extend()b:SetClassName("\066\097\115\101\071\114\097\115\115\067\101\108\108")function b.__new(Y,v,f,Q,b,A,j)Y:InitializeSuper(v,f,Q,b,A,j)Y.RandomNumberGenerator=Random.new(math.noise(r,v/100,f/100)*1e+15)P.Terrain:FillBlock(CFrame.new(v*100,-8,f*100),Vector3.new(100,12,100),Enum.Material.LeafyGrass)local u=Instance.new("\077\111\100\101\108")u.Name="\067\101\108\108\095"..(tostring(v)..("\095"..tostring(f)))u.Parent=P Y.CellModel=u end function b.Destroy(r)P.Terrain:FillBlock(CFrame.new(r.X*100,-8,r.Y*100),Vector3.new(100,12,100),Enum.Material.Air)r.CellModel:Destroy()end return b
--[[
TheNexusAvenger

Generates a base grass cell.
--]]

local RANDOM_SEED = 4302981239 --This number is completely random, but must be consistent accross clients for generation.



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

local ReplicatedStorageProject = require(ReplicatedStorage:WaitForChild("Project"):WaitForChild("ReplicatedStorage"))

local BaseCell = ReplicatedStorageProject:GetResource("Generation.Cell.BaseCell")

local BaseGrassCell = BaseCell:Extend()
BaseGrassCell:SetClassName("BaseGrassCell")



--[[
Creates a cell.
--]]
function BaseGrassCell:__new(X,Y,TopCellType,BottomCellType,LeftCellType,RightCellType)
    self:InitializeSuper(X,Y,TopCellType,BottomCellType,LeftCellType,RightCellType)

    --Get the random number generator.
    --This is done using a constant seed and the X and Y coordinate
    --to be consisent between clients.
    self.RandomNumberGenerator = Random.new(math.noise(RANDOM_SEED,X/100,Y/100) * (10^15))

    --Create the grass.
    Workspace.Terrain:FillBlock(CFrame.new(X * 100,-8,Y * 100),Vector3.new(100,12,100),Enum.Material.LeafyGrass)

    --Create the leaves.
    local CellModel = Instance.new("Model")
    CellModel.Name = "Cell_"..tostring(X).."_"..tostring(Y)
    CellModel.Parent = Workspace
    self.CellModel = CellModel
end

--[[
Destroys the cell.
--]]
function BaseGrassCell:Destroy()
    --Clear the grass.
    Workspace.Terrain:FillBlock(CFrame.new(self.X * 100,-8,self.Y * 100),Vector3.new(100,12,100),Enum.Material.Air)

    --Clear the cell.
    self.CellModel:Destroy()
end



return BaseGrassCell