]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Add cvars to control the minimum and maximum speed multiplier while spectating
authorMario <mario@smbclan.net>
Thu, 1 Feb 2018 13:50:24 +0000 (23:50 +1000)
committerMario <mario@smbclan.net>
Thu, 1 Feb 2018 13:50:24 +0000 (23:50 +1000)
defaultServer.cfg
qcsrc/ecs/systems/sv_physics.qc
qcsrc/server/autocvars.qh

index 739746267769380cc8cd599a5f944bc91e477a9d..4cabc2246ac608a760fa1fc596f576a54cf1e9a9 100644 (file)
@@ -83,6 +83,8 @@ set sv_precacheplayermodels 1
 set sv_precacheweapons 0
 set sv_precacheitems 0
 set sv_spectator_speed_multiplier 1.5
+set sv_spectator_speed_multiplier_min 1
+set sv_spectator_speed_multiplier_max 5
 set sv_spectate 1 "if set to 1, new clients are allowed to spectate or observe the game, if set to 0 joining clients spawn as players immediately (no spectating)"
 set sv_defaultcharacter 0 "master switch, if set to 1 the further configuration for replacing all player models, skins and colors is taken from the sv_defaultplayermodel, sv_defaultplayerskin and sv_defaultplayercolors variables"
 set sv_defaultcharacterskin 0 "if set to 1 the further configuration for replacing all skins is taken from the sv_defaultplayerskin variables"
index 6731bdf9433b7e228481237974e79a020334ddfa..ac939740b69c5febe24e48bbe2ab9783337ee11a 100644 (file)
@@ -65,7 +65,7 @@ void sys_phys_spectator_control(entity this)
                            || CS(this).impulse == 18
                            || (CS(this).impulse >= 200 && CS(this).impulse <= 209)
                           ) {
-                               this.spectatorspeed = bound(1, this.spectatorspeed + 0.5, 5);
+                               this.spectatorspeed = bound(autocvar_sv_spectator_speed_multiplier_min, this.spectatorspeed + 0.5, autocvar_sv_spectator_speed_multiplier_max);
                        } else if (CS(this).impulse == 11) {
                                this.spectatorspeed = maxspeed_mod;
                        } else if (CS(this).impulse == 12
@@ -86,7 +86,7 @@ void sys_phys_fixspeed(entity this, float maxspeed_mod)
 {
        float spd = max(PHYS_MAXSPEED(this), PHYS_MAXAIRSPEED(this)) * maxspeed_mod;
        if (this.speed != spd) {
-               this.speed = spd;
+               this.speed = spd; // TODO: send this as a stat and set the below cvars on the client?
                string temps = ftos(spd);
                stuffcmd(this, strcat("cl_forwardspeed ", temps, "\n"));
                stuffcmd(this, strcat("cl_backspeed ", temps, "\n"));
index 4b3745dc00784589e9c288854c3b6f948bfbfbd8..80da3f403ac97c025274b109d1ede8f5c8c8ea83 100644 (file)
@@ -330,6 +330,8 @@ bool autocvar_sv_ready_restart_repeatable;
 bool autocvar_sv_servermodelsonly;
 int autocvar_sv_spectate;
 float autocvar_sv_spectator_speed_multiplier;
+float autocvar_sv_spectator_speed_multiplier_min = 1;
+float autocvar_sv_spectator_speed_multiplier_max = 5;
 bool autocvar_sv_status_privacy;
 float autocvar_sv_stepheight;
 float autocvar_sv_strengthsound_antispam_refire_threshold;