vomit based gameplay addition (#7142)

You will now throw up into disposal bins, sinks, and toilets if you're within range of them, instead of onto the floor, you fucking animal.
This commit is contained in:
Geeves
2019-10-18 21:36:37 +02:00
committed by Erki
parent 4d30327c13
commit c8c1fe4dd3
2 changed files with 64 additions and 7 deletions

View File

@@ -731,24 +731,40 @@ proc/is_blind(A)
return 1
/mob/living/carbon/proc/vomit()
var/canVomit = 0
var/canVomit = FALSE
var/mob/living/carbon/human/H
if (istype(src, /mob/living/carbon/human))
H = src
if (H.ingested.total_volume > 0)
canVomit = 1
canVomit = TRUE
if (nutrition > 0)
canVomit = 1
canVomit = TRUE
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/list/vomitCandidate = typecacheof(/obj/machinery/disposal) + typecacheof(/obj/structure/sink) + typecacheof(/obj/structure/toilet)
var/obj/vomitReceptacle
for(var/obj/vessel in view(1, src))
if (!is_type_in_typecache(vessel, vomitCandidate))
continue
if(!vessel.Adjacent(src))
continue
vomitReceptacle = vessel
break
if(vomitReceptacle)
src.visible_message(span("warning", "[src] vomits into \the [vomitReceptacle]!"), span("warning", "You vomit into \the [vomitReceptacle]!"))
playsound(vomitReceptacle, 'sound/effects/splat.ogg', 50, 1)
else
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)
if(!vomitReceptacle)
if (istype(location, /turf/simulated))
location.add_vomit_floor(src, 1)
adjustNutritionLoss(60)
adjustHydrationLoss(30)
if (intoxication)//The pain and system shock of vomiting, sobers you up a little