mirror of
https://github.com/Oarcinae/FactorioScenarioMultiplayerSpawn.git
synced 2024-12-04 09:43:00 +02:00
More gui style and issues cleanup. Changed starting items logic to allow for mods with starting item kits.
This commit is contained in:
parent
fd2d4052ff
commit
0ace14d001
@ -95,10 +95,7 @@ end)
|
||||
-- Player Events
|
||||
----------------------------------------
|
||||
script.on_event(defines.events.on_player_created, function(event)
|
||||
local player = game.players[event.player_index]
|
||||
player.teleport({x=0,y=0}, HOLDING_PEN_SURFACE_NAME)
|
||||
|
||||
SeparateSpawnsInitPlayer(event.player_index, true)
|
||||
SeparateSpawnsInitPlayer(event.player_index)
|
||||
end)
|
||||
|
||||
script.on_event(defines.events.on_player_respawned, function(event)
|
||||
|
@ -12,7 +12,7 @@ ACTIVE ITEMS:
|
||||
20. Force enable_world_eater to require enable_regrowth
|
||||
26. Fix all GUI styling (buttons outside of content)
|
||||
|
||||
27.
|
||||
27. Figure out how to reset player inventory on player reset to avoid extra items? (save and load items?)
|
||||
28.
|
||||
29.
|
||||
30.
|
||||
|
@ -6,13 +6,19 @@
|
||||
function ServerInfoGuiClick(event)
|
||||
if not event.element.valid then return end
|
||||
local player = game.players[event.player_index]
|
||||
local name = event.element.name
|
||||
local tags = event.element.tags
|
||||
|
||||
if (name == "ban_player") then
|
||||
local pIndex = event.element.parent.ban_players_dropdown.selected_index
|
||||
if (tags.action ~= "oarc_server_info_tab") then
|
||||
return
|
||||
end
|
||||
|
||||
local player_dropdown = event.element.parent.ban_players_dropdown
|
||||
|
||||
if (tags.setting == "ban_player") then
|
||||
local pIndex = player_dropdown.selected_index
|
||||
|
||||
if (pIndex ~= 0) then
|
||||
local banPlayer = event.element.parent.ban_players_dropdown.get_item(pIndex)
|
||||
local banPlayer = player_dropdown.get_item(pIndex)
|
||||
if (game.players[banPlayer]) then
|
||||
game.ban_player(banPlayer --[[@as string]], "Banned from admin panel.")
|
||||
log("Banning " .. banPlayer)
|
||||
@ -20,11 +26,11 @@ function ServerInfoGuiClick(event)
|
||||
end
|
||||
end
|
||||
|
||||
if (name == "restart_player") then
|
||||
local pIndex = event.element.parent.ban_players_dropdown.selected_index
|
||||
if (tags.setting == "restart_player") then
|
||||
local pIndex = player_dropdown.selected_index
|
||||
|
||||
if (pIndex ~= 0) then
|
||||
local resetPlayer = event.element.parent.ban_players_dropdown.get_item(pIndex)
|
||||
local resetPlayer = player_dropdown.get_item(pIndex)
|
||||
|
||||
if not game.players[resetPlayer] or not game.players[resetPlayer].connected then
|
||||
SendMsg(player.name, "Player " .. resetPlayer .. " is not found?")
|
||||
@ -36,9 +42,9 @@ function ServerInfoGuiClick(event)
|
||||
return
|
||||
end
|
||||
|
||||
RemoveOrResetPlayer(player, false, true, true, true)
|
||||
SeparateSpawnsInitPlayer(resetPlayer --[[@as string]], true)
|
||||
log("Resetting " .. resetPlayer)
|
||||
RemoveOrResetPlayer(game.players[resetPlayer], false, true, true, true)
|
||||
SeparateSpawnsInitPlayer(resetPlayer --[[@as string]])
|
||||
else
|
||||
SendMsg(player.name, "No player selected!")
|
||||
return
|
||||
@ -151,6 +157,7 @@ function CreateServerInfoTab(tab_container, player)
|
||||
local label = AddLabel(horizontal_flow, nil, "Select Player:", my_label_style) --TODO: localize
|
||||
local dropdown = horizontal_flow.add{
|
||||
name = "ban_players_dropdown",
|
||||
tags = { action = "oarc_server_info_tab", setting = "ban_players_dropdown" },
|
||||
type = "drop-down",
|
||||
items = player_list
|
||||
}
|
||||
@ -164,6 +171,7 @@ function CreateServerInfoTab(tab_container, player)
|
||||
|
||||
local ban_button = horizontal_flow.add{
|
||||
name="ban_player",
|
||||
tags = { action = "oarc_server_info_tab", setting = "ban_player" },
|
||||
type="button",
|
||||
caption="Ban Player",
|
||||
style = "red_button"
|
||||
@ -171,6 +179,7 @@ function CreateServerInfoTab(tab_container, player)
|
||||
-- ban_button.style.horizontal_align = "right"
|
||||
local reset_button = horizontal_flow.add{
|
||||
name="restart_player",
|
||||
tags = { action = "oarc_server_info_tab", setting = "restart_player" },
|
||||
type="button",
|
||||
caption="Restart Player",
|
||||
style = "red_button"
|
||||
|
@ -20,19 +20,23 @@ function CreateSpawnControlsTab(tab_container, player)
|
||||
local spwnCtrls = tab_container.add {
|
||||
type = "scroll-pane",
|
||||
name = "spwn_ctrl_panel",
|
||||
caption = "" }
|
||||
caption = ""
|
||||
}
|
||||
ApplyStyle(spwnCtrls, my_fixed_width_style)
|
||||
spwnCtrls.style.maximal_height = 1000
|
||||
spwnCtrls.horizontal_scroll_policy = "never"
|
||||
|
||||
if global.ocfg.gameplay.enable_shared_spawns then
|
||||
if (global.ocore.uniqueSpawns[player.name] ~= nil) then
|
||||
-- This checkbox allows people to join your base when they first
|
||||
-- start the game.
|
||||
spwnCtrls.add { type = "checkbox", name = "accessToggle",
|
||||
-- This checkbox allows people to join your base when they first start the game.
|
||||
local toggle = spwnCtrls.add {
|
||||
type = "checkbox",
|
||||
name = "accessToggle",
|
||||
tags = { action = "oarc_spawn_ctrl_tab", setting = "shared_access_toggle" },
|
||||
caption = { "oarc-spawn-allow-joiners" },
|
||||
state = IsSharedSpawnActive(player) }
|
||||
ApplyStyle(spwnCtrls["accessToggle"], my_fixed_width_style)
|
||||
state = IsSharedSpawnActive(player)
|
||||
}
|
||||
ApplyStyle(toggle, my_fixed_width_style)
|
||||
end
|
||||
end
|
||||
|
||||
@ -45,33 +49,57 @@ function CreateSpawnControlsTab(tab_container, player)
|
||||
-- Sets the player's custom spawn point to their current location
|
||||
if ((game.tick - global.ocore.playerCooldowns[player.name].setRespawn) >
|
||||
(global.ocfg.gameplay.respawn_cooldown_min * TICKS_PER_MINUTE)) then
|
||||
spwnCtrls.add { type = "button", name = "setRespawnLocation", caption = { "oarc-set-respawn-loc" } }
|
||||
spwnCtrls["setRespawnLocation"].style.font = "default-small-semibold"
|
||||
local change_respawn_button = spwnCtrls.add {
|
||||
type = "button",
|
||||
tags = { action = "oarc_spawn_ctrl_tab", setting = "set_respawn_location" },
|
||||
name = "setRespawnLocation",
|
||||
caption = { "oarc-set-respawn-loc" }
|
||||
}
|
||||
change_respawn_button.style.font = "default-small-semibold"
|
||||
else
|
||||
AddLabel(spwnCtrls, "respawn_cooldown_note1",
|
||||
AddLabel(spwnCtrls, nil,
|
||||
{ "oarc-set-respawn-loc-cooldown", FormatTime((global.ocfg.gameplay.respawn_cooldown_min * TICKS_PER_MINUTE) -
|
||||
(game.tick - global.ocore.playerCooldowns[player.name].setRespawn)) }, my_note_style)
|
||||
end
|
||||
AddLabel(spwnCtrls, "respawn_cooldown_note2", { "oarc-set-respawn-note" }, my_note_style)
|
||||
AddLabel(spwnCtrls, nil, { "oarc-set-respawn-note" }, my_note_style)
|
||||
|
||||
-- Display a list of people in the join queue for your base.
|
||||
if (global.ocfg.gameplay.enable_shared_spawns and IsSharedSpawnActive(player)) then
|
||||
if (TableLength(global.ocore.sharedSpawns[player.name].joinQueue) > 0) then
|
||||
AddLabel(spwnCtrls, "drop_down_msg_lbl1", { "oarc-select-player-join-queue" }, my_label_style)
|
||||
spwnCtrls.add { name = "join_queue_dropdown",
|
||||
|
||||
local horizontal_flow = spwnCtrls.add { type = "flow", direction = "horizontal" }
|
||||
horizontal_flow.style.horizontally_stretchable = true
|
||||
|
||||
horizontal_flow.add {
|
||||
name = "join_queue_dropdown",
|
||||
type = "drop-down",
|
||||
items = global.ocore.sharedSpawns[player.name].joinQueue }
|
||||
spwnCtrls.add { name = "accept_player_request",
|
||||
items = global.ocore.sharedSpawns[player.name].joinQueue
|
||||
}
|
||||
|
||||
local dragger = horizontal_flow.add {
|
||||
type = "empty-widget",
|
||||
style = "draggable_space_header"
|
||||
}
|
||||
dragger.style.horizontally_stretchable = true
|
||||
|
||||
horizontal_flow.add {
|
||||
name = "accept_player_request",
|
||||
tags = { action = "oarc_spawn_ctrl_tab", setting = "accept_player_request" },
|
||||
type = "button",
|
||||
caption = { "oarc-accept" } }
|
||||
spwnCtrls.add { name = "reject_player_request",
|
||||
style = "green_button",
|
||||
caption = { "oarc-accept" }
|
||||
}
|
||||
horizontal_flow.add {
|
||||
name = "reject_player_request",
|
||||
tags = { action = "oarc_spawn_ctrl_tab", setting = "reject_player_request" },
|
||||
type = "button",
|
||||
caption = { "oarc-reject" } }
|
||||
style = "red_button",
|
||||
caption = { "oarc-reject" }
|
||||
}
|
||||
else
|
||||
AddLabel(spwnCtrls, "empty_join_queue_note1", { "oarc-no-player-join-reqs" }, my_note_style)
|
||||
end
|
||||
spwnCtrls.add { name = "join_queue_spacer", type = "label",
|
||||
caption = " " }
|
||||
end
|
||||
end
|
||||
|
||||
@ -79,13 +107,11 @@ end
|
||||
---@param event EventData.on_gui_checked_state_changed
|
||||
---@return nil
|
||||
function SpawnCtrlGuiOptionsSelect(event)
|
||||
if not (event and event.element and event.element.valid) then return end
|
||||
|
||||
if not event.element.valid then return end
|
||||
local player = game.players[event.player_index]
|
||||
local name = event.element.name
|
||||
local tags = event.element.tags
|
||||
|
||||
if not player then
|
||||
log("Another gui click happened with no valid player...")
|
||||
if (tags.action ~= "oarc_spawn_ctrl_tab") then
|
||||
return
|
||||
end
|
||||
|
||||
@ -93,20 +119,20 @@ function SpawnCtrlGuiOptionsSelect(event)
|
||||
local sharedSpawn = global.ocore.sharedSpawns[player.name]
|
||||
|
||||
-- Handle changes to spawn sharing.
|
||||
if (name == "accessToggle") then
|
||||
if (tags.setting == "shared_access_toggle") then
|
||||
if event.element.state then
|
||||
if DoesPlayerHaveCustomSpawn(player) then
|
||||
if (sharedSpawn == nil) then
|
||||
CreateNewSharedSpawn(player)
|
||||
else
|
||||
sharedSpawn.openAccess = true
|
||||
global.ocore.sharedSpawns[player.name].openAccess = true
|
||||
end
|
||||
|
||||
SendBroadcastMsg({ "oarc-start-shared-base", player.name })
|
||||
end
|
||||
else
|
||||
if (sharedSpawn ~= nil) then
|
||||
sharedSpawn.openAccess = false
|
||||
global.ocore.sharedSpawns[player.name].openAccess = false
|
||||
SendBroadcastMsg({ "oarc-stop-shared-base", player.name })
|
||||
end
|
||||
end
|
||||
@ -123,36 +149,29 @@ end
|
||||
---@param event EventData.on_gui_click
|
||||
---@return nil
|
||||
function SpawnCtrlGuiClick(event)
|
||||
if not (event and event.element and event.element.valid) then return end
|
||||
|
||||
if not event.element.valid then return end
|
||||
local player = game.players[event.player_index]
|
||||
local elemName = event.element.name
|
||||
local tags = event.element.tags
|
||||
|
||||
if not player then
|
||||
log("Another gui click happened with no valid player...")
|
||||
if (tags.action ~= "oarc_spawn_ctrl_tab") then
|
||||
return
|
||||
end
|
||||
|
||||
if (event.element.parent) then
|
||||
if (event.element.parent.name ~= "spwn_ctrl_panel") then
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
-- Sets a new respawn point and resets the cooldown.
|
||||
if (elemName == "setRespawnLocation") then
|
||||
if (tags.setting == "set_respawn_location") then
|
||||
if DoesPlayerHaveCustomSpawn(player) then
|
||||
ChangePlayerSpawn(player, player.surface.name, player.position)
|
||||
OarcGuiRefreshContent(player)
|
||||
player.print({ "oarc-spawn-point-updated" })
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-- Accept or reject pending player join requests to a shared base
|
||||
if ((elemName == "accept_player_request") or (elemName == "reject_player_request")) then
|
||||
elseif ((tags.setting == "accept_player_request") or (tags.setting == "reject_player_request")) then
|
||||
|
||||
if ((event.element.parent.join_queue_dropdown == nil) or
|
||||
(event.element.parent.join_queue_dropdown.selected_index == 0)) then
|
||||
player.print({ "oarc-selected-player-not-wait" })
|
||||
player.print({ "oarc-selected-player-not-valid" })
|
||||
OarcGuiRefreshContent(player)
|
||||
return
|
||||
end
|
||||
@ -160,6 +179,7 @@ function SpawnCtrlGuiClick(event)
|
||||
local joinQueueIndex = event.element.parent.join_queue_dropdown.selected_index
|
||||
local joinQueuePlayerChoice = event.element.parent.join_queue_dropdown.get_item(joinQueueIndex) --[[@as string]]
|
||||
|
||||
-- Shouldn't be able to hit this since we force a GUI refresh when they leave?
|
||||
if ((game.players[joinQueuePlayerChoice] == nil) or
|
||||
(not game.players[joinQueuePlayerChoice].connected)) then
|
||||
player.print({ "oarc-selected-player-not-wait" })
|
||||
@ -170,7 +190,9 @@ function SpawnCtrlGuiClick(event)
|
||||
---@type OarcSharedSpawn
|
||||
local sharedSpawn = global.ocore.sharedSpawns[player.name]
|
||||
|
||||
if (elemName == "reject_player_request") then
|
||||
if (tags.setting == "reject_player_request") then
|
||||
|
||||
RemovePlayerFromJoinQueue(joinQueuePlayerChoice) -- This also refreshes the host gui
|
||||
|
||||
-- Inform the host that the player was rejected
|
||||
player.print({ "oarc-reject-joiner", joinQueuePlayerChoice })
|
||||
@ -183,57 +205,31 @@ function SpawnCtrlGuiClick(event)
|
||||
DisplaySpawnOptions(game.players[joinQueuePlayerChoice])
|
||||
end
|
||||
|
||||
-- Find and remove the player from the joinQueue they were in.
|
||||
for index, requestingPlayer in pairs(sharedSpawn.joinQueue) do
|
||||
if (requestingPlayer == joinQueuePlayerChoice) then
|
||||
sharedSpawn.joinQueue[index] = nil
|
||||
elseif (tags.setting == "accept_player_request") then
|
||||
|
||||
RemovePlayerFromJoinQueue(joinQueuePlayerChoice) -- This also refreshes the host gui
|
||||
|
||||
---Close the waiting players menu and display the spawn options
|
||||
-- requestingPlayer
|
||||
-- TODO: Nice to have if I can get this to work.
|
||||
-- Send an announcement
|
||||
SendBroadcastMsg({ "oarc-player-joining-base", joinQueuePlayerChoice, player.name })
|
||||
|
||||
return
|
||||
end
|
||||
-- Close the waiting players menu
|
||||
if (game.players[joinQueuePlayerChoice].gui.screen.join_shared_spawn_wait_menu) then
|
||||
game.players[joinQueuePlayerChoice].gui.screen.join_shared_spawn_wait_menu.destroy()
|
||||
end
|
||||
|
||||
OarcGuiRefreshContent(player)
|
||||
-- Spawn the player
|
||||
local joiningPlayer = game.players[joinQueuePlayerChoice]
|
||||
ChangePlayerSpawn(joiningPlayer, sharedSpawn.surface, sharedSpawn.position)
|
||||
SendPlayerToSpawn(joiningPlayer)
|
||||
GivePlayerStarterItems(joiningPlayer)
|
||||
table.insert(sharedSpawn.players, joiningPlayer.name)
|
||||
joiningPlayer.force = game.players[player.name].force
|
||||
|
||||
elseif (elemName == "accept_player_request") then
|
||||
-- Find and remove the player from the joinQueue they were in.
|
||||
for index, requestingPlayer in pairs(sharedSpawn.joinQueue) do
|
||||
if (requestingPlayer == joinQueuePlayerChoice) then
|
||||
sharedSpawn.joinQueue[index] = nil
|
||||
end
|
||||
end
|
||||
-- Render some welcoming text...
|
||||
DisplayWelcomeGroundTextAtSpawn(joiningPlayer, sharedSpawn.surface, sharedSpawn.position)
|
||||
|
||||
-- If player exists, then do stuff.
|
||||
if (game.players[joinQueuePlayerChoice]) then
|
||||
-- Send an announcement
|
||||
SendBroadcastMsg({ "oarc-player-joining-base", joinQueuePlayerChoice, player.name })
|
||||
|
||||
-- Close the waiting players menu
|
||||
if (game.players[joinQueuePlayerChoice].gui.screen.join_shared_spawn_wait_menu) then
|
||||
game.players[joinQueuePlayerChoice].gui.screen.join_shared_spawn_wait_menu.destroy()
|
||||
end
|
||||
|
||||
-- Spawn the player
|
||||
local joiningPlayer = game.players[joinQueuePlayerChoice]
|
||||
ChangePlayerSpawn(joiningPlayer, sharedSpawn.surface, sharedSpawn.position)
|
||||
SendPlayerToSpawn(joiningPlayer)
|
||||
GivePlayerStarterItems(joiningPlayer)
|
||||
table.insert(sharedSpawn.players, joiningPlayer.name)
|
||||
joiningPlayer.force = game.players[player.name].force
|
||||
|
||||
-- Render some welcoming text...
|
||||
DisplayWelcomeGroundTextAtSpawn(joiningPlayer, sharedSpawn.surface, sharedSpawn.position)
|
||||
|
||||
-- Unlock spawn control gui tab
|
||||
SetOarcGuiTabEnabled(joiningPlayer, OARC_SPAWN_CTRL_TAB_NAME, true)
|
||||
else
|
||||
SendBroadcastMsg({ "oarc-player-left-while-joining", joinQueuePlayerChoice })
|
||||
end
|
||||
|
||||
OarcGuiRefreshContent(player)
|
||||
-- Unlock spawn control gui tab
|
||||
SetOarcGuiTabEnabled(joiningPlayer, OARC_SPAWN_CTRL_TAB_NAME, true)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -53,7 +53,8 @@ my_warning_style = {
|
||||
-- minimal_width = 450,
|
||||
-- maximal_width = 450,
|
||||
single_line = false,
|
||||
font_color = {r=1,g=0.1,b=0.1},
|
||||
font = "default-bold",
|
||||
font_color = {r=1,g=0.3,b=0.3},
|
||||
top_padding = 0,
|
||||
bottom_padding = 0
|
||||
}
|
||||
|
@ -309,9 +309,10 @@ function GivePlayerRespawnItems(player)
|
||||
|
||||
local respawnItems = global.ocfg.surfaces_config[playerSpawn.surface].starting_items.player_respawn_items
|
||||
|
||||
for name, count in pairs(respawnItems) do
|
||||
player.insert({ name = name, count = count })
|
||||
end
|
||||
util.insert_safe(player, respawnItems)
|
||||
-- for name, count in pairs(respawnItems) do
|
||||
-- player.insert({ name = name, count = count })
|
||||
-- end
|
||||
end
|
||||
|
||||
-- TODO: Take advantage of util.insert_safe ??
|
||||
@ -326,11 +327,30 @@ function GivePlayerStarterItems(player)
|
||||
return
|
||||
end
|
||||
|
||||
local respawnItems = global.ocfg.surfaces_config[playerSpawn.surface].starting_items.player_start_items
|
||||
local startItems = global.ocfg.surfaces_config[playerSpawn.surface].starting_items.player_start_items
|
||||
|
||||
for name, count in pairs(respawnItems) do
|
||||
player.insert({ name = name, count = count })
|
||||
util.insert_safe(player, startItems)
|
||||
-- for name, count in pairs(startItems) do
|
||||
-- player.insert({ name = name, count = count })
|
||||
-- end
|
||||
end
|
||||
|
||||
---Attempts to remove any starter items from the player
|
||||
---@param player LuaPlayer
|
||||
---@param surface_name string? Fallback surface name if player spawn is not found
|
||||
---@return nil
|
||||
function RemovePlayerStarterItems(player, surface_name)
|
||||
local playerSpawn = global.ocore.playerSpawns[player.name]
|
||||
local surface_override = surface_name
|
||||
if (playerSpawn == nil) then
|
||||
log("WARN - RemovePlayerStarterItems - No player spawn found for player: " .. player.name)
|
||||
else
|
||||
surface_override = playerSpawn.surface -- Use the player's spawn surface if we have it
|
||||
end
|
||||
|
||||
local startItems = global.ocfg.surfaces_config[surface_override].starting_items.player_start_items
|
||||
|
||||
util.remove_safe(player, startItems)
|
||||
end
|
||||
|
||||
--- Delete all chunks on a surface
|
||||
|
@ -34,7 +34,6 @@ function InitSpawnGlobalsAndForces()
|
||||
|
||||
-- This contains each player's spawn point. Literally where they will respawn.
|
||||
-- There is a way in game to change this under one of the little menu features I added.
|
||||
---TODO: Add support for multiple surfaces!
|
||||
if (global.ocore.playerSpawns == nil) then
|
||||
global.ocore.playerSpawns --[[@as OarcPlayerSpawnsTable]] = {}
|
||||
end
|
||||
@ -45,38 +44,11 @@ function InitSpawnGlobalsAndForces()
|
||||
global.ocore.uniqueSpawns --[[@as OarcUniqueSpawnsTable]] = {}
|
||||
end
|
||||
|
||||
-- List of available vanilla spawns
|
||||
-- TODO: Vanilla spawn point are not implemented yet.
|
||||
-- if (global.vanillaSpawns == nil) then
|
||||
-- global.vanillaSpawns = {}
|
||||
-- end
|
||||
|
||||
-- This keeps a list of any player that has shared their base.
|
||||
-- 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.
|
||||
@ -103,12 +75,6 @@ function InitSpawnGlobalsAndForces()
|
||||
global.ocore.spawnChoices --[[@as OarcSpawnChoicesTable]] = {}
|
||||
end
|
||||
|
||||
-- This is what I use to communicate a buddy spawn request between the buddies.
|
||||
-- This contains information of who is asking, and what options were selected.
|
||||
-- if (global.ocore.buddySpawnOpts == nil) then
|
||||
-- global.ocore.buddySpawnOpts --[[@as OarcBuddySpawnOptsTable]] = {}
|
||||
-- end
|
||||
|
||||
-- Buddy info: The only real use is to check if one of a buddy pair is online to see if we should allow enemy
|
||||
-- attacks on the base.
|
||||
-- global.ocore.buddyPairs[player.name] = requesterName
|
||||
@ -132,6 +98,41 @@ function InitSpawnGlobalsAndForces()
|
||||
global.ocore.destroyed_force = "_DESTROYED_"
|
||||
game.create_force(global.ocore.abandoned_force)
|
||||
game.create_force(global.ocore.destroyed_force)
|
||||
|
||||
CreateHoldingPenPermissionsGroup()
|
||||
|
||||
end
|
||||
|
||||
function CreateHoldingPenPermissionsGroup()
|
||||
|
||||
-- Create a permission group for the holding pen players.
|
||||
if (game.permissions.get_group("holding_pen") == nil) then
|
||||
game.permissions.create_group("holding_pen")
|
||||
end
|
||||
|
||||
local holding_pen_group = game.permissions.get_group("holding_pen")
|
||||
|
||||
-- Disable all permissions for the holding pen group.
|
||||
for _,action in pairs(defines.input_action) do
|
||||
holding_pen_group.set_allows_action(action, false)
|
||||
end
|
||||
|
||||
-- Just allow the ones we want:
|
||||
holding_pen_group.set_allows_action(defines.input_action.gui_checked_state_changed, true)
|
||||
holding_pen_group.set_allows_action(defines.input_action.gui_click, true)
|
||||
holding_pen_group.set_allows_action(defines.input_action.gui_confirmed, true)
|
||||
holding_pen_group.set_allows_action(defines.input_action.gui_elem_changed, true)
|
||||
holding_pen_group.set_allows_action(defines.input_action.gui_hover, true)
|
||||
holding_pen_group.set_allows_action(defines.input_action.gui_leave, true)
|
||||
holding_pen_group.set_allows_action(defines.input_action.gui_location_changed, true)
|
||||
holding_pen_group.set_allows_action(defines.input_action.gui_selected_tab_changed, true)
|
||||
holding_pen_group.set_allows_action(defines.input_action.gui_selection_state_changed, true)
|
||||
holding_pen_group.set_allows_action(defines.input_action.gui_switch_state_changed, true)
|
||||
holding_pen_group.set_allows_action(defines.input_action.gui_text_changed, true)
|
||||
holding_pen_group.set_allows_action(defines.input_action.gui_value_changed, true)
|
||||
holding_pen_group.set_allows_action(defines.input_action.start_walking, true)
|
||||
-- holding_pen_group.set_allows_action(defines.input_action.write_to_console, true)
|
||||
|
||||
end
|
||||
|
||||
---Detects when new surfaces are created and adds them to the list of surfaces that allow spawns
|
||||
@ -178,11 +179,12 @@ end
|
||||
-- If new player, assign them to the main force so they can communicate with the team without shouting (/s).
|
||||
-- TODO: Possibly change this to a holding_pen force?
|
||||
---@param player_index integer|string
|
||||
---@param clear_inv boolean If true, clear the player's inventory.
|
||||
---@return nil
|
||||
function SeparateSpawnsInitPlayer(player_index, clear_inv)
|
||||
function SeparateSpawnsInitPlayer(player_index)
|
||||
local player = game.players[player_index]
|
||||
|
||||
SafeTeleport(player, game.surfaces[HOLDING_PEN_SURFACE_NAME], { x = 0, y = 0 })
|
||||
|
||||
-- Make sure spawn control tab is disabled
|
||||
SetOarcGuiTabEnabled(player, OARC_SPAWN_CTRL_TAB_NAME, false)
|
||||
SwitchOarcGuiTab(player, OARC_SERVER_INFO_TAB_NAME)
|
||||
@ -192,14 +194,7 @@ function SeparateSpawnsInitPlayer(player_index, clear_inv)
|
||||
player.force = global.ocfg.gameplay.main_force_name
|
||||
end
|
||||
|
||||
-- Ensure cleared inventory!
|
||||
if (clear_inv) then
|
||||
player.get_inventory(defines.inventory.character_main ).clear()
|
||||
player.get_inventory(defines.inventory.character_guns).clear()
|
||||
player.get_inventory(defines.inventory.character_ammo).clear()
|
||||
player.get_inventory(defines.inventory.character_armor).clear()
|
||||
player.get_inventory(defines.inventory.character_trash).clear()
|
||||
end
|
||||
player.permission_group = game.permissions.get_group("holding_pen")
|
||||
|
||||
InitOarcGuiTabs(player)
|
||||
HideOarcGui(player)
|
||||
@ -347,7 +342,8 @@ function SendPlayerToNewSpawnAndCreateIt(delayedSpawn)
|
||||
|
||||
-- Send the player to that position
|
||||
local player = game.players[delayedSpawn.playerName]
|
||||
SafeTeleport(player, game.surfaces[delayedSpawn.surface], delayedSpawn.position)
|
||||
-- SafeTeleport(player, game.surfaces[delayedSpawn.surface], delayedSpawn.position)
|
||||
SendPlayerToSpawn(player)
|
||||
GivePlayerStarterItems(player)
|
||||
|
||||
-- Render some welcoming text...
|
||||
@ -640,7 +636,7 @@ function ResetPlayerAndDestroyForce(player)
|
||||
end
|
||||
|
||||
RemoveOrResetPlayer(player, false, false, true, true)
|
||||
SeparateSpawnsInitPlayer(player.index, false)
|
||||
SeparateSpawnsInitPlayer(player.index)
|
||||
end
|
||||
|
||||
---Resets the player and merges their force into the abandoned_force.
|
||||
@ -658,7 +654,7 @@ function ResetPlayerAndAbandonForce(player)
|
||||
end
|
||||
|
||||
RemoveOrResetPlayer(player, false, false, false, false)
|
||||
SeparateSpawnsInitPlayer(player.index, false)
|
||||
SeparateSpawnsInitPlayer(player.index)
|
||||
end
|
||||
|
||||
---Reset player and merge their force to neutral
|
||||
@ -666,7 +662,7 @@ end
|
||||
---@return nil
|
||||
function ResetPlayerAndMergeForceToNeutral(player)
|
||||
RemoveOrResetPlayer(player, false, true, true, true)
|
||||
SeparateSpawnsInitPlayer(player.index, true)
|
||||
SeparateSpawnsInitPlayer(player.index)
|
||||
end
|
||||
|
||||
---Kicks player from game and marks player for removal from globals.
|
||||
@ -692,6 +688,8 @@ function RemoveOrResetPlayer(player, remove_player, remove_force, remove_base, i
|
||||
return
|
||||
end
|
||||
|
||||
RemovePlayerStarterItems(player, player.surface.name) -- Remove any starting items they may have.
|
||||
|
||||
-- If this player is staying in the game, lets make sure we don't delete them along with the map chunks being
|
||||
-- cleared.
|
||||
player.teleport({x=0,y=0}, HOLDING_PEN_SURFACE_NAME)
|
||||
@ -785,11 +783,6 @@ function CleanupPlayerGlobals(playerName)
|
||||
end
|
||||
end
|
||||
|
||||
-- Clear buddy spawn options (should already be cleared, but just in case it isn't)
|
||||
-- if (global.ocore.buddySpawnOpts[playerName] ~= nil) then
|
||||
-- global.ocore.buddySpawnOpts[playerName] = nil
|
||||
-- end
|
||||
|
||||
-- Transfer or remove a shared spawn if player is owner
|
||||
if (global.ocore.sharedSpawns[playerName] ~= nil) then
|
||||
local sharedSpawn = global.ocore.sharedSpawns[playerName] --[[@as OarcSharedSpawn]]
|
||||
@ -835,6 +828,9 @@ function CleanupPlayerGlobals(playerName)
|
||||
end
|
||||
end
|
||||
|
||||
-- Remove them from any join queues they may be in:
|
||||
RemovePlayerFromJoinQueue(playerName)
|
||||
|
||||
if (global.ocore.playerCooldowns[playerName] ~= nil) then
|
||||
global.ocore.playerCooldowns[playerName] = nil
|
||||
end
|
||||
@ -865,6 +861,26 @@ end
|
||||
|
||||
--]]
|
||||
|
||||
---Finds and removes a player from a shared spawn join queue, and refreshes the host's GUI.
|
||||
---@param player_name string
|
||||
---@return boolean
|
||||
function RemovePlayerFromJoinQueue(player_name)
|
||||
for host_name, shared_spawn in pairs(global.ocore.sharedSpawns --[[@as OarcSharedSpawnsTable]]) do
|
||||
for index, requestor in pairs(shared_spawn.joinQueue) do
|
||||
if (requestor == player_name) then
|
||||
global.ocore.sharedSpawns[host_name].joinQueue[index] = nil
|
||||
local host_player = game.players[host_name]
|
||||
if (host_player ~= nil) and (host_player.connected) then
|
||||
host_player.print({ "oarc-player-cancel-join-request", player_name })
|
||||
OarcGuiRefreshContent(host_player)
|
||||
end
|
||||
return true
|
||||
end
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
---Same as GetClosestPosFromTable but specific to global.ocore.uniqueSpawns
|
||||
---@param surface LuaSurface
|
||||
---@param pos MapPosition
|
||||
@ -1109,11 +1125,15 @@ end
|
||||
---@return nil
|
||||
function SendPlayerToSpawn(player)
|
||||
local playerSpawn = GetPlayerCustomSpawn(player)
|
||||
|
||||
player.permission_group = game.permissions.get_group("default")
|
||||
|
||||
if (playerSpawn ~= nil) then
|
||||
SafeTeleport(player,
|
||||
game.surfaces[playerSpawn.surface],
|
||||
playerSpawn.position)
|
||||
else
|
||||
log("ERROR - SendPlayerToSpawn - No custom spawn point found for player: " .. player.name)
|
||||
local gameplayConfig = global.ocfg.gameplay --[[@as OarcConfigGameplaySettings]]
|
||||
SafeTeleport(player,
|
||||
game.surfaces[gameplayConfig.default_surface],
|
||||
|
@ -388,6 +388,8 @@ function CreateSharedSpawnFrame(parent_flow, enable_shared_spawns)
|
||||
|
||||
if (num_avail_spawns > 0) then
|
||||
|
||||
AddLabel(shared_spawn_frame, "join_other_spawn_lbl1", { "oarc-join-someone-info" }, my_label_style)
|
||||
|
||||
local previous_index = 0
|
||||
if selected_host then
|
||||
for i,host in ipairs(avail_hosts) do
|
||||
@ -424,7 +426,7 @@ function CreateSharedSpawnFrame(parent_flow, enable_shared_spawns)
|
||||
dragger.style.horizontally_stretchable = true
|
||||
|
||||
|
||||
local button = shared_spawn_frame.add {
|
||||
local button = horizontal_flow.add {
|
||||
name = "join_other_spawn",
|
||||
tags = { action = "oarc_spawn_options", setting = "join_other_spawn" },
|
||||
type = "button",
|
||||
@ -433,7 +435,7 @@ function CreateSharedSpawnFrame(parent_flow, enable_shared_spawns)
|
||||
}
|
||||
button.style.horizontal_align = "right"
|
||||
|
||||
AddLabel(shared_spawn_frame, "join_other_spawn_lbl1", { "oarc-join-someone-info" }, my_label_style)
|
||||
|
||||
else
|
||||
AddLabel(shared_spawn_frame, "join_other_spawn_lbl1", { "oarc-no-shared-avail" }, my_label_style)
|
||||
end
|
||||
@ -666,7 +668,7 @@ end
|
||||
---Handle the gui click of the spawn options
|
||||
---@param event EventData.on_gui_click
|
||||
---@return nil
|
||||
function SpawnChoicesGuiClickNew(event)
|
||||
function SpawnOptsGuiClick(event)
|
||||
if not event.element.valid then return end
|
||||
local player = game.players[event.player_index]
|
||||
local tags = event.element.tags
|
||||
@ -780,20 +782,7 @@ function CancelSharedSpawnRequest(player)
|
||||
player.gui.screen.join_shared_spawn_wait_menu.destroy()
|
||||
DisplaySpawnOptions(player)
|
||||
|
||||
-- Find and remove the player from the joinQueue they were in.
|
||||
for host_name, shared_spawn in pairs(global.ocore.sharedSpawns --[[@as OarcSharedSpawnsTable]]) do
|
||||
for index, requestor in pairs(shared_spawn.joinQueue) do
|
||||
if (requestor == player.name) then
|
||||
global.ocore.sharedSpawns[host_name].joinQueue[index] = nil
|
||||
local host_player = game.players[host_name]
|
||||
if (host_player ~= nil) and (host_player.connected) then
|
||||
game.players[host_name].print({ "oarc-player-cancel-join-request", player.name })
|
||||
OarcGuiRefreshContent(game.players[host_name])
|
||||
end
|
||||
return -- Found and removed player from joinQueue
|
||||
end
|
||||
end
|
||||
end
|
||||
RemovePlayerFromJoinQueue(player.name)
|
||||
|
||||
log("ERROR! Failed to remove player from joinQueue?!")
|
||||
end
|
||||
@ -908,103 +897,6 @@ function SpawnRequest(player)
|
||||
end
|
||||
end
|
||||
|
||||
---Handle the gui click of the spawn options
|
||||
-- ---@param event EventData.on_gui_click
|
||||
-- ---@return nil
|
||||
-- function SpawnOptsGuiClick(event)
|
||||
-- if not event.element.valid then return end
|
||||
-- local player = game.players[event.player_index]
|
||||
-- local elemName = event.element.name
|
||||
|
||||
-- if not player then
|
||||
-- log("Another gui click happened with no valid player...")
|
||||
-- return
|
||||
-- end
|
||||
|
||||
-- if (player.gui.screen.spawn_opts == nil) then
|
||||
-- return -- Gui event unrelated to this gui.
|
||||
-- end
|
||||
|
||||
-- local pgcs = player.gui.screen.spawn_opts
|
||||
|
||||
-- local joinOwnTeamRadio, moatChoice = false, false
|
||||
-- local surfaceName = global.ocfg.gameplay.default_surface -- Default to default surface
|
||||
-- local surface = game.surfaces[surfaceName]
|
||||
|
||||
-- -- Check if a valid button on the gui was pressed
|
||||
-- -- and delete the GUI
|
||||
-- if ((elemName == "default_spawn_btn") or
|
||||
-- (elemName == "isolated_spawn_near") or
|
||||
-- (elemName == "isolated_spawn_far") or
|
||||
-- (elemName == "join_other_spawn") or
|
||||
-- (elemName == "buddy_spawn") or
|
||||
-- (elemName == "join_other_spawn_check")) then
|
||||
-- if (global.ocfg.gameplay.enable_separate_teams) then
|
||||
-- joinMainTeamRadio = pgcs.spawn_solo_flow.isolated_spawn_main_team_radio.state
|
||||
-- joinOwnTeamRadio = pgcs.spawn_solo_flow.isolated_spawn_new_team_radio.state
|
||||
-- else
|
||||
-- joinMainTeamRadio = true
|
||||
-- joinOwnTeamRadio = false
|
||||
-- end
|
||||
-- ---TODO: Vanilla spawn points are not implemented yet. and not global.ocfg.enable_vanilla_spawns
|
||||
-- if (global.ocfg.gameplay.allow_moats_around_spawns and
|
||||
-- (pgcs.spawn_solo_flow.isolated_spawn_moat_option_checkbox ~= nil)) then
|
||||
-- moatChoice = pgcs.spawn_solo_flow.isolated_spawn_moat_option_checkbox.state
|
||||
-- end
|
||||
|
||||
-- -- Override the default surface if the player selected a different one.
|
||||
-- local surfaceDropdownIndex = pgcs.spawn_solo_flow.surfaces_horizontal_flow.surface_select_dropdown.selected_index
|
||||
|
||||
-- -- Index 0 means nothing was selected!
|
||||
-- if (surfaceDropdownIndex ~= 0) then
|
||||
-- surfaceName = pgcs.spawn_solo_flow.surfaces_horizontal_flow.surface_select_dropdown.get_item(surfaceDropdownIndex) --[[@as string]]
|
||||
-- surface = game.surfaces[surfaceName]
|
||||
-- end
|
||||
|
||||
-- -- if (global.ocfg.enable_vanilla_spawns and
|
||||
-- -- (pgcs.spawn_solo_flow.isolated_spawn_vanilla_option_checkbox ~= nil)) then
|
||||
-- -- vanillaChoice = pgcs.spawn_solo_flow.isolated_spawn_vanilla_option_checkbox.state
|
||||
-- -- end
|
||||
-- pgcs.destroy()
|
||||
-- else
|
||||
-- return -- Do nothing, no valid element item was clicked.
|
||||
-- end
|
||||
|
||||
-- -- Default spawn should always spawn on a default surface I think?
|
||||
-- if (elemName == "default_spawn_btn") then
|
||||
-- GivePlayerStarterItems(player)
|
||||
|
||||
-- local defaultSurfaceName = global.ocfg.gameplay.default_surface
|
||||
-- local defaultSurface = game.surfaces[defaultSurfaceName]
|
||||
-- local spawnPosition = player.force.get_spawn_position(defaultSurface)
|
||||
|
||||
-- ChangePlayerSpawn(player, defaultSurfaceName, spawnPosition)
|
||||
-- SendBroadcastMsg({ "oarc-player-is-joining-main-force", player.name, defaultSurfaceName })
|
||||
-- ChartArea(player.force, player.position,
|
||||
-- math.ceil(global.ocfg.surfaces_config[defaultSurfaceName].spawn_config.general.spawn_radius_tiles / CHUNK_SIZE),
|
||||
-- defaultSurface)
|
||||
-- -- Unlock spawn control gui tab
|
||||
-- SetOarcGuiTabEnabled(player, OARC_SPAWN_CTRL_TAB_NAME, true)
|
||||
|
||||
-- elseif ((elemName == "isolated_spawn_near") or (elemName == "isolated_spawn_far")) then
|
||||
-- --- MOVED
|
||||
-- elseif (elemName == "join_other_spawn") then
|
||||
-- DisplaySharedSpawnOptions(player)
|
||||
|
||||
-- -- Provide a way to refresh the gui to check if people have shared their
|
||||
-- -- bases.
|
||||
-- elseif (elemName == "join_other_spawn_check") then
|
||||
-- DisplaySpawnOptions(player)
|
||||
|
||||
-- -- Hacky buddy spawn system
|
||||
-- elseif (elemName == "buddy_spawn") then
|
||||
-- table.insert(global.ocore.waitingBuddies --[[@as OarcWaitingBuddiesTable]], player.name)
|
||||
-- SendBroadcastMsg({ "oarc-looking-for-buddy", player.name })
|
||||
|
||||
-- DisplayBuddySpawnOptions(player)
|
||||
-- end
|
||||
-- end
|
||||
|
||||
---Display the spawn options and explanation
|
||||
---@param player LuaPlayer
|
||||
---@return nil
|
||||
@ -1047,22 +939,36 @@ function DisplaySharedSpawnOptions(player)
|
||||
style = "back_button" }
|
||||
end
|
||||
|
||||
---Display shared spawn join wait menu
|
||||
---Display shared spawn join wait menu to the requesting player
|
||||
---@param player LuaPlayer
|
||||
---@return nil
|
||||
function DisplaySharedSpawnJoinWaitMenu(player)
|
||||
local sGui = player.gui.screen.add { name = "join_shared_spawn_wait_menu",
|
||||
|
||||
if (player.gui.screen.spawn_opts ~= nil) then
|
||||
player.gui.screen.spawn_opts.destroy()
|
||||
end
|
||||
|
||||
local sGui = player.gui.screen.add {
|
||||
name = "join_shared_spawn_wait_menu",
|
||||
type = "frame",
|
||||
direction = "vertical",
|
||||
caption = { "oarc-waiting-for-spawn-owner" } }
|
||||
caption = { "oarc-waiting-for-spawn-owner" }
|
||||
}
|
||||
|
||||
sGui.auto_center = true
|
||||
sGui.style.maximal_width = SPAWN_GUI_MAX_WIDTH
|
||||
sGui.style.maximal_height = SPAWN_GUI_MAX_HEIGHT
|
||||
sGui.style.padding = 5
|
||||
|
||||
local sGui_if = sGui.add {
|
||||
type = "frame",
|
||||
direction = "vertical",
|
||||
style = "inside_shallow_frame_with_padding"
|
||||
}
|
||||
|
||||
-- Warnings and explanations...
|
||||
AddLabel(sGui, "warning_lbl1", { "oarc-you-will-spawn-once-host" }, my_warning_style)
|
||||
|
||||
AddLabel(sGui_if, "warning_lbl1", { "oarc-you-will-spawn-once-host" }, my_note_style)
|
||||
|
||||
|
||||
local button_flow = sGui.add {
|
||||
type = "flow",
|
||||
@ -1079,48 +985,10 @@ function DisplaySharedSpawnJoinWaitMenu(player)
|
||||
tooltip = { "oarc-return-to-previous-tooltip" },
|
||||
style = "back_button"
|
||||
}
|
||||
cancel_button.style.horizontal_align = "left"
|
||||
end
|
||||
|
||||
---Handle the gui click of the shared spawn join wait menu
|
||||
---@param event EventData.on_gui_click
|
||||
---@return nil
|
||||
function SharedSpawnJoinWaitMenuClick(event)
|
||||
if not event.element.valid then return end
|
||||
local player = game.players[event.player_index]
|
||||
local elem_name = event.element.name
|
||||
|
||||
if not player then
|
||||
log("Another gui click happened with no valid player...")
|
||||
return
|
||||
end
|
||||
|
||||
if (player.gui.screen.join_shared_spawn_wait_menu == nil) then
|
||||
return -- Gui event unrelated to this gui.
|
||||
end
|
||||
|
||||
-- Check if player is cancelling the request.
|
||||
if (elem_name == "cancel_shared_spawn_wait_menu") then
|
||||
player.gui.screen.join_shared_spawn_wait_menu.destroy()
|
||||
DisplaySpawnOptions(player)
|
||||
|
||||
-- Find and remove the player from the joinQueue they were in.
|
||||
for host_name, shared_spawn in pairs(global.ocore.sharedSpawns --[[@as OarcSharedSpawnsTable]]) do
|
||||
for index, requestor in pairs(shared_spawn.joinQueue) do
|
||||
if (requestor == player.name) then
|
||||
global.ocore.sharedSpawns[host_name].joinQueue[index] = nil
|
||||
local host_player = game.players[host_name]
|
||||
if (host_player ~= nil) and (host_player.connected) then
|
||||
game.players[host_name].print({ "oarc-player-cancel-join-request", player.name })
|
||||
OarcGuiRefreshContent(game.players[host_name])
|
||||
end
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
log("ERROR! Failed to remove player from joinQueue!")
|
||||
end
|
||||
local dragger = button_flow.add{type="empty-widget", style="draggable_space_with_no_right_margin"}
|
||||
dragger.style.horizontally_stretchable = true
|
||||
dragger.style.height = 30
|
||||
end
|
||||
|
||||
|
||||
@ -1152,10 +1020,10 @@ function DisplayBuddySpawnWaitMenu(player)
|
||||
}
|
||||
|
||||
-- Warnings and explanations...
|
||||
AddLabel(buddy_wait_menu_if, nil, { "oarc-wait-buddy-select-yes" }, my_warning_style)
|
||||
AddLabel(buddy_wait_menu_if, nil, { "oarc-wait-buddy-select-yes" }, my_note_style)
|
||||
AddSpacer(buddy_wait_menu_if)
|
||||
|
||||
local button_flow = buddy_wait_menu_if.add {
|
||||
local button_flow = buddy_wait_menu.add {
|
||||
type = "flow",
|
||||
direction = "horizontal",
|
||||
style = "dialog_buttons_horizontal_flow"
|
||||
@ -1170,7 +1038,10 @@ function DisplayBuddySpawnWaitMenu(player)
|
||||
caption = { "oarc-cancel-button-caption" },
|
||||
tooltip = { "oarc-return-to-previous-tooltip" },
|
||||
}
|
||||
cancel_button.style.horizontal_align = "left"
|
||||
|
||||
local dragger = button_flow.add{type="empty-widget", style="draggable_space_with_no_right_margin"}
|
||||
dragger.style.horizontally_stretchable = true
|
||||
dragger.style.height = 30
|
||||
end
|
||||
|
||||
|
||||
@ -1366,7 +1237,6 @@ function RejectBuddyRequest(player, requesting_buddy_name)
|
||||
requester_buddy.print({ "oarc-buddy-declined", player.name })
|
||||
end
|
||||
|
||||
|
||||
---Display the please wait dialog
|
||||
---@param player LuaPlayer
|
||||
---@param delay_seconds integer
|
||||
@ -1389,7 +1259,13 @@ function DisplayPleaseWaitForSpawnDialog(player, delay_seconds)
|
||||
---@type OarcPlayerSpawn
|
||||
local player_spawn = global.ocore.playerSpawns[player.name]
|
||||
|
||||
pleaseWaitGui.add {
|
||||
local pleaseWaitGui_if = pleaseWaitGui.add {
|
||||
type = "frame",
|
||||
direction = "vertical",
|
||||
style = "inside_shallow_frame_with_padding"
|
||||
}
|
||||
|
||||
pleaseWaitGui_if.add {
|
||||
type = "minimap",
|
||||
position = player_spawn.position,
|
||||
surface_index = game.surfaces[player_spawn.surface].index,
|
||||
@ -1397,7 +1273,6 @@ function DisplayPleaseWaitForSpawnDialog(player, delay_seconds)
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
---Get a list of OTHER players currently in the spawn menu
|
||||
---@param self_player LuaPlayer
|
||||
---@return table
|
||||
@ -1416,15 +1291,7 @@ end
|
||||
---@return nil
|
||||
function SeparateSpawnsGuiClick(event)
|
||||
WelcomeTextGuiClick(event)
|
||||
|
||||
SpawnChoicesGuiClickNew(event)
|
||||
|
||||
-- SpawnOptsGuiClick(event)
|
||||
-- SharedSpwnOptsGuiClick(event)
|
||||
-- BuddySpawnOptsGuiClick(event)
|
||||
-- BuddySpawnWaitMenuClick(event)
|
||||
-- BuddySpawnRequestMenuClick(event)
|
||||
SharedSpawnJoinWaitMenuClick(event)
|
||||
SpawnOptsGuiClick(event)
|
||||
end
|
||||
|
||||
---Gui checked state changed event handlers
|
||||
|
@ -41,7 +41,7 @@ oarc-join-someone-info=You can request to join someone else's starting area. Thi
|
||||
oarc-no-shared-avail=There are currently no shared bases availble to spawn at.
|
||||
oarc-join-check-again=Check Again
|
||||
oarc-shared-spawn-disabled=Shared spawns are disabled in this mode.
|
||||
oarc-no-shared-spawn-selected=You have not selected a vlid player to join. Please select one from the list.
|
||||
oarc-no-shared-spawn-selected=You have not selected a valid player to join. Please select one from the list.
|
||||
oarc-invalid-host-shared-spawn=Selected player is no longer available! Please try again.
|
||||
|
||||
oarc-buddy-spawn=Request Buddy Spawn
|
||||
@ -89,13 +89,12 @@ oarc-stop-shared-base=New players can no longer join __1__'s base!
|
||||
|
||||
oarc-spawn-point-updated=Re-spawn point updated!
|
||||
oarc-selected-player-not-wait=Selected player is no longer waiting to join!
|
||||
oarc-selected-player-not-valid=Please select a valid player!
|
||||
oarc-reject-joiner=You rejected __1__'s request to join your base.
|
||||
oarc-your-request-rejected=Your request to join was rejected.
|
||||
|
||||
oarc-player-joining-base=__1__ is joining __2__'s base!
|
||||
|
||||
oarc-player-left-while-joining=__1__ left the game. What an ass.
|
||||
|
||||
oarc-buddy-select-label=Select Buddy:
|
||||
oarc-buddy-spawn-options=Buddy Spawn Options
|
||||
oarc-buddy-spawn-instructions=You and your buddy must be in this menu at the same time. Only one of you can send the request. Select your your spawn options first, then select your buddy from the list. Click Request Buddy Spawn. The other buddy can then accept (or deny) the request. This will allow you both to spawn next to each other, each with your own spawn area.
|
||||
|
Loading…
Reference in New Issue
Block a user