From: drjaska Date: Tue, 27 Dec 2022 12:19:01 +0000 (+0200) Subject: framework for individual dp_sf values for weaponentities X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=refs%2Fheads%2Fdrjaska%2Findividual-dp_sf;p=xonotic%2Fxonotic-data.pk3dir.git framework for individual dp_sf values for weaponentities --- diff --git a/qcsrc/client/main.qc b/qcsrc/client/main.qc index 4e05e681d..560c81701 100644 --- a/qcsrc/client/main.qc +++ b/qcsrc/client/main.qc @@ -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(); diff --git a/qcsrc/client/main.qh b/qcsrc/client/main.qh index 1f9e6a9a0..333d20cb5 100644 --- a/qcsrc/client/main.qh +++ b/qcsrc/client/main.qh @@ -139,7 +139,6 @@ vector camera_direction; const float ALPHA_MIN_VISIBLE = 0.003; float armorblockpercent; -float damagepush_speedfactor; //hooks int calledhooks; diff --git a/qcsrc/common/effects/qc/damageeffects.qc b/qcsrc/common/effects/qc/damageeffects.qc index 5f3cf9d43..411c6d153 100644 --- a/qcsrc/common/effects/qc/damageeffects.qc +++ b/qcsrc/common/effects/qc/damageeffects.qc @@ -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); } diff --git a/qcsrc/common/weapons/weapon/devastator.qh b/qcsrc/common/weapons/weapon/devastator.qh index 70c72f52c..2b4f8b1ff 100644 --- a/qcsrc/common/weapons/weapon/devastator.qh +++ b/qcsrc/common/weapons/weapon/devastator.qh @@ -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) \ diff --git a/qcsrc/server/client.qc b/qcsrc/server/client.qc index 58fda9a01..740c377a1 100644 --- a/qcsrc/server/client.qc +++ b/qcsrc/server/client.qc @@ -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() diff --git a/qcsrc/server/damage.qc b/qcsrc/server/damage.qc index d93d00bf5..ed7cc4eb0 100644 --- a/qcsrc/server/damage.qc +++ b/qcsrc/server/damage.qc @@ -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); diff --git a/qcsrc/server/weapons/common.qh b/qcsrc/server/weapons/common.qh index 779226be3..831b852dd 100644 --- a/qcsrc/server/weapons/common.qh +++ b/qcsrc/server/weapons/common.qh @@ -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; diff --git a/qcsrc/server/weapons/weaponsystem.qc b/qcsrc/server/weapons/weaponsystem.qc index fc2c3979c..3d5a1b1b4 100644 --- a/qcsrc/server/weapons/weaponsystem.qc +++ b/qcsrc/server/weapons/weaponsystem.qc @@ -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;