X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Fmonsters%2Fsv_monsters.qc;h=20e7b26a1cc993513b07b7f91ad06bf8de763986;hb=8319f82185c2c3a9609181abf54bbeea63071e8d;hp=80cd21b481b41474dcf860d2d42178c95428f228;hpb=0c6b993abfdde30411dc771643b8d25b8377cb50;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/monsters/sv_monsters.qc b/qcsrc/common/monsters/sv_monsters.qc index 80cd21b48..20e7b26a1 100644 --- a/qcsrc/common/monsters/sv_monsters.qc +++ b/qcsrc/common/monsters/sv_monsters.qc @@ -125,21 +125,27 @@ entity Monster_FindTarget(entity this) vector my_center = CENTER_OR_VIEWOFS(this); // find the closest acceptable target to pass to - IL_EACH(g_monster_targets, it.monster_attack && vdist(it.origin - this.origin, <, this.target_range), + IL_EACH(g_monster_targets, it.monster_attack, { - if(Monster_ValidTarget(this, it)) - { - // if it's a player, use the view origin as reference (stolen from RadiusDamage functions in g_damage.qc) - vector targ_center = CENTER_OR_VIEWOFS(it); + float trange = this.target_range; + if(PHYS_INPUT_BUTTON_CROUCH(it)) + trange *= 0.75; // TODO cvar this + vector theirmid = (it.absmin + it.absmax) * 0.5; + if(vdist(theirmid - this.origin, >, trange)) + continue; + if(!Monster_ValidTarget(this, it)) + continue; - if(closest_target) - { - vector closest_target_center = CENTER_OR_VIEWOFS(closest_target); - if(vlen2(my_center - targ_center) < vlen2(my_center - closest_target_center)) - { closest_target = it; } - } - else { closest_target = it; } + // if it's a player, use the view origin as reference (stolen from RadiusDamage functions in g_damage.qc) + vector targ_center = CENTER_OR_VIEWOFS(it); + + if(closest_target) + { + vector closest_target_center = CENTER_OR_VIEWOFS(closest_target); + if(vlen2(my_center - targ_center) < vlen2(my_center - closest_target_center)) + { closest_target = it; } } + else { closest_target = it; } }); return closest_target; @@ -166,6 +172,11 @@ void monster_setupcolors(entity this) else this.colormap = 1024; } + + if(this.colormap > 0) + this.glowmod = colormapPaletteColor(this.colormap & 0x0F, false); + else + this.glowmod = '1 1 1'; } void monster_changeteam(entity this, int newteam) @@ -1393,15 +1404,8 @@ bool Monster_Spawn(entity this, bool check_appear, int mon_id) set_movetype(this, MOVETYPE_FLY); } - if(!(this.spawnflags & MONSTERFLAG_RESPAWNED)) - { - if(mon.spawnflags & MONSTER_SIZE_BROKEN) - this.scale *= 1.3; - - if(mon.spawnflags & MONSTER_SIZE_QUAKE) - if(autocvar_g_monsters_quake_resize) - this.scale *= 1.3; - } + if((mon.spawnflags & MONSTER_SIZE_QUAKE) && autocvar_g_monsters_quake_resize && !(this.spawnflags & MONSTERFLAG_RESPAWNED)) + this.scale *= 1.3; setsize(this, mon.m_mins * this.scale, mon.m_maxs * this.scale);