mirror of
https://github.com/Refactorio/RedMew.git
synced 2024-12-14 10:13:13 +02:00
Merge pull request #144 from Valansch/island_0.16_tweaks
Tile/Entity name 0.16 port
This commit is contained in:
commit
c4477fed7a
1
.gitignore
vendored
1
.gitignore
vendored
@ -1 +1,2 @@
|
||||
*.swp
|
||||
build.sh
|
||||
|
@ -288,7 +288,7 @@ function run_combined_module(event)
|
||||
local entities = surface.find_entities(area)
|
||||
for _, entity in pairs(entities) do
|
||||
if entity.type == "resource" then
|
||||
--table.insert(resource_tiles, {name = "sand-dark", position = entity.position})
|
||||
--table.insert(resource_tiles, {name = "sand-3", position = entity.position})
|
||||
special_tiles = false
|
||||
end
|
||||
if entity.type == "simple-entity" or entity.type == "tree" then
|
||||
@ -304,7 +304,7 @@ function run_combined_module(event)
|
||||
local pos_y = event.area.left_top.y + y
|
||||
local pos = {x = pos_x,y = pos_y}
|
||||
local tile = surface.get_tile(pos_x,pos_y)
|
||||
local tile_to_insert = "sand"
|
||||
local tile_to_insert = "sand-1"
|
||||
local entity_placed = false
|
||||
|
||||
local seed_increment_number = 10000
|
||||
@ -338,7 +338,7 @@ function run_combined_module(event)
|
||||
end
|
||||
|
||||
if noise_trees > 0.4 then
|
||||
tile_to_insert = "sand-dark"
|
||||
tile_to_insert = "sand-3"
|
||||
end
|
||||
if noise_borg_defense > 0.4 then
|
||||
tile_to_insert = "concrete"
|
||||
@ -411,7 +411,7 @@ function run_combined_module(event)
|
||||
tile_to_insert = "stone-path"
|
||||
end
|
||||
|
||||
if noise_trees > 0.4 and tile_to_insert == "sand-dark" then
|
||||
if noise_trees > 0.4 and tile_to_insert == "sand-3" then
|
||||
if math.random(1,20) == 1 then
|
||||
if event.surface.can_place_entity {name="dry-tree", position={pos_x,pos_y}} then
|
||||
event.surface.create_entity {name="dry-tree", position={pos_x,pos_y}}
|
||||
@ -446,10 +446,10 @@ function run_combined_module(event)
|
||||
end
|
||||
|
||||
if noise_trees < -0.5 then
|
||||
if tile_to_insert == "sand-dark" or tile_to_insert == "sand" then
|
||||
if tile_to_insert == "sand-3" or tile_to_insert == "sand-1" then
|
||||
if math.random(1,15) == 1 then
|
||||
if event.surface.can_place_entity {name="stone-rock", position={pos_x,pos_y}} then
|
||||
event.surface.create_entity {name="stone-rock", position={pos_x,pos_y}}
|
||||
if event.surface.can_place_entity {name="rock-big", position={pos_x,pos_y}} then
|
||||
event.surface.create_entity {name="rock-big", position={pos_x,pos_y}}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -307,7 +307,7 @@ function run_borg( params )
|
||||
local pos_y = area.left_top.y + y
|
||||
local pos = {x = pos_x,y = pos_y}
|
||||
local tile = surface.get_tile(pos_x,pos_y)
|
||||
local tile_to_insert = "sand"
|
||||
local tile_to_insert = "sand-1"
|
||||
local entity_placed = false
|
||||
|
||||
local seed_increment_number = 10000
|
||||
@ -349,7 +349,7 @@ function run_borg( params )
|
||||
end
|
||||
|
||||
if noise_trees > 0.17 then
|
||||
tile_to_insert = "sand-dark"
|
||||
tile_to_insert = "sand-3"
|
||||
end
|
||||
if noise_borg_defense > 0.4 then
|
||||
tile_to_insert = "concrete"
|
||||
@ -399,7 +399,7 @@ function run_borg( params )
|
||||
end
|
||||
|
||||
|
||||
if noise_trees > 0.2 and tile_to_insert == "sand-dark" then
|
||||
if noise_trees > 0.2 and tile_to_insert == "sand-3" then
|
||||
if math.random(1,15) == 1 then
|
||||
if math.random(1,5) == 1 then
|
||||
if surface.can_place_entity {name="dry-hairy-tree", position={pos_x,pos_y}} then
|
||||
@ -450,10 +450,10 @@ function run_borg( params )
|
||||
end
|
||||
|
||||
if noise_trees < -0.5 then
|
||||
if tile_to_insert == "sand-dark" or tile_to_insert == "sand" then
|
||||
if tile_to_insert == "sand-3" or tile_to_insert == "sand-1" then
|
||||
if math.random(1,15) == 1 then
|
||||
if surface.can_place_entity {name="stone-rock", position={pos_x,pos_y}} then
|
||||
surface.create_entity {name="stone-rock", position={pos_x,pos_y}}
|
||||
if surface.can_place_entity {name="rock-big", position={pos_x,pos_y}} then
|
||||
surface.create_entity {name="rock-big", position={pos_x,pos_y}}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -322,10 +322,10 @@ function run_swamp_entities(params)
|
||||
local tile = surface.get_tile(pos_x,pos_y)
|
||||
local tile_to_insert = tile
|
||||
local entity_placed = false
|
||||
-- or tile.name == "grass-dry"
|
||||
-- or tile.name == "grass-2"
|
||||
--if tile.name ~= "water" and tile.name ~= "deepwater" and tile.name ~= "water-green" then
|
||||
if tile.name ~= "water-green" then
|
||||
table.insert(global.swamp_tiles_hold, {name = "grass", position = {pos_x,pos_y}})
|
||||
table.insert(global.swamp_tiles_hold, {name = "grass-1", position = {pos_x,pos_y}})
|
||||
|
||||
local entity_list = {}
|
||||
table.insert(entity_list, {name="big-ship-wreck-1", pos={pos_x,pos_y},chance = 65000, health="random"})
|
||||
@ -343,7 +343,7 @@ function run_swamp_entities(params)
|
||||
table.insert(entity_list, {name="tree-09", pos={pos_x,pos_y},chance = 1000})
|
||||
table.insert(entity_list, {name="tree-07", pos={pos_x,pos_y},chance = 400})
|
||||
table.insert(entity_list, {name="tree-06", pos={pos_x,pos_y},chance = 150})
|
||||
table.insert(entity_list, {name="stone-rock", pos={pos_x,pos_y},chance = 400})
|
||||
table.insert(entity_list, {name="rock-big", pos={pos_x,pos_y},chance = 400})
|
||||
table.insert(entity_list, {name="green-coral", pos={pos_x,pos_y},chance = 10000})
|
||||
table.insert(entity_list, {name="medium-ship-wreck", pos={pos_x,pos_y},chance = 25000, health="random"})
|
||||
table.insert(entity_list, {name="small-ship-wreck", pos={pos_x,pos_y},chance = 25000, health="random"})
|
||||
@ -434,18 +434,18 @@ function run_swamp_cleanup(params)
|
||||
local tile = surface.get_tile(pos_x, pos_y)
|
||||
local decal_has_been_placed = false
|
||||
|
||||
if tile.name == "grass" then
|
||||
if tile.name == "grass-1" then
|
||||
if decal_has_been_placed == false then
|
||||
local r = math.random(1,3)
|
||||
if r == 1 then
|
||||
table.insert(decoratives, {name="green-carpet-grass", position={pos_x,pos_y}, amount=1})
|
||||
table.insert(decoratives, {name="green-carpet-grass-1", position={pos_x,pos_y}, amount=1})
|
||||
decal_has_been_placed = false
|
||||
end
|
||||
end
|
||||
if decal_has_been_placed == false then
|
||||
local r = math.random(1,7)
|
||||
if r == 1 then
|
||||
table.insert(decoratives, {name="green-hairy-grass", position={pos_x,pos_y}, amount=1})
|
||||
table.insert(decoratives, {name="green-hairy-grass-1", position={pos_x,pos_y}, amount=1})
|
||||
decal_has_been_placed = false
|
||||
end
|
||||
end
|
||||
@ -466,7 +466,7 @@ function run_swamp_cleanup(params)
|
||||
if decal_has_been_placed == false then
|
||||
local r = math.random(1,12)
|
||||
if r == 1 then
|
||||
table.insert(decoratives, {name="green-small-grass", position={pos_x,pos_y}, amount=1})
|
||||
table.insert(decoratives, {name="green-small-grass-1", position={pos_x,pos_y}, amount=1})
|
||||
decal_has_been_placed = false
|
||||
end
|
||||
end
|
||||
@ -483,14 +483,14 @@ function run_swamp_cleanup(params)
|
||||
if decal_has_been_placed == false then
|
||||
local r = math.random(1,18)
|
||||
if r == 1 then
|
||||
table.insert(decoratives, {name="green-carpet-grass", position={pos_x,pos_y}, amount=1})
|
||||
table.insert(decoratives, {name="green-carpet-grass-1", position={pos_x,pos_y}, amount=1})
|
||||
decal_has_been_placed = false
|
||||
end
|
||||
end
|
||||
if decal_has_been_placed == false then
|
||||
local r = math.random(1,950)
|
||||
if r == 1 then
|
||||
table.insert(decoratives, {name="green-small-grass", position={pos_x,pos_y}, amount=1})
|
||||
table.insert(decoratives, {name="green-small-grass-1", position={pos_x,pos_y}, amount=1})
|
||||
decal_has_been_placed = false
|
||||
end
|
||||
end
|
||||
|
@ -487,3 +487,4 @@ function apply_effect(builder, func)
|
||||
return tile, entity
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -128,43 +128,43 @@ local decorative_options = {
|
||||
{"brown-carpet-grass", 100},
|
||||
{"brown-cane-cluster", 500},
|
||||
},
|
||||
["dirt"] = {
|
||||
["dirt-3"] = {
|
||||
{"brown-carpet-grass", 100},
|
||||
{"brown-cane-cluster", 200},
|
||||
{"red-desert-rock-tiny", 150},
|
||||
{"sand-rock-small", 150},
|
||||
},
|
||||
["dirt-dark"] = {
|
||||
{"red-desert-rock-tiny", 150},
|
||||
["dirt-6"] = {
|
||||
{"sand-rock-small", 150},
|
||||
{"red-asterisk", 45},
|
||||
{"red-desert-bush", 12},
|
||||
{"red-desert-rock-medium", 375},
|
||||
{"rock-medium", 375},
|
||||
|
||||
|
||||
},
|
||||
["grass"] = {
|
||||
{"green-carpet-grass", 3},
|
||||
{"green-hairy-grass", 7},
|
||||
["grass-1"] = {
|
||||
{"green-carpet-grass-1", 3},
|
||||
{"green-hairy-grass-1", 7},
|
||||
{"green-bush-mini", 10},
|
||||
{"green-pita", 6},
|
||||
{"green-small-grass", 12},
|
||||
{"green-small-grass-1", 12},
|
||||
{"green-asterisk", 25},
|
||||
{"green-bush-mini", 7},
|
||||
{"garballo", 20},
|
||||
},
|
||||
["grass-medium"] = {
|
||||
{"green-carpet-grass", 12},
|
||||
{"green-hairy-grass", 28},
|
||||
["grass-3"] = {
|
||||
{"green-carpet-grass-1", 12},
|
||||
{"green-hairy-grass-1", 28},
|
||||
{"green-bush-mini", 40},
|
||||
{"green-pita", 24},
|
||||
{"green-small-grass", 48},
|
||||
{"green-small-grass-1", 48},
|
||||
{"green-asterisk", 100},
|
||||
{"green-bush-mini", 28},
|
||||
},
|
||||
["grass-dry"] = {
|
||||
{"green-hairy-grass", 56},
|
||||
["grass-2"] = {
|
||||
{"green-hairy-grass-1", 56},
|
||||
{"green-bush-mini", 80},
|
||||
{"green-pita", 48},
|
||||
{"green-small-grass", 96},
|
||||
{"green-small-grass-1", 96},
|
||||
{"green-asterisk", 200},
|
||||
{"green-bush-mini", 56},
|
||||
{"brown-cane-cluster", 100},
|
||||
@ -179,26 +179,26 @@ local decorative_options = {
|
||||
{"orange-coral-mini", 45},
|
||||
{"red-asterisk", 45},
|
||||
{"red-desert-bush", 12},
|
||||
{"red-desert-rock-medium", 375},
|
||||
{"red-desert-rock-small", 200},
|
||||
{"red-desert-rock-tiny", 30},
|
||||
{"rock-medium", 375},
|
||||
{"sand-rock-small", 200},
|
||||
{"sand-rock-small", 30},
|
||||
},
|
||||
["red-desert-dark"] = {
|
||||
{"brown-carpet-grass", 70},
|
||||
{"orange-coral-mini", 90},
|
||||
{"red-asterisk", 90},
|
||||
{"red-desert-bush", 35},
|
||||
{"red-desert-rock-medium", 375},
|
||||
{"red-desert-rock-small", 200},
|
||||
{"red-desert-rock-tiny", 150},
|
||||
{"rock-medium", 375},
|
||||
{"sand-rock-small", 200},
|
||||
{"sand-rock-small", 150},
|
||||
},
|
||||
["sand"] = {
|
||||
["sand-1"] = {
|
||||
{"brown-carpet-grass", 35},
|
||||
{"orange-coral-mini", 45},
|
||||
{"red-asterisk", 45},
|
||||
{"brown-asterisk", 45},
|
||||
},
|
||||
["sand-dark"] = {
|
||||
["sand-3"] = {
|
||||
{"brown-carpet-grass", 35},
|
||||
{"orange-coral-mini", 45},
|
||||
{"brown-asterisk", 45},
|
||||
@ -230,29 +230,29 @@ local entity_options = {
|
||||
["deepwater-green"] = {},
|
||||
["water"] = {},
|
||||
["water-green"] = {},
|
||||
["dirt"] = {
|
||||
["dirt-3"] = {
|
||||
{"tree-01", 500},
|
||||
{"tree-06", 300},
|
||||
{"tree-07", 800},
|
||||
{"tree-09", 2000},
|
||||
{"stone-rock", 400},
|
||||
{"rock-big", 400},
|
||||
},
|
||||
["dirt-dark"] = {
|
||||
["dirt-6"] = {
|
||||
{"tree-06", 150},
|
||||
{"tree-07", 400},
|
||||
{"tree-09", 1000},
|
||||
{"stone-rock", 300},
|
||||
{"rock-big", 300},
|
||||
},
|
||||
["grass"] = {
|
||||
["grass-1"] = {
|
||||
{"tree-01", 150},
|
||||
{"tree-04", 400},
|
||||
{"tree-06", 400},
|
||||
{"tree-07", 400},
|
||||
{"tree-09", 1000},
|
||||
{"stone-rock", 400},
|
||||
{"rock-big", 400},
|
||||
{"green-coral", 10000},
|
||||
},
|
||||
["grass-medium"] = {
|
||||
["grass-3"] = {
|
||||
{"tree-02", 400},
|
||||
{"tree-03", 400},
|
||||
{"tree-04", 800},
|
||||
@ -260,15 +260,15 @@ local entity_options = {
|
||||
{"tree-07", 800},
|
||||
{"tree-08", 400},
|
||||
{"tree-09", 2000},
|
||||
{"stone-rock", 400},
|
||||
{"rock-big", 400},
|
||||
},
|
||||
["grass-dry"] = {
|
||||
["grass-2"] = {
|
||||
{"tree-04", 800},
|
||||
{"tree-06", 300},
|
||||
{"tree-07", 400},
|
||||
{"tree-09", 1000},
|
||||
{"dry-tree", 1000},
|
||||
{"stone-rock", 200},
|
||||
{"rock-big", 200},
|
||||
},
|
||||
["hazard-concrete-left"] = {},
|
||||
["hazard-concrete-right"] = {},
|
||||
@ -282,8 +282,8 @@ local entity_options = {
|
||||
{"tree-01", 500},
|
||||
{"tree-02", 500},
|
||||
{"tree-03", 500},
|
||||
{"red-desert-rock-big-01", 200},
|
||||
{"red-desert-rock-huge-01", 400},
|
||||
{"sand-rock-big", 200},
|
||||
{"sand-rock-big", 400},
|
||||
{"red-desert-rock-huge-02", 400},
|
||||
},
|
||||
["red-desert-dark"] = {
|
||||
@ -294,22 +294,22 @@ local entity_options = {
|
||||
{"tree-01", 500},
|
||||
{"tree-02", 500},
|
||||
{"tree-03", 500},
|
||||
{"red-desert-rock-big-01", 200},
|
||||
{"red-desert-rock-huge-01", 400},
|
||||
{"sand-rock-big", 200},
|
||||
{"sand-rock-big", 400},
|
||||
{"red-desert-rock-huge-02", 400},
|
||||
},
|
||||
["sand"] = {
|
||||
["sand-1"] = {
|
||||
{"dry-tree", 1000},
|
||||
{"dry-hairy-tree", 1000},
|
||||
{"dead-tree", 1000},
|
||||
{"stone-rock", 150},
|
||||
{"rock-big", 150},
|
||||
|
||||
},
|
||||
["sand-dark"] = {
|
||||
["sand-3"] = {
|
||||
{"dead-tree", 1000},
|
||||
{"dry-tree", 1000},
|
||||
{"dry-hairy-tree", 1000},
|
||||
{"stone-rock", 150},
|
||||
{"rock-big", 150},
|
||||
|
||||
},
|
||||
["stone-path"] = {},
|
||||
|
@ -12,6 +12,6 @@ map = translate(map, -12, 2)
|
||||
map = scale(map, scale_factor, scale_factor)
|
||||
|
||||
--map = change_tile(map, false, "water")
|
||||
--map = change_map_gen_collision_tile(map, "water-tile", "grass")
|
||||
--map = change_map_gen_collision_tile(map, "water-tile", "grass-1")
|
||||
|
||||
return map
|
@ -90,6 +90,6 @@ local pattern =
|
||||
local map = grid_pattern_builder(pattern, 2, 2, 480,480)
|
||||
map = choose(mediumn_dot, start, map)
|
||||
|
||||
map = change_map_gen_collision_tile(map,"water-tile", "grass")
|
||||
map = change_map_gen_collision_tile(map,"water-tile", "grass-1")
|
||||
|
||||
return map
|
||||
|
@ -17,6 +17,6 @@ local pattern =
|
||||
local map = grid_pattern_builder(pattern, 2, 2, pic.width * scale_factor, pic.height * scale_factor)
|
||||
map = translate(map, 128 * scale_factor, 26 * scale_factor)
|
||||
|
||||
map = change_map_gen_collision_tile(map, "water-tile", "grass")
|
||||
map = change_map_gen_collision_tile(map, "water-tile", "grass-1")
|
||||
|
||||
return map
|
@ -19,8 +19,10 @@ function run_combined_module(event)
|
||||
-- run_island( {area = event.area, surface = event.surface, x = x})
|
||||
end
|
||||
Thread.queue_action("run_island_place_tiles", {surface = event.surface})
|
||||
Thread.queue_action("run_chart_update", {area = event.area, surface = event.surface})
|
||||
end
|
||||
|
||||
|
||||
global.island_tiles_hold = {}
|
||||
global.island_decoratives_hold = {}
|
||||
|
||||
@ -37,6 +39,15 @@ function run_island_place_tiles(params)
|
||||
end
|
||||
end
|
||||
|
||||
function run_chart_update(params)
|
||||
local x = params.area.left_top.x / 32
|
||||
local y = params.area.left_top.y / 32
|
||||
if game.forces.player.is_chunk_charted(params.surface, {x,y} ) then
|
||||
-- Don't use full area, otherwise adjacent chunks get charted
|
||||
game.forces.player.chart(params.surface, {{ params.area.left_top.x, params.area.left_top.y}, { params.area.left_top.x+30, params.area.left_top.y+30} } )
|
||||
end
|
||||
end
|
||||
|
||||
function run_island( params )
|
||||
local area = params.area
|
||||
local surface = params.surface
|
||||
@ -108,31 +119,31 @@ function run_island( params )
|
||||
local b = pos_x * pos_x
|
||||
local tile_distance_to_center = a + b
|
||||
if tile_distance_to_center + noise_island_starting <= radsquare then
|
||||
tile_to_insert = "grass"
|
||||
tile_to_insert = "grass-1"
|
||||
end
|
||||
|
||||
if tile_distance_to_center + noise_island_starting > radsquare + 20000 then
|
||||
--Placement of Island Tiles
|
||||
|
||||
if noise_island_oil_and_uranium > 0.53 then
|
||||
tile_to_insert = "red-desert"
|
||||
tile_to_insert = "red-desert-1"
|
||||
end
|
||||
if noise_island_oil_and_uranium < -0.53 then
|
||||
tile_to_insert = "red-desert-dark"
|
||||
tile_to_insert = "red-desert-0"
|
||||
end
|
||||
|
||||
if noise_island_stone_and_coal > 0.47 then
|
||||
tile_to_insert = "grass-medium"
|
||||
tile_to_insert = "grass-3"
|
||||
end
|
||||
if noise_island_stone_and_coal < -0.47 then
|
||||
tile_to_insert = "grass-dry"
|
||||
tile_to_insert = "grass-2"
|
||||
end
|
||||
|
||||
if noise_island_iron_and_copper > 0.47 then
|
||||
tile_to_insert = "sand"
|
||||
tile_to_insert = "sand-1"
|
||||
end
|
||||
if noise_island_iron_and_copper < -0.47 then
|
||||
tile_to_insert = "sand-dark"
|
||||
tile_to_insert = "sand-3"
|
||||
end
|
||||
|
||||
end
|
||||
@ -141,29 +152,29 @@ function run_island( params )
|
||||
if tile_to_insert ~= "water" then
|
||||
if noise_trees > 0.1 then
|
||||
local tree = "tree-01"
|
||||
if tile_to_insert == "grass" then
|
||||
if tile_to_insert == "grass-1" then
|
||||
tree = "tree-05"
|
||||
end
|
||||
if tile_to_insert == "grass-dry" then
|
||||
if tile_to_insert == "grass-2" then
|
||||
tree = "tree-02"
|
||||
end
|
||||
if tile_to_insert == "grass-medium" then
|
||||
if tile_to_insert == "grass-3" then
|
||||
tree = "tree-04"
|
||||
end
|
||||
if tile_to_insert == "sand" then
|
||||
if tile_to_insert == "sand-1" then
|
||||
tree = "tree-07"
|
||||
end
|
||||
if tile_to_insert == "sand-dark" then
|
||||
if tile_to_insert == "sand-3" then
|
||||
tree = "dry-hairy-tree"
|
||||
end
|
||||
if tile_to_insert == "red-desert" then
|
||||
if tile_to_insert == "red-desert-1" then
|
||||
tree = "dry-tree"
|
||||
end
|
||||
if tile_to_insert == "red-desert-dark" then
|
||||
if tile_to_insert == "red-desert-0" then
|
||||
if math.random(1,3) == 1 then
|
||||
tree = "red-desert-rock-huge-01"
|
||||
tree = "sand-rock-big"
|
||||
else
|
||||
tree = "red-desert-rock-big-01"
|
||||
tree = "sand-rock-big"
|
||||
end
|
||||
end
|
||||
if math.random(1,8) == 1 then
|
||||
@ -174,17 +185,17 @@ function run_island( params )
|
||||
end
|
||||
end
|
||||
|
||||
if tile_to_insert == "sand" or tile_to_insert == "sand-dark" then
|
||||
if tile_to_insert == "sand-1" or tile_to_insert == "sand-3" then
|
||||
if math.random(1,200) == 1 then
|
||||
if surface.can_place_entity {name="stone-rock", position={pos_x,pos_y}} then
|
||||
surface.create_entity {name="stone-rock", position={pos_x,pos_y}}
|
||||
if surface.can_place_entity {name="rock-big", position={pos_x,pos_y}} then
|
||||
surface.create_entity {name="rock-big", position={pos_x,pos_y}}
|
||||
end
|
||||
end
|
||||
end
|
||||
if tile_to_insert == "grass" or tile_to_insert == "grass-dry" or tile_to_insert == "grass-medium" then
|
||||
if tile_to_insert == "grass-1" or tile_to_insert == "grass-2" or tile_to_insert == "grass-3" then
|
||||
if math.random(1,2000) == 1 then
|
||||
if surface.can_place_entity {name="stone-rock", position={pos_x,pos_y}} then
|
||||
surface.create_entity {name="stone-rock", position={pos_x,pos_y}}
|
||||
if surface.can_place_entity {name="rock-big", position={pos_x,pos_y}} then
|
||||
surface.create_entity {name="rock-big", position={pos_x,pos_y}}
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -192,35 +203,35 @@ function run_island( params )
|
||||
--Placement of Decoratives
|
||||
if tile_to_insert ~= "water" then
|
||||
if noise_decoratives > 0.3 then
|
||||
local decorative = "green-carpet-grass"
|
||||
if tile_to_insert == "grass" then
|
||||
local decorative = "green-carpet-grass-1"
|
||||
if tile_to_insert == "grass-1" then
|
||||
decorative = "green-pita"
|
||||
end
|
||||
if tile_to_insert == "grass-dry" then
|
||||
if tile_to_insert == "grass-2" then
|
||||
decorative = "green-pita"
|
||||
end
|
||||
if tile_to_insert == "grass-medium" then
|
||||
if tile_to_insert == "grass-3" then
|
||||
decorative = "green-pita"
|
||||
end
|
||||
if tile_to_insert == "sand" then
|
||||
if tile_to_insert == "sand-1" then
|
||||
decorative = "green-asterisk"
|
||||
end
|
||||
if tile_to_insert == "sand-dark" then
|
||||
if tile_to_insert == "sand-3" then
|
||||
decorative = "green-asterisk"
|
||||
end
|
||||
if tile_to_insert == "red-desert" then
|
||||
if tile_to_insert == "red-desert-1" then
|
||||
decorative = "red-asterisk"
|
||||
end
|
||||
if tile_to_insert == "red-desert-dark" then
|
||||
if tile_to_insert == "red-desert-0" then
|
||||
decorative = "red-asterisk"
|
||||
end
|
||||
if math.random(1,5) == 1 then
|
||||
table.insert(global.island_decoratives_hold, {name=decorative, position={pos_x,pos_y}, amount=1})
|
||||
end
|
||||
end
|
||||
if tile_to_insert == "red-desert-dark" then
|
||||
if tile_to_insert == "red-desert-0" then
|
||||
if math.random(1,50) == 1 then
|
||||
table.insert(global.island_decoratives_hold, {name="red-desert-rock-medium", position={pos_x,pos_y}, amount=1})
|
||||
table.insert(global.island_decoratives_hold, {name="rock-medium", position={pos_x,pos_y}, amount=1})
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -237,7 +248,7 @@ function run_island( params )
|
||||
local noise_resource_amount_modifier = perlin:noise(((pos_x+seed)/200),((pos_y+seed)/200),0)
|
||||
local resource_amount = 1 + ((500 + (500*noise_resource_amount_modifier*0.2)) * resource_amount_distance_multiplicator)
|
||||
|
||||
if tile_to_insert == "sand" or tile_to_insert == "sand-dark" then
|
||||
if tile_to_insert == "sand-1" or tile_to_insert == "sand-3" then
|
||||
if noise_island_iron_and_copper > 0.5 and noise_island_resource > 0.2 then
|
||||
if surface.can_place_entity {name="iron-ore", position={pos_x,pos_y}} then
|
||||
surface.create_entity {name="iron-ore", position={pos_x,pos_y}, amount=resource_amount}
|
||||
@ -250,7 +261,7 @@ function run_island( params )
|
||||
end
|
||||
end
|
||||
|
||||
if tile_to_insert == "grass-medium" or tile_to_insert == "grass-dry" then
|
||||
if tile_to_insert == "grass-3" or tile_to_insert == "grass-2" then
|
||||
if noise_island_stone_and_coal > 0.5 and noise_island_resource > 0.2 then
|
||||
if surface.can_place_entity {name="stone", position={pos_x,pos_y}} then
|
||||
surface.create_entity {name="stone", position={pos_x,pos_y}, amount=resource_amount*1.5}
|
||||
@ -263,7 +274,7 @@ function run_island( params )
|
||||
end
|
||||
end
|
||||
|
||||
if tile_to_insert == "red-desert" or tile_to_insert == "red-desert-dark" then
|
||||
if tile_to_insert == "red-desert-1" or tile_to_insert == "red-desert-0" then
|
||||
if noise_island_oil_and_uranium > 0.55 and noise_island_resource > 0.25 then
|
||||
if surface.can_place_entity {name="crude-oil", position={pos_x,pos_y}} then
|
||||
if math.random(1,60) == 1 then
|
||||
|
@ -1,539 +0,0 @@
|
||||
--Author: MewMew
|
||||
|
||||
-- !! ATTENTION !!
|
||||
-- Use water only in starting area as map setting!!!
|
||||
|
||||
require "locale.gen_shared.perlin_noise"
|
||||
|
||||
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}}
|
||||
|
||||
|
||||
local function place_entities(surface, entity_list)
|
||||
local directions = {defines.direction.north, defines.direction.east, defines.direction.south, defines.direction.west}
|
||||
for _, entity in pairs(entity_list) do
|
||||
local r = math.random(1,entity.chance)
|
||||
if r == 1 then
|
||||
if not entity.force then entity.force = "player" end
|
||||
local r = math.random(1,4)
|
||||
if surface.can_place_entity {name=entity.name, position=entity.pos, direction=directions[r], force=entity.force} then
|
||||
local e = surface.create_entity {name=entity.name, position=entity.pos, direction=directions[r], force=entity.force}
|
||||
if entity.health then
|
||||
if entity.health == "low" then e.health = ((e.health / 1000) * math.random(33,330)) end
|
||||
if entity.health == "medium" then e.health = ((e.health / 1000) * math.random(333,666)) end
|
||||
if entity.health == "high" then e.health = ((e.health / 1000) * math.random(666,999)) end
|
||||
if entity.health == "random" then e.health = ((e.health / 1000) * math.random(1,1000)) end
|
||||
end
|
||||
return true, e
|
||||
end
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
local function auto_place_entity_around_target(entity, scan_radius, mode, density, surface)
|
||||
local x = entity.pos.x
|
||||
local y = entity.pos.y
|
||||
if not surface then surface = game.surfaces[1] end
|
||||
if not scan_radius then scan_radius = 6 end
|
||||
if not entity then return end
|
||||
if not mode then mode = "ball" end
|
||||
if not density then density = 1 end
|
||||
|
||||
if surface.can_place_entity {name=entity.name, position={x,y}} then
|
||||
local e = surface.create_entity {name=entity.name, position={x,y}}
|
||||
return true, e
|
||||
end
|
||||
|
||||
local i = 2
|
||||
local r = 1
|
||||
|
||||
if mode == "ball" then
|
||||
if math.random(1,2) == 1 then
|
||||
density = density * -1
|
||||
end
|
||||
r = math.random(1,4)
|
||||
end
|
||||
if mode == "line" then
|
||||
density = 1
|
||||
r = math.random(1,4)
|
||||
end
|
||||
if mode == "line_down" then
|
||||
density = density * -1
|
||||
r = math.random(1,4)
|
||||
end
|
||||
if mode == "line_up" then
|
||||
density = 1
|
||||
r = math.random(1,4)
|
||||
end
|
||||
if mode == "block" then
|
||||
r = 1
|
||||
density = 1
|
||||
end
|
||||
|
||||
if r == 1 then
|
||||
--start placing at -1,-1
|
||||
while i <= scan_radius do
|
||||
y = y - density
|
||||
x = x - density
|
||||
for a = 1, i, 1 do
|
||||
if surface.can_place_entity {name=entity.name, position={x,y}} then
|
||||
local e = surface.create_entity {name=entity.name, position={x,y}}
|
||||
return true, e
|
||||
end
|
||||
x = x + density
|
||||
end
|
||||
for a = 1, i, 1 do
|
||||
if surface.can_place_entity {name=entity.name, position={x,y}} then
|
||||
local e = surface.create_entity {name=entity.name, position={x,y}}
|
||||
return true, e
|
||||
end
|
||||
y = y + density
|
||||
end
|
||||
for a = 1, i, 1 do
|
||||
if surface.can_place_entity {name=entity.name, position={x,y}} then
|
||||
local e = surface.create_entity {name=entity.name, position={x,y}}
|
||||
return true, e
|
||||
end
|
||||
x = x - density
|
||||
end
|
||||
for a = 1, i, 1 do
|
||||
if surface.can_place_entity {name=entity.name, position={x,y}} then
|
||||
local e = surface.create_entity {name=entity.name, position={x,y}}
|
||||
return true, e
|
||||
end
|
||||
y = y - density
|
||||
end
|
||||
i = i + 2
|
||||
end
|
||||
end
|
||||
|
||||
if r == 2 then
|
||||
--start placing at 0,-1
|
||||
while i <= scan_radius do
|
||||
y = y - density
|
||||
x = x - density
|
||||
for a = 1, i, 1 do
|
||||
x = x + density
|
||||
if surface.can_place_entity {name=entity.name, position={x,y}} then
|
||||
local e = surface.create_entity {name=entity.name, position={x,y}}
|
||||
return true, e
|
||||
end
|
||||
end
|
||||
for a = 1, i, 1 do
|
||||
y = y + density
|
||||
if surface.can_place_entity {name=entity.name, position={x,y}} then
|
||||
local e = surface.create_entity {name=entity.name, position={x,y}}
|
||||
return true, e
|
||||
end
|
||||
end
|
||||
for a = 1, i, 1 do
|
||||
x = x - density
|
||||
if surface.can_place_entity {name=entity.name, position={x,y}} then
|
||||
local e = surface.create_entity {name=entity.name, position={x,y}}
|
||||
return true, e
|
||||
end
|
||||
end
|
||||
for a = 1, i, 1 do
|
||||
y = y - density
|
||||
if surface.can_place_entity {name=entity.name, position={x,y}} then
|
||||
local e = surface.create_entity {name=entity.name, position={x,y}}
|
||||
return true, e
|
||||
end
|
||||
end
|
||||
i = i + 2
|
||||
end
|
||||
end
|
||||
|
||||
if r == 3 then
|
||||
--start placing at 1,-1
|
||||
while i <= scan_radius do
|
||||
y = y - density
|
||||
x = x + density
|
||||
for a = 1, i, 1 do
|
||||
if surface.can_place_entity {name=entity.name, position={x,y}} then
|
||||
local e = surface.create_entity {name=entity.name, position={x,y}}
|
||||
return true, e
|
||||
end
|
||||
y = y + density
|
||||
end
|
||||
for a = 1, i, 1 do
|
||||
if surface.can_place_entity {name=entity.name, position={x,y}} then
|
||||
local e = surface.create_entity {name=entity.name, position={x,y}}
|
||||
return true, e
|
||||
end
|
||||
x = x - density
|
||||
end
|
||||
for a = 1, i, 1 do
|
||||
if surface.can_place_entity {name=entity.name, position={x,y}} then
|
||||
local e = surface.create_entity {name=entity.name, position={x,y}}
|
||||
return true, e
|
||||
end
|
||||
y = y - density
|
||||
end
|
||||
for a = 1, i, 1 do
|
||||
if surface.can_place_entity {name=entity.name, position={x,y}} then
|
||||
local e = surface.create_entity {name=entity.name, position={x,y}}
|
||||
return true, e
|
||||
end
|
||||
x = x + density
|
||||
end
|
||||
i = i + 2
|
||||
end
|
||||
end
|
||||
|
||||
if r == 4 then
|
||||
--start placing at 1,0
|
||||
while i <= scan_radius do
|
||||
y = y - density
|
||||
x = x + density
|
||||
for a = 1, i, 1 do
|
||||
y = y + density
|
||||
if surface.can_place_entity {name=entity.name, position={x,y}} then
|
||||
local e = surface.create_entity {name=entity.name, position={x,y}}
|
||||
return true, e
|
||||
end
|
||||
end
|
||||
for a = 1, i, 1 do
|
||||
x = x - density
|
||||
if surface.can_place_entity {name=entity.name, position={x,y}} then
|
||||
local e = surface.create_entity {name=entity.name, position={x,y}}
|
||||
return true, e
|
||||
end
|
||||
end
|
||||
for a = 1, i, 1 do
|
||||
y = y - density
|
||||
if surface.can_place_entity {name=entity.name, position={x,y}} then
|
||||
local e = surface.create_entity {name=entity.name, position={x,y}}
|
||||
return true, e
|
||||
end
|
||||
end
|
||||
for a = 1, i, 1 do
|
||||
x = x + density
|
||||
if surface.can_place_entity {name=entity.name, position={x,y}} then
|
||||
local e = surface.create_entity {name=entity.name, position={x,y}}
|
||||
return true, e
|
||||
end
|
||||
end
|
||||
i = i + 2
|
||||
end
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
function run_combined_module(event)
|
||||
if not global.perlin_noise_seed then global.perlin_noise_seed = math.random(1000,1000000) end
|
||||
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)
|
||||
for _, entity in pairs(entities) do
|
||||
if entity.type == "simple-entity" or entity.type == "resource" or entity.type == "tree" then
|
||||
entity.destroy()
|
||||
end
|
||||
end
|
||||
|
||||
for x = 0, 31, 1 do
|
||||
for y = 0, 31, 1 do
|
||||
local pos_x = event.area.left_top.x + x
|
||||
local pos_y = event.area.left_top.y + y
|
||||
local tile = surface.get_tile(pos_x,pos_y)
|
||||
local tile_to_insert = "concrete"
|
||||
|
||||
local a = pos_x
|
||||
local b = pos_y
|
||||
local c = 1
|
||||
if event.area.right_bottom.x < 0 then a = event.area.right_bottom.x * -1 end
|
||||
if event.area.right_bottom.y < 0 then b = event.area.right_bottom.y * -1 end
|
||||
if a > b then c = a else c = b end
|
||||
local resource_amount_distance_multiplicator = (((c + 1) / 75) / 75) + 1
|
||||
local resource_entity_placed = false
|
||||
|
||||
local entity_list = {}
|
||||
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"})
|
||||
table.insert(entity_list, {name="big-ship-wreck-3", pos={pos_x,pos_y},chance = 65000, health="random"})
|
||||
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"})
|
||||
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"})
|
||||
table.insert(entity_list, {name="nuclear-reactor", pos={pos_x,pos_y},chance = 1000000, force="enemy", health="medium"})
|
||||
local b, placed_entity = place_entities(surface, entity_list)
|
||||
if b == true then
|
||||
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
|
||||
placed_entity.insert(wreck_item_pool[math.random(1,#wreck_item_pool)])
|
||||
placed_entity.insert(wreck_item_pool[math.random(1,#wreck_item_pool)])
|
||||
placed_entity.insert(wreck_item_pool[math.random(1,#wreck_item_pool)])
|
||||
end
|
||||
end
|
||||
|
||||
local seed_increment_number = 10000
|
||||
local seed = global.perlin_noise_seed
|
||||
|
||||
local noise_terrain_1 = perlin:noise(((pos_x+seed)/400),((pos_y+seed)/400),0)
|
||||
noise_terrain_1 = noise_terrain_1 * 100
|
||||
seed = seed + seed_increment_number
|
||||
local noise_terrain_2 = perlin:noise(((pos_x+seed)/250),((pos_y+seed)/250),0)
|
||||
noise_terrain_2 = noise_terrain_2 * 100
|
||||
seed = seed + seed_increment_number
|
||||
local noise_terrain_3 = perlin:noise(((pos_x+seed)/100),((pos_y+seed)/100),0)
|
||||
noise_terrain_3 = noise_terrain_3 * 50
|
||||
seed = seed + seed_increment_number
|
||||
local noise_terrain_4 = perlin:noise(((pos_x+seed)/20),((pos_y+seed)/20),0)
|
||||
noise_terrain_4 = noise_terrain_4 * 10
|
||||
seed = seed + seed_increment_number
|
||||
local noise_terrain_5 = perlin:noise(((pos_x+seed)/5),((pos_y+seed)/5),0)
|
||||
noise_terrain_5 = noise_terrain_5 * 4
|
||||
seed = seed + seed_increment_number
|
||||
local noise_sand = perlin:noise(((pos_x+seed)/18),((pos_y+seed)/18),0)
|
||||
noise_sand = noise_sand * 10
|
||||
|
||||
--DECORATIVES
|
||||
seed = seed + seed_increment_number
|
||||
local noise_decoratives_1 = perlin:noise(((pos_x+seed)/20),((pos_y+seed)/20),0)
|
||||
noise_decoratives_1 = noise_decoratives_1
|
||||
seed = seed + seed_increment_number
|
||||
local noise_decoratives_2 = perlin:noise(((pos_x+seed)/30),((pos_y+seed)/30),0)
|
||||
noise_decoratives_2 = noise_decoratives_2
|
||||
seed = seed + seed_increment_number
|
||||
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_water_1 = perlin:noise(((pos_x+seed)/250),((pos_y+seed)/300),0)
|
||||
noise_water_1 = noise_water_1 * 100
|
||||
seed = seed + seed_increment_number
|
||||
local noise_water_2 = perlin:noise(((pos_x+seed)/100),((pos_y+seed)/150),0)
|
||||
noise_water_2 = noise_water_2 * 50
|
||||
|
||||
--RESOURCES
|
||||
seed = seed + seed_increment_number
|
||||
local noise_resources = perlin:noise(((pos_x+seed)/100),((pos_y+seed)/100),0)
|
||||
seed = seed + seed_increment_number
|
||||
local noise_resources_2 = perlin:noise(((pos_x+seed)/40),((pos_y+seed)/40),0)
|
||||
seed = seed + seed_increment_number
|
||||
local noise_resources_3 = perlin:noise(((pos_x+seed)/20),((pos_y+seed)/20),0)
|
||||
noise_resources = noise_resources * 50 + noise_resources_2 * 20 + noise_resources_3 * 20
|
||||
noise_resources = noise_resources_2 * 100
|
||||
|
||||
seed = seed + seed_increment_number
|
||||
local noise_resource_amount_modifier = perlin:noise(((pos_x+seed)/200),((pos_y+seed)/200),0)
|
||||
local resource_amount = 1 + ((400 + (400*noise_resource_amount_modifier*0.2)) * resource_amount_distance_multiplicator)
|
||||
seed = seed + seed_increment_number
|
||||
local noise_resources_iron_and_copper = perlin:noise(((pos_x+seed)/250),((pos_y+seed)/250),0)
|
||||
noise_resources_iron_and_copper = noise_resources_iron_and_copper * 100
|
||||
seed = seed + seed_increment_number
|
||||
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
|
||||
seed = seed + seed_increment_number
|
||||
local noise_resources_stone_and_oil = perlin:noise(((pos_x+seed)/150),((pos_y+seed)/150),0)
|
||||
noise_resources_stone_and_oil = noise_resources_stone_and_oil * 100
|
||||
|
||||
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
|
||||
local noise_red_desert_rocks_2 = perlin:noise(((pos_x+seed)/10),((pos_y+seed)/10),0)
|
||||
noise_red_desert_rocks_2 = noise_red_desert_rocks_2 * 50
|
||||
seed = seed + seed_increment_number
|
||||
local noise_red_desert_rocks_3 = perlin:noise(((pos_x+seed)/5),((pos_y+seed)/5),0)
|
||||
noise_red_desert_rocks_3 = noise_red_desert_rocks_3 * 100
|
||||
seed = seed + seed_increment_number
|
||||
local noise_forest = perlin:noise(((pos_x+seed)/100),((pos_y+seed)/100),0)
|
||||
noise_forest = noise_forest * 100
|
||||
seed = seed + seed_increment_number
|
||||
local noise_forest_2 = perlin:noise(((pos_x+seed)/20),((pos_y+seed)/20),0)
|
||||
noise_forest_2 = noise_forest_2 * 20
|
||||
|
||||
local terrain_smoothing = math.random(0,1)
|
||||
local place_tree_number
|
||||
|
||||
if noise_terrain_1 < 8 + terrain_smoothing + noise_terrain_2 + noise_terrain_3 + noise_terrain_4 then
|
||||
tile_to_insert = "red-desert"
|
||||
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
|
||||
tile_to_insert = "sand"
|
||||
place_tree_number = math.random(3,#tree_to_place)
|
||||
else
|
||||
place_tree_number = math.random(1,(#tree_to_place - 3))
|
||||
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
|
||||
tile_to_insert = "water"
|
||||
local a = pos_x + 1
|
||||
table.insert(tiles, {name = tile_to_insert, position = {a,pos_y}})
|
||||
local a = pos_y + 1
|
||||
table.insert(tiles, {name = tile_to_insert, position = {pos_x,a}})
|
||||
local a = pos_x - 1
|
||||
table.insert(tiles, {name = tile_to_insert, position = {a,pos_y}})
|
||||
local a = pos_y - 1
|
||||
table.insert(tiles, {name = tile_to_insert, position = {pos_x,a}})
|
||||
if noise_water_1 + noise_water_2 < 2 or noise_water_1 + noise_water_2 > 13 then
|
||||
if math.random(1,15) == 1 then
|
||||
table.insert(decoratives, {name="green-carpet-grass", position={pos_x,pos_y}, amount=1})
|
||||
end
|
||||
if math.random(1,15) == 1 then
|
||||
table.insert(decoratives, {name="brown-cane-cluster", position={pos_x,pos_y}, amount=1})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if tile_to_insert ~= "water" then
|
||||
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
|
||||
if math.random(1,35) == 1 then
|
||||
table.insert(decoratives, {name="brown-carpet-grass", position={pos_x,pos_y}, amount=1})
|
||||
end
|
||||
end
|
||||
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
|
||||
if math.random(1,35) == 1 then
|
||||
table.insert(decoratives, {name="brown-carpet-grass", position={pos_x,pos_y}, amount=1})
|
||||
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
|
||||
end
|
||||
if noise_decoratives_1 > 0.4 and noise_decoratives_1 <= 0.5 then
|
||||
if math.random(1,4) == 1 then table.insert(decoratives, {name="red-desert-bush", position={pos_x,pos_y}, amount=1}) end
|
||||
end
|
||||
end
|
||||
|
||||
--HAPPY TREES
|
||||
if noise_terrain_1 < -30 + noise_terrain_2 + noise_terrain_3 + noise_terrain_5 + noise_forest_2 then
|
||||
if noise_forest > 0 and noise_forest <= 10 then
|
||||
if math.random(1,50) == 1 then
|
||||
if surface.can_place_entity {name=tree_to_place[place_tree_number], position={pos_x,pos_y}} then
|
||||
surface.create_entity {name=tree_to_place[place_tree_number], position={pos_x,pos_y}}
|
||||
end
|
||||
end
|
||||
end
|
||||
if noise_forest > 10 and noise_forest <= 20 then
|
||||
if math.random(1,25) == 1 then
|
||||
if surface.can_place_entity {name=tree_to_place[place_tree_number], position={pos_x,pos_y}} then
|
||||
surface.create_entity {name=tree_to_place[place_tree_number], position={pos_x,pos_y}}
|
||||
end
|
||||
end
|
||||
end
|
||||
if noise_forest > 20 then
|
||||
if math.random(1,10) == 1 then
|
||||
if surface.can_place_entity {name=tree_to_place[place_tree_number], position={pos_x,pos_y}} then
|
||||
surface.create_entity {name=tree_to_place[place_tree_number], position={pos_x,pos_y}}
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if tile_to_insert ~= "water" 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
|
||||
if math.random(1,45) == 1 then
|
||||
table.insert(decoratives, {name="red-desert-rock-medium", position={pos_x,pos_y}, amount=1})
|
||||
end
|
||||
if math.random(1,20) == 1 then
|
||||
table.insert(decoratives, {name="red-desert-rock-tiny", position={pos_x,pos_y}, amount=1})
|
||||
end
|
||||
else
|
||||
if math.random(1,375) == 1 then
|
||||
table.insert(decoratives, {name="red-desert-rock-medium", position={pos_x,pos_y}, amount=1})
|
||||
end
|
||||
if math.random(1,45) == 1 then
|
||||
table.insert(decoratives, {name="red-desert-rock-tiny", position={pos_x,pos_y}, amount=1})
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
tile_to_insert = "red-desert-dark"
|
||||
end
|
||||
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
|
||||
if surface.can_place_entity {name="uranium-ore", position={pos_x,pos_y}} then
|
||||
surface.create_entity {name="uranium-ore", position={pos_x,pos_y}, amount=resource_amount}
|
||||
resource_entity_placed = true
|
||||
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 surface.can_place_entity {name="iron-ore", position={pos_x,pos_y}} then
|
||||
surface.create_entity {name="iron-ore", position={pos_x,pos_y}, amount=resource_amount}
|
||||
resource_entity_placed = true
|
||||
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 surface.can_place_entity {name="coal", position={pos_x,pos_y}} then
|
||||
surface.create_entity {name="coal", position={pos_x,pos_y}, amount=resource_amount}
|
||||
resource_entity_placed = true
|
||||
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 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}
|
||||
resource_entity_placed = true
|
||||
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 surface.can_place_entity {name="stone", position={pos_x,pos_y}} then
|
||||
surface.create_entity {name="stone", position={pos_x,pos_y}, amount=resource_amount}
|
||||
resource_entity_placed = true
|
||||
end
|
||||
end
|
||||
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
|
||||
if math.random(1,42) == 1 then
|
||||
if surface.can_place_entity {name="crude-oil", position={pos_x,pos_y}} then
|
||||
surface.create_entity {name="crude-oil", position={pos_x,pos_y}, amount=(resource_amount*500)}
|
||||
resource_entity_placed = true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
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 math.random(1,3) == 1 then
|
||||
if math.random(1,3) == 1 then
|
||||
if surface.can_place_entity {name="red-desert-rock-huge-01", position={pos_x,pos_y}} then
|
||||
surface.create_entity {name="red-desert-rock-huge-01", position={pos_x,pos_y}}
|
||||
end
|
||||
else
|
||||
if surface.can_place_entity {name="red-desert-rock-big-01", position={pos_x,pos_y}} then
|
||||
surface.create_entity {name="red-desert-rock-big-01", position={pos_x,pos_y}}
|
||||
end
|
||||
end
|
||||
end
|
||||
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
|
||||
if math.random(1,5) == 1 then
|
||||
table.insert(decoratives, {name="red-desert-rock-medium", position={pos_x,pos_y}, amount=1})
|
||||
end
|
||||
else
|
||||
if tile_to_insert ~= "water" and tile_to_insert ~= "sand" then
|
||||
if math.random(1,15) == 1 then
|
||||
table.insert(decoratives, {name="red-desert-rock-small", position={pos_x,pos_y}, amount=1})
|
||||
else
|
||||
if math.random(1,8) == 1 then
|
||||
table.insert(decoratives, {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(decoratives, {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(decoratives, {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(decoratives, {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(decoratives, {name="brown-fluff-dry", position={pos_x,pos_y}, amount=1}) end
|
||||
end
|
||||
end
|
||||
end
|
||||
table.insert(tiles, {name = tile_to_insert, position = {pos_x,pos_y}})
|
||||
end
|
||||
end
|
||||
|
||||
surface.set_tiles(tiles,true)
|
||||
for _,deco in pairs(decoratives) do
|
||||
surface.create_decoratives{check_collision=false, decoratives={deco}}
|
||||
end
|
||||
end
|
@ -192,9 +192,9 @@ function run_planet( params )
|
||||
local place_tree_number
|
||||
|
||||
if noise_terrain_1 < 8 + terrain_smoothing + noise_terrain_2 + noise_terrain_3 + noise_terrain_4 then
|
||||
tile_to_insert = "red-desert"
|
||||
tile_to_insert = "red-desert-1"
|
||||
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
|
||||
tile_to_insert = "sand"
|
||||
tile_to_insert = "sand-1"
|
||||
place_tree_number = math.random(3,#tree_to_place)
|
||||
else
|
||||
place_tree_number = math.random(1,(#tree_to_place - 3))
|
||||
@ -214,9 +214,6 @@ function run_planet( params )
|
||||
if math.random(1,15) == 1 then
|
||||
table.insert(global.planet_decoratives_hold, {name="green-carpet-grass", position={pos_x,pos_y}, amount=1})
|
||||
end
|
||||
if math.random(1,15) == 1 then
|
||||
table.insert(global.planet_decoratives_hold, {name="brown-cane-cluster", position={pos_x,pos_y}, amount=1})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -267,22 +264,22 @@ function run_planet( params )
|
||||
if tile_to_insert ~= "water" 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
|
||||
if math.random(1,180) == 1 then
|
||||
table.insert(global.planet_decoratives_hold, {name="red-desert-rock-medium", position={pos_x,pos_y}, amount=1})
|
||||
table.insert(global.planet_decoratives_hold, {name="rock-medium", position={pos_x,pos_y}, amount=1})
|
||||
end
|
||||
if math.random(1,80) == 1 then
|
||||
table.insert(global.planet_decoratives_hold, {name="red-desert-rock-tiny", position={pos_x,pos_y}, amount=1})
|
||||
table.insert(global.planet_decoratives_hold, {name="sand-rock-small", position={pos_x,pos_y}, amount=1})
|
||||
end
|
||||
else
|
||||
if math.random(1,1500) == 1 then
|
||||
table.insert(global.planet_decoratives_hold, {name="red-desert-rock-medium", position={pos_x,pos_y}, amount=1})
|
||||
table.insert(global.planet_decoratives_hold, {name="rock-medium", position={pos_x,pos_y}, amount=1})
|
||||
end
|
||||
if math.random(1,180) == 1 then
|
||||
table.insert(global.planet_decoratives_hold, {name="red-desert-rock-tiny", position={pos_x,pos_y}, amount=1})
|
||||
table.insert(global.planet_decoratives_hold, {name="sand-rock-small", position={pos_x,pos_y}, amount=1})
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
tile_to_insert = "red-desert-dark"
|
||||
tile_to_insert = "red-desert-0"
|
||||
end
|
||||
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
|
||||
if surface.can_place_entity {name="uranium-ore", position={pos_x,pos_y}} then
|
||||
@ -326,12 +323,12 @@ function run_planet( params )
|
||||
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 math.random(1,3) == 1 then
|
||||
if math.random(1,3) == 1 then
|
||||
if surface.can_place_entity {name="red-desert-rock-huge-01", position={pos_x,pos_y}} then
|
||||
surface.create_entity {name="red-desert-rock-huge-01", position={pos_x,pos_y}}
|
||||
if surface.can_place_entity {name="sand-rock-big", position={pos_x,pos_y}} then
|
||||
surface.create_entity {name="sand-rock-big", position={pos_x,pos_y}}
|
||||
end
|
||||
else
|
||||
if surface.can_place_entity {name="red-desert-rock-big-01", position={pos_x,pos_y}} then
|
||||
surface.create_entity {name="red-desert-rock-big-01", position={pos_x,pos_y}}
|
||||
if surface.can_place_entity {name="sand-rock-big", position={pos_x,pos_y}} then
|
||||
surface.create_entity {name="sand-rock-big", position={pos_x,pos_y}}
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -339,15 +336,15 @@ function run_planet( params )
|
||||
|
||||
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
|
||||
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})
|
||||
table.insert(global.planet_decoratives_hold, {name="rock-medium", position={pos_x,pos_y}, amount=1})
|
||||
end
|
||||
else
|
||||
if tile_to_insert ~= "water" and tile_to_insert ~= "sand" then
|
||||
if tile_to_insert ~= "water" and tile_to_insert ~= "sand-1" 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})
|
||||
table.insert(global.planet_decoratives_hold, {name="sand-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})
|
||||
table.insert(global.planet_decoratives_hold, {name="sand-rock-small", position={pos_x,pos_y}, amount=1})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -245,9 +245,9 @@ function create_rock_cluster(pos, amount)
|
||||
entity.pos = pos
|
||||
for i = 1, amount, 1 do
|
||||
if 1 == math.random(1,3) then
|
||||
entity.name = "red-desert-rock-huge-01"
|
||||
entity.name = "sand-rock-big"
|
||||
else
|
||||
entity.name = "red-desert-rock-big-01"
|
||||
entity.name = "sand-rock-big"
|
||||
end
|
||||
local b, e = auto_place_entity_around_target(entity, scan_radius, mode)
|
||||
if b == true then
|
||||
@ -531,5 +531,5 @@ function create_tile_cluster(tilename,position,amount)
|
||||
end
|
||||
if b == false then return false,x,y end
|
||||
if i >= amount then return true,x,y end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -41,7 +41,7 @@ function run_terrain_module(event)
|
||||
|
||||
if tile.name ~= "out-of-map" then
|
||||
|
||||
local tile_to_insert = "grass-medium"
|
||||
local tile_to_insert = "grass-3"
|
||||
|
||||
local wiggle = 50 + perlin:noise((x*0.005),(y*0.005),global.terrain_seed_A + 71) * 60
|
||||
local terrain_A = perlin:noise((x*0.005),(y*0.005),global.terrain_seed_A + 19) * wiggle --For determining where water is
|
||||
@ -67,7 +67,7 @@ function run_terrain_module(event)
|
||||
--table.insert(tileswater, {name = "water", position = {x+1,y+1}})
|
||||
|
||||
else
|
||||
if terrain_D >= 20 then tile_to_insert = "sand" end
|
||||
if terrain_D >= 20 then tile_to_insert = "sand-1" end
|
||||
end
|
||||
elseif terrain_sqr > 70 then
|
||||
wiggle = 100 + perlin:noise((x*0.01),(y*0.01),global.terrain_seed_B + 41) * 60
|
||||
@ -106,9 +106,9 @@ function run_terrain_module(event)
|
||||
if terrain_D < 20 then
|
||||
|
||||
|
||||
if terrain_C < 4 then --we set grass around near forest areas
|
||||
if terrain_C < 4 then --we set grass-1 around near forest areas
|
||||
|
||||
tile_to_insert = "grass"
|
||||
tile_to_insert = "grass-1"
|
||||
|
||||
if terrain_C < -20 and math.random(1,3) == 1 then --dense trees
|
||||
local treenum = math.random(3,7)
|
||||
@ -126,7 +126,7 @@ function run_terrain_module(event)
|
||||
end
|
||||
else
|
||||
if terrain_D < 30 then
|
||||
tile_to_insert = "sand"
|
||||
tile_to_insert = "sand-1"
|
||||
|
||||
if terrain_C < -20 and math.random(1,7) == 1 then --dense trees
|
||||
local treenum = math.random(1,3)
|
||||
@ -141,7 +141,7 @@ function run_terrain_module(event)
|
||||
end
|
||||
|
||||
else
|
||||
tile_to_insert = "sand-dark"
|
||||
tile_to_insert = "sand-3"
|
||||
--if terrain_C > 40 and math.random(1,200) == 1 and surface.can_place_entity {name="crude-oil", position={pos_x,pos_y}} then
|
||||
-- surface.create_entity {name="crude-oil", position={pos_x,pos_y}, amount = math.random(20000,60000) +distance_bonus* 2000 }
|
||||
--end
|
||||
@ -150,17 +150,17 @@ function run_terrain_module(event)
|
||||
|
||||
end
|
||||
|
||||
if math.floor(terrain_D) % 5 == 1 and math.random(1,70) == 1 and surface.can_place_entity {name="stone-rock", position={x,y}} then
|
||||
surface.create_entity {name="stone-rock", position={x,y}}
|
||||
if math.floor(terrain_D) % 5 == 1 and math.random(1,70) == 1 and surface.can_place_entity {name="rock-big", position={x,y}} then
|
||||
surface.create_entity {name="rock-big", position={x,y}}
|
||||
end
|
||||
|
||||
else
|
||||
|
||||
if terrain_D >= 20 then
|
||||
if terrain_D < 30 then
|
||||
tile_to_insert = "sand"
|
||||
tile_to_insert = "sand-1"
|
||||
else
|
||||
tile_to_insert = "sand-dark"
|
||||
tile_to_insert = "sand-3"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -29,7 +29,7 @@ function run_terrain_module(event)
|
||||
|
||||
if tile.name ~= "out-of-map" then
|
||||
|
||||
--local tile_to_insert = "grass-medium"
|
||||
--local tile_to_insert = "grass-3"
|
||||
|
||||
local wiggle = 50 + perlin:noise((x*0.005),(y*0.005),global.terrain_seed_A + 71) * 60
|
||||
local terrain_A = perlin:noise((x*0.005),(y*0.005),global.terrain_seed_A + 19) * wiggle --For determining where water is
|
||||
|
@ -272,4 +272,10 @@ return
|
||||
"the Spanish Inquisition",
|
||||
"an addiction to Cracktorio",
|
||||
"a broken mirror",
|
||||
"a dismembered hooker",
|
||||
"a popped balloon",
|
||||
"a hipster breakfast",
|
||||
"a nintendo cartridge",
|
||||
"a generic greething card",
|
||||
"an empty bottle of barbiturics",
|
||||
}
|
||||
|
@ -24,7 +24,8 @@ local function on_tick()
|
||||
if global.actions_queue[1] then
|
||||
global.actions_queue_n = global.actions_queue_n - 1
|
||||
local callback = global.actions_queue[1]
|
||||
pcall(_G[callback.action], callback.params)
|
||||
local _, err = pcall(_G[callback.action], callback.params)
|
||||
if err then log(err) end
|
||||
table.remove(global.actions_queue, 1)
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user