]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
framework for individual dp_sf values for weaponentities drjaska/individual-dp_sf
authordrjaska <drjaska83@gmail.com>
Tue, 27 Dec 2022 12:19:01 +0000 (14:19 +0200)
committerdrjaska <drjaska83@gmail.com>
Wed, 28 Dec 2022 11:19:04 +0000 (13:19 +0200)
qcsrc/client/main.qc
qcsrc/client/main.qh
qcsrc/common/effects/qc/damageeffects.qc
qcsrc/common/weapons/weapon/devastator.qh
qcsrc/server/client.qc
qcsrc/server/damage.qc
qcsrc/server/weapons/common.qh
qcsrc/server/weapons/weaponsystem.qc

index 4e05e681db3d48d8c37276dfe4339e4e895fcd9e..560c817017dc5319992b401d53257fbab7c4983f 100644 (file)
@@ -1114,7 +1114,6 @@ NET_HANDLE(ENT_CLIENT_INIT, bool isnew)
        strcpy(forcefog, ReadString());
 
        armorblockpercent = ReadByte() / 255.0;
-       damagepush_speedfactor = ReadByte() / 255.0;
 
        serverflags = ReadByte();
 
index 1f9e6a9a03e5aa1f78ef13dd78a8de13b79853ca..333d20cb59c34877e7b2a18216334b28b6b622cf 100644 (file)
@@ -139,7 +139,6 @@ vector camera_direction;
 const float ALPHA_MIN_VISIBLE = 0.003;
 
 float armorblockpercent;
-float damagepush_speedfactor;
 
 //hooks
 int calledhooks;
index 5f3cf9d43b3fd32979fc245e41d3ba66ca49d7c8..411c6d1534981148981e7bf33aef9172f98aa75c 100644 (file)
@@ -240,7 +240,8 @@ NET_HANDLE(ENT_CLIENT_DAMAGEINFO, bool isNew)
                if(it.damageforcescale)
                        if(vdist(thisforce, !=, 0))
                        {
-                               it.velocity = it.velocity + damage_explosion_calcpush(it.damageforcescale * thisforce, it.velocity, damagepush_speedfactor);
+                               // gibs are unscaled by damagepush_speedfactor
+                               it.velocity += it.damageforcescale * thisforce;
                                UNSET_ONGROUND(it);
                        }
 
index 70c72f52cba160dbcad5ab19e82e476f102f090c..2b4f8b1ff765320e4850450f6505dd8e5aeab2c2 100644 (file)
@@ -23,8 +23,8 @@ CLASS(Devastator, Weapon)
        BEGIN(class) \
                P(class, prefix, ammo, float, NONE) \
         P(class, prefix, animtime, float, NONE) \
-        P(class, prefix, damageforcescale, float, NONE) \
         P(class, prefix, damage, float, NONE) \
+        P(class, prefix, damageforcescale, float, NONE) \
         P(class, prefix, detonatedelay, float, NONE) \
         P(class, prefix, edgedamage, float, NONE) \
         P(class, prefix, force, float, NONE) \
index 58fda9a016cdc2b42cd0c5ef8622f9c28d699cae..740c377a1d7d47b504176456878d980da26ef903 100644 (file)
@@ -878,7 +878,6 @@ void ClientInit_misc(entity this)
        else
                WriteString(channel, "");
        WriteByte(channel, this.count * 255.0); // g_balance_armor_blockpercent
-       WriteByte(channel, this.cnt * 255.0); // g_balance_damagepush_speedfactor
        WriteByte(channel, serverflags);
        WriteCoord(channel, autocvar_g_trueaim_minrange);
 }
@@ -891,11 +890,6 @@ void ClientInit_CheckUpdate(entity this)
                this.count = autocvar_g_balance_armor_blockpercent;
                this.SendFlags |= 1;
        }
-       if(this.cnt != autocvar_g_balance_damagepush_speedfactor)
-       {
-               this.cnt = autocvar_g_balance_damagepush_speedfactor;
-               this.SendFlags |= 1;
-       }
 }
 
 void ClientInit_Spawn()
index d93d00bf5f58d368a1f338c970d1657368ec46b9..ed7cc4eb099adbb1447510790437243eaf06a5d0 100644 (file)
@@ -829,7 +829,13 @@ void Damage(entity targ, entity inflictor, entity attacker, float damage, int de
        if (force)
        if (!IS_PLAYER(targ) || !StatusEffects_active(STATUSEFFECT_SpawnShield, targ) || targ == attacker)
        {
-               vector farce = damage_explosion_calcpush(targ.damageforcescale * force, targ.velocity, autocvar_g_balance_damagepush_speedfactor);
+               float dp_sf = 0;
+               if (attacker.(weaponentity).damagepush_speedfactor != 0) // if initialized
+                       dp_sf = attacker.(weaponentity).damagepush_speedfactor;
+               else
+                       dp_sf = autocvar_g_balance_damagepush_speedfactor;
+
+               vector farce = damage_explosion_calcpush(targ.damageforcescale * force, targ.velocity, dp_sf);
                if(targ.move_movetype == MOVETYPE_PHYSICS)
                {
                        entity farcent = new(farce);
index 779226be3dfc98ded7bb21b56042e9ac54265b40..831b852ddbbc83f8d81a22f68148c30f536e2474 100644 (file)
@@ -17,6 +17,8 @@ bool WarpZone_Projectile_Touch_ImpactFilter_Callback(entity this, entity toucher
 
 .float misc_bulletcounter;
 
+.float damagepush_speedfactor;
+
 .int projectiledeathtype;
 
 .float fade_time;
index fc2c3979c2b15226d5242fc95fdc641ad658b53e..3d5a1b1b41a466afd623b34a4ee10c2566b476e8 100644 (file)
@@ -536,6 +536,7 @@ void W_WeaponFrame(Player actor, .entity weaponentity)
                                this.m_weapon = newwep;
                                this.weaponname = newwep.mdl;
                                this.bulletcounter = 0;
+                               this.damagepush_speedfactor = autocvar_g_balance_damagepush_speedfactor;
                                newwep.wr_setup(newwep, actor, weaponentity);
                                this.state = WS_RAISE;