]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/monsters/sv_monsters.qc
Make sure delayed monster attacks also update angles
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / monsters / sv_monsters.qc
index 97a68b5f8f92877e95d115b0bf6c50d03b804088..4f2139cc170a56c78d49548f47b360e8ca8e78b3 100644 (file)
@@ -189,7 +189,11 @@ void monster_changeteam(entity this, int newteam)
 .void(entity) monster_delayedfunc;
 void Monster_Delay_Action(entity this)
 {
-       if(Monster_ValidTarget(this.owner, this.owner.enemy)) { this.monster_delayedfunc(this.owner); }
+       if(Monster_ValidTarget(this.owner, this.owner.enemy))
+       {
+               monster_makevectors(this.owner, this.owner.enemy);
+               this.monster_delayedfunc(this.owner);
+       }
 
        if(this.cnt > 1)
        {
@@ -359,8 +363,6 @@ bool Monster_Attack_Melee(entity this, entity targ, float damg, vector anim, flo
        else
                this.attack_finished_single[0] = this.anim_finished = time + animtime;
 
-       monster_makevectors(this, targ);
-
        traceline(this.origin + this.view_ofs, this.origin + v_forward * er, 0, this);
 
        if(trace_ent.takedamage)
@@ -424,6 +426,7 @@ void Monster_Attack_Check(entity this, entity targ, .entity weaponentity)
 
        if(vdist(targ.origin - this.origin, <=, this.attack_range))
        {
+               monster_makevectors(this, targ);
                int attack_success = this.monster_attackfunc(MONSTER_ATTACK_MELEE, this, targ, weaponentity);
                if(attack_success == 1)
                        Monster_Sound(this, monstersound_melee, 0, false, CH_VOICE);
@@ -433,6 +436,7 @@ void Monster_Attack_Check(entity this, entity targ, .entity weaponentity)
 
        if(vdist(targ.origin - this.origin, >, this.attack_range))
        {
+               monster_makevectors(this, targ);
                int attack_success = this.monster_attackfunc(MONSTER_ATTACK_RANGED, this, targ, weaponentity);
                if(attack_success == 1)
                        Monster_Sound(this, monstersound_melee, 0, false, CH_VOICE);
@@ -1095,15 +1099,12 @@ void Monster_Move_2D(entity this, float mspeed, bool allow_jumpoff)
        if(trace_ent && IS_MONSTER(trace_ent))
                reverse = true;
 
-       // TODO: fix this... tracing is broken if the floor is thin
-       /*
-       if(!allow_jumpoff)
+       if(!allow_jumpoff && IS_ONGROUND(this))
        {
-               a = b - '0 0 32';
-               traceline(b, a, MOVE_WORLDONLY, this);
+               traceline(b, b - '0 0 32', MOVE_NORMAL, this);
                if(trace_fraction == 1.0)
                        reverse = true;
-       } */
+       }
 
        if(reverse)
        {
@@ -1321,7 +1322,7 @@ bool Monster_Spawn(entity this, bool check_appear, int mon_id)
 
        if(!autocvar_g_monsters) { Monster_Remove(this); return false; }
 
-       if(!(this.spawnflags & MONSTERFLAG_RESPAWNED))
+       if(!(this.spawnflags & MONSTERFLAG_RESPAWNED) && !(this.flags & FL_MONSTER))
        {
                IL_PUSH(g_monsters, this);
                if(this.mdl && this.mdl != "")