Adds a new, swanky new player option menu. (#9216)

Ported from Baystation12/Baystation12#28751 with a few assorted fixes.

I'll see if I can requisition a better fitting title screen from Kyres. In the meantime, take a gander at the Runtime Station title menu: https://cdn.discordapp.com/attachments/635914105668108316/726041678988705832/unknown.png
This commit is contained in:
Matt Atlas
2020-06-29 15:18:10 +03:00
committed by GitHub
parent 99e5300036
commit a5fd16aac9
11 changed files with 277 additions and 102 deletions
@@ -43,7 +43,6 @@
sight |= SEE_TURFS
player_list |= src
new_player_panel()
spawn(40)
if(client)
client.playtitlemusic()
@@ -0,0 +1,231 @@
//MENU SYSTEM BY BIGRAGE, some awful code, some awful design, all as you love //Code edits/additions by AshtonFox
/mob/abstract/new_player/instantiate_hud(datum/hud/HUD, ui_style, ui_color, ui_alpha)
HUD.new_player_hud(ui_style, ui_color, ui_alpha)
HUD.mymob = src
/datum/hud/new_player
hud_shown = TRUE
inventory_shown = FALSE
hotkey_ui_hidden = FALSE
/datum/hud/proc/new_player_hud(var/ui_style='icons/mob/screen/white.dmi', var/ui_color = "#fffffe", var/ui_alpha = 255)
adding = list()
var/obj/screen/using
using = new /obj/screen/new_player/title()
using.name = "Title"
adding += using
using = new /obj/screen/new_player/selection/join_game(src)
using.name = "Join Game"
adding += using
using = new /obj/screen/new_player/selection/settings()
using.name = "Setup Character"
adding += using
using = new /obj/screen/new_player/selection/manifest()
using.name = "Crew Manifest"
adding += using
using = new /obj/screen/new_player/selection/observe()
using.name = "Observe"
adding += using
using = new /obj/screen/new_player/selection/changelog()
using.name = "Changelog"
adding += using
using = new /obj/screen/new_player/selection/polls()
using.name = "Polls"
adding += using
mymob.client.screen = list()
mymob.client.screen += adding
src.adding += using
/obj/screen/new_player
icon = 'icons/misc/hudmenu.dmi'
layer = HUD_LAYER
/obj/screen/new_player/title
name = "Title"
screen_loc = "WEST,SOUTH"
/obj/screen/new_player/title/Initialize()
icon = current_map.lobby_icon
var/list/known_icon_states = icon_states(icon)
for(var/lobby_screen in current_map.lobby_screens)
if(!(lobby_screen in known_icon_states))
error("Lobby screen '[lobby_screen]' did not exist in the icon set [icon].")
current_map.lobby_screens -= lobby_screen
if(length(current_map.lobby_screens))
icon_state = pick(current_map.lobby_screens)
else
icon_state = known_icon_states[1]
. = ..()
/obj/screen/new_player/selection/join_game
name = "Join Game"
icon_state = "unready"
screen_loc = "LEFT+1,CENTER"
/obj/screen/new_player/selection/settings
name = "Setup"
icon_state = "setup"
screen_loc = "LEFT+1,CENTER-1"
/obj/screen/new_player/selection/manifest
name = "Crew Manifest"
icon_state = "manifest"
screen_loc = "LEFT+1,CENTER-2"
/obj/screen/new_player/selection/observe
name = "Observe"
icon_state = "observe"
screen_loc = "LEFT+1,CENTER-3"
/obj/screen/new_player/selection/changelog
name = "Changelog"
icon_state = "changelog"
screen_loc = "LEFT+1,CENTER-4"
/obj/screen/new_player/selection/polls
name = "Polls"
icon_state = "polls"
screen_loc = "LEFT+1,CENTER-5"
//SELECTION
/obj/screen/new_player/selection/New(var/desired_loc)
color = null
return ..()
/obj/screen/new_player/selection/MouseEntered(location,control,params) //Yellow color for the font
color = "#ffb200"
return ..()
/obj/screen/new_player/selection/MouseExited(location,control,params)
color = null
return ..()
/obj/screen/new_player/selection/join_game/New(var/datum/hud/H)
hud = H
var/mob/abstract/new_player/player = hud.mymob
update_icon(player)
/obj/screen/new_player/selection/join_game/Click()
var/mob/abstract/new_player/player = usr
sound_to(player, 'sound/effects/pop.ogg')
if(SSticker.current_state <= GAME_STATE_SETTING_UP)
if(player.ready)
player.ready = FALSE
player.ready(FALSE)
else
player.ready = TRUE
player.ready(TRUE)
else
player.join_game()
update_icon(player)
/obj/screen/new_player/selection/join_game/update_icon(var/mob/abstract/new_player/player)
if(SSticker.current_state <= GAME_STATE_SETTING_UP)
if(player.ready)
icon_state = "ready"
else
icon_state = "unready"
else
icon_state = "joingame"
/obj/screen/new_player/selection/manifest/Click()
var/mob/abstract/new_player/player = usr
sound_to(player, 'sound/effects/pop.ogg')
player.ViewManifest()
/obj/screen/new_player/selection/observe/Click()
var/mob/abstract/new_player/player = usr
sound_to(player, 'sound/effects/pop.ogg')
player.new_player_observe()
/obj/screen/new_player/selection/settings/Click()
var/mob/abstract/new_player/player = usr
sound_to(player, 'sound/effects/pop.ogg')
player.setupcharacter()
/obj/screen/new_player/selection/changelog/Click()
var/mob/abstract/new_player/player = usr
sound_to(player, 'sound/effects/pop.ogg')
player.client.changes()
/obj/screen/new_player/selection/poll/Click()
var/mob/abstract/new_player/player = usr
sound_to(player, 'sound/effects/pop.ogg')
player.handle_player_polling()
/mob/abstract/new_player/proc/setupcharacter()
client.prefs.ShowChoices(src)
return TRUE
/mob/abstract/new_player/proc/ready(var/readying = TRUE)
if(SSticker.current_state <= GAME_STATE_PREGAME) // Make sure we don't ready up after the round has started
// Cannot join without a saved character, if we're on SQL saves.
if (config.sql_saves && !client.prefs.current_character)
alert(src, "You have not saved your character yet. Please do so before readying up.")
return
if(client.unacked_warning_count > 0)
alert(src, "You can not ready up, because you have unacknowledged warnings. Acknowledge your warnings in OOC->Warnings and Notifications.")
return
ready = readying
else
ready = FALSE
/mob/abstract/new_player/proc/join_game(href, href_list)
if(SSticker.current_state <= GAME_STATE_SETTING_UP || SSticker.current_state >= GAME_STATE_FINISHED)
to_chat(usr, "<span class='warning'>The round is either not ready, or has already finished...</span>")
return
LateChoices() //show the latejoin job selection menu
/mob/abstract/new_player/proc/new_player_observe()
if(!SSATOMS_IS_PROBABLY_DONE)
// Don't allow players to observe until initialization is more or less complete.
// Letting them join too early breaks things, they can wait.
alert(src, "Please wait, the map is not initialized yet.")
return 0
if(alert(src,"Are you sure you wish to observe? You will have to wait [config.respawn_delay] minutes before being able to respawn!","Player Setup","Yes","No") == "Yes")
if(!client)
return TRUE
var/mob/abstract/observer/observer = new /mob/abstract/observer(src)
spawning = 1
sound_to(src, sound(null, repeat = 0, wait = 0, volume = 85, channel = 1))
observer.started_as_observer = 1
close_spawn_windows()
var/obj/O = locate("landmark*Observer-Start")
if(istype(O))
to_chat(src, "<span class='notice'>Now teleporting.</span>")
observer.forceMove(O.loc)
else
to_chat(src, "<span class='danger'>Could not locate an observer spawn point. Use the Teleport verb to jump to the station map.</span>")
observer.timeofdeath = world.time // Set the time of death so that the respawn timer works correctly.
announce_ghost_joinleave(src)
var/mob/living/carbon/human/dummy/mannequin = SSmob.get_mannequin(client.ckey)
client.prefs.dress_preview_mob(mannequin)
observer.appearance = mannequin
observer.alpha = 127
observer.layer = initial(observer.layer)
observer.invisibility = initial(observer.invisibility)
observer.desc = initial(observer.desc)
observer.real_name = client.prefs.real_name
observer.name = observer.real_name
if(!client.holder && !config.antag_hud_allowed)
observer.verbs -= /mob/abstract/observer/verb/toggle_antagHUD
observer.ckey = ckey
observer.initialise_postkey()
qdel(src)
@@ -22,54 +22,6 @@ INITIALIZE_IMMEDIATE(/mob/abstract/new_player)
. = ..()
dead_mob_list -= src
/mob/abstract/new_player/verb/new_player_panel()
set src = usr
new_player_panel_proc()
/mob/abstract/new_player/proc/new_player_panel_proc()
var/output = "<div align='center'><hr1><B>Welcome to the [station_name()]!</B></hr1><br>"
var/character_name = client.prefs.real_name
if(current_map.description)
output += "<i>[current_map.description]</i><hr>"
output += "<a href='byond://?src=\ref[src];show_preferences=1'>Setup Character</A> "
output += "<a href='byond://?src=\ref[src];observe=1'>Observe</A> "
if(ROUND_IS_STARTED)
output += "<a href='byond://?src=\ref[src];manifest=1'>View the Crew Manifest</A> "
if(!IsGuestKey(src.key))
establish_db_connection(dbcon)
if(dbcon.IsConnected())
var/isadmin = 0
if(src.client && src.client.holder)
isadmin = 1
var/DBQuery/query = dbcon.NewQuery("SELECT id FROM ss13_poll_question WHERE [(isadmin ? "" : "adminonly = false AND")] Now() BETWEEN starttime AND endtime AND id NOT IN (SELECT pollid FROM ss13_poll_vote WHERE ckey = \"[ckey]\") AND id NOT IN (SELECT pollid FROM ss13_poll_textreply WHERE ckey = \"[ckey]\")")
query.Execute()
var/newpoll = 0
while(query.NextRow())
newpoll = 1
break
if(newpoll)
output += "<b><a href='byond://?src=\ref[src];showpoll=1'>Show Player Polls</A> (NEW!)</b>"
else
output += "<a href='byond://?src=\ref[src];showpoll=1'>Show Player Polls</A>"
if(character_name)
output += "<hr>You will board as <b>[character_name]</b><br>"
if(ROUND_IS_STARTED)
output += "<a href='byond://?src=\ref[src];late_join=1'>Join the Game</A> "
else
if(ready)
output += "<a href='byond://?src=\ref[src];ready=0'>Un-Ready</a> "
else
output += "<a href='byond://?src=\ref[src];ready=1'>Ready Up</a> "
output += "</div>"
send_theme_resources(src)
src << browse(enable_ui_theme(src, output),"window=playersetup;size=560x280;can_close=0")
/mob/abstract/new_player/Stat()
..()
@@ -118,52 +70,9 @@ INITIALIZE_IMMEDIATE(/mob/abstract/new_player)
else
ready = 0
if(href_list["refresh"])
src << browse(null, "window=playersetup") //closes the player setup window)
new_player_panel_proc()
if(href_list["observe"])
if (!SSATOMS_IS_PROBABLY_DONE)
// Don't allow players to observe until initialization is more or less complete.
// Letting them join too early breaks things, they can wait.
alert(src, "Please wait, the map is not initialized yet.")
return 0
if(alert(src,"Are you sure you wish to observe? You will have to wait [config.respawn_delay] minutes before being able to respawn!","Player Setup","Yes","No") == "Yes")
if(!client) return 1
var/mob/abstract/observer/observer = new /mob/abstract/observer(src)
spawning = 1
src << sound(null, repeat = 0, wait = 0, volume = 85, channel = 1) // MAD JAMS cant last forever yo)
observer.started_as_observer = 1
close_spawn_windows()
var/obj/O = locate("landmark*Observer-Start")
if(istype(O))
to_chat(src, "<span class='notice'>Now teleporting.</span>")
observer.forceMove(O.loc)
else
to_chat(src, "<span class='danger'>Could not locate an observer spawn point. Use the Teleport verb to jump to the station map.</span>")
observer.timeofdeath = world.time // Set the time of death so that the respawn timer works correctly.
announce_ghost_joinleave(src)
var/mob/living/carbon/human/dummy/mannequin = SSmob.get_mannequin(client.ckey)
client.prefs.dress_preview_mob(mannequin)
observer.appearance = mannequin
observer.alpha = 127
observer.layer = initial(observer.layer)
observer.invisibility = initial(observer.invisibility)
observer.desc = initial(observer.desc)
observer.real_name = client.prefs.real_name
observer.name = observer.real_name
if(!client.holder && !config.antag_hud_allowed) // For new ghosts we remove the verb from even showing up if it's not allowed.
observer.verbs -= /mob/abstract/observer/verb/toggle_antagHUD // Poor guys, don't know what they are missing!
observer.ckey = ckey
observer.initialise_postkey()
qdel(src)
return 1
new_player_observe()
return TRUE
if(href_list["late_join"])
@@ -225,11 +134,8 @@ INITIALIZE_IMMEDIATE(/mob/abstract/new_player)
if(!ready && href_list["preference"])
if(client)
client.prefs.process_link(src, href_list)
else if(!href_list["late_join"])
new_player_panel()
if(href_list["showpoll"])
handle_player_polling()
return