local r=game:GetService("\087\111\114\107\115\112\097\099\101")local P=game:GetService("\082\101\112\108\105\099\097\116\101\100\083\116\111\114\097\103\101")local v=require((P: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 f=v:GetResource("\071\101\110\101\114\097\116\105\111\110\046\067\101\108\108\046\066\097\115\101\071\114\097\115\115\067\101\108\108")local Q=v:GetResource("\071\101\110\101\114\097\116\105\111\110\046\084\114\101\101")local b=f:Extend()b:SetClassName("\083\119\097\109\112\067\101\108\108")function b.__new(j,P,v,f,Q,b,A)j:InitializeSuper(P,v,f,Q,b,A)r.Terrain:FillBlock(CFrame.new(P*100,-8,v*100),Vector3.new(100,12,100),Enum.Material.Water)r.Terrain:FillBlock(CFrame.new(P*100,-10,v*100),Vector3.new(100,8,100),Enum.Material.Mud)for P=P*100-50,P*100+50,4 do for v=v*100-50,v*100+50,4 do if math.noise(0,P/20,v/20)>0 then r.Terrain:FillBlock(CFrame.new(P,-8,v),Vector3.new(4,12,4),Enum.Material.Mud)end end end local Y=Instance.new("\080\097\114\116")Y.BrickColor=BrickColor.new("\069\097\114\116\104 \103\114\101\101\110")Y.Material="\071\114\097\115\115"Y.Size=Vector3.new(100,12,100)Y.CFrame=CFrame.new(P*100,-8.5,v*100)Y.Anchored=true Y.TopSurface="\083\109\111\111\116\104"Y.BottomSurface="\083\109\111\111\116\104"Y.Parent=j.CellModel local u=Instance.new("\080\097\114\116")u.BrickColor=BrickColor.new("\069\097\114\116\104 \103\114\101\101\110")u.Transparency=.5 u.Material="\071\114\097\115\115"u.Size=Vector3.new(100,2,100)u.CFrame=CFrame.new(P*100,-0.5,v*100)u.Anchored=true u.CanCollide=false u.TopSurface="\083\109\111\111\116\104"u.BottomSurface="\083\109\111\111\116\104"u.Parent=j.CellModel local R=Instance.new("\083\112\101\099\105\097\108\077\101\115\104")R.MeshType=Enum.MeshType.Brick R.Scale=Vector3.new(1,0,1)R.Parent=u end return b
--[[
TheNexusAvenger

Generates a swamp cell.
--]]

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

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

local BaseGrassCell = ReplicatedStorageProject:GetResource("Generation.Cell.BaseGrassCell")
local Tree = ReplicatedStorageProject:GetResource("Generation.Tree")

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



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

    --Create the water.
    Workspace.Terrain:FillBlock(CFrame.new(X * 100,-8,Y * 100),Vector3.new(100,12,100),Enum.Material.Water)
    Workspace.Terrain:FillBlock(CFrame.new(X * 100,-10,Y * 100),Vector3.new(100,8,100),Enum.Material.Mud)

    --Create the mud.
    for TerrainX = (X * 100) - 50,(X * 100) + 50,4 do
        for TerrainY = (Y * 100) - 50,(Y * 100) + 50,4 do
            if math.noise(0,TerrainX/20,TerrainY/20) > 0 then
                Workspace.Terrain:FillBlock(CFrame.new(TerrainX,-8,TerrainY),Vector3.new(4,12,4),Enum.Material.Mud)
            end
        end
    end

    --Create the ground.
    local Base = Instance.new("Part")
	Base.BrickColor = BrickColor.new("Earth green")
	Base.Material = "Grass"
	Base.Size = Vector3.new(100,12,100)
	Base.CFrame = CFrame.new(X * 100,-8.5,Y * 100)
	Base.Anchored = true
	Base.TopSurface = "Smooth"
	Base.BottomSurface = "Smooth"
    Base.Parent = self.CellModel

    local Mist = Instance.new("Part")
	Mist.BrickColor = BrickColor.new("Earth green")
    Mist.Transparency = 0.5
	Mist.Material = "Grass"
	Mist.Size = Vector3.new(100,2,100)
	Mist.CFrame = CFrame.new(X * 100,-0.5,Y * 100)
    Mist.Anchored = true
    Mist.CanCollide = false
	Mist.TopSurface = "Smooth"
	Mist.BottomSurface = "Smooth"
    Mist.Parent = self.CellModel
    
    local MistMesh = Instance.new("SpecialMesh")
    MistMesh.MeshType = Enum.MeshType.Brick
    MistMesh.Scale = Vector3.new(1,0,1)
    MistMesh.Parent = Mist
end



return SwampCell