mirror of
https://github.com/Oarcinae/FactorioScenarioMultiplayerSpawn.git
synced 2025-03-05 14:45:19 +02:00
Add a dialog to tell players to wait while their spawn is created.
This commit is contained in:
parent
7179e44a1e
commit
4c89f75908
@ -85,10 +85,9 @@ function FindUnusedSpawns(event)
|
||||
nearOtherSpawn = false
|
||||
for spawnPlayerName,otherSpawnPos in pairs(global.uniqueSpawns) do
|
||||
if ((spawnPlayerName ~= player.name) and (getDistance(spawnPos, otherSpawnPos.pos) < (CHUNK_SIZE*10))) then
|
||||
DebugPrint("Won't remove base as it's close to another spawn.")
|
||||
DebugPrint("Won't remove base as it's close to another spawn: " .. spawnPlayerName)
|
||||
nearOtherSpawn = true
|
||||
end
|
||||
DebugPrint("Checking distance to spawn: " .. spawnPlayerName)
|
||||
end
|
||||
|
||||
if (ENABLE_ABANDONED_BASE_REMOVAL and not nearOtherSpawn) then
|
||||
@ -268,6 +267,8 @@ function QueuePlayerForDelayedSpawn(playerName, spawn, moatEnabled)
|
||||
delayedTick = game.tick + 10*TICKS_PER_SECOND
|
||||
table.insert(global.delayedSpawns, {playerName=playerName, spawn=spawn, moatEnabled=moatEnabled, delayedTick=delayedTick})
|
||||
|
||||
DisplayPleaseWaitForSpawnDialog(game.players[playerName])
|
||||
|
||||
else
|
||||
DebugPrint("THIS SHOULD NOT EVER HAPPEN! Spawn failed!")
|
||||
SendBroadcastMsg("ERROR!! Failed to create spawn point for: " .. playerName)
|
||||
@ -312,6 +313,10 @@ function SendPlayerToNewSpawnAndCreateIt(playerName, spawn, moatEnabled)
|
||||
-- Send the player to that position
|
||||
game.players[playerName].teleport(spawn, GAME_SURFACE_NAME)
|
||||
GivePlayerStarterItems(game.players[playerName])
|
||||
|
||||
if (game.players[playerName].gui.center.wait_for_spawn_dialog ~= nil) then
|
||||
game.players[playerName].gui.center.wait_for_spawn_dialog.destroy()
|
||||
end
|
||||
end
|
||||
|
||||
function SendPlayerToSpawn(player)
|
||||
|
@ -1318,3 +1318,31 @@ function BuddySpawnRequestMenuClick(event)
|
||||
requesterBuddy.print(player.name .. " declined your buddy request!")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function DisplayPleaseWaitForSpawnDialog(player)
|
||||
|
||||
player.gui.center.add{name = "wait_for_spawn_dialog",
|
||||
type = "frame",
|
||||
direction = "vertical",
|
||||
caption="Please wait!"}
|
||||
local pleaseWaitGui = player.gui.center.wait_for_spawn_dialog
|
||||
pleaseWaitGui.style.maximal_width = SPAWN_GUI_MAX_WIDTH
|
||||
pleaseWaitGui.style.maximal_height = SPAWN_GUI_MAX_HEIGHT
|
||||
|
||||
|
||||
-- Warnings and explanations...
|
||||
pleaseWaitGui.add{name = "warning_lbl1", type = "label",
|
||||
caption="Your spawn is being created now."}
|
||||
pleaseWaitGui.add{name = "warning_lbl2", type = "label",
|
||||
caption="You will be teleported there in about 10 seconds!"}
|
||||
pleaseWaitGui.add{name = "warning_lbl3", type = "label",
|
||||
caption="Please standby..."}
|
||||
pleaseWaitGui.add{name = "warning_spacer", type = "label",
|
||||
caption=" "}
|
||||
ApplyStyle(pleaseWaitGui.warning_lbl1, my_warning_style)
|
||||
ApplyStyle(pleaseWaitGui.warning_lbl2, my_warning_style)
|
||||
ApplyStyle(pleaseWaitGui.warning_lbl3, my_warning_style)
|
||||
ApplyStyle(pleaseWaitGui.warning_spacer, my_spacer_style)
|
||||
|
||||
end
|
Loading…
x
Reference in New Issue
Block a user