]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Add a 2D mode to infront checking, to avoid the standing on monsters exploit, also...
authorMario <mario@smbclan.net>
Tue, 24 Apr 2018 08:40:29 +0000 (18:40 +1000)
committerMario <mario@smbclan.net>
Tue, 24 Apr 2018 08:40:29 +0000 (18:40 +1000)
monsters.cfg
qcsrc/common/monsters/monster/golem.qc
qcsrc/common/monsters/sv_monsters.qc
qcsrc/server/autocvars.qh

index 000bb6a70eed80a6c45e5521f483f2b8ef5179d8..15a98c0534c2f632b63afd819e944ca74e52bd12 100644 (file)
@@ -77,6 +77,7 @@ set g_monster_golem_attack_lightning_radius_zap 250
 set g_monster_golem_attack_lightning_speed 1000
 set g_monster_golem_attack_lightning_speed_up 150
 set g_monster_golem_attack_smash_damage 50
+set g_monster_golem_attack_smash_force 100
 set g_monster_golem_attack_smash_range 200
 set g_monster_golem_damageforcescale 0.100000001
 set g_monster_golem_health 650
@@ -106,6 +107,7 @@ 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_target_infront_2d 1
 set g_monsters_attack_range 120
 set g_monsters_respawn 1
 set g_monsters_respawn_delay 20
index 85a1716390718b0544a34d01334c23a2fbf07352..d236bde23650df8bdc00ea300b744ebf39deb24b 100644 (file)
@@ -4,7 +4,8 @@
 float autocvar_g_monster_golem_health;
 float autocvar_g_monster_golem_damageforcescale = 0.1;
 float autocvar_g_monster_golem_attack_smash_damage;
-float autocvar_g_monster_golem_attack_smash_range;
+float autocvar_g_monster_golem_attack_smash_force = 100;
+float autocvar_g_monster_golem_attack_smash_range = 200;
 float autocvar_g_monster_golem_attack_claw_damage;
 float autocvar_g_monster_golem_attack_lightning_damage;
 float autocvar_g_monster_golem_attack_lightning_damage_zap = 15;
@@ -37,12 +38,14 @@ void M_Golem_Attack_Smash(entity this)
        Send_Effect(EFFECT_EXPLOSION_MEDIUM, (this.origin + (v_forward * 150)) - ('0 0 1' * this.maxs.z), '0 0 0', 1);
        sound(this, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
 
-       // RadiusDamage does NOT support custom starting location, which means we must use this hack...
+       vector loc = this.origin + v_forward * 50;
 
-       tracebox(this.origin + v_forward * 50, this.mins * 0.5, this.maxs * 0.5, this.origin + v_forward * autocvar_g_monster_golem_attack_smash_range, MOVE_NORMAL, this);
-
-       if(trace_ent.takedamage)
-               Damage(trace_ent, this, this, (autocvar_g_monster_golem_attack_smash_damage) * MONSTER_SKILLMOD(this), DEATH_MONSTER_GOLEM_SMASH.m_id, DMG_NOWEP, trace_ent.origin, normalize(trace_ent.origin - this.origin));
+       entity dmgent = spawn();
+       dmgent.owner = dmgent.realowner = this;
+       setorigin(dmgent, loc);
+       RadiusDamage (dmgent, this, (autocvar_g_monster_golem_attack_smash_damage) * MONSTER_SKILLMOD(this), (autocvar_g_monster_golem_attack_smash_damage * 0.5) * MONSTER_SKILLMOD(this), 
+                                       autocvar_g_monster_golem_attack_smash_range, this, NULL, autocvar_g_monster_golem_attack_smash_force, DEATH_MONSTER_GOLEM_SMASH.m_id, DMG_NOWEP, NULL);
+       delete(dmgent);
 }
 
 void M_Golem_Attack_Swing(entity this)
@@ -175,7 +178,7 @@ bool M_Golem_Attack(int attack_type, entity actor, entity targ, .entity weaponen
                        if(IS_ONGROUND(actor))
                        if(randomness <= 0.5 && vdist(actor.enemy.origin - actor.origin, <=, autocvar_g_monster_golem_attack_smash_range))
                        {
-                               setanim(actor, actor.anim_melee1, true, true, false);
+                               setanim(actor, actor.anim_melee1, false, true, true);
                                Monster_Delay(actor, 1, 1.1, M_Golem_Attack_Smash);
                                if(actor.animstate_endtime > time)
                                        actor.anim_finished = actor.animstate_endtime;
@@ -220,7 +223,7 @@ METHOD(Golem, mr_pain, float(Golem this, entity actor, float damage_take, entity
 {
     TC(Golem, this);
     actor.pain_finished = time + 0.5;
-    setanim(actor, actor.anim_pain1, true, true, false);
+    setanim(actor, ((random() >= 0.5) ? actor.anim_pain2 : actor.anim_pain1), true, true, false);
     return damage_take;
 }
 
index e9aa200e627997039a9a69061f54fb55142f49f4..16f803e0c430d20e714a925ea634e7c62160f1eb 100644 (file)
@@ -60,7 +60,13 @@ bool monster_facing(entity this, entity targ)
 {
        // relies on target having an origin
        makevectors(this.angles);
-       float dot = normalize(targ.origin - this.origin) * v_forward;
+       vector targ_org = targ.origin, my_org = this.origin;
+       if(autocvar_g_monsters_target_infront_2d)
+       {
+               targ_org = vec2(targ_org);
+               my_org = vec2(my_org);
+       }
+       float dot = normalize(targ_org - my_org) * v_forward;
 
        return !(dot <= autocvar_g_monsters_target_infront_range);
 }
index f26e1f478ffbb5cd94d60038f36f817a8ed1cf66..402662c60e19ee8adba0238fff4428eaa1fe669f 100644 (file)
@@ -394,6 +394,7 @@ 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;
+bool autocvar_g_monsters_target_infront_2d = true;
 float autocvar_g_monsters_attack_range;
 int autocvar_g_monsters_score_kill;
 int autocvar_g_monsters_score_spawned;