this.tur_head.angles += dt * this.tur_head.avelocity;
- if (this.health < 127)
+ if (GetResourceAmount(this, RESOURCE_HEALTH) < 127)
{
dt = random();
te_spark(this.origin + '0 0 40', randomvec() * 256 + '0 0 256', 16);
}
- if(this.health < 85)
+ if(GetResourceAmount(this, RESOURCE_HEALTH) < 85)
if(dt < 0.01)
pointparticles(EFFECT_SMOKE_LARGE, (this.origin + (randomvec() * 80)), '0 0 0', 1);
- if(this.health < 32)
+ if(GetResourceAmount(this, RESOURCE_HEALTH) < 32)
if(dt < 0.015)
pointparticles(EFFECT_SMOKE_SMALL, (this.origin + (randomvec() * 80)), '0 0 0', 1);
}
o = drawspritearrow(o, M_PI, rgb, a, SPRITE_ARROW_SCALE * t);
- o = drawsprite_TextOrIcon(true, o, M_PI, (SPRITE_HEALTHBAR_WIDTH + 2 * SPRITE_HEALTHBAR_BORDER) * t, rgb, a, waypointsprite_fontsize * '1 1 0', txt);
+ if(autocvar_g_waypointsprite_turrets_text)
+ {
+ o = drawsprite_TextOrIcon(true, o, M_PI, (SPRITE_HEALTHBAR_WIDTH + 2 * SPRITE_HEALTHBAR_BORDER) * t, rgb, a, waypointsprite_fontsize * '1 1 0', txt);
+ }
drawhealthbar(
o,
0,
- this.health / 255,
+ GetResourceAmount(this, RESOURCE_HEALTH) / 255,
'0 0 0',
'0 0 0',
0.5 * SPRITE_HEALTHBAR_WIDTH * t,
set_movetype(this.tur_head, MOVETYPE_NOCLIP);
set_movetype(this, MOVETYPE_NOCLIP);
this.tur_head.angles = this.angles;
- this.health = 255;
+ SetResourceAmount(this, RESOURCE_HEALTH, 255);
this.solid = SOLID_BBOX;
this.tur_head.solid = SOLID_NOT;
set_movetype(this, MOVETYPE_NOCLIP);
{
this.m_id = ReadByte();
- this.origin_x = ReadCoord();
- this.origin_y = ReadCoord();
- this.origin_z = ReadCoord();
+ this.origin = ReadVector();
setorigin(this, this.origin);
this.angles_x = ReadAngle();
if(sf & TNSF_MOVE)
{
- this.origin_x = ReadShort();
- this.origin_y = ReadShort();
- this.origin_z = ReadShort();
+ this.origin = ReadVector();
setorigin(this, this.origin);
- this.velocity_x = ReadShort();
- this.velocity_y = ReadShort();
- this.velocity_z = ReadShort();
+ this.velocity = ReadVector();
this.angles_y = ReadShort();
}
_tmp = ReadByte();
- if(_tmp == 0 && this.health != 0)
+ float myhp = GetResourceAmount(this, RESOURCE_HEALTH);
+ if(_tmp == 0 && myhp != 0)
turret_die(this);
- else if(this.health && this.health != _tmp)
+ else if(myhp && myhp > _tmp)
this.helpme = servertime + 10;
+ else if(myhp && myhp < _tmp)
+ this.helpme = 0; // we're being healed, don't spam help me waypoints
- this.health = _tmp;
+ SetResourceAmount(this, RESOURCE_HEALTH, _tmp);
}
- //this.enemy.health = this.health / 255;
return true;
}