mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-12 15:45:25 +01:00
Add accessory/internals box support, add cybernetic implants support to new outfit system
This commit is contained in:
@@ -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"])
|
||||
|
||||
@@ -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
|
||||
.["box"] = box
|
||||
.["implants"] = implants
|
||||
.["cybernetic_implants"] = cybernetic_implants
|
||||
.["accessories"] = accessories
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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, "<span class='notice'>You cannot attach more accessories of this type to [src].</span>")
|
||||
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, "<span class='notice'>You cannot attach more accessories of this type to [src].</span>")
|
||||
|
||||
return FALSE
|
||||
|
||||
/obj/item/clothing/under/examine(mob/user)
|
||||
..(user)
|
||||
|
||||
@@ -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()]"
|
||||
|
||||
Reference in New Issue
Block a user