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

config options file

This commit is contained in:
MewMew 2019-04-28 19:38:44 +02:00
parent ad118c50b2
commit fc56ac32ce
5 changed files with 46 additions and 21 deletions

View File

@ -0,0 +1,17 @@
--BITER BATTLES CONFIG FILE--
local config = {
--MAP PREGENERATION
["map_pregeneration_radius"] = 32, --Radius in chunks to pregenerate at the start of the map.
["fast_pregen"] = true, --Force fast pregeneration.
--TEAM SETTINGS
["north_side_team_name"] = "North", --Name in the GUI of Team North.
["south_side_team_name"] = "South", --Name in the GUI of Team South.
["team_balancing"] = true, --Should players only be able to join a team that has less or equal members than the opposing team?
--TERRAIN OPTIONS
["border_river_width"] = 32 --Approximate width of the horizontal impassable river seperating the teams. (values up to 100)
}
return config

View File

@ -18,11 +18,12 @@ local enemy_team_of = {
["south"] = "north"
}
local minimum_modifier = 50
local maximum_modifier = 250
local player_amount_for_maximum_threat_gain = 20
function get_instant_threat_player_count_modifier()
local current_player_count = #game.forces.north.connected_players + #game.forces.south.connected_players
local minimum_modifier = 50
local maximum_modifier = 250
local player_amount_for_maximum_threat_gain = 20
local gain_per_player = (maximum_modifier - minimum_modifier) / player_amount_for_maximum_threat_gain
local m = minimum_modifier + gain_per_player * current_player_count
if m > maximum_modifier then m = maximum_modifier end

View File

@ -1,5 +1,5 @@
local event = require 'utils.event'
local config = require "maps.biter_battles_v2.config"
local spy_fish = require "maps.biter_battles_v2.spy_fish"
local feed_the_biters = require "maps.biter_battles_v2.feeding"
@ -14,10 +14,10 @@ local food_names = {
}
local gui_values = {
["north"] = {force = "north", biter_force = "north_biters", c1 = "Team North", c2 = "JOIN NORTH", n1 = "join_north_button",
["north"] = {force = "north", biter_force = "north_biters", c1 = "Team " .. config.north_side_team_name, c2 = "JOIN " .. string.upper(config.north_side_team_name), n1 = "join_north_button",
t1 = "Evolution of the North side biters. Can go beyond 100% for endgame modifiers.",
t2 = "Threat causes biters to attack. Reduces when biters are slain.", color1 = {r = 0.55, g = 0.55, b = 0.99}, color2 = {r = 0.66, g = 0.66, b = 0.99}},
["south"] = {force = "south", biter_force = "south_biters", c1 = "Team South", c2 = "JOIN SOUTH", n1 = "join_south_button",
["south"] = {force = "south", biter_force = "south_biters", c1 = "Team " .. config.south_side_team_name, c2 = "JOIN " .. string.upper(config.south_side_team_name), n1 = "join_south_button",
t1 = "Evolution of the South side biters. Can go beyond 100% for endgame modifiers.",
t2 = "Threat causes biters to attack. Reduces when biters are slain.", color1 = {r = 0.99, g = 0.33, b = 0.33}, color2 = {r = 0.99, g = 0.44, b = 0.44}}
}
@ -222,10 +222,12 @@ local function join_team(player, force_name)
local enemy_team = "south"
if force_name == "south" then enemy_team = "north" end
if #game.forces[force_name].connected_players > #game.forces[enemy_team].connected_players then
if not global.chosen_team[player.name] then
player.print("Team " .. force_name .. " has too many players currently.", {r = 0.98, g = 0.66, b = 0.22})
return
if config.team_balancing then
if #game.forces[force_name].connected_players > #game.forces[enemy_team].connected_players then
if not global.chosen_team[player.name] then
player.print("Team " .. force_name .. " has too many players currently.", {r = 0.98, g = 0.66, b = 0.22})
return
end
end
end

View File

@ -1,4 +1,5 @@
local event = require 'utils.event'
local config = require "maps.biter_battles_v2.config"
local function set_chunk_coords(radius)
global.chunk_gen_coords = {}
@ -47,7 +48,7 @@ end
local function process_chunk(surface)
if global.map_generation_complete then return end
if game.tick < 300 then return end
if not global.chunk_gen_coords then set_chunk_coords(32) end
if not global.chunk_gen_coords then set_chunk_coords(config.map_pregeneration_radius) end
if #global.chunk_gen_coords == 0 then
global.map_generation_complete = true
draw_gui()
@ -61,6 +62,9 @@ local function process_chunk(surface)
local surface = game.surfaces["biter_battles"]
if not surface then return end
local force_chunk_requests = 1
if config.fast_pregen then force_chunk_requests = 16 end
for i = #global.chunk_gen_coords, 1, -1 do
if surface.is_chunk_generated(global.chunk_gen_coords[i]) then
global.chunk_gen_coords[i] = nil
@ -68,7 +72,10 @@ local function process_chunk(surface)
surface.request_to_generate_chunks({x = (global.chunk_gen_coords[i].x * 32) - 16, y = (global.chunk_gen_coords[i].y * 32) - 16}, 1)
surface.force_generate_chunk_requests()
global.chunk_gen_coords[i] = nil
break
force_chunk_requests = force_chunk_requests - 1
if force_chunk_requests <= 0 then
break
end
end
end
draw_gui()

View File

@ -1,5 +1,5 @@
-- Terrain for Biter Battles -- by MewMew
local event = require 'utils.event'
local event = require 'utils.event'
local config = require "maps.biter_battles_v2.config"
local math_random = math.random
local simplex_noise = require 'utils.simplex_noise'.d2
local create_tile_chain = require "functions.create_tile_chain"
@ -77,11 +77,9 @@ local function draw_noise_ore_patch(position, name, surface, radius, richness)
end
end
local function generate_horizontal_river(surface, pos)
if pos.y < -32 then return false end
local function is_horizontal_border_river(surface, pos)
if pos.y > -5 and pos.x > -5 and pos.x < 5 then return false end
--if -11 < pos.y + (get_noise(1, pos) * 5) then return true end
if -14 < pos.y + (get_noise(1, pos) * 5) then return true end
if math.floor(config.border_river_width * -0.5) < pos.y + (get_noise(1, pos) * 5) then return true end
return false
end
@ -149,7 +147,7 @@ local function generate_silos(event)
end
local function generate_river(event)
if event.area.left_top.y < -32 then return end
if event.area.left_top.y < -64 then return end
local surface = event.surface
local left_top_x = event.area.left_top.x
local left_top_y = event.area.left_top.y
@ -157,7 +155,7 @@ local function generate_river(event)
for y = 0, 31, 1 do
local pos = {x = left_top_x + x, y = left_top_y + y}
local distance_to_center = math.sqrt(pos.x ^ 2 + pos.y ^ 2)
if generate_horizontal_river(surface, pos) then
if is_horizontal_border_river(surface, pos) then
surface.set_tiles({{name = "deepwater", position = pos}})
if math_random(1, 64) == 1 then surface.create_entity({name = "fish", position = pos}) end
end
@ -259,7 +257,7 @@ local function restrict_landfill(surface, inventory, tiles)
local distance_to_center = math.sqrt(t.position.x ^ 2 + t.position.y ^ 2)
local check_position = t.position
if check_position.y > 0 then check_position = {x = check_position.x * -1, y = (check_position.y * -1) - 1} end
if generate_horizontal_river(surface, check_position) or distance_to_center < spawn_circle_size then
if is_horizontal_border_river(surface, check_position) or distance_to_center < spawn_circle_size then
surface.set_tiles({{name = t.old_tile.name, position = t.position}}, true)
inventory.insert({name = "landfill", count = 1})
end