Failing to latejoin as a job when the latejoin panel is already open now makes a more descriptive error message (#36794)

* job availability

* avail

* Boop
This commit is contained in:
kevinz000
2018-03-30 09:04:48 -07:00
committed by CitadelStationBot
parent e35ddc7093
commit 6e64e8e601
2 changed files with 39 additions and 16 deletions

View File

@@ -41,3 +41,10 @@
#define CLOWN (1<<11)
#define MIME (1<<12)
#define ASSISTANT (1<<13)
#define JOB_AVAILABLE 0
#define JOB_UNAVAILABLE_GENERIC 1
#define JOB_UNAVAILABLE_BANNED 2
#define JOB_UNAVAILABLE_PLAYTIME 3
#define JOB_UNAVAILABLE_ACCOUNTAGE 4
#define JOB_UNAVAILABLE_SLOTFULL 5

View File

@@ -278,31 +278,47 @@
qdel(src)
return TRUE
/mob/dead/new_player/proc/IsJobAvailable(rank)
/proc/get_job_unavailable_error_message(retval, jobtitle)
switch(retval)
if(JOB_AVAILABLE)
return "[jobtitle] is available."
if(JOB_UNAVAILABLE_GENERIC)
return "[jobtitle] is unavailable."
if(JOB_UNAVAILABLE_BANNED)
return "You are currently banned from [jobtitle]."
if(JOB_UNAVAILABLE_PLAYTIME)
return "You do not have enough relevant playtime for [jobtitle]."
if(JOB_UNAVAILABLE_ACCOUNTAGE)
return "Your account is not old enough for [jobtitle]."
if(JOB_UNAVAILABLE_SLOTFULL)
return "[jobtitle] is already filled to capacity."
return "Error: Unknown job availability."
/mob/dead/new_player/proc/IsJobUnavailable(rank)
var/datum/job/job = SSjob.GetJob(rank)
if(!job)
return 0
return JOB_UNAVAILABLE_GENERIC
if((job.current_positions >= job.total_positions) && job.total_positions != -1)
if(job.title == "Assistant")
if(isnum(client.player_age) && client.player_age <= 14) //Newbies can always be assistants
return 1
return JOB_AVAILABLE
for(var/datum/job/J in SSjob.occupations)
if(J && J.current_positions < J.total_positions && J.title != job.title)
return 0
return JOB_UNAVAILABLE_SLOTFULL
else
return 0
return JOB_UNAVAILABLE_SLOTFULL
if(jobban_isbanned(src,rank))
return 0
if(!job.player_old_enough(src.client))
return 0
return JOB_UNAVAILABLE_BANNED
if(!job.player_old_enough(client))
return JOB_UNAVAILABLE_ACCOUNTAGE
if(job.required_playtime_remaining(client))
return 0
return 1
return JOB_UNAVAILABLE_PLAYTIME
return JOB_AVAILABLE
/mob/dead/new_player/proc/AttemptLateSpawn(rank)
if(!IsJobAvailable(rank))
alert(src, "[rank] is not available. Please try another.")
var/error = IsJobUnavailable(rank)
if(error != JOB_AVAILABLE)
alert(src, get_job_unavailable_error_message(error, rank))
return FALSE
if(SSticker.late_join_disabled)
@@ -405,7 +421,7 @@
var/available_job_count = 0
for(var/datum/job/job in SSjob.occupations)
if(job && IsJobAvailable(job.title))
if(job && IsJobUnavailable(job.title) == JOB_AVAILABLE)
available_job_count++;
@@ -428,7 +444,7 @@
dat += "<div class='jobs'><div class='jobsColumn'>"
var/job_count = 0
for(var/datum/job/job in SSjob.occupations)
if(job && IsJobAvailable(job.title))
if(job && IsJobUnavailable(job.title) == JOB_AVAILABLE)
job_count++;
if (job_count > round(available_job_count / 2))
dat += "</div><div class='jobsColumn'>"