Files
Bubberstation/code/modules/zombie/items.dm
coiax 881e8c1ab9 Refactors NODROP flag into TRAIT_NODROP (#42109)
* Refactors NODROP flag into TRAIT_NODROP

🆑 coiax
fix: Anti-drop implants can no longer be used to drop objects that they
were not responsible for sticking to a person's hand.
fix: Backfiring with a Barnyard spellbook will now play a spooky horse sound.
refactor: Refactors the way that "NODROP" items work to a new system,
there should be no change in functionality.
/🆑

Various items in the codebase were doing weird hoop jumps in order to
preserve the nodrop flag's state when it also wanted to change it, so I
moved it to a trait system.

I may have gone overboard with the type of unique trait sources, but
those can be changed later. My long term plan is make a general "CURSED"
nodrop origin, which means you can unlock cursed items by being hit with
a bolt of door opening or something. But that's for another PR, this has
no functionality changes, apart from some slightly modified descriptions
on cursed masks.

- Removed a bunch of redundant voice changing code for all the voice
changing animal masks, used two new clothing flags for this purpose.
- Also refactored a bit the animal masks, making new cursed subtypes that play
the sound when created.

* Drop location
2019-01-17 15:24:30 -05:00

77 lines
2.4 KiB
Plaintext

/obj/item/zombie_hand
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."
item_flags = ABSTRACT | DROPDEL
resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | UNACIDABLE | ACID_PROOF
icon = 'icons/effects/blood.dmi'
icon_state = "bloodhand_left"
var/icon_left = "bloodhand_left"
var/icon_right = "bloodhand_right"
hitsound = 'sound/hallucinations/growl1.ogg'
force = 21 // Just enough to break airlocks with melee attacks
damtype = "brute"
/obj/item/zombie_hand/Initialize()
. = ..()
add_trait(TRAIT_NODROP, HAND_REPLACEMENT_TRAIT)
/obj/item/zombie_hand/equipped(mob/user, slot)
. = ..()
//these are intentionally inverted
var/i = user.get_held_index_of_item(src)
if(!(i % 2))
icon_state = icon_left
else
icon_state = icon_right
/obj/item/zombie_hand/afterattack(atom/target, mob/user, proximity_flag)
. = ..()
if(!proximity_flag)
return
else if(isliving(target))
if(ishuman(target))
try_to_zombie_infect(target)
else
check_feast(target, user)
/proc/try_to_zombie_infect(mob/living/carbon/human/target)
CHECK_DNA_AND_SPECIES(target)
if(NOZOMBIE in target.dna.species.species_traits)
// cannot infect any NOZOMBIE subspecies (such as high functioning
// zombies)
return
var/obj/item/organ/zombie_infection/infection
infection = target.getorganslot(ORGAN_SLOT_ZOMBIE)
if(!infection)
infection = new()
infection.Insert(target)
/obj/item/zombie_hand/suicide_act(mob/user)
user.visible_message("<span class='suicide'>[user] is ripping [user.p_their()] brains out! It looks like [user.p_theyre()] trying to commit suicide!</span>")
if(isliving(user))
var/mob/living/L = user
var/obj/item/bodypart/O = L.get_bodypart(BODY_ZONE_HEAD)
if(O)
O.dismember()
return (BRUTELOSS)
/obj/item/zombie_hand/proc/check_feast(mob/living/target, mob/living/user)
if(target.stat == DEAD)
var/hp_gained = target.maxHealth
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.adjustBrainLoss(-hp_gained) // Zom Bee gibbers "BRAAAAISNSs!1!"
user.set_nutrition(min(user.nutrition + hp_gained, NUTRITION_LEVEL_FULL))