1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-03-11 14:49:24 +02:00
This commit is contained in:
MewMew 2019-03-24 05:21:55 +01:00
parent 9fbffd6d1a
commit 69a42a00ff
6 changed files with 41 additions and 23 deletions

View File

@ -8,7 +8,7 @@ local event = require 'utils.event'
local function init_surface()
local map_gen_settings = {}
map_gen_settings.water = "0.4"
map_gen_settings.water = "0.35"
map_gen_settings.starting_area = "5"
map_gen_settings.cliff_settings = {cliff_elevation_interval = 12, cliff_elevation_0 = 32}
map_gen_settings.autoplace_controls = {
@ -18,7 +18,7 @@ local function init_surface()
["iron-ore"] = {frequency = "3", size = "1.2", richness = "1"},
["uranium-ore"] = {frequency = "2", size = "1", richness = "1"},
["crude-oil"] = {frequency = "3", size = "1.2", richness = "1.5"},
["trees"] = {frequency = "1.1", size = "0.5", richness = "0.65"},
["trees"] = {frequency = "1.25", size = "0.5", richness = "0.65"},
["enemy-base"] = {frequency = "5.5", size = "2", richness = "2"}
}
game.create_surface("biter_battles", map_gen_settings)

View File

@ -18,10 +18,11 @@ local function create_victory_gui(player)
local values = gui_values[global.bb_game_won_by_team]
local frame = player.gui.left.add {type = "frame", name = "bb_victory_gui", direction = "vertical", caption = values.c1 .. " team has won!" }
frame.style.font = "heading-1"
frame.style.font_color = values.color1
if not global.results_to_discord then
server_commands.to_discord_embed(values.c1 .. " team has won!")
global.results_to_discord = true end
frame.style.font_color = values.color1
local l = frame.add {type = "label", caption = global.victory_time}
l.style.font = "heading-2"
l.style.font_color = {r = 0.77, g = 0.77, b = 0.77}
end
local function destroy_entity(e)
@ -111,7 +112,7 @@ local function create_fireworks_rocket(surface, position)
})
end
if math.random(1,12) ~= 1 then return end
if math.random(1,10) ~= 1 then return end
surface.create_entity({name = "explosion", position = position})
end
@ -291,12 +292,26 @@ local function server_restart()
end
end
local function set_victory_time()
local minutes = game.tick % 216000
local hours = game.tick - minutes
minutes = math.floor(minutes / 3600)
hours = math.floor(hours / 216000)
if hours > 0 then hours = hours .. " hours and " else hours = "" end
global.victory_time = "Time - " .. hours
global.victory_time = global.victory_time .. minutes
global.victory_time = global.victory_time .. " minutes"
end
local function on_entity_died(event)
if not event.entity.valid then return end
if event.entity.name ~= "rocket-silo" then return end
if global.bb_game_won_by_team then return end
if event.entity == global.rocket_silo.south or event.entity == global.rocket_silo.north then
global.bb_game_won_by_team = enemy_team_of[event.entity.force.name]
set_victory_time()
for _, player in pairs(game.connected_players) do
player.play_sound{path="utility/game_won", volume_modifier=1}
if player.gui.left["bb_main_gui"] then player.gui.left["bb_main_gui"].destroy() end
@ -310,8 +325,11 @@ local function on_entity_died(event)
game.forces["south"].set_friend("south_biters", true)
global.spy_fish_timeout["north"] = game.tick + 999999
global.spy_fish_timeout["south"] = game.tick + 999999
global.server_restart_timer = 180
global.server_restart_timer = 180
server_commands.to_discord_embed(gui_values[global.bb_game_won_by_team].c1 .. " team has won!")
server_commands.to_discord_embed(global.victory_time)
fireworks(event.entity.surface)
annihilate_base_v2(event.entity.position, event.entity.surface, event.entity.force.name)
end

View File

@ -15,7 +15,7 @@ local function shuffle(tbl)
return tbl
end
local function get_noise(name, pos)
local function get_noise(name, pos)
local seed = game.surfaces[1].map_gen_settings.seed
local noise_seed_add = 25000
if name == 1 then
@ -24,7 +24,8 @@ local function get_noise(name, pos)
seed = seed + noise_seed_add
noise[2] = simplex_noise(pos.x * 0.031, pos.y * 0.031, seed)
seed = seed + noise_seed_add
local noise = noise[1] + noise[2] * 0.08
noise[3] = simplex_noise(pos.x * 0.1, pos.y * 0.1, seed)
local noise = noise[1] + noise[2] * 0.08 + noise[3] * 0.035
return noise
end
if name == 2 then
@ -32,7 +33,6 @@ local function get_noise(name, pos)
noise[1] = simplex_noise(pos.x * 0.011, pos.y * 0.011, seed)
seed = seed + noise_seed_add
noise[2] = simplex_noise(pos.x * 0.08, pos.y * 0.08, seed)
seed = seed + noise_seed_add
local noise = noise[1] + noise[2] * 0.2
return noise
end
@ -41,7 +41,6 @@ local function get_noise(name, pos)
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.08, pos.y * 0.08, seed)
seed = seed + noise_seed_add
local noise = noise[1] + noise[2] * 0.1
return noise
end
@ -176,10 +175,12 @@ local function rainbow_ore_and_ponds(event)
if surface.can_place_entity({name = "iron-ore", position = pos}) then
local noise = get_noise(1, pos)
if noise > 0.83 then
local amount = math_random(1500, 2000) + math.sqrt(pos.x ^ 2 + pos.y ^ 2) * noise * 4
local i = math.ceil(math.abs(noise * 90)) % 4
local amount = math_random(500, 1000) + math.sqrt(pos.x ^ 2 + pos.y ^ 2) * 4
local m = (noise - 0.82) * 50
amount = amount * m
local i = math.ceil(math.abs(noise * 50)) % 4
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
if noise < -0.86 then
if noise < -0.92 then

View File

@ -6,15 +6,14 @@ local function on_player_joined_game(event)
if not global.new_player_equipped[player.name] then
player.insert({name = "raw-fish", count = 3})
player.insert({name = "iron-axe", count = 1})
player.insert({name = "iron-plate", count = 128})
player.insert({name = "iron-gear-wheel", count = 64})
player.insert({name = "copper-plate", count = 128})
player.insert({name = "copper-cable", count = 64})
player.insert({name = "pistol", count = 1})
player.insert({name = "firearm-magazine", count = 128})
player.insert({name = "firearm-magazine", count = 64})
player.insert({name = "shotgun", count = 1})
player.insert({name = "shotgun-shell", count = 32})
player.insert({name = "shotgun-shell", count = 16})
player.insert({name = "light-armor", count = 1})
global.new_player_equipped[player.name] = true

View File

@ -301,7 +301,7 @@ local function create_inner_content(surface, pos, noise)
end
return
end
if math_random(1, 750) == 1 then
if math_random(1, 650) == 1 then
if surface.can_place_entity({name = "biter-spawner", position = pos}) then
local distance_to_center = pos.x ^ 2 + pos.y ^ 2
if distance_to_center > 35000 then

View File

@ -93,7 +93,7 @@ local function init()
global.satellites_in_space = 0
global.satellite_score = {
{goal = 0, rank = false, achieved = true},
{goal = 1, rank = "Copper", color = {r = 201, g = 133, b = 6}, msg = "The first satellite has been launched!", msg2 = "However, this is only the beginning.", achieved = false},
{goal = 1, rank = "Copper", color = {r = 201, g = 133, b = 6}, msg = "", msg2 = "", achieved = false},
{goal = 10, rank = "Iron", color = {r = 219, g = 216, b = 206}, msg = "", msg2 = "", achieved = false},
{goal = 100, rank = "Bronze", color = {r = 186, g = 115, b = 39}, msg = "", msg2 = "", achieved = false},
{goal = 500, rank = "Silver", color = {r = 186, g = 178, b = 171}, msg = "", msg2 = "", achieved = false},
@ -119,9 +119,9 @@ local function on_player_joined_game(event)
local player = game.players[event.player_index]
satellite_score_toggle_button(player)
if player.gui.left["satellites_in_space"] then
if player.gui.left["satellites_in_space"] or global.satellites_in_space > 0 then
satellites_in_space_gui(player)
end
end
end
local function on_gui_click(event)