Skip to content

Commit

Permalink
Changes ready up menu
Browse files Browse the repository at this point in the history
  • Loading branch information
MrMelbert committed Jul 17, 2024
1 parent 15ff7b5 commit 6debcfc
Show file tree
Hide file tree
Showing 12 changed files with 118 additions and 10 deletions.
8 changes: 8 additions & 0 deletions code/__DEFINES/living.dm
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,11 @@
#define TRAIT_ROBOTIC_LIMBATTACHMENT "trait_robotic_limbattachment"

#define COLOR_BLOOD "#c90000"

// Used in ready menu anominity
/// Hide ckey
#define CKEY_ANON (1<<0)
/// Hide character name
#define NAME_ANON (1<<1)
/// Hide top job preference
#define JOB_ANON (1<<2)
4 changes: 2 additions & 2 deletions code/_onclick/hud/new_player.dm
Original file line number Diff line number Diff line change
Expand Up @@ -211,10 +211,10 @@
var/mob/dead/new_player/new_player = hud.mymob
ready = !ready
if(ready)
new_player.ready = PLAYER_READY_TO_PLAY
new_player.ready()
base_icon_state = "ready"
else
new_player.ready = PLAYER_NOT_READY
new_player.unready()
base_icon_state = "not_ready"
update_appearance(UPDATE_ICON)
SEND_SIGNAL(hud, COMSIG_HUD_PLAYER_READY_TOGGLE)
Expand Down
2 changes: 1 addition & 1 deletion code/controllers/subsystem/job.dm
Original file line number Diff line number Diff line change
Expand Up @@ -666,7 +666,7 @@ SUBSYSTEM_DEF(job)
unassigned -= player
if(!run_divide_occupation_pure)
to_chat(player, "<span class='infoplain'><b>You have failed to qualify for any job you desired.</b></span>")
player.ready = PLAYER_NOT_READY
player.unready()


/datum/controller/subsystem/job/Recover()
Expand Down
2 changes: 2 additions & 0 deletions code/controllers/subsystem/ticker.dm
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ SUBSYSTEM_DEF(ticker)
var/totalPlayersReady = 0
/// Num of ready admins, used for pregame stats on statpanel (only viewable by admins)
var/total_admins_ready = 0
/// List of what everyone is ready up as, assoc new player - string
var/list/ready_report = list()

var/queue_delay = 0
var/list/queued_players = list() //used for join queues when the server exceeds the hard population cap
Expand Down
4 changes: 4 additions & 0 deletions code/modules/client/preferences/middleware/jobs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@

preferences.character_preview_view?.update_body()

if(isnewplayer(user))
var/mob/dead/new_player/cycle = user
cycle.update_ready_report()

return TRUE

/datum/preference_middleware/jobs/get_constant_data()
Expand Down
6 changes: 6 additions & 0 deletions code/modules/client/preferences_savefile.dm
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,12 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
all_quirks = SSquirks.filter_invalid_quirks(SANITIZE_LIST(all_quirks))
validate_quirks()

if(isnewplayer(parent?.mob))
// Update the report that appears in ready menu if applicable
// (Yeah I could signalize this but whatever)
var/mob/dead/new_player/cycle = parent?.mob
cycle.update_ready_report()

return TRUE

/datum/preferences/proc/save_character()
Expand Down
8 changes: 5 additions & 3 deletions code/modules/mob/dead/dead.dm
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,11 @@ INITIALIZE_IMMEDIATE(/mob/dead)
. += "Time To Start: SOON"

. += "Players: [LAZYLEN(GLOB.clients)]"
if(client.holder)
. += "Players Ready: [SSticker.totalPlayersReady]"
. += "Admins Ready: [SSticker.total_admins_ready] / [length(GLOB.admins)]"
if(length(SSticker.ready_report))
. += ""
. += "[SSticker.totalPlayersReady] Readied players:"
for(var/readied in SSticker.ready_report)
. += "- [SSticker.ready_report[readied]]"

#define SERVER_HOPPER_TRAIT "server_hopper"

Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/dead/new_player/logout.dm
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/mob/dead/new_player/Logout()
ready = 0
unready()
..()
if(!spawning)//Here so that if they are spawning and log out, the other procs can play out and they will have a mob to come back to.
key = null//We null their key before deleting the mob, so they are properly kicked out.
Expand Down
51 changes: 48 additions & 3 deletions code/modules/mob/dead/new_player/new_player.dm
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
//When you cop out of the round (NB: this HAS A SLEEP FOR PLAYER INPUT IN IT)
/mob/dead/new_player/proc/make_me_an_observer()
if(QDELETED(src) || !src.client)
ready = PLAYER_NOT_READY
unready()
return FALSE

var/less_input_message
Expand All @@ -76,7 +76,6 @@
// Don't convert this to tgui please, it's way too important
var/this_is_like_playing_right = alert(usr, "Are you sure you wish to observe? You will not be able to play this round![less_input_message]", "Observe", "Yes", "No")
if(QDELETED(src) || !src.client || this_is_like_playing_right != "Yes")
ready = PLAYER_NOT_READY
return FALSE

var/mob/dead/observer/observer = new()
Expand Down Expand Up @@ -320,7 +319,7 @@
if(!ineligible_for_roles)
to_chat(src, span_danger("You have no jobs enabled, along with return to lobby if job is unavailable. This makes you ineligible for any round start role, please update your job preferences."))
ineligible_for_roles = TRUE
ready = PLAYER_NOT_READY
unready()
if(has_antags)
log_admin("[src.ckey] has no jobs enabled, return to lobby if job is unavailable enabled and [client.prefs.be_special.len] antag preferences enabled. The player has been forcefully returned to the lobby.")
message_admins("[src.ckey] has no jobs enabled, return to lobby if job is unavailable enabled and [client.prefs.be_special.len] antag preferences enabled. This is an old antag rolling technique. The player has been asked to update their job preferences and has been forcefully returned to the lobby.")
Expand Down Expand Up @@ -369,4 +368,50 @@
to_chat(new_player, span_info("Lobby Menu HUD reset. You may reset the HUD again in <b>[DisplayTimeText(RESET_HUD_INTERVAL)]</b>."))
hud_used.show_hud(hud_used.hud_version)

/mob/dead/new_player/proc/ready()
if(ready == PLAYER_READY_TO_PLAY)
return
ready = PLAYER_READY_TO_PLAY
update_ready_report()

/mob/dead/new_player/proc/update_ready_report()
if(ready != PLAYER_READY_TO_PLAY)
return
var/datum/job/my_job = client?.prefs?.get_highest_priority_job()
var/my_name
var/name_pref = /datum/preference/name/real_name
var/datum/preference/choiced/ready_anominity/the_pref = GLOB.preference_entries[/datum/preference/choiced/ready_anominity]
var/anominity = the_pref.value_list[client?.prefs?.read_preference(/datum/preference/choiced/ready_anominity)] || NONE

// This sucks and should be moved to the job datums
switch(my_job?.type)
if(/datum/job/clown)
name_pref = /datum/preference/name/clown
if(/datum/job/mime)
name_pref = /datum/preference/name/mime
if(/datum/job/ai)
name_pref = /datum/preference/name/ai
if(/datum/job/cyborg)
name_pref = /datum/preference/name/cyborg
// Spoilers. Also this sucks as well
if(my_job.type == /datum/job/stowaway)
my_job = null

my_name += (anominity & CKEY_ANON) ? "Anonymous" : "[ckey]"
my_name += " / "
my_name += (anominity & NAME_ANON) ? "Anonymous" : "[client?.prefs?.read_preference(name_pref) || "Unknown"]"
my_name += " / "
my_name += (anominity & JOB_ANON) ? "Anonymous" : "[my_job?.title || "No job"]"
SSticker.ready_report[src] = my_name

/mob/dead/new_player/proc/unready()
if(ready == PLAYER_NOT_READY)
return
ready = PLAYER_NOT_READY
SSticker.ready_report -= src

/mob/dead/new_player/Destroy()
SSticker.ready_report -= src // should be redundant but just in case.
return ..()

#undef RESET_HUD_INTERVAL
1 change: 1 addition & 0 deletions maplestation.dme
Original file line number Diff line number Diff line change
Expand Up @@ -6256,6 +6256,7 @@
#include "maplestation_modules\code\modules\client\preferences\loadout_preference.dm"
#include "maplestation_modules\code\modules\client\preferences\multiline_preferences.dm"
#include "maplestation_modules\code\modules\client\preferences\name_preferences.dm"
#include "maplestation_modules\code\modules\client\preferences\ready_anominity.dm"
#include "maplestation_modules\code\modules\client\preferences\runechat_color.dm"
#include "maplestation_modules\code\modules\client\preferences\sound_frequency.dm"
#include "maplestation_modules\code\modules\client\preferences\toggle_radio.dm"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/datum/preference/choiced/ready_anominity
category = PREFERENCE_CATEGORY_GAME_PREFERENCES
savefile_key = "ready_anominity"
savefile_identifier = PREFERENCE_PLAYER
/// What values we pass to possible values, keyed to the actual bitflag
var/list/value_list = list(
"Show All" = NONE,
"Show Nothing" = ALL,
"Just Show Ckey" = ~CKEY_ANON,
"Just Show Character" = ~NAME_ANON,
"Just Show Job Title" = ~JOB_ANON,
"Don't Show Ckey" = CKEY_ANON,
"Don't Show Character" = NAME_ANON,
"Don't Show Job Title" = JOB_ANON,
)

/datum/preference/choiced/ready_anominity/apply_to_client_updated(client/client, value)
if(isnewplayer(client?.mob))
var/mob/dead/new_player/cycle = client?.mob
cycle.update_ready_report()

/datum/preference/choiced/ready_anominity/create_default_value()
return value_list[3]

/datum/preference/choiced/ready_anominity/init_possible_values()
return value_list

// This also needs to update anominity
/datum/preference/name/apply_to_client_updated(client/client, value)
if(isnewplayer(client?.mob))
var/mob/dead/new_player/cycle = client?.mob
cycle.update_ready_report()
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { FeatureChoiced, FeatureDropdownInput } from '../base';

export const ready_anominity: FeatureChoiced = {
name: 'Ready Anominity',
component: FeatureDropdownInput,
category: 'GHOST',
description: 'Allows you to anonymously ready up in the lobby.',
};

0 comments on commit 6debcfc

Please sign in to comment.