From 26a1fb1eb131f5b76533a8813fbf8e77ef0e901b Mon Sep 17 00:00:00 2001 From: TimePath Date: Sun, 23 Aug 2015 19:50:18 +1000 Subject: [PATCH] Global forces mutator --- qcsrc/common/mutators/all.inc | 1 + .../mutators/mutator/globalforces/_mod.inc | 2 ++ .../mutators/mutator/globalforces/_mod.qh | 2 ++ .../mutator/globalforces/globalforces.qc | 22 +++++++++++++++++++ .../mutators/mutator/globalforces/module.inc | 3 +++ 5 files changed, 30 insertions(+) create mode 100644 qcsrc/common/mutators/mutator/globalforces/_mod.inc create mode 100644 qcsrc/common/mutators/mutator/globalforces/_mod.qh create mode 100644 qcsrc/common/mutators/mutator/globalforces/globalforces.qc create mode 100644 qcsrc/common/mutators/mutator/globalforces/module.inc diff --git a/qcsrc/common/mutators/all.inc b/qcsrc/common/mutators/all.inc index e99092c66..622587233 100644 --- a/qcsrc/common/mutators/all.inc +++ b/qcsrc/common/mutators/all.inc @@ -16,6 +16,7 @@ #include "mutator/damagetext/module.inc" #include "mutator/dodging/module.inc" #include "mutator/doublejump/module.inc" +#include "mutator/globalforces/module.inc" #include "mutator/hook/module.inc" #include "mutator/instagib/module.inc" #include "mutator/invincibleproj/module.inc" diff --git a/qcsrc/common/mutators/mutator/globalforces/_mod.inc b/qcsrc/common/mutators/mutator/globalforces/_mod.inc new file mode 100644 index 000000000..006a5d5c7 --- /dev/null +++ b/qcsrc/common/mutators/mutator/globalforces/_mod.inc @@ -0,0 +1,2 @@ +// generated file; do not modify +#include diff --git a/qcsrc/common/mutators/mutator/globalforces/_mod.qh b/qcsrc/common/mutators/mutator/globalforces/_mod.qh new file mode 100644 index 000000000..ac5cfd244 --- /dev/null +++ b/qcsrc/common/mutators/mutator/globalforces/_mod.qh @@ -0,0 +1,2 @@ +// generated file; do not modify +#include diff --git a/qcsrc/common/mutators/mutator/globalforces/globalforces.qc b/qcsrc/common/mutators/mutator/globalforces/globalforces.qc new file mode 100644 index 000000000..4e2e0424f --- /dev/null +++ b/qcsrc/common/mutators/mutator/globalforces/globalforces.qc @@ -0,0 +1,22 @@ +#ifdef IMPLEMENTATION + +AUTOCVAR(g_globalforces, float, false, "Global forces: knockback affects everyone"); +REGISTER_MUTATOR(mutator_globalforces, autocvar_g_globalforces); + +MUTATOR_HOOKFUNCTION(mutator_globalforces, BuildMutatorsString) { + M_ARGV(0, string) = strcat(M_ARGV(0, string), ":GlobalForces"); +} + +MUTATOR_HOOKFUNCTION(mutator_globalforces, BuildMutatorsPrettyString) { + M_ARGV(0, string) = strcat(M_ARGV(0, string), ", Global forces"); +} + +MUTATOR_HOOKFUNCTION(mutator_globalforces, PlayerDamage_SplitHealthArmor) { + entity frag_target = M_ARGV(2, entity); + vector damage_force = M_ARGV(3, vector) * autocvar_g_globalforces; + FOREACH_CLIENT(IS_PLAYER(it) && it != frag_target, { + it.velocity += damage_explosion_calcpush(it.damageforcescale * damage_force, it.velocity, autocvar_g_balance_damagepush_speedfactor); + }); +} + +#endif diff --git a/qcsrc/common/mutators/mutator/globalforces/module.inc b/qcsrc/common/mutators/mutator/globalforces/module.inc new file mode 100644 index 000000000..2a0eec8bf --- /dev/null +++ b/qcsrc/common/mutators/mutator/globalforces/module.inc @@ -0,0 +1,3 @@ +#ifdef SVQC + #include "globalforces.qc" +#endif -- 2.39.2