All pastes #907513 Raw Edit

Animay3 Allergies

public text v1 · immutable
·published 2008-02-17 17:49 UTC
rendered paste body
/mob/human/attack_hand(mob/human/M as mob)
	switch(M.a_intent)
		if("help")
			allergycheck(M, src)
			..()
		if("hurt")
			allergycheck(M, src)
			..()
		if("grab")
			allergycheck(M, src)
			..()
	if(M.a_intent != "help" || "hurt" || "grab")
		allergycheck(M, src)
		..()	
/mob/human/var
	lallergy = 1.0 // Do you have latex allergies
	latexallergy = 1.0 // What type
	anaphylaxis = 0.0 // Are you in anaphylaxis?
	lexposure = 0.0 // Exposure level
	allergiesd = "There is no record of any allergies in this patient."
mob/human/proc/allergycheck(mob/human/predator, mob/human/prey) // lallergy latexallergy
	if(predator.gloves && prey.lallergy)
		prey.show_message(text("\red<b>[] is wearing latex!</b>", predator))
		if(prey.latexallergy == 1.0) // Type 1
			prey.lexposure++
			if(prey.lexposure >= 12)
				//Anaphylaxis

				world.log << text("[] is in anaphylaxis shock", prey)
				prey << "\red<b>You are having trouble breathing!</b>"
				prey.anaphylaxis += 10	
				spawn(250)
					while(prey.anaphylaxis)
						sleep(40)
						if(rand(1,3) == 3)
							prey.paralysis += 34
							prey.oxyloss += 25
						if(prey.health >= -75)
							anaphylaxis -= 5 // oh my
							
				

/*
if("CPR")

			if ((src.target.health >= -75.0 && src.target.health < 0))
				src.target.cpr_time = world.time
				if (src.target.health >= -40.0)
					var/suff = min(src.target.oxyloss, 5)
					src.target.oxyloss -= suff
					src.target.health = 100 - src.target.oxyloss - src.target.toxloss - src.target.fireloss - src.target.bruteloss
				if(src.target.rejuv < 10) src.target.rejuv += 10
				for(var/mob/O in viewers(src.source, null))
					O.show_message(text("\red [] performs CPR on []!", src.source, src.target), 1)
					src.target.anaphylaxis -= 1
					//Foreach goto(3251)
				src.source << "\red Repeat every 7 seconds AT LEAST."
				*/

/*

This system has problems.
First, it delays the attack message until it runs the proc, this can be easily fixed though with a check before running the proc!
Second, it doesn't update the medical logs(search for the manifest proc, I didn't want to code this in...)
I'm not sure if you would consider grab and help counting as 2 contacts a bug, but you can fix it anyways!
*/