X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Fmonsters%2Fsv_monsters.qc;h=3e90b07e4716b62b0a9fd4603afe2c6890c5eca3;hb=04f3c72e87f63adf935d05039f0e3f752b4dd99a;hp=fcab35af5334e5e282dc9013e0e12d0ca28d3586;hpb=75cc3b0a65b02ee61f525e6c6d788ab591868e42;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/monsters/sv_monsters.qc b/qcsrc/common/monsters/sv_monsters.qc index fcab35af5..3e90b07e4 100644 --- a/qcsrc/common/monsters/sv_monsters.qc +++ b/qcsrc/common/monsters/sv_monsters.qc @@ -99,9 +99,10 @@ bool Monster_ValidTarget(entity this, entity targ) return false; } - traceline(this.origin + this.view_ofs, targ.origin, MOVE_NOMONSTERS, this); + vector targ_origin = ((targ.absmin + targ.absmax) * 0.5); + traceline(this.origin + this.view_ofs, targ_origin, MOVE_NOMONSTERS, this); - if(trace_fraction < 1) + if(trace_fraction < 1 && trace_ent != targ) return false; // solid if(autocvar_g_monsters_target_infront || (this.spawnflags & MONSTERFLAG_INFRONT)) @@ -693,7 +694,8 @@ void Monster_CalculateVelocity(entity this, vector to, vector from, float turnra void Monster_Move(entity this, float runspeed, float walkspeed, float stpspeed) { // update goal entity if lost - if(this.target2 && this.goalentity.targetname != this.target2) { this.goalentity = find(NULL, targetname, this.target2); } + if(this.target2 && this.target2 != "" && this.goalentity.targetname != this.target2) + this.goalentity = find(NULL, targetname, this.target2); if(STAT(FROZEN, this) == 2) { @@ -866,9 +868,9 @@ void Monster_Move(entity this, float runspeed, float walkspeed, float stpspeed) else { entity e = this.goalentity; //find(NULL, targetname, this.target2); - if(e.target2) + if(e.target2 && e.target2 != "") this.target2 = e.target2; - else if(e.target) // compatibility + else if(e.target && e.target != "") // compatibility this.target2 = e.target; movelib_brake_simple(this, stpspeed); @@ -1073,7 +1075,7 @@ void Monster_Damage(entity this, entity inflictor, entity attacker, float damage this.dmg_time = time; - if(sound_allowed(MSG_BROADCAST, attacker) && deathtype != DEATH_DROWN.m_id && deathtype != DEATH_FIRE.m_id) + if(deathtype != DEATH_DROWN.m_id && deathtype != DEATH_FIRE.m_id && sound_allowed(MSG_BROADCAST, attacker)) spamsound (this, CH_PAIN, SND(BODYIMPACT1), VOL_BASE, ATTEN_NORM); // FIXME: PLACEHOLDER this.velocity += force * this.damageforcescale;