diff --git a/code/modules/mob/new_player/login.dm b/code/modules/mob/new_player/login.dm index 480a90d8b5c6..048bdeb361df 100644 --- a/code/modules/mob/new_player/login.dm +++ b/code/modules/mob/new_player/login.dm @@ -1,5 +1,3 @@ -/mob/new_player/var/datum/tgui_window/lobby_window - /mob/new_player/Login() if(!mind) mind = new /datum/mind(key, ckey) @@ -67,6 +65,8 @@ .["round_start"] = !SSticker || !SSticker.mode || SSticker.current_state <= GAME_STATE_PREGAME .["readied"] = ready + .["confirmation_message"] = lobby_confirmation_message + .["upp_enabled"] = GLOB.master_mode == /datum/game_mode/extended/faction_clash/cm_vs_upp::name .["xenomorph_enabled"] = GLOB.master_mode == /datum/game_mode/colonialmarines::name && client.prefs && (client.prefs.get_job_priority(JOB_XENOMORPH) || client.prefs.get_job_priority(JOB_XENOMORPH_QUEEN)) .["predator_enabled"] = SSticker.mode?.flags_round_type & MODE_PREDATOR && SSticker.mode.check_predator_late_join(src, FALSE) @@ -170,13 +170,11 @@ if(SSticker.mode.check_xeno_late_join(src)) var/mob/new_xeno = SSticker.mode.attempt_to_join_as_xeno(src, FALSE) if(!new_xeno) - if(!client) - return FALSE - - if(client.prefs && !(client.prefs.be_special & BE_ALIEN_AFTER_DEATH)) - client.prefs.be_special |= BE_ALIEN_AFTER_DEATH - to_chat(src, SPAN_BOLDNOTICE("You will now be considered for Xenomorph after unrevivable death events (where possible).")) - attempt_observe() + lobby_confirmation_message = list( + "Are you sure you wish to observe to be a xeno candidate?", + "When you observe, you will not be able to join as marine.", + "It might also take some time to become a xeno or responder!") + execute_on_confirm = CALLBACK(src, PROC_REF(observe_for_xeno)) else if(!istype(new_xeno, /mob/living/carbon/xenomorph/larva)) SSticker.mode.transfer_xeno(src, new_xeno) @@ -216,7 +214,7 @@ return TRUE if("ready") - if( (SSticker.current_state <= GAME_STATE_PREGAME) && !ready) // Make sure we don't ready up after the round has started + if((SSticker.current_state <= GAME_STATE_PREGAME) && !ready) // Make sure we don't ready up after the round has started ready = TRUE GLOB.readied_players++ @@ -229,9 +227,27 @@ return TRUE + if("confirm") + lobby_confirmation_message = null + execute_on_confirm?.Invoke() + execute_on_confirm = null + return TRUE + + if("unconfirm") + lobby_confirmation_message = null + execute_on_confirm = null + return TRUE + if("keyboard") playsound_client(client, get_sfx("keyboard"), vol = 20) +/// Join as a 'xeno' - set us up in the larva queue +/mob/new_player/proc/observe_for_xeno() + if(client.prefs && !(client.prefs.be_special & BE_ALIEN_AFTER_DEATH)) + client.prefs.be_special |= BE_ALIEN_AFTER_DEATH + to_chat(src, SPAN_BOLDNOTICE("You will now be considered for Xenomorph after unrevivable death events (where possible).")) + attempt_observe() + /mob/new_player/proc/lobby() if(!client) return diff --git a/code/modules/mob/new_player/new_player.dm b/code/modules/mob/new_player/new_player.dm index 79e8a1f1acf0..1add99af6a5f 100644 --- a/code/modules/mob/new_player/new_player.dm +++ b/code/modules/mob/new_player/new_player.dm @@ -13,6 +13,15 @@ ///The time when the larva_queue_cached_message should be considered stale var/larva_queue_message_stale_time + /// The window that we display the main menu in + var/datum/tgui_window/lobby_window + + /// The message that we are displaying to the user. If a list, each list element is displayed on its own line + var/lobby_confirmation_message + + /// The callback that we will execute when the user confirms the message + var/datum/callback/execute_on_confirm + /mob/new_player/Initialize() . = ..() GLOB.dead_mob_list -= src diff --git a/tgui/packages/tgui/interfaces/LobbyMenu.tsx b/tgui/packages/tgui/interfaces/LobbyMenu.tsx index e02ac36e7de0..c21ce9076533 100644 --- a/tgui/packages/tgui/interfaces/LobbyMenu.tsx +++ b/tgui/packages/tgui/interfaces/LobbyMenu.tsx @@ -36,6 +36,8 @@ type LobbyData = { round_start: BooleanLike; readied: BooleanLike; + confirmation_message?: string | string[]; + upp_enabled: BooleanLike; xenomorph_enabled: BooleanLike; predator_enabled: BooleanLike; @@ -56,7 +58,7 @@ const LobbyContext = createContext({ export const LobbyMenu = () => { const { act, data } = useBackend(); - const { lobby_author, upp_enabled } = data; + const { lobby_author, upp_enabled, confirmation_message } = data; const onLoadPlayer = useRef(null); @@ -82,6 +84,44 @@ export const LobbyMenu = () => { }, 10000); }, []); + useEffect(() => { + if (!confirmation_message) return; + + setModal( +
{ + setModal!(false); + act('unconfirm'); + }} + icon={'x'} + /> + } + p={3} + title={'Confirm'} + > + + + {Array.isArray(confirmation_message) ? ( + confirmation_message.map((element, index) => ( + {element} + )) + ) : ( + {confirmation_message} + )} + + + + + + + +
, + ); + }, [confirmation_message]); + const [hidden, setHidden] = useState(false); if (themeDisabled === undefined) { @@ -420,27 +460,7 @@ const LobbyButtons = (props: { { - setModal( - - - - - Are you sure want to attempt joining as a - Xenomorph? - - - - - - - - - , - ); - }} + onClick={() => act('late_join_xeno')} > Join the Hive