1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-01-22 03:38:48 +02:00

Initial training mode to allow 1 or more players to train against their own biter feeding. Disabled South team from options and GUIs to avoid confusion.

This commit is contained in:
muppet9010 2019-10-27 15:06:30 +00:00
parent b453cd3301
commit 69f122147a
6 changed files with 22 additions and 6 deletions

View File

@ -275,9 +275,13 @@ end
ai.raise_evo = function()
if global.freeze_players then return end
if #game.forces.north.connected_players == 0 or #game.forces.south.connected_players == 0 then return end
if #game.forces.north.connected_players == 0 or (not bb_config.training_mode and #game.forces.south.connected_players == 0) then return end
local amount = math.ceil(global.difficulty_vote_value * global.evo_raise_counter)
for _, f in pairs({"north_biters", "south_biters"}) do
local biter_teams = {["north_biters"] = true, ["south_biters"] = true}
if bb_config.training_mode then
biter_teams["south_biters"] = nil
end
for f in pairs(biter_teams) do
set_evo_and_threat(amount, "automation-science-pack", f)
end
global.evo_raise_counter = global.evo_raise_counter + (1 * 0.50)

View File

@ -4,6 +4,7 @@ bb_config = {
--TEAM SETTINGS--
["team_balancing"] = true, --Should players only be able to join a team that has less or equal members than the opposing team?
["only_admins_vote"] = false, --Are only admins able to vote on the global difficulty?
['training_mode'] = true, --Players must join north team and all feeding affects their own biters. Southern team is disabled. Designed for 1 or more players to train aginst themselves.
--Optional custom team names, can also be modified via "Team Manager"
["north_side_team_name"] = "Team North",

View File

@ -17,6 +17,9 @@ local enemy_team_of = {
["north"] = "south",
["south"] = "north"
}
if bb_config.training_mode then
enemy_team_of["north"] = "north"
end

View File

@ -19,7 +19,10 @@ local gui_values = {
["south"] = {force = "south", biter_force = "south_biters", c1 = bb_config.south_side_team_name, c2 = "JOIN ", 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}}
}
}
if bb_config.training_mode then
gui_values["south"] = nil
end
local map_gen_messages = {
"Map is still generating, please get comfy.",
@ -229,7 +232,7 @@ function join_team(player, force_name, forced_join)
local enemy_team = "south"
if force_name == "south" then enemy_team = "north" end
if bb_config.team_balancing then
if not bb_config.training_mode and bb_config.team_balancing then
if not forced_join then
if #game.forces[force_name].connected_players > #game.forces[enemy_team].connected_players then
if not global.chosen_team[player.name] then

View File

@ -164,7 +164,7 @@ local function init_forces()
global.bb_threat_income[force.name] = 0
global.bb_threat[force.name] = 0
end
global.game_lobby_active = true
global.game_lobby_active = not bb_config.training_mode
end
local function on_player_joined_game(event)

View File

@ -3,6 +3,9 @@ local forces = {
{name = "spectator", color = {r = 111, g = 111, b = 111}},
{name = "south", color = {r = 200, g = 0, b = 0}},
}
if bb_config.training_mode then
forces[3] = nil
end
local function get_player_array(force_name)
local a = {}
@ -129,7 +132,8 @@ local function draw_manager_gui(player)
local frame = player.gui.center.add({type = "frame", name = "team_manager_gui", caption = "Manage Teams", direction = "vertical"})
local t = frame.add({type = "table", name = "team_manager_root_table", column_count = 5})
local column_count = (#forces * 2) - 1
local t = frame.add({type = "table", name = "team_manager_root_table", column_count = column_count})
local i2 = 1
for i = 1, #forces * 2 - 1, 1 do
@ -152,6 +156,7 @@ local function draw_manager_gui(player)
list_box.style.minimal_height = 360
list_box.style.minimal_width = 160
list_box.style.maximal_height = 480
list_box.style.maximal_width = 160
i2 = i2 + 1
else
local tt = t.add({type = "table", column_count = 1})