From 3f8b268455ca1bf80c7d9c2ebb4341d92b89e6c0 Mon Sep 17 00:00:00 2001 From: Seris02 <49109742+Seris02@users.noreply.github.com> Date: Tue, 19 Jan 2021 07:02:51 +0800 Subject: [PATCH] no_dresscode variable but this time it doesn't override important slots (#2468) * once again but better this time * Makes it so that equipping them has no sound * Update code/modules/mob/mob.dm Co-authored-by: Azarak Co-authored-by: Azarak --- code/controllers/subsystem/job.dm | 8 ++++++-- code/modules/mob/mob.dm | 12 ++++++++++-- .../modules/customization/modules/jobs/_job.dm | 3 +++ .../modules/mob/dead/new_player/preferences_setup.dm | 10 ++++++---- 4 files changed, 25 insertions(+), 8 deletions(-) diff --git a/code/controllers/subsystem/job.dm b/code/controllers/subsystem/job.dm index 445780aa915..5567cd7179c 100644 --- a/code/controllers/subsystem/job.dm +++ b/code/controllers/subsystem/job.dm @@ -481,6 +481,10 @@ SUBSYSTEM_DEF(job) to_chat(M, "You are the [rank].") var/list/packed_items //SKYRAT CHANGE ADDITION - CUSTOMIZATION if(job) + //SKYRAT EDIT ADDITION BEGIN - CUSTOMIZATION + if (M.client && job.no_dresscode && job.loadout) + packed_items = M.client.prefs.equip_preference_loadout(living_mob,FALSE,job,blacklist=job.blacklist_dresscode_slots,initial=TRUE) + //SKYRAT EDIT ADDITION END var/new_mob = job.equip(living_mob, null, null, joined_late , null, M.client)//silicons override this proc to return a mob if(ismob(new_mob)) living_mob = new_mob @@ -513,9 +517,9 @@ SUBSYSTEM_DEF(job) if(job && living_mob) job.after_spawn(living_mob, M, joined_late) // note: this happens before the mob has a key! M will always have a client, H might not. //SKYRAT CHANGE ADDITION BEGIN - CUSTOMIZATION - if(job.loadout) + if(!job.no_dresscode && job.loadout) if(M.client) - packed_items = M.client.prefs.equip_preference_loadout(living_mob, FALSE, job) + packed_items = M.client.prefs.equip_preference_loadout(living_mob, FALSE, job,initial=TRUE) if(packed_items) M.client.prefs.add_packed_items(living_mob, packed_items) //SKYRAT CHANGE ADDITION END diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index 2c6fceeacd8..3a89ff7f8ba 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -366,7 +366,8 @@ * * returns 0 if it cannot, 1 if successful */ -/mob/proc/equip_to_appropriate_slot(obj/item/W, qdel_on_fail = FALSE) +///mob/proc/equip_to_appropriate_slot(obj/item/W, qdel_on_fail = FALSE) (original) SKYRAT EDIT CHANGE - CUSTOMIZATION +/mob/proc/equip_to_appropriate_slot(obj/item/W, qdel_on_fail = FALSE, blacklist, initial) if(!istype(W)) return FALSE var/slot_priority = W.slot_equipment_priority @@ -382,9 +383,16 @@ ITEM_SLOT_LPOCKET, ITEM_SLOT_RPOCKET,\ ITEM_SLOT_DEX_STORAGE\ ) - + //SKYRAT EDIT CHANGE BEGIN - CUSTOMIZATION + /* for(var/slot in slot_priority) if(equip_to_slot_if_possible(W, slot, FALSE, TRUE, TRUE, FALSE, FALSE)) //qdel_on_fail = FALSE; disable_warning = TRUE; redraw_mob = TRUE; + */ + if (blacklist) + slot_priority -= blacklist + for(var/slot in slot_priority) + if(equip_to_slot_if_possible(W, slot, FALSE, TRUE, TRUE, FALSE, initial)) //qdel_on_fail = FALSE; disable_warning = TRUE; redraw_mob = TRUE; + //SKYRAT EDIT CHANGE END return TRUE if(qdel_on_fail) diff --git a/modular_skyrat/modules/customization/modules/jobs/_job.dm b/modular_skyrat/modules/customization/modules/jobs/_job.dm index 90474fa89f7..27364c72304 100644 --- a/modular_skyrat/modules/customization/modules/jobs/_job.dm +++ b/modular_skyrat/modules/customization/modules/jobs/_job.dm @@ -5,6 +5,8 @@ var/loadout = TRUE //List of banned quirks in their names(dont blame me, that's how they're stored), players can't join as the job if they have the quirk. Associative for the purposes of performance var/list/banned_quirks + ///A list of slots that can't have loadout items assigned to them if no_dresscode is applied, used for important items such as ID, PDA, backpack and headset + var/list/blacklist_dresscode_slots //Whitelist of allowed species for this job. If not specified then all roundstart races can be used. Associative with TRUE var/list/species_whitelist //Blacklist of species for this job. @@ -31,6 +33,7 @@ /datum/job/assistant no_dresscode = TRUE + blacklist_dresscode_slots = list(ITEM_SLOT_EARS,ITEM_SLOT_BELT,ITEM_SLOT_ID,ITEM_SLOT_BACK) //headset, PDA, ID, backpack are important items /datum/job/officer banned_quirks = list(SEC_RESTRICTED_QUIRKS) diff --git a/modular_skyrat/modules/customization/modules/mob/dead/new_player/preferences_setup.dm b/modular_skyrat/modules/customization/modules/mob/dead/new_player/preferences_setup.dm index fe163ec2e10..4f099e21c57 100644 --- a/modular_skyrat/modules/customization/modules/mob/dead/new_player/preferences_setup.dm +++ b/modular_skyrat/modules/customization/modules/mob/dead/new_player/preferences_setup.dm @@ -165,7 +165,7 @@ parent.show_character_previews(new /mutable_appearance(mannequin)) unset_busy_human_dummy(DUMMY_HUMAN_SLOT_PREFERENCES) -/datum/preferences/proc/equip_preference_loadout(mob/living/carbon/human/H, just_preview = FALSE, datum/job/choosen_job) +/datum/preferences/proc/equip_preference_loadout(mob/living/carbon/human/H, just_preview = FALSE, datum/job/choosen_job, blacklist, initial) if(!ishuman(H)) return var/list/items_to_pack = list() @@ -175,20 +175,22 @@ //Skip the item if the job doesn't match, but only if that not used for the preview if(!just_preview && (choosen_job && LI.restricted_roles && !(choosen_job.title in LI.restricted_roles))) continue - if(!H.equip_to_appropriate_slot(ITEM)) + if(!H.equip_to_appropriate_slot(ITEM,blacklist=blacklist,initial=initial)) if(!just_preview) items_to_pack += ITEM //Here we stick it into a bag, if possible - if(!H.equip_to_slot_if_possible(ITEM, ITEM_SLOT_BACKPACK, disable_warning = TRUE, bypass_equip_delay_self = TRUE)) + if(!H.equip_to_slot_if_possible(ITEM, ITEM_SLOT_BACKPACK, disable_warning = TRUE, bypass_equip_delay_self = TRUE, initial=initial)) //Otherwise - on the ground ITEM.forceMove(get_turf(H)) else qdel(ITEM) return items_to_pack + + //This needs to be a seperate proc because the character could not have the proper backpack during the moment of loadout equip /datum/preferences/proc/add_packed_items(mob/living/carbon/human/H, list/packed_items, del_on_fail = TRUE) - //Here we stick loadout items that couldn't be equipped into a bag. + //Here we stick loadout items that couldn't be equipped into a bag. var/obj/item/back_item = H.back for(var/item in packed_items) var/obj/item/ITEM = item