if (this.max_health)
{
this.takedamage = DAMAGE_YES;
- #ifdef SVQC
SetResourceAmountExplicit(this, RESOURCE_HEALTH, this.max_health);
- #elif defined(CSQC)
- this.health = this.max_health;
- #endif
}
this.state = STATE_DOWN;
if(this.spawnflags & NOSPLASH)
if(!(DEATH_ISSPECIAL(deathtype)) && (deathtype & HITTYPE_SPLASH))
return;
-#ifdef SVQC
SetResourceAmountExplicit(this, RESOURCE_HEALTH, GetResourceAmount(this, RESOURCE_HEALTH) - damage);
-#elif defined(CSQC)
- this.health -= damage;
-#endif
if (this.itemkeys)
{
return;
}
-#ifdef SVQC
if (GetResourceAmount(this, RESOURCE_HEALTH) <= 0)
{
SetResourceAmountExplicit(this.owner, RESOURCE_HEALTH, this.owner.max_health);
this.owner.takedamage = DAMAGE_NO; // will be reset upon return
door_use(this.owner, NULL, NULL);
}
-#elif defined(CSQC)
- if(this.health <= 0)
- {
- this.owner.health = this.owner.max_health;
- this.owner.takedamage = DAMAGE_NO;
- door_use(this.owner, NULL, NULL);
- }
-#endif
}
.float door_finished;
void door_trigger_touch(entity this, entity toucher)
{
-#ifdef SVQC
if (GetResourceAmount(toucher, RESOURCE_HEALTH) < 1)
+#ifdef SVQC
if (!((toucher.iscreature || (toucher.flags & FL_PROJECTILE)) && !IS_DEAD(toucher)))
#elif defined(CSQC)
- if (toucher.health < 1)
if(!((IS_CLIENT(toucher) || toucher.classname == "csqcprojectile") && !IS_DEAD(toucher)))
#endif
return;
{
this.owner = this.enemy = this;
-#ifdef SVQC
if (GetResourceAmount(this, RESOURCE_HEALTH))
-#elif defined(CSQC)
- if(this.health)
-#endif
return;
IFTARGETED
return;
cmaxs = this.absmax;
for(t = this; ; t = t.enemy)
{
- #ifdef SVQC
if(GetResourceAmount(t, RESOURCE_HEALTH) && !GetResourceAmount(this, RESOURCE_HEALTH))
SetResourceAmountExplicit(this, RESOURCE_HEALTH, GetResourceAmount(t, RESOURCE_HEALTH));
- #elif defined(CSQC)
- if(t.health && !this.health)
- this.health = t.health;
- #endif
if((t.targetname != "") && (this.targetname == ""))
this.targetname = t.targetname;
if((t.message != "") && (this.message == ""))
// distribute health, targetname, message
for(t = this; t; t = t.enemy)
{
- #ifdef SVQC
SetResourceAmountExplicit(t, RESOURCE_HEALTH, GetResourceAmount(this, RESOURCE_HEALTH));
- #elif defined(CSQC)
- t.health = this.health;
- #endif
t.targetname = this.targetname;
t.message = this.message;
if(t.enemy == this)
// shootable, or triggered doors just needed the owner/enemy links,
// they don't spawn a field
-#ifdef SVQC
if (GetResourceAmount(this, RESOURCE_HEALTH))
-#elif defined(CSQC)
- if(this.health)
-#endif
return;
IFTARGETED
return;