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("\080\117\109\112\107\105\110\115\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.Ground)for r=P*100-30,P*100+30,20 do for P=v*100-30,v*100+30,20 do local v=Instance.new("\080\097\114\116")v.Shape="\066\097\108\108"v.Size=Vector3.new(4,4,4)v.CFrame=CFrame.new(r+j.RandomNumberGenerator:NextNumber(-8,8),2,P+j.RandomNumberGenerator:NextNumber(-8,8))*CFrame.Angles(j.RandomNumberGenerator:NextNumber(math.rad(-5),math.rad(5)),j.RandomNumberGenerator:NextNumber(math.rad(-180),math.rad(180)),j.RandomNumberGenerator:NextNumber(math.rad(-5),math.rad(5)))v.Anchored=true v.Parent=j.CellModel local f=Instance.new("\083\112\101\099\105\097\108\077\101\115\104")f.MeshType="\070\105\108\101\077\101\115\104"f.MeshId="\104\116\116\112\058\047\047\119\119\119\046\114\111\098\108\111\120\046\099\111\109\047\097\115\115\101\116\047\063\105\100\061\052\051\048\055\052\056\052\053\056"f.TextureId="\104\116\116\112\058\047\047\119\119\119\046\114\111\098\108\111\120\046\099\111\109\047\097\115\115\101\116\047\063\105\100\061\052\051\048\055\053\049\054\056\050"f.Scale=Vector3.new(.025,.025,.025)f.Parent=v end end local Y,u=P*100,v*100 for r=Y-48,Y-8,10 do j:CreateWoodPart(Vector3.new(4,1,1),CFrame.new(r,1.5,u-48)*CFrame.Angles(0,0,math.pi/2))end for r=Y+8,Y+48,10 do j:CreateWoodPart(Vector3.new(4,1,1),CFrame.new(r,1.5,u-48)*CFrame.Angles(0,0,math.pi/2))end for r=Y-48,Y-8,10 do j:CreateWoodPart(Vector3.new(4,1,1),CFrame.new(r,1.5,u+48)*CFrame.Angles(0,0,math.pi/2))end for r=Y+8,Y+48,10 do j:CreateWoodPart(Vector3.new(4,1,1),CFrame.new(r,1.5,u+48)*CFrame.Angles(0,0,math.pi/2))end for r=u-38,u-8,10 do j:CreateWoodPart(Vector3.new(4,1,1),CFrame.new(Y-48,1.5,r)*CFrame.Angles(0,0,math.pi/2))end for r=u+8,u+38,10 do j:CreateWoodPart(Vector3.new(4,1,1),CFrame.new(Y-48,1.5,r)*CFrame.Angles(0,0,math.pi/2))end for r=u-38,u-8,10 do j:CreateWoodPart(Vector3.new(4,1,1),CFrame.new(Y+48,1.5,r)*CFrame.Angles(0,0,math.pi/2))end for r=u+8,u+38,10 do j:CreateWoodPart(Vector3.new(4,1,1),CFrame.new(Y+48,1.5,r)*CFrame.Angles(0,0,math.pi/2))end j:CreateWoodPart(Vector3.new(40,.8,.2),CFrame.new(Y-28,3,u-48))j:CreateWoodPart(Vector3.new(40,.8,.2),CFrame.new(Y-28,1.5,u-48))j:CreateWoodPart(Vector3.new(40,.8,.2),CFrame.new(Y+28,3,u-48))j:CreateWoodPart(Vector3.new(40,.8,.2),CFrame.new(Y+28,1.5,u-48))j:CreateWoodPart(Vector3.new(40,.8,.2),CFrame.new(Y-28,3,u+48))j:CreateWoodPart(Vector3.new(40,.8,.2),CFrame.new(Y-28,1.5,u+48))j:CreateWoodPart(Vector3.new(40,.8,.2),CFrame.new(Y+28,3,u+48))j:CreateWoodPart(Vector3.new(40,.8,.2),CFrame.new(Y+28,1.5,u+48))j:CreateWoodPart(Vector3.new(.2,.8,40),CFrame.new(Y-48,3,u-28))j:CreateWoodPart(Vector3.new(.2,.8,40),CFrame.new(Y-48,1.5,u-28))j:CreateWoodPart(Vector3.new(.2,.8,40),CFrame.new(Y+48,3,u-28))j:CreateWoodPart(Vector3.new(.2,.8,40),CFrame.new(Y+48,1.5,u-28))j:CreateWoodPart(Vector3.new(.2,.8,40),CFrame.new(Y-48,3,u+28))j:CreateWoodPart(Vector3.new(.2,.8,40),CFrame.new(Y-48,1.5,u+28))j:CreateWoodPart(Vector3.new(.2,.8,40),CFrame.new(Y+48,3,u+28))j:CreateWoodPart(Vector3.new(.2,.8,40),CFrame.new(Y+48,1.5,u+28))end function b.CreateWoodPart(v,r,P)local f=Instance.new("\080\097\114\116")f.BrickColor=BrickColor.new("\066\114\111\119\110")f.Material="\087\111\111\100"f.Size=r f.CFrame=P f.Anchored=true f.TopSurface="\083\109\111\111\116\104"f.BottomSurface="\083\109\111\111\116\104"f.Parent=v.CellModel end return b
--[[
TheNexusAvenger

Generates a pumpkin 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 PumpkinsCell = BaseGrassCell:Extend()
PumpkinsCell:SetClassName("PumpkinsCell")



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

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

    --Create the pumpkins.
    for PumpkinX = (X * 100) - 30,(X * 100) + 30,20 do
        for PumpkinY = (Y * 100) - 30,(Y * 100) + 30,20 do
            local Pumpkin = Instance.new("Part")
            Pumpkin.Shape = "Ball"
            Pumpkin.Size = Vector3.new(4,4,4)
            Pumpkin.CFrame = CFrame.new(PumpkinX + self.RandomNumberGenerator:NextNumber(-8,8),2,PumpkinY + self.RandomNumberGenerator:NextNumber(-8,8)) * CFrame.Angles(self.RandomNumberGenerator:NextNumber(math.rad(-5),math.rad(5)),self.RandomNumberGenerator:NextNumber(math.rad(-180),math.rad(180)),self.RandomNumberGenerator:NextNumber(math.rad(-5),math.rad(5)))
            Pumpkin.Anchored = true
            Pumpkin.Parent = self.CellModel

            local PumpkinMesh = Instance.new("SpecialMesh")
            PumpkinMesh.MeshType = "FileMesh"
            PumpkinMesh.MeshId = "http://www.roblox.com/asset/?id=430748458"
            PumpkinMesh.TextureId = "http://www.roblox.com/asset/?id=430751682"
            PumpkinMesh.Scale = Vector3.new(0.025,0.025,0.025)
            PumpkinMesh.Parent = Pumpkin
        end
    end

    --Create the fence posts.
    local CenterX,CenterY = X * 100,Y * 100
    for PostX = CenterX - 48,CenterX - 8,10 do
        self:CreateWoodPart(Vector3.new(4,1,1),CFrame.new(PostX,1.5,CenterY - 48) * CFrame.Angles(0,0,math.pi/2))
    end
    for PostX = CenterX + 8,CenterX + 48,10 do
        self:CreateWoodPart(Vector3.new(4,1,1),CFrame.new(PostX,1.5,CenterY - 48) * CFrame.Angles(0,0,math.pi/2))
    end
    for PostX = CenterX - 48,CenterX - 8,10 do
        self:CreateWoodPart(Vector3.new(4,1,1),CFrame.new(PostX,1.5,CenterY + 48) * CFrame.Angles(0,0,math.pi/2))
    end
    for PostX = CenterX + 8,CenterX + 48,10 do
        self:CreateWoodPart(Vector3.new(4,1,1),CFrame.new(PostX,1.5,CenterY + 48) * CFrame.Angles(0,0,math.pi/2))
    end
    for PostY = CenterY - 38,CenterY - 8,10 do
        self:CreateWoodPart(Vector3.new(4,1,1),CFrame.new(CenterX - 48,1.5,PostY) * CFrame.Angles(0,0,math.pi/2))
    end
    for PostY = CenterY + 8,CenterY + 38,10 do
        self:CreateWoodPart(Vector3.new(4,1,1),CFrame.new(CenterX - 48,1.5,PostY) * CFrame.Angles(0,0,math.pi/2))
    end
    for PostY = CenterY - 38,CenterY - 8,10 do
        self:CreateWoodPart(Vector3.new(4,1,1),CFrame.new(CenterX + 48,1.5,PostY) * CFrame.Angles(0,0,math.pi/2))
    end
    for PostY = CenterY + 8,CenterY + 38,10 do
        self:CreateWoodPart(Vector3.new(4,1,1),CFrame.new(CenterX + 48,1.5,PostY) * CFrame.Angles(0,0,math.pi/2))
    end

    --Create the fence.
    self:CreateWoodPart(Vector3.new(40,0.8,0.2),CFrame.new(CenterX - 28,3,CenterY - 48))
    self:CreateWoodPart(Vector3.new(40,0.8,0.2),CFrame.new(CenterX - 28,1.5,CenterY - 48))
    self:CreateWoodPart(Vector3.new(40,0.8,0.2),CFrame.new(CenterX + 28,3,CenterY - 48))
    self:CreateWoodPart(Vector3.new(40,0.8,0.2),CFrame.new(CenterX + 28,1.5,CenterY - 48))
    self:CreateWoodPart(Vector3.new(40,0.8,0.2),CFrame.new(CenterX - 28,3,CenterY + 48))
    self:CreateWoodPart(Vector3.new(40,0.8,0.2),CFrame.new(CenterX - 28,1.5,CenterY + 48))
    self:CreateWoodPart(Vector3.new(40,0.8,0.2),CFrame.new(CenterX + 28,3,CenterY + 48))
    self:CreateWoodPart(Vector3.new(40,0.8,0.2),CFrame.new(CenterX + 28,1.5,CenterY + 48))

    
    self:CreateWoodPart(Vector3.new(0.2,0.8,40),CFrame.new(CenterX - 48,3,CenterY - 28))
    self:CreateWoodPart(Vector3.new(0.2,0.8,40),CFrame.new(CenterX - 48,1.5,CenterY - 28))
    self:CreateWoodPart(Vector3.new(0.2,0.8,40),CFrame.new(CenterX + 48,3,CenterY - 28))
    self:CreateWoodPart(Vector3.new(0.2,0.8,40),CFrame.new(CenterX + 48,1.5,CenterY - 28))
    self:CreateWoodPart(Vector3.new(0.2,0.8,40),CFrame.new(CenterX - 48,3,CenterY + 28))
    self:CreateWoodPart(Vector3.new(0.2,0.8,40),CFrame.new(CenterX - 48,1.5,CenterY + 28))
    self:CreateWoodPart(Vector3.new(0.2,0.8,40),CFrame.new(CenterX + 48,3,CenterY + 28))
    self:CreateWoodPart(Vector3.new(0.2,0.8,40),CFrame.new(CenterX + 48,1.5,CenterY + 28))
end

--[[
Creates a wood part.
--]]
function PumpkinsCell:CreateWoodPart(Size,Center)
    local Wood = Instance.new("Part")
	Wood.BrickColor = BrickColor.new("Brown")
	Wood.Material = "Wood"
	Wood.Size = Size
	Wood.CFrame = Center
	Wood.Anchored = true
	Wood.TopSurface = "Smooth"
	Wood.BottomSurface = "Smooth"
    Wood.Parent = self.CellModel
end



return PumpkinsCell