Added "force_groundkeys" style property.

This commit is contained in:
shavit 2019-04-15 03:01:06 +03:00
parent 2a1914010c
commit b88915ba18
3 changed files with 4 additions and 1 deletions

View File

@ -42,6 +42,7 @@
"block_d" "0" // Block +moveright (D).
"block_use" "0" // Block +use (E).
"force_hsw" "0" // Force half-sideways gameplay. 1 for regular HSW and 2 for surf-HSW.
"force_groundkeys" "0" // Forces the above settings even while on ground. e.g. enabling this will not allow W/D or W/A prestrafing when playing styles that disable the keys.
"block_pleft" "0" // Block +left. 2 to stop timer.
"block_pright" "0" // Block +right. 2 to stop timer.
"block_pstrafe" "0" // Prevent button inconsistencies (including +pstrafe). May have false positives when players lag. Will prevent some strafe hacks too. Set this to 2 to also stop the timer.

View File

@ -168,6 +168,7 @@ enum struct stylesettings_t
bool bInaccessible;
int iEnabled;
bool bKZCheckpoints;
bool bForceKeysOnGround;
}
enum struct chatstrings_t

View File

@ -1988,6 +1988,7 @@ bool LoadStyles()
gA_StyleSettings[i].bInaccessible = view_as<bool>(kv.GetNum("inaccessible", false));
gA_StyleSettings[i].iEnabled = kv.GetNum("enabled", 1);
gA_StyleSettings[i].bKZCheckpoints = view_as<bool>(kv.GetNum("kzcheckpoints", 0));
gA_StyleSettings[i].bForceKeysOnGround = view_as<bool>(kv.GetNum("force_groundkeys", 0));
// if this style is disabled, we will force certain settings
if(gA_StyleSettings[i].iEnabled <= 0)
@ -2484,7 +2485,7 @@ public Action OnPlayerRunCmd(int client, int &buttons, int &impulse, float vel[3
buttons &= ~IN_USE;
}
if(iGroundEntity == -1)
if(iGroundEntity == -1 || gA_StyleSettings[gA_Timers[client].iStyle].bForceKeysOnGround)
{
if(gA_StyleSettings[gA_Timers[client].iStyle].bBlockW && ((buttons & IN_FORWARD) > 0 || vel[0] > 0.0))
{