From b4859b4c7a86bb3ba22e62e97216a220447e0442 Mon Sep 17 00:00:00 2001 From: Segrain Date: Fri, 4 Aug 2023 00:47:47 +0400 Subject: [PATCH] Assigned job slots and cryorines. (#4076) # About the pull request Followup to #3552. In other words, the second part of it that was left out of the original PR to cut down on feature creep. Seems to work out fine in first approach on localhost, but testing with wider populace in natural conditions is probably required. (Also, added an extra sanity check to keep randomised characters from inheriting actual characters' records which might be using the actual names - not that anybody ever reads character records anyawy.) # Explain why it's good for the game Roleplaying game letting players use their characters is good. Encouraging players to use different characters more is also good. # Changelog :cl: add: Joining cryomarines now uses your assigned character slot for the role you get (as long as you have not already used that character name this round). /:cl: --- code/datums/emergency_calls/cryo_marines.dm | 15 ++++++++++----- code/modules/client/preferences.dm | 17 ++++++++++++----- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/code/datums/emergency_calls/cryo_marines.dm b/code/datums/emergency_calls/cryo_marines.dm index eb914e198b37..fb4a0d94e177 100644 --- a/code/datums/emergency_calls/cryo_marines.dm +++ b/code/datums/emergency_calls/cryo_marines.dm @@ -36,30 +36,35 @@ if(leaders < cryo_squad.max_leaders && HAS_FLAG(H.client.prefs.toggles_ert, PLAY_LEADER) && check_timelock(H.client, JOB_SQUAD_LEADER, time_required_for_job)) leader = H leaders++ - arm_equipment(H, /datum/equipment_preset/uscm/leader/cryo, TRUE, TRUE) + H.client.prefs.copy_all_to(H, JOB_SQUAD_LEADER, TRUE, TRUE) + arm_equipment(H, /datum/equipment_preset/uscm/leader/cryo, FALSE, TRUE) to_chat(H, SPAN_ROLE_HEADER("You are a Squad Leader in the USCM")) to_chat(H, SPAN_ROLE_BODY("You are here to assist in the defence of the [SSmapping.configs[GROUND_MAP].map_name]. Listen to the chain of command.")) to_chat(H, SPAN_BOLDWARNING("If you wish to cryo or ghost upon spawning in, you must ahelp and inform staff so you can be replaced.")) else if (heavies < max_heavies && HAS_FLAG(H.client.prefs.toggles_ert, PLAY_HEAVY) && check_timelock(H.client, JOB_SQUAD_SPECIALIST, time_required_for_job)) heavies++ - arm_equipment(H, /datum/equipment_preset/uscm/spec/cryo, TRUE, TRUE) + H.client.prefs.copy_all_to(H, JOB_SQUAD_SPECIALIST, TRUE, TRUE) + arm_equipment(H, /datum/equipment_preset/uscm/spec/cryo, FALSE, TRUE) to_chat(H, SPAN_ROLE_HEADER("You are a Weapons Specialist in the USCM")) to_chat(H, SPAN_ROLE_BODY("Your squad is here to assist in the defence of the [SSmapping.configs[GROUND_MAP].map_name]. Listen to the chain of command.")) to_chat(H, SPAN_BOLDWARNING("If you wish to cryo or ghost upon spawning in, you must ahelp and inform staff so you can be replaced.")) else if (medics < max_medics && HAS_FLAG(H.client.prefs.toggles_ert, PLAY_MEDIC) && check_timelock(H.client, JOB_SQUAD_MEDIC, time_required_for_job)) medics++ - arm_equipment(H, /datum/equipment_preset/uscm/medic/cryo, TRUE, TRUE) + H.client.prefs.copy_all_to(H, JOB_SQUAD_MEDIC, TRUE, TRUE) + arm_equipment(H, /datum/equipment_preset/uscm/medic/cryo, FALSE, TRUE) to_chat(H, SPAN_ROLE_HEADER("You are a Hospital Corpsman in the USCM")) to_chat(H, SPAN_ROLE_BODY("You are here to assist in the defence of the [SSmapping.configs[GROUND_MAP].map_name]. Listen to the chain of command.")) to_chat(H, SPAN_BOLDWARNING("If you wish to cryo or ghost upon spawning in, you must ahelp and inform staff so you can be replaced.")) else if (engineers < max_engineers && HAS_FLAG(H.client.prefs.toggles_ert, PLAY_ENGINEER) && check_timelock(H.client, JOB_SQUAD_ENGI, time_required_for_job)) engineers++ - arm_equipment(H, /datum/equipment_preset/uscm/engineer/cryo, TRUE, TRUE) + H.client.prefs.copy_all_to(H, JOB_SQUAD_ENGI, TRUE, TRUE) + arm_equipment(H, /datum/equipment_preset/uscm/engineer/cryo, FALSE, TRUE) to_chat(H, SPAN_ROLE_HEADER("You are an Engineer in the USCM")) to_chat(H, SPAN_ROLE_BODY("You are here to assist in the defence of the [SSmapping.configs[GROUND_MAP].map_name]. Listen to the chain of command.")) to_chat(H, SPAN_BOLDWARNING("If you wish to cryo or ghost upon spawning in, you must ahelp and inform staff so you can be replaced.")) else - arm_equipment(H, /datum/equipment_preset/uscm/pfc/cryo, TRUE, TRUE) + H.client.prefs.copy_all_to(H, JOB_SQUAD_MARINE, TRUE, TRUE) + arm_equipment(H, /datum/equipment_preset/uscm/pfc/cryo, FALSE, TRUE) to_chat(H, SPAN_ROLE_HEADER("You are a Rifleman in the USCM")) to_chat(H, SPAN_ROLE_BODY("You are here to assist in the defence of the [SSmapping.configs[GROUND_MAP].map_name]. Listen to the chain of command.")) to_chat(H, SPAN_BOLDWARNING("If you wish to cryo or ghost upon spawning in, you must ahelp and inform staff so you can be replaced.")) diff --git a/code/modules/client/preferences.dm b/code/modules/client/preferences.dm index 16afa8d1b4f2..4f1161709657 100644 --- a/code/modules/client/preferences.dm +++ b/code/modules/client/preferences.dm @@ -1955,11 +1955,17 @@ var/const/MAX_SAVE_SLOTS = 10 load_character(slot_for_job) /// Transfers both physical characteristics and character information to character -/datum/preferences/proc/copy_all_to(mob/living/carbon/human/character, job_title, is_late_join = FALSE) +/datum/preferences/proc/copy_all_to(mob/living/carbon/human/character, job_title, is_late_join = FALSE, check_datacore = FALSE) if(!istype(character)) return find_assigned_slot(job_title, is_late_join) + if(check_datacore && !(be_random_body && be_random_name)) + for(var/datum/data/record/record as anything in GLOB.data_core.locked) + if(record.fields["name"] == real_name) + be_random_body = TRUE + be_random_name = TRUE + break if(be_random_name) real_name = random_name(gender) @@ -1987,10 +1993,11 @@ var/const/MAX_SAVE_SLOTS = 10 character.flavor_texts["legs"] = flavor_texts["legs"] character.flavor_texts["feet"] = flavor_texts["feet"] - character.med_record = strip_html(med_record) - character.sec_record = strip_html(sec_record) - character.gen_record = strip_html(gen_record) - character.exploit_record = strip_html(exploit_record) + if(!be_random_name) + character.med_record = strip_html(med_record) + character.sec_record = strip_html(sec_record) + character.gen_record = strip_html(gen_record) + character.exploit_record = strip_html(exploit_record) character.age = age character.gender = gender