diff --git a/code/controllers/configuration/entries/general.dm b/code/controllers/configuration/entries/general.dm index 75a2f362cc3..6339752a769 100644 --- a/code/controllers/configuration/entries/general.dm +++ b/code/controllers/configuration/entries/general.dm @@ -209,6 +209,13 @@ /datum/config_entry/flag/use_exp_restrictions_admin_bypass +/datum/config_entry/flag/use_low_living_hour_intern + +/datum/config_entry/number/use_low_living_hour_intern_hours + config_entry_value = 0 + integer = FALSE + min_val = 0 + /datum/config_entry/string/server /datum/config_entry/string/banappeals diff --git a/code/controllers/subsystem/job.dm b/code/controllers/subsystem/job.dm index 57e32840e36..825ae019bf5 100644 --- a/code/controllers/subsystem/job.dm +++ b/code/controllers/subsystem/job.dm @@ -18,6 +18,8 @@ SUBSYSTEM_DEF(job) /// A list of all jobs associated with the station. These jobs also have various icons associated with them including sechud and card trims. var/list/station_jobs + /// A list of all Head of Staff jobs. + var/list/head_of_staff_jobs /// A list of additional jobs that have various icons associated with them including sechud and card trims. var/list/additional_jobs_with_icons /// A list of jobs associed with Centcom and should use the standard NT Centcom icons. @@ -828,6 +830,8 @@ SUBSYSTEM_DEF(job) "Atmospheric Technician", "Chief Medical Officer", "Medical Doctor", "Paramedic", "Chemist", "Geneticist", "Virologist", "Psychologist", \ "Research Director", "Scientist", "Roboticist", "Head of Security", "Warden", "Detective", "Security Officer", "Prisoner") + head_of_staff_jobs = list("Head of Personnel", "Chief Engineer", "Chief Medical Officer", "Research Director", "Head of Security", "Captain") + additional_jobs_with_icons = list("Emergency Response Team Commander", "Security Response Officer", "Engineering Response Officer", "Medical Response Officer", \ "Entertainment Response Officer", "Religious Response Officer", "Janitorial Response Officer", "Death Commando", "Security Officer (Engineering)", \ "Security Officer (Cargo)", "Security Officer (Medical)", "Security Officer (Science)") diff --git a/code/game/objects/items/cards_ids.dm b/code/game/objects/items/cards_ids.dm index 5a532818419..ed23723371c 100644 --- a/code/game/objects/items/cards_ids.dm +++ b/code/game/objects/items/cards_ids.dm @@ -4,6 +4,9 @@ */ #define ID_ICON_BORDERS 1, 9, 32, 24 +/// Fallback time if none of the config entries are set for USE_LOW_LIVING_HOUR_INTERN +#define INTERN_THRESHOLD_FALLBACK_HOURS 15 + /* Cards * Contains: * DATA CARD @@ -106,6 +109,9 @@ /// List of wildcard slot names as keys with lists of wildcard data as values. var/list/wildcard_slots = list() + /// Boolean value. If TRUE, the [Intern] tag gets prepended to this ID card when the label is updated. + var/is_intern = FALSE + /obj/item/card/id/Initialize(mapload) . = ..() @@ -618,8 +624,18 @@ /// Updates the name based on the card's vars and state. /obj/item/card/id/proc/update_label() - var/blank = !registered_name - name = "[blank ? initial(name) : "[registered_name]'s ID Card"][(!assignment) ? "" : " ([assignment])"]" + var/name_string = registered_name ? "[registered_name]'s ID Card" : initial(name) + var/assignment_string + + if(is_intern) + if(assignment) + assignment_string = (assignment in SSjob.head_of_staff_jobs) ? " ([assignment]-in-Training)" : " (Intern [assignment])" + else + assignment_string = " (Intern)" + else + assignment_string = " ([assignment])" + + name = "[name_string][assignment_string]" /obj/item/card/id/away name = "\proper a perfectly generic identification card" @@ -716,6 +732,88 @@ /// If this is set, will manually override the trim's assignmment for SecHUDs. Intended for admins to VV edit and chameleon ID cards. var/trim_assignment_override +/obj/item/card/id/advanced/Initialize(mapload) + . = ..() + RegisterSignal(src, COMSIG_ITEM_EQUIPPED, .proc/update_intern_status) + RegisterSignal(src, COMSIG_ITEM_DROPPED, .proc/remove_intern_status) + +/obj/item/card/id/advanced/Destroy() + UnregisterSignal(src, COMSIG_ITEM_EQUIPPED, COMSIG_ITEM_DROPPED) + + return ..() + +/obj/item/card/id/advanced/proc/update_intern_status(datum/source, mob/user) + SIGNAL_HANDLER + + if(!user?.client) + return + if(!CONFIG_GET(flag/use_exp_tracking)) + return + if(!CONFIG_GET(flag/use_low_living_hour_intern)) + return + if(!SSdbcore.Connect()) + return + + var/intern_threshold = (CONFIG_GET(number/use_low_living_hour_intern_hours) * 60) || (CONFIG_GET(number/use_exp_restrictions_heads_hours) * 60) || INTERN_THRESHOLD_FALLBACK_HOURS * 60 + var/playtime = user.client.get_exp_living(pure_numeric = TRUE) + + if((intern_threshold >= playtime) && (user.mind?.assigned_role in SSjob.station_jobs)) + is_intern = TRUE + update_label() + return + + if(!is_intern) + return + + is_intern = FALSE + update_label() + +/obj/item/card/id/advanced/proc/remove_intern_status(datum/source, mob/user) + SIGNAL_HANDLER + + if(!is_intern) + return + + is_intern = FALSE + update_label() + +/obj/item/card/id/advanced/proc/on_holding_card_slot_moved(obj/item/computer_hardware/card_slot/source, atom/old_loc, dir, forced) + if(istype(old_loc, /obj/item/modular_computer/tablet)) + UnregisterSignal(old_loc, COMSIG_ITEM_EQUIPPED, COMSIG_ITEM_DROPPED) + + if(istype(source.loc, /obj/item/modular_computer/tablet)) + RegisterSignal(source.loc, COMSIG_ITEM_EQUIPPED, .proc/update_intern_status) + RegisterSignal(source.loc, COMSIG_ITEM_DROPPED, .proc/remove_intern_status) + +/obj/item/card/id/advanced/Moved(atom/OldLoc, Dir) + . = ..() + + if(istype(OldLoc, /obj/item/pda) || istype(OldLoc, /obj/item/storage/wallet)) + UnregisterSignal(OldLoc, COMSIG_ITEM_EQUIPPED, COMSIG_ITEM_DROPPED) + + if(istype(OldLoc, /obj/item/computer_hardware/card_slot)) + var/obj/item/computer_hardware/card_slot/slot = OldLoc + + UnregisterSignal(OldLoc, COMSIG_MOVABLE_MOVED) + + if(istype(slot.holder, /obj/item/modular_computer/tablet)) + var/obj/item/modular_computer/tablet/slot_holder = slot.holder + UnregisterSignal(slot_holder, COMSIG_ITEM_EQUIPPED, COMSIG_ITEM_DROPPED) + + if(istype(loc, /obj/item/pda) || istype(OldLoc, /obj/item/storage/wallet)) + RegisterSignal(loc, COMSIG_ITEM_EQUIPPED, .proc/update_intern_status) + RegisterSignal(loc, COMSIG_ITEM_DROPPED, .proc/remove_intern_status) + + if(istype(loc, /obj/item/computer_hardware/card_slot)) + var/obj/item/computer_hardware/card_slot/slot = loc + + RegisterSignal(loc, COMSIG_MOVABLE_MOVED, .proc/on_holding_card_slot_moved) + + if(istype(slot.holder, /obj/item/modular_computer/tablet)) + var/obj/item/modular_computer/tablet/slot_holder = slot.holder + RegisterSignal(slot_holder, COMSIG_ITEM_EQUIPPED, .proc/update_intern_status) + RegisterSignal(slot_holder, COMSIG_ITEM_DROPPED, .proc/remove_intern_status) + /obj/item/card/id/advanced/update_overlays() . = ..() @@ -1208,4 +1306,5 @@ desc = "A card used to identify members of the green team for CTF" icon_state = "ctf_green" +#undef INTERN_THRESHOLD_FALLBACK_HOURS #undef ID_ICON_BORDERS diff --git a/code/game/objects/items/devices/PDA/PDA.dm b/code/game/objects/items/devices/PDA/PDA.dm index bcaddee5da8..be9a6be50ee 100644 --- a/code/game/objects/items/devices/PDA/PDA.dm +++ b/code/game/objects/items/devices/PDA/PDA.dm @@ -118,6 +118,7 @@ GLOBAL_LIST_EMPTY(PDAs) else inserted_item = new /obj/item/pen(src) RegisterSignal(src, COMSIG_LIGHT_EATER_ACT, .proc/on_light_eater) + update_appearance() /obj/item/pda/equipped(mob/user, slot) diff --git a/config/config.txt b/config/config.txt index c7b27189a45..8f5a5f7cb67 100644 --- a/config/config.txt +++ b/config/config.txt @@ -87,6 +87,10 @@ ENABLE_LOCALHOST_RANK #USE_EXP_RESTRICTIONS_OTHER ## Allows admins to bypass job playtime requirements. #USE_EXP_RESTRICTIONS_ADMIN_BYPASS +## Unhash this to have intern tags automatically added to ID cards for station roles depending on the living hours of the player holding them. +#USE_LOW_LIVING_HOUR_INTERN +## If USE_LOW_LIVING_HOUR_INTERN is unhashed, players under this number of living hours have [Intern] added to their ID card. If this isn't set, uses USE_EXP_RESTRICTIONS_HEADS_HOURS instead. If that isn't set, it finally defaults to a hardcoded fallback of 15 hours. +#USE_LOW_LIVING_HOUR_INTERN_HOURS 50 ## log OOC channel LOG_OOC