mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-07-19 03:49:10 +01:00
Fixes Alt Title Age Requirements (#7130)
Job age requirements now take into account alt titles. Alt titles are automatically limited to only ones a character is old enough for.
The latejoin screen now shows what alt-title you have selected.
The occupation preferences screen now functions differently if only one alt-title is available, or if the base job is not available.
Tidies up the job age requirement system.
This commit is contained in:
@@ -102,9 +102,7 @@
|
||||
if(jobban_isbanned(player, rank))
|
||||
return FALSE
|
||||
|
||||
var/character_age = player.client.prefs.age
|
||||
var/datum/species/species = global.all_species[player.client.prefs.species]
|
||||
if((character_age < job.minimum_character_age) && !(species.spawn_flags & NO_AGE_MINIMUM))
|
||||
if(!(rank in player.client.prefs.GetValidTitles(job)))
|
||||
to_chat(player, "<span class='warning'>Your character is too young!</span>")
|
||||
return FALSE
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
var/department = null // Does this position have a department tag?
|
||||
var/head_position = 0 // Is this position Command?
|
||||
var/minimum_character_age = 17
|
||||
var/list/alt_ages = null // assoc list of alt titles to minimum character ages
|
||||
var/ideal_character_age = 30
|
||||
|
||||
var/latejoin_at_spawnpoints = FALSE //If this job should use roundstart spawnpoints for latejoin (offstation jobs etc)
|
||||
|
||||
@@ -61,6 +61,7 @@
|
||||
access = list(access_medical, access_medical_equip, access_morgue, access_surgery, access_pharmacy, access_virology, access_genetics, access_eva)
|
||||
minimal_access = list(access_medical, access_medical_equip, access_morgue, access_surgery, access_genetics, access_eva)
|
||||
alt_titles = list("Surgeon","Emergency Physician","Nurse")
|
||||
alt_ages = list("Nurse" = 25)
|
||||
outfit = /datum/outfit/job/doctor
|
||||
alt_outfits = list(
|
||||
"Emergency Physician"=/datum/outfit/job/doctor/emergency_physician,
|
||||
@@ -210,7 +211,8 @@
|
||||
economic_modifier = 4
|
||||
|
||||
minimum_character_age = 24
|
||||
|
||||
alt_ages = list("Emergency Medical Technician" = 20)
|
||||
|
||||
access = list(access_medical, access_medical_equip, access_morgue, access_surgery, access_pharmacy, access_virology, access_eva, access_maint_tunnels, access_external_airlocks, access_psychiatrist, access_paramedic)
|
||||
minimal_access = list(access_medical, access_medical_equip, access_morgue, access_eva, access_maint_tunnels, access_external_airlocks, access_paramedic)
|
||||
alt_titles = list("Emergency Medical Technician")
|
||||
@@ -253,7 +255,9 @@
|
||||
selection_color = "#FF97D1"
|
||||
access = list(access_medical, access_surgery, access_medical_equip)
|
||||
minimal_access = list(access_medical, access_surgery, access_medical_equip)
|
||||
minimum_character_age = 25
|
||||
alt_titles = list("Medical Intern")
|
||||
alt_ages = list("Medical Intern" = 18)
|
||||
outfit = /datum/outfit/job/intern_med
|
||||
|
||||
/datum/outfit/job/intern_med
|
||||
|
||||
@@ -136,6 +136,9 @@
|
||||
var/alt_title = pref.player_alt_titles[job.title]
|
||||
if(alt_title && !(alt_title in job.alt_titles))
|
||||
pref.player_alt_titles -= job.title
|
||||
var/list/available = pref.GetValidTitles(job)
|
||||
if(LAZYLEN(available) == 1)
|
||||
SetPlayerAltTitle(job, LAZYACCESS(available, 1))
|
||||
|
||||
sanitize_faction()
|
||||
|
||||
@@ -171,29 +174,28 @@
|
||||
dat += "<tr style='background-color: [hex2cssrgba(job.selection_color, 0.4)];'><td width='60%' align='right'>"
|
||||
var/rank = job.title
|
||||
lastJob = job
|
||||
var/dispRank = LAZYACCESS(pref.GetValidTitles(job), 1) || rank
|
||||
var/ban_reason = jobban_isbanned(user, rank)
|
||||
var/character_age = user.client.prefs.age
|
||||
var/datum/species/species = global.all_species[user.client.prefs.species]
|
||||
if(ban_reason == "WHITELISTED")
|
||||
dat += "<del>[rank]</del></td><td><b> \[WHITELISTED]</b></td></tr>"
|
||||
dat += "<del>[dispRank]</del></td><td><b> \[WHITELISTED]</b></td></tr>"
|
||||
continue
|
||||
else if (ban_reason == "AGE WHITELISTED")
|
||||
var/available_in_days = player_old_enough_for_role(user.client, rank)
|
||||
dat += "<del>[rank]</del></td><td> \[IN [(available_in_days)] DAYS]</td></tr>"
|
||||
dat += "<del>[dispRank]</del></td><td> \[IN [(available_in_days)] DAYS]</td></tr>"
|
||||
continue
|
||||
else if(!LAZYLEN(pref.GetValidTitles(job))) // we have no available jobs the character is old enough for
|
||||
dat += "<del>[dispRank]</del></td><td> \[MINIMUM AGE: [LAZYLEN(job.alt_ages) ? min(job.alt_ages[min(job.alt_ages)], job.minimum_character_age) : job.minimum_character_age]]</td></tr>"
|
||||
continue
|
||||
else if (ban_reason)
|
||||
dat += "<del>[rank]</del></td><td><b> \[<a href='?src=\ref[user.client];view_jobban=\ref[rank];'>BANNED</a>]</b></td></tr>"
|
||||
continue
|
||||
else if((character_age < job.minimum_character_age) && !(species.spawn_flags & NO_AGE_MINIMUM))
|
||||
dat += "<del>[rank]</del></td><td> \[MINIMUM AGE: [job.minimum_character_age]]</td></tr>"
|
||||
dat += "<del>[dispRank]</del></td><td><b> \[<a href='?src=\ref[user.client];view_jobban=\ref[rank];'>BANNED</a>]</b></td></tr>"
|
||||
continue
|
||||
if((pref.job_civilian_low & ASSISTANT) && (rank != "Assistant"))
|
||||
dat += "<font color=orange>[rank]</font></td><td></td></tr>"
|
||||
dat += "<font color=orange>[dispRank]</font></td><td></td></tr>"
|
||||
continue
|
||||
if((rank in command_positions) || (rank == "AI"))//Bold head jobs
|
||||
dat += "<b>[rank]</b>"
|
||||
dat += "<b>[dispRank]</b>"
|
||||
else
|
||||
dat += "[rank]"
|
||||
dat += "[dispRank]"
|
||||
|
||||
dat += "</td><td width='40%'>"
|
||||
|
||||
@@ -217,7 +219,7 @@
|
||||
dat += " <font color=orange>\[Low]</font>"
|
||||
else
|
||||
dat += " <font color=red>\[NEVER]</font>"
|
||||
if(job.alt_titles)
|
||||
if(job.alt_titles && (LAZYLEN(pref.GetValidTitles(job)) > 1))
|
||||
dat += "</a></td></tr><tr style='background-color: [hex2cssrgba(lastJob.selection_color, 0.4)];'><td width='60%' align='center'> </td><td><a href='?src=\ref[src];select_alt_title=\ref[job]'>\[[pref.GetPlayerAltTitle(job)]\]</a></td></tr>"
|
||||
dat += "</a></td></tr>"
|
||||
|
||||
@@ -236,7 +238,7 @@
|
||||
|
||||
. = dat.Join()
|
||||
|
||||
/datum/category_item/player_setup_item/occupation/OnTopic(href, href_list, user)
|
||||
/datum/category_item/player_setup_item/occupation/OnTopic(href, href_list, mob/user)
|
||||
if(href_list["reset_jobs"])
|
||||
ResetJobs()
|
||||
return TOPIC_REFRESH
|
||||
@@ -250,12 +252,15 @@
|
||||
|
||||
else if(href_list["select_alt_title"])
|
||||
var/datum/job/job = locate(href_list["select_alt_title"])
|
||||
if (job)
|
||||
var/choices = list(job.title) + job.alt_titles
|
||||
var/choice = input("Choose an title for [job.title].", "Choose Title", pref.GetPlayerAltTitle(job)) as anything in choices|null
|
||||
if(choice && CanUseTopic(user))
|
||||
SetPlayerAltTitle(job, choice)
|
||||
return TOPIC_REFRESH
|
||||
if (!job)
|
||||
return ..()
|
||||
var/list/choices = pref.GetValidTitles(job)
|
||||
if(!LAZYLEN(choices))
|
||||
return ..()// should never happen
|
||||
var/choice = input("Choose an title for [job.title].", "Choose Title", pref.GetPlayerAltTitle(job)) as anything in choices|null
|
||||
if(choice && CanUseTopic(user))
|
||||
SetPlayerAltTitle(job, choice)
|
||||
return TOPIC_REFRESH
|
||||
|
||||
else if(href_list["set_job"])
|
||||
if(SetJob(user, href_list["set_job"]))
|
||||
@@ -425,6 +430,18 @@
|
||||
/datum/preferences/proc/GetPlayerAltTitle(datum/job/job)
|
||||
return player_alt_titles[job.title] || job.title
|
||||
|
||||
/datum/preferences/proc/GetValidTitles(datum/job/job)
|
||||
if (!job)
|
||||
return
|
||||
var/choices = list(job.title) + job.alt_titles
|
||||
if((global.all_species[src.species].spawn_flags & NO_AGE_MINIMUM))
|
||||
return choices
|
||||
for(var/t in choices)
|
||||
if (src.age >= (LAZYACCESS(job.alt_ages, t) || job.minimum_character_age))
|
||||
continue
|
||||
choices -= t
|
||||
return choices
|
||||
|
||||
/datum/preferences/proc/GetJobDepartment(var/datum/job/job, var/level)
|
||||
if(!job || !level) return 0
|
||||
switch(job.department_flag)
|
||||
|
||||
@@ -283,9 +283,7 @@ INITIALIZE_IMMEDIATE(/mob/abstract/new_player)
|
||||
if (!(job.type in faction.allowed_role_types))
|
||||
return FALSE
|
||||
|
||||
var/character_age = client.prefs.age
|
||||
var/datum/species/species = global.all_species[client.prefs.species]
|
||||
if((character_age < job.minimum_character_age) && !(species.spawn_flags & NO_AGE_MINIMUM))
|
||||
if(!(rank in client.prefs.GetValidTitles(job))) // does age/species check for us!
|
||||
return FALSE
|
||||
|
||||
return TRUE
|
||||
@@ -388,9 +386,9 @@ INITIALIZE_IMMEDIATE(/mob/abstract/new_player)
|
||||
var/active = 0
|
||||
// Only players with the job assigned and AFK for less than 10 minutes count as active
|
||||
for(var/mob/M in player_list) //Added isliving check here, so it won't check ghosts and qualify them as active
|
||||
if(isliving(M) && M.mind && M.client && M.mind.assigned_role == job.title && M.client.inactivity <= 10 * 60 * 10)
|
||||
if(isliving(M) && M.mind && M.client && M.mind.assigned_role == job.title && M.client.inactivity <= 10 MINUTES)
|
||||
active++
|
||||
dat += "<a href='byond://?src=\ref[src];SelectedJob=[job.title]'>[job.title] ([job.current_positions]) (Active: [active])</a><br>"
|
||||
dat += "<a href='byond://?src=\ref[src];SelectedJob=[job.title]'>[client.prefs.GetPlayerAltTitle(job)] ([job.current_positions]) (Active: [active])</a><br>"
|
||||
|
||||
dat += "</center>"
|
||||
send_theme_resources(src)
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
author: MoondancerPony
|
||||
delete-after: True
|
||||
changes:
|
||||
- bugfix: "Job age requirements now take into account alt titles. Alt titles are automatically limited to only ones a character is old enough for."
|
||||
- bugfix: "The latejoin screen now shows what alt-title you have selected."
|
||||
- tweak: "The occupation preferences screen now functions differently if only one alt-title is available, or if the base job is not available."
|
||||
- backend: "Tidies up the job age requirement system."
|
||||
Reference in New Issue
Block a user