mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2025-01-04 00:15:45 +02:00
update
new spawn ore more turrets bp disable faster feeding enemy player charting spawn position change
This commit is contained in:
parent
07336111bf
commit
e3cc65d21f
@ -68,8 +68,8 @@ function Public.reset_map()
|
||||
surface.request_to_generate_chunks({0,0}, 8)
|
||||
surface.force_generate_chunk_requests()
|
||||
game.forces.spectator.set_spawn_position({0, -128}, surface)
|
||||
game.forces.west.set_spawn_position({-200, 0}, surface)
|
||||
game.forces.east.set_spawn_position({200, 0}, surface)
|
||||
game.forces.west.set_spawn_position({-210, 0}, surface)
|
||||
game.forces.east.set_spawn_position({210, 0}, surface)
|
||||
|
||||
Team.set_force_attributes()
|
||||
Team.assign_random_force_to_active_players()
|
||||
@ -120,7 +120,7 @@ local function spawn_units(belt, food_item, removed_item_count)
|
||||
team.unit_count = team.unit_count + 1
|
||||
end
|
||||
end
|
||||
if math_random(1, 6) == 1 then spawn_worm_turret(belt.surface, belt.force.name, food_item) end
|
||||
if math_random(1, 8) == 1 then spawn_worm_turret(belt.surface, belt.force.name, food_item) end
|
||||
end
|
||||
|
||||
local function get_belts(spawner)
|
||||
@ -318,14 +318,17 @@ end
|
||||
|
||||
local function tick()
|
||||
local game_tick = game.tick
|
||||
if game_tick % 240 == 0 then
|
||||
if game_tick % 240 == 0 then
|
||||
local surface = game.surfaces[global.active_surface_index]
|
||||
--if surface.is_chunk_generated({10, 0}) then
|
||||
local area = {{-320, -161}, {319, 160}}
|
||||
game.forces.west.chart(surface, area)
|
||||
game.forces.east.chart(surface, area)
|
||||
--end
|
||||
end
|
||||
local west = game.forces.west
|
||||
local east = game.forces.east
|
||||
local area = {{-320, -161}, {319, 160}}
|
||||
west.chart(surface, area)
|
||||
east.chart(surface, area)
|
||||
local r = 64
|
||||
for _, player in pairs(west.connected_players) do east.chart(surface, {{player.position.x - r, player.position.y - r}, {player.position.x + r, player.position.y + r}}) end
|
||||
for _, player in pairs(east.connected_players) do west.chart(surface, {{player.position.x - r, player.position.y - r}, {player.position.x + r, player.position.y + r}}) end
|
||||
end
|
||||
if game_tick % 1200 == 0 then send_unit_groups() end
|
||||
if global.game_reset_tick then
|
||||
if global.game_reset_tick < game_tick then
|
||||
@ -396,6 +399,9 @@ local function on_init()
|
||||
surface.delete_chunk({chunk.x, chunk.y})
|
||||
end
|
||||
|
||||
game.permissions.get_group("Default").set_allows_action(defines.input_action.open_blueprint_library_gui, false)
|
||||
game.permissions.get_group("Default").set_allows_action(defines.input_action.import_blueprint_string, false)
|
||||
|
||||
game.difficulty_settings.technology_price_multiplier = 0.5
|
||||
game.map_settings.enemy_evolution.destroy_factor = 0
|
||||
game.map_settings.enemy_evolution.pollution_factor = 0
|
||||
@ -415,7 +421,7 @@ local function on_init()
|
||||
"Feed your hatchery science flasks to breed biters!\n",
|
||||
"They will soon after swarm to the opposing teams nest!\n",
|
||||
"\n",
|
||||
"Lay transport belts to your hatchery and they will happily nom the juice off the conveyor.\n",
|
||||
"Lay transport belts to your hatchery and they will happily nom the science juice off the conveyor.\n",
|
||||
"Higher tier flasks will breed stronger biters!\n",
|
||||
"\n",
|
||||
"Player turrets are disabled.\n",
|
||||
@ -432,7 +438,7 @@ end
|
||||
|
||||
local event = require 'utils.event'
|
||||
event.on_init(on_init)
|
||||
event.on_nth_tick(60, tick)
|
||||
event.on_nth_tick(30, tick)
|
||||
event.add(defines.events.on_player_used_spider_remote, on_player_used_spider_remote)
|
||||
event.add(defines.events.on_robot_built_entity, on_robot_built_entity)
|
||||
event.add(defines.events.on_entity_died, on_entity_died)
|
||||
|
@ -1,6 +1,6 @@
|
||||
local math_abs = math.abs
|
||||
local math_random = math.random
|
||||
local Map_functions = require "tools.map_functions"
|
||||
local GetNoise = require "utils.get_noise"
|
||||
local Public = {}
|
||||
|
||||
local hatchery_position = {x = 192, y = 0}
|
||||
@ -47,40 +47,66 @@ local function create_border_beams(surface)
|
||||
surface.create_entity({name = "electric-beam", position = {-4, -96}, source = {-4, -96}, target = {-4,96}})
|
||||
end
|
||||
|
||||
local function draw_spawn_ore(surface, position)
|
||||
local ores = {"copper-ore", "iron-ore", "coal", "stone"}
|
||||
table.shuffle_table(ores)
|
||||
|
||||
local seed = math_random(1, 1000000)
|
||||
local r = 25
|
||||
local r_square = r ^ 2
|
||||
|
||||
for x = -32, 32, 1 do
|
||||
for y = -32, 32, 1 do
|
||||
local position = {x = position.x + x + 0.5, y = position.y + y + 0.5}
|
||||
if x ^ 2 + y ^ 2 + math_abs(GetNoise("decoratives", position, seed) * 300) < r_square then
|
||||
local name = ores[1]
|
||||
if y <= 0 and x < 0 then
|
||||
name = ores[2]
|
||||
end
|
||||
if y >= 0 and x >= 0 then
|
||||
name = ores[3]
|
||||
end
|
||||
if y >= 0 and x < 0 then
|
||||
name = ores[4]
|
||||
end
|
||||
for _, e in pairs(surface.find_entities_filtered({position = position})) do e.destroy() end
|
||||
local tile = surface.get_tile(position)
|
||||
if tile.name == "water" or tile.name == "deepwater" then
|
||||
surface.set_tiles({{name = "landfill", position = position}}, true)
|
||||
end
|
||||
surface.create_entity({name = name, position = position, amount = math_random(800, 1000)})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function Public.create_mirror_surface()
|
||||
if game.surfaces["mirror_terrain"] then return end
|
||||
|
||||
local map_gen_settings = {}
|
||||
map_gen_settings.seed = math_random(1, 99999999)
|
||||
map_gen_settings.water = 0.2
|
||||
map_gen_settings.water = 0.22
|
||||
map_gen_settings.starting_area = 1
|
||||
map_gen_settings.terrain_segmentation = 8
|
||||
map_gen_settings.cliff_settings = {cliff_elevation_interval = 0, cliff_elevation_0 = 0}
|
||||
map_gen_settings.autoplace_controls = {
|
||||
["coal"] = {frequency = 5, size = 0.7, richness = 0.5,},
|
||||
["stone"] = {frequency = 5, size = 0.7, richness = 0.5,},
|
||||
["copper-ore"] = {frequency = 10, size = 0.7, richness = 0.75,},
|
||||
["iron-ore"] = {frequency = 10, size = 0.7, richness = 1,},
|
||||
["coal"] = {frequency = 8, size = 0.7, richness = 0.5,},
|
||||
["stone"] = {frequency = 8, size = 0.7, richness = 0.5,},
|
||||
["copper-ore"] = {frequency = 8, size = 0.7, richness = 0.75,},
|
||||
["iron-ore"] = {frequency = 8, size = 0.7, richness = 1,},
|
||||
["uranium-ore"] = {frequency = 5, size = 0.5, richness = 0.5,},
|
||||
["crude-oil"] = {frequency = 10, size = 1, richness = 1,},
|
||||
["crude-oil"] = {frequency = 5, size = 1, richness = 1,},
|
||||
["trees"] = {frequency = math_random(5, 12) * 0.1, size = math_random(5, 12) * 0.1, richness = math_random(1, 10) * 0.1},
|
||||
["enemy-base"] = {frequency = 0, size = 0, richness = 0}
|
||||
}
|
||||
local surface = game.create_surface("mirror_terrain", map_gen_settings)
|
||||
|
||||
local x = hatchery_position.x - 16
|
||||
local offset = 38
|
||||
|
||||
surface.request_to_generate_chunks({x, 0}, 5)
|
||||
surface.force_generate_chunk_requests()
|
||||
|
||||
local positions = {{x = x, y = offset}, {x = x, y = offset * -1}, {x = x, y = offset * -2}, {x = x, y = offset * 2}}
|
||||
table.shuffle_table(positions)
|
||||
|
||||
for key, ore in pairs({"copper-ore", "iron-ore", "coal", "stone"}) do
|
||||
Map_functions.draw_smoothed_out_ore_circle(surface.find_non_colliding_position("coal", positions[key], 128, 1), ore, surface, 15, 2500)
|
||||
end
|
||||
draw_spawn_ore(surface, {x = 240, y = 0})
|
||||
|
||||
local r = 32
|
||||
for x = r * -1, r, 1 do
|
||||
@ -133,8 +159,7 @@ local function combat_area(event)
|
||||
|
||||
local replacement_tile = "landfill"
|
||||
local tile = surface.get_tile({8,0})
|
||||
if tile then replacement_tile = tile.name end
|
||||
|
||||
if tile then replacement_tile = tile.name end
|
||||
for _, tile in pairs(surface.find_tiles_filtered({area = event.area})) do
|
||||
--if tile.name == "water" or tile.name == "deepwater" then
|
||||
--surface.set_tiles({{name = replacement_tile, position = tile.position}}, true)
|
||||
@ -147,7 +172,7 @@ local function combat_area(event)
|
||||
for _, entity in pairs(surface.find_entities_filtered({type = {"resource", "cliff"}, area = event.area})) do
|
||||
entity.destroy()
|
||||
end
|
||||
]]
|
||||
]]
|
||||
end
|
||||
|
||||
local function is_out_of_map(p)
|
||||
@ -169,11 +194,28 @@ local function out_of_map_area(event)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--[[
|
||||
local function modify_source_surface(event)
|
||||
local surface = event.surface
|
||||
local left_top = event.area.left_top
|
||||
if left_top.x >= 192 then return end
|
||||
local seed = surface.map_gen_settings.seed
|
||||
for x = 0, 31, 1 do
|
||||
for y = 0, 31, 1 do
|
||||
local p = {x = left_top.x + x, y = left_top.y + y}
|
||||
if p.x + math_abs(GetNoise("cave_rivers", {x = 0, y = p.y}, seed) * 16) < 64 then
|
||||
surface.set_tiles({{name = "water", position = p}}, true)
|
||||
surface.set_tiles({{name = "nuclear-ground", position = p}}, true)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
]]
|
||||
local function on_chunk_generated(event)
|
||||
local source_surface = game.surfaces["mirror_terrain"]
|
||||
if not source_surface then return end
|
||||
if not source_surface.valid then return end
|
||||
--if event.surface.index == source_surface.index then modify_source_surface(event) return end
|
||||
if event.surface.index == source_surface.index then return end
|
||||
|
||||
local left_top = event.area.left_top
|
||||
|
Loading…
Reference in New Issue
Block a user