Open Adrianilloo opened 3 years ago
I've been working on an extension that fixes it, among another issue. This already properly fixes SM timeleft cache not syncing upon round_start
events. However, I would like to know: why was timeleft replicated with it's own vars at SM core, rather than accessing/using game rules ones (m_flGameStartTime
)?
The game isn't reliable (as weird as that sounds) unfortunately.
Take a look at https://github.com/alliedmodders/sourcemod/blob/d93f6984cc8486bc51c9d53e86c04687a55c3a60/extensions/cstrike/timeleft.cpp#L52 for the code that cstrike uses.
@KyleSanderson Thanks for answering. However, why not, though? Btw I'm running my extension on my server and it worked perfectly. I already based my approach on CSS extension. Plus, in HL2MP there seem to be no round_end
event triggers, which may simplify anything.
Could we have something like the changes applied for CSS here? #1072
It's a little trickier since we don't ship an hl2mp-specific extension, and having one just for the time syncing does not seem worth shipping the extra binary. Hardcoding directly in core isn't ideal either.
However, if multiple games use a similar pattern, maybe we could have a gamedata key for a gamerules prop to check against, and use a generic variant of the logic in your extension and the cstrike one, moved to core. If the prop exists in gamedata, that can be considered opting into the logic for it, else falling back to the existing method.
However, I would like to know: why was timeleft replicated with it's own vars at SM core, rather than accessing/using game rules ones (m_flGameStartTime)?
I don't know the answer to that, but the code for it predates SM having support for poking at gamerules netvars. Maybe a fully generic approach was desired, or maybe the var didn't seem easily accessible, or maybe neither.
Thanks for the answer, I'm according with the points explained. Then I understand this is something that may be implemented in the long term.
Meanwhile anyone could use my extension, which also mitigates another default game issue. I'd remove the timeleft fix once it gets embedded into SM core.
Using
mp_restartgame <seconds>
causes SM timeleft cache not to sync with new server value (which should reset tomp_timelimit
). Only few guys had pointed out this limitation in the past (https://forums.alliedmods.net/showthread.php?t=166827), and I guess there wasn't enough interest in overcoming it. This limitation causes timeleft message "[SM] This is the last round" to be returned as well fromtimeleft
triggers once the SM-wise timeleft ends on current map after having used the restart command.Could we have something like the changes applied for CSS here? https://github.com/alliedmodders/sourcemod/pull/1072
Where SM cached timeleft is automatically updated on a
round_start
event, and the same approach could be taken in HL2MP (or other mods which would benefit too), as the event is generated in the exposed case as you can notice here: https://github.com/ValveSoftware/source-sdk-2013/blob/0d8dceea4310fde5706b3ce1c70609d72a38efdf/mp/src/game/shared/hl2mp/hl2mp_gamerules.cpp#L1050Thank you.