From 085e8eba0ca8822d69416fabed69726a9f41912b Mon Sep 17 00:00:00 2001 From: Mario Date: Wed, 30 Sep 2015 23:53:34 +1000 Subject: [PATCH] Add a simple cvar to control the range of monster front view targeting --- monsters.cfg | 1 + qcsrc/common/monsters/sv_monsters.qc | 2 +- qcsrc/server/autocvars.qh | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/monsters.cfg b/monsters.cfg index 9d961c0ad..2cb6c3e7d 100644 --- a/monsters.cfg +++ b/monsters.cfg @@ -102,6 +102,7 @@ set g_monsters_spawnshieldtime 2 set g_monsters_typefrag 1 set g_monsters_target_range 2000 set g_monsters_target_infront 0 +set g_monsters_target_infront_range 0.3 set g_monsters_attack_range 120 set g_monsters_respawn 1 set g_monsters_respawn_delay 20 diff --git a/qcsrc/common/monsters/sv_monsters.qc b/qcsrc/common/monsters/sv_monsters.qc index 73e6d9060..0734d54d5 100644 --- a/qcsrc/common/monsters/sv_monsters.qc +++ b/qcsrc/common/monsters/sv_monsters.qc @@ -118,7 +118,7 @@ bool Monster_ValidTarget(entity mon, entity player) makevectors (mon.angles); dot = normalize (player.origin - mon.origin) * v_forward; - if(dot <= 0.3) { return false; } + if(dot <= autocvar_g_monsters_target_infront_range) { return false; } } return true; // this target is valid! diff --git a/qcsrc/server/autocvars.qh b/qcsrc/server/autocvars.qh index fcf209fac..5358b662c 100644 --- a/qcsrc/server/autocvars.qh +++ b/qcsrc/server/autocvars.qh @@ -702,6 +702,7 @@ int autocvar_g_monsters_max_perplayer; float autocvar_g_monsters_damageforcescale = 0.8; float autocvar_g_monsters_target_range; bool autocvar_g_monsters_target_infront; +float autocvar_g_monsters_target_infront_range = 0.3; float autocvar_g_monsters_attack_range; int autocvar_g_monsters_score_kill; int autocvar_g_monsters_score_spawned; -- 2.39.2