From f997d4e54468d930da356031dd22f64d26f8b44d Mon Sep 17 00:00:00 2001 From: kidfearless Date: Mon, 14 Dec 2020 15:12:22 -0700 Subject: [PATCH] implement force_timescale in configs --- addons/sourcemod/configs/shavit-styles.cfg | 1 + addons/sourcemod/scripting/shavit-core.sp | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/addons/sourcemod/configs/shavit-styles.cfg b/addons/sourcemod/configs/shavit-styles.cfg index cc503778..d8cb0da4 100644 --- a/addons/sourcemod/configs/shavit-styles.cfg +++ b/addons/sourcemod/configs/shavit-styles.cfg @@ -31,6 +31,7 @@ "gravity" "1.0" // Gravity setting, 1.0 for default. Standard for low gravity styles is 0.6. "speed" "1.0" // Speed multiplier, 1.0 for default. Standard for slowmo styles is 0.5. "timescale" "1.0" // Timing will scale with this setting. + "force_timescale" "0" // Force the timescale every jump? Default is 0 for normal timescales. "velocity" "1.0" // % of horizontal velocity to keep per jump. a value 0.9 will make the player lose 10% of their velocity per jump. Likewise, values above 1 will result in speed gains. "bonus_velocity" "0.0" // Bonus velocity to gain per jump. If set to e.g. 100.0, the player will gain 100 bonus velocity per jump. "min_velocity" "0.0" // Minimum amount of horizontal velocity to keep per jump. If set to 600.0, the player can't have less than 600 velocity per jump. diff --git a/addons/sourcemod/scripting/shavit-core.sp b/addons/sourcemod/scripting/shavit-core.sp index 96115201..60a2fca8 100644 --- a/addons/sourcemod/scripting/shavit-core.sp +++ b/addons/sourcemod/scripting/shavit-core.sp @@ -2591,6 +2591,20 @@ public SMCResult OnStyleLeaveSection(SMCParser smc) gSM_StyleKeys[gI_CurrentParserIndex].SetString("timescale", "0.5"); } + // Setting it here so that we can reference the timescale setting. + if(!HasStyleSetting(gI_CurrentParserIndex, "force_timescale")) + { + if(GetStyleSettingFloat(gI_CurrentParserIndex, "timescale") == 1.0) + { + gSM_StyleKeys[gI_CurrentParserIndex].SetString("force_timescale", "0"); + } + + else + { + gSM_StyleKeys[gI_CurrentParserIndex].SetString("force_timescale", "1"); + } + } + if(!gB_Registered && strlen(gS_StyleStrings[gI_CurrentParserIndex].sChangeCommand) > 0 && !gA_StyleSettings[gI_CurrentParserIndex].bInaccessible) { char sStyleCommands[32][32];