- || (!IS_VEHICLE(targ) && (IS_DEAD(targ) || IS_DEAD(this) || GetResourceAmount(targ, RESOURCE_HEALTH) <= 0 || GetResourceAmount(this, RESOURCE_HEALTH) <= 0))
+ || (!IS_VEHICLE(targ) && (IS_DEAD(targ) || IS_DEAD(this) || GetResource(targ, RES_HEALTH) <= 0 || GetResource(this, RES_HEALTH) <= 0))
|| (this.monster_follow == targ || targ.monster_follow == this)
|| (!IS_VEHICLE(targ) && (targ.flags & FL_NOTARGET))
|| (!autocvar_g_monsters_typefrag && PHYS_INPUT_BUTTON_CHAT(targ))
|| (this.monster_follow == targ || targ.monster_follow == this)
|| (!IS_VEHICLE(targ) && (targ.flags & FL_NOTARGET))
|| (!autocvar_g_monsters_typefrag && PHYS_INPUT_BUTTON_CHAT(targ))
return false; // called when dead?
if(time < this.attack_finished_single[0])
return false; // still attacking
return false; // called when dead?
if(time < this.attack_finished_single[0])
return false; // still attacking
// g_monsters_miniboss_chance cvar or spawnflags 64 causes a monster to be a miniboss
if ((this.spawnflags & MONSTERFLAG_MINIBOSS) || (chance < autocvar_g_monsters_miniboss_chance))
{
// g_monsters_miniboss_chance cvar or spawnflags 64 causes a monster to be a miniboss
if ((this.spawnflags & MONSTERFLAG_MINIBOSS) || (chance < autocvar_g_monsters_miniboss_chance))
{
this.takedamage = DAMAGE_NO;
setorigin(this, this.pos1);
this.angles = this.pos2;
this.takedamage = DAMAGE_NO;
setorigin(this, this.pos1);
this.angles = this.pos2;
|| (STAT(FROZEN, this.enemy))
|| (this.enemy.flags & FL_NOTARGET)
|| (this.enemy.alpha < 0.5 && this.enemy.alpha != 0)
|| (STAT(FROZEN, this.enemy))
|| (this.enemy.flags & FL_NOTARGET)
|| (this.enemy.alpha < 0.5 && this.enemy.alpha != 0)
void Monster_Move(entity this, float runspeed, float walkspeed, float stpspeed)
{
void Monster_Move(entity this, float runspeed, float walkspeed, float stpspeed)
{
- if(vdist(this.velocity, >, 10))
- setanim(this, ((do_run) ? this.anim_run : this.anim_walk), true, false, false);
- else
- setanim(this, this.anim_idle, true, false, false);
+ {
+ if(vdist(this.velocity, >, 10))
+ setanim(this, ((do_run) ? this.anim_run : this.anim_walk), true, false, false);
+ else
+ setanim(this, this.anim_idle, true, false, false);
+ }
void Monster_Dead_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, .entity weaponentity, vector hitloc, vector force)
{
void Monster_Dead_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, .entity weaponentity, vector hitloc, vector force)
{
Violence_GibSplash_At(hitloc, force, 2, bound(0, damage, 200) / 16, this, attacker);
Violence_GibSplash_At(hitloc, force, 2, bound(0, damage, 200) / 16, this, attacker);
{
Violence_GibSplash_At(hitloc, force, 2, bound(0, damage, 200) / 16, this, attacker);
{
Violence_GibSplash_At(hitloc, force, 2, bound(0, damage, 200) / 16, this, attacker);
- {
- Unfreeze(this); // remove any icy remains
- SetResourceAmountExplicit(this, RESOURCE_HEALTH, 0); // reset by Unfreeze (TODO)
- }
+ Unfreeze(this, false); // remove any icy remains
- vector v = healtharmor_applydamage(100, GetResourceAmount(this, RESOURCE_ARMOR) / 100, deathtype, damage);
+ vector v = healtharmor_applydamage(100, GetResource(this, RES_ARMOR) / 100, deathtype, damage);
Monster_Sound(this, monstersound_pain, 1.2, true, CH_PAIN);
}
if(this.sprite)
Monster_Sound(this, monstersound_pain, 1.2, true, CH_PAIN);
}
if(this.sprite)
Violence_GibSplash_At(hitloc, force * -0.2, 3, 1, this, attacker);
}
Violence_GibSplash_At(hitloc, force * -0.2, 3, 1, this, attacker);
}
SUB_UseTargets(this, attacker, this.enemy);
this.target2 = this.oldtarget2; // reset to original target on death, incase we respawn
SUB_UseTargets(this, attacker, this.enemy);
this.target2 = this.oldtarget2; // reset to original target on death, incase we respawn
- Monster_Dead(this, attacker, (GetResourceAmount(this, RESOURCE_HEALTH) <= -100 || deathtype == DEATH_KILL.m_id));
+ Monster_Dead(this, attacker, (GetResource(this, RES_HEALTH) <= -100 || deathtype == DEATH_KILL.m_id));
WaypointSprite_Kill(this.sprite);
MUTATOR_CALLHOOK(MonsterDies, this, attacker, deathtype);
WaypointSprite_Kill(this.sprite);
MUTATOR_CALLHOOK(MonsterDies, this, attacker, deathtype);
{
Violence_GibSplash(this, 1, 0.5, attacker);
{
Violence_GibSplash(this, 1, 0.5, attacker);
bool Monster_Heal(entity targ, entity inflictor, float amount, float limit)
{
bool Monster_Heal(entity targ, entity inflictor, float amount, float limit)
{
- float true_limit = ((limit) ? limit : targ.max_health);
- if(GetResourceAmount(targ, RESOURCE_HEALTH) <= 0 || GetResourceAmount(targ, RESOURCE_HEALTH) >= true_limit)
+ float true_limit = ((limit != RES_LIMIT_NONE) ? limit : targ.max_health);
+ if(GetResource(targ, RES_HEALTH) <= 0 || GetResource(targ, RES_HEALTH) >= true_limit)
- GiveResourceWithLimit(targ, RESOURCE_HEALTH, amount, true_limit);
+ GiveResourceWithLimit(targ, RES_HEALTH, amount, true_limit);
movelib_move_simple_gravity(this, v_forward, mspeed, 1);
if(time > this.pain_finished && time > this.attack_finished_single[0])
movelib_move_simple_gravity(this, v_forward, mspeed, 1);
if(time > this.pain_finished && time > this.attack_finished_single[0])
- if(vdist(this.velocity, >, 10))
- setanim(this, this.anim_walk, true, false, false);
- else
- setanim(this, this.anim_idle, true, false, false);
+ {
+ if(vdist(this.velocity, >, 10))
+ setanim(this, this.anim_walk, true, false, false);
+ else
+ setanim(this, this.anim_idle, true, false, false);
+ }
{
STAT(REVIVE_PROGRESS, this) = bound(0, STAT(REVIVE_PROGRESS, this) + this.ticrate * this.revive_speed, 1);
{
STAT(REVIVE_PROGRESS, this) = bound(0, STAT(REVIVE_PROGRESS, this) + this.ticrate * this.revive_speed, 1);
- SetResourceAmountExplicit(this, RESOURCE_HEALTH, max(1, STAT(REVIVE_PROGRESS, this) * this.max_health));
+ SetResourceExplicit(this, RES_HEALTH, max(1, STAT(REVIVE_PROGRESS, this) * this.max_health));
this.iceblock.alpha = bound(0.2, 1 - STAT(REVIVE_PROGRESS, this), 1);
if(!(this.spawnflags & MONSTERFLAG_INVINCIBLE) && this.sprite)
this.iceblock.alpha = bound(0.2, 1 - STAT(REVIVE_PROGRESS, this), 1);
if(!(this.spawnflags & MONSTERFLAG_INVINCIBLE) && this.sprite)
{
STAT(REVIVE_PROGRESS, this) = bound(0, STAT(REVIVE_PROGRESS, this) - this.ticrate * this.revive_speed, 1);
{
STAT(REVIVE_PROGRESS, this) = bound(0, STAT(REVIVE_PROGRESS, this) - this.ticrate * this.revive_speed, 1);
- SetResourceAmountExplicit(this, RESOURCE_HEALTH, max(0, autocvar_g_nades_ice_health + (this.max_health-autocvar_g_nades_ice_health) * STAT(REVIVE_PROGRESS, this)));
+ SetResourceExplicit(this, RES_HEALTH, max(0, autocvar_g_nades_ice_health + (this.max_health-autocvar_g_nades_ice_health) * STAT(REVIVE_PROGRESS, this)));
if(this.event_damage)
this.event_damage(this, this, this.frozen_by, 1, DEATH_NADE_ICE_FREEZE.m_id, DMG_NOWEP, this.origin, '0 0 0');
}
if(this.event_damage)
this.event_damage(this, this, this.frozen_by, 1, DEATH_NADE_ICE_FREEZE.m_id, DMG_NOWEP, this.origin, '0 0 0');
}
- Damage(this, this, this, GetResourceAmount(this, RESOURCE_HEALTH) + this.max_health, DEATH_KILL.m_id, DMG_NOWEP, this.origin, this.origin);
+ Damage(this, this, this, GetResource(this, RES_HEALTH) + this.max_health, DEATH_KILL.m_id, DMG_NOWEP, this.origin, this.origin);
- if(!GetResourceAmount(this, RESOURCE_HEALTH)) { SetResourceAmountExplicit(this, RESOURCE_HEALTH, 100); }
- if(!GetResourceAmount(this, RESOURCE_ARMOR)) { SetResourceAmountExplicit(this, RESOURCE_ARMOR, bound(0.2, 0.5 * MONSTER_SKILLMOD(this), 0.9)); }
+ if(!GetResource(this, RES_HEALTH)) { SetResourceExplicit(this, RES_HEALTH, 100); }
+ if(!GetResource(this, RES_ARMOR)) { SetResourceExplicit(this, RES_ARMOR, bound(0.2, 0.5 * MONSTER_SKILLMOD(this), 0.9)); }
if(!this.target_range) { this.target_range = autocvar_g_monsters_target_range; }
if(!this.respawntime) { this.respawntime = autocvar_g_monsters_respawn_delay; }
if(!this.monster_moveflags) { this.monster_moveflags = MONSTER_MOVE_WANDER; }
if(!this.target_range) { this.target_range = autocvar_g_monsters_target_range; }
if(!this.respawntime) { this.respawntime = autocvar_g_monsters_respawn_delay; }
if(!this.monster_moveflags) { this.monster_moveflags = MONSTER_MOVE_WANDER; }
- SetResourceAmountExplicit(this, RESOURCE_HEALTH, GetResourceAmount(this, RESOURCE_HEALTH) * MONSTER_SKILLMOD(this));
+ SetResourceExplicit(this, RES_HEALTH, GetResource(this, RES_HEALTH) * MONSTER_SKILLMOD(this));
if(!(this.spawnflags & MONSTERFLAG_INVINCIBLE))
{
WaypointSprite_UpdateMaxHealth(this.sprite, this.max_health);
if(!(this.spawnflags & MONSTERFLAG_INVINCIBLE))
{
WaypointSprite_UpdateMaxHealth(this.sprite, this.max_health);