diff --git a/code/controllers/subsystem/overmap.dm b/code/controllers/subsystem/overmap.dm index de03f6a5a03e..b96a4944c812 100644 --- a/code/controllers/subsystem/overmap.dm +++ b/code/controllers/subsystem/overmap.dm @@ -31,6 +31,9 @@ SUBSYSTEM_DEF(overmap) ///The two-dimensional list that contains every single tile in the overmap as a sublist. var/list/list/overmap_container + ///Whether or not a ship is currently being spawned. Used to prevent multiple ships from being spawned at once. + var/ship_spawning //TODO: Make a proper queue for this + /datum/controller/subsystem/overmap/get_metrics() . = ..() var/list/cust = list() @@ -227,13 +230,18 @@ SUBSYSTEM_DEF(overmap) * Inteded for ship purchases, etc. */ /datum/controller/subsystem/overmap/proc/spawn_ship_at_start(datum/map_template/shuttle/template) + //Should never happen, but just in case. This'll delay the next spawn until the current one is done. + UNTIL(!ship_spawning) + var/ship_loc if(template.space_spawn) ship_loc = null else ship_loc = SSovermap.outposts[1] - return new /datum/overmap/ship/controlled(ship_loc, template) + ship_spawning = TRUE + . = new /datum/overmap/ship/controlled(ship_loc, template) //This statement SHOULDN'T runtime (not counting runtimes actually in the constructor) so ship_spawning should always be toggled. + ship_spawning = FALSE /** * Creates an overmap object for each ruin level, making them accessible. diff --git a/code/modules/mob/dead/new_player/ship_select.dm b/code/modules/mob/dead/new_player/ship_select.dm index 88146c9ea0fd..1515aa82f799 100644 --- a/code/modules/mob/dead/new_player/ship_select.dm +++ b/code/modules/mob/dead/new_player/ship_select.dm @@ -71,6 +71,9 @@ return var/datum/map_template/shuttle/template = SSmapping.ship_purchase_list[params["name"]] + if(SSovermap.ship_spawning) + to_chat(spawnee, "A ship is currently spawning. Try again in a little while.") + return if(!SSovermap.player_ship_spawn_allowed()) to_chat(spawnee, "No more ships may be spawned at this time!") return @@ -104,6 +107,10 @@ to_chat(spawnee, "Ship spawned, but you were unable to be spawned. You can likely try to spawn in the ship through joining normally, but if not, please contact an admin.") spawnee.new_player_panel() +/datum/ship_select/ui_data(mob/user) + . = list() + .["shipSpawning"] = SSovermap.ship_spawning + /datum/ship_select/ui_static_data(mob/user) // tracks the number of existing ships of each template type so that their unavailability for purchase can be communicated to the user var/list/template_num_lookup = list() diff --git a/tgui/packages/tgui/interfaces/ShipSelect.js b/tgui/packages/tgui/interfaces/ShipSelect.js index 11c48f96175e..72cff05306d2 100644 --- a/tgui/packages/tgui/interfaces/ShipSelect.js +++ b/tgui/packages/tgui/interfaces/ShipSelect.js @@ -67,7 +67,9 @@ export const ShipSelect = (props, context) => { (data.purchaseBanned && 'You are banned from purchasing ships.') || (!data.shipSpawnAllowed && - 'No more ships may be spawned at this time.') + 'No more ships may be spawned at this time.') || + (data.shipSpawning && + 'A ship is currently spawning. Please wait.') } disabled={data.purchaseBanned} onClick={() => { @@ -254,10 +256,13 @@ export const ShipSelect = (props, context) => { 'There are too many ships of this type.') || (!data.autoMeet && data.playMin < template.minTime && - 'You do not have enough playtime to buy this ship.') + 'You do not have enough playtime to buy this ship.') || + (data.shipSpawning && + 'A ship is currently spawning. Please wait.') } disabled={ !data.shipSpawnAllowed || + data.shipSpawning || template.curNum >= template.limit || (!data.autoMeet && data.playMin < template.minTime) }