local filter = GLOBAL.terrain.filter
local GROUND = GLOBAL.GROUND
local rock_rarity = (GetModConfigData("rock_rarity"))
local multiplier = rock_rarity

local function PreInitVeryRare(room)
	if not room.contents.distributeprefabs then
		room.contents.distributeprefabs = {}
	end
	room.contents.distributeprefabs.rock_iron = 0.7 * 0.004 * multiplier
	room.contents.distributeprefabs.rock_cobalt = 0.5 * 0.004 * multiplier
	room.contents.distributeprefabs.rock_tough = 0.3 * 0.004 * multiplier
--	room.contents.distributeprefabs.rock_titan = 0.3
--	room.contents.distributeprefabs.rock_tungsten = 0.1

	--room.contents.distributepercent = 0.004 * multiplier

	filter.rock_iron = {GROUND.ROAD, GROUND.WOODFLOOR, GROUND.CARPET, GROUND.CHECKER}
	filter.rock_cobalt = {GROUND.ROAD, GROUND.WOODFLOOR, GROUND.CARPET, GROUND.CHECKER}
	filter.rock_tough = {GROUND.ROAD, GROUND.WOODFLOOR, GROUND.CARPET, GROUND.CHECKER}
--	filter.rock_titan = {GROUND.ROAD, GROUND.WOODFLOOR, GROUND.CARPET, GROUND.CHECKER}
--	filter.rock_tungsten = {GROUND.ROAD, GROUND.WOODFLOOR, GROUND.CARPET, GROUND.CHECKER}
end

local function PreInitRare(room)
	if not room.contents.distributeprefabs then
		room.contents.distributeprefabs = {}
	end
	room.contents.distributeprefabs.rock_iron = 0.7 * 0.05 * multiplier
	room.contents.distributeprefabs.rock_cobalt = 0.5 * 0.05 * multiplier
	room.contents.distributeprefabs.rock_tough = 0.3 * 0.05 * multiplier
--	room.contents.distributeprefabs.rock_titan = 0.3
--	room.contents.distributeprefabs.rock_tungsten = 0.1

	--room.contents.distributepercent = 0.05 * multiplier

	filter.rock_iron = {GROUND.ROAD, GROUND.WOODFLOOR, GROUND.CARPET, GROUND.CHECKER}
	filter.rock_cobalt = {GROUND.ROAD, GROUND.WOODFLOOR, GROUND.CARPET, GROUND.CHECKER}
--	filter.rock_titan = {GROUND.ROAD, GROUND.WOODFLOOR, GROUND.CARPET, GROUND.CHECKER}
--	filter.rock_tungsten = {GROUND.ROAD, GROUND.WOODFLOOR, GROUND.CARPET, GROUND.CHECKER}
	filter.rock_tough = {GROUND.ROAD, GROUND.WOODFLOOR, GROUND.CARPET, GROUND.CHECKER}
end

local function PreInitFew(room)
	if not room.contents.distributeprefabs then
		room.contents.distributeprefabs = {}
	end
	room.contents.distributeprefabs.rock_iron = 0.7 * 0.5 * multiplier
	room.contents.distributeprefabs.rock_cobalt = 0.5 * 0.5 * multiplier
	room.contents.distributeprefabs.rock_tough = 0.3 * 0.5 * multiplier
--	room.contents.distributeprefabs.rock_titan = 0.3
--	room.contents.distributeprefabs.rock_tungsten = 0.1

	--room.contents.distributepercent = 0.5 * multiplier

	filter.rock_iron = {GROUND.ROAD, GROUND.WOODFLOOR, GROUND.CARPET, GROUND.CHECKER}
	filter.rock_cobalt = {GROUND.ROAD, GROUND.WOODFLOOR, GROUND.CARPET, GROUND.CHECKER}
--	filter.rock_titan = {GROUND.ROAD, GROUND.WOODFLOOR, GROUND.CARPET, GROUND.CHECKER}
--	filter.rock_tungsten = {GROUND.ROAD, GROUND.WOODFLOOR, GROUND.CARPET, GROUND.CHECKER}
	filter.rock_tough = {GROUND.ROAD, GROUND.WOODFLOOR, GROUND.CARPET, GROUND.CHECKER}
end

local function PreInitNormal(room)
	if not room.contents.distributeprefabs then
		room.contents.distributeprefabs = {}
	end
	room.contents.distributeprefabs.rock_iron = 0.7
	room.contents.distributeprefabs.rock_cobalt = 0.5
	room.contents.distributeprefabs.rock_tough = 0.3
--	room.contents.distributeprefabs.rock_titan = 0.3
--	room.contents.distributeprefabs.rock_tungsten = 0.1

	room.contents.distributepercent = 1 * multiplier

	filter.rock_iron = {GROUND.ROAD, GROUND.WOODFLOOR, GROUND.CARPET, GROUND.CHECKER}
	filter.rock_cobalt = {GROUND.ROAD, GROUND.WOODFLOOR, GROUND.CARPET, GROUND.CHECKER}
--	filter.rock_titan = {GROUND.ROAD, GROUND.WOODFLOOR, GROUND.CARPET, GROUND.CHECKER}
--	filter.rock_tungsten = {GROUND.ROAD, GROUND.WOODFLOOR, GROUND.CARPET, GROUND.CHECKER}
	filter.rock_tough = {GROUND.ROAD, GROUND.WOODFLOOR, GROUND.CARPET, GROUND.CHECKER}
end

local function PreInitDouble(room)
	if not room.contents.distributeprefabs then
		room.contents.distributeprefabs = {}
	end
	room.contents.distributeprefabs.rock_iron = 0.7
	room.contents.distributeprefabs.rock_cobalt = 0.5
	room.contents.distributeprefabs.rock_tough = 0.3
--	room.contents.distributeprefabs.rock_titan = 0.3
--	room.contents.distributeprefabs.rock_tungsten = 0.1

	room.contents.distributepercent = 2 * multiplier

	filter.rock_iron = {GROUND.ROAD, GROUND.WOODFLOOR, GROUND.CARPET, GROUND.CHECKER}
	filter.rock_cobalt = {GROUND.ROAD, GROUND.WOODFLOOR, GROUND.CARPET, GROUND.CHECKER}
--	filter.rock_titan = {GROUND.ROAD, GROUND.WOODFLOOR, GROUND.CARPET, GROUND.CHECKER}
--	filter.rock_tungsten = {GROUND.ROAD, GROUND.WOODFLOOR, GROUND.CARPET, GROUND.CHECKER}
	filter.rock_tough = {GROUND.ROAD, GROUND.WOODFLOOR, GROUND.CARPET, GROUND.CHECKER}
end

	--As golden rocks (rock2)

AddRoomPreInit("Deerclopsfield", PreInitVeryRare)
AddRoomPreInit("Tallbirdfield", PreInitNormal)
AddRoomPreInit("Moundfield", PreInitFew)

AddRoomPreInit("ChessForest", PreInitVeryRare)
AddRoomPreInit("ChessBarrens", PreInitNormal)

AddRoomPreInit("HoundyBadlands", PreInitNormal)
AddRoomPreInit("BGDeciduous", PreInitRare)

AddRoomPreInit("SpiderVillage", PreInitNormal)

AddRoomPreInit("TallbirdNests", PreInitDouble)

AddRoomPreInit("BGDirt", PreInitNormal)

AddRoomPreInit("BGCrappyForest", PreInitVeryRare)
AddRoomPreInit("Forest", PreInitVeryRare)
AddRoomPreInit("DeepForest", PreInitVeryRare)
AddRoomPreInit("BGForest", PreInitVeryRare)
AddRoomPreInit("BGDeepForest", PreInitVeryRare)

AddRoomPreInit("BGGrassBurnt", PreInitRare)

AddRoomPreInit("BGNoise", PreInitRare)

AddRoomPreInit("BGChessRocky", PreInitNormal)
AddRoomPreInit("BGRocky", PreInitNormal)
AddRoomPreInit("Rocky", PreInitDouble)
AddRoomPreInit("RockyBuzzards", PreInitDouble)
AddRoomPreInit("GenericRockyNoThreat", PreInitDouble)
AddRoomPreInit("MolesvilleRocky", PreInitNormal)

AddRoomPreInit("WalrusHut_Rocky", PreInitNormal)

AddRoomPreInit("Wormhole_Plains", PreInitNormal)
AddRoomPreInit("NoisyCave", PreInitNormal)
AddRoomPreInit("CaveRoom", PreInitFew)
AddRoomPreInit("RockLobsterPlains", PreInitFew)
AddRoomPreInit("NoisyCave", PreInitFew)

AddRoomPreInit("SlurtleCanyon",PreInitNormal)
AddRoomPreInit("RockyPlains",PreInitNormal)
AddRoomPreInit("BGRockyCave",PreInitDouble)
------
GLOBAL.require("map/terrain")
if GLOBAL.terrain.rooms.BGSavanna then
	GLOBAL.terrain.rooms.BGSavanna.contents.distributeprefabs.bambootree = 0.25
end

GLOBAL.terrain.filter.bambootree = {GLOBAL.GROUND.ROAD, GLOBAL.GROUND.WOODFLOOR, GLOBAL.GROUND.CARPET, GLOBAL.GROUND.CHECKER}
