]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
dogshit proto
authordrjaska <drjaska83@gmail.com>
Sat, 19 Aug 2023 01:56:23 +0000 (04:56 +0300)
committerdrjaska <drjaska83@gmail.com>
Sat, 19 Aug 2023 01:56:23 +0000 (04:56 +0300)
bal-wep-mario.cfg
bal-wep-nexuiz25.cfg
bal-wep-samual.cfg
bal-wep-xdf.cfg
bal-wep-xonotic.cfg
qcsrc/common/weapons/weapon/hagar.qc
qcsrc/common/weapons/weapon/hagar.qh

index 25293a947af3f7afc0994764749394e28a8ed7db..a13f589c8a3e89138b534e0525dda6b04c1bd92c 100644 (file)
@@ -348,6 +348,7 @@ set g_balance_hagar_primary_damageforcescale 0
 set g_balance_hagar_primary_edgedamage 12.5
 set g_balance_hagar_primary_force 100
 set g_balance_hagar_primary_health 15
+set g_balance_hagar_primary_homing_speed_turnrate 0
 set g_balance_hagar_primary_lifetime 5
 set g_balance_hagar_primary_radius 65
 set g_balance_hagar_primary_refire 0.16667
index 17f5b31cab3b29b313e70f27606e6cf42bd7e082..4c2b12a3c8d93a1d7e6ee20566f4644750e98d6e 100644 (file)
@@ -348,6 +348,7 @@ set g_balance_hagar_primary_damageforcescale 0
 set g_balance_hagar_primary_edgedamage 15
 set g_balance_hagar_primary_force 100
 set g_balance_hagar_primary_health 0
+set g_balance_hagar_primary_homing_speed_turnrate 0
 set g_balance_hagar_primary_lifetime 30
 set g_balance_hagar_primary_radius 65
 set g_balance_hagar_primary_refire 0.15
index 2799a2496b47fb4debea904aa6b051b95c59a621..fafa6be49c663bd1c1702f108effe7662d125f60 100644 (file)
@@ -348,6 +348,7 @@ set g_balance_hagar_primary_damageforcescale 0
 set g_balance_hagar_primary_edgedamage 12.5
 set g_balance_hagar_primary_force 100
 set g_balance_hagar_primary_health 15
+set g_balance_hagar_primary_homing_speed_turnrate 0
 set g_balance_hagar_primary_lifetime 5
 set g_balance_hagar_primary_radius 65
 set g_balance_hagar_primary_refire 0.16667
index 491f0db713aeb77630fa60ae396f0d6261fe735b..cf58bb043ac7adf83c5a0aa459ff93bf7a48172f 100644 (file)
@@ -348,6 +348,7 @@ set g_balance_hagar_primary_damageforcescale 0
 set g_balance_hagar_primary_edgedamage 12.5
 set g_balance_hagar_primary_force 92
 set g_balance_hagar_primary_health 15
+set g_balance_hagar_primary_homing_speed_turnrate 0
 set g_balance_hagar_primary_lifetime 5
 set g_balance_hagar_primary_radius 25
 set g_balance_hagar_primary_refire 0.11
index 29d73a4240dce99f1ed7f9db67a7dd0f18394a13..5da6114379e336edfecf73379dc80b822f1267a6 100644 (file)
@@ -348,6 +348,7 @@ set g_balance_hagar_primary_damageforcescale 0
 set g_balance_hagar_primary_edgedamage 12.5
 set g_balance_hagar_primary_force 100
 set g_balance_hagar_primary_health 15
+set g_balance_hagar_primary_homing_speed_turnrate 0
 set g_balance_hagar_primary_lifetime 5
 set g_balance_hagar_primary_radius 65
 set g_balance_hagar_primary_refire 0.16667
index a8c12efccd2002dad48197ffccd8be1b6be6a3c0..8071ef900e1a834296987405e9435fdbba899138 100644 (file)
@@ -75,6 +75,189 @@ void W_Hagar_Touch2(entity this, entity toucher)
        }
 }
 
+/***************************************/
+// LegendGuard writes homming missile part to test 02-02-2021
+// LegendGuard adds a copy from hk_weapon.qc functions and the EXPERIMENT of homing missile of this weapon worked successfully 07-02-2021
+bool validate_target(entity this, entity proj, entity targ)
+{
+       if (!targ)
+               return false;
+
+       // we know for sure pure entities are bad targets
+       if (is_pure(targ))
+               return false;
+
+       // If only this was used more..
+       if (targ.flags & FL_NOTARGET)
+               return false;
+
+       // Cant touch this
+       if ((targ.takedamage == DAMAGE_NO) || (GetResource(targ, RES_HEALTH) < 0))
+               return false;
+
+       // player
+       if (IS_PLAYER(targ))
+       {
+               if (this.target_select_playerbias < 0)
+                       return false;
+
+               if (IS_DEAD(targ))
+                       return false;
+       }
+
+       // Missile
+       if ((targ.flags & FL_PROJECTILE) && (this.target_select_missilebias < 0))
+               return false;
+
+       // Team check
+       if (SAME_TEAM(this, targ) || SAME_TEAM(this, targ.owner))
+               return false;
+
+       return true;
+}
+
+void Hagar_homing_Missile_Think(entity this)
+{
+       // Check if lifetime has expired
+       if (this.cnt < time)
+               W_Hagar_Explode(this, NULL);
+
+       vector vu, vd, vf, vl, vr, ve;   // Vector (direction)
+       float  fu, fd, ff, fl, fr, fe;   // Fraction to solid
+       vector olddir, wishdir, newdir;  // Final direction
+       float lt_for;   // Length of Trace FORwrad
+       float lt_seek;  // Length of Trace SEEK (left, right, up down)
+       float pt_seek;  // Pitch of Trace SEEK (How mutch to angele left, right up, down trace towards v_forward)
+
+       //this.nextthink = time + this.ticrate;
+       this.nextthink = time + 0.25;
+       this.nextthink = time;
+
+       if (IS_DEAD(this.enemy) || IS_SPEC(this.enemy) || IS_OBSERVER(this.enemy))
+               this.enemy = NULL;
+
+       // Pick the closest valid target missile can see.
+       if (!this.enemy)
+       {
+               // in this case, the lighter check is to validate it first, and check distance if it is valid
+               IL_EACH(g_damagedbycontents, validate_target(this.owner, this, it),
+               {
+                       if(vdist((this.origin - it.origin), >, 1000))
+                               continue;
+
+                       WarpZone_TraceLine(this.origin, it.origin, true, this.enemy);
+                       if (trace_fraction == 1 || trace_ent == it)
+                       {
+
+                               if(!this.enemy)
+                                       this.enemy = it;
+                               else if(vlen2(this.origin - it.origin) < vlen2(this.origin - this.enemy.origin))
+                                       this.enemy = it;
+                       }
+               });
+       }
+
+       this.angles = vectoangles(this.velocity);
+       this.angles_x = this.angles_x * -1;
+       makevectors(this.angles);
+       this.angles_x = this.angles_x * -1;
+
+       if (this.enemy)
+       {
+               // Get data on enemy position
+               vector pre_pos = this.enemy.origin + this.enemy.velocity * min((vlen(this.enemy.origin - this.origin) / vlen(this.velocity)), 0.5);
+
+               WarpZone_TraceLine(this.origin, pre_pos, true, this.enemy);
+               ve = normalize(pre_pos - this.origin);
+               fe = trace_fraction;
+       }
+       else
+       {
+               ve = '0 0 0';
+               fe = 0;
+       }
+
+       if ((fe != 1) || (this.enemy == NULL) || vdist(this.origin - this.enemy.origin, >, 1000))
+       {
+               float myspeed = vlen(this.velocity);
+
+               lt_for  = myspeed * 3;
+               lt_seek = myspeed * 2.95;
+
+               // Trace forward
+               traceline(this.origin, this.origin + v_forward * lt_for, false, this);
+               vf = trace_endpos;
+               ff = trace_fraction;
+
+               // Setup trace pitch
+               pt_seek = 1 - ff;
+               pt_seek = bound(0.15, pt_seek, 0.8);
+               if (ff < 0.5) pt_seek = 1;
+
+               // Trace left
+               traceline(this.origin, this.origin + (-1 * (v_right * pt_seek) + (v_forward * ff)) * lt_seek, false, this);
+               vl = trace_endpos;
+               fl = trace_fraction;
+
+               // Trace right
+               traceline(this.origin,  this.origin + ((v_right * pt_seek) + (v_forward * ff)) * lt_seek, false, this);
+               vr = trace_endpos;
+               fr = trace_fraction;
+
+               // Trace up
+               traceline(this.origin,  this.origin + ((v_up * pt_seek) + (v_forward * ff)) * lt_seek, false, this);
+               vu = trace_endpos;
+               fu = trace_fraction;
+
+               // Trace down
+               traceline(this.origin,  this.origin + (-1 * (v_up * pt_seek) + (v_forward * ff)) * lt_seek, false, this);
+               vd = trace_endpos;
+               fd = trace_fraction;
+
+               vl = normalize(vl - this.origin);
+               vr = normalize(vr - this.origin);
+               vu = normalize(vu - this.origin);
+               vd = normalize(vd - this.origin);
+
+               // Panic tresh passed, find a single direction and turn as hard as we can
+               if (pt_seek == 1)
+               {
+                       wishdir = v_right;
+                       if (fl > fr) wishdir = -1 * v_right;
+                       if (fu > fl) wishdir = v_up;
+                       if (fd > fu) wishdir = -1 * v_up;
+               }
+               else
+               {
+                       // Normalize our trace vectors to make a smooth path
+                       wishdir = normalize( (vl * fl) + (vr * fr) +  (vu * fu) +  (vd * fd) );
+               }
+
+               if (this.enemy)
+               {
+                       if (fe < 0.1) fe = 0.1; // Make sure we always try to move sligtly towards our target
+                       wishdir = (wishdir * (1 - fe)) + (ve * fe);
+               }
+       }
+       else
+       {
+               wishdir = ve;
+       }
+
+       // Calculate new heading
+       olddir = normalize(this.velocity);
+       newdir = normalize(olddir + wishdir * WEP_CVAR_PRI(hagar, homing_speed_turnrate));
+
+       // Set heading & speed
+       this.velocity = newdir * vlen(this.velocity);
+
+       // Align model with new heading
+       this.angles = vectoangles(this.velocity);
+
+       UpdateCSQCProjectile(this);
+}
+/********************************/
+
 void W_Hagar_Attack(Weapon thiswep, entity actor, .entity weaponentity)
 {
        entity missile;
@@ -99,8 +282,15 @@ void W_Hagar_Attack(Weapon thiswep, entity actor, .entity weaponentity)
 
        settouch(missile, W_Hagar_Touch);
        missile.use = W_Hagar_Explode_use;
-       setthink(missile, adaptor_think2use_hittype_splash);
-       missile.nextthink = time + WEP_CVAR_PRI(hagar, lifetime);
+       if (WEP_CVAR_PRI(hagar, homing_speed_turnrate) == 0) {
+               setthink(missile, adaptor_think2use_hittype_splash);
+               missile.nextthink = time + WEP_CVAR_PRI(hagar, lifetime);
+       } else {
+               setthink(missile, Hagar_homing_Missile_Think);
+               missile.nextthink = time + 0.5; // when to start homing
+               missile.nextthink = time; // when to start homing
+               missile.cnt = time + WEP_CVAR_PRI(hagar, lifetime);
+       }
        PROJECTILE_MAKETRIGGER(missile);
        missile.projectiledeathtype = thiswep.m_id;
        missile.weaponentity_fld = weaponentity;
index 5a43d84eff1fc5113e56058bc4a687d7fd95d54b..4d3e926a77a95025347114b783916bc85a808036 100644 (file)
@@ -27,6 +27,7 @@ CLASS(Hagar, Weapon)
         P(class, prefix, edgedamage, float, BOTH) \
         P(class, prefix, force, float, BOTH) \
         P(class, prefix, health, float, BOTH) \
+        P(class, prefix, homing_speed_turnrate, float, PRI) \
         P(class, prefix, lifetime, float, PRI) \
         P(class, prefix, lifetime_min, float, SEC) \
         P(class, prefix, lifetime_rand, float, SEC) \