From 8471995aa686936d408576b50d83fe32b70389b7 Mon Sep 17 00:00:00 2001 From: Segrain Date: Wed, 2 Aug 2023 01:03:46 +0400 Subject: [PATCH 1/2] Assigned job slots and cryorines. --- code/datums/emergency_calls/cryo_marines.dm | 15 +++++++++----- code/modules/client/preferences.dm | 22 ++++++++++++++------- 2 files changed, 25 insertions(+), 12 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..f576aa8136f1 100644 --- a/code/modules/client/preferences.dm +++ b/code/modules/client/preferences.dm @@ -1943,7 +1943,7 @@ var/const/MAX_SAVE_SLOTS = 10 /// Loads appropriate character slot for the given job as assigned in preferences. -/datum/preferences/proc/find_assigned_slot(job_title, is_late_join = FALSE) +/datum/preferences/proc/find_assigned_slot(job_title, is_late_join = FALSE, check_datacore = FALSE) if(toggle_prefs & (is_late_join ? TOGGLE_LATE_JOIN_CURRENT_SLOT : TOGGLE_START_JOIN_CURRENT_SLOT)) return var/slot_for_job = pref_job_slots[job_title] @@ -1951,15 +1951,22 @@ var/const/MAX_SAVE_SLOTS = 10 if(JOB_SLOT_RANDOMISED_SLOT) be_random_body = TRUE be_random_name = TRUE + check_datacore = FALSE if(1 to MAX_SAVE_SLOTS) load_character(slot_for_job) + if(check_datacore) + 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 + return /// 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) + find_assigned_slot(job_title, is_late_join, check_datacore) if(be_random_name) real_name = random_name(gender) @@ -1987,10 +1994,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 From 7de7b942a66728f41b6e284a776a4ef537dddb73 Mon Sep 17 00:00:00 2001 From: Segrain Date: Wed, 2 Aug 2023 14:46:27 +0400 Subject: [PATCH 2/2] Shuffling checks around. --- code/modules/client/preferences.dm | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/code/modules/client/preferences.dm b/code/modules/client/preferences.dm index f576aa8136f1..4f1161709657 100644 --- a/code/modules/client/preferences.dm +++ b/code/modules/client/preferences.dm @@ -1943,7 +1943,7 @@ var/const/MAX_SAVE_SLOTS = 10 /// Loads appropriate character slot for the given job as assigned in preferences. -/datum/preferences/proc/find_assigned_slot(job_title, is_late_join = FALSE, check_datacore = FALSE) +/datum/preferences/proc/find_assigned_slot(job_title, is_late_join = FALSE) if(toggle_prefs & (is_late_join ? TOGGLE_LATE_JOIN_CURRENT_SLOT : TOGGLE_START_JOIN_CURRENT_SLOT)) return var/slot_for_job = pref_job_slots[job_title] @@ -1951,22 +1951,21 @@ var/const/MAX_SAVE_SLOTS = 10 if(JOB_SLOT_RANDOMISED_SLOT) be_random_body = TRUE be_random_name = TRUE - check_datacore = FALSE if(1 to MAX_SAVE_SLOTS) load_character(slot_for_job) - if(check_datacore) - 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 - return /// 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, check_datacore = FALSE) if(!istype(character)) return - find_assigned_slot(job_title, is_late_join, check_datacore) + 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)