Files
Bubberstation/code/modules/zombie/items.dm
carlarctg 047f7aa316 Fixed headless zambos and the oversight of no bio armor resistance (#78589)
## About The Pull Request

Fixed zombies being able to infect headless corpses (Including former
zombies)

Fixed bio armor being totally useless against zombies. Now it checks how
hurt your limb is: If it's more than the bio armor value, you get
infected. THICKMATERIAL clothing guarantees at least 25 damage required
to infect you, non-thick clothing reduces effective defence by 25. In
practice this means people with MODsuits, biosuits will resist infection
unless they're pummeled into crit, and wearing a firesuit will save you
from the first few slashes.

Fixed the bomb hood armor not having the same bio armor value as bomb
armor.

Added a message to the zed when they succesfully infect someone.

Turned some proc names into snake_case rather than, uh, nospacecase.

## Why It's Good For The Game

> Fixed zombies being able to infect headless corpses (Including former
zombies)

This is pretty cool but it also means you can't actually permanently
kill a zombie if they just get slashed again by another zombie.

> Fixed bio armor being totally useless against zombies. Now it checks
how hurt your limb is: If it's more than the bio armor value, you get
infected. THICKMATERIAL clothing guarantees at least 25 damage required
to infect you, non-thick clothing reduces effective defence by 25. In
practice this means people with MODsuits, biosuits will resist infection
unless they're pummeled into crit, and wearing a firesuit will save you
from the first few slashes.

Melbert told me this is an oversight, so I, uh, 'fixed' it? This also
lets people have some true actual defence against zombie infections,
without making them immune to it.

> Fixed the bomb hood armor not having the same bio armor value as bomb
armor.

Bug I noticed while going over bio armors. 

> Added a message to the zed when they succesfully infect someone.

QoL and good feedback

> Turned some proc names into snake_case rather than, uh, nospacecase.

what the hell do you call isuckatnamignprocs(). what case is that.
cougarcase?

## Changelog

🆑
fix: Fixed zombies being able to infect headless corpses (Including
former zombies)
fix: Fixed bio armor being totally useless against zombies. Now it
checks how hurt your limb is: If it's more than the bio armor value, you
get infected. THICKMATERIAL clothing guarantees at least 25 damage
required to infect you, non-thick clothing reduces effective defence by
25. In practice this means people with MODsuits, biosuits will resist
infection unless they're pummeled into crit, and wearing a firesuit will
save you from the first few slashes.
fix: Fixed the bomb hood armor not having the same bio armor value as
bomb armor.
qol: Added a message to the zed when they succesfully infect someone.
code: Turned some proc names into snake_case rather than, uh,
nospacecase.
/🆑

---------

Co-authored-by: MrMelbert <51863163+MrMelbert@users.noreply.github.com>
2023-09-27 06:56:41 +02:00

86 lines
3.1 KiB
Plaintext

/obj/item/mutant_hand/zombie
name = "zombie claw"
desc = "A zombie's claw is its primary tool, capable of infecting \
humans, butchering all other living things to \
sustain the zombie, smashing open airlock doors and opening \
child-safe caps on bottles."
hitsound = 'sound/hallucinations/growl1.ogg'
force = 21 // Just enough to break airlocks with melee attacks
wound_bonus = -30
bare_wound_bonus = 15
sharpness = SHARP_EDGED
/obj/item/mutant_hand/zombie/afterattack(atom/target, mob/living/user, proximity_flag)
. = ..()
if(!proximity_flag)
return
else if(isliving(target))
if(ishuman(target))
try_to_zombie_infect(target, user, user.zone_selected)
else
. |= AFTERATTACK_PROCESSED_ITEM
check_feast(target, user)
/proc/try_to_zombie_infect(mob/living/carbon/human/target, mob/living/user, def_zone = BODY_ZONE_CHEST)
CHECK_DNA_AND_SPECIES(target)
// Can't zombify with no head
if(!target.get_bodypart(BODY_ZONE_HEAD))
return
if(HAS_TRAIT(target, TRAIT_NO_ZOMBIFY))
// cannot infect any TRAIT_NO_ZOMBIFY human
return
// spaceacillin has a 75% chance to block infection
if(HAS_TRAIT(target, TRAIT_VIRUS_RESISTANCE) && prob(75))
return
var/obj/item/bodypart/actual_limb = target.get_bodypart(def_zone)
// What you hitting bro?
if(!actual_limb)
return
var/limb_damage = actual_limb.get_damage()
var/limb_armor = max(0, target.getarmor(actual_limb, BIO) - 25)
// This is a pretty jank way to do this, but in short:
// if they have thick material on that bodypart it will always need at least 25 previous limb damage to trigger an infection.
// and if their bio armor isn't thick it's a bit weaker.
for(var/obj/item/clothing/iter_clothing in target.get_clothing_on_part(actual_limb))
if(iter_clothing.clothing_flags & THICKMATERIAL)
limb_armor += 25
if(limb_armor > limb_damage)
return
var/obj/item/organ/internal/zombie_infection/infection
infection = target.get_organ_slot(ORGAN_SLOT_ZOMBIE)
if(!infection)
infection = new()
infection.Insert(target)
to_chat(user, span_alien("You see [target] twitch for a moment as [target.p_their()] head is covered in \a [infection] - [target.p_Theyve()] been infected."))
/obj/item/mutant_hand/zombie/suicide_act(mob/living/user)
user.visible_message(span_suicide("[user] is ripping [user.p_their()] brains out! It looks like [user.p_theyre()] trying to commit suicide!"))
var/obj/item/bodypart/head = user.get_bodypart(BODY_ZONE_HEAD)
if(head)
head.dismember()
return BRUTELOSS
/obj/item/mutant_hand/zombie/proc/check_feast(mob/living/target, mob/living/user)
if(target.stat == DEAD)
var/hp_gained = target.maxHealth
target.investigate_log("has been devoured by a zombie.", INVESTIGATE_DEATHS)
target.gib()
// zero as argument for no instant health update
user.adjustBruteLoss(-hp_gained, 0)
user.adjustToxLoss(-hp_gained, 0)
user.adjustFireLoss(-hp_gained, 0)
user.adjustCloneLoss(-hp_gained, 0)
user.updatehealth()
user.adjustOrganLoss(ORGAN_SLOT_BRAIN, -hp_gained) // Zom Bee gibbers "BRAAAAISNSs!1!"
user.set_nutrition(min(user.nutrition + hp_gained, NUTRITION_LEVEL_FULL))