From 3728e5efe4a3d5e0f31a72ae7630ff94bdeab276 Mon Sep 17 00:00:00 2001 From: Mark van Alphen Date: Sun, 9 Jun 2019 22:47:47 +0200 Subject: [PATCH] More outfit improvements --- code/datums/datumvars.dm | 2 +- code/datums/outfits/outfit.dm | 18 +++++++++--------- code/datums/outfits/vv_outfit.dm | 2 ++ code/modules/admin/outfits.dm | 15 ++++++++++++++- code/modules/admin/topic.dm | 10 +++++----- code/modules/clothing/clothing.dm | 16 +++++++++------- 6 files changed, 40 insertions(+), 23 deletions(-) diff --git a/code/datums/datumvars.dm b/code/datums/datumvars.dm index 44a8d0bb597..ea5d3e83f45 100644 --- a/code/datums/datumvars.dm +++ b/code/datums/datumvars.dm @@ -1280,7 +1280,7 @@ src.debug_variables(DAT) if(href_list["copyoutfit"]) - if(!check_rights(R_SPAWN)) + if(!check_rights(R_EVENT)) return var/mob/living/carbon/human/H = locateUID(href_list["copyoutfit"]) if(istype(H)) diff --git a/code/datums/outfits/outfit.dm b/code/datums/outfits/outfit.dm index 4c630122d9b..6622e263789 100644 --- a/code/datums/outfits/outfit.dm +++ b/code/datums/outfits/outfit.dm @@ -179,14 +179,14 @@ /datum/outfit/proc/save_to_file(mob/admin) var/stored_data = get_json_data() var/json = json_encode(stored_data) - //Kinda annoying but as far as i can tell you need to make actual file. + // Kinda annoying but as far as I can tell you need to make actual file. var/f = file("data/TempOutfitUpload") fdel(f) WRITE_FILE(f, json) admin << ftp(f, "[name].json") /datum/outfit/proc/load_from(list/outfit_data) - //This could probably use more strict validation + // This could probably use more strict validation. name = outfit_data["name"] uniform = text2path(outfit_data["uniform"]) suit = text2path(outfit_data["suit"]) @@ -200,13 +200,13 @@ r_ear = text2path(outfit_data["r_ear"]) glasses = text2path(outfit_data["glasses"]) id = text2path(outfit_data["id"]) + pda = text2path(outfit_data["pda"]) l_pocket = text2path(outfit_data["l_pocket"]) r_pocket = text2path(outfit_data["r_pocket"]) suit_store = text2path(outfit_data["suit_store"]) r_hand = text2path(outfit_data["r_hand"]) l_hand = text2path(outfit_data["l_hand"]) - pda = text2path(outfit_data["pda"]) - internals_slot = outfit_data["internals_slot"] + internals_slot = text2path(outfit_data["internals_slot"]) var/list/backpack = outfit_data["backpack_contents"] backpack_contents = list() @@ -226,16 +226,16 @@ var/list/cybernetic_impl = outfit_data["cybernetic_implants"] cybernetic_implants = list() for(var/I in cybernetic_impl) - var/imptype = text2path(I) - if(imptype) - cybernetic_implants += cybernetic_impl + var/cybtype = text2path(I) + if(cybtype) + cybernetic_implants += cybtype var/list/accessories = outfit_data["accessories"] accessories = list() for(var/A in accessories) var/accessorytype = text2path(A) if(accessorytype) - accessories += A + accessories += accessorytype return TRUE @@ -255,12 +255,12 @@ .["r_ear"] = r_ear .["glasses"] = glasses .["id"] = id + .["pda"] = pda .["l_pocket"] = l_pocket .["r_pocket"] = r_pocket .["suit_store"] = suit_store .["r_hand"] = r_hand .["l_hand"] = l_hand - .["pda"] = pda .["internals_slot"] = internals_slot .["backpack_contents"] = backpack_contents .["box"] = box diff --git a/code/datums/outfits/vv_outfit.dm b/code/datums/outfits/vv_outfit.dm index 4ca01ffa24c..791949fc0c2 100644 --- a/code/datums/outfits/vv_outfit.dm +++ b/code/datums/outfits/vv_outfit.dm @@ -35,6 +35,8 @@ glasses = item_path if(slot_wear_id) id = item_path + if(slot_wear_pda) + pda = item_path if(slot_s_store) suit_store = item_path if(slot_l_store) diff --git a/code/modules/admin/outfits.dm b/code/modules/admin/outfits.dm index 8804c66c1c1..2b109c7ecfe 100644 --- a/code/modules/admin/outfits.dm +++ b/code/modules/admin/outfits.dm @@ -4,7 +4,7 @@ GLOBAL_LIST_EMPTY(custom_outfits) //Admin created outfits set category = "Debug" set name = "Outfit Manager" - if(!check_rights(R_DEBUG)) + if(!check_rights(R_EVENT)) return holder.outfit_manager(usr) @@ -59,6 +59,7 @@ GLOBAL_LIST_EMPTY(custom_outfits) //Admin created outfits var/list/headwear = typesof(/obj/item/clothing/head) var/list/glasses = typesof(/obj/item/clothing/glasses) var/list/masks = typesof(/obj/item/clothing/mask) + var/list/pdas = typesof(/obj/item/pda) var/list/ids = typesof(/obj/item/card/id) var/uniform_select = "" + var/pda_select = "" + var/dat = {" Create Outfit
@@ -185,6 +191,12 @@ GLOBAL_LIST_EMPTY(custom_outfits) //Admin created outfits [id_select] + + PDA: + + [pda_select] + + Left Pocket: @@ -241,6 +253,7 @@ GLOBAL_LIST_EMPTY(custom_outfits) //Admin created outfits O.l_pocket = text2path(href_list["outfit_l_pocket"]) O.r_pocket = text2path(href_list["outfit_r_pocket"]) O.id = text2path(href_list["outfit_id"]) + O.pda = text2path(href_list["outfit_pda"]) O.belt = text2path(href_list["outfit_belt"]) O.l_ear = text2path(href_list["outfit_l_ear"]) O.r_ear = text2path(href_list["outfit_r_ear"]) diff --git a/code/modules/admin/topic.dm b/code/modules/admin/topic.dm index 7f0660332fb..93fc5a9174b 100644 --- a/code/modules/admin/topic.dm +++ b/code/modules/admin/topic.dm @@ -3373,24 +3373,24 @@ log_admin("[key_name_admin(usr)] forcefully unlinked the discord account belonging to [target_ckey]") else if(href_list["create_outfit_finalize"]) - if(!check_rights(R_ADMIN)) + if(!check_rights(R_EVENT)) return create_outfit_finalize(usr,href_list) else if(href_list["load_outfit"]) - if(!check_rights(R_ADMIN)) + if(!check_rights(R_EVENT)) return load_outfit(usr) else if(href_list["create_outfit_menu"]) - if(!check_rights(R_ADMIN)) + if(!check_rights(R_EVENT)) return create_outfit(usr) else if(href_list["delete_outfit"]) - if(!check_rights(R_ADMIN)) + if(!check_rights(R_EVENT)) return var/datum/outfit/O = locate(href_list["chosen_outfit"]) in GLOB.custom_outfits delete_outfit(usr,O) else if(href_list["save_outfit"]) - if(!check_rights(R_ADMIN)) + if(!check_rights(R_EVENT)) return var/datum/outfit/O = locate(href_list["chosen_outfit"]) in GLOB.custom_outfits save_outfit(usr,O) diff --git a/code/modules/clothing/clothing.dm b/code/modules/clothing/clothing.dm index 46f2d6cec4d..76364d1c334 100644 --- a/code/modules/clothing/clothing.dm +++ b/code/modules/clothing/clothing.dm @@ -625,19 +625,20 @@ BLIND // can't see anything /obj/item/clothing/under/proc/can_attach_accessory(obj/item/clothing/accessory/A) if(istype(A)) - . = 1 + . = TRUE else - return 0 + return FALSE + if(accessories.len) for(var/obj/item/clothing/accessory/AC in accessories) if((A.slot in list(ACCESSORY_SLOT_UTILITY, ACCESSORY_SLOT_ARMBAND)) && AC.slot == A.slot) - return 0 + return FALSE if(!A.allow_duplicates && AC.type == A.type) - return 0 + return FALSE /obj/item/clothing/under/attackby(obj/item/I, mob/user, params) if(istype(I, /obj/item/clothing/accessory)) - attach_accessory(I, user) + attach_accessory(I, user, TRUE) if(accessories.len) for(var/obj/item/clothing/accessory/A in accessories) @@ -646,10 +647,11 @@ BLIND // can't see anything . = ..() -/obj/item/clothing/under/proc/attach_accessory(obj/item/clothing/accessory/A, mob/user) +/obj/item/clothing/under/proc/attach_accessory(obj/item/clothing/accessory/A, mob/user, unequip = FALSE) if(can_attach_accessory(A)) - if(!user.unEquip(A)) // Make absolutely sure this accessory is removed from hands + if(check_unequip && !user.unEquip(A)) // Make absolutely sure this accessory is removed from hands return FALSE + accessories += A A.on_attached(src, user)