From 2014d57332d7b222f008f9bc1ff0a7c4521a92c7 Mon Sep 17 00:00:00 2001 From: Coul Date: Tue, 3 Sep 2019 15:42:31 -0400 Subject: [PATCH] override apply_damage, revert set_species changes, allow admemes to convert living people --- code/modules/mob/living/carbon/human/human.dm | 7 +-- .../mob/living/carbon/human/human_damage.dm | 55 +------------------ .../living/carbon/human/species/_species.dm | 52 +++++++++++++++++- .../living/carbon/human/species/zombies.dm | 2 +- code/modules/zombie/organs.dm | 5 +- 5 files changed, 56 insertions(+), 65 deletions(-) diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index 69c486b6155..6481f6bc04a 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -1305,13 +1305,8 @@ oldspecies.handle_dna(src, TRUE) // Remove any genes that belong to the old species oldspecies.on_species_loss(src) - var/datum/species/new_race - if(ispath(new_species)) - new_race = new new_species - else if(istype(new_species)) - new_race = new_species - dna.species = new_race + dna.species = new new_species() tail = dna.species.tail diff --git a/code/modules/mob/living/carbon/human/human_damage.dm b/code/modules/mob/living/carbon/human/human_damage.dm index 80b376bf33b..d33682e3c73 100644 --- a/code/modules/mob/living/carbon/human/human_damage.dm +++ b/code/modules/mob/living/carbon/human/human_damage.dm @@ -335,57 +335,4 @@ This function restores all organs. //Handle BRUTE and BURN damage handle_suit_punctures(damagetype, damage) //Handle species apply_damage procs - dna.species.spec_apply_damage(damage, damagetype, def_zone, blocked, sharp, used_weapon) - - blocked = (100 - blocked) / 100 - if(blocked <= 0) - return 0 - - var/obj/item/organ/external/organ = null - if(isorgan(def_zone)) - organ = def_zone - else - if(!def_zone) - def_zone = ran_zone(def_zone) - organ = get_organ(check_zone(def_zone)) - if(!organ) - return 0 - - damage = damage * blocked - - switch(damagetype) - if(BRUTE) - damageoverlaytemp = 20 - if(dna.species) - damage = damage * dna.species.brute_mod - - if(organ.receive_damage(damage, 0, sharp, used_weapon)) - UpdateDamageIcon() - - if(LAssailant && ishuman(LAssailant)) //superheros still get the comical hit markers - var/mob/living/carbon/human/H = LAssailant - if(H.mind && H.mind in (SSticker.mode.superheroes || SSticker.mode.supervillains || SSticker.mode.greyshirts)) - var/list/attack_bubble_recipients = list() - var/mob/living/user - for(var/mob/O in viewers(user, src)) - if(O.client && O.has_vision(information_only=TRUE)) - attack_bubble_recipients.Add(O.client) - spawn(0) - var/image/dmgIcon = image('icons/effects/hit_blips.dmi', src, "dmg[rand(1,2)]",MOB_LAYER+1) - dmgIcon.pixel_x = (!lying) ? rand(-3,3) : rand(-11,12) - dmgIcon.pixel_y = (!lying) ? rand(-11,9) : rand(-10,1) - flick_overlay(dmgIcon, attack_bubble_recipients, 9) - - - if(BURN) - damageoverlaytemp = 20 - - if(dna.species) - damage = damage * dna.species.burn_mod - - if(organ.receive_damage(0, damage, sharp, used_weapon)) - UpdateDamageIcon() - - // Will set our damageoverlay icon to the next level, which will then be set back to the normal level the next mob.Life(). - updatehealth("apply damage") - return 1 + return dna.species.apply_damage(damage, damagetype, def_zone, blocked, src, sharp, used_weapon) diff --git a/code/modules/mob/living/carbon/human/species/_species.dm b/code/modules/mob/living/carbon/human/species/_species.dm index 7016e523cea..3f5d8ba3709 100644 --- a/code/modules/mob/living/carbon/human/species/_species.dm +++ b/code/modules/mob/living/carbon/human/species/_species.dm @@ -311,8 +311,56 @@ /datum/species/proc/spec_death(gibbed, mob/living/carbon/human/C) return -/datum/species/proc/spec_apply_damage(damage = 0, damagetype = BRUTE, def_zone = null, blocked = 0, sharp = 0, obj/used_weapon = null) - return +/datum/species/proc/apply_damage(damage = 0, damagetype = BRUTE, def_zone = null, blocked = 0, mob/living/carbon/human/H, sharp = 0, obj/used_weapon = null) + blocked = (100 - blocked) / 100 + if(blocked <= 0) + return 0 + + var/obj/item/organ/external/organ = null + if(isorgan(def_zone)) + organ = def_zone + else + if(!def_zone) + def_zone = ran_zone(def_zone) + organ = H.get_organ(check_zone(def_zone)) + if(!organ) + return 0 + + damage = damage * blocked + + switch(damagetype) + if(BRUTE) + H.damageoverlaytemp = 20 + damage = damage * brute_mod + + if(organ.receive_damage(damage, 0, sharp, used_weapon)) + H.UpdateDamageIcon() + + if(H.LAssailant && ishuman(H.LAssailant)) //superheros still get the comical hit markers + var/mob/living/carbon/human/A = H.LAssailant + if(A.mind && A.mind in (SSticker.mode.superheroes || SSticker.mode.supervillains || SSticker.mode.greyshirts)) + var/list/attack_bubble_recipients = list() + var/mob/living/user + for(var/mob/O in viewers(user, src)) + if(O.client && O.has_vision(information_only=TRUE)) + attack_bubble_recipients.Add(O.client) + spawn(0) + var/image/dmgIcon = image('icons/effects/hit_blips.dmi', src, "dmg[rand(1,2)]",MOB_LAYER+1) + dmgIcon.pixel_x = (!H.lying) ? rand(-3,3) : rand(-11,12) + dmgIcon.pixel_y = (!H.lying) ? rand(-11,9) : rand(-10,1) + flick_overlay(dmgIcon, attack_bubble_recipients, 9) + + + if(BURN) + H.damageoverlaytemp = 20 + damage = damage * burn_mod + + if(organ.receive_damage(0, damage, sharp, used_weapon)) + H.UpdateDamageIcon() + + // Will set our damageoverlay icon to the next level, which will then be set back to the normal level the next mob.Life(). + H.updatehealth("apply damage") + return 1 /datum/species/proc/spec_stun(mob/living/carbon/human/H,amount) return diff --git a/code/modules/mob/living/carbon/human/species/zombies.dm b/code/modules/mob/living/carbon/human/species/zombies.dm index 5b019ead911..c03f92af40d 100644 --- a/code/modules/mob/living/carbon/human/species/zombies.dm +++ b/code/modules/mob/living/carbon/human/species/zombies.dm @@ -41,7 +41,7 @@ /datum/species/zombie/infectious/spec_stun(mob/living/carbon/human/H, amount) . = min(20, amount) -/datum/species/zombie/infectious/spec_apply_damage(damage = 0, damagetype = BRUTE, def_zone = null, blocked = 0, sharp = 0, obj/used_weapon = null) +/datum/species/zombie/infectious/apply_damage(damage = 0, damagetype = BRUTE, def_zone = null, blocked = 0, sharp = 0, obj/used_weapon = null) . = ..() if(damage) regen_cooldown = world.time + REGENERATION_DELAY diff --git a/code/modules/zombie/organs.dm b/code/modules/zombie/organs.dm index 220c6c985da..76bce6ead3d 100644 --- a/code/modules/zombie/organs.dm +++ b/code/modules/zombie/organs.dm @@ -4,6 +4,7 @@ parent_organ = "head" slot = "zombie_infection" icon_state = "blacktumor" + var/converts_living = FALSE var/causes_damage = TRUE var/datum/species/old_species = /datum/species/human var/living_transformation_time = 3 @@ -45,7 +46,7 @@ return if(owner.suiciding) return - if(owner.stat != DEAD) + if(owner.stat != DEAD && !converts_living) return if(causes_damage && !iszombie(owner) && owner.stat != DEAD) owner.adjustToxLoss(1) @@ -63,7 +64,7 @@ /obj/item/organ/internal/zombie_infection/proc/zombify() timer_id = null - if(owner.stat != DEAD) + if(owner.stat != DEAD && !converts_living) return if(!iszombie(owner))