Total Reassembly

This commit is contained in:
BlackMajor
2022-09-19 14:40:29 +12:00
parent 0af27b48f6
commit bb6c77dd57
4 changed files with 100 additions and 120 deletions

View File

@@ -117,8 +117,7 @@
/obj/item/organ/external/emp_act(severity) /obj/item/organ/external/emp_act(severity)
for(var/obj/O as anything in src.contents) for(var/obj/O as anything in src.contents)
O.emp_act(severity) O.emp_act(severity)
if(!(robotic >= ORGAN_ROBOT) || robotic == ORGAN_NANOFORM) //CHOMPEdit - Proteans handle EMP's differently
if((!(robotic >= ORGAN_ROBOT)) || (robotic = ORGAN_NANOFORM)) //CHOMPEdit - Proteans handle EMP's differently
return return
var/burn_damage = 0 var/burn_damage = 0
for(var/i = 1; i <= robotic; i++) for(var/i = 1; i <= robotic; i++)

View File

@@ -89,113 +89,39 @@
update_icons_body() update_icons_body()
/mob/living/carbon/human/proc/nano_regenerate() /mob/living/carbon/human/proc/nano_regenerate()
set name = "Total Reassembly (wip)" set name = "Total Reassembly"
set desc = "Completely reassemble yourself from whatever save slot you have loaded in preferences. Assuming you meet the requirements." set desc = "Fully repair yourself or reload your appearance from whatever character slot you have loaded."
set category = "Abilities" set category = "Abilities"
set hidden = 1 set hidden = 1
var/mob/living/caller = src var/mob/living/caller = src
if(temporary_form) if(temporary_form)
caller = temporary_form caller = temporary_form
to_chat(caller,"<span class ='warning'>This function isn't coded yet. Soon, my child.</span>") var/input = tgui_alert(caller,{"Do you want to rebuild or reassemble yourself?
else Rebuilding will cost 10,000 steel and will rebuild all of your limbs as well as repair all damage over a 40s period.
to_chat(src,"<span class ='warning'>This function isn't coded yet. Soon, my child.</span>") Reassembling costs no steel and will copy the appearance data of your currently loaded save slot."},"Reassembly",list("Rebuild","Reassemble","Cancel"))
if(input == "Cancel" || !input)
/*if(stat)
to_chat(src,"<span class='warning'>You must be awake and standing to perform this action!</span>")
return return
if(input == "Rebuild")
if(!isturf(loc)) var/obj/item/organ/internal/nano/refactory/refactory = nano_get_refactory()
to_chat(src,"<span class='warning'>You need more space to perform this action!</span>") if(refactory.get_stored_material(MAT_STEEL) >= 10000)
return to_chat(caller, "<span class='notify'>You begin to rebuild. You will need to remain still.</span>")
if(do_after(caller, 400))
var/obj/item/organ/internal/nano/refactory/refactory = nano_get_refactory() if(species?:OurRig) //Unsafe, but we should only ever be using this with a Protean
//Missing the organ that does this species?:OurRig?:make_alive(src,1) //Re-using this proc
if(!istype(refactory)) refactory.use_stored_material(MAT_STEEL,refactory.get_stored_material(MAT_STEEL)) //Use all of our steel
to_chat(src,"<span class='warning'>You don't have a working refactory module!</span>") else
return to_chat(caller, "<span class='usrdanger'>Somehow, you are missing your protean rig. You are unable to rebuild without one.</span>")
//Already regenerating
if(active_regen)
to_chat(src, "<span class='warning'>You are already refactoring!</span>")
return
var/swap_not_rebuild = tgui_alert(src,"Do you want to rebuild, or reshape?","Rebuild or Reshape",list("Reshape","Cancel","Rebuild"))
if(swap_not_rebuild == "Cancel")
return
if(swap_not_rebuild == "Reshape")
var/list/usable_manufacturers = list()
for(var/company in chargen_robolimbs)
var/datum/robolimb/M = chargen_robolimbs[company]
if(!(BP_TORSO in M.parts))
continue
if(impersonate_bodytype in M.species_cannot_use)
continue
if(M.whitelisted_to && !(ckey in M.whitelisted_to))
continue
usable_manufacturers[company] = M
if(!usable_manufacturers.len)
return
var/manu_choice = tgui_input_list(src, "Which manufacturer do you wish to mimic?", "Manufacturer", usable_manufacturers)
if(!manu_choice)
return //Changed mind
if(!organs_by_name[BP_TORSO])
return //Ain't got a torso!
var/obj/item/organ/external/torso = organs_by_name[BP_TORSO]
to_chat(src, "<span class='danger'>Remain still while the process takes place! It will take 5 seconds.</span>")
visible_message("<B>[src]</B>'s form collapses into an amorphous blob of black ichor...")
var/mob/living/simple_mob/protean_blob/blob = nano_intoblob()
active_regen = 1
if(do_after(blob,5 SECONDS))
synthetic = usable_manufacturers[manu_choice]
torso.robotize(manu_choice) //Will cascade to all other organs.
regenerate_icons()
visible_message("<B>[src]</B>'s form reshapes into a new one...")
active_regen = 0
nano_outofblob(blob)
return
//Not enough resources (AND spends the resources, should be the last check)
if(!refactory.use_stored_material(MAT_STEEL,refactory.max_storage))
to_chat(src, "<span class='warning'>You need to be maxed out on normal metal to do this!</span>")
return
var/delay_length = round(active_regen_delay * species.active_regen_mult)
to_chat(src, "<span class='danger'>Remain still while the process takes place! It will take [delay_length/10] seconds.</span>")
visible_message("<B>[src]</B>'s form begins to shift and ripple as if made of oil...")
active_regen = 1
var/mob/living/simple_mob/protean_blob/blob = nano_intoblob()
if(do_after(blob, delay_length, null, 0))
if(stat != DEAD && refactory)
var/list/holder = refactory.materials
species.create_organs(src)
var/obj/item/organ/external/torso = organs_by_name[BP_TORSO]
torso.robotize() //synthetic wasn't defined here.
LAZYCLEARLIST(blood_DNA)
LAZYCLEARLIST(feet_blood_DNA)
blood_color = null
feet_blood_color = null
regenerate_icons() //Probably worth it, yeah.
var/obj/item/organ/internal/nano/refactory/new_refactory = locate() in internal_organs
if(!new_refactory)
log_debug("[src] protean-regen'd but lacked a refactory when done.")
else
new_refactory.materials = holder
to_chat(src, "<span class='notice'>Your refactoring is complete.</span>") //Guarantees the message shows no matter how bad the timing.
to_chat(blob, "<span class='notice'>Your refactoring is complete!</span>")
else else
to_chat(src, "<span class='critical'>Your refactoring has failed.</span>") to_chat(caller, "<span class='warning'>You do not have enough steel stored for this operation.</span>")
to_chat(blob, "<span class='critical'>Your refactoring has failed!</span>")
else else
to_chat(src, "<span class='critical'>Your refactoring is interrupted.</span>") to_chat(caller, "<span class='notify'>You begin to reassemble. You will need to remain still.</span>")
to_chat(blob, "<span class='critical'>Your refactoring is interrupted!</span>") caller.visible_message("<span class='notify'>[caller] rapidly contorts and shifts!</span>", "<span class='danger'>You begin to reassemble.</span>")
active_regen = 0 if(do_after(caller, 40))
nano_outofblob(blob)*/ if(client.prefs) //Make sure we didn't d/c
var/obj/item/weapon/rig/protean/Rig = species?:OurRig
GetAppearanceFromPrefs()
species?:OurRig = Rig //Get a reference to our Rig and put it back after reassembling
caller.visible_message("<span class='notify'>[caller] adopts a new form!</span>", "<span class='danger'>You have reassembled.</span>")
//// ////
// Storing metal // Storing metal
@@ -511,8 +437,8 @@
to_call = /mob/living/carbon/human/proc/nano_partswap to_call = /mob/living/carbon/human/proc/nano_partswap
/obj/effect/protean_ability/reform_body /obj/effect/protean_ability/reform_body
ability_name = "Total Reassembly (wip)" ability_name = "Total Reassembly"
desc = "Completely reassemble yourself from whatever save slot you have loaded in preferences. Assuming you meet the requirements." desc = "Fully repair yourself or reload your appearance from whatever character slot you have loaded."
icon_state = "body" icon_state = "body"
to_call = /mob/living/carbon/human/proc/nano_regenerate to_call = /mob/living/carbon/human/proc/nano_regenerate

View File

@@ -362,7 +362,7 @@
if(PL.use(5)) if(PL.use(5))
to_chat(user, "<span class='notice'>You feed plasteel to the Protean, they will be able to reconstitute in ten minutes from now.</span>") to_chat(user, "<span class='notice'>You feed plasteel to the Protean, they will be able to reconstitute in ten minutes from now.</span>")
to_chat(myprotean, "<span class='notice'>You've been fed the necessary plasteel to reconstitute your form, you will be able to reconstitute in ten minutes.</span>") to_chat(myprotean, "<span class='notice'>You've been fed the necessary plasteel to reconstitute your form, you will be able to reconstitute in ten minutes.</span>")
addtimer(CALLBACK(src, .proc/make_alive, myprotean), 6000) addtimer(CALLBACK(src, .proc/make_alive, myprotean?:humanform), 6000)
return return
else else
to_chat(user, "<span class='notice'>This Protean is already reconstituting</span>") to_chat(user, "<span class='notice'>This Protean is already reconstituting</span>")
@@ -375,11 +375,8 @@
AssimilateBag(user,0,W) AssimilateBag(user,0,W)
..() ..()
/obj/item/weapon/rig/protean/proc/make_alive(var/mob/living/simple_mob/protean_blob/P) /obj/item/weapon/rig/protean/proc/make_alive(var/mob/living/carbon/human/H, var/partial)
var/mob/living/carbon/human/H if(H)
var/datum/species/protean/S
if(P.humanform)
H = P.humanform
H.setToxLoss(0) H.setToxLoss(0)
H.setOxyLoss(0) H.setOxyLoss(0)
H.setCloneLoss(0) H.setCloneLoss(0)
@@ -393,17 +390,30 @@
H.ear_deaf = 0 H.ear_deaf = 0
H.ear_damage = 0 H.ear_damage = 0
H.heal_overall_damage(H.getActualBruteLoss(), H.getActualFireLoss(), 1) H.heal_overall_damage(H.getActualBruteLoss(), H.getActualFireLoss(), 1)
dead_mob_list.Remove(H) for(var/I in H.organs_by_name)
living_mob_list += H if(!H.organs_by_name[I] || istype(H.organs_by_name[I], /obj/item/organ/external/stump))
H.tod = null if(H.organs_by_name[I])
H.timeofdeath = 0 var/obj/item/organ/external/oldlimb = H.organs_by_name[I]
H.set_stat(CONSCIOUS) oldlimb.removed()
if(istype(H.species, /datum/species/protean)) qdel(oldlimb)
S = H.species var/list/organ_data = H.species.has_limbs[I]
S.pseudodead = 0 var/limb_path = organ_data["path"]
dead = 0 var/obj/item/organ/external/new_eo = new limb_path(H)
reviving = 0 new_eo.robotize(H.synthetic ? H.synthetic.company : null)
to_chat(P, "<span class='notice'>You have finished reconstituting.</span>") new_eo.sync_colour_to_human(H)
if(!partial)
dead_mob_list.Remove(H)
living_mob_list += H
H.tod = null
H.timeofdeath = 0
H.set_stat(CONSCIOUS)
if(istype(H.species, /datum/species/protean))
var/datum/species/protean/S
S = H.species
S.pseudodead = 0
dead = 0
reviving = 0
to_chat(myprotean, "<span class='notice'>You have finished reconstituting.</span>")
/obj/item/weapon/rig/protean/take_hit(damage, source, is_emp=0) /obj/item/weapon/rig/protean/take_hit(damage, source, is_emp=0)
return //We don't do that here return //We don't do that here

View File

@@ -103,3 +103,48 @@
spawn(12) spawn(12)
struggle_anim_taur = FALSE struggle_anim_taur = FALSE
update_vore_tail_sprite() update_vore_tail_sprite()
/mob/living/carbon/human/proc/GetAppearanceFromPrefs()
/* Jank code that effectively creates the client's mob from save, then copies its appearance to our current mob.
Intended to be used with shapeshifter species so we don't reset their organs in doing so.*/
var/mob/living/carbon/human/dummy/mannequin/Dummy = new
if(client.prefs)
client.prefs.copy_to(Dummy)
//Important, since some sprites only work for specific species
if(Dummy.species.base_species == "Promethean")
impersonate_bodytype = "Human"
else
impersonate_bodytype = Dummy.species.base_species
custom_species = Dummy.custom_species
var/list/traits = dna.species_traits.Copy()
dna = Dummy.dna.Clone()
dna.species_traits.Cut()
dna.species_traits = traits.Copy()
UpdateAppearance()
icon = Dummy.icon
qdel(Dummy)
/* Alternative version of the above proc, incase it turns out cloning our dummy mob's DNA is an awful, terrible bad idea.
Would need to fix this proc up to work as smoothly as the above proc, though.
/mob/living/carbon/human/proc/GetAppearanceFromPrefs()
/* Jank code that effectively creates the client's mob from save, then copies its appearance to our current mob.
Intended to be used with shapeshifter species so we don't reset their organs in doing so.*/
var/mob/living/carbon/human/dummy/mannequin/Dummy = new
if(client.prefs)
client.prefs.copy_to(Dummy)
//Important, since some sprites only work for specific species
if(Dummy.species.base_species == "Promethean")
impersonate_bodytype = "Human"
else
impersonate_bodytype = Dummy.species.base_species
custom_species = Dummy.custom_species
for(var/tag in Dummy.dna.body_markings)
var/obj/item/organ/external/E = organs_by_name[tag]
if(E)
E.markings.Cut()
var/list/marklist = Dummy.dna.body_markings[tag]
E.markings = marklist.Copy()
UpdateAppearance(Dummy.dna.UI.Copy())
icon = Dummy.icon
qdel(Dummy)
*/