-------------------------------------------------------------------
RandomDebrisCreator = function()
	if RandomDebriscount == DebrisMaxcount and RandomDebrisCreatorState then
		Trigger.AfterDelay(1, function() 
			RandomDebrisCreatorState = false
			Trigger.AfterDelay(1, function()
--				RandomDebrises = Map.ActorsInBox(Map.TopLeft, Map.BottomRight, function(debris) return debris.Owner == rocks end)
--				Utils.Do(RandomDebrises, function(debris)
--					debris.GrantUpgrade("unkillable.fixedposition")
--				end)
			end)
		end)
	elseif RandomDebriscount < DebrisMaxcount and RandomDebrisCreatorState then
		CreateRandomDebris()
	end
end
-------------------------------------------------------------------
CreateRandomDebris = function()
	local RandomDebris = Actor.Create(Utils.Random({ "p" .. tostring(Utils.RandomInteger(13, 14)), "p0" .. tostring(Utils.Random({ Utils.RandomInteger(1, 4), Utils.RandomInteger(7, 8) })), "rf0" .. tostring(Utils.RandomInteger(1, 7)) }), true, { Owner = rocks, Location = CPos.New(Utils.RandomInteger(MapSlippedEdgeStartHorizontical, MapSlippedEdgeOverHorizontical), Utils.RandomInteger(MapSlippedEdgeStartVertical, MapSlippedEdgeOverVertical)), Facing = 0 })
	RandomDebriscount = RandomDebriscount + 1
	if RandomDebriscount < DebrisMaxcount and RandomDebrisCreatorState then RandomDebrisCreator() end
end
-------------------------------------------------------------------
RandomRockCreator = function()
	if RandomRockcount == RockMaxcount and RandomRockCreatorState then
		Trigger.AfterDelay(1, function() 
			RandomRockCreatorState = false
			Trigger.AfterDelay(1, function()
--				RandomRocks = Map.ActorsInBox(Map.TopLeft, Map.BottomRight, function(rock) return rock.Owner == rocks end)
--				Utils.Do(RandomRocks, function(rock)
--					rock.GrantUpgrade("unkillable.fixedposition")
--				end)
			end)
		end)
	elseif RandomRockcount < RockMaxcount and RandomRockCreatorState then
		CreateRandomRock()
	end
end
-------------------------------------------------------------------
CreateRandomRock = function()
	local RandomRock = Actor.Create(RockTypes[Utils.RandomInteger(1, 7)], true, { Owner = rocks, Location = CPos.New(Utils.RandomInteger(MapSlippedEdgeStartHorizontical, MapSlippedEdgeOverHorizontical), Utils.RandomInteger(MapSlippedEdgeStartVertical, MapSlippedEdgeOverVertical)), Facing = 0 })
	RandomRockcount = RandomRockcount + 1
	if RandomRockcount < RockMaxcount and RandomRockCreatorState then RandomRockCreator() end
end
-------------------------------------------------------------------
RandomTreeCreator = function()
	if RandomTreecount == TreeMaxcount and RandomTreeCreatorState then
		Trigger.AfterDelay(1, function() 
			RandomTreeCreatorState = false
			Trigger.AfterDelay(1, function()
--				RandomTrees = Map.ActorsInBox(Map.TopLeft, Map.BottomRight, function(tree) return tree.Owner == trees end)
--				Utils.Do(RandomTrees, function(tree)
--					tree.GrantUpgrade("unkillable.fixedposition")
--				end)
			end)
		end)
	elseif RandomTreecount < TreeMaxcount and RandomTreeCreatorState then
		CreateRandomTree()
	end
end
-------------------------------------------------------------------
CreateRandomTree = function()
	local RandomTree = Actor.Create(TreeTypes[Utils.RandomInteger(1, 39)], true, { Owner = trees, Location = CPos.New(Utils.RandomInteger(MapSlippedEdgeStartHorizontical, MapSlippedEdgeOverHorizontical), Utils.RandomInteger(MapSlippedEdgeStartVertical, MapSlippedEdgeOverVertical)), Facing = 0 })
	RandomTreecount = RandomTreecount + 1
	if RandomTreecount < TreeMaxcount and RandomTreeCreatorState then RandomTreeCreator() end
end
-------------------------------------------------------------------
RandomTreeModifier = function()
	Trigger.AfterDelay(1, function()
	end)
end
-------------------------------------------------------------------

