X-Git-Url: https://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Fmonsters%2Fmonster%2Fzombie.qc;h=d2078c9d70d13df241337adc64d4cfd970c87884;hb=8782d4625fb1b3e338da59e947a05e0dbcf4a493;hp=297bab87ddeac5409cc962be2776fdeec6fcc263;hpb=f8cd0686b2a5e6af575d50b47153426d8fbea754;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/monsters/monster/zombie.qc b/qcsrc/common/monsters/monster/zombie.qc index 297bab87d..d2078c9d7 100644 --- a/qcsrc/common/monsters/monster/zombie.qc +++ b/qcsrc/common/monsters/monster/zombie.qc @@ -51,7 +51,7 @@ const float zombie_anim_spawn = 30; void M_Zombie_Attack_Leap_Touch(entity this, entity toucher) { - if (this.health <= 0) + if (GetResource(this, RES_HEALTH) <= 0) return; vector angles_face; @@ -74,16 +74,16 @@ void M_Zombie_Attack_Leap_Touch(entity this, entity toucher) void M_Zombie_Defend_Block_End(entity this) { - if(this.health <= 0) + if(GetResource(this, RES_HEALTH) <= 0) return; setanim(this, this.anim_blockend, false, true, true); - this.armorvalue = autocvar_g_monsters_armor_blockpercent; + SetResourceExplicit(this, RES_ARMOR, autocvar_g_monsters_armor_blockpercent); } bool M_Zombie_Defend_Block(entity this) { - this.armorvalue = 0.9; + SetResourceExplicit(this, RES_ARMOR, 0.9); this.state = MONSTER_ATTACK_MELEE; // freeze monster this.attack_finished_single[0] = time + 2.1; this.anim_finished = this.attack_finished_single[0]; @@ -100,7 +100,7 @@ bool M_Zombie_Attack(int attack_type, entity actor, entity targ, .entity weapone { case MONSTER_ATTACK_MELEE: { - if(random() < 0.3 && actor.health < 75 && actor.enemy.health > 10) + if(random() < 0.3 && GetResource(actor, RES_HEALTH) < 75 && GetResource(actor.enemy, RES_HEALTH) > 10) return M_Zombie_Defend_Block(actor); float anim_chance = random(); @@ -125,7 +125,7 @@ bool M_Zombie_Attack(int attack_type, entity actor, entity targ, .entity weapone return false; } -spawnfunc(monster_zombie) { Monster_Spawn(this, true, MON_ZOMBIE.monsterid); } +spawnfunc(monster_zombie) { Monster_Spawn(this, true, MON_ZOMBIE); } #endif // SVQC #ifdef SVQC @@ -141,14 +141,15 @@ METHOD(Zombie, mr_pain, float(Zombie this, entity actor, float damage_take, enti { TC(Zombie, this); actor.pain_finished = time + 0.34; - setanim(actor, ((random() > 0.5) ? actor.anim_pain1 : actor.anim_pain2), true, true, false); + if(time >= actor.spawn_time) + setanim(actor, ((random() > 0.5) ? actor.anim_pain1 : actor.anim_pain2), true, true, false); return damage_take; } METHOD(Zombie, mr_death, bool(Zombie this, entity actor)) { TC(Zombie, this); - actor.armorvalue = autocvar_g_monsters_armor_blockpercent; + SetResourceExplicit(actor, RES_ARMOR, autocvar_g_monsters_armor_blockpercent); setanim(actor, ((random() > 0.5) ? actor.anim_die1 : actor.anim_die2), false, true, true); return true; @@ -180,7 +181,7 @@ METHOD(Zombie, mr_anim, bool(Zombie this, entity actor)) METHOD(Zombie, mr_setup, bool(Zombie this, entity actor)) { TC(Zombie, this); - if(!actor.health) actor.health = (autocvar_g_monster_zombie_health); + if(!GetResource(actor, RES_HEALTH)) SetResourceExplicit(actor, RES_HEALTH, autocvar_g_monster_zombie_health); if(!actor.speed) { actor.speed = (autocvar_g_monster_zombie_speed_walk); } if(!actor.speed2) { actor.speed2 = (autocvar_g_monster_zombie_speed_run); } if(!actor.stopspeed) { actor.stopspeed = (autocvar_g_monster_zombie_speed_stop); }