1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-02-13 13:49:33 +02:00

tree cloning and ore gen tweaks

This commit is contained in:
MewMew 2019-03-18 23:53:27 +01:00
parent 60e5187795
commit 6aaf201088
3 changed files with 11 additions and 14 deletions

View File

@ -39,10 +39,10 @@ require "score"
----------------------------- -----------------------------
---- enable maps here ---- ---- enable maps here ----
--require "maps.biter_battles_v2.biter_battles_v2" require "maps.biter_battles_v2.biter_battles_v2"
--require "maps.biter_battles.biter_battles" --require "maps.biter_battles.biter_battles"
--require "maps.cave_miner" --require "maps.cave_miner"
require "maps.labyrinth" --require "maps.labyrinth"
--require "maps.junkyard" --require "maps.junkyard"
--require "maps.spooky_forest" --require "maps.spooky_forest"
--require "maps.nightfall" --require "maps.nightfall"

View File

@ -52,11 +52,8 @@ local function process_entity(surface, entity)
--local new_pos = {x = entity.position.x * -1, y = (entity.position.y * -1) - 1} --local new_pos = {x = entity.position.x * -1, y = (entity.position.y * -1) - 1}
local new_pos = {x = entity.position.x * -1, y = entity.position.y * -1} local new_pos = {x = entity.position.x * -1, y = entity.position.y * -1}
if entity.type == "tree" then if entity.type == "tree" then
local new_e = {name = entity.name, position = new_pos, graphics_variation = entity.graphics_variation} if not surface.can_place_entity({name = entity.name, position = new_pos}) then return end
if not surface.can_place_entity(new_e) then return end entity.clone({position=new_pos, surface=surface, force="neutral"})
local e = surface.create_entity(new_e)
e.graphics_variation = entity.graphics_variation
--e.tree_color_index = entity.tree_color_index
return return
end end
if entity.type == "simple-entity" then if entity.type == "simple-entity" then

View File

@ -20,11 +20,11 @@ local function get_noise(name, pos)
local noise_seed_add = 25000 local noise_seed_add = 25000
if name == 1 then if name == 1 then
local noise = {} local noise = {}
noise[1] = simplex_noise(pos.x * 0.005, pos.y * 0.005, seed) noise[1] = simplex_noise(pos.x * 0.0042, pos.y * 0.0042, seed)
seed = seed + noise_seed_add seed = seed + noise_seed_add
noise[2] = simplex_noise(pos.x * 0.05, pos.y * 0.05, seed) noise[2] = simplex_noise(pos.x * 0.031, pos.y * 0.031, seed)
seed = seed + noise_seed_add seed = seed + noise_seed_add
local noise = noise[1] + noise[2] * 0.1 local noise = noise[1] + noise[2] * 0.08
return noise return noise
end end
if name == 2 then if name == 2 then
@ -170,14 +170,14 @@ local function rainbow_ore_and_ponds(event)
local pos = {x = left_top_x + x, y = left_top_y + y} local pos = {x = left_top_x + x, y = left_top_y + y}
if surface.can_place_entity({name = "iron-ore", position = pos}) then if surface.can_place_entity({name = "iron-ore", position = pos}) then
local noise = get_noise(1, pos) local noise = get_noise(1, pos)
if noise > 0.81 then if noise > 0.83 then
local amount = math_random(1500, 2000) + math.sqrt(pos.x ^ 2 + pos.y ^ 2) * noise * 4 local amount = math_random(1500, 2000) + math.sqrt(pos.x ^ 2 + pos.y ^ 2) * noise * 4
local i = math.ceil(math.abs(noise * 30)) % 4 local i = math.ceil(math.abs(noise * 60)) % 4
if i == 0 then i = 4 end if i == 0 then i = 4 end
surface.create_entity({name = ores[i], position = pos, amount = amount}) surface.create_entity({name = ores[i], position = pos, amount = amount})
end end
if noise < -0.85 then if noise < -0.86 then
if noise < -0.91 then if noise < -0.92 then
surface.set_tiles({{name = "deepwater", position = pos}}) surface.set_tiles({{name = "deepwater", position = pos}})
else else
surface.set_tiles({{name = "water", position = pos}}) surface.set_tiles({{name = "water", position = pos}})