mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-22 11:37:40 +01:00
Adds bare bones for a persistence system
Admins can toy around with converting a character to text, and placing them back elsewhere, independent of the round. It's got a kink, though: The text given to you directly needs to be printed once to remove all the escapes - otherwise the thing will choke. I'd like advice on resolving that
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
//why are these here and not in human_defines.dm
|
||||
//var/list/hud_list[10]
|
||||
var/datum/species/species //Contains icon generation and language information, set during New().
|
||||
var/embedded_flag //To check if we've need to roll for damage on movement while an item is imbedded in us.
|
||||
var/embedded_flag //To check if we've need to roll for damage on movement while an item is imbedded in us.
|
||||
var/obj/item/weapon/rig/wearing_rig // This is very not good, but it's much much better than calling get_rig() every update_canmove() call.
|
||||
|
||||
/mob/living/carbon/human/New(var/new_loc, var/new_species = null, var/delay_ready_dna = 0)
|
||||
@@ -482,8 +482,8 @@
|
||||
if(3 to 4) stunprob = 30
|
||||
if(5 to 6) stunprob = 40
|
||||
if(7 to 8) stunprob = 60
|
||||
if(9) stunprob = 70
|
||||
if(10) stunprob = 95
|
||||
if(9) stunprob = 70
|
||||
if(10) stunprob = 95
|
||||
|
||||
if(prob(stunprob))
|
||||
M.powerlevel -= 3
|
||||
@@ -944,7 +944,7 @@
|
||||
for(var/datum/data/record/R in data_core.security)
|
||||
if(R.fields["id"] == E.fields["id"])
|
||||
if(hasHUD(usr,"security"))
|
||||
var/t1 = sanitize(copytext(input("Add Comment:", "Sec. records", null, null) as message,1,MAX_MESSAGE_LEN))
|
||||
var/t1 = sanitize(copytext(input("Add Comment:", "Sec. records", null, null) as message,1,MAX_MESSAGE_LEN))
|
||||
if( !(t1) || usr.stat || usr.restrained() || !(hasHUD(usr,"security")) )
|
||||
return
|
||||
var/counter = 1
|
||||
@@ -1075,7 +1075,7 @@
|
||||
for(var/datum/data/record/R in data_core.medical)
|
||||
if(R.fields["id"] == E.fields["id"])
|
||||
if(hasHUD(usr,"medical"))
|
||||
var/t1 = sanitize(copytext(input("Add Comment:", "Med. records", null, null) as message,1,MAX_MESSAGE_LEN))
|
||||
var/t1 = sanitize(copytext(input("Add Comment:", "Med. records", null, null) as message,1,MAX_MESSAGE_LEN))
|
||||
if( !(t1) || usr.stat || usr.restrained() || !(hasHUD(usr,"medical")) )
|
||||
return
|
||||
var/counter = 1
|
||||
@@ -1285,8 +1285,8 @@
|
||||
var/limb_path = organ_data["path"]
|
||||
var/obj/item/organ/external/O = new limb_path(temp_holder)
|
||||
if(H.get_limb_by_name(O.name)) //Check to see if the user already has an limb with the same name as the 'missing limb'. If they do, skip regrowth.
|
||||
continue //In an example, this will prevent duplication of the mob's right arm if the mob is a Human and they have a Diona right arm, since,
|
||||
//while the limb with the name 'right_arm' the mob has may not be listed in their species' bodyparts definition, it is still viable and has the appropriate limb name.
|
||||
continue //In an example, this will prevent duplication of the mob's right arm if the mob is a Human and they have a Diona right arm, since,
|
||||
//while the limb with the name 'right_arm' the mob has may not be listed in their species' bodyparts definition, it is still viable and has the appropriate limb name.
|
||||
else
|
||||
O = new limb_path(H) //Create the limb on the player.
|
||||
O.owner = H
|
||||
@@ -1704,7 +1704,7 @@
|
||||
if((head_organ.species.name in tmp_hair.species_allowed) && (robohead.company in tmp_hair.models_allowed)) //Populate the list of available monitor styles only with styles that the monitor-head is allowed to use.
|
||||
hair += i
|
||||
|
||||
var/new_style = input(src, "Select a monitor display", "Monitor Display", head_organ.h_style) as null|anything in hair
|
||||
var/new_style = input(src, "Select a monitor display", "Monitor Display", head_organ.h_style) as null|anything in hair
|
||||
if(incapacitated())
|
||||
to_chat(src, "<span class='warning'>You were interrupted while changing your monitor display.</span>")
|
||||
return
|
||||
@@ -1909,7 +1909,7 @@
|
||||
if(current_size >= STAGE_THREE)
|
||||
var/list/handlist = list(l_hand, r_hand)
|
||||
for(var/obj/item/hand in handlist)
|
||||
if(prob(current_size * 5) && hand.w_class >= ((11-current_size)/2) && unEquip(hand))
|
||||
if(prob(current_size * 5) && hand.w_class >= ((11-current_size)/2) && unEquip(hand))
|
||||
step_towards(hand, src)
|
||||
to_chat(src, "<span class='warning'>\The [S] pulls \the [hand] from your grip!</span>")
|
||||
apply_effect(current_size * 3, IRRADIATE)
|
||||
@@ -2031,3 +2031,59 @@
|
||||
return 0
|
||||
|
||||
return .
|
||||
|
||||
/mob/living/carbon/human/serialize()
|
||||
// Currently: Limbs/organs only
|
||||
var/list/data = ..()
|
||||
var/list/limbs_list = list()
|
||||
var/list/organs_list = list()
|
||||
data["limbs"] = limbs_list
|
||||
data["iorgans"] = organs_list
|
||||
data["dna"] = dna.serialize()
|
||||
data["ushirt"] = undershirt
|
||||
for(var/limb in organs_by_name)
|
||||
var/obj/item/organ/O = organs_by_name[limb]
|
||||
if(!O)
|
||||
limbs_list[limb] = "missing"
|
||||
continue
|
||||
|
||||
limbs_list[limb] = O.serialize()
|
||||
|
||||
for(var/organ in internal_organs)
|
||||
var/obj/item/organ/O = organ
|
||||
organs_list[O.name] = O.serialize()
|
||||
|
||||
return json_encode(data)
|
||||
|
||||
/mob/living/carbon/human/deserialize(list/data)
|
||||
var/list/limbs_list = data["limbs"]
|
||||
var/list/organs_list = data["iorgans"]
|
||||
if(!islist(data["limbs"]))
|
||||
throw EXCEPTION("Expected a limbs list, but found none")
|
||||
|
||||
if(islist(data["dna"]))
|
||||
dna.deserialize(data["dna"])
|
||||
real_name = dna.real_name
|
||||
name = real_name
|
||||
UpdateAppearance()
|
||||
set_species(dna.species)
|
||||
undershirt = data["ushirt"]
|
||||
for(var/obj/item/organ/internal/iorgan in internal_organs)
|
||||
qdel(iorgan)
|
||||
|
||||
for(var/obj/item/organ/external/organ in organs)
|
||||
qdel(organ)
|
||||
|
||||
for(var/limb in limbs_list)
|
||||
// Missing means skip this part - it's missing
|
||||
if(limbs_list[limb] == "missing")
|
||||
continue
|
||||
// "New" code handles insertion and DNA sync'ing
|
||||
var/obj/item/organ/external/E = list_to_object(limbs_list[limb], src)
|
||||
E.sync_colour_to_dna()
|
||||
|
||||
for(var/organ in organs_list)
|
||||
// As above, "New" code handles insertion, DNA sync
|
||||
list_to_object(organs_list[organ], src)
|
||||
update_icons()
|
||||
..()
|
||||
|
||||
Reference in New Issue
Block a user