mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2025-05-13 21:56:29 +02:00
map update
This commit is contained in:
parent
a63cfecc12
commit
1aa764a5d5
@ -106,3 +106,8 @@ tooltip_2=gain / minute
|
||||
|
||||
[native_war]
|
||||
map_info= - - N A T I V E W A R - -\n\n Defeat the enemy team Market !\n\nFeed your market with science to spawn waves of native biters and spitters !\nThey will soon after swarm to the opposing team Market !\n\nThe corridor is stewn with worms.\nRebuy dead worms and upgrade them to stem the opposing waves !\n\nExcess energy will activate a beam.\nBeam will progress with more excess energy.\nNatives will spawn according to the beam position.\n\nUse radars to spy opponent's base.\nUse your experience to improve damage and resistance of your biters.\nSpace science packs give extra life to your biters.\nConstruction robots may not build over the wall.\n
|
||||
|
||||
[territorial_control]
|
||||
map_info_main_caption=T E R R I T O R I A L C O N T R O L
|
||||
map_info_sub_caption= ..alone in the darkness..
|
||||
map_info_text=Citizen Log #468-2A-3287, Freelancer Trent. \n\nTo whoever is reading this message, \nAny natural resources are rare and the ones worth while are too hard for me to reach. \nLuckily, the wrecks yield all kinds of useful scraps, but also various dangers. \nAlmost lost half a leg some days ago while digging out some scrap. \nThe wildlife is extremely aggressive, especially at the time of night. \nMost of these insect appearing like creatures seem to live underground. \nStay near your light sources, if you want to have a chance of surviving here! \n\n###Log End###]
|
@ -1,6 +1,6 @@
|
||||
-- territorial control by Gerkiz
|
||||
|
||||
require "territorial_control_intro"
|
||||
local Map = require "modules.map_info"
|
||||
require "on_tick_schedule"
|
||||
require "modules.fish_respawner"
|
||||
global.fish_respawner_water_tiles_per_fish = 16
|
||||
@ -16,13 +16,10 @@ require "modules.biters_yield_coins"
|
||||
require "modules.mineable_wreckage_yields_scrap"
|
||||
|
||||
local shapes = require "tools.shapes"
|
||||
local event = require 'utils.event'
|
||||
local map_functions = require "tools.map_functions"
|
||||
local Event = require 'utils.event'
|
||||
local unearthing_worm = require "functions.unearthing_worm"
|
||||
local unearthing_biters = require "functions.unearthing_biters"
|
||||
local tick_tack_trap = require "functions.tick_tack_trap"
|
||||
local create_entity_chain = require "functions.create_entity_chain"
|
||||
local create_tile_chain = require "functions.create_tile_chain"
|
||||
local map_functions = require "tools.map_functions"
|
||||
local simplex_noise = require 'utils.simplex_noise'
|
||||
simplex_noise = simplex_noise.d2
|
||||
@ -74,9 +71,8 @@ local biters_in_the_void = {
|
||||
[18] = {"big-biter","behemoth-biter","behemoth-biter","behemoth-biter","behemoth-biter","behemoth-spitter"},
|
||||
[19] = {"behemoth-biter","behemoth-biter","behemoth-biter","behemoth-biter","behemoth-biter","behemoth-spitter"},
|
||||
[20] = {"behemoth-biter","behemoth-biter","behemoth-biter","behemoth-biter","behemoth-spitter","behemoth-spitter"}
|
||||
}
|
||||
}
|
||||
|
||||
local ore_spill_raffle = {"iron-ore","iron-ore","iron-ore","iron-ore","copper-ore","copper-ore","copper-ore","coal","coal"}
|
||||
local ore_spawn_raffle = {
|
||||
"iron-ore","iron-ore","iron-ore","iron-ore", "iron-ore","iron-ore","iron-ore","iron-ore", "iron-ore","iron-ore",
|
||||
"copper-ore","copper-ore","copper-ore", "copper-ore","copper-ore","copper-ore", "copper-ore",
|
||||
@ -90,18 +86,18 @@ local rock_raffle = {"sand-rock-big","sand-rock-big", "rock-big","rock-big","roc
|
||||
local tree_raffle = {"tree-02-red","tree-09-red", "tree-02-red","tree-09-red","tree-02-red","tree-09-red","tree-02-red","tree-09-red","tree-02-red","tree-09-red","tree-02-red"}
|
||||
|
||||
local function secret_shop(pos, surface)
|
||||
local secret_market_items = {
|
||||
local secret_market_items = {
|
||||
{price = {{"coin", math_random(75,125)}}, offer = {type = 'give-item', item = 'combat-shotgun'}},
|
||||
{price = {{"coin", math_random(40,60)}}, offer = {type = 'give-item', item = 'rocket-launcher'}},
|
||||
{price = {{"coin", math_random(40,60)}}, offer = {type = 'give-item', item = 'rocket-launcher'}},
|
||||
{price = {{"coin", math_random(1,2)}}, offer = {type = 'give-item', item = 'piercing-rounds-magazine'}},
|
||||
{price = {{"coin", math_random(3,6)}}, offer = {type = 'give-item', item = 'uranium-rounds-magazine'}},
|
||||
{price = {{"coin", math_random(3,6)}}, offer = {type = 'give-item', item = 'uranium-rounds-magazine'}},
|
||||
{price = {{"coin", math_random(1,4)}}, offer = {type = 'give-item', item = 'piercing-shotgun-shell'}},
|
||||
{price = {{"coin", math_random(1,2)}}, offer = {type = 'give-item', item = 'rocket'}},
|
||||
{price = {{"coin", math_random(2,3)}}, offer = {type = 'give-item', item = 'explosive-rocket'}},
|
||||
{price = {{"coin", math_random(2,3)}}, offer = {type = 'give-item', item = 'explosive-rocket'}},
|
||||
{price = {{"coin", math_random(1,2)}}, offer = {type = 'give-item', item = 'explosive-cannon-shell'}},
|
||||
{price = {{"coin", math_random(3,6)}}, offer = {type = 'give-item', item = 'explosive-uranium-cannon-shell'}},
|
||||
{price = {{"coin", math_random(4,8)}}, offer = {type = 'give-item', item = 'cluster-grenade'}},
|
||||
{price = {{"coin", math_random(1,2)}}, offer = {type = 'give-item', item = 'land-mine'}},
|
||||
{price = {{"coin", math_random(3,6)}}, offer = {type = 'give-item', item = 'explosive-uranium-cannon-shell'}},
|
||||
{price = {{"coin", math_random(4,8)}}, offer = {type = 'give-item', item = 'cluster-grenade'}},
|
||||
{price = {{"coin", math_random(1,2)}}, offer = {type = 'give-item', item = 'land-mine'}},
|
||||
{price = {{"coin", math_random(25,50)}}, offer = {type = 'give-item', item = 'heavy-armor'}},
|
||||
{price = {{"coin", math_random(125,250)}}, offer = {type = 'give-item', item = 'modular-armor'}},
|
||||
{price = {{"coin", math_random(300,600)}}, offer = {type = 'give-item', item = 'power-armor'}},
|
||||
@ -113,7 +109,7 @@ local function secret_shop(pos, surface)
|
||||
{price = {{"coin", math_random(60,120)}}, offer = {type = 'give-item', item = 'personal-roboport-equipment'}},
|
||||
{price = {{"coin", math_random(3,9)}}, offer = {type = 'give-item', item = 'construction-robot'}},
|
||||
{price = {{"coin", math_random(100,200)}}, offer = {type = 'give-item', item = 'energy-shield-equipment'}},
|
||||
{price = {{"coin", math_random(200,400)}}, offer = {type = 'give-item', item = 'personal-laser-defense-equipment'}},
|
||||
{price = {{"coin", math_random(200,400)}}, offer = {type = 'give-item', item = 'personal-laser-defense-equipment'}},
|
||||
{price = {{"coin", math_random(25,50)}}, offer = {type = 'give-item', item = 'railgun'}},
|
||||
{price = {{"coin", math_random(1,2)}}, offer = {type = 'give-item', item = 'railgun-dart', count = 2}},
|
||||
{price = {{"coin", math_random(30,60)}}, offer = {type = 'give-item', item = 'loader'}},
|
||||
@ -123,9 +119,7 @@ local function secret_shop(pos, surface)
|
||||
{price = {{"coin", math_random(15,35)}}, offer = {type = 'give-item', item = 'cargo-wagon'}},
|
||||
{price = {{"coin", math_random(1,4)}}, offer = {type = 'give-item', item = 'grenade'}},
|
||||
{price = {{"coin", 1}}, offer = {type = 'give-item', item = 'rail', count = 4}},
|
||||
-- {price = {{"coin", 1}}, offer = {type = 'give-item', item = 'rail-signal', count = 2}},
|
||||
-- {price = {{"coin", 1}}, offer = {type = 'give-item', item = 'rail-chain-signal', count = 2}},
|
||||
{price = {{"coin", 5}}, offer = {type = 'give-item', item = 'train-stop'}},
|
||||
{price = {{"coin", 5}}, offer = {type = 'give-item', item = 'train-stop'}},
|
||||
{price = {{"coin", 1}}, offer = {type = 'give-item', item = 'small-lamp'}},
|
||||
{price = {{"coin", 2}}, offer = {type = 'give-item', item = 'firearm-magazine'}},
|
||||
{price = {{"coin", 1}}, offer = {type = 'give-item', item = 'wood', count = math_random(25,75)}},
|
||||
@ -136,58 +130,52 @@ local function secret_shop(pos, surface)
|
||||
{price = {{"coin", 1}}, offer = {type = 'give-item', item = 'uranium-ore', count = math_random(25,75)}}
|
||||
}
|
||||
secret_market_items = shuffle(secret_market_items)
|
||||
|
||||
local market = surface.create_entity {name = "market", position = pos}
|
||||
market.destructible = false
|
||||
|
||||
market.destructible = false
|
||||
|
||||
for i = 1, math.random(4, 8), 1 do
|
||||
market.add_market_item(secret_market_items[i])
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
local function spawn_biter(surface, position)
|
||||
local e = math.ceil(game.forces.enemy.evolution_factor*20)
|
||||
if e < 1 then e = 1 end
|
||||
if e > 20 then e = 20 end
|
||||
if e > 20 then e = 20 end
|
||||
local biter = biters_in_the_void[e][math_random(1, #biters_in_the_void[e])]
|
||||
local p = surface.find_non_colliding_position(biter , position, 16, 0.5)
|
||||
if not p then return end
|
||||
surface.create_entity{name = biter, position = p}
|
||||
end
|
||||
|
||||
local function get_noise(name, pos)
|
||||
end
|
||||
|
||||
local function get_noise(name, pos)
|
||||
local seed = game.surfaces[1].map_gen_settings.seed
|
||||
local noise = {}
|
||||
local noise_seed_add = 25000
|
||||
if name == "water" then
|
||||
if name == "water" then
|
||||
noise[1] = simplex_noise(pos.x * 0.02, pos.y * 0.02, seed)
|
||||
seed = seed + noise_seed_add
|
||||
noise[2] = simplex_noise(pos.x * 0.1, pos.y * 0.1, seed)
|
||||
seed = seed + noise_seed_add
|
||||
local noise = noise[1] + noise[2] * 0.2
|
||||
return noise
|
||||
local value = noise[1] + noise[2] * 0.2
|
||||
return value
|
||||
end
|
||||
seed = seed + noise_seed_add
|
||||
if name == "dirt" then
|
||||
--noise[1] = simplex_noise(pos.x * 0.1, pos.y * 0.1, seed)
|
||||
if name == "dirt" then
|
||||
noise[1] = simplex_noise(pos.x * 0.08, pos.y * 0.08, seed)
|
||||
seed = seed + noise_seed_add
|
||||
local noise = noise[1]
|
||||
return noise
|
||||
local value = noise[1]
|
||||
return value
|
||||
end
|
||||
seed = seed + noise_seed_add
|
||||
if name == "trees" then
|
||||
if name == "trees" then
|
||||
noise[1] = simplex_noise(pos.x * 0.045, pos.y * 0.045, seed)
|
||||
seed = seed + noise_seed_add
|
||||
local noise = noise[1]
|
||||
return noise
|
||||
local value = noise[1]
|
||||
return value
|
||||
end
|
||||
seed = seed + noise_seed_add
|
||||
if name == "spawners" then
|
||||
if name == "spawners" then
|
||||
noise[1] = simplex_noise(pos.x * 0.02, pos.y * 0.02, seed)
|
||||
seed = seed + noise_seed_add
|
||||
local noise = noise[1]
|
||||
return noise
|
||||
local value = noise[1]
|
||||
return value
|
||||
end
|
||||
end
|
||||
|
||||
@ -202,28 +190,28 @@ local function get_entity(position)
|
||||
if math_random(1, 128) == 1 then
|
||||
if position.x > 32 or position.x < -32 or position.y > 32 or position.y < -32 then
|
||||
local e = math.ceil(game.forces.enemy.evolution_factor*10)
|
||||
if e < 1 then e = 1 end
|
||||
if e < 1 then e = 1 end
|
||||
entity_name = worm_raffle_table[e][math_random(1, #worm_raffle_table[e])]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
if noise > 0.61 then
|
||||
entity_name = tree_raffle[math_random(1, #tree_raffle)]
|
||||
|
||||
|
||||
if math_random(1, 128) == 1 then
|
||||
if position.x > 32 or position.x < -32 or position.y > 32 or position.y < -32 then
|
||||
local e = math.ceil(game.forces.enemy.evolution_factor*10)
|
||||
if e < 1 then e = 1 end
|
||||
if e < 1 then e = 1 end
|
||||
entity_name = worm_raffle_table[e][math_random(1, #worm_raffle_table[e])]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
if math_random(1, 2048) == 1 then
|
||||
entity_name = "market"
|
||||
entity_name = "market"
|
||||
end
|
||||
|
||||
|
||||
if math_random(1, 64) == 1 then
|
||||
local noise_spawners = get_noise("spawners", position)
|
||||
if noise_spawners > 0.25 and position.x^2 + position.y^2 > 3000 then
|
||||
@ -240,54 +228,39 @@ end
|
||||
local function get_noise_tile(position)
|
||||
local noise = get_noise("dirt", position)
|
||||
local tile_name
|
||||
|
||||
|
||||
if noise > 0 then
|
||||
tile_name = "grass-1"
|
||||
if noise > 0.5 then
|
||||
tile_name = "dirt-5"
|
||||
end
|
||||
else
|
||||
tile_name = "dirt-7"
|
||||
tile_name = "dirt-7"
|
||||
end
|
||||
|
||||
local noise = get_noise("water", position)
|
||||
if noise > 0.71 then
|
||||
|
||||
local noise_2 = get_noise("water", position)
|
||||
if noise_2 > 0.71 then
|
||||
tile_name = "water"
|
||||
if noise > 0.78 then
|
||||
tile_name = "deepwater"
|
||||
end
|
||||
if noise_2 > 0.78 then
|
||||
tile_name = "deepwater"
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
if noise < -0.76 then
|
||||
tile_name = "water"
|
||||
end
|
||||
|
||||
|
||||
return tile_name
|
||||
end
|
||||
|
||||
local function get_chunk_position(position)
|
||||
local chunk_position = {}
|
||||
position.x = math.floor(position.x, 0)
|
||||
position.y = math.floor(position.y, 0)
|
||||
for x = 0, 31, 1 do
|
||||
if (position.x - x) % 32 == 0 then chunk_position.x = (position.x - x) / 32 end
|
||||
end
|
||||
for y = 0, 31, 1 do
|
||||
if (position.y - y) % 32 == 0 then chunk_position.y = (position.y - y) / 32 end
|
||||
end
|
||||
return chunk_position
|
||||
end
|
||||
|
||||
local function uncover_map(surface, position, radius_min, radius_max)
|
||||
local circles = shapes.circles
|
||||
local circles = shapes.circles
|
||||
local tiles = {}
|
||||
local fishes = {}
|
||||
local regenerate_decoratives = false
|
||||
for r = radius_min, radius_max, 1 do
|
||||
for _, position_modifier in pairs(circles[r]) do
|
||||
for _, position_modifier in pairs(circles[r]) do
|
||||
local pos = {x = position.x + position_modifier.x, y = position.y + position_modifier.y}
|
||||
if surface.get_tile(pos).name == "out-of-map" then
|
||||
regenerate_decoratives = true
|
||||
local tile_name = get_noise_tile(pos)
|
||||
insert(tiles, {name = tile_name, position = pos})
|
||||
if tile_name == "water" or tile_name == "deepwater" then
|
||||
@ -305,14 +278,14 @@ local function uncover_map(surface, position, radius_min, radius_max)
|
||||
local area = {{pos.x - 4, pos.y - 4}, {pos.x + 4, pos.y + 4}}
|
||||
if surface.count_entities_filtered({name = "biter-spawner", area = area}) == 0 then
|
||||
surface.create_entity({name = entity, position = pos})
|
||||
end
|
||||
end
|
||||
else
|
||||
surface.create_entity({name = entity, position = pos})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
if #tiles > 0 then
|
||||
@ -326,18 +299,16 @@ end
|
||||
local function uncover_map_for_player(player)
|
||||
local position = player.position
|
||||
local surface = player.surface
|
||||
local circles = shapes.circles
|
||||
local circles = shapes.circles
|
||||
local tiles = {}
|
||||
local fishes = {}
|
||||
local uncover_map_schedule = {}
|
||||
local regenerate_decoratives = false
|
||||
for r = uncover_radius - 1, uncover_radius, 1 do
|
||||
for _, position_modifier in pairs(circles[r]) do
|
||||
local pos = {x = position.x + position_modifier.x, y = position.y + position_modifier.y}
|
||||
local pos = {x = position.x + position_modifier.x, y = position.y + position_modifier.y}
|
||||
if surface.get_tile(pos).name == "out-of-map" then
|
||||
regenerate_decoratives = true
|
||||
local tile_name = get_noise_tile(pos)
|
||||
insert(tiles, {name = tile_name, position = pos})
|
||||
insert(tiles, {name = tile_name, position = pos})
|
||||
if tile_name == "water" or tile_name == "deepwater" then
|
||||
if math_random(1, 24) == 1 then insert(fishes, pos) end
|
||||
else
|
||||
@ -353,40 +324,40 @@ local function uncover_map_for_player(player)
|
||||
local area = {{pos.x - 4, pos.y - 4}, {pos.x + 4, pos.y + 4}}
|
||||
if surface.count_entities_filtered({name = "biter-spawner", area = area}) == 0 then
|
||||
surface.create_entity({name = entity, position = pos})
|
||||
end
|
||||
end
|
||||
else
|
||||
surface.create_entity({name = entity, position = pos})
|
||||
end
|
||||
end
|
||||
end
|
||||
if entity == "biter-spawner" or entity == "spitter-spawner" then
|
||||
insert(uncover_map_schedule, {x = pos.x, y = pos.y})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
if #tiles > 0 then
|
||||
surface.set_tiles(tiles, true)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
for _, pos in pairs(uncover_map_schedule) do
|
||||
uncover_map(surface, pos, 1, 16)
|
||||
end
|
||||
uncover_map(surface, pos, 1, 16)
|
||||
end
|
||||
for _, fish in pairs(fishes) do
|
||||
surface.create_entity({name = "fish", position = fish})
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
local function on_player_joined_game(event)
|
||||
local player = game.players[event.player_index]
|
||||
|
||||
|
||||
if not global.territorial_control_init_done then
|
||||
local map_gen_settings = {}
|
||||
map_gen_settings.water = "small"
|
||||
map_gen_settings.cliff_settings = {cliff_elevation_interval = 22, cliff_elevation_0 = 22}
|
||||
map_gen_settings.cliff_settings = {cliff_elevation_interval = 22, cliff_elevation_0 = 22}
|
||||
map_gen_settings.autoplace_controls = {
|
||||
["coal"] = {frequency = "none", size = "none", richness = "none"},
|
||||
["stone"] = {frequency = "none", size = "none", richness = "none"},
|
||||
@ -395,34 +366,34 @@ local function on_player_joined_game(event)
|
||||
["crude-oil"] = {frequency = "none", size = "none", richness = "none"},
|
||||
["trees"] = {frequency = "none", size = "none", richness = "none"},
|
||||
["enemy-base"] = {frequency = "none", size = "none", richness = "none"}
|
||||
}
|
||||
game.create_surface("territorial_control", map_gen_settings)
|
||||
}
|
||||
game.create_surface("territorial_control", map_gen_settings)
|
||||
local surface = game.surfaces["territorial_control"]
|
||||
--surface.daytime = 0.5
|
||||
--surface.freeze_daytime = 1
|
||||
surface.ticks_per_day = surface.ticks_per_day * 2
|
||||
surface.min_brightness = 0.08
|
||||
game.forces["player"].set_spawn_position({0, 0}, surface)
|
||||
|
||||
|
||||
game.map_settings.enemy_expansion.enabled = true
|
||||
game.map_settings.enemy_evolution.destroy_factor = 0.0016
|
||||
game.map_settings.enemy_evolution.time_factor = 0
|
||||
game.map_settings.enemy_evolution.pollution_factor = 0
|
||||
|
||||
|
||||
local turret_positions = {{6, 6}, {-5, -5}, {-5, 6}, {6, -5}}
|
||||
for _, pos in pairs(turret_positions) do
|
||||
local turret = surface.create_entity({name = "gun-turret", position = pos, force = "player"})
|
||||
turret.insert({name = "firearm-magazine", count = 32})
|
||||
end
|
||||
|
||||
|
||||
local radius = 320
|
||||
game.forces.player.chart(surface, {{x = -1 * radius, y = -1 * radius}, {x = radius, y = radius}})
|
||||
|
||||
|
||||
global.territorial_control_init_done = true
|
||||
end
|
||||
|
||||
|
||||
if player.online_time < 1 then
|
||||
player.insert({name = "submachine-gun", count = 1})
|
||||
player.insert({name = "submachine-gun", count = 1})
|
||||
player.insert({name = "iron-plate", count = 64})
|
||||
player.insert({name = "grenade", count = 3})
|
||||
player.insert({name = "raw-fish", count = 5})
|
||||
@ -432,7 +403,7 @@ local function on_player_joined_game(event)
|
||||
player.insert({name = "firearm-magazine", count = 128})
|
||||
if global.show_floating_killscore then global.show_floating_killscore[player.name] = false end
|
||||
end
|
||||
|
||||
|
||||
local surface = game.surfaces["territorial_control"]
|
||||
if player.online_time < 2 and surface.is_chunk_generated({0,0}) then
|
||||
player.teleport(surface.find_non_colliding_position("character", {0, 0}, 50, 1), "territorial_control")
|
||||
@ -450,41 +421,38 @@ local function on_player_changed_position(event)
|
||||
end
|
||||
end
|
||||
|
||||
local function generate_spawn_area(position_left_top)
|
||||
local function generate_spawn_area(position_left_top)
|
||||
if position_left_top.x > 32 then return end
|
||||
if position_left_top.y > 32 then return end
|
||||
if position_left_top.x < -32 then return end
|
||||
if position_left_top.y < -32 then return end
|
||||
|
||||
|
||||
local surface = game.surfaces["territorial_control"]
|
||||
local entities = {}
|
||||
local tiles = {}
|
||||
|
||||
local tiles = {}
|
||||
for x = 0, 31, 1 do
|
||||
for y = 0, 31, 1 do
|
||||
local tile_to_insert = false
|
||||
local pos = {x = position_left_top.x + x, y = position_left_top.y + y}
|
||||
if pos.x > -9 and pos.x < 9 and pos.y > -9 and pos.y < 9 then
|
||||
tile_to_insert = get_noise_tile(pos)
|
||||
--if math_random(1, 4) == 1 then
|
||||
tile_to_insert = "stone-path"
|
||||
--end
|
||||
tile_to_insert = get_noise_tile(pos)
|
||||
tile_to_insert = "stone-path"
|
||||
if pos.x <= -7 or pos.x >= 7 or pos.y <= -7 or pos.y >= 7 then
|
||||
if math_random(1, 3) ~= 1 then
|
||||
table.insert(entities, {name = "stone-wall", position = {x = pos.x, y = pos.y}, force = "player"})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
if tile_to_insert == "water" or tile_to_insert == "deepwater" then
|
||||
tile_to_insert = "grass-2"
|
||||
end
|
||||
end
|
||||
if tile_to_insert then
|
||||
insert(tiles, {name = tile_to_insert, position = pos})
|
||||
end
|
||||
end
|
||||
end
|
||||
surface.set_tiles(tiles, true)
|
||||
|
||||
|
||||
for _, entity in pairs(entities) do
|
||||
surface.create_entity(entity)
|
||||
end
|
||||
@ -494,11 +462,11 @@ local function on_chunk_generated(event)
|
||||
if not game.surfaces["territorial_control"] then return end
|
||||
local surface = game.surfaces["territorial_control"]
|
||||
if surface.name ~= event.surface.name then return end
|
||||
|
||||
|
||||
local position_left_top = event.area.left_top
|
||||
generate_spawn_area(position_left_top)
|
||||
|
||||
local tiles = {}
|
||||
|
||||
local tiles = {}
|
||||
for x = 0, 31, 1 do
|
||||
for y = 0, 31, 1 do
|
||||
local tile_to_insert = "out-of-map"
|
||||
@ -508,20 +476,20 @@ local function on_chunk_generated(event)
|
||||
insert(tiles, {name = tile_to_insert, position = pos})
|
||||
end
|
||||
end
|
||||
end
|
||||
surface.set_tiles(tiles, true)
|
||||
end
|
||||
surface.set_tiles(tiles, true)
|
||||
end
|
||||
|
||||
local function on_player_mined_entity(event)
|
||||
local entity = event.entity
|
||||
if not entity.valid then return end
|
||||
|
||||
if entity.name == "mineable-wreckage" then
|
||||
if math_random(1,40) == 1 then unearthing_biters(entity.surface, entity.position, math_random(4,12)) end
|
||||
if math_random(1,80) == 1 then unearthing_worm(entity.surface, entity.position) end
|
||||
|
||||
if entity.name == "mineable-wreckage" then
|
||||
if math_random(1,40) == 1 then unearthing_biters(entity.surface, entity.position, math_random(4,12)) end
|
||||
if math_random(1,80) == 1 then unearthing_worm(entity.surface, entity.position) end
|
||||
if math_random(1,160) == 1 then tick_tack_trap(entity.surface, entity.position) end
|
||||
end
|
||||
|
||||
|
||||
if entity.force.name ~= "scrap" then return end
|
||||
local positions = {}
|
||||
local r = math.ceil(entity.prototype.max_health / 32)
|
||||
@ -537,27 +505,27 @@ local function on_player_mined_entity(event)
|
||||
unearthing_biters(entity.surface, positions[i], math_random(5,10))
|
||||
else
|
||||
unearthing_worm(entity.surface, positions[i])
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function on_entity_died(event)
|
||||
local surface = event.entity.surface
|
||||
|
||||
if event.entity.name == "biter-spawner" or event.entity.name == "spitter-spawner" then
|
||||
|
||||
if event.entity.name == "biter-spawner" or event.entity.name == "spitter-spawner" then
|
||||
if math_random(1, 2) ~= 1 then
|
||||
local name = ore_spawn_raffle[math.random(1,#ore_spawn_raffle)]
|
||||
local pos = {x = event.entity.position.x, y = event.entity.position.y}
|
||||
local pos = {x = event.entity.position.x, y = event.entity.position.y}
|
||||
local amount_modifier = math.ceil(1 + game.forces.enemy.evolution_factor * 10)
|
||||
local size_modifier = math.floor(game.forces.enemy.evolution_factor * 4)
|
||||
if name == "crude-oil" then
|
||||
if name == "crude-oil" then
|
||||
map_functions.draw_oil_circle(pos, name, surface, 4, math.ceil(100000 * amount_modifier))
|
||||
else
|
||||
else
|
||||
map_functions.draw_smoothed_out_ore_circle(pos, name, surface, 6 + size_modifier, math.ceil(500 * amount_modifier))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
if event.entity.type == "tree" or event.entity.name == "mineable-wreckage" or event.entity.type == "rock" then
|
||||
if math_random(1, 32) == 1 then
|
||||
spawn_biter(event.entity.surface, event.entity.position)
|
||||
@ -578,38 +546,49 @@ local disabled_for_deconstruction = {
|
||||
["tree-02-red"] = true,
|
||||
["tree-09-red"] = true
|
||||
}
|
||||
|
||||
local function on_marked_for_deconstruction(event)
|
||||
|
||||
local function on_marked_for_deconstruction(event)
|
||||
event.research.force.character_inventory_slots_bonus = game.forces.player.mining_drill_productivity_bonus * 300
|
||||
if disabled_for_deconstruction[event.entity.name] then
|
||||
event.entity.cancel_deconstruction(game.players[event.player_index].force.name)
|
||||
end
|
||||
end
|
||||
|
||||
local function on_research_finished(event)
|
||||
local function on_research_finished()
|
||||
game.forces.player.recipes["flamethrower-turret"].enabled = false
|
||||
end
|
||||
|
||||
local function on_tick()
|
||||
local function on_tick()
|
||||
if game.tick % 4500 ~= 0 then return end
|
||||
if math_random(1, 4) ~= 1 then return end
|
||||
|
||||
|
||||
local surface = game.surfaces["territorial_control"]
|
||||
|
||||
|
||||
local biters = surface.find_entities_filtered({type = "unit", force = "enemy", limit = 32})
|
||||
if biters[1] then
|
||||
biters = shuffle(biters)
|
||||
for _, biter in pairs(biters) do
|
||||
biter.set_command({type = defines.command.attack_area, destination = {x = 0, y = 0}, radius = 64, distraction = defines.distraction.by_anything})
|
||||
for _, biter in pairs(biters) do
|
||||
biter.set_command({type = defines.command.attack_area, destination = {x = 0, y = 0}, radius = 64, distraction = defines.distraction.by_anything})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
event.add(defines.events.on_tick, on_tick)
|
||||
event.add(defines.events.on_research_finished, on_research_finished)
|
||||
event.add(defines.events.on_marked_for_deconstruction, on_marked_for_deconstruction)
|
||||
event.add(defines.events.on_player_mined_entity, on_player_mined_entity)
|
||||
event.add(defines.events.on_entity_died, on_entity_died)
|
||||
event.add(defines.events.on_chunk_generated, on_chunk_generated)
|
||||
event.add(defines.events.on_player_changed_position, on_player_changed_position)
|
||||
event.add(defines.events.on_player_joined_game, on_player_joined_game)
|
||||
local function on_init()
|
||||
local T = Map.Pop_info()
|
||||
T.localised_category = "territorial_control"
|
||||
T.main_caption_color = {r = 150, g = 150, b = 0}
|
||||
T.sub_caption_color = {r = 0, g = 150, b = 0}
|
||||
global.rocks_yield_ore_maximum_amount = 999
|
||||
global.rocks_yield_ore_base_amount = 50
|
||||
global.rocks_yield_ore_distance_modifier = 0.025
|
||||
end
|
||||
|
||||
Event.on_init(on_init)
|
||||
Event.add(defines.events.on_tick, on_tick)
|
||||
Event.add(defines.events.on_research_finished, on_research_finished)
|
||||
Event.add(defines.events.on_marked_for_deconstruction, on_marked_for_deconstruction)
|
||||
Event.add(defines.events.on_player_mined_entity, on_player_mined_entity)
|
||||
Event.add(defines.events.on_entity_died, on_entity_died)
|
||||
Event.add(defines.events.on_chunk_generated, on_chunk_generated)
|
||||
Event.add(defines.events.on_player_changed_position, on_player_changed_position)
|
||||
Event.add(defines.events.on_player_joined_game, on_player_joined_game)
|
@ -1,79 +0,0 @@
|
||||
local event = require 'utils.event'
|
||||
|
||||
local info = [[
|
||||
Citizen Log #468-2A-3287, Freelancer Trent
|
||||
|
||||
To whoever is reading this message,
|
||||
|
||||
Any natural resources are rare and the ones worth while are too hard for me to reach.
|
||||
Luckily, the wrecks yield all kinds of useful scraps, but also various dangers.
|
||||
Almost lost half a leg some days ago while digging out some scrap.
|
||||
|
||||
The wildlife is extremely aggressive, especially at the time of night.
|
||||
Most of these insect appearing like creatures seem to live underground.
|
||||
Stay near your light sources, if you want to have a chance of surviving here!
|
||||
|
||||
###Log End###
|
||||
]]
|
||||
|
||||
local function create_map_intro_button(player)
|
||||
if player.gui.top["map_intro_button"] then return end
|
||||
local b = player.gui.top.add({type = "sprite-button", caption = "?", name = "map_intro_button", tooltip = "Map Info"})
|
||||
b.style.font_color = {r = 0.8, g = 0.8, b = 0.8}
|
||||
b.style.font = "heading-1"
|
||||
b.style.minimal_height = 38
|
||||
b.style.minimal_width = 38
|
||||
b.style.top_padding = 2
|
||||
b.style.left_padding = 4
|
||||
b.style.right_padding = 4
|
||||
b.style.bottom_padding = 2
|
||||
end
|
||||
|
||||
local function create_map_intro(player)
|
||||
if player.gui.left["map_intro_frame"] then player.gui.left["map_intro_frame"].destroy() end
|
||||
local frame = player.gui.left.add {type = "frame", name = "map_intro_frame", direction = "vertical"}
|
||||
|
||||
local t = frame.add {type = "table", column_count = 1}
|
||||
|
||||
local b = frame.add {type = "button", caption = "Close", name = "close_map_intro_frame", align = "right"}
|
||||
b.style.font = "default"
|
||||
b.style.minimal_height = 30
|
||||
b.style.minimal_width = 30
|
||||
b.style.top_padding = 2
|
||||
b.style.left_padding = 4
|
||||
b.style.right_padding = 4
|
||||
b.style.bottom_padding = 2
|
||||
|
||||
local frame = t.add {type = "frame"}
|
||||
local l = frame.add {type = "label", caption = info}
|
||||
l.style.single_line = false
|
||||
l.style.font = "heading-3"
|
||||
l.style.font_color = {r=0.95, g=0.95, b=0.95}
|
||||
end
|
||||
|
||||
local function on_player_joined_game(event)
|
||||
local player = game.players[event.player_index]
|
||||
create_map_intro_button(player)
|
||||
if player.online_time == 0 then
|
||||
create_map_intro(player)
|
||||
end
|
||||
end
|
||||
|
||||
local function on_gui_click(event)
|
||||
if not event then return end
|
||||
if not event.element then return end
|
||||
if not event.element.valid then return end
|
||||
local player = game.players[event.element.player_index]
|
||||
if event.element.name == "close_map_intro_frame" then player.gui.left["map_intro_frame"].destroy() return end
|
||||
if event.element.name == "map_intro_button" then
|
||||
if player.gui.left["map_intro_frame"] then
|
||||
player.gui.left["map_intro_frame"].destroy()
|
||||
else
|
||||
create_map_intro(player)
|
||||
end
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
event.add(defines.events.on_player_joined_game, on_player_joined_game)
|
||||
event.add(defines.events.on_gui_click, on_gui_click)
|
Loading…
x
Reference in New Issue
Block a user