Skip to content

Conversation

@mourningsickness
Copy link
Contributor

the OnReplaySaved forward was tweaked in bhoptimer 4.0 and needs to be updated to not crash when a wr is achieved

@mourningsickness
Copy link
Contributor Author

@Jeftaei
Copy link
Member

Jeftaei commented Jan 8, 2026

What were you thinking for keeping backwards compatibility working, using #if compile options doesnt work since it cant access SHAVIT_VERSION_MAJOR and trying to keep both function signatures doesnt work either so im out of ideas

Ill fix up the forward and redefinitions aswell just not sure how to keep the backwards compatibility up

@mourningsickness
Copy link
Contributor Author

like i described over steam message, you will use

#undef REQUIRE_PLUGIN
#include <shavit/core>

after the already present includes
then, we can check if SHAVIT_VERSION_MAJOR is defined (or >= 4), if it is, use this new forward; if not, use the old one.

keep in mind, this backwards compatibility would only be able to be done for people who are compiling the plugin themselves (as they should). there's not a way to have a pre-compiled plugin that does both versions, since we can check the version during compiling, based on the shavit include file.

@mourningsickness
Copy link
Contributor Author

if you want to have pre-compiled plugins, now there would have to be one for pre-4.0, and one for 4.0+

@Jeftaei
Copy link
Member

Jeftaei commented Jan 8, 2026

@mourningsickness if you could sanity check this that would be great, worked fine on my lan as far as i can tell

@mourningsickness
Copy link
Contributor Author

it worked because you have the shavit includes in your scripting folder. let me make some notes, one sec


#define API_BASE_URL "https://offstyles.tommyy.dev/api"

#undef REQUIRE_PLUGIN
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the point of this line is to say the shavit includes are not required (so other timer users can also use this plugin) so the #include <shavit*> go after this.. move this undef line to line 6


public void OnPluginStart()
{
if (SHAVIT_VERSION_MAJOR < 4) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this won't work if you don't have the shavit includes, better to do

#if defined SHAVIT_MAJOR_VERSION
~do the stuff for v4+~
#else
~do the backward compatibility stuff~
#endif

then you can also do the same for the foward itself (line 511) because you need different parameters depending on version.

@mourningsickness
Copy link
Contributor Author

this can actually be refactored into one single plugin that can check the cvar "shavit_version" in runtime, so we don't "need" the includes (though i think that's a good change), and you won't need two separate versions anyway.

you can do this using a handle and HookConVarChange then GetConVarString to check what the timer sets it as, in realtime on the server.

@mourningsickness
Copy link
Contributor Author

That convar string can be checked like this
if(StrEqual(sBuffer[0], "4"))
with sBuffer being the buffer char you store the convar value to

@mourningsickness
Copy link
Contributor Author

we spoke over steam some more. it'll be pretty cancer, but with a #define that takes variable inputs, this will be able to be done and keep backwards compatibility in one plugin, whether people compile it themselves or not (^: anything is possible with enough autism

@Jeftaei
Copy link
Member

Jeftaei commented Jan 9, 2026

that should be everything, ill merge this later today after a private island gets it setup so i dont have to make sure they download the v3 branch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants