set cl_weapon_stay_alpha 0.75 "Alpha of picked up weapons when g_weapon_stay > 0"
seta g_superspectate 0 "server side, allows extended spectator functions through the cmd interface. followpowerup, followstrength, followstshield or followfc [red|blue] will transfer spectation to the relevent player, if any"
+
+set g_random_gravity 0 "enable random gravity mutator"
+set g_random_gravity_delay 3 "delay between gravity changes"
+set g_random_gravity_negative_chance 0.5 "chance of gravity being a negative value"
+set g_random_gravity_min -2000 "minimum gravity"
+set g_random_gravity_max 2000 "maximum gravity"
+set g_random_gravity_positive 1000 "positive gravity multiplier"
+set g_random_gravity_negative 1000 "negative gravity multiplier"
float autocvar_g_touchexplode_edgedamage;
float autocvar_g_touchexplode_force;
#define autocvar_g_bloodloss cvar("g_bloodloss")
+float autocvar_g_random_gravity_negative_chance;
+float autocvar_g_random_gravity_min;
+float autocvar_g_random_gravity_max;
+float autocvar_g_random_gravity_positive;
+float autocvar_g_random_gravity_negative;
+float autocvar_g_random_gravity_delay;
+
CHECK_MUTATOR_ADD("g_pinata", mutator_pinata, !cvar("g_minstagib"));
CHECK_MUTATOR_ADD("g_midair", mutator_midair, 1);
CHECK_MUTATOR_ADD("g_bloodloss", mutator_bloodloss, !cvar("g_minstagib"));
+ CHECK_MUTATOR_ADD("g_random_gravity", mutator_random_gravity, 1);
CHECK_MUTATOR_ADD("g_sandbox", sandbox, 1);
#undef CHECK_MUTATOR_ADD
--- /dev/null
+float gravity_delay;
+float old_gravity;
+MUTATOR_HOOKFUNCTION(gravity_StartFrame)
+{
+ if(gameover)
+ {
+ if(autocvar_sv_gravity != old_gravity)
+ {
+ cvar_set("sv_gravity", ftos(old_gravity));
+ old_gravity = autocvar_sv_gravity; // update now so it can be changed during match end
+ }
+
+ return FALSE;
+ }
+
+ if(time < gravity_delay) return FALSE;
+ if(time < game_starttime) return FALSE;
+ if(round_handler_IsActive() && !round_handler_IsRoundStarted()) return FALSE;
+
+ if(random() >= autocvar_g_random_gravity_negative_chance)
+ cvar_set("sv_gravity", ftos(bound(autocvar_g_random_gravity_min, random() - random() * -autocvar_g_random_gravity_negative, autocvar_g_random_gravity_max)));
+ else
+ cvar_set("sv_gravity", ftos(bound(autocvar_g_random_gravity_min, random() * autocvar_g_random_gravity_positive, autocvar_g_random_gravity_max)));
+
+ gravity_delay = time + autocvar_g_random_gravity_delay;
+
+ dprint("Gravity is now: ", ftos(autocvar_sv_gravity), "\n");
+
+ return FALSE;
+}
+
+MUTATOR_HOOKFUNCTION(gravity_BuildMutatorsString)
+{
+ ret_string = strcat(ret_string, ":RandomGravity");
+ return 0;
+}
+
+MUTATOR_HOOKFUNCTION(gravity_BuildMutatorsPrettyString)
+{
+ ret_string = strcat(ret_string, ", Random gravity");
+ return 0;
+}
+
+MUTATOR_DEFINITION(mutator_random_gravity)
+{
+ MUTATOR_HOOK(SV_StartFrame, gravity_StartFrame, CBC_ORDER_ANY);
+ MUTATOR_HOOK(BuildMutatorsString, gravity_BuildMutatorsString, CBC_ORDER_ANY);
+ MUTATOR_HOOK(BuildMutatorsPrettyString, gravity_BuildMutatorsPrettyString, CBC_ORDER_ANY);
+
+ MUTATOR_ONADD
+ {
+ old_gravity = autocvar_sv_gravity;
+ }
+
+ MUTATOR_ONREMOVE
+ {
+ cvar_set("sv_gravity", ftos(old_gravity));
+ }
+
+ return FALSE;
+}
MUTATOR_DECLARATION(mutator_pinata);
MUTATOR_DECLARATION(mutator_midair);
MUTATOR_DECLARATION(mutator_bloodloss);
+MUTATOR_DECLARATION(mutator_random_gravity);
MUTATOR_DECLARATION(sandbox);
mutators/mutator_pinata.qc
mutators/mutator_midair.qc
mutators/mutator_bloodloss.qc
+mutators/mutator_random_gravity.qc
../warpzonelib/anglestransform.qc
../warpzonelib/mathlib.qc