Merge pull request #7988 from VOREStation/Arokha/protfixes

Make protean deaths a bit more robust
This commit is contained in:
Aronai Sieyes
2020-05-20 16:09:29 -04:00
committed by GitHub
6 changed files with 120 additions and 64 deletions

View File

@@ -42,6 +42,7 @@ SUBSYSTEM_DEF(mobs)
if(!M || QDELETED(M))
mob_list -= M
continue
else if(M.low_priority && !(process_z[get_z(M)]))
slept_mobs++
continue

View File

@@ -12,7 +12,7 @@
for(var/obj/item/organ/I in internal_organs)
I.removed()
if(istype(loc,/turf))
if(isturf(I?.loc)) // Some organs qdel themselves or other things when removed
I.throw_at(get_edge_target_turf(src,pick(alldirs)),rand(1,3),30)
for(var/obj/item/organ/external/E in src.organs)

View File

@@ -107,75 +107,113 @@
..()
/mob/living/simple_mob/protean_blob/updatehealth()
if(humanform)
//Set the max
maxHealth = humanform.getMaxHealth()*2 //HUMANS, and their 'double health', bleh.
//Set us to their health, but, human health ignores robolimbs so we do it 'the hard way'
health = maxHealth - humanform.getOxyLoss() - humanform.getToxLoss() - humanform.getCloneLoss() - humanform.getActualFireLoss() - humanform.getActualBruteLoss()
if(!humanform)
return ..()
//Alive, becoming dead
if((stat < DEAD) && (health <= 0))
death()
//Set the max
maxHealth = humanform.getMaxHealth()*2 //HUMANS, and their 'double health', bleh.
//Set us to their health, but, human health ignores robolimbs so we do it 'the hard way'
health = maxHealth - humanform.getOxyLoss() - humanform.getToxLoss() - humanform.getCloneLoss() - humanform.getActualFireLoss() - humanform.getActualBruteLoss()
//Overhealth
if(health > getMaxHealth())
health = getMaxHealth()
//Alive, becoming dead
if((stat < DEAD) && (health <= 0))
death()
//Update our hud if we have one
if(healths)
if(stat != DEAD)
var/heal_per = (health / getMaxHealth()) * 100
switch(heal_per)
if(100 to INFINITY)
healths.icon_state = "health0"
if(80 to 100)
healths.icon_state = "health1"
if(60 to 80)
healths.icon_state = "health2"
if(40 to 60)
healths.icon_state = "health3"
if(20 to 40)
healths.icon_state = "health4"
if(0 to 20)
healths.icon_state = "health5"
else
healths.icon_state = "health6"
else
healths.icon_state = "health7"
else
..()
//Overhealth
if(health > getMaxHealth())
health = getMaxHealth()
//Grab any other interesting values
confused = humanform.confused
radiation = humanform.radiation
paralysis = humanform.paralysis
//Update our hud if we have one
if(healths)
if(stat != DEAD)
var/heal_per = (health / getMaxHealth()) * 100
switch(heal_per)
if(100 to INFINITY)
healths.icon_state = "health0"
if(80 to 100)
healths.icon_state = "health1"
if(60 to 80)
healths.icon_state = "health2"
if(40 to 60)
healths.icon_state = "health3"
if(20 to 40)
healths.icon_state = "health4"
if(0 to 20)
healths.icon_state = "health5"
else
healths.icon_state = "health6"
else
healths.icon_state = "health7"
// All the damage and such to the blob translates to the human
/mob/living/simple_mob/protean_blob/adjustBruteLoss(var/amount)
if(humanform)
humanform.adjustBruteLoss(amount)
return humanform.adjustBruteLoss(amount)
else
..()
return ..()
/mob/living/simple_mob/protean_blob/adjustFireLoss(var/amount)
if(humanform)
humanform.adjustFireLoss(amount)
return humanform.adjustFireLoss(amount)
else
..()
return ..()
/mob/living/simple_mob/protean_blob/adjustToxLoss(amount)
if(humanform)
return humanform.adjustToxLoss(amount)
else
return ..()
/mob/living/simple_mob/protean_blob/adjustOxyLoss(amount)
if(humanform)
return humanform.adjustOxyLoss(amount)
else
return ..()
/mob/living/simple_mob/protean_blob/adjustHalLoss(amount)
if(humanform)
return humanform.adjustHalLoss(amount)
else
return ..()
/mob/living/simple_mob/protean_blob/emp_act(severity)
if(humanform)
return humanform.emp_act(severity)
else
return ..()
/mob/living/simple_mob/protean_blob/ex_act(severity)
if(humanform)
return humanform.ex_act(severity)
else
return ..()
/mob/living/simple_mob/protean_blob/rad_act(severity)
if(humanform)
return humanform.ex_act(severity)
else
return ..()
/mob/living/simple_mob/protean_blob/bullet_act(obj/item/projectile/P)
if(humanform)
return humanform.bullet_act(P)
else
return ..()
/mob/living/simple_mob/protean_blob/death(gibbed, deathmessage = "dissolves away, leaving only a few spare parts!")
if(humanform)
humanform.death(gibbed = gibbed)
for(var/organ in humanform.internal_organs)
var/obj/item/organ/internal/O = organ
O.removed()
O.forceMove(drop_location())
var/list/items = humanform.get_equipped_items()
if(prev_left_hand) items += prev_left_hand
if(prev_right_hand) items += prev_right_hand
for(var/obj/object in items)
object.forceMove(drop_location())
QDEL_NULL(humanform) //Don't leave it just sitting in nullspace
animate(src,alpha = 0,time = 2 SECONDS)
sleep(2 SECONDS)
qdel(src)
..()
humanform.death(gibbed, deathmessage)
else
animate(src, alpha = 0, time = 2 SECONDS)
sleep(2 SECONDS)
if(!QDELETED(src)) // Human's handle death should have taken us, but maybe we were adminspawned or something without a human counterpart
qdel(src)
/mob/living/simple_mob/protean_blob/Life()
. = ..()

View File

@@ -162,10 +162,23 @@
return rgb(80,80,80,230)
/datum/species/protean/handle_death(var/mob/living/carbon/human/H)
to_chat(H,"<span class='warning'>You died as a Protean. Please sit out of the round for at least 60 minutes before respawning, to represent the time it would take to ship a new-you to the station.</span>")
spawn(1) //This spawn is here so that if the protean_blob calls qdel, it doesn't try to gib the humanform.
if(H)
H.gib()
if(!H)
return // Iono!
if(H.temporary_form)
H.forceMove(H.temporary_form.drop_location())
H.ckey = H.temporary_form.ckey
QDEL_NULL(H.temporary_form)
to_chat(H, "<span class='warning'>You died as a Protean. Please sit out of the round for at least 60 minutes before respawning, to represent the time it would take to ship a new-you to the station.</span>")
for(var/obj/item/organ/I in H.internal_organs)
I.removed()
for(var/obj/item/I in src)
H.drop_from_inventory(I)
qdel(H)
/datum/species/protean/handle_environment_special(var/mob/living/carbon/human/H)
if((H.getActualBruteLoss() + H.getActualFireLoss()) > H.maxHealth*0.5 && isturf(H.loc)) //So, only if we're not a blob (we're in nullspace) or in someone (or a locker, really, but whatever)

View File

@@ -7,4 +7,9 @@
var/obj/screen/shadekin/darkness/shadekin_dark_display = null
var/obj/screen/shadekin/energy/shadekin_energy_display = null
var/obj/screen/xenochimera/danger_level/xenochimera_danger_display = null
var/obj/screen/xenochimera/danger_level/xenochimera_danger_display = null
/mob/drop_location()
if(temporary_form)
return temporary_form.drop_location()
return ..()

View File

@@ -168,9 +168,8 @@
/obj/belly/Destroy()
STOP_PROCESSING(SSbellies, src)
if(owner)
owner.vore_organs -= src
owner = null
owner?.vore_organs?.Remove(src)
owner = null
return ..()
// Called whenever an atom enters this belly