diff --git a/addons/sourcemod/configs/shavit-styles.cfg b/addons/sourcemod/configs/shavit-styles.cfg index 659fcd04..ad6ad9f7 100644 --- a/addons/sourcemod/configs/shavit-styles.cfg +++ b/addons/sourcemod/configs/shavit-styles.cfg @@ -25,6 +25,12 @@ "velocity_limit" "0.0" // Velocity limit: set to 0.0 for unlimited, 400.00 for 400vel styles etc. "bunnyhopping" "1" // Per-style sv_enablebunnyhopping. Leave as 1 if you want bunnyhopping to maintain player speed. This setting will override _strafe map settings. + // Convar overrides + "prespeed_type" "-1" // Set the specific value of shavit_misc_prespeed to use for this style. -1 will use the current shavit_misc_prespeed value. Requires "prespeed" to be 0. + "blockprejump" "-1" // Set the specific value of shavit_core_blockprejump to use for this style. -1 will use the current shavit_core_blockprejump value. + "nozaxisspeed" "-1" // Set the specific value of shavit_core_nozaxisspeed to use for this style. -1 will use the current shavit_core_nozaxisspeed value. + "restrictnoclip" "-1" // Set the specific value of shavit_misc_restrictnoclip to use for this style. -1 will use the current shavit_misc_restrictnoclip value. + // Physics "airaccelerate" "1000.0" // sv_airaccelerate value for the style. "runspeed" "260.00" // Running speed. Requires DHooks, shavit-misc and shavit_misc_staticprestrafe set to 1. diff --git a/addons/sourcemod/scripting/include/shavit/style-settings.sp b/addons/sourcemod/scripting/include/shavit/style-settings.sp index bab737de..62d1b92c 100644 --- a/addons/sourcemod/scripting/include/shavit/style-settings.sp +++ b/addons/sourcemod/scripting/include/shavit/style-settings.sp @@ -149,8 +149,14 @@ public SMCResult OnStyleEnterSection(SMCParser smc, const char[] name, bool opt_ SetStyleSettingInt (gI_CurrentParserIndex, "easybhop", 1); SetStyleSettingInt (gI_CurrentParserIndex, "prespeed", 0); SetStyleSettingFloat(gI_CurrentParserIndex, "velocity_limit", 0.0); - SetStyleSettingFloat(gI_CurrentParserIndex, "airaccelerate", 1000.0); SetStyleSettingInt (gI_CurrentParserIndex, "bunnyhopping", 1); + + SetStyleSettingInt (gI_CurrentParserIndex, "prespeed_type", -1); + SetStyleSettingInt (gI_CurrentParserIndex, "blockprejump", -1); + SetStyleSettingInt (gI_CurrentParserIndex, "nozaxisspeed", -1); + SetStyleSettingInt (gI_CurrentParserIndex, "restrictnoclip", -1); + + SetStyleSettingFloat(gI_CurrentParserIndex, "airaccelerate", 1000.0); SetStyleSettingFloat(gI_CurrentParserIndex, "runspeed", 260.00); SetStyleSettingFloat(gI_CurrentParserIndex, "gravity", 1.0); SetStyleSettingFloat(gI_CurrentParserIndex, "speed", 1.0); @@ -242,7 +248,7 @@ public SMCResult OnStyleLeaveSection(SMCParser smc) } #endif - if (GetStyleSettingInt(gI_CurrentParserIndex, "prespeed") > 0) + if (GetStyleSettingInt(gI_CurrentParserIndex, "prespeed") > 0 || GetStyleSettingInt(gI_CurrentParserIndex, "prespeed_type") > 0) { bool value; diff --git a/addons/sourcemod/scripting/shavit-core.sp b/addons/sourcemod/scripting/shavit-core.sp index 65c0279a..94d34cf2 100644 --- a/addons/sourcemod/scripting/shavit-core.sp +++ b/addons/sourcemod/scripting/shavit-core.sp @@ -2066,7 +2066,14 @@ void StartTimer(int client, int track) GetEntPropVector(client, Prop_Data, "m_vecVelocity", fSpeed); float curVel = SquareRoot(Pow(fSpeed[0], 2.0) + Pow(fSpeed[1], 2.0)); - if (!gCV_NoZAxisSpeed.BoolValue || + int nozaxisspeed = GetStyleSettingInt(gA_Timers[client].bsStyle, "nozaxisspeed"); + + if (nozaxisspeed < 0) + { + nozaxisspeed = gCV_NoZAxisSpeed.BoolValue; + } + + if (!nozaxisspeed || GetStyleSettingInt(gA_Timers[client].bsStyle, "prespeed") == 1 || (fSpeed[2] == 0.0 && (GetStyleSettingInt(gA_Timers[client].bsStyle, "prespeed") == 2 || curVel <= 290.0))) { @@ -2488,7 +2495,14 @@ public void PostThinkPost(int client) float fVel[3]; GetEntPropVector(client, Prop_Data, "m_vecVelocity", fVel); - if(!gCV_NoZAxisSpeed.BoolValue) + int nozaxisspeed = GetStyleSettingInt(gA_Timers[client].bsStyle, "nozaxisspeed"); + + if (nozaxisspeed < 0) + { + nozaxisspeed = gCV_NoZAxisSpeed.BoolValue; + } + + if (!nozaxisspeed) { if(fVel[2] == 0.0) { @@ -2957,7 +2971,14 @@ public Action OnPlayerRunCmd(int client, int &buttons, int &impulse, float vel[3 } } - if (bInStart && gCV_BlockPreJump.BoolValue && GetStyleSettingInt(gA_Timers[client].bsStyle, "prespeed") == 0 && (vel[2] > 0 || (buttons & IN_JUMP) > 0)) + int blockprejump = GetStyleSettingInt(gA_Timers[client].bsStyle, "blockprejump"); + + if (blockprejump < 0) + { + blockprejump = gCV_BlockPreJump.BoolValue; + } + + if (bInStart && blockprejump && GetStyleSettingInt(gA_Timers[client].bsStyle, "prespeed") == 0 && (vel[2] > 0 || (buttons & IN_JUMP) > 0)) { vel[2] = 0.0; buttons &= ~IN_JUMP; diff --git a/addons/sourcemod/scripting/shavit-misc.sp b/addons/sourcemod/scripting/shavit-misc.sp index 9fe1a61e..024ce0bb 100644 --- a/addons/sourcemod/scripting/shavit-misc.sp +++ b/addons/sourcemod/scripting/shavit-misc.sp @@ -1205,16 +1205,24 @@ public Action Shavit_OnUserCmdPre(int client, int &buttons, int &impulse, float { Shavit_StopTimer(client); } - if(bInStart && gCV_RestrictNoclip.BoolValue) + + if (bInStart) { - if(gCV_RestrictNoclip.IntValue == 1) + int restrictnoclip = Shavit_GetStyleSettingInt(gI_Style[client], "restrictnoclip"); + + if (restrictnoclip == -1) + { + restrictnoclip = gCV_RestrictNoclip.IntValue; + } + + if (restrictnoclip == 1) { float fSpeed[3]; GetEntPropVector(client, Prop_Data, "m_vecAbsVelocity", fSpeed); fSpeed[2] = 0.0; DumbSetVelocity(client, fSpeed); } - else if(gCV_RestrictNoclip.IntValue == 2) + else if (restrictnoclip == 2) { SetEntityMoveType(client, MOVETYPE_ISOMETRIC); } @@ -1226,12 +1234,19 @@ public Action Shavit_OnUserCmdPre(int client, int &buttons, int &impulse, float // prespeed if(!bNoclip && Shavit_GetStyleSettingInt(gI_Style[client], "prespeed") == 0 && bInStart) { + int prespeed_type = Shavit_GetStyleSettingInt(gI_Style[client], "prespeed_type"); + + if (prespeed_type == -1) + { + prespeed_type = gCV_PreSpeed.IntValue; + } + int iPrevGroundEntity = (gI_GroundEntity[client] != -1) ? EntRefToEntIndex(gI_GroundEntity[client]) : -1; - if((gCV_PreSpeed.IntValue == 2 || gCV_PreSpeed.IntValue == 3) && iPrevGroundEntity == -1 && iGroundEntity != -1 && (buttons & IN_JUMP) > 0) + if ((prespeed_type == 2 || prespeed_type == 3) && iPrevGroundEntity == -1 && iGroundEntity != -1 && (buttons & IN_JUMP) > 0) { DumbSetVelocity(client, view_as({0.0, 0.0, 0.0})); } - else if(gCV_PreSpeed.IntValue == 1 || gCV_PreSpeed.IntValue >= 3) + else if (prespeed_type == 1 || prespeed_type >= 3) { float fSpeed[3]; GetEntPropVector(client, Prop_Data, "m_vecAbsVelocity", fSpeed); @@ -1240,7 +1255,7 @@ public Action Shavit_OnUserCmdPre(int client, int &buttons, int &impulse, float // if trying to jump, add a very low limit to stop prespeeding in an elegant way // otherwise, make sure nothing weird is happening (such as sliding at ridiculous speeds, at zone enter) - if(gCV_PreSpeed.IntValue < 4 && fSpeed[2] > 0.0) + if (prespeed_type < 4 && fSpeed[2] > 0.0) { fLimit /= 3.0; } @@ -1250,7 +1265,7 @@ public Action Shavit_OnUserCmdPre(int client, int &buttons, int &impulse, float if(fScale < 1.0) { - if(gCV_PreSpeed.IntValue == 5) + if (prespeed_type == 5) { float zSpeed = fSpeed[2]; fSpeed[2] = 0.0;