From 1b4573cdf7e576d7c04659d10164ec32ef38ea2e Mon Sep 17 00:00:00 2001 From: Adrer Date: Tue, 3 Oct 2023 18:16:03 +0200 Subject: [PATCH] Adds supply department to agent ID options and cleans code (#22613) Co-authored-by: Adrer --- code/game/objects/items/weapons/cards_ids.dm | 35 +++++++------------- 1 file changed, 12 insertions(+), 23 deletions(-) diff --git a/code/game/objects/items/weapons/cards_ids.dm b/code/game/objects/items/weapons/cards_ids.dm index 6f3c17a11b9..037c67a7d99 100644 --- a/code/game/objects/items/weapons/cards_ids.dm +++ b/code/game/objects/items/weapons/cards_ids.dm @@ -544,15 +544,16 @@ RebuildHTML() if("Occupation") - var/list/departments =list( - "Assistant", - "Engineering", - "Medical", - "Science", - "Security", - "Support", - "Command", - "Custom", + var/list/departments = list( + "Assistant" = null, + "Engineering" = GLOB.engineering_positions, + "Medical" = GLOB.medical_positions, + "Science" = GLOB.science_positions, + "Security" = GLOB.security_positions, + "Support" = GLOB.support_positions, + "Supply" = GLOB.supply_positions, + "Command" = GLOB.command_positions, + "Custom" = null, ) var/department = input(user, "What job would you like to put on this card?\nChoose a department or a custom job title.\nChanging occupation will not grant or remove any access levels.","Agent Card Occupation") in departments @@ -560,20 +561,8 @@ if(department == "Custom") new_job = sanitize(stripped_input(user,"Choose a custom job title:","Agent Card Occupation", "Assistant", MAX_MESSAGE_LEN)) - else if(department != "Assistant") - switch(department) - if("Engineering") - new_job = input(user, "What job would you like to put on this card?\nChanging occupation will not grant or remove any access levels.","Agent Card Occupation") in GLOB.engineering_positions - if("Medical") - new_job = input(user, "What job would you like to put on this card?\nChanging occupation will not grant or remove any access levels.","Agent Card Occupation") in GLOB.medical_positions - if("Science") - new_job = input(user, "What job would you like to put on this card?\nChanging occupation will not grant or remove any access levels.","Agent Card Occupation") in GLOB.science_positions - if("Security") - new_job = input(user, "What job would you like to put on this card?\nChanging occupation will not grant or remove any access levels.","Agent Card Occupation") in GLOB.security_positions - if("Support") - new_job = input(user, "What job would you like to put on this card?\nChanging occupation will not grant or remove any access levels.","Agent Card Occupation") in GLOB.support_positions - if("Command") - new_job = input(user, "What job would you like to put on this card?\nChanging occupation will not grant or remove any access levels.","Agent Card Occupation") in GLOB.command_positions + else if(department != "Assistant" && !isnull(departments[department])) + new_job = input(user, "What job would you like to put on this card?\nChanging occupation will not grant or remove any access levels.","Agent Card Occupation") in departments[department] if(!Adjacent(user)) return