diff --git a/code/datums/datumvars.dm b/code/datums/datumvars.dm
index 13c3fb64f33..44a8d0bb597 100644
--- a/code/datums/datumvars.dm
+++ b/code/datums/datumvars.dm
@@ -1279,7 +1279,12 @@
return
src.debug_variables(DAT)
- return
+ if(href_list["copyoutfit"])
+ if(!check_rights(R_SPAWN))
+ return
+ var/mob/living/carbon/human/H = locateUID(href_list["copyoutfit"])
+ if(istype(H))
+ H.copy_outfit()
/client/proc/view_var_Topic_list(href, href_list, hsrc)
if(href_list["VarsList"])
diff --git a/code/datums/outfits/outfit.dm b/code/datums/outfits/outfit.dm
index 0134a62d7fb..4c630122d9b 100644
--- a/code/datums/outfits/outfit.dm
+++ b/code/datums/outfits/outfit.dm
@@ -22,8 +22,10 @@
var/pda = null
var/internals_slot = null //ID of slot containing a gas tank
var/list/backpack_contents = list() // In the list(path=count,otherpath=count) format
- var/list/implants = null
- var/list/cybernetic_implants = null
+ var/box // Internals box. Will be inserted at the start of backpack_contents
+ var/list/implants = list()
+ var/list/cybernetic_implants = list()
+ var/list/accessories = list()
var/list/chameleon_extras //extra types for chameleon outfit changes, mostly guns
@@ -84,12 +86,24 @@
if(pda)
equip_item(H, pda, slot_wear_pda)
+ if(uniform)
+ for(var/path in accessories)
+ var/obj/item/clothing/accessory/A = new path()
+ var/obj/item/clothing/under/U = uniform
+ U.attach_accessory(A, H)
+
if(!visualsOnly) // Items in pockets or backpack don't show up on mob's icon.
if(l_pocket)
equip_item(H, l_pocket, slot_l_store)
if(r_pocket)
equip_item(H, r_pocket, slot_r_store)
+ if(box)
+ if(!backpack_contents)
+ backpack_contents = list()
+ backpack_contents.Insert(1, box)
+ backpack_contents[box] = 1
+
for(var/path in backpack_contents)
var/number = backpack_contents[path]
for(var/i in 1 to number)
@@ -168,7 +182,7 @@
//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)
+ WRITE_FILE(f, json)
admin << ftp(f, "[name].json")
/datum/outfit/proc/load_from(list/outfit_data)
@@ -191,19 +205,38 @@
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"]
+
var/list/backpack = outfit_data["backpack_contents"]
backpack_contents = list()
for(var/item in backpack)
var/itype = text2path(item)
if(itype)
backpack_contents[itype] = backpack[item]
+ box = text2path(outfit_data["box"])
+
var/list/impl = outfit_data["implants"]
implants = list()
for(var/I in impl)
var/imptype = text2path(I)
if(imptype)
implants += imptype
+
+ 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/list/accessories = outfit_data["accessories"]
+ accessories = list()
+ for(var/A in accessories)
+ var/accessorytype = text2path(A)
+ if(accessorytype)
+ accessories += A
+
return TRUE
/datum/outfit/proc/get_json_data()
@@ -227,6 +260,10 @@
.["suit_store"] = suit_store
.["r_hand"] = r_hand
.["l_hand"] = l_hand
+ .["pda"] = pda
.["internals_slot"] = internals_slot
.["backpack_contents"] = backpack_contents
- .["implants"] = implants
\ No newline at end of file
+ .["box"] = box
+ .["implants"] = implants
+ .["cybernetic_implants"] = cybernetic_implants
+ .["accessories"] = accessories
diff --git a/code/datums/outfits/vv_outfit.dm b/code/datums/outfits/vv_outfit.dm
index 5a4791eea89..4ca01ffa24c 100644
--- a/code/datums/outfits/vv_outfit.dm
+++ b/code/datums/outfits/vv_outfit.dm
@@ -69,7 +69,7 @@
//Copy equipment
var/list/result = list()
- var/list/slots_to_check = list(slot_w_uniform, slot_back, slot_wear_suit, slot_belt, slot_gloves, slot_shoes, slot_head, slot_wear_mask, slot_l_ear, slot_r_ear, slot_glasses, slot_wear_id, slot_s_store, slot_l_store, slot_r_store)
+ var/list/slots_to_check = list(slot_w_uniform, slot_back, slot_wear_suit, slot_belt, slot_gloves, slot_shoes, slot_head, slot_wear_mask, slot_l_ear, slot_r_ear, slot_glasses, slot_wear_id, slot_wear_pda, slot_s_store, slot_l_store, slot_r_store)
for(var/s in slots_to_check)
var/obj/item/I = get_item_by_slot(s)
var/vedits = collect_vv(I)
@@ -87,7 +87,7 @@
if(ID && ID.registered_name == real_name)
O.update_id_name = TRUE
//Copy hands
- if(l_hand && r_hand) //Not in the mood to let outfits transfer amputees
+ if(l_hand || r_hand) //Not in the mood to let outfits transfer amputees
var/obj/item/left_hand = l_hand
var/obj/item/right_hand = r_hand
if(istype(left_hand))
@@ -101,24 +101,39 @@
if(vedits)
result["RHAND"] = vedits
O.vv_values = result
+
//Copy backpack contents if exist.
var/obj/item/backpack = get_item_by_slot(slot_back)
- if(istype(backpack) && SEND_SIGNAL(backpack, COMSIG_CONTAINS_STORAGE))
- var/list/bp_stuff = list()
+ if(istype(backpack) && LAZYLEN(backpack.contents) > 0)
var/list/typecounts = list()
- SEND_SIGNAL(backpack, COMSIG_TRY_STORAGE_RETURN_INVENTORY, bp_stuff, FALSE)
- for(var/obj/item/I in bp_stuff)
+ for(var/obj/item/I in backpack)
if(typecounts[I.type])
typecounts[I.type] += 1
else
typecounts[I.type] = 1
O.backpack_contents = typecounts
//TODO : Copy varedits from backpack stuff too.
+
//Copy implants
O.implants = list()
for(var/obj/item/implant/I in contents)
if(istype(I))
O.implants |= I.type
+
+ // Copy cybernetic implants
+ O.cybernetic_implants = list()
+ for(var/obj/item/organ/internal/CI in contents)
+ if(istype(CI))
+ O.cybernetic_implants |= CI.type
+
+ // Copy accessories
+ if(O.uniform)
+ var/obj/item/clothing/under/U = O.uniform
+ O.accessories = list()
+ for(var/obj/item/clothing/accessory/A in U.accessories)
+ if(istype(A))
+ O.accessories |= A
+
//Copy to outfit cache
var/outfit_name = stripped_input(usr, "Enter the outfit name")
O.name = outfit_name
diff --git a/code/game/jobs/job/job.dm b/code/game/jobs/job/job.dm
index eebe4f2e9e4..9def19d2970 100644
--- a/code/game/jobs/job/job.dm
+++ b/code/game/jobs/job/job.dm
@@ -146,7 +146,7 @@
var/backpack = /obj/item/storage/backpack
var/satchel = /obj/item/storage/backpack/satchel_norm
var/dufflebag = /obj/item/storage/backpack/duffel
- var/box = /obj/item/storage/box/survival
+ box = /obj/item/storage/box/survival
var/tmp/list/gear_leftovers = list()
@@ -168,12 +168,8 @@
else
back = backpack //Department backpack
- if(box)
- var/spawnbox = box
- if(H.dna.species.speciesbox)
- spawnbox = H.dna.species.speciesbox
- backpack_contents.Insert(1, spawnbox) // Box always takes a first slot in backpack
- backpack_contents[spawnbox] = 1
+ if(box && H.dna.species.speciesbox)
+ box = H.dna.species.speciesbox
if(allow_loadout && H.client && (H.client.prefs.gear && H.client.prefs.gear.len))
for(var/gear in H.client.prefs.gear)
diff --git a/code/modules/clothing/clothing.dm b/code/modules/clothing/clothing.dm
index 4bbf68b4b7f..46f2d6cec4d 100644
--- a/code/modules/clothing/clothing.dm
+++ b/code/modules/clothing/clothing.dm
@@ -637,26 +637,31 @@ BLIND // can't see anything
/obj/item/clothing/under/attackby(obj/item/I, mob/user, params)
if(istype(I, /obj/item/clothing/accessory))
- var/obj/item/clothing/accessory/A = I
- if(can_attach_accessory(A))
- user.unEquip(I) // Make absolutely sure this accessory is removed from hands
- accessories += A
- A.on_attached(src, user)
-
- if(istype(loc, /mob/living/carbon/human))
- var/mob/living/carbon/human/H = loc
- H.update_inv_w_uniform()
-
- return
- else
- to_chat(user, "You cannot attach more accessories of this type to [src].")
+ attach_accessory(I, user)
if(accessories.len)
for(var/obj/item/clothing/accessory/A in accessories)
A.attackby(I, user, params)
- return
+ return TRUE
- ..()
+ . = ..()
+
+/obj/item/clothing/under/proc/attach_accessory(obj/item/clothing/accessory/A, mob/user)
+ if(can_attach_accessory(A))
+ if(!user.unEquip(A)) // Make absolutely sure this accessory is removed from hands
+ return FALSE
+ accessories += A
+ A.on_attached(src, user)
+
+ if(ishuman(loc))
+ var/mob/living/carbon/human/H = loc
+ H.update_inv_w_uniform()
+
+ return TRUE
+ else
+ to_chat(user, "You cannot attach more accessories of this type to [src].")
+
+ return FALSE
/obj/item/clothing/under/examine(mob/user)
..(user)
diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm
index bc0c33c233d..70c679cb163 100644
--- a/code/modules/mob/living/carbon/human/human.dm
+++ b/code/modules/mob/living/carbon/human/human.dm
@@ -1934,6 +1934,7 @@ Eyes need to have significantly high darksight to shine unless the mob has the X
. = ..()
. += "---"
.["Set Species"] = "?_src_=vars;setspecies=[UID()]"
+ .["Copy outfit"] = "?_src_=vars;copyoutfit=[UID()]"
.["Make AI"] = "?_src_=vars;makeai=[UID()]"
.["Make Mask of Nar'sie"] = "?_src_=vars;makemask=[UID()]"
.["Make cyborg"] = "?_src_=vars;makerobot=[UID()]"