]> de.git.xonotic.org Git - voretournament/voretournament.git/blobdiff - data/qcsrc/server/w_common.qc
First attempt to make health possible to swallow slowly. Incomplete and still buggy...
[voretournament/voretournament.git] / data / qcsrc / server / w_common.qc
index d682eb13fd1e437f75df2314e52918b3397a4ee6..8f4226c158b044ae4c06a3e6852f57c98789549d 100644 (file)
@@ -479,3 +479,29 @@ void W_PrepareExplosionByDamage(entity attacker, void() explode)
        self.nextthink = time;\r
        self.think = explode;\r
 }\r
+\r
+void PlayerGib(entity e, entity attacker)\r
+{\r
+       if(e.stat_eaten)\r
+               return; // you can't gib inside the stomach\r
+\r
+       float gib_health;\r
+       gib_health = cvar("sv_gibhealth");\r
+       if(gib_health > 0) // someone is being stupid\r
+               gib_health = 0;\r
+       if(cvar("g_healthsize")) // smaller bodies are more likely to gib and vice versa\r
+               gib_health *= e.scale;\r
+\r
+       if (e.health <= gib_health && e.modelindex != 0)\r
+       {\r
+               // don't use any animations as a gib\r
+               e.frame = 0;\r
+               e.dead_frame = 0;\r
+               // view just above the floor\r
+               e.view_ofs = '0 0 4';\r
+\r
+               Violence_GibSplash(e, 1, 1, attacker);\r
+               e.modelindex = 0; // restore later\r
+               e.solid = SOLID_NOT; // restore later\r
+       }\r
+}\r