==============================================================================
Title                   : Eat Gibs 1.0
Filename                : eatgibs.txt, eatgibs.pat
Author                  : Sean Leonard
Email Address           : leonard@ap.net
Description             : If your health is below 50%, you can eat the
                          gibs of monsters or your opponants to heal you.
                          A normal gib (leg, arm, etc.) will heal you a
                          random amount between 1 and 10 percent.  A head
                          will heal you 15 percent.

                          This patch is ESPECIALLY useful and cool if you
                          have Jeff Epler's (jepler@inetnebr.com) solid
                          monster patch so that you can hack up your enemies
                          to eat them!
How to use              : I distributed this file in both plain text and
                          GNU diff format for those who know how to use
                          it.  I assume you know how to compile this and
                          use the modified progs.dat.  If not, ask around
                          on the news groups.  (I'm sure that there'll be
                          a FAQ when the quake-c news group is created)
==============================================================================
* Play Information *
Level #                 : N/A
Single Player           : Yes
Cooperative 2-16 Player : Yes
Deathmatch 2-16 Player  : Yes
Difficulty Settings     : N/A
New Sounds              : No
New Graphics            : No
New Music               : No
New Weapons		: No
Demos Replaced          : No

* Copyright / Permissions *
Give me credit if you use this code or I inspire you =).

* Where to get this file *

ftp://ftp.cdrom.com/pub/idgames2/quakec/misc/

==============================================================================

=-=-=-=-=-=-=-
Key
+    add this
-    remove this
=-=-=-=-=-=-=-

PLAYER.QC

************************
 	setsize (new, '0 0 0', '0 0 0');
 	new.velocity = VelocityForDamage (dm);
 	new.movetype = MOVETYPE_BOUNCE;
-	new.solid = SOLID_NOT;
+        new.solid = SOLID_TRIGGER;
 	new.avelocity_x = random()*600;
 	new.avelocity_y = random()*600;
 	new.avelocity_z = random()*600;
@@ -475,6 +475,7 @@
 	new.nextthink = time + 10 + random()*10;
 	new.frame = 0;
 	new.flags = 0;
+        new.touch = EatGibs;
 };
************************

************************
 	self.nextthink = -1;
 	self.movetype = MOVETYPE_BOUNCE;
 	self.takedamage = DAMAGE_NO;
-	self.solid = SOLID_NOT;
+        self.solid = SOLID_TRIGGER;
 	self.view_ofs = '0 0 8';
 	setsize (self, '-16 -16 0', '16 16 56');
 	self.velocity = VelocityForDamage (dm);
 	self.origin_z = self.origin_z - 24;
 	self.flags = self.flags - (self.flags & FL_ONGROUND);
 	self.avelocity = crandom() * '0 600 0';
+        self.touch = EatHead;
 };
************************

ITEMS.QC

************************
        item.nextthink = time + 120;	// remove after 2 minutes
 	item.think = SUB_Remove;
 };
+
+void() EatGibs =
+{
+// only a player can pick it up
+        if (other.classname != "player")
+		return;
+	if (other.health <= 0)
+		return;
+// only eat gibs if desparate
+        if (other.health >= 50)
+                return;
+
+// heal a random amount of 10% health
+        if (!T_Heal(other, random() * 10, 0))
+                return;
+
+        sprint(other, "Yummy gibs!\n");
+
+// gibs touch sound
+	sound(other, CHAN_ITEM, "zombie/z_miss.wav", 1, ATTN_NORM);
+
+        stuffcmd (other, "bf\n");
+
+        remove (self);
+
+};
+
+void() EatHead =
+{
+// only a player can pick it up
+        if (other.classname != "player")
+		return;
+	if (other.health <= 0)
+		return;
+// only eat head if desparate
+        if (other.health >= 50)
+                return;
+
+// heal 15%
+        if (!T_Heal(other, 15, 0))
+                return;
+
+        sprint(other, "Tasty brains!\n");
+
+// head touch sound
+        sound(other, CHAN_ITEM, "demon/dhit2.wav", 1, ATTN_NORM);
+
+        stuffcmd (other, "bf\n");
+
+        remove (self);
+
+};
************************

WORLD.QC

************************
 // setup precaches allways needed
-	precache_sound ("items/itembk2.wav");		// item respawn sound
+        precache_sound ("demon/dhit2.wav");             // for eatin' heads
+        precache_sound ("zombie/z_miss.wav");           // for eatin' gibs
+
+        precache_sound ("items/itembk2.wav");           // item respawn sound
 	precache_sound ("player/plyrjmp8.wav");		// player jump
 	precache_sound ("player/land.wav");			// player landing
 	precache_sound ("player/land2.wav");		// player hurt landing
************************