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

Saving minor changes for testing and todo notes.

This commit is contained in:
Oarcinae 2024-08-13 14:25:47 -04:00
parent ca347d88bf
commit b462f17659
4 changed files with 67 additions and 23 deletions

View File

@ -5,15 +5,17 @@
10. Check and update all functions using surfaces to clearly use either the LuaSurface obj OR a string name.
11. Expose more config options in admin GUI
12. Tooltips for GUI elements in spawn menu options!
13. Change Near/Far buttons to radio selection w/ text explanation and have a single Spawn button.
14. Configurable welcome/server messages in admin GUI.
Random Notes:
Configurable welcome message in admin GUI.
Other Ideas, Not Committed:
Add option to spawn on existing chunks (look for chunks with any entities in them, or use regrowth logic)
Add option for spawn pen to be on a specified surface
Change "search for ungenerated spawn point" to be a "roll" button that the player can re-roll? Maybe it shows on the map in an icon where they might go first?
Make players join a "holding_pen" force instead of the main force? Might cause issues with chat and vision?
Separate chest sharing and electricity ()
1. (DONE) First setup the mod settings and lua global settings.
2. (DONE) Test out removing the creation of a custom surface and ensure map settings can be set as needed. Possibly create a separate surface, or just a separate area away from the origin, for starting players.
3. (DONE) Start copying in the core pieces required for the primary spawning mechanic.

View File

@ -57,6 +57,14 @@ require("lib/oarc_gui_tabs")
script.on_init(function(event)
ValidateAndLoadConfig()
RegrowthInit()
-- Test create some other surfaces
-- TODO: Remove this later.
game.create_surface("vulcanus")
game.create_surface("fulgora")
game.create_surface("gleba")
game.create_surface("aquilo")
InitSpawnGlobalsAndForces()
CreateHoldingPenSurface() -- Must be after init spawn globals?
end)

View File

@ -62,6 +62,28 @@ function InitSpawnGlobalsAndForces()
-- Each entry contains information about if it's open, spawn pos, and players in the group.
if (global.ocore.sharedSpawns == nil) then
global.ocore.sharedSpawns --[[@as OarcSharedSpawnsTable]] = {}
-- Use this for testing shared spawns...
local sharedSpawnExample1 = {
surface="nauvis",
openAccess=true,
position={x=50,y=50},
players={"ABC", "DEF"}}
local sharedSpawnExample2 = {
surface="vulcanus",
openAccess=false,
position={x=200,y=200},
players={"ABC", "DEF"}}
local sharedSpawnExample3 = {
surface="fulgora",
openAccess=true,
position={x=400,y=400},
players={"A", "B", "C", "D"}}
global.ocore.sharedSpawns = {
testName1=sharedSpawnExample1,
testName2=sharedSpawnExample2,
Oarc=sharedSpawnExample3
}
end
-- Each player has an option to change their respawn which has a cooldown when used.
@ -937,9 +959,11 @@ function GetNumberOfAvailableSharedSpawns()
local number_of_players_per_shared_spawn = global.ocfg.mod_overlap.number_of_players_per_shared_spawn
for ownerName, sharedSpawn in pairs(global.ocore.sharedSpawns --[[@as OarcSharedSpawnsTable]]) do
if (sharedSpawn.openAccess and
(game.players[ownerName] ~= nil) and
game.players[ownerName].connected) then
-- Disabled only for testing. TODO: Re-enable this!
-- if (sharedSpawn.openAccess and
-- (game.players[ownerName] ~= nil) and
-- game.players[ownerName].connected) then
if (sharedSpawn.openAccess) then
if ((number_of_players_per_shared_spawn == 0) or
(TableLength(global.ocore.sharedSpawns[ownerName].players) < number_of_players_per_shared_spawn)) then
count = count + 1

View File

@ -8,21 +8,6 @@ require("lib/separate_spawns")
local SPAWN_GUI_MAX_WIDTH = 500
local SPAWN_GUI_MAX_HEIGHT = 1000
-- Use this for testing shared spawns...
-- local sharedSpawnExample1 = {openAccess=true,
-- position={x=50,y=50},
-- players={"ABC", "DEF"}}
-- local sharedSpawnExample2 = {openAccess=false,
-- position={x=200,y=200},
-- players={"ABC", "DEF"}}
-- local sharedSpawnExample3 = {openAccess=true,
-- position={x=400,y=400},
-- players={"A", "B", "C", "D"}}
-- global.ocore.sharedSpawns = {testName1=sharedSpawnExample1,
-- testName2=sharedSpawnExample2,
-- Oarc=sharedSpawnExample3}
---A display gui message. Meant to be display the first time a player joins.
---@param player LuaPlayer
---@return boolean
@ -143,6 +128,29 @@ function DisplaySpawnOptions(player)
direction = "vertical",
style = "bordered_frame" }
-- Pick surface
if (mod_overlap.enable_spawning_on_other_surfaces) then
local surfacesHorizontalFlow = soloSpawnFlow.add { name = "surfaces_horizontal_flow",
type = "flow",
direction = "horizontal" }
---@type string[]
local surfaceList = {}
for surfaceName,allowed in pairs(global.ocore.surfaces) do
if allowed then
table.insert(surfaceList, surfaceName)
end
end
AddLabel(surfacesHorizontalFlow, "surfacesHorizontalFlowLabel", "Select Surface: ", my_label_style)
surfacesHorizontalFlow.add { name = "surface_select_dropdown",
type = "drop-down",
items = surfaceList,
selected_index = 0}
end
-- Radio buttons to pick your team.
if (mod_overlap.enable_separate_teams) then
soloSpawnFlow.add { name = "isolated_spawn_main_team_radio",
@ -449,9 +457,11 @@ function DisplaySharedSpawnOptions(player)
for spawnName, sharedSpawn in pairs(global.ocore.sharedSpawns) do
if (sharedSpawn.openAccess and
(game.players[spawnName] ~= nil) and
game.players[spawnName].connected) then
-- Disabled for testing. TODO: Renable this later!
-- if (sharedSpawn.openAccess and
-- (game.players[spawnName] ~= nil) and
-- game.players[spawnName].connected) then
if sharedSpawn.openAccess then
local spotsRemaining = global.ocfg.mod_overlap.number_of_players_per_shared_spawn - TableLength(global.ocore.sharedSpawns[spawnName].players)
if (global.ocfg.mod_overlap.number_of_players_per_shared_spawn == 0) then
shGui.add { type = "button", caption = spawnName, name = spawnName }