From 49bbcefba88901d3fd019c811a79c10d28c8e782 Mon Sep 17 00:00:00 2001 From: DragonTrance Date: Mon, 8 Mar 2021 15:20:23 -0700 Subject: [PATCH] try this again --- code/controllers/subsystem/job.dm | 5 +- code/datums/outfit.dm | 50 +++++++++---------- code/modules/jobs/job_types/job.dm | 2 +- code/modules/mob/mob.dm | 18 +++++-- .../code/controllers/subsystem/job.dm | 22 ++++---- .../code/modules/jobs/dresscode_values.dm | 8 --- tgstation.dme | 1 - 7 files changed, 53 insertions(+), 53 deletions(-) delete mode 100644 modular_citadel/code/modules/jobs/dresscode_values.dm diff --git a/code/controllers/subsystem/job.dm b/code/controllers/subsystem/job.dm index 3d525e05..6d77a1f6 100644 --- a/code/controllers/subsystem/job.dm +++ b/code/controllers/subsystem/job.dm @@ -390,6 +390,7 @@ SUBSYSTEM_DEF(job) var/datum/job/job = GetJob(rank) H.job = rank + equip_loadout(N, H) //If we joined at roundstart we should be positioned at our workstation if(!joined_late) @@ -416,8 +417,6 @@ SUBSYSTEM_DEF(job) H.mind.assigned_role = rank if(job) - if(!job.dresscodecompliant)// CIT CHANGE - dress code compliance - equip_loadout(N, H) // CIT CHANGE - allows players to spawn with loadout items var/new_mob = job.equip(H, null, null, joined_late) if(ismob(new_mob)) H = new_mob @@ -449,8 +448,6 @@ SUBSYSTEM_DEF(job) H.add_memory("Your account ID is [wageslave.account_id].") if(job && H) - if(job.dresscodecompliant)// CIT CHANGE - dress code compliance - equip_loadout(N, H) // CIT CHANGE - allows players to spawn with loadout items job.after_spawn(H, M, joined_late) // note: this happens before the mob has a key! M will always have a client, H might not. equip_loadout(N, H, TRUE)//CIT CHANGE - makes players spawn with in-backpack loadout items properly. A little hacky but it works diff --git a/code/datums/outfit.dm b/code/datums/outfit.dm index 3bb752b5..2cd30da8 100644 --- a/code/datums/outfit.dm +++ b/code/datums/outfit.dm @@ -40,31 +40,44 @@ //Start with uniform,suit,backpack for additional slots if(uniform) - H.equip_to_slot_or_del(new uniform(H),SLOT_W_UNIFORM) + H.equip_to_slot_or_store_and_del(new uniform(H),SLOT_W_UNIFORM) if(suit) - H.equip_to_slot_or_del(new suit(H),SLOT_WEAR_SUIT) + H.equip_to_slot_or_store_and_del(new suit(H),SLOT_WEAR_SUIT) if(back) H.equip_to_slot_or_del(new back(H),SLOT_BACK) + + if(!visualsOnly) // Items in pockets or backpack don't show up on mob's icon. + if(l_pocket) + H.equip_to_slot_or_store_and_del(new l_pocket(H),SLOT_L_STORE) + if(r_pocket) + H.equip_to_slot_or_store_and_del(new r_pocket(H),SLOT_R_STORE) + if(backpack_contents) + for(var/path in backpack_contents) + var/number = backpack_contents[path] + if(!isnum(number))//Default to 1 + number = 1 + for(var/i in 1 to number) + H.equip_to_slot_or_del(new path(H),SLOT_IN_BACKPACK) if(belt) - H.equip_to_slot_or_del(new belt(H),SLOT_BELT) + H.equip_to_slot_or_store_and_del(new belt(H),SLOT_BELT) if(gloves) - H.equip_to_slot_or_del(new gloves(H),SLOT_GLOVES) + H.equip_to_slot_or_store_and_del(new gloves(H),SLOT_GLOVES) if(shoes) - H.equip_to_slot_or_del(new shoes(H),SLOT_SHOES) + H.equip_to_slot_or_store_and_del(new shoes(H),SLOT_SHOES) if(head) - H.equip_to_slot_or_del(new head(H),SLOT_HEAD) + H.equip_to_slot_or_store_and_del(new head(H),SLOT_HEAD) if(mask) - H.equip_to_slot_or_del(new mask(H),SLOT_WEAR_MASK) + H.equip_to_slot_or_store_and_del(new mask(H),SLOT_WEAR_MASK) if(neck) - H.equip_to_slot_or_del(new neck(H),SLOT_NECK) + H.equip_to_slot_or_store_and_del(new neck(H),SLOT_NECK) if(ears) - H.equip_to_slot_or_del(new ears(H),SLOT_EARS) + H.equip_to_slot_or_store_and_del(new ears(H),SLOT_EARS) if(glasses) - H.equip_to_slot_or_del(new glasses(H),SLOT_GLASSES) + H.equip_to_slot_or_store_and_del(new glasses(H),SLOT_GLASSES) if(id) - H.equip_to_slot_or_del(new id(H),SLOT_WEAR_ID) + H.equip_to_slot_or_store_and_del(new id(H),SLOT_WEAR_ID) if(suit_store) - H.equip_to_slot_or_del(new suit_store(H),SLOT_S_STORE) + H.equip_to_slot_or_store_and_del(new suit_store(H),SLOT_S_STORE) if(accessory) var/obj/item/clothing/under/U = H.w_uniform @@ -78,19 +91,6 @@ if(r_hand) H.put_in_r_hand(new r_hand(H)) - if(!visualsOnly) // Items in pockets or backpack don't show up on mob's icon. - if(l_pocket) - H.equip_to_slot_or_del(new l_pocket(H),SLOT_L_STORE) - if(r_pocket) - H.equip_to_slot_or_del(new r_pocket(H),SLOT_R_STORE) - if(backpack_contents) - for(var/path in backpack_contents) - var/number = backpack_contents[path] - if(!isnum(number))//Default to 1 - number = 1 - for(var/i in 1 to number) - H.equip_to_slot_or_del(new path(H),SLOT_IN_BACKPACK) - if(!H.head && toggle_helmet && istype(H.wear_suit, /obj/item/clothing/suit/space/hardsuit)) var/obj/item/clothing/suit/space/hardsuit/HS = H.wear_suit HS.ToggleHelmet() diff --git a/code/modules/jobs/job_types/job.dm b/code/modules/jobs/job_types/job.dm index 3a8aa68b..d593bfd8 100644 --- a/code/modules/jobs/job_types/job.dm +++ b/code/modules/jobs/job_types/job.dm @@ -224,7 +224,7 @@ if(!J) J = SSjob.GetJob(H.job) - if(H.nameless && J.dresscodecompliant) + if(H.nameless) if(J.title in GLOB.command_positions) H.real_name = J.title else diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index 98209303..bca71db9 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -235,15 +235,19 @@ mob/visible_message(message, self_message, blind_message, vision_distance = DEFA //set qdel_on_fail to have it delete W if it fails to equip //set disable_warning to disable the 'you are unable to equip that' warning. //unset redraw_mob to prevent the mob from being redrawn at the end. -/mob/proc/equip_to_slot_if_possible(obj/item/W, slot, qdel_on_fail = FALSE, disable_warning = FALSE, redraw_mob = TRUE, bypass_equip_delay_self = FALSE) +/mob/proc/equip_to_slot_if_possible(obj/item/W, slot, qdel_on_fail = FALSE, disable_warning = FALSE, redraw_mob = TRUE, bypass_equip_delay_self = FALSE, store = FALSE) if(!istype(W)) return FALSE if(!W.mob_can_equip(src, null, slot, disable_warning, bypass_equip_delay_self)) + if(store && istype(src, /mob/living/carbon/human)) + var/mob/living/carbon/human/H = src + var/obj/item/storage/backpack/BP = H.back + if(BP) + return SEND_SIGNAL(BP, COMSIG_TRY_STORAGE_INSERT, W, null, TRUE, TRUE) if(qdel_on_fail) qdel(W) - else - if(!disable_warning) - to_chat(src, "You are unable to equip that!") + else if(!disable_warning) + to_chat(src, "You are unable to equip that!") return FALSE equip_to_slot(W, slot, redraw_mob) //This proc should not ever fail. return TRUE @@ -258,6 +262,12 @@ mob/visible_message(message, self_message, blind_message, vision_distance = DEFA /mob/proc/equip_to_slot_or_del(obj/item/W, slot) return equip_to_slot_if_possible(W, slot, TRUE, TRUE, FALSE, TRUE) +/mob/proc/equip_to_slot_or_store(obj/item/W, slot) + return equip_to_slot_if_possible(W, slot, FALSE, TRUE, FALSE, TRUE, TRUE) + +/mob/proc/equip_to_slot_or_store_and_del(obj/item/W, slot) + return equip_to_slot_if_possible(W, slot, TRUE, TRUE, FALSE, TRUE, TRUE) + //puts the item "W" into an appropriate slot in a human's inventory //returns 0 if it cannot, 1 if successful /mob/proc/equip_to_appropriate_slot(obj/item/W) diff --git a/modular_citadel/code/controllers/subsystem/job.dm b/modular_citadel/code/controllers/subsystem/job.dm index c433042a..5234ccfc 100644 --- a/modular_citadel/code/controllers/subsystem/job.dm +++ b/modular_citadel/code/controllers/subsystem/job.dm @@ -1,4 +1,4 @@ -/datum/controller/subsystem/job/proc/equip_loadout(mob/dead/new_player/N, mob/living/M, equipbackpackstuff) +/datum/controller/subsystem/job/proc/equip_loadout(mob/dead/new_player/N, mob/living/M, backpackstuffs) var/mob/the_mob = N if(!the_mob) the_mob = M // cause this doesn't get assigned if player is a latejoiner @@ -10,18 +10,20 @@ G = GLOB.loadout_items[slot_to_string(initial(G.category))][initial(G.name)] if(!G) continue - var/permitted = TRUE if(G.restricted_roles && G.restricted_roles.len && !(M.mind.assigned_role in G.restricted_roles)) - permitted = FALSE - if(G.ckeywhitelist && G.ckeywhitelist.len && !(the_mob.client.ckey in G.ckeywhitelist)) - permitted = FALSE - if(!equipbackpackstuff && G.category == SLOT_IN_BACKPACK)//snowflake check since plopping stuff in the backpack doesnt work for pre-job equip loadout stuffs - permitted = FALSE - if(equipbackpackstuff && G.category != SLOT_IN_BACKPACK)//ditto - permitted = FALSE - if(!permitted) continue + if(G.ckeywhitelist && G.ckeywhitelist.len && !(the_mob.client.ckey in G.ckeywhitelist)) + continue + var/obj/item/I = new G.path + if(backpackstuffs && G.category == SLOT_IN_BACKPACK && iscarbon(M)) + var/mob/living/carbon/C = M + var/obj/item/storage/backpack/B = C.back + if(!B || !SEND_SIGNAL(B, COMSIG_TRY_STORAGE_INSERT, I, null, TRUE, TRUE)) + I.forceMove(get_turf(C)) + continue + else if(backpackstuffs && G.category != SLOT_IN_BACKPACK) + continue if(!M.equip_to_slot_if_possible(I, G.category, disable_warning = TRUE, bypass_equip_delay_self = TRUE)) // If the job's dresscode compliant, try to put it in its slot, first if(iscarbon(M)) var/mob/living/carbon/C = M diff --git a/modular_citadel/code/modules/jobs/dresscode_values.dm b/modular_citadel/code/modules/jobs/dresscode_values.dm deleted file mode 100644 index 24cd5c5a..00000000 --- a/modular_citadel/code/modules/jobs/dresscode_values.dm +++ /dev/null @@ -1,8 +0,0 @@ -//This file controls whether or not a job complies with dresscodes. -//If a job complies with dresscodes, loadout items will not be equipped instead of the job's outfit, instead placing the items into the player's backpack. - -/datum/job - var/dresscodecompliant = TRUE - -/datum/job/assistant - dresscodecompliant = FALSE \ No newline at end of file diff --git a/tgstation.dme b/tgstation.dme index 9aef6ce2..20ef289f 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -3227,7 +3227,6 @@ #include "modular_citadel\code\modules\events\blob.dm" #include "modular_citadel\code\modules\events\wizard\magicarp.dm" #include "modular_citadel\code\modules\integrated_electronics\subtypes\manipulation.dm" -#include "modular_citadel\code\modules\jobs\dresscode_values.dm" #include "modular_citadel\code\modules\mentor\follow.dm" #include "modular_citadel\code\modules\mentor\mentor.dm" #include "modular_citadel\code\modules\mentor\mentor_memo.dm"