Files
S.P.L.U.R.T-Station-13/code/modules/surgery/organs/stomach.dm
DeltaFire 0faac6dce6 hoo boy
2021-12-14 23:06:42 +01:00

177 lines
7.0 KiB
Plaintext

/obj/item/organ/stomach
name = "stomach"
icon_state = "stomach"
w_class = WEIGHT_CLASS_NORMAL
zone = BODY_ZONE_CHEST
slot = ORGAN_SLOT_STOMACH
attack_verb = list("gored", "squished", "slapped", "digested")
desc = "Onaka ga suite imasu."
var/disgust_metabolism = 1
healing_factor = STANDARD_ORGAN_HEALING
decay_factor = STANDARD_ORGAN_DECAY
low_threshold_passed = "<span class='info'>Your stomach flashes with pain before subsiding. Food doesn't seem like a good idea right now.</span>"
high_threshold_passed = "<span class='warning'>Your stomach flares up with constant pain- you can hardly stomach the idea of food right now!</span>"
high_threshold_cleared = "<span class='info'>The pain in your stomach dies down for now, but food still seems unappealing.</span>"
low_threshold_cleared = "<span class='info'>The last bouts of pain in your stomach have died out.</span>"
/obj/item/organ/stomach/on_life()
. = ..()
if(!owner)
return
if(ishuman(owner))
var/mob/living/carbon/human/H = owner
if(.)
H.dna.species.handle_digestion(H)
handle_disgust(H)
if(!damage)
return
var/datum/reagent/consumable/nutriment/Nutri = locate(/datum/reagent/consumable/nutriment) in owner.reagents.reagent_list
if(!Nutri)
return
var/prob_divisor = damage > high_threshold ? 10 : 40
if(prob((damage/prob_divisor) * (Nutri.volume**2)))
owner.vomit(damage)
to_chat(owner, "<span class='warning'>Your stomach reels in pain as you're incapable of holding down all that food!</span>")
/obj/item/organ/stomach/proc/handle_disgust(mob/living/carbon/human/H)
if(H.disgust)
var/pukeprob = 5 + 0.05 * H.disgust
if(H.disgust >= DISGUST_LEVEL_GROSS)
if(prob(10))
H.stuttering += 1
H.confused += 2
if(prob(10) && !H.stat)
to_chat(H, "<span class='warning'>You feel kind of iffy...</span>")
H.jitteriness = max(H.jitteriness - 3, 0)
if(H.disgust >= DISGUST_LEVEL_VERYGROSS)
if(prob(pukeprob)) //iT hAndLeS mOrE ThaN PukInG
H.confused += 2.5
H.stuttering += 1
H.vomit(10, 0, 1, 0, 1, 0)
H.Dizzy(5)
if(H.disgust >= DISGUST_LEVEL_DISGUSTED)
if(prob(25))
H.blur_eyes(3) //We need to add more shit down here
H.adjust_disgust(-0.5 * disgust_metabolism)
switch(H.disgust)
if(0 to DISGUST_LEVEL_GROSS)
H.clear_alert("disgust")
SEND_SIGNAL(H, COMSIG_CLEAR_MOOD_EVENT, "disgust")
if(DISGUST_LEVEL_GROSS to DISGUST_LEVEL_VERYGROSS)
H.throw_alert("disgust", /atom/movable/screen/alert/gross)
SEND_SIGNAL(H, COMSIG_ADD_MOOD_EVENT, "disgust", /datum/mood_event/gross)
if(DISGUST_LEVEL_VERYGROSS to DISGUST_LEVEL_DISGUSTED)
H.throw_alert("disgust", /atom/movable/screen/alert/verygross)
SEND_SIGNAL(H, COMSIG_ADD_MOOD_EVENT, "disgust", /datum/mood_event/verygross)
if(DISGUST_LEVEL_DISGUSTED to INFINITY)
H.throw_alert("disgust", /atom/movable/screen/alert/disgusted)
SEND_SIGNAL(H, COMSIG_ADD_MOOD_EVENT, "disgust", /datum/mood_event/disgusted)
/obj/item/organ/stomach/Remove(special = FALSE)
var/mob/living/carbon/human/H = owner
if(H && istype(H))
H.clear_alert("disgust")
SEND_SIGNAL(H, COMSIG_CLEAR_MOOD_EVENT, "disgust")
..()
/obj/item/organ/stomach/slime
name = "macrolysosome" //an original cell has multiple lysosomes, but in this case a slimeperson only really has one... a big one? probably give it "macro" in the name.
icon_state = "stomach-s"
desc = "A slimeperson organelle resembling a stomach. It breaks down, or digests macromolecules. Or food and drinks."
/obj/item/organ/stomach/fly
name = "insectoid stomach"
icon_state = "stomach-x" //xenomorph liver? It's just a black liver so it fits.
desc = "A mutant stomach designed to handle the unique diet of a flyperson."
/obj/item/organ/stomach/plasmaman
name = "digestive crystal"
icon_state = "stomach-p"
desc = "A strange crystal that is responsible for metabolizing the unseen energy force that feeds plasmamen."
/obj/item/organ/stomach/cybernetic
name = "basic cybernetic stomach"
icon_state = "stomach-c"
desc = "A basic device designed to mimic the functions of a human stomach"
organ_flags = ORGAN_SYNTHETIC
maxHealth = STANDARD_ORGAN_THRESHOLD * 0.5
var/emp_vulnerability = 1 //The value the severity of emps are divided by to determine the likelihood of permanent damage.
/obj/item/organ/stomach/cybernetic/tier2
name = "cybernetic stomach"
icon_state = "stomach-c-u"
desc = "An electronic device designed to mimic the functions of a human stomach. Handles disgusting food a bit better."
maxHealth = 1.5 * STANDARD_ORGAN_THRESHOLD
disgust_metabolism = 2
emp_vulnerability = 2
/obj/item/organ/stomach/cybernetic/tier3
name = "upgraded cybernetic stomach"
icon_state = "stomach-c-u2"
desc = "An upgraded version of the cybernetic stomach, designed to improve further upon organic stomachs. Handles disgusting food very well."
maxHealth = 2 * STANDARD_ORGAN_THRESHOLD
disgust_metabolism = 3
emp_vulnerability = 3
/obj/item/organ/stomach/cybernetic/emp_act(severity)
. = ..()
if(. & EMP_PROTECT_SELF)
return
if(!COOLDOWN_FINISHED(src, severe_cooldown)) //So we cant just spam emp to kill people.
owner.vomit(stun = FALSE)
COOLDOWN_START(src, severe_cooldown, 10 SECONDS)
if(prob(severity/emp_vulnerability)) //Chance of permanent effects
organ_flags |= ORGAN_SYNTHETIC_EMP //Starts organ faliure - gonna need replacing soon.
/obj/item/organ/stomach/ipc
name = "ipc cell"
icon_state = "stomach-ipc"
/obj/item/organ/stomach/ipc/emp_act(severity)
. = ..()
if(!owner || . & EMP_PROTECT_SELF)
return
switch(severity)
if(1 to 50)
owner.nutrition = max(owner.nutrition - 50, 0)
to_chat(owner, "<span class='warning'>Alert: Detected severe battery discharge!</span>")
if(50 to INFINITY)
owner.nutrition = max(owner.nutrition - 100, 0)
to_chat(owner, "<span class='warning'>Alert: Minor battery discharge!</span>")
/obj/item/organ/stomach/ethereal
name = "biological battery"
icon_state = "stomach-p" //Welp. At least it's more unique in functionaliy.
desc = "A crystal-like organ that stores the electric charge of ethereals."
var/crystal_charge = ETHEREAL_CHARGE_FULL
/obj/item/organ/stomach/ethereal/on_life()
..()
adjust_charge(-ETHEREAL_CHARGE_FACTOR)
/obj/item/organ/stomach/ethereal/Insert(mob/living/carbon/M, special = 0, drop_if_replaced = TRUE)
..()
RegisterSignal(owner, COMSIG_PROCESS_BORGCHARGER_OCCUPANT, .proc/charge)
RegisterSignal(owner, COMSIG_LIVING_ELECTROCUTE_ACT, .proc/on_electrocute)
/obj/item/organ/stomach/ethereal/Remove(mob/living/carbon/M, special = 0)
UnregisterSignal(owner, COMSIG_PROCESS_BORGCHARGER_OCCUPANT)
UnregisterSignal(owner, COMSIG_LIVING_ELECTROCUTE_ACT)
..()
/obj/item/organ/stomach/ethereal/proc/charge(datum/source, amount, repairs)
adjust_charge(amount / 70)
/obj/item/organ/stomach/ethereal/proc/on_electrocute(datum/source, shock_damage, siemens_coeff = 1, flags = NONE)
if(flags & SHOCK_ILLUSION)
return
adjust_charge(shock_damage * siemens_coeff * 2)
to_chat(owner, "<span class='notice'>You absorb some of the shock into your body!</span>")
/obj/item/organ/stomach/ethereal/proc/adjust_charge(amount)
crystal_charge = clamp(crystal_charge + amount, ETHEREAL_CHARGE_NONE, ETHEREAL_CHARGE_DANGEROUS)