GLOBAL.require("map/tasks")
GLOBAL.require("constants")

local Layouts = GLOBAL.require("map/layouts").Layouts
local StaticLayout = GLOBAL.require("map/static_layout")

Layouts["Pig_Beebox"] = StaticLayout.Get("map/static_layouts/pigbeebox")
Layouts["Ancient_Chest"] = StaticLayout.Get("map/static_layouts/ancient_chest")

--[NEW] Here we define a new room containing one 'haunted_house' .  Ignore the colour and value parameters.
AddRoom("Pig_Beebox", 
{
	colour={r=0.3,g=0.2,b=0.1,a=0.3},
	value = GLOBAL.GROUND.GRASS, 
	contents =  
	{
		countstaticlayouts= 
		{
			--[NEW] Here we specify how many 'tut08' creatures we want as part of our room.
			Pig_Beebox = 1,
		},
		distributepercent = .5,	
		distributeprefabs=
		{
			spiderden=0.001,
			beehive=0.003,
			flower=0.112,
			grass=0.2,
			rabbithole=0.02,
			carrot_planted=0.05,
			flint=0.05,
			berrybush=0.05,
			sapling=0.2,
			evergreen=0.3,
			pond=.001,
			blue_mushroom = .005,
			green_mushroom = .003,
			red_mushroom = .004,
		},	
	}
})

AddRoom("Ancient_Chest", 
{
	colour={r=0.3,g=0.2,b=0.1,a=0.3},
	value = GLOBAL.GROUND.ROCKY, 
	contents =  
	{
		countstaticlayouts= 
		{
			Ancient_Chest = 1,
		},
		distributepercent = .5,	
		distributeprefabs=
		{
			flint=0.5,
			rock1=1,
			rock2=1,
			tallbirdnest=0.008,
		},	
	}
})

--[NEW] We get a reference to the 'Forest Hunters' task which is one of the standard world generation tasks.
local task = GLOBAL.tasks.GetTaskByName("Forest hunters", GLOBAL.tasks.sampletasks)

--[NEW] We now add a new room choice to this task which is the room filled with our new creature.  By giving it a value 
--		of 50, we're telling the world generation to spawn up to 50 new rooms with our new creature meaning there should 
--		be up to 50 of our creature spawned randomly around the world.
task.room_choices["Pig_Beebox"] = 1
task.room_choices["Ancient_Chest"] = 1