diff options
author | Michael Smith <mikesmiffy128@gmail.com> | 2023-06-11 10:55:38 +0100 |
---|---|---|
committer | Michael Smith <mikesmiffy128@gmail.com> | 2023-06-11 10:55:38 +0100 |
commit | bc63c357bf1ac3ef7f153408ad9b9c48e32bde23 (patch) | |
tree | 7e5fab332e5efe3d7eed639b4bd94dd133312a2e | |
parent | 02c48fa32f0065ec853958a1d7ee49f485241095 (diff) |
Add a stupid hack fix for the autojump cheat check
Of course, Portal doesn't actually check this properly, and it was never
tested well enough until just now. This fixes it, albeit in a really
stupid way. C'est la vie.
-rw-r--r-- | src/autojump.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/autojump.c b/src/autojump.c index d26ab9e..1bfc170 100644 --- a/src/autojump.c +++ b/src/autojump.c @@ -73,6 +73,16 @@ static bool unprot(void *gm) { return ret; } +// reimplementing cheats check for dumb and bad reasons, see below +static struct con_var *sv_cheats; +static void cheatcb(struct con_var *this) { + if (this->ival && !con_getvari(sv_cheats)) { + con_warn("Can't use cheat cvar sst_autojump, unless server has " + "sv_cheats set to 1.\n"); + con_setvari(this, 0); + } +} + INIT { gmsv = factory_server("GameMovement001", 0); if (!gmsv) { @@ -97,10 +107,11 @@ INIT { // tried arguing about it already and with how long it takes to convince // the Portal guys of anything I'd rather concede for now and maybe try // and revert this later if anyone eventually decides to be sensible. - // the alternative is nobody's allowed to use SST in runs - except of - // course the couple of people who just roll the dice anyway, and - // thusfar haven't actually been told to stop. yeah, whatever. + // and annoyingly, since cheats aren't even checked properly in portal, + // it's also necessary to do this extremely stupid callback nonsense! sst_autojump->base.flags |= CON_CHEAT; + sv_cheats = con_findvar("sv_cheats"); + sst_autojump->cb = cheatcb; } return true; } |