Skip to content

Instantly share code, notes, and snippets.

@daftmugi
Created February 15, 2023 20:39
Show Gist options
  • Save daftmugi/05f7b65d761677908932929d081f5b17 to your computer and use it in GitHub Desktop.
Save daftmugi/05f7b65d761677908932929d081f5b17 to your computer and use it in GitHub Desktop.
#6256: Make auto lock picking succeed on 1 attempt
diff --git game/Game_local.cpp game/Game_local.cpp
index 673912e..3f3997d 100644
--- game/Game_local.cpp
+++ game/Game_local.cpp
@@ -4532,7 +4532,7 @@ void idGameLocal::HandleMainMenuCommands( const char *menuCommand, idUserInterfa
break;
case 4: // Automatic
cv_lp_auto_pick.SetBool(true);
- cv_lp_pick_timeout.SetInteger(500); // auto-LP is using average timeout
+ cv_lp_pick_timeout.SetInteger(300); // auto-LP is using expert timeout
break;
default:
gameLocal.Warning("Unknown value for lockpicking difficulty encountered!");
diff --git game/PickableLock.cpp game/PickableLock.cpp
index c19134c..82ca823 100644
--- game/PickableLock.cpp
+++ game/PickableLock.cpp
@@ -527,8 +527,8 @@ bool PickableLock::ProcessLockpickRepeat(int type)
m_FailedLockpickRounds++;
// greebo: Check if auto-pick should kick in
- if (cv_lp_auto_pick.GetBool() && cv_lp_max_pick_attempts.GetInteger() > 0 &&
- m_FailedLockpickRounds > cv_lp_max_pick_attempts.GetInteger())
+ if (cv_lp_auto_pick.GetBool()
+ && m_FailedLockpickRounds >= cv_lp_max_pick_attempts.GetInteger())
{
OnLockpickPinSuccess();
success = true;
diff --git game/gamesys/SysCvar.cpp game/gamesys/SysCvar.cpp
index 7250eb4..4312fdb 100644
--- game/gamesys/SysCvar.cpp
+++ game/gamesys/SysCvar.cpp
@@ -566,7 +566,7 @@ idCVar cv_empty_model("tdm_empty_model", "models/darkmod/misc/system/empty.lwo",
idCVar cv_lp_pin_base_count("tdm_lp_base_count", "5", CVAR_GAME | CVAR_INTEGER | CVAR_ARCHIVE, "Base number of clicks per pin. This number will be added to the pinpattern." );
idCVar cv_lp_sample_delay("tdm_lp_sample_delay", "10", CVAR_GAME | CVAR_INTEGER | CVAR_ARCHIVE, "Time in ms added to each pin sample to create a small pause between each pinsample." );
idCVar cv_lp_pick_timeout("tdm_lp_pick_timeout", "500", CVAR_GAME | CVAR_INTEGER | CVAR_ARCHIVE, "Timeout that defines the maximum reaction time before the pin is to be considered unpicked and started over." );
-idCVar cv_lp_max_pick_attempts("tdm_lp_autopick_attempts", "3", CVAR_GAME | CVAR_INTEGER | CVAR_ARCHIVE, "How many pick attemps before it automatically gets picked? 0 = unlimited (you must solve it yourself)" );
+idCVar cv_lp_max_pick_attempts("tdm_lp_autopick_attempts", "1", CVAR_GAME | CVAR_INTEGER | CVAR_ARCHIVE, "How many pick attempts before it automatically gets picked?" );
idCVar cv_lp_auto_pick("tdm_lp_auto_pick", "0", CVAR_GAME | CVAR_BOOL | CVAR_ARCHIVE, "Determines if auto picking is enabled (see tdm_lp_max_pick_attempts)" );
idCVar cv_lp_randomize("tdm_lp_randomize", "1", CVAR_GAME | CVAR_BOOL | CVAR_ARCHIVE, "If set to 1, the jiggling, while lockpicking, will be randomized, otherwise it is linear." );
idCVar cv_lp_pawlow("tdm_lp_pawlow", "0", CVAR_GAME | CVAR_BOOL | CVAR_ARCHIVE, "If set to 1 the sweetspot sound will play at the end of the pattern instead of at the beginning. Thus making it into a reaction game." );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment