Vomiting Overhaul (#365)

Centralises vomiting code to remove duplication and standardise effects.
Makes vomiting empty your stomach a bit (30u, the capacity of a drink
glass)
Adds Ipecac, an emetic to cause vomiting
This commit is contained in:
NanakoAC
2016-06-20 15:49:44 +03:00
committed by skull132
parent 2179fd46ba
commit 4e61099040
9 changed files with 104 additions and 33 deletions
+3 -11
View File
@@ -31,7 +31,7 @@ Bonus
/datum/symptom/vomit/Activate(var/datum/disease/advance/A)
..()
if(prob(SYMPTOM_ACTIVATION_PROB / 2))
var/mob/living/M = A.affected_mob
var/mob/living/carbon/M = A.affected_mob
switch(A.stage)
if(1, 2, 3, 4)
M << "<span class='notice'>[pick("You feel nauseous.", "You feel like you're going to throw up!")]</span>"
@@ -40,16 +40,8 @@ Bonus
return
/datum/symptom/vomit/proc/Vomit(var/mob/living/M)
M.visible_message("<B>[M]</B> vomits on the floor!")
M.nutrition -= 20
M.adjustToxLoss(-3)
var/turf/pos = get_turf(M)
pos.add_vomit_floor(M)
playsound(pos, 'sound/effects/splat.ogg', 50, 1)
/datum/symptom/vomit/proc/Vomit(var/mob/living/carbon/M)
M.vomit()//This function is in mob_helpers
/*
//////////////////////////////////////
+2 -7
View File
@@ -33,13 +33,8 @@
affected_mob.adjustToxLoss(1)
if(stage > 2)
if(prob(1))
if (affected_mob.nutrition > 100)
var/mob/living/carbon/human/H = affected_mob
H.vomit()
else
affected_mob << "\red You gag as you want to throw up, but there's nothing in your stomach!"
affected_mob.Weaken(10)
affected_mob.adjustToxLoss(3)
var/mob/living/carbon/human/H = affected_mob
H.delayed_vomit()
if(stage > 3)
if(prob(1) && ishuman(affected_mob))
var/mob/living/carbon/human/H = affected_mob
+2 -12
View File
@@ -751,7 +751,7 @@
xylophone=0
return
/mob/living/carbon/human/proc/vomit()
/mob/living/carbon/human/proc/delayed_vomit()
if(species.flags & IS_SYNTHETIC)
return //Machines don't throw up.
@@ -762,17 +762,7 @@
spawn(150) //15 seconds until second warning
src << "<span class='warning'>You feel like you are about to throw up!</span>"
spawn(100) //and you have 10 more for mad dash to the bucket
Stun(5)
src.visible_message("<span class='warning'>[src] throws up!</span>","<span class='warning'>You throw up!</span>")
playsound(loc, 'sound/effects/splat.ogg', 50, 1)
var/turf/location = loc
if (istype(location, /turf/simulated))
location.add_vomit_floor(src, 1)
nutrition -= 40
adjustToxLoss(-3)
vomit()//Vomit function is in mob helpers
spawn(350) //wait 35 seconds before next volley
lastpuke = 0
+2 -2
View File
@@ -1459,8 +1459,8 @@
proc/handle_random_events()
// Puke if toxloss is too high
if(!stat)
if (getToxLoss() >= 45 && nutrition > 20)
vomit()
if (getToxLoss() >= 45)
delayed_vomit()
//0.1% chance of playing a scary sound to someone who's in complete darkness
if(isturf(loc) && rand(1,1000) == 1)
+27
View File
@@ -690,4 +690,31 @@ proc/is_blind(A)
return 0
return 1
/mob/living/carbon/proc/vomit()
var/canVomit = 0
var/mob/living/carbon/human/H
if (istype(src, /mob/living/carbon/human))
H = src
if (H.ingested.total_volume > 0)
canVomit = 1
if (nutrition > 150)
canVomit = 1
if(canVomit)
Stun(4)
src.visible_message("<span class='warning'>[src] vomits!</span>","<span class='warning'>You vomit!</span>")
playsound(loc, 'sound/effects/splat.ogg', 50, 1)
var/turf/location = loc
if (istype(location, /turf/simulated))
location.add_vomit_floor(src, 1)
nutrition -= 40
if (istype(src, /mob/living/carbon/human))
ingested.trans_to_turf(location,30)//Vomiting empties the stomach, transferring 30u reagents to the floor where you vomited
else
src.visible_message("<span class='warning'>[src] retches, attempting to vomit!</span>","<span class='warning'>You gag and collapse as you feel the urge to vomit, but there's nothing in your stomach!</span>")
Weaken(4)
#undef SAFE_PERP
+1 -1
View File
@@ -112,7 +112,7 @@
owner << "\red Your skin itches."
if (germ_level > INFECTION_LEVEL_TWO)
if(prob(1))
spawn owner.vomit()
spawn owner.delayed_vomit()
if(owner.life_tick % PROCESS_ACCURACY == 0)
@@ -506,3 +506,24 @@
if(dose > 10)
M.make_dizzy(5)
M.make_jittery(5)
/datum/reagent/ipecac
name = "Ipecac"
id = "ipecac"
description = "A simple emetic, Induces vomiting in the patient, emptying stomach contents"
reagent_state = LIQUID
color = "#280f0b"
overdose = REAGENTS_OVERDOSE
scannable = 1
/datum/reagent/ipecac/affect_ingest(var/mob/living/carbon/M, var/alien, var/removed)
if (prob(10+dose))
M << pick("You feel nauseous", "Ugghh....", "Your stomach churns uncomfortably", "You feel like you're about to throw up", "You feel queasy","You feel pressure in your abdomen")
if (prob(dose))
M.vomit()
/datum/reagent/ipecac/affect_blood(var/mob/living/carbon/M, var/alien, var/removed)
M.adjustToxLoss(2 * removed) //If you inject it you're doing it wrong
@@ -274,6 +274,13 @@
required_reagents = list("oxygen" = 1, "anti_toxin" = 1, "carbon" = 1)
result_amount = 3
/datum/chemical_reaction/ipecac
name = "Ipecac"
id = "ipecac"
result = "ipecac"
required_reagents = list("hydrogen" = 1, "anti_toxin" = 1, "ethanol" = 1)
result_amount = 3
/datum/chemical_reaction/soporific
name = "Soporific"
id = "stoxin"