Skip to content

Commit

Permalink
[s] interview code tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
Absolucy committed Dec 4, 2024
1 parent 4117364 commit 5b6df12
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 1 deletion.
2 changes: 2 additions & 0 deletions code/__DEFINES/~monkestation/admin.dm
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,5 @@
#define AHELP_CLOSEREASON_NONE 0
#define AHELP_CLOSEREASON_IC 1
#define AHELP_CLOSEREASON_MENTOR 2

#define ADMIN_SUSINFO(user) "[ADMIN_LOOKUP(user)] [ADMIN_PP(user)] [ADMIN_INDIVIDUALLOG(user)] [ADMIN_SMITE(user)]"
24 changes: 24 additions & 0 deletions code/__HELPERS/~monkestation-helpers/clients.dm
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,27 @@
RETURN_TYPE(/datum/admins)
var/client/client = CLIENT_FROM_VAR(doohickey)
return client?.holder

/proc/should_be_interviewing(mob/target)
. = FALSE
if(QDELETED(target))
return
. = target.client?.interviewee
var/ckey = target.ckey
if(ckey)
if(ckey in GLOB.interviews.approved_ckeys)
return FALSE
var/datum/interview/interview = GLOB.interviews.open_interviews[ckey]
if(interview && interview.status != INTERVIEW_APPROVED)
return TRUE
if(ckey in GLOB.interviews.cooldown_ckeys)
return TRUE

/proc/interview_safety(mob/target, context)
. = should_be_interviewing(target)
if(.)
if(isnewplayer(target))
var/mob/dead/new_player/dingbat = target
dingbat.ready = PLAYER_NOT_READY
message_admins(span_danger("<b>WARNING</b>: [ADMIN_SUSINFO(target)] has seemingly bypassed an interview! (context: [context])"))
log_admin_private("[key_name(target)] has seemingly bypassed an interview! (context: [context])")
1 change: 1 addition & 0 deletions code/_onclick/hud/new_player.dm
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@
if(!new_client.readied_store)
new_client.readied_store = new(new_player)
new_client.readied_store.ui_interact(new_player)
addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(interview_safety), new_player), 1 SECONDS, TIMER_UNIQUE)
else
new_player.ready = PLAYER_NOT_READY
base_icon_state = "not_ready"
Expand Down
3 changes: 3 additions & 0 deletions code/controllers/subsystem/ticker.dm
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,9 @@ SUBSYSTEM_DEF(ticker)
for(var/i in GLOB.new_player_list)
var/mob/dead/new_player/player = i
if(player.ready == PLAYER_READY_TO_PLAY && player.mind)
if(interview_safety(player, "readied up"))
player.ready == PLAYER_NOT_READY
continue
GLOB.joined_player_list += player.ckey
var/chosen_title = player.client?.prefs.alt_job_titles[player.mind.assigned_role.title] || player.mind.assigned_role.title
var/atom/destination = player.mind.assigned_role.get_roundstart_spawn_point(chosen_title)
Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/dead/new_player/latejoin_menu.dm
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ GLOBAL_DATUM_INIT(latejoin_menu, /datum/latejoin_menu, new)
/datum/latejoin_menu/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state)
. = ..()

if(!ui.user.client || ui.user.client.interviewee || !isnewplayer(ui.user))
if(!ui.user.client || should_be_interviewing(ui.user) || !isnewplayer(ui.user))
return TRUE

var/mob/dead/new_player/owner = ui.user
Expand Down
6 changes: 6 additions & 0 deletions code/modules/mob/dead/new_player/new_player.dm
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@
ready = PLAYER_NOT_READY
return FALSE

if(interview_safety(src, "attempting to observe"))
return FALSE

var/less_input_message
if(SSlag_switch.measures[DISABLE_DEAD_KEYLOOP])
less_input_message = " - Notice: Observer freelook is currently disabled."
Expand Down Expand Up @@ -143,6 +146,9 @@
return JOB_AVAILABLE

/mob/dead/new_player/proc/AttemptLateSpawn(rank)
if(interview_safety(src, "attempting to latejoin"))
return FALSE

var/error = IsJobUnavailable(rank)
if(error != JOB_AVAILABLE)
tgui_alert(usr, get_job_unavailable_error_message(error, rank))
Expand Down
2 changes: 2 additions & 0 deletions code/modules/mob/dead/observer/login.dm
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
/mob/dead/observer/Login()
if(interview_safety(src, "observing"))
return FALSE
. = ..()
if(!. || !client)
return FALSE
Expand Down
2 changes: 2 additions & 0 deletions code/modules/mob/living/login.dm
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
/mob/living/Login()
if(interview_safety(src, "client in living mob"))
return FALSE
. = ..()
if(!. || !client)
return FALSE
Expand Down

0 comments on commit 5b6df12

Please sign in to comment.