mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-21 19:17:50 +01:00
adds implants and hair gradients to serialisation (#18934)
removes organ DNA from serialisation
This commit is contained in:
@@ -1821,9 +1821,11 @@ Eyes need to have significantly high darksight to shine unless the mob has the X
|
||||
var/list/limbs_list = list()
|
||||
var/list/organs_list = list()
|
||||
var/list/equip_list = list()
|
||||
var/list/implant_list = list()
|
||||
data["limbs"] = limbs_list
|
||||
data["iorgans"] = organs_list
|
||||
data["equip"] = equip_list
|
||||
data["implant_list"] = implant_list
|
||||
|
||||
data["dna"] = dna.serialize()
|
||||
data["age"] = age
|
||||
@@ -1854,12 +1856,16 @@ Eyes need to have significantly high darksight to shine unless the mob has the X
|
||||
if(thing != null)
|
||||
equip_list[i] = thing.serialize()
|
||||
|
||||
for(var/obj/item/implant/implant in src)
|
||||
implant_list[implant] = implant.serialize()
|
||||
|
||||
return data
|
||||
|
||||
/mob/living/carbon/human/deserialize(list/data)
|
||||
var/list/limbs_list = data["limbs"]
|
||||
var/list/organs_list = data["iorgans"]
|
||||
var/list/equip_list = data["equip"]
|
||||
var/list/implant_list = data["implant_list"]
|
||||
var/turf/T = get_turf(src)
|
||||
if(!islist(data["limbs"]))
|
||||
throw EXCEPTION("Expected a limbs list, but found none")
|
||||
@@ -1891,6 +1897,13 @@ Eyes need to have significantly high darksight to shine unless the mob has the X
|
||||
// As above, "New" code handles insertion, DNA sync
|
||||
list_to_object(organs_list[organ], src)
|
||||
|
||||
for(var/thing in implant_list)
|
||||
var/implant_data = implant_list[thing]
|
||||
var/path = text2path(implant_data["type"])
|
||||
var/obj/item/implant/implant = new path(T)
|
||||
if(!implant.implant(src, src))
|
||||
qdel(implant)
|
||||
|
||||
UpdateAppearance()
|
||||
|
||||
// De-serialize equipment
|
||||
|
||||
@@ -291,13 +291,8 @@ I use this so that this can be made better once the organ overhaul rolls out --
|
||||
|
||||
/obj/item/organ/serialize()
|
||||
var/data = ..()
|
||||
if(status != 0)
|
||||
if(status)
|
||||
data["status"] = status
|
||||
|
||||
// Save the DNA datum if: The owner doesn't exist, or the dna doesn't match the owner
|
||||
// Don't save when the organ has no initialized DNA. Happens when you spawn it in as admin
|
||||
if(dna.unique_enzymes && !(owner && dna.unique_enzymes == owner.dna.unique_enzymes))
|
||||
data["dna"] = dna.serialize()
|
||||
return data
|
||||
|
||||
/obj/item/organ/deserialize(data)
|
||||
@@ -305,8 +300,4 @@ I use this so that this can be made better once the organ overhaul rolls out --
|
||||
if(data["status"] & ORGAN_ROBOT)
|
||||
robotize()
|
||||
status = data["status"]
|
||||
if(islist(data["dna"]))
|
||||
// The only thing the official proc does is
|
||||
//instantiate the list and call this proc
|
||||
dna.deserialize(data["dna"])
|
||||
..()
|
||||
..()
|
||||
|
||||
@@ -233,6 +233,9 @@
|
||||
if(!length(contents))
|
||||
. += "<span class='warning'>There is nothing left inside!</span>"
|
||||
|
||||
/obj/item/organ/external/head/vars_to_save()
|
||||
return list("color", "name", "h_grad_style", "h_grad_offset_x", "h_grad_offset_y", "h_grad_colour", "h_grad_alpha")
|
||||
|
||||
/obj/item/organ/external/head/remove()
|
||||
if(owner)
|
||||
if(!istype(dna))
|
||||
|
||||
Reference in New Issue
Block a user