Files
SmArtKar 223badbebb Eye wounds, scars and a new ~Pirate~ RP quirk (#87209)
## About The Pull Request

Upon getting stabbed in your eyes or having a bullet fly through your
head there's a chance (minor for stabbing, extremely low for headshots)
you'll receive a new "Eye Puncture" wound which causes profuse bleeding
out of your now-empty eye hole. Once healed you'll have to deal with a
scar on your eye which cannot be cured and requires surgical
replacement. Eye scarring will reduce your eyes' max health by 15, give
you a minor screen tint and a fancy visual on your character sprite.
Getting scarring on both eyes will turn you completely blind.

![image](https://github.com/user-attachments/assets/c1ae4ff3-6844-405d-819b-9c390511e321)

This PR also introduces a new quirk which gives you eye scarring on the
eye of your choice and an eyepatch to go alongside it, just make sure
that it sits on the right eye.

Also added medical(white) subtype of eyepatches to loadout for those who
want that version instead. Credits to AnturK on discord for the idea.

## Why It's Good For The Game

Its a neat lil' feature that makes the game more immersive, and unlocks
more roleplay opportunities for players. New quirk gives access to this
feature for players who want to make it a part of their character's
backstory (or maybe as a part of permanent scar roleplaying).

## Changelog
🆑
add: Getting stabbed or shot in the eyes has a chance of giving you a
new wound and a semi-permanent scar, blinding you on one side
add: Added new "Scarred Eye" quirk which blinds you on one eye but gives
you a fancy eyepatch
add: Medical eyepatches have been added to loadout
/🆑

---------

Co-authored-by: Time-Green <7501474+Time-Green@users.noreply.github.com>
# Conflicts:
#	code/_globalvars/traits/_traits.dm
#	code/_globalvars/traits/admin_tooling.dm
#	code/modules/surgery/organs/internal/eyes/_eyes.dm
2024-12-01 22:09:44 -08:00

137 lines
4.8 KiB
Plaintext

/// What's the probability a clumsy person stabs themselves in the eyes?
#define CLUMSY_ATTACK_SELF_CHANCE 50
/// The damage threshold (of the victim's eyes) after which they start taking more serious effects
#define EYESTAB_BLEEDING_THRESHOLD 10
/// The damage threshold (of the victim's eyes) after which they can go blind
#define EYESTAB_BLINDING_THRESHOLD 30
/// How much blur we can apply
#define EYESTAB_MAX_BLUR (4 MINUTES)
/// An element that lets you stab people in the eyes when targeting them
/datum/element/eyestab
element_flags = ELEMENT_BESPOKE
argument_hash_start_idx = 2
/// The amount of damage to do per eyestab
var/damage = 7
/datum/element/eyestab/Attach(datum/target, damage)
. = ..()
if (!isitem(target))
return ELEMENT_INCOMPATIBLE
if (!isnull(damage))
src.damage = damage
RegisterSignal(target, COMSIG_ITEM_ATTACK, PROC_REF(on_item_attack))
/datum/element/eyestab/Detach(datum/source, ...)
. = ..()
UnregisterSignal(source, COMSIG_ITEM_ATTACK)
/datum/element/eyestab/proc/on_item_attack(datum/source, mob/living/target, mob/living/user)
SIGNAL_HANDLER
if (user.zone_selected != BODY_ZONE_PRECISE_EYES)
return
if (HAS_TRAIT(user, TRAIT_PACIFISM))
return
if (HAS_TRAIT(user, TRAIT_CLUMSY) && prob(CLUMSY_ATTACK_SELF_CHANCE))
target = user
if (target.is_eyes_covered() || isalien(target) || isbrain(target))
return
perform_eyestab(source, target, user)
return COMPONENT_SKIP_ATTACK
/datum/element/eyestab/proc/perform_eyestab(obj/item/item, mob/living/target, mob/living/user)
var/obj/item/bodypart/target_limb = target.get_bodypart(BODY_ZONE_HEAD)
if (ishuman(target) && isnull(target_limb))
return
item.add_fingerprint(user)
playsound(item, item.hitsound, 30, TRUE, -1)
user.do_attack_animation(target)
if (target == user)
user.visible_message(
span_danger("[user] stabs [user.p_them()]self in the eye with [item]!"),
span_userdanger("You stab yourself in the eye with [item]!"),
)
else
target.visible_message(
span_danger("[user] stabs [target] in the eye with [item]!"),
span_userdanger("[user] stabs you in the eye with [item]!"),
)
if (target_limb)
target.apply_damage(damage, BRUTE, target_limb, attacking_item = item)
else
target.take_bodypart_damage(damage)
target.add_mood_event("eye_stab", /datum/mood_event/eye_stab)
log_combat(user, target, "attacked", "[item.name]", "(Combat mode: [user.combat_mode ? "On" : "Off"])")
var/obj/item/organ/eyes/eyes = target.get_organ_slot(ORGAN_SLOT_EYES)
if (!eyes)
return
target.adjust_eye_blur_up_to(6 SECONDS, EYESTAB_MAX_BLUR)
var/started_bleeding = eyes.damage < EYESTAB_BLEEDING_THRESHOLD
eyes.apply_organ_damage(rand(2, 4))
if(eyes.damage < EYESTAB_BLEEDING_THRESHOLD)
return
// At over 10 damage we apply a lot of eye blur
target.adjust_eye_blur_up_to(30 SECONDS, EYESTAB_MAX_BLUR)
if (target.stat != DEAD && started_bleeding)
to_chat(target, span_danger("Your eyes start to bleed profusely!"))
// At over 10 damage, we cause at least enough eye damage to force nearsightedness
if (!target.is_nearsighted_from(EYE_DAMAGE) && eyes.damage <= eyes.low_threshold)
eyes.set_organ_damage(eyes.low_threshold)
// At over 10 damage, there is a 50% chance they drop all their items
if (prob(50) && target.stat != DEAD)
var/list/dropped = target.drop_all_held_items()
if(length(dropped))
to_chat(target, span_danger("You drop what you're holding and clutch at your eyes!"))
target.adjust_eye_blur_up_to(20 SECONDS, EYESTAB_MAX_BLUR)
target.Unconscious(2 SECONDS)
target.Paralyze(4 SECONDS)
// A solid chance of getting a permanent scar over one of your eyes, if you have at least one unscarred eyeball
if (prob(eyes.damage - EYESTAB_BLEEDING_THRESHOLD + 1))
var/valid_sides = list()
if (!(eyes.scarring & RIGHT_EYE_SCAR))
valid_sides += RIGHT_EYE_SCAR
if (!(eyes.scarring & LEFT_EYE_SCAR))
valid_sides += LEFT_EYE_SCAR
if (length(valid_sides))
var/picked_side = pick(valid_sides)
to_chat(target, span_userdanger("You feel searing pain shoot though your [picked_side == RIGHT_EYE_SCAR ? "right" : "left"] eye!"))
// oof ouch my eyes
var/datum/wound/pierce/bleed/severe/eye/eye_puncture = new
eye_puncture.apply_wound(eyes.bodypart_owner, wound_source = "eye stab", right_side = picked_side)
eyes.apply_scar(picked_side)
if (eyes.damage < EYESTAB_BLINDING_THRESHOLD)
return
// At over 30 damage, there is a chance (based on eye damage) of going blind
if (prob(eyes.damage - EYESTAB_BLINDING_THRESHOLD + 1))
if (!target.is_blind_from(EYE_DAMAGE))
eyes.set_organ_damage(eyes.maxHealth)
// Also cause some temp blindness, so that they're still blind even if they get healed
target.adjust_temp_blindness_up_to(20 SECONDS, 1 MINUTES)
#undef CLUMSY_ATTACK_SELF_CHANCE
#undef EYESTAB_BLEEDING_THRESHOLD
#undef EYESTAB_BLINDING_THRESHOLD
#undef EYESTAB_MAX_BLUR