1
0
mirror of https://github.com/Oarcinae/FactorioScenarioMultiplayerSpawn.git synced 2024-12-04 09:43:00 +02:00

More settings tab and info tab work done.

This commit is contained in:
Oarcinae 2024-09-07 07:00:29 -04:00
parent e278f216c0
commit 01d41297ba
13 changed files with 219 additions and 223 deletions

View File

@ -128,8 +128,8 @@ script.on_event(defines.events.on_tick, function(event)
if global.ocfg.regrowth.enable_regrowth then
RegrowthOnTick()
RegrowthForceRemovalOnTick()
end
RegrowthForceRemovalOnTick() -- Allows for abandoned base cleanup without regrowth enabled.
end)
----------------------------------------

View File

@ -2,7 +2,7 @@
ACTIVE ITEMS:
- Change regrowth to be list of surfaces indexed by surface name?
- Add warning for modifying surface settings after gameplay has started
- Ensure updates to regrowth surfaces don't cause errors (update indexes)
- Make disable main team setting work (hide radio button)
@ -10,7 +10,7 @@ ACTIVE ITEMS:
10. Tooltips for GUI elements in spawn menu options!
13. Add regrowth settings GUI tab? Not sure how the other settings fit in with a dedicated regrowth tab? Need to be able to enable/disable other surfaces during runtime?
14. Check all settings to see which CAN'T be changed during runtime. Possibly move these to startup.
16. Support run time toggling of enable_spawning_on_other_surfaces
16.
17. Support run time toggling of enable_shared_team_vision
18. Support run time toggling of enable_friendly_fire
19. Support run time toggling of main_force_name
@ -32,6 +32,15 @@ Other Ideas, Not Committed:
- Change enable_shared_team_vision to allow players to change this per player (like BNO)
- Change enable_friendly_fire to be per team?
- Allow players to spawn "near" an existing player (by request)
- Change enable_spawning_on_other_surfaces to a start up setting?
------------------------------------------------------SPACE AGE---------------------------------------------------------
- Map Settings changes?
- Pollution changes (regrowth)?
- Enemy changes?
- Rocket silo locations per player? (Only allowed to build 1)?
- Surface names for space ships?
--------------------------------------------------------DONE------------------------------------------------------------
@ -56,4 +65,5 @@ Other Ideas, Not Committed:
23. Refresh the spawn controls GUI when player accepts/rejects
15. Redo FindUngeneratedCoordinates to pick a random direction, and use the distance to get a starting point, instead of multiple tries.
26. Fix all GUI styling (buttons outside of content)
20. Force enable_world_eater to require enable_regrowth
20. Force enable_world_eater to require enable_regrowth
- Add warning for modifying surface settings after gameplay has started

View File

@ -170,10 +170,10 @@ OCFG = {
-- Server Info - This stuff is shown in the welcome GUI and Info panel.
---@type OarcConfigServerInfo
server_info = {
server_msg = "Rules: Be polite. Ask before changing other players's stuff. Have fun!\n"..
"This server is running a custom mod that allows individual starting areas on the map.",
welcome_msg_title = "OARC V2 - TEST SERVER",
welcome_msg = "TEMPORARY BETA TESTING OF V2 MOD!", -- Printed to player on join as well.
server_msg = "YOUR SERVER MSG HERE",
welcome_msg_title = "YOUR SERVER TITLE HERE",
welcome_msg = "YOUR WELCOME MSG HERE", -- Printed to player on join as well.
discord_invite = "YOUR DISCORD INVITE HERE"
},
-- General gameplay related settings that I didn't want to expose in the mod settings since these should
@ -334,6 +334,7 @@ OCFG = {
---@field welcome_msg_title string Title of welcome GUI window.
---@field welcome_msg string Main welcome message. (Should provide mod info.)
---@field server_msg string Server specific message. (Rules, etc.)
---@field discord_invite string Discord invite for easy copy paste.
---@class OarcConfigGameplaySettings
---@field enable_main_team boolean Allows all players to join a primary force(team).

View File

@ -10,11 +10,12 @@ OCFG_KEYS =
["server_info.welcome_msg_title"] = {mod_key = "oarc-mod-welcome-msg-title" , ocfg_keys = {"server_info", "welcome_msg_title"}, type = "string"},
["server_info.server_msg"] = {mod_key = "oarc-mod-server-msg" , ocfg_keys = {"server_info", "server_msg"}, type = "string"},
["server_info.welcome_msg"] = {mod_key = "oarc-mod-welcome-msg" , ocfg_keys = {"server_info", "welcome_msg"}, type = "string"},
["server_info.discord_invite"] = {mod_key = "oarc-mod-discord-invite" , ocfg_keys = {"server_info", "discord_invite"}, type = "string"},
["Gameplay"] = {mod_key = "" , ocfg_keys = {""}, type = "header"},
["gameplay.enable_main_team"] = {mod_key = "oarc-mod-enable-main-team" , ocfg_keys = {"gameplay", "enable_main_team"}, type = "boolean"},
["gameplay.enable_separate_teams"] = {mod_key = "oarc-mod-enable-separate-teams" , ocfg_keys = {"gameplay", "enable_separate_teams"}, type = "boolean"},
["gameplay.enable_spawning_on_other_surfaces"] = {mod_key = "oarc-mod-enable-spawning-on-other-surfaces" , ocfg_keys = {"gameplay", "enable_spawning_on_other_surfaces"}, type = "boolean"},
-- ["gameplay.enable_spawning_on_other_surfaces"] = {mod_key = "oarc-mod-enable-spawning-on-other-surfaces" , ocfg_keys = {"gameplay", "enable_spawning_on_other_surfaces"}, type = "boolean"},
["gameplay.allow_moats_around_spawns"] = {mod_key = "oarc-mod-allow-moats-around-spawns" , ocfg_keys = {"gameplay", "allow_moats_around_spawns"}, type = "boolean"},
["gameplay.enable_moat_bridging"] = {mod_key = "oarc-mod-enable-moat-bridging" , ocfg_keys = {"gameplay", "enable_moat_bridging"}, type = "boolean"},
["gameplay.minimum_distance_to_existing_chunks"] = {mod_key = "oarc-mod-minimum-distance-to-existing-chunks" , ocfg_keys = {"gameplay", "minimum_distance_to_existing_chunks"}, type = "integer"},
@ -120,7 +121,7 @@ end
---@return nil
function RuntimeModSettingChanged(event)
log("on_runtime_mod_setting_changed" .. event.setting)
log("on_runtime_mod_setting_changed: " .. event.setting)
-- Find the matching OARC setting and update it.
local found_setting = false

View File

@ -0,0 +1,32 @@
-- Contains the GUI for the regrowth controls tab.
---Used by AddOarcGuiTab
---@param tab_container LuaGuiElement
---@param player LuaPlayer
---@return nil
function CreateModInfoTab(tab_container, player)
AddLabel(tab_container, nil, "Mod Info & FAQ", my_label_header2_style)
AddSpacerLine(tab_container)
CreateFAQEntry(tab_container, { "oarc-mod-faq-what-is-this-mod" }, { "oarc-mod-faq-what-is-this-mod-answer" })
CreateFAQEntry(tab_container, { "oarc-mod-faq-other-surfaces" }, { "oarc-mod-faq-other-surfaces-answer" })
CreateFAQEntry(tab_container, { "oarc-mod-faq-what-are-teams" }, { "oarc-mod-faq-what-are-teams-answer" })
CreateFAQEntry(tab_container, { "oarc-mod-faq-shared-spawn" }, { "oarc-mod-faq-shared-spawn-answer" })
CreateFAQEntry(tab_container, { "oarc-mod-faq-buddy-spawn" }, { "oarc-mod-faq-buddy-spawn-answer" })
CreateFAQEntry(tab_container, { "oarc-mod-faq-regrowth" }, { "oarc-mod-faq-regrowth-answer" })
CreateFAQEntry(tab_container, { "oarc-mod-faq-cleanup-abandoned" }, { "oarc-mod-faq-cleanup-abandoned-answer" })
CreateFAQEntry(tab_container, { "oarc-mod-faq-offline-protection" }, { "oarc-mod-faq-offline-protection-answer" })
end
---Creates a FAQ entry in the tab
---@param tab_container LuaGuiElement
---@param question LocalisedString
---@param answer LocalisedString
---@return nil
function CreateFAQEntry(tab_container, question, answer)
AddLabel(tab_container, nil, question, "caption_label")
AddLabel(tab_container, nil, answer, my_longer_label_style)
AddSpacerLine(tab_container)
end

View File

@ -1,63 +0,0 @@
-- Contains the GUI for the regrowth controls tab.
---Used by AddOarcGuiTab
---@param tab_container LuaGuiElement
---@param player LuaPlayer
---@return nil
function CreateRegrowthControlsTab(tab_container, player)
--- Create a table with 3 columns. Surface Name, Spawning Enabled, Regrowth Enabled
local surface_table = tab_container.add {
type = "table",
name = "surface_table",
column_count = 3,
-- draw_horizontal_lines = true,
-- draw_vertical_lines = true,
-- draw_vertical_line_after_headers = true,
style = "bordered_table",
}
--- Add the header row
AddLabel(surface_table, nil, "Surface", "caption_label")
AddLabel(surface_table, nil, "Spawning Enabled", "caption_label")
AddLabel(surface_table, nil, "Regrowth Enabled", "caption_label")
--- Add the rows
for name, enabled in pairs(global.ocore.surfaces --[[@as table<string, boolean>]]) do
AddLabel(surface_table, nil, name, my_label_style)
AddSurfaceCheckboxSetting(surface_table, name, "spawn_enabled", enabled)
-- AddSurfaceCheckboxSetting(surface_table, name, "regrowth_enabled", TableContains(global.rg.active_surfaces, name))
-- AddCheckbox(surface_table, nil, surface_name.."_spawn_enabled", surface.spawn_enabled)
-- AddCheckbox(surface_table, nil, surface_name.."_regrowth_enabled", surface.regrowth_enabled)
end
-- AddLabel(tab_container, nil, "test regrowth message my_label_style", my_label_style)
-- AddLabel(tab_container, nil, "test regrowth message my_label_header_style", my_label_header_style)
-- AddLabel(tab_container, nil, "test regrowth message my_label_header_grey_style", my_label_header_grey_style)
-- AddLabel(tab_container, nil, "test regrowth message my_note_style", my_note_style)
-- AddLabel(tab_container, nil, "test regrowth message my_warning_style", my_warning_style)
-- AddLabel(tab_container, nil, "test regrowth message my_longer_label_style", my_longer_label_style)
end
---Creates a checkbox setting for surface related settings.
---@param parent LuaGuiElement
---@param surface_name string
---@param setting_name string
---@param state boolean
---@return nil
function AddSurfaceCheckboxSetting(parent, surface_name, setting_name, state)
parent.add{
type = "checkbox",
-- caption = { "mod-setting-name."..entry.mod_key },
state = state,
-- enabled = enabled,
-- tooltip = { "mod-setting-description."..entry.mod_key },
tags = { action = "oarc_surfaces_tab", setting = setting_name, surface = surface_name },
}
end

View File

@ -58,69 +58,84 @@ end
---@return nil
function CreateServerInfoTab(tab_container, player)
if global.oarc_announcements ~= nil then
AddLabel(tab_container, "announcement_info_label", "Server announcements:", my_label_header_style)
AddLabel(tab_container, "announcement_info_txt", "global.oarc_announcements", my_longer_label_style)
-- if global.oarc_announcements ~= nil then
-- AddLabel(tab_container, "announcement_info_label", "Server announcements:", my_label_header_style)
-- AddLabel(tab_container, "announcement_info_txt", "global.oarc_announcements", my_longer_label_style)
-- AddSpacerLine(tab_container)
-- end
-- General Server Info:
if (global.ocfg.server_info.welcome_msg ~= "") then
AddLabel(tab_container, nil, "Welcome Message", "caption_label")
AddLabel(tab_container, nil, global.ocfg.server_info.welcome_msg, my_longer_label_style)
AddSpacerLine(tab_container)
end
if (global.ocfg.server_info.server_msg ~= "") then
AddLabel(tab_container, nil, "Server Message", "caption_label")
AddLabel(tab_container, nil, global.ocfg.server_info.server_msg, my_longer_label_style)
AddSpacerLine(tab_container)
end
-- General Server Info:
AddLabel(tab_container, "info_1", "global.ocfg.welcome_msg", my_longer_label_style)
AddLabel(tab_container, "info_2", "global.ocfg.server_rules", my_longer_label_style)
AddLabel(tab_container, "info_3", "global.ocfg.server_contact", my_longer_label_style)
tab_container.add{type="textfield",
tooltip="Come join the discord (copy this invite)!",
text="DISCORD_INV"}
AddSpacerLine(tab_container)
if (global.ocfg.server_info.discord_invite ~= "") then
local horizontal_flow = tab_container.add{
type="flow", direction="horizontal"
}
AddLabel(horizontal_flow, nil, "Discord Invite:", "caption_label")
horizontal_flow.add{
type="textfield",
tooltip="Come join the discord (copy this invite)!",
text=global.ocfg.server_info.discord_invite
}
AddSpacerLine(tab_container)
end
-- Enemy Settings:
local enemy_expansion_txt = "disabled"
if game.map_settings.enemy_expansion.enabled then enemy_expansion_txt = "enabled" end
local enemy_text="Server Run Time: " .. FormatTimeHoursSecs(game.tick) .. "\n" ..
"Current Evolution: " .. string.format("%.4f", game.forces["enemy"].evolution_factor) .. "\n" ..
"Enemy evolution time/pollution/destroy factors: " .. game.map_settings.enemy_evolution.time_factor .. "/" ..
game.map_settings.enemy_evolution.pollution_factor .. "/" ..
game.map_settings.enemy_evolution.destroy_factor .. "\n" ..
-- "Current Evolution: " .. string.format("%.4f", game.forces["enemy"].evolution_factor) .. "\n" ..
-- "Enemy evolution time/pollution/destroy factors: " .. game.map_settings.enemy_evolution.time_factor .. "/" ..
-- game.map_settings.enemy_evolution.pollution_factor .. "/" ..
-- game.map_settings.enemy_evolution.destroy_factor .. "\n" ..
"Enemy expansion is " .. enemy_expansion_txt
AddLabel(tab_container, nil, "Map Info", my_label_header2_style)
AddLabel(tab_container, "enemy_info", enemy_text, my_longer_label_style)
AddSpacerLine(tab_container)
-- AddSpacerLine(tab_container)
-- Soft Mods:
local soft_mods_string = "Oarc Core"
-- local soft_mods_string = "Oarc Core"
if (global.ocfg.regrowth.enable_regrowth) then
soft_mods_string = soft_mods_string .. ", Regrowth"
end
if (global.ocfg.gameplay.enable_offline_protection) then
soft_mods_string = soft_mods_string .. ", Offline Attack Inhibitor"
end
-- if (global.ocfg.regrowth.enable_regrowth) then
-- soft_mods_string = soft_mods_string .. ", Regrowth"
-- end
-- if (global.ocfg.gameplay.enable_offline_protection) then
-- soft_mods_string = soft_mods_string .. ", Offline Attack Inhibitor"
-- end
local game_info_str = "Soft Mods: " .. soft_mods_string
-- local game_info_str = "Soft Mods: " .. soft_mods_string
-- Spawn options:
if (global.ocfg.gameplay.enable_separate_teams) then
game_info_str = game_info_str.."\n".."You are allowed to spawn on your own team (have your own research tree). All teams are friendly!"
end
-- if (global.ocfg.enable_vanilla_spawns) then
-- game_info_str = game_info_str.."\n".."You are spawned in a default style starting area."
-- else
game_info_str = game_info_str.."\n".."You are spawned with a fix set of starting resources."
if (global.ocfg.gameplay.enable_buddy_spawn) then
game_info_str = game_info_str.."\n".."You can chose to spawn alongside a buddy if you spawn together at the same time."
end
-- if (global.ocfg.gameplay.enable_separate_teams) then
-- game_info_str = game_info_str.."\n".."You are allowed to spawn on your own team (have your own research tree). All teams are friendly!"
-- end
-- game_info_str = game_info_str.."\n".."You are spawned with a fix set of starting resources."
-- if (global.ocfg.gameplay.enable_buddy_spawn) then
-- game_info_str = game_info_str.."\n".."You can chose to spawn alongside a buddy if you spawn together at the same time."
-- end
-- -- end
-- if (global.ocfg.gameplay.enable_shared_spawns) then
-- game_info_str = game_info_str.."\n".."Spawn hosts may choose to share their spawn and allow other players to join them."
-- end
-- if (global.ocfg.gameplay.enable_separate_teams and global.ocfg.gameplay.enable_shared_team_vision) then
-- game_info_str = game_info_str.."\n".."Everyone (all teams) have shared vision."
-- end
if (global.ocfg.gameplay.enable_shared_spawns) then
game_info_str = game_info_str.."\n".."Spawn hosts may choose to share their spawn and allow other players to join them."
end
if (global.ocfg.gameplay.enable_separate_teams and global.ocfg.gameplay.enable_shared_team_vision) then
game_info_str = game_info_str.."\n".."Everyone (all teams) have shared vision."
end
if (global.ocfg.gameplay.enable_regrowth) then
game_info_str = game_info_str.."\n".."Old parts of the map will slowly be deleted over time (chunks without any player buildings)."
end
-- if (global.ocfg.gameplay.enable_regrowth) then
-- game_info_str = game_info_str.."\n".."Old parts of the map will slowly be deleted over time (chunks without any player buildings)."
-- end
-- if (global.ocfg.enable_power_armor_start or global.ocfg.enable_modular_armor_start) then
-- game_info_str = game_info_str.."\n".."Quicker start enabled."
-- end
@ -130,9 +145,9 @@ function CreateServerInfoTab(tab_container, player)
AddLabel(tab_container, "game_info_label", game_info_str, my_longer_label_style)
-- AddLabel(tab_container, "game_info_label", game_info_str, my_longer_label_style)
if (global.ocfg.gameplay.enable_abandoned_base_removal) then
if (global.ocfg.regrowth.enable_abandoned_base_cleanup) then
AddLabel(tab_container, "leave_warning_msg", "If you leave within " .. global.ocfg.gameplay.minimum_online_time .. " minutes of joining, your base and character will be deleted.", my_longer_label_style)
tab_container.leave_warning_msg.style.font_color=my_color_red
end
@ -147,21 +162,20 @@ function CreateServerInfoTab(tab_container, player)
table.insert(player_list, player.name)
end
AddLabel(tab_container, nil, "Admin Controls:", my_label_header_style)
AddLabel(tab_container, nil, "Admin Controls", my_label_header2_style)
local horizontal_flow = tab_container.add{
type="flow", direction="horizontal"
}
horizontal_flow.style.horizontally_stretchable = true
local label = AddLabel(horizontal_flow, nil, "Select Player:", my_label_style) --TODO: localize
local dropdown = horizontal_flow.add{
AddLabel(horizontal_flow, nil, "Select Player:", my_label_style) --TODO: localize
horizontal_flow.add{
name = "ban_players_dropdown",
tags = { action = "oarc_server_info_tab", setting = "ban_players_dropdown" },
type = "drop-down",
items = player_list
}
-- dropdown.style.horizontal_align = "left"
local dragger = horizontal_flow.add{
type="empty-widget",
@ -169,21 +183,19 @@ function CreateServerInfoTab(tab_container, player)
}
dragger.style.horizontally_stretchable = true
local ban_button = horizontal_flow.add{
horizontal_flow.add{
name="ban_player",
tags = { action = "oarc_server_info_tab", setting = "ban_player" },
type="button",
caption="Ban Player",
style = "red_button"
}
-- ban_button.style.horizontal_align = "right"
local reset_button = horizontal_flow.add{
horizontal_flow.add{
name="restart_player",
tags = { action = "oarc_server_info_tab", setting = "restart_player" },
type="button",
caption="Restart Player",
style = "red_button"
}
-- reset_button.style.horizontal_align = "right"
end
end

View File

@ -8,6 +8,9 @@ function CreateSettingsControlsTab(tab_container, player)
if (player.admin) then
local label = AddLabel(tab_container, nil, { "oarc-settings-tab-admin-warning" }, my_warning_style)
label.style.padding = 5
else
local label = AddLabel(tab_container, nil, { "oarc-settings-tab-player-warning" }, my_warning_style)
label.style.padding = 5
end
local horizontal_flow = tab_container.add { type = "flow", direction = "horizontal", }
@ -74,9 +77,9 @@ function CreateSurfaceSettingsSection(container, player)
AddLabel(surface_table, nil, "Spawning Enabled", "caption_label")
--- Add the rows
for name, enabled in pairs(global.ocore.surfaces --[[@as table<string, boolean>]]) do
for name, allowed in pairs(global.ocore.surfaces --[[@as table<string, boolean>]]) do
AddLabel(surface_table, nil, name, my_label_style)
AddSurfaceCheckboxSetting(surface_table, name, "spawn_enabled", enabled)
AddSurfaceCheckboxSetting(surface_table, name, "spawn_enabled", allowed, player.admin)
end
end
@ -92,7 +95,6 @@ function SettingsControlsTabGuiClick(event)
local entry = OCFG_KEYS[index]
if (entry.type == "boolean") then
SetGlobalOarcConfigUsingKeyTable(entry.ocfg_keys, gui_elem.state)
settings.global[entry.mod_key] = { value = gui_elem.state }
end
end
@ -109,7 +111,6 @@ function SettingsControlsTabGuiTextChanged(event)
local entry = OCFG_KEYS[index]
if (entry.type == "string") or (entry.type == "integer") then
SetGlobalOarcConfigUsingKeyTable(entry.ocfg_keys, gui_elem.text)
settings.global[entry.mod_key] = { value = gui_elem.text }
end
end
@ -198,13 +199,15 @@ end
---@param surface_name string
---@param setting_name string
---@param state boolean
---@param admin boolean
---@return nil
function AddSurfaceCheckboxSetting(parent, surface_name, setting_name, state)
function AddSurfaceCheckboxSetting(parent, surface_name, setting_name, state, admin)
parent.add{
name = surface_name.."_"..setting_name,
type = "checkbox",
state = state,
tags = { action = "oarc_settings_tab_surfaces", setting = setting_name, surface = surface_name },
enabled = admin
}
end

View File

@ -3,8 +3,8 @@
local mod_gui = require("mod-gui")
require("lib/gui_tabs/server_info")
require("lib/gui_tabs/spawn_controls")
require("lib/gui_tabs/regrowth_controls")
require("lib/gui_tabs/settings_controls")
require("lib/gui_tabs/mod_info_faq")
--------------------------------------------------------------------------------
-- GUI Tab Handler
@ -16,14 +16,14 @@ OARC_GUI = "oarc_gui"
-- LIST of all implemented tabs and their content Functions
OARC_SERVER_INFO_TAB_NAME = "Server Info"
OARC_SPAWN_CTRL_TAB_NAME = "Spawn Controls"
OARC_REGROWTH_CTRL_TAB_NAME = "Regrowth"
OARC_CONFIG_CTRL_TAB_NAME = "Settings"
OARC_MOD_INFO_CTRL_TAB_NAME = "Mod Info"
local OARC_GUI_TAB_CONTENT_FUNCTIONS = {
[OARC_SERVER_INFO_TAB_NAME] = CreateServerInfoTab,
[OARC_SPAWN_CTRL_TAB_NAME] = CreateSpawnControlsTab,
[OARC_REGROWTH_CTRL_TAB_NAME] = CreateRegrowthControlsTab,
[OARC_MOD_INFO_CTRL_TAB_NAME] = CreateModInfoTab,
[OARC_CONFIG_CTRL_TAB_NAME] = CreateSettingsControlsTab,
}
@ -46,8 +46,8 @@ function InitOarcGuiTabs(player)
AddOarcGuiTab(player, OARC_SPAWN_CTRL_TAB_NAME)
-- Regrowth control tab
AddOarcGuiTab(player, OARC_REGROWTH_CTRL_TAB_NAME)
SetOarcGuiTabEnabled(player, OARC_REGROWTH_CTRL_TAB_NAME, true)
AddOarcGuiTab(player, OARC_MOD_INFO_CTRL_TAB_NAME)
SetOarcGuiTabEnabled(player, OARC_MOD_INFO_CTRL_TAB_NAME, true)
-- Settings control tab
if (player.admin) then

View File

@ -41,16 +41,20 @@ function DisplayWelcomeTextGui(player)
}
-- Start with server message.
AddLabel(welcome_gui_if, nil, global.ocfg.server_info.server_msg, my_label_style)
-- AddLabel(wGui, "contact_info_msg_lbl1", global.ocfg.server_contact, my_label_style)
AddSpacer(welcome_gui_if)
if (global.ocfg.server_info.server_msg ~= "") then
AddLabel(welcome_gui_if, nil, global.ocfg.server_info.server_msg, my_label_style)
-- AddLabel(wGui, "contact_info_msg_lbl1", global.ocfg.server_contact, my_label_style)
AddSpacer(welcome_gui_if)
end
-- Informational message about the scenario
AddLabel(welcome_gui_if, nil, global.ocfg.server_info.welcome_msg, my_label_style)
AddSpacer(welcome_gui_if)
if (global.ocfg.server_info.welcome_msg ~= "") then
AddLabel(welcome_gui_if, nil, global.ocfg.server_info.welcome_msg, my_label_style)
AddSpacer(welcome_gui_if)
end
-- Warnings about the scenario
AddLabel(welcome_gui_if, nil, { "oarc-scenario-warning-msg" }, my_note_style)
AddLabel(welcome_gui_if, nil, { "oarc-scenario-info-warn-msg" }, my_note_style)
-- Confirm button
local button_flow = welcome_gui.add {
@ -152,39 +156,38 @@ end
---Display the team select radio buttons
---@param parent_flow LuaGuiElement
---@param enable_main_team boolean
---@param enable_separate_teams boolean
---@param enable_buddy_spawn boolean
---@return nil
function DisplayTeamSelectRadioButtons(parent_flow, enable_separate_teams, enable_buddy_spawn)
local main_team_radio = parent_flow.add {
name = "isolated_spawn_main_team_radio",
tags = { action = "oarc_spawn_options", setting = "team_select", value = SPAWN_TEAM_CHOICE.join_main_team },
type = "radiobutton",
caption = { "oarc-join-main-team-radio" },
state = true
}
function DisplayTeamSelectRadioButtons(parent_flow, enable_main_team, enable_separate_teams)
if enable_main_team then
local main_team_radio = parent_flow.add {
name = "isolated_spawn_main_team_radio",
tags = { action = "oarc_spawn_options", setting = "team_select", value = SPAWN_TEAM_CHOICE.join_main_team },
type = "radiobutton",
caption = { "oarc-join-main-team-radio" },
state = true
}
if not enable_separate_teams then
-- If separate teams are not enabled, default to joining the main team, and disable the radio buttons.
main_team_radio.ignored_by_interaction = true
main_team_radio.enabled = false
end
end
if (enable_separate_teams) then
parent_flow.add {
local separate_teams_radio = parent_flow.add {
name = "isolated_spawn_new_team_radio",
tags = { action = "oarc_spawn_options", setting = "team_select", value = SPAWN_TEAM_CHOICE.join_own_team },
type = "radiobutton",
caption = { "oarc-create-own-team-radio" },
state = false
}
-- if (enable_buddy_spawn) then
-- parent_flow.add {
-- name = "isolated_spawn_buddy_team_radio",
-- tags = { action = "oarc_spawn_options", setting = "team_select", value = SPAWN_TEAM_CHOICE.join_buddy_team },
-- type = "radiobutton",
-- caption = { "oarc-create-buddy-team" },
-- state = false
-- }
-- end
else
-- If separate teams are not enabled, default to joining the main team, and disable the radio buttons.
main_team_radio.ignored_by_interaction = true
if not enable_main_team then
-- If main team is not enabled, default to joining the a separate team, and disable the radio buttons.
separate_teams_radio.ignored_by_interaction = true
separate_teams_radio.enabled = false
end
end
end
@ -258,7 +261,7 @@ function CreateSpawnSettingsFrame(parent_flow, gameplay)
end
-- Radio buttons to pick your team.
DisplayTeamSelectRadioButtons(spawn_settings_frame, gameplay.enable_separate_teams, gameplay.enable_buddy_spawn)
DisplayTeamSelectRadioButtons(spawn_settings_frame, gameplay.enable_main_team, gameplay.enable_separate_teams)
-- Allow players to spawn with a moat around their area.
if (gameplay.allow_moats_around_spawns) then
@ -317,27 +320,6 @@ function CreateSoloSpawnFrame(parent_flow, enable_shared_spawns, max_shared_play
}
end
---Create a confirm button for player to request a BUDDY spawn
---@param parent_flow LuaGuiElement
---@return nil
function CreateBuddySpawnRequestButton(parent_flow)
-- local buddySpawnRequestFlow = parent_flow.add {
-- name = "buddy_spawn_request_flow",
-- type = "flow",
-- direction = "horizontal"
-- }
-- buddySpawnRequestFlow.style.horizontal_align = "right"
-- buddySpawnRequestFlow.style.horizontally_stretchable = true
local button = parent_flow.add {
name = "buddy_spawn_request",
tags = { action = "oarc_spawn_options", setting = "buddy_spawn_request" },
type = "button",
caption = { "oarc-buddy-spawn" },
style = "green_button"
}
button.style.horizontal_align = "right"
end
---Creates the shared spawn frame for joining another player's base
---@param parent_flow LuaGuiElement
---@param enable_shared_spawns boolean
@ -453,8 +435,10 @@ end
---Creates the buddy spawn frame for spawning with a buddy
---@param parent_flow LuaGuiElement
---@param player LuaPlayer
---@param enable_buddy_spawn boolean
---@param enable_separate_teams boolean
---@return nil
function CreateBuddySpawnFrame(parent_flow, player, enable_buddy_spawn)
function CreateBuddySpawnFrame(parent_flow, player, enable_buddy_spawn, enable_separate_teams)
local buddy_spawn_frame = parent_flow.buddy_spawn_frame
local selected_buddy = nil ---@type string?
@ -494,25 +478,23 @@ function CreateBuddySpawnFrame(parent_flow, player, enable_buddy_spawn)
AddLabel(buddy_spawn_frame, nil, { "oarc-spawn-menu-buddy-header" }, my_label_header_style)
if not enable_buddy_spawn then -- TODO: Confirm if this must also require enable_shared_spawns!!
-- Add some note about this being disabled?
if not enable_buddy_spawn then
AddLabel(buddy_spawn_frame, nil, { "oarc-buddy-spawn-disabled" }, my_warning_style)
return
end
-- Warnings and explanations...
AddLabel(buddy_spawn_frame, nil, { "oarc-buddy-spawn-instructions" }, my_label_style)
-- AddSpacer(buddy_spawn_frame)
buddy_spawn_frame.add {
tags = { action = "oarc_spawn_options", setting = "buddy_team_select" },
type = "checkbox",
caption = { "oarc-create-buddy-team" },
state = false
}
if (enable_separate_teams) then
buddy_spawn_frame.add {
tags = { action = "oarc_spawn_options", setting = "buddy_team_select" },
type = "checkbox",
caption = { "oarc-create-buddy-team" },
state = false
}
end
---@type string[]
local avail_buddies = GetOtherPlayersInSpawnMenu(player)
@ -538,7 +520,6 @@ function CreateBuddySpawnFrame(parent_flow, player, enable_buddy_spawn)
local label = AddLabel(buddy_button_horizontal_flow, nil, { "oarc-buddy-select-label" }, my_label_style)
label.style.horizontal_align = "left"
-- AddLabel(buddy_spawn_frame, nil, { "oarc-buddy-select-info" }, my_label_style)
local buddy_dropdown = buddy_button_horizontal_flow.add {
name = "waiting_buddies_dropdown",
tags = { action = "oarc_spawn_options", setting = "buddy_select" },
@ -547,10 +528,6 @@ function CreateBuddySpawnFrame(parent_flow, player, enable_buddy_spawn)
selected_index = previous_index
}
buddy_dropdown.style.horizontal_align = "left"
-- buddySpawnFrame.add { name = "refresh_buddy_list",
-- type = "button",
-- caption = { "oarc-buddy-refresh" } }
-- AddSpacerLine(buddySpawnFlow)
local empty = buddy_button_horizontal_flow.add {
type = "empty-widget",
@ -566,11 +543,6 @@ function CreateBuddySpawnFrame(parent_flow, player, enable_buddy_spawn)
style = "green_button"
}
button.style.horizontal_align = "right"
-- CreateBuddySpawnRequestButton(buddy_button_horizontal_flow)
-- AddLabel(buddy_spawn_frame, "buddy_spawn_lbl1", { "oarc-buddy-spawn-info" }, my_label_style)
end
---Refresh the buddy list without recreating any GUI elements
@ -619,7 +591,7 @@ function DisplaySpawnOptions(player)
CreateSpawnSettingsFrame(sGui, gameplay) -- The settings for configuring a spawn
CreateSoloSpawnFrame(sGui, gameplay.enable_shared_spawns, gameplay.number_of_players_per_shared_spawn) -- The primary method of spawning
CreateSharedSpawnFrame(sGui, gameplay.enable_shared_spawns) -- Spawn options to join another player's base.
CreateBuddySpawnFrame(sGui, player, gameplay.enable_buddy_spawn) -- Awesome buddy spawning system
CreateBuddySpawnFrame(sGui, player, gameplay.enable_buddy_spawn, gameplay.enable_separate_teams) -- Awesome buddy spawning system
end

View File

@ -5,10 +5,11 @@ oarc-mod=This is a multiplayer mod that allows every player to create their own
oarc-mod-welcome-msg-title=Welcome Message Title
oarc-mod-welcome-msg=Game Welcome Message
oarc-mod-server-msg=Server Welcome Message
oarc-mod-discord-invite=Discord Invite
oarc-mod-enable-main-team=Enable main team
oarc-mod-enable-separate-teams=Enable separate teams
oarc-mod-enable-spawning-on-other-surfaces=Allow starting on other surfaces
# oarc-mod-enable-spawning-on-other-surfaces=Allow starting on other surfaces
oarc-mod-allow-moats-around-spawns=Allow moats around spawns
oarc-mod-enable-moat-bridging=Moat bridges
@ -40,10 +41,11 @@ oarc-mod-enable-abandoned-base-cleanup=Cleanup abandoned bases
oarc-mod-welcome-msg-title=This is the title of the welcome message that will be displayed to players when they join the game.
oarc-mod-welcome-msg=This is the welcome message that will be displayed to players when they join the game.
oarc-mod-server-msg=This is an additional message that will be displayed to players when they join the game.
oarc-mod-discord-invite=Place your discord invite here so players can easily copy it from the in game info panel. Leave empty to disable.
oarc-mod-enable-main-team=Allow players to join the main team. This is the default team that is created when the game starts.
oarc-mod-enable-separate-teams=Allow players to start their own teams (CO-OP only, No PVP).\n[color=red][font=default-bold]You must enable one or both of the main team and separate team options. Otherwise it will default to main team allowed only.[/font][/color]
oarc-mod-enable-spawning-on-other-surfaces=Allow spawning on other surfaces. If enabled, by default all other surfaces will be available for players to spawn on. You can configure individual surfaces using the in game settings menu as well.
# oarc-mod-enable-spawning-on-other-surfaces=Allow spawning on other surfaces. If enabled, by default all other surfaces will be available for players to spawn on. You can configure individual surfaces using the in game settings menu as well.
oarc-mod-allow-moats-around-spawns=Allow players to choose spawns with a moat around them.
oarc-mod-enable-moat-bridging=If the spawn area is surrounded by land, the moat will have a small land bridge connecting it.
@ -62,7 +64,7 @@ oarc-mod-enable-friendly-fire=Enables friendly fire. So you can shoot your chest
oarc-mod-main-force-name=The name of the main force. This is the default team that is created when the game starts.
oarc-mod-default-surface=The default surface that players will spawn on if they join the main team or if spawning on other surfaces is not enabled.
oarc-mod-scale-resources-around-spawns=This scales resources around every spawn area so far away spawns aren't immediately next to very rich deposits.
oarc-mod-modified-enemy-spawning=This scales the enemy spawning around every spawn area so far away spawns aren't next to very dangerous enemies.
oarc-mod-modified-enemy-spawning=This scales the enemy spawning globally based on the allowed spawn distances to avoid every spawn being surrounded by behemoth worms.
oarc-mod-minimum-online-time=The minimum time a player must be online before they leave, otherwise their spawn area will be cleaned up.
oarc-mod-respawn-cooldown-min=The minimum time a player must wait before they can change their spawn point to a new location.

View File

@ -2,7 +2,7 @@ scenario-name=OARC
description=This mod provides a scenario that overhauls multiplayer spawning.\n[color=red][font=default-bold]Please check out the github page and discord for more information and support.[/font][/color]
oarc-scenario-warning-msg=This scenario allows players to create their own spawn points far from the center of the map. For more information, click the INFO button in the top left corner.
oarc-scenario-info-warn-msg=This scenario allows players to create their own spawn points far from the center of the map. For more information, click the INFO button in the top left corner.
oarc-i-understand=I Understand
oarc-spawn-options=Spawn Options
@ -136,6 +136,25 @@ oarc-spawn-wait=Please wait!
oarc-wait-text=Your spawn is being created now.\nYou will be teleported there in __1__ seconds!\nPlease standby...
oarc-settings-tab-title=Mod Settings
oarc-settings-tab-admin-warning=You are an admin. You may change any of these settings. BE CAREFUL!
oarc-settings-tab-admin-warning=You are an admin. Changing these settings late in the game may cause issues! BE CAREFUL!
oarc-settings-tab-player-warning=You are not an admin. These settings are read-only for you.
oarc-settings-tab-title-surface=Surface Settings
oarc-settings-tab-title-surface=Surface Settings
oarc-mod-faq-what-is-this-mod=What is this mod?
oarc-mod-faq-what-is-this-mod-answer=This mod overhauls multiplayer spawning. Players can create their own spawn points away from the center of the map. Players can also join other players' bases, or create buddy spawns. The mod does not change the core gameplay of Factorio, but it does change the way players start the game. The starting area is a preset area with resources, not a "natural" spawn point.
oarc-mod-faq-other-surfaces=Can I start on a different surface/planet?
oarc-mod-faq-other-surfaces-answer=[color=red]This feature is currently a work in progress. As such, only spawning on "nauvis" or a default nauvis-like surface will work correctly. Spawning on other surfaces may cause issues.[/color]
oarc-mod-faq-what-are-teams=What are the different team options?
oarc-mod-faq-what-are-teams-answer=I wrote this mod for co-op play only, not pvp. Depending on the mod settings, you can either join the main team, which shares research, or create your own team, which has its own research tree. All teams/forces are friendly to each other and can communicate in chat and (optionally) share map vision. The only reason to create your own team is if you want to have your own research progress.
oarc-mod-faq-shared-spawn=What is a shared spawn?
oarc-mod-faq-shared-spawn-answer=Players can choose to allow other players to join their base. This allows new players to spawn in the same starting area as the host player. The host player can control who can join their base.
oarc-mod-faq-buddy-spawn=What is a buddy spawn?
oarc-mod-faq-buddy-spawn-answer=If you and another player are in the spawn menu at the same time, you can request a buddy spawn. This will spawn you and your buddy right next to each other on the map, each with your own starting area.
oarc-mod-faq-regrowth=What are the regrowth and world eater features?
oarc-mod-faq-regrowth-answer="Regrowth" helps keep the save file size down by removing inactive map chunks over time. This is useful for long-running servers with many players. No chunks with player activity will be removed. "World Eater" slowly checks every chunk to see if there are any player structures in it. This is an additional check on top of the regrowth feature that will catch any chunks that players built on, but then later removed all structures from.
oarc-mod-faq-cleanup-abandoned=What is the cleanup abandoned bases feature?
oarc-mod-faq-cleanup-abandoned-answer=This removes the spawn area if the player leaves within the "minimum online time" and will also delete their character. This feature is useful for keeping the map clean and the save file size down. Public servers likely want to enable this feature.
oarc-mod-faq-offline-protection=What is the offline protection feature?
oarc-mod-faq-offline-protection-answer=If a base has all players offline, it will be protected from enemy attacks. This is not 100% guaranteed, but it will help prevent the base from being destroyed while players are offline.

View File

@ -20,6 +20,13 @@ data:extend({
default_value = "Insert Server Info Message Here!",
order = "a3"
},
{
type = "string-setting",
name = "oarc-mod-discord-invite",
setting_type = "runtime-global",
default_value = "Insert Discord Invite Here!",
order = "a4"
},
{
@ -36,13 +43,13 @@ data:extend({
default_value = true,
order = "b2"
},
{
type = "bool-setting",
name = "oarc-mod-enable-spawning-on-other-surfaces",
setting_type = "runtime-global",
default_value = true,
order = "b3"
},
-- {
-- type = "bool-setting",
-- name = "oarc-mod-enable-spawning-on-other-surfaces",
-- setting_type = "runtime-global",
-- default_value = true,
-- order = "b3"
-- },
{
type = "bool-setting",
name = "oarc-mod-allow-moats-around-spawns",