You've already forked FactorioScenarioMultiplayerSpawn
mirror of
https://github.com/Oarcinae/FactorioScenarioMultiplayerSpawn.git
synced 2025-07-17 01:12:20 +02:00
Add a dialog to tell players to wait while their spawn is created.
This commit is contained in:
@ -85,10 +85,9 @@ function FindUnusedSpawns(event)
|
|||||||
nearOtherSpawn = false
|
nearOtherSpawn = false
|
||||||
for spawnPlayerName,otherSpawnPos in pairs(global.uniqueSpawns) do
|
for spawnPlayerName,otherSpawnPos in pairs(global.uniqueSpawns) do
|
||||||
if ((spawnPlayerName ~= player.name) and (getDistance(spawnPos, otherSpawnPos.pos) < (CHUNK_SIZE*10))) then
|
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
|
nearOtherSpawn = true
|
||||||
end
|
end
|
||||||
DebugPrint("Checking distance to spawn: " .. spawnPlayerName)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if (ENABLE_ABANDONED_BASE_REMOVAL and not nearOtherSpawn) then
|
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
|
delayedTick = game.tick + 10*TICKS_PER_SECOND
|
||||||
table.insert(global.delayedSpawns, {playerName=playerName, spawn=spawn, moatEnabled=moatEnabled, delayedTick=delayedTick})
|
table.insert(global.delayedSpawns, {playerName=playerName, spawn=spawn, moatEnabled=moatEnabled, delayedTick=delayedTick})
|
||||||
|
|
||||||
|
DisplayPleaseWaitForSpawnDialog(game.players[playerName])
|
||||||
|
|
||||||
else
|
else
|
||||||
DebugPrint("THIS SHOULD NOT EVER HAPPEN! Spawn failed!")
|
DebugPrint("THIS SHOULD NOT EVER HAPPEN! Spawn failed!")
|
||||||
SendBroadcastMsg("ERROR!! Failed to create spawn point for: " .. playerName)
|
SendBroadcastMsg("ERROR!! Failed to create spawn point for: " .. playerName)
|
||||||
@ -312,6 +313,10 @@ function SendPlayerToNewSpawnAndCreateIt(playerName, spawn, moatEnabled)
|
|||||||
-- Send the player to that position
|
-- Send the player to that position
|
||||||
game.players[playerName].teleport(spawn, GAME_SURFACE_NAME)
|
game.players[playerName].teleport(spawn, GAME_SURFACE_NAME)
|
||||||
GivePlayerStarterItems(game.players[playerName])
|
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
|
end
|
||||||
|
|
||||||
function SendPlayerToSpawn(player)
|
function SendPlayerToSpawn(player)
|
||||||
|
@ -1318,3 +1318,31 @@ function BuddySpawnRequestMenuClick(event)
|
|||||||
requesterBuddy.print(player.name .. " declined your buddy request!")
|
requesterBuddy.print(player.name .. " declined your buddy request!")
|
||||||
end
|
end
|
||||||
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
|
Reference in New Issue
Block a user