r1917 - trunk/data/qcsrc/server
savagex at icculus.org
savagex at icculus.org
Thu Nov 9 15:12:13 EST 2006
Author: savagex
Date: 2006-11-09 15:12:12 -0500 (Thu, 09 Nov 2006)
New Revision: 1917
Modified:
trunk/data/qcsrc/server/t_plats.qc
Log:
tZork's platform damage patch. Needs testing, then perhaps can go into
branch
Modified: trunk/data/qcsrc/server/t_plats.qc
===================================================================
--- trunk/data/qcsrc/server/t_plats.qc 2006-11-09 16:48:04 UTC (rev 1916)
+++ trunk/data/qcsrc/server/t_plats.qc 2006-11-09 20:12:12 UTC (rev 1917)
@@ -5,6 +5,8 @@
float STATE_DOWN = 3;
.entity trigger_field;
+//.float dmgtime;
+.float dmgtime2;
void() plat_center_touch;
void() plat_outside_touch;
@@ -111,12 +113,23 @@
void() plat_crush =
{
- if (self.state == 4)
- plat_go_down ();
- else if (self.state == 3)
- plat_go_up ();
- else
- objerror ("plat_crush: bad self.state\n");
+ if((self.spawnflags == 4) && (other.takedamage != DAMAGE_NO)) { // KIll Kill Kill!!
+ Damage (other, self, self, 10000, DEATH_HURTTRIGGER, other.origin, '0 0 0');
+ } else {
+ if((self.dmg) && (other.takedamage != DAMAGE_NO)) { // Shall we bite?
+ Damage (other, self, self, self.dmg, DEATH_HURTTRIGGER, other.origin, '0 0 0');
+ // Gib dead/dying stuff
+ if(other.deadflag != DEAD_NO)
+ Damage (other, self, self, 10000, DEATH_HURTTRIGGER, other.origin, '0 0 0');
+ }
+
+ if (self.state == 4)
+ plat_go_down ();
+ else if (self.state == 3)
+ plat_go_up ();
+ else
+ objerror ("plat_crush: bad self.state\n");
+ }
};
void() plat_use =
@@ -140,6 +153,12 @@
if (self.sounds == 0)
self.sounds = 2;
+ if(self.spawnflags == 4)
+ self.dmg = 10000;
+
+ if(self.dmg && (!self.message))
+ self.message = "was in the wrong place.";
+
if (self.sounds == 1)
{
precache_sound ("plats/plat1.wav");
@@ -178,8 +197,10 @@
setsize (self, self.mins , self.maxs);
self.blocked = plat_crush;
+
if (!self.speed)
self.speed = 150;
+
self.pos1 = self.origin;
self.pos2 = self.origin;
self.pos2_z = self.origin_z - self.size_z + 8;
@@ -356,11 +377,33 @@
self.think = func_train_find;
};
+
+
+void() rotating_blocked =
+{
+
+ if(self.dmg && other.takedamage != DAMAGE_NO) {
+ if(self.dmgtime2 < time) {
+ Damage (other, self, self, self.dmg, DEATH_HURTTRIGGER, other.origin, '0 0 0');
+ self.dmgtime2 = time + self.dmgtime;
+ }
+
+ // Gib dead/dying stuff
+ if(other.deadflag != DEAD_NO)
+ Damage (other, self, self, 10000, DEATH_HURTTRIGGER, other.origin, '0 0 0');
+ }
+
+
+}
+
/*QUAKED func_rotating (0 .5 .8) ? - - X_AXIS Y_AXIS
Brush model that spins in place on one axis (default Z).
-speed : speed to rotate (in degrees per second)
-noise : path/name of looping .wav file to play.
+speed : speed to rotate (in degrees per second)
+noise : path/name of looping .wav file to play.
+dmg : Do this mutch dmg every .dmgtime intervall when blocked
+dmgtime : See above.
*/
+
void() func_rotating =
{
if (self.noise)
@@ -380,6 +423,16 @@
else // Z
self.avelocity = '0 1 0' * self.speed;
+ if(self.dmg & (!self.message))
+ self.message = " was in the wrong place.";
+
+
+ if(self.dmg && (!self.dmgtime))
+ self.dmgtime = 0.25;
+
+ self.dmgtime2 = time;
+
+
self.solid = SOLID_BSP;
self.movetype = MOVETYPE_PUSH;
@@ -387,6 +440,8 @@
setsize(self, self.mins, self.maxs);
setorigin(self, self.origin);
+ self.blocked = rotating_blocked;
+
// wait for targets to spawn
self.nextthink = self.ltime + 999999999;
self.think = SUB_Null;
@@ -633,17 +688,42 @@
void() door_blocked =
{
+
+ if((self.spawnflags == 4) && (other.takedamage != DAMAGE_NO)) { // KIll Kill Kill!!
+ bprint("blabla2\n");
+ Damage (other, self, self, 10000, DEATH_HURTTRIGGER, other.origin, '0 0 0');
+ } else {
+
+ if((self.dmg) && (other.takedamage == DAMAGE_YES)) // Shall we bite?
+ Damage (other, self, self, self.dmg, DEATH_HURTTRIGGER, other.origin, '0 0 0');
+
+ //Dont chamge direction for dead or dying stuff
+ if(other.deadflag != DEAD_NO && (other.takedamage == DAMAGE_NO)) {
+ if (self.wait >= 0)
+ {
+ if (self.state == STATE_DOWN)
+ door_go_up ();
+ else
+ door_go_down ();
+ }
+ } else {
+ //gib dying stuff just to make sure
+ if((self.dmg) && (other.takedamage != DAMAGE_NO)) // Shall we bite?
+ Damage (other, self, self, 10000, DEATH_HURTTRIGGER, other.origin, '0 0 0');
+ }
+ }
+
//T_Damage (other, self, self, self.dmg, self.dmg, self.deathtype, DT_IMPACT, (self.absmin + self.absmax) * 0.5, '0 0 0', Obituary_Generic);
-
// if a door has a negative wait, it would never come back if blocked,
// so let it just squash the object to death real fast
- if (self.wait >= 0)
+/* if (self.wait >= 0)
{
if (self.state == STATE_DOWN)
door_go_up ();
else
door_go_down ();
}
+*/
};
@@ -991,14 +1071,27 @@
self.blocked = door_blocked;
self.use = door_use;
-
+
+ if(self.targetname == "") {
+ self.spawnflags = 0;
+ self.dmg = 0;
+ }
+
+ if(self.spawnflags == 4)
+ self.dmg = 10000;
+
+ if(self.dmg & (!self.message))
+ self.message = "was in the wrong place.";
+
+
+
if (self.sounds > 0)
{
precache_sound ("plats/medplat1.wav");
precache_sound ("plats/medplat2.wav");
self.noise2 = "plats/medplat1.wav";
self.noise1 = "plats/medplat2.wav";
- }
+ }
if (!self.speed)
self.speed = 100;
More information about the nexuiz-commits
mailing list