r5749 - trunk/data/qcsrc/server/tturrets/system
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Wed Feb 4 11:20:06 EST 2009
Author: tzork
Date: 2009-02-04 11:20:06 -0500 (Wed, 04 Feb 2009)
New Revision: 5749
Modified:
trunk/data/qcsrc/server/tturrets/system/system_damage.qc
trunk/data/qcsrc/server/tturrets/system/system_main.qc
Log:
make turret head's hittable (with separate .heath's for body and head)
Modified: trunk/data/qcsrc/server/tturrets/system/system_damage.qc
===================================================================
--- trunk/data/qcsrc/server/tturrets/system/system_damage.qc 2009-02-04 14:47:15 UTC (rev 5748)
+++ trunk/data/qcsrc/server/tturrets/system/system_damage.qc 2009-02-04 16:20:06 UTC (rev 5749)
@@ -258,6 +258,8 @@
self.tur_head.avelocity = self.avelocity;
self.tur_head.angles = self.idle_aim;
self.health = self.tur_health;
+ self.tur_head.health = self.tur_health;
+
self.enemy = world;
self.volly_counter = self.shot_volly;
self.ammo = self.ammo_max;
@@ -275,30 +277,34 @@
*/
void turret_stdproc_damage (entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector vforce)
{
- entity baseent,oldself;
+ entity baseent;
- if (self.health <= 0) return;
+ // Damage func is shared on all parts as standard, we need to know what the master entity of this turret is.
- // Damage func is shared on all parts as standard, we need to know what the master entity of this turret is.
if (self.owner)
baseent = self.owner;
else
baseent = self;
- oldself = self;
- self = baseent;
+ //oldself = self;
+ //self = baseent;
+
+ if (self.health <= 0) return;
+
if (teamplay != 0)
if (self.team == attacker.team)
{
// This does not happen anymore. Re-enable if you fix that.
//if(attacker.flags & FL_CLIENT)
+ if(clienttype(attacker) == CLIENTTYPE_REAL)
+ sprint(attacker, "\{1}Turret tells you: I'm on your team!\n");
//if not(attacker.isbot)
- //sprint(attacker, "\{1}Turret tells you: I'm on your team!\n");
+
if(cvar("g_friendlyfire"))
{
- self = oldself;
+ //self = oldself;
return;
}
else
@@ -310,7 +316,7 @@
self.health = self.health - damage;
// thorw head slightly off aim when hit?
- if (oldself.classname == "turret_head")
+ if (self.classname == "turret_head")
if (self.damage_flags & TFL_DMG_HEADSHAKE)
self.tur_head.angles = self.tur_head.angles + randomvec() * damage;
@@ -319,11 +325,11 @@
// Start burning when we have 10% or less health left
if (self.health < (self.tur_health * 0.1))
- self.tur_head.effects = EF_FLAME;
+ self.effects = EF_FLAME;
- self = oldself;
+ // self = oldself;
- if (baseent.health <= 0)
+ if (self.health <= 0)
{
baseent.event_damage = SUB_Null;
baseent.tur_head.event_damage = SUB_Null;
@@ -335,6 +341,7 @@
+
}
Modified: trunk/data/qcsrc/server/tturrets/system/system_main.qc
===================================================================
--- trunk/data/qcsrc/server/tturrets/system/system_main.qc 2009-02-04 14:47:15 UTC (rev 5748)
+++ trunk/data/qcsrc/server/tturrets/system/system_main.qc 2009-02-04 16:20:06 UTC (rev 5749)
@@ -955,7 +955,7 @@
// Spawn extra bits
self.tur_head = spawn();
- self.tur_head.netname = self.tur_head.classname = "turret_head";
+ self.tur_head.netname = self.tur_head.classname = "turret_head";
self.tur_head.team = self.team;
// Defend mode?
@@ -970,7 +970,7 @@
}
// Claim ownership
- self.tur_head.owner = self;
+ self.tur_head.owner = self;
// Put pices in place
@@ -987,8 +987,10 @@
self.tur_head.angles = self.idle_aim;
if (!self.health) self.health = 150;
- self.tur_health = self.health;
+ self.tur_health = self.health;
+ self.tur_head.health = self.health;
+
//Solid bbox for preformance reasons
self.solid = SOLID_BBOX;
self.tur_head.solid = SOLID_BBOX;
@@ -1015,7 +1017,7 @@
self.turret_postthink = turret_stdproc_nothing;
//self.turret_damagefunc = turret_stdproc_damage;
- self.event_damage = turret_stdproc_damage;
+ //self.event_damage = turret_stdproc_damage;
self.tur_head.event_damage = turret_stdproc_damage;
//self.turret_diefunc = turret_stdproc_die;
More information about the nexuiz-commits
mailing list