1
0
mirror of https://github.com/Refactorio/RedMew.git synced 2024-12-12 10:04:40 +02:00

Red planet is now threaded

This commit is contained in:
TWLTriston 2017-10-21 07:14:50 -04:00
parent c0a6303493
commit 98820ddeb2
2 changed files with 327 additions and 296 deletions

View File

@ -4,6 +4,7 @@
-- Use water only in starting area as map setting!!! -- Use water only in starting area as map setting!!!
require "locale.gen_shared.perlin_noise" require "locale.gen_shared.perlin_noise"
local Thread = require "locale.utils.Thread"
wreck_item_pool = {} wreck_item_pool = {}
wreck_item_pool = {{name="iron-gear-wheel", count=32},{name="iron-plate", count=64},{name="rocket-control-unit", count=1} ,{name="coal", count=4},{name="rocket-launcher", count=1},{name="rocket", count=32},{name="copper-cable", count=128},{name="land-mine", count=64},{name="railgun", count=1},{name="railgun-dart", count=128},{name="fast-inserter", count=8},{name="stack-filter-inserter", count=2},{name="belt-immunity-equipment", count=1},{name="fusion-reactor-equipment", count=1},{name="electric-engine-unit", count=8},{name="exoskeleton-equipment", count=1},{name="rocket-fuel", count=10},{name="used-up-uranium-fuel-cell", count=3},{name="uranium-fuel-cell", count=2}} wreck_item_pool = {{name="iron-gear-wheel", count=32},{name="iron-plate", count=64},{name="rocket-control-unit", count=1} ,{name="coal", count=4},{name="rocket-launcher", count=1},{name="rocket", count=32},{name="copper-cable", count=128},{name="land-mine", count=64},{name="railgun", count=1},{name="railgun-dart", count=128},{name="fast-inserter", count=8},{name="stack-filter-inserter", count=2},{name="belt-immunity-equipment", count=1},{name="fusion-reactor-equipment", count=1},{name="electric-engine-unit", count=8},{name="exoskeleton-equipment", count=1},{name="rocket-fuel", count=10},{name="used-up-uranium-fuel-cell", count=3},{name="uranium-fuel-cell", count=2}}
@ -37,9 +38,7 @@ local resource_amount_distance_multiplicator = (((c + 1) / 75) / 75) + 1
function run_combined_module(event) function run_combined_module(event)
if not global.perlin_noise_seed then global.perlin_noise_seed = math.random(1000,1000000) end if not global.perlin_noise_seed then global.perlin_noise_seed = math.random(1000,1000000) end
local surface = game.surfaces[1] local surface = game.surfaces[1]
local tiles = {}
local decoratives = {}
local tree_to_place = {"dry-tree","dry-hairy-tree","tree-06","tree-06","tree-01","tree-02","tree-03"}
local entities = surface.find_entities(event.area) local entities = surface.find_entities(event.area)
for _, entity in pairs(entities) do for _, entity in pairs(entities) do
if entity.type == "simple-entity" or entity.type == "resource" or entity.type == "tree" then if entity.type == "simple-entity" or entity.type == "resource" or entity.type == "tree" then
@ -47,298 +46,328 @@ function run_combined_module(event)
end end
end end
for x = 0, 31, 1 do Thread.queue_action("run_planet_init", {} )
for y = 0, 31, 1 do --run_planet_init()
local pos_x = event.area.left_top.x + x for x = 0, 31, 1 do
local pos_y = event.area.left_top.y + y Thread.queue_action("run_planet", {area = event.area, surface = event.surface, x = x})
local tile = surface.get_tile(pos_x,pos_y) --run_planet( {area = event.area, surface = event.surface, x = x})
local tile_to_insert = "concrete" end
--run_planet_place_tiles( {surface = event.surface} )
Thread.queue_action("run_planet_place_tiles", {surface = event.surface})
local a = pos_x end
local b = pos_y
local resource_entity_placed = false
global.planet_tiles_hold = {}
local entity_list = {} global.planet_decoratives_hold = {}
table.insert(entity_list, {name="big-ship-wreck-1", pos={pos_x,pos_y},chance = 65000, health="random"})
table.insert(entity_list, {name="big-ship-wreck-2", pos={pos_x,pos_y},chance = 65000, health="random"}) function run_planet_init(params)
table.insert(entity_list, {name="big-ship-wreck-3", pos={pos_x,pos_y},chance = 65000, health="random"}) global.planet_tiles_hold = {}
table.insert(entity_list, {name="medium-ship-wreck", pos={pos_x,pos_y},chance = 25000, health="medium"}) global.planet_decoratives_hold = {}
table.insert(entity_list, {name="small-ship-wreck", pos={pos_x,pos_y},chance = 15000, health="medium"}) end
table.insert(entity_list, {name="car", pos={pos_x,pos_y},chance = 150000, health="low"})
table.insert(entity_list, {name="laser-turret", pos={pos_x,pos_y},chance = 100000, force="enemy", health="low"}) function run_planet_place_tiles(params)
table.insert(entity_list, {name="nuclear-reactor", pos={pos_x,pos_y},chance = 1000000, force="enemy", health="medium"}) local surface = params.surface
local b, placed_entity = place_entities(surface, entity_list) surface.set_tiles(global.planet_tiles_hold)
if b == true then for _,deco in pairs(global.planet_decoratives_hold) do
if placed_entity.name == "big-ship-wreck-1" or placed_entity.name == "big-ship-wreck-2" or placed_entity.name == "big-ship-wreck-3" then surface.create_decoratives{check_collision=false, decoratives={deco}}
placed_entity.insert(wreck_item_pool[math.random(1,#wreck_item_pool)]) end
placed_entity.insert(wreck_item_pool[math.random(1,#wreck_item_pool)]) end
placed_entity.insert(wreck_item_pool[math.random(1,#wreck_item_pool)])
end function run_planet( params )
end local tree_to_place = {"dry-tree","dry-hairy-tree","tree-06","tree-06","tree-01","tree-02","tree-03"}
local area = params.area
local seed_increment_number = 10000 local surface = params.surface
local seed = global.perlin_noise_seed
local x = params.x
local noise_terrain_1 = perlin:noise(((pos_x+seed)/400),((pos_y+seed)/400),0) local pos_x = area.left_top.x + x
noise_terrain_1 = noise_terrain_1 * 100
seed = seed + seed_increment_number for y = 0, 31, 1 do
local noise_terrain_2 = perlin:noise(((pos_x+seed)/250),((pos_y+seed)/250),0) local pos_y = area.left_top.y + y
noise_terrain_2 = noise_terrain_2 * 100 local seed = surface.map_gen_settings.seed
seed = seed + seed_increment_number local tile = surface.get_tile(pos_x,pos_y)
local noise_terrain_3 = perlin:noise(((pos_x+seed)/100),((pos_y+seed)/100),0) local tile_to_insert = "concrete"
noise_terrain_3 = noise_terrain_3 * 50
seed = seed + seed_increment_number local a = pos_x
local noise_terrain_4 = perlin:noise(((pos_x+seed)/20),((pos_y+seed)/20),0) local b = pos_y
noise_terrain_4 = noise_terrain_4 * 10 local resource_entity_placed = false
seed = seed + seed_increment_number
local noise_terrain_5 = perlin:noise(((pos_x+seed)/5),((pos_y+seed)/5),0) local entity_list = {}
noise_terrain_5 = noise_terrain_5 * 4 table.insert(entity_list, {name="big-ship-wreck-1", pos={pos_x,pos_y},chance = 65000, health="random"})
seed = seed + seed_increment_number table.insert(entity_list, {name="big-ship-wreck-2", pos={pos_x,pos_y},chance = 65000, health="random"})
local noise_sand = perlin:noise(((pos_x+seed)/18),((pos_y+seed)/18),0) table.insert(entity_list, {name="big-ship-wreck-3", pos={pos_x,pos_y},chance = 65000, health="random"})
noise_sand = noise_sand * 10 table.insert(entity_list, {name="medium-ship-wreck", pos={pos_x,pos_y},chance = 25000, health="medium"})
table.insert(entity_list, {name="small-ship-wreck", pos={pos_x,pos_y},chance = 15000, health="medium"})
--DECORATIVES table.insert(entity_list, {name="car", pos={pos_x,pos_y},chance = 150000, health="low"})
seed = seed + seed_increment_number table.insert(entity_list, {name="laser-turret", pos={pos_x,pos_y},chance = 100000, force="enemy", health="low"})
local noise_decoratives_1 = perlin:noise(((pos_x+seed)/20),((pos_y+seed)/20),0) table.insert(entity_list, {name="nuclear-reactor", pos={pos_x,pos_y},chance = 1000000, force="enemy", health="medium"})
noise_decoratives_1 = noise_decoratives_1 local b, placed_entity = place_entities(surface, entity_list)
seed = seed + seed_increment_number if b == true then
local noise_decoratives_2 = perlin:noise(((pos_x+seed)/30),((pos_y+seed)/30),0) if placed_entity.name == "big-ship-wreck-1" or placed_entity.name == "big-ship-wreck-2" or placed_entity.name == "big-ship-wreck-3" then
noise_decoratives_2 = noise_decoratives_2 placed_entity.insert(wreck_item_pool[math.random(1,#wreck_item_pool)])
seed = seed + seed_increment_number placed_entity.insert(wreck_item_pool[math.random(1,#wreck_item_pool)])
local noise_decoratives_3 = perlin:noise(((pos_x+seed)/30),((pos_y+seed)/30),0) placed_entity.insert(wreck_item_pool[math.random(1,#wreck_item_pool)])
noise_decoratives_3 = noise_decoratives_3 end
end
seed = seed + seed_increment_number local seed_increment_number = 10000
local noise_water_1 = perlin:noise(((pos_x+seed)/250),((pos_y+seed)/300),0)
noise_water_1 = noise_water_1 * 100 local noise_terrain_1 = perlin:noise(((pos_x+seed)/400),((pos_y+seed)/400),0)
seed = seed + seed_increment_number noise_terrain_1 = noise_terrain_1 * 100
local noise_water_2 = perlin:noise(((pos_x+seed)/100),((pos_y+seed)/150),0) seed = seed + seed_increment_number
noise_water_2 = noise_water_2 * 50 local noise_terrain_2 = perlin:noise(((pos_x+seed)/250),((pos_y+seed)/250),0)
noise_terrain_2 = noise_terrain_2 * 100
--RESOURCES seed = seed + seed_increment_number
seed = seed + seed_increment_number local noise_terrain_3 = perlin:noise(((pos_x+seed)/100),((pos_y+seed)/100),0)
local noise_resources = perlin:noise(((pos_x+seed)/100),((pos_y+seed)/100),0) noise_terrain_3 = noise_terrain_3 * 50
seed = seed + seed_increment_number seed = seed + seed_increment_number
local noise_resources_2 = perlin:noise(((pos_x+seed)/40),((pos_y+seed)/40),0) local noise_terrain_4 = perlin:noise(((pos_x+seed)/20),((pos_y+seed)/20),0)
seed = seed + seed_increment_number noise_terrain_4 = noise_terrain_4 * 10
local noise_resources_3 = perlin:noise(((pos_x+seed)/20),((pos_y+seed)/20),0) seed = seed + seed_increment_number
noise_resources = noise_resources * 50 + noise_resources_2 * 20 + noise_resources_3 * 20 local noise_terrain_5 = perlin:noise(((pos_x+seed)/5),((pos_y+seed)/5),0)
noise_resources = noise_resources_2 * 100 noise_terrain_5 = noise_terrain_5 * 4
seed = seed + seed_increment_number
seed = seed + seed_increment_number local noise_sand = perlin:noise(((pos_x+seed)/18),((pos_y+seed)/18),0)
local noise_resource_amount_modifier = perlin:noise(((pos_x+seed)/200),((pos_y+seed)/200),0) noise_sand = noise_sand * 10
local resource_amount = 1 + ((400 + (400*noise_resource_amount_modifier*0.2)) * resource_amount_distance_multiplicator)
seed = seed + seed_increment_number --DECORATIVES
local noise_resources_iron_and_copper = perlin:noise(((pos_x+seed)/250),((pos_y+seed)/250),0) seed = seed + seed_increment_number
noise_resources_iron_and_copper = noise_resources_iron_and_copper * 100 local noise_decoratives_1 = perlin:noise(((pos_x+seed)/20),((pos_y+seed)/20),0)
seed = seed + seed_increment_number noise_decoratives_1 = noise_decoratives_1
local noise_resources_coal_and_uranium = perlin:noise(((pos_x+seed)/250),((pos_y+seed)/250),0) seed = seed + seed_increment_number
noise_resources_coal_and_uranium = noise_resources_coal_and_uranium * 100 local noise_decoratives_2 = perlin:noise(((pos_x+seed)/30),((pos_y+seed)/30),0)
seed = seed + seed_increment_number noise_decoratives_2 = noise_decoratives_2
local noise_resources_stone_and_oil = perlin:noise(((pos_x+seed)/150),((pos_y+seed)/150),0) seed = seed + seed_increment_number
noise_resources_stone_and_oil = noise_resources_stone_and_oil * 100 local noise_decoratives_3 = perlin:noise(((pos_x+seed)/30),((pos_y+seed)/30),0)
noise_decoratives_3 = noise_decoratives_3
seed = seed + seed_increment_number
local noise_red_desert_rocks_1 = perlin:noise(((pos_x+seed)/20),((pos_y+seed)/20),0)
noise_red_desert_rocks_1 = noise_red_desert_rocks_1 * 100 seed = seed + seed_increment_number
seed = seed + seed_increment_number local noise_water_1 = perlin:noise(((pos_x+seed)/250),((pos_y+seed)/300),0)
local noise_red_desert_rocks_2 = perlin:noise(((pos_x+seed)/10),((pos_y+seed)/10),0) noise_water_1 = noise_water_1 * 100
noise_red_desert_rocks_2 = noise_red_desert_rocks_2 * 50 seed = seed + seed_increment_number
seed = seed + seed_increment_number local noise_water_2 = perlin:noise(((pos_x+seed)/100),((pos_y+seed)/150),0)
local noise_red_desert_rocks_3 = perlin:noise(((pos_x+seed)/5),((pos_y+seed)/5),0) noise_water_2 = noise_water_2 * 50
noise_red_desert_rocks_3 = noise_red_desert_rocks_3 * 100
seed = seed + seed_increment_number --RESOURCES
local noise_forest = perlin:noise(((pos_x+seed)/100),((pos_y+seed)/100),0) seed = seed + seed_increment_number
noise_forest = noise_forest * 100 local noise_resources = perlin:noise(((pos_x+seed)/100),((pos_y+seed)/100),0)
seed = seed + seed_increment_number seed = seed + seed_increment_number
local noise_forest_2 = perlin:noise(((pos_x+seed)/20),((pos_y+seed)/20),0) local noise_resources_2 = perlin:noise(((pos_x+seed)/40),((pos_y+seed)/40),0)
noise_forest_2 = noise_forest_2 * 20 seed = seed + seed_increment_number
local noise_resources_3 = perlin:noise(((pos_x+seed)/20),((pos_y+seed)/20),0)
local terrain_smoothing = math.random(0,1) noise_resources = noise_resources * 50 + noise_resources_2 * 20 + noise_resources_3 * 20
local place_tree_number noise_resources = noise_resources_2 * 100
if noise_terrain_1 < 8 + terrain_smoothing + noise_terrain_2 + noise_terrain_3 + noise_terrain_4 then seed = seed + seed_increment_number
tile_to_insert = "red-desert" local noise_resource_amount_modifier = perlin:noise(((pos_x+seed)/200),((pos_y+seed)/200),0)
if noise_water_1 + noise_water_2 + noise_sand > -10 and noise_water_1 + noise_water_2 + noise_sand < 25 and noise_terrain_1 < -52 + noise_terrain_2 + noise_terrain_3 + noise_terrain_4 + noise_terrain_5 then local resource_amount = 1 + ((400 + (400*noise_resource_amount_modifier*0.2)) * resource_amount_distance_multiplicator)
tile_to_insert = "sand" seed = seed + seed_increment_number
place_tree_number = math.random(3,#tree_to_place) local noise_resources_iron_and_copper = perlin:noise(((pos_x+seed)/250),((pos_y+seed)/250),0)
else noise_resources_iron_and_copper = noise_resources_iron_and_copper * 100
place_tree_number = math.random(1,(#tree_to_place - 3)) seed = seed + seed_increment_number
end local noise_resources_coal_and_uranium = perlin:noise(((pos_x+seed)/250),((pos_y+seed)/250),0)
noise_resources_coal_and_uranium = noise_resources_coal_and_uranium * 100
if noise_water_1 + noise_water_2 > 0 and noise_water_1 + noise_water_2 < 15 and noise_terrain_1 < -60 + noise_terrain_2 + noise_terrain_3 + noise_terrain_4 + noise_terrain_5 then seed = seed + seed_increment_number
tile_to_insert = "water" local noise_resources_stone_and_oil = perlin:noise(((pos_x+seed)/150),((pos_y+seed)/150),0)
local a = pos_x + 1 noise_resources_stone_and_oil = noise_resources_stone_and_oil * 100
table.insert(tiles, {name = tile_to_insert, position = {a,pos_y}})
local a = pos_y + 1 seed = seed + seed_increment_number
table.insert(tiles, {name = tile_to_insert, position = {pos_x,a}}) local noise_red_desert_rocks_1 = perlin:noise(((pos_x+seed)/20),((pos_y+seed)/20),0)
local a = pos_x - 1 noise_red_desert_rocks_1 = noise_red_desert_rocks_1 * 100
table.insert(tiles, {name = tile_to_insert, position = {a,pos_y}}) seed = seed + seed_increment_number
local a = pos_y - 1 local noise_red_desert_rocks_2 = perlin:noise(((pos_x+seed)/10),((pos_y+seed)/10),0)
table.insert(tiles, {name = tile_to_insert, position = {pos_x,a}}) noise_red_desert_rocks_2 = noise_red_desert_rocks_2 * 50
if noise_water_1 + noise_water_2 < 2 or noise_water_1 + noise_water_2 > 13 then seed = seed + seed_increment_number
if math.random(1,15) == 1 then local noise_red_desert_rocks_3 = perlin:noise(((pos_x+seed)/5),((pos_y+seed)/5),0)
table.insert(decoratives, {name="green-carpet-grass", position={pos_x,pos_y}, amount=1}) noise_red_desert_rocks_3 = noise_red_desert_rocks_3 * 100
end seed = seed + seed_increment_number
if math.random(1,15) == 1 then local noise_forest = perlin:noise(((pos_x+seed)/100),((pos_y+seed)/100),0)
table.insert(decoratives, {name="brown-cane-cluster", position={pos_x,pos_y}, amount=1}) noise_forest = noise_forest * 100
end seed = seed + seed_increment_number
end local noise_forest_2 = perlin:noise(((pos_x+seed)/20),((pos_y+seed)/20),0)
end noise_forest_2 = noise_forest_2 * 20
if tile_to_insert ~= "water" then local terrain_smoothing = math.random(0,1)
if noise_water_1 + noise_water_2 > 16 and noise_water_1 + noise_water_2 < 25 and noise_terrain_1 < -55 + noise_terrain_2 + noise_terrain_3 + noise_terrain_4 + noise_terrain_5 then local place_tree_number
if math.random(1,35) == 1 then
table.insert(decoratives, {name="brown-carpet-grass", position={pos_x,pos_y}, amount=1}) if noise_terrain_1 < 8 + terrain_smoothing + noise_terrain_2 + noise_terrain_3 + noise_terrain_4 then
end tile_to_insert = "red-desert"
end if noise_water_1 + noise_water_2 + noise_sand > -10 and noise_water_1 + noise_water_2 + noise_sand < 25 and noise_terrain_1 < -52 + noise_terrain_2 + noise_terrain_3 + noise_terrain_4 + noise_terrain_5 then
if noise_water_1 + noise_water_2 > -10 and noise_water_1 + noise_water_2 < -1 and noise_terrain_1 < -55 + noise_terrain_2 + noise_terrain_3 + noise_terrain_4 + noise_terrain_5 then tile_to_insert = "sand"
if math.random(1,35) == 1 then place_tree_number = math.random(3,#tree_to_place)
table.insert(decoratives, {name="brown-carpet-grass", position={pos_x,pos_y}, amount=1}) else
end place_tree_number = math.random(1,(#tree_to_place - 3))
end end
if noise_decoratives_1 > 0.5 and noise_decoratives_1 <= 0.8 then
if math.random(1,12) == 1 then table.insert(decoratives, {name="red-desert-bush", position={pos_x,pos_y}, amount=1}) end if noise_water_1 + noise_water_2 > 0 and noise_water_1 + noise_water_2 < 15 and noise_terrain_1 < -60 + noise_terrain_2 + noise_terrain_3 + noise_terrain_4 + noise_terrain_5 then
end tile_to_insert = "water"
if noise_decoratives_1 > 0.4 and noise_decoratives_1 <= 0.5 then local a = pos_x + 1
if math.random(1,4) == 1 then table.insert(decoratives, {name="red-desert-bush", position={pos_x,pos_y}, amount=1}) end table.insert(global.planet_tiles_hold, {name = tile_to_insert, position = {a,pos_y}})
end local a = pos_y + 1
end table.insert(global.planet_tiles_hold, {name = tile_to_insert, position = {pos_x,a}})
local a = pos_x - 1
--HAPPY TREES table.insert(global.planet_tiles_hold, {name = tile_to_insert, position = {a,pos_y}})
if noise_terrain_1 < -30 + noise_terrain_2 + noise_terrain_3 + noise_terrain_5 + noise_forest_2 then local a = pos_y - 1
if noise_forest > 0 and noise_forest <= 10 then table.insert(global.planet_tiles_hold, {name = tile_to_insert, position = {pos_x,a}})
if math.random(1,50) == 1 then if noise_water_1 + noise_water_2 < 2 or noise_water_1 + noise_water_2 > 13 then
if surface.can_place_entity {name=tree_to_place[place_tree_number], position={pos_x,pos_y}} then if math.random(1,15) == 1 then
surface.create_entity {name=tree_to_place[place_tree_number], position={pos_x,pos_y}} table.insert(global.planet_decoratives_hold, {name="green-carpet-grass", position={pos_x,pos_y}, amount=1})
end end
end if math.random(1,15) == 1 then
end table.insert(global.planet_decoratives_hold, {name="brown-cane-cluster", position={pos_x,pos_y}, amount=1})
if noise_forest > 10 and noise_forest <= 20 then end
if math.random(1,25) == 1 then end
if surface.can_place_entity {name=tree_to_place[place_tree_number], position={pos_x,pos_y}} then end
surface.create_entity {name=tree_to_place[place_tree_number], position={pos_x,pos_y}}
end if tile_to_insert ~= "water" then
end if noise_water_1 + noise_water_2 > 16 and noise_water_1 + noise_water_2 < 25 and noise_terrain_1 < -55 + noise_terrain_2 + noise_terrain_3 + noise_terrain_4 + noise_terrain_5 then
end if math.random(1,35) == 1 then
if noise_forest > 20 then table.insert(global.planet_decoratives_hold, {name="brown-carpet-grass", position={pos_x,pos_y}, amount=1})
if math.random(1,10) == 1 then end
if surface.can_place_entity {name=tree_to_place[place_tree_number], position={pos_x,pos_y}} then end
surface.create_entity {name=tree_to_place[place_tree_number], position={pos_x,pos_y}} if noise_water_1 + noise_water_2 > -10 and noise_water_1 + noise_water_2 < -1 and noise_terrain_1 < -55 + noise_terrain_2 + noise_terrain_3 + noise_terrain_4 + noise_terrain_5 then
end if math.random(1,35) == 1 then
end table.insert(global.planet_decoratives_hold, {name="brown-carpet-grass", position={pos_x,pos_y}, amount=1})
end end
end end
if noise_decoratives_1 > 0.5 and noise_decoratives_1 <= 0.8 then
if tile_to_insert ~= "water" then if math.random(1,12) == 1 then table.insert(global.planet_decoratives_hold, {name="red-desert-bush", position={pos_x,pos_y}, amount=1}) end
if noise_terrain_1 < 8 + noise_terrain_2 + noise_terrain_3 + noise_terrain_4 and noise_terrain_1 > -5 + noise_terrain_2 + noise_terrain_3 + noise_terrain_4 then end
if math.random(1,45) == 1 then if noise_decoratives_1 > 0.4 and noise_decoratives_1 <= 0.5 then
table.insert(decoratives, {name="red-desert-rock-medium", position={pos_x,pos_y}, amount=1}) if math.random(1,4) == 1 then table.insert(global.planet_decoratives_hold, {name="red-desert-bush", position={pos_x,pos_y}, amount=1}) end
end end
if math.random(1,20) == 1 then end
table.insert(decoratives, {name="red-desert-rock-tiny", position={pos_x,pos_y}, amount=1})
end --HAPPY TREES
else if noise_terrain_1 < -30 + noise_terrain_2 + noise_terrain_3 + noise_terrain_5 + noise_forest_2 then
if math.random(1,375) == 1 then if noise_forest > 0 and noise_forest <= 10 then
table.insert(decoratives, {name="red-desert-rock-medium", position={pos_x,pos_y}, amount=1}) if math.random(1,50) == 1 then
end if surface.can_place_entity {name=tree_to_place[place_tree_number], position={pos_x,pos_y}} then
if math.random(1,45) == 1 then surface.create_entity {name=tree_to_place[place_tree_number], position={pos_x,pos_y}}
table.insert(decoratives, {name="red-desert-rock-tiny", position={pos_x,pos_y}, amount=1}) end
end end
end end
end if noise_forest > 10 and noise_forest <= 20 then
else if math.random(1,25) == 1 then
tile_to_insert = "red-desert-dark" if surface.can_place_entity {name=tree_to_place[place_tree_number], position={pos_x,pos_y}} then
end surface.create_entity {name=tree_to_place[place_tree_number], position={pos_x,pos_y}}
if resource_entity_placed == false and noise_resources_coal_and_uranium + noise_resources < -72 and noise_terrain_1 > 65 + noise_terrain_2 + noise_terrain_3 + noise_terrain_4 then end
if surface.can_place_entity {name="uranium-ore", position={pos_x,pos_y}} then end
surface.create_entity {name="uranium-ore", position={pos_x,pos_y}, amount=resource_amount} end
resource_entity_placed = true if noise_forest > 20 then
end if math.random(1,10) == 1 then
end if surface.can_place_entity {name=tree_to_place[place_tree_number], position={pos_x,pos_y}} then
if resource_entity_placed == false and noise_resources_iron_and_copper + noise_resources > 72 and noise_terrain_1 > 15 + noise_terrain_2 + noise_terrain_3 + noise_terrain_4 then surface.create_entity {name=tree_to_place[place_tree_number], position={pos_x,pos_y}}
if surface.can_place_entity {name="iron-ore", position={pos_x,pos_y}} then end
surface.create_entity {name="iron-ore", position={pos_x,pos_y}, amount=resource_amount} end
resource_entity_placed = true end
end end
end
if resource_entity_placed == false and noise_resources_coal_and_uranium + noise_resources > 70 and noise_terrain_1 > 15 + noise_terrain_2 + noise_terrain_3 + noise_terrain_4 then if tile_to_insert ~= "water" then
if surface.can_place_entity {name="coal", position={pos_x,pos_y}} then if noise_terrain_1 < 8 + noise_terrain_2 + noise_terrain_3 + noise_terrain_4 and noise_terrain_1 > -5 + noise_terrain_2 + noise_terrain_3 + noise_terrain_4 then
surface.create_entity {name="coal", position={pos_x,pos_y}, amount=resource_amount} if math.random(1,180) == 1 then
resource_entity_placed = true table.insert(global.planet_decoratives_hold, {name="red-desert-rock-medium", position={pos_x,pos_y}, amount=1})
end end
end if math.random(1,80) == 1 then
if resource_entity_placed == false and noise_resources_iron_and_copper + noise_resources < -72 and noise_terrain_1 > 15 + noise_terrain_2 + noise_terrain_3 + noise_terrain_4 then table.insert(global.planet_decoratives_hold, {name="red-desert-rock-tiny", position={pos_x,pos_y}, amount=1})
if surface.can_place_entity {name="copper-ore", position={pos_x,pos_y}} then end
surface.create_entity {name="copper-ore", position={pos_x,pos_y}, amount=resource_amount} else
resource_entity_placed = true if math.random(1,1500) == 1 then
end table.insert(global.planet_decoratives_hold, {name="red-desert-rock-medium", position={pos_x,pos_y}, amount=1})
end end
if resource_entity_placed == false and noise_resources_stone_and_oil + noise_resources > 72 and noise_terrain_1 > 15 + noise_terrain_2 + noise_terrain_3 + noise_terrain_4 then if math.random(1,180) == 1 then
if surface.can_place_entity {name="stone", position={pos_x,pos_y}} then table.insert(global.planet_decoratives_hold, {name="red-desert-rock-tiny", position={pos_x,pos_y}, amount=1})
surface.create_entity {name="stone", position={pos_x,pos_y}, amount=resource_amount} end
resource_entity_placed = true end
end end
end else
if resource_entity_placed == false and noise_resources_stone_and_oil + noise_resources < -70 and noise_terrain_1 < -50 + noise_terrain_2 + noise_terrain_3 + noise_terrain_4 then tile_to_insert = "red-desert-dark"
if math.random(1,42) == 1 then end
if surface.can_place_entity {name="crude-oil", position={pos_x,pos_y}} then if resource_entity_placed == false and noise_resources_coal_and_uranium + noise_resources < -72 and noise_terrain_1 > 65 + noise_terrain_2 + noise_terrain_3 + noise_terrain_4 then
surface.create_entity {name="crude-oil", position={pos_x,pos_y}, amount=(resource_amount*500)} if surface.can_place_entity {name="uranium-ore", position={pos_x,pos_y}} then
resource_entity_placed = true surface.create_entity {name="uranium-ore", position={pos_x,pos_y}, amount=resource_amount}
end resource_entity_placed = true
end end
end end
if resource_entity_placed == false and noise_resources_iron_and_copper + noise_resources > 72 and noise_terrain_1 > 15 + noise_terrain_2 + noise_terrain_3 + noise_terrain_4 then
if resource_entity_placed == false and noise_red_desert_rocks_1 + noise_red_desert_rocks_2 + noise_red_desert_rocks_3 > 20 and noise_red_desert_rocks_1 + noise_red_desert_rocks_2 < 60 and noise_terrain_1 > 7 + noise_terrain_2 + noise_terrain_3 + noise_terrain_4 then if surface.can_place_entity {name="iron-ore", position={pos_x,pos_y}} then
if math.random(1,3) == 1 then surface.create_entity {name="iron-ore", position={pos_x,pos_y}, amount=resource_amount}
if math.random(1,3) == 1 then resource_entity_placed = true
if surface.can_place_entity {name="red-desert-rock-huge-01", position={pos_x,pos_y}} then end
surface.create_entity {name="red-desert-rock-huge-01", position={pos_x,pos_y}} end
end if resource_entity_placed == false and noise_resources_coal_and_uranium + noise_resources > 70 and noise_terrain_1 > 15 + noise_terrain_2 + noise_terrain_3 + noise_terrain_4 then
else if surface.can_place_entity {name="coal", position={pos_x,pos_y}} then
if surface.can_place_entity {name="red-desert-rock-big-01", position={pos_x,pos_y}} then surface.create_entity {name="coal", position={pos_x,pos_y}, amount=resource_amount}
surface.create_entity {name="red-desert-rock-big-01", position={pos_x,pos_y}} resource_entity_placed = true
end end
end end
end if resource_entity_placed == false and noise_resources_iron_and_copper + noise_resources < -72 and noise_terrain_1 > 15 + noise_terrain_2 + noise_terrain_3 + noise_terrain_4 then
end if surface.can_place_entity {name="copper-ore", position={pos_x,pos_y}} then
surface.create_entity {name="copper-ore", position={pos_x,pos_y}, amount=resource_amount}
if noise_red_desert_rocks_1 + noise_red_desert_rocks_2 + noise_red_desert_rocks_3 + noise_terrain_4 >= 10 and noise_red_desert_rocks_1 + noise_red_desert_rocks_2 + noise_red_desert_rocks_3 < 20 and noise_terrain_1 > 7 + noise_terrain_2 + noise_terrain_3 + noise_terrain_4 then resource_entity_placed = true
if math.random(1,5) == 1 then end
table.insert(decoratives, {name="red-desert-rock-medium", position={pos_x,pos_y}, amount=1}) end
end if resource_entity_placed == false and noise_resources_stone_and_oil + noise_resources > 72 and noise_terrain_1 > 15 + noise_terrain_2 + noise_terrain_3 + noise_terrain_4 then
else if surface.can_place_entity {name="stone", position={pos_x,pos_y}} then
if tile_to_insert ~= "water" and tile_to_insert ~= "sand" then surface.create_entity {name="stone", position={pos_x,pos_y}, amount=resource_amount}
if math.random(1,15) == 1 then resource_entity_placed = true
table.insert(decoratives, {name="red-desert-rock-small", position={pos_x,pos_y}, amount=1}) end
else end
if math.random(1,8) == 1 then if resource_entity_placed == false and noise_resources_stone_and_oil + noise_resources < -70 and noise_terrain_1 < -50 + noise_terrain_2 + noise_terrain_3 + noise_terrain_4 then
table.insert(decoratives, {name="red-desert-rock-tiny", position={pos_x,pos_y}, amount=1}) if math.random(1,42) == 1 then
end if surface.can_place_entity {name="crude-oil", position={pos_x,pos_y}} then
end surface.create_entity {name="crude-oil", position={pos_x,pos_y}, amount=(resource_amount*500)}
end resource_entity_placed = true
end end
if tile_to_insert ~= "water" then end
if noise_decoratives_2 > 0.6 then end
if math.random(1,9) == 1 then table.insert(decoratives, {name="red-asterisk", position={pos_x,pos_y}, amount=1}) end
else if resource_entity_placed == false and noise_red_desert_rocks_1 + noise_red_desert_rocks_2 + noise_red_desert_rocks_3 > 20 and noise_red_desert_rocks_1 + noise_red_desert_rocks_2 < 60 and noise_terrain_1 > 7 + noise_terrain_2 + noise_terrain_3 + noise_terrain_4 then
if noise_decoratives_2 > 0.4 then if math.random(1,3) == 1 then
if math.random(1,17) == 1 then table.insert(decoratives, {name="red-asterisk", position={pos_x,pos_y}, amount=1}) end if math.random(1,3) == 1 then
end if surface.can_place_entity {name="red-desert-rock-huge-01", position={pos_x,pos_y}} then
end surface.create_entity {name="red-desert-rock-huge-01", position={pos_x,pos_y}}
if noise_decoratives_3 < -0.6 then end
if math.random(1,2) == 1 then table.insert(decoratives, {name="brown-fluff-dry", position={pos_x,pos_y}, amount=1}) end else
else if surface.can_place_entity {name="red-desert-rock-big-01", position={pos_x,pos_y}} then
if noise_decoratives_3 < -0.4 then surface.create_entity {name="red-desert-rock-big-01", position={pos_x,pos_y}}
if math.random(1,5) == 1 then table.insert(decoratives, {name="brown-fluff-dry", position={pos_x,pos_y}, amount=1}) end end
end end
end end
end end
table.insert(tiles, {name = tile_to_insert, position = {pos_x,pos_y}})
end if noise_red_desert_rocks_1 + noise_red_desert_rocks_2 + noise_red_desert_rocks_3 + noise_terrain_4 >= 10 and noise_red_desert_rocks_1 + noise_red_desert_rocks_2 + noise_red_desert_rocks_3 < 20 and noise_terrain_1 > 7 + noise_terrain_2 + noise_terrain_3 + noise_terrain_4 then
end if math.random(1,5) == 1 then
table.insert(global.planet_decoratives_hold, {name="red-desert-rock-medium", position={pos_x,pos_y}, amount=1})
surface.set_tiles(tiles,false) end
surface.create_decoratives{check_collision=false, decoratives=decoratives} else
if tile_to_insert ~= "water" and tile_to_insert ~= "sand" then
if math.random(1,15) == 1 then
table.insert(global.planet_decoratives_hold, {name="red-desert-rock-small", position={pos_x,pos_y}, amount=1})
else
if math.random(1,8) == 1 then
table.insert(global.planet_decoratives_hold, {name="red-desert-rock-tiny", position={pos_x,pos_y}, amount=1})
end
end
end
end
if tile_to_insert ~= "water" then
if noise_decoratives_2 > 0.6 then
if math.random(1,9) == 1 then table.insert(global.planet_decoratives_hold, {name="red-asterisk", position={pos_x,pos_y}, amount=1}) end
else
if noise_decoratives_2 > 0.4 then
if math.random(1,17) == 1 then table.insert(global.planet_decoratives_hold, {name="red-asterisk", position={pos_x,pos_y}, amount=1}) end
end
end
if noise_decoratives_3 < -0.6 then
if math.random(1,2) == 1 then table.insert(global.planet_decoratives_hold, {name="brown-fluff-dry", position={pos_x,pos_y}, amount=1}) end
else
if noise_decoratives_3 < -0.4 then
if math.random(1,5) == 1 then table.insert(global.planet_decoratives_hold, {name="brown-fluff-dry", position={pos_x,pos_y}, amount=1}) end
end
end
end
table.insert(global.planet_tiles_hold, {name = tile_to_insert, position = {pos_x,pos_y}})
end
end end

View File

@ -121,4 +121,6 @@ return
["yago2003"] = "", ["yago2003"] = "",
["saneman"] = "", ["saneman"] = "",
["mesohorknee"] = "", ["mesohorknee"] = "",
["brl_chacal"] = "",
["spechok"] = "",
} }