mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2025-05-13 21:56:29 +02:00
update
This commit is contained in:
parent
8ad24de73b
commit
ecbeecef5f
@ -1,3 +1,5 @@
|
||||
local get_noise = require 'maps.stone_maze.noise'
|
||||
|
||||
local room = {}
|
||||
|
||||
room.empty = function(surface, cell_left_top, direction)
|
||||
@ -160,11 +162,15 @@ end
|
||||
room.tons_of_trees = function(surface, cell_left_top, direction)
|
||||
local tree = tree_raffle[math.random(1, #tree_raffle)]
|
||||
local left_top = {x = cell_left_top.x * grid_size, y = cell_left_top.y * grid_size}
|
||||
local seed = math.random(1000, 1000000)
|
||||
for x = 0.5, grid_size - 0.5, 1 do
|
||||
for y = 0.5, grid_size - 0.5, 1 do
|
||||
local pos = {left_top.x + x, left_top.y + y}
|
||||
if math.random(1,4) == 1 then
|
||||
surface.create_entity({name = tree, position = pos, force = "neutral"})
|
||||
local noise = get_noise("trees_01", pos, seed)
|
||||
if math.random(1,3) == 1 then
|
||||
if noise > 0.25 or noise < -0.25 then
|
||||
surface.create_entity({name = tree, position = pos, force = "neutral"})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -205,24 +211,20 @@ end
|
||||
|
||||
room.tons_of_rocks = function(surface, cell_left_top, direction)
|
||||
local left_top = {x = cell_left_top.x * grid_size, y = cell_left_top.y * grid_size}
|
||||
|
||||
local seed = game.surfaces[1].map_gen_settings.seed
|
||||
for x = 0.5, grid_size - 0.5, 1 do
|
||||
for y = 0.5, grid_size - 0.5, 1 do
|
||||
local pos = {left_top.x + x, left_top.y + y}
|
||||
if math.random(1,4) ~= 1 then
|
||||
surface.create_entity({name = rock_raffle[math.random(1, #rock_raffle)], position = pos, force = "neutral"})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
room.lots_of_rocks = function(surface, cell_left_top, direction)
|
||||
local left_top = {x = cell_left_top.x * grid_size, y = cell_left_top.y * grid_size}
|
||||
for x = 0.5, grid_size - 0.5, 1 do
|
||||
for y = 0.5, grid_size - 0.5, 1 do
|
||||
local pos = {left_top.x + x, left_top.y + y}
|
||||
if math.random(1,2) ~= 1 then
|
||||
surface.create_entity({name = rock_raffle[math.random(1, #rock_raffle)], position = pos, force = "neutral"})
|
||||
end
|
||||
local noise = get_noise("trees_01", pos, seed)
|
||||
if math.random(1,3) ~= 1 then
|
||||
if noise > 0.2 or noise < -0.2 then
|
||||
surface.create_entity({name = rock_raffle[math.random(1, #rock_raffle)], position = pos, force = "neutral"})
|
||||
if math.random(1, 512) == 1 then
|
||||
surface.create_entity({name = get_worm(), position = pos, force = "enemy"})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -240,24 +242,14 @@ room.some_scrap = function(surface, cell_left_top, direction)
|
||||
room.worms(surface, cell_left_top, direction)
|
||||
end
|
||||
|
||||
room.lots_of_scrap = function(surface, cell_left_top, direction)
|
||||
local left_top = {x = cell_left_top.x * grid_size, y = cell_left_top.y * grid_size}
|
||||
for x = 0.5, grid_size - 0.5, 1 do
|
||||
for y = 0.5, grid_size - 0.5, 1 do
|
||||
local pos = {left_top.x + x, left_top.y + y}
|
||||
if math.random(1,8) == 1 then
|
||||
surface.create_entity({name = "mineable-wreckage", position = pos, force = "neutral"})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
room.tons_of_scrap = function(surface, cell_left_top, direction)
|
||||
local left_top = {x = cell_left_top.x * grid_size, y = cell_left_top.y * grid_size}
|
||||
local seed = game.surfaces[1].map_gen_settings.seed + 10000
|
||||
for x = 0.5, grid_size - 0.5, 1 do
|
||||
for y = 0.5, grid_size - 0.5, 1 do
|
||||
local pos = {left_top.x + x, left_top.y + y}
|
||||
if math.random(1,2) == 1 then
|
||||
local noise = get_noise("scrap_01", pos, seed)
|
||||
if math.random(1,2) == 1 and noise > 0 then
|
||||
surface.create_entity({name = "mineable-wreckage", position = pos, force = "neutral"})
|
||||
end
|
||||
end
|
||||
@ -286,28 +278,26 @@ room.pond = function(surface, cell_left_top, direction)
|
||||
end
|
||||
|
||||
local room_weights = {
|
||||
{func = room.worms, weight = 15},
|
||||
{func = room.worms, weight = 12},
|
||||
{func = room.nests, weight = 8},
|
||||
|
||||
{func = room.tons_of_trees, weight = 15},
|
||||
|
||||
{func = room.lots_of_rocks, weight = 15},
|
||||
{func = room.tons_of_rocks, weight = 15},
|
||||
{func = room.quad_rocks, weight = 10},
|
||||
{func = room.tons_of_rocks, weight = 35},
|
||||
{func = room.quad_rocks, weight = 8},
|
||||
{func = room.three_rocks, weight = 3},
|
||||
{func = room.single_rock, weight = 10},
|
||||
{func = room.single_rock, weight = 8},
|
||||
|
||||
{func = room.checkerboard_ore, weight = 7},
|
||||
{func = room.single_oil, weight = 5},
|
||||
--{func = room.some_scrap, weight = 10},
|
||||
{func = room.lots_of_scrap, weight = 5},
|
||||
--{func = room.tons_of_scrap, weight = 2},
|
||||
{func = room.tons_of_scrap, weight = 15},
|
||||
--{func = room.empty, weight = 1},
|
||||
|
||||
{func = room.pond, weight = 8},
|
||||
|
||||
{func = room.loot_crate, weight = 10},
|
||||
{func = room.tree_ring, weight = 10}
|
||||
{func = room.loot_crate, weight = 9},
|
||||
{func = room.tree_ring, weight = 9}
|
||||
|
||||
}
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
local get_noise = require 'maps.stone_maze.noise'
|
||||
|
||||
local room = {}
|
||||
|
||||
room.empty = function(surface, cell_left_top, direction)
|
||||
@ -161,12 +163,34 @@ room.stone_block = function(surface, cell_left_top, direction)
|
||||
end
|
||||
end
|
||||
|
||||
room.tons_of_rocks = function(surface, cell_left_top, direction)
|
||||
local left_top = {x = cell_left_top.x * grid_size, y = cell_left_top.y * grid_size}
|
||||
|
||||
local seed = game.surfaces[1].map_gen_settings.seed
|
||||
for x = 0.5, grid_size * 2 - 0.5, 1 do
|
||||
for y = 0.5, grid_size * 2 - 0.5, 1 do
|
||||
local pos = {left_top.x + x, left_top.y + y}
|
||||
local noise = get_noise("trees_01", pos, seed)
|
||||
if math.random(1,3) ~= 1 then
|
||||
if noise > 0.2 or noise < -0.2 then
|
||||
surface.create_entity({name = rock_raffle[math.random(1, #rock_raffle)], position = pos, force = "neutral"})
|
||||
if math.random(1, 512) == 1 then
|
||||
surface.create_entity({name = get_worm(), position = pos, force = "enemy"})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
room.scrapyard = function(surface, cell_left_top, direction)
|
||||
local left_top = {x = cell_left_top.x * grid_size, y = cell_left_top.y * grid_size}
|
||||
local left_top = {x = cell_left_top.x * grid_size, y = cell_left_top.y * grid_size}
|
||||
local seed = game.surfaces[1].map_gen_settings.seed + 10000
|
||||
for x = 2.5, grid_size * 2 - 2.5, 1 do
|
||||
for y = 2.5, grid_size * 2 - 2.5, 1 do
|
||||
local pos = {left_top.x + x, left_top.y + y}
|
||||
if math.random(1,3) == 1 then surface.create_entity({name = "mineable-wreckage", position = pos, force = "neutral"}) end
|
||||
local pos = {left_top.x + x, left_top.y + y}
|
||||
local noise = get_noise("scrap_01", pos, seed)
|
||||
if math.random(1,3) == 1 and noise > 0 then surface.create_entity({name = "mineable-wreckage", position = pos, force = "neutral"}) end
|
||||
end
|
||||
end
|
||||
local e = surface.create_entity({name = "storage-tank", position = {left_top.x + grid_size, left_top.y + grid_size}, force = "neutral", direction = math.random(0, 3)})
|
||||
@ -258,7 +282,7 @@ room.minefield_chest = function(surface, cell_left_top, direction)
|
||||
if x == 2 or x == grid_size * 2 - 3 or y == 2 or y == grid_size * 2 - 3 then
|
||||
surface.create_entity({name = "stone-wall", position = pos, force = "enemy"})
|
||||
else
|
||||
if math.random(1,6) == 1 then
|
||||
if math.random(1,8) == 1 then
|
||||
surface.create_entity({name = "land-mine", position = pos, force = "enemy"})
|
||||
end
|
||||
end
|
||||
@ -269,8 +293,9 @@ end
|
||||
|
||||
local room_weights = {
|
||||
{func = room.circle_pond_with_trees, weight = 10},
|
||||
{func = room.scrapyard, weight = 10},
|
||||
{func = room.stone_block, weight = 15},
|
||||
{func = room.scrapyard, weight = 9},
|
||||
{func = room.stone_block, weight = 12},
|
||||
{func = room.tons_of_rocks, weight = 12},
|
||||
{func = room.minefield_chest, weight = 5},
|
||||
{func = room.checkerboard_ore, weight = 3},
|
||||
|
||||
|
@ -3,6 +3,7 @@ require "modules.satellite_score"
|
||||
require "modules.dynamic_landfill"
|
||||
require "modules.dangerous_goods"
|
||||
require "modules.spawners_contain_biters"
|
||||
require "modules.manual_mining_booster"
|
||||
|
||||
--essentials
|
||||
require "modules.biters_yield_coins"
|
||||
@ -32,7 +33,7 @@ multirooms["3x3"] = require 'maps.stone_maze.3x3_rooms'
|
||||
|
||||
map_functions = require "tools.map_functions"
|
||||
grid_size = 24
|
||||
manual_mining_speed_modifier = 2
|
||||
--manual_mining_speed_modifier = 1
|
||||
main_ground_tile = "dirt-3"
|
||||
rock_raffle = {"rock-huge", "rock-big", "rock-big", "rock-big"}
|
||||
tree_raffle = {"tree-01", "tree-02", "tree-03", "tree-04", "tree-05", "tree-06", "tree-07", "tree-08", "tree-09", "tree-02-red", "tree-06-brown", "tree-08-brown", "tree-08-red","tree-09-brown","tree-09-red","dead-dry-hairy-tree","dry-hairy-tree","dry-tree","dead-tree-desert","dead-grey-trunk"}
|
||||
@ -343,10 +344,10 @@ local function on_player_joined_game(event)
|
||||
draw_depth_gui()
|
||||
end
|
||||
|
||||
local function on_research_finished(event)
|
||||
if not event.research.force.technologies["steel-axe"].researched then return end
|
||||
event.research.force.manual_mining_speed_modifier = manual_mining_speed_modifier + 2
|
||||
end
|
||||
--local function on_research_finished(event)
|
||||
--if not event.research.force.technologies["steel-axe"].researched then return end
|
||||
--event.research.force.manual_mining_speed_modifier = manual_mining_speed_modifier + 2
|
||||
--end
|
||||
|
||||
local function on_marked_for_deconstruction(event)
|
||||
if disabled_for_deconstruction[event.entity.name] then
|
||||
@ -368,7 +369,7 @@ local function on_init(event)
|
||||
}
|
||||
|
||||
game.forces["player"].set_spawn_position({x = 2, y = 2}, game.surfaces.nauvis)
|
||||
game.forces["player"].manual_mining_speed_modifier = manual_mining_speed_modifier
|
||||
--game.forces["player"].manual_mining_speed_modifier = manual_mining_speed_modifier
|
||||
|
||||
game.map_settings.enemy_evolution.time_factor = 0
|
||||
game.map_settings.enemy_evolution.destroy_factor = 0
|
||||
@ -380,4 +381,4 @@ event.add(defines.events.on_marked_for_deconstruction, on_marked_for_deconstruct
|
||||
event.add(defines.events.on_player_changed_position, on_player_changed_position)
|
||||
event.add(defines.events.on_player_joined_game, on_player_joined_game)
|
||||
event.add(defines.events.on_chunk_generated, on_chunk_generated)
|
||||
event.add(defines.events.on_research_finished, on_research_finished)
|
||||
--event.add(defines.events.on_research_finished, on_research_finished)
|
21
maps/stone_maze/noise.lua
Normal file
21
maps/stone_maze/noise.lua
Normal file
@ -0,0 +1,21 @@
|
||||
local simplex_noise = require "utils.simplex_noise".d2
|
||||
|
||||
local noises = {
|
||||
["trees_01"] = {{modifier = 0.03, weight = 1}, {modifier = 0.05, weight = 0.3}, {modifier = 0.1, weight = 0.05}},
|
||||
["scrap_01"] = {{modifier = 0.04, weight = 1}, {modifier = 0.06, weight = 0.3}, {modifier = 0.08, weight = 0.1}}
|
||||
}
|
||||
|
||||
local function get_noise(name, pos, seed)
|
||||
local noise = 0
|
||||
local x = pos.x
|
||||
local y = pos.y
|
||||
if not x then x = pos[1] end
|
||||
if not y then y = pos[2] end
|
||||
for _, n in pairs(noises[name]) do
|
||||
noise = noise + simplex_noise(x * n.modifier, y * n.modifier, seed) * n.weight
|
||||
seed = seed + 10000
|
||||
end
|
||||
return noise
|
||||
end
|
||||
|
||||
return get_noise
|
@ -4,7 +4,8 @@ local event = require 'utils.event'
|
||||
|
||||
local function mining_speed_cooldown(p)
|
||||
if not global.manual_mining_booster[p.index] then return end
|
||||
if game.tick - global.manual_mining_booster[p.index] < 180 then return end
|
||||
if game.tick - global.manual_mining_booster[p.index] < 180 then return end
|
||||
if not p.character then p.character.character_mining_speed_modifier = 0 return end
|
||||
p.character.character_mining_speed_modifier = p.character.character_mining_speed_modifier - 1
|
||||
if p.character.character_mining_speed_modifier <= 0 then p.character.character_mining_speed_modifier = 0 end
|
||||
end
|
||||
@ -12,7 +13,7 @@ end
|
||||
local function on_player_mined_entity(event)
|
||||
local player = game.players[event.player_index]
|
||||
player.character.character_mining_speed_modifier = player.character.character_mining_speed_modifier + (math.random(25, 50) * 0.01)
|
||||
if player.character.character_mining_speed_modifier > 12 then player.character.character_mining_speed_modifier = 12 end
|
||||
if player.character.character_mining_speed_modifier > 10 then player.character.character_mining_speed_modifier = 10 end
|
||||
global.manual_mining_booster[event.player_index] = game.tick
|
||||
end
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user