Skip to content

Conversation

@treacherousfiend
Copy link

All of the code which determines how much ubercharge you get on a specific tick was server only, causing the medigun to constantly cause prediction errors due to the client having no clue how much uber you were actually building, unless you are in a situation where you are getting the default ubercharge per tick (stock medigun, damaged patient, no critheals, etc.)

This fixes that by making all possible server code also be on the client. The only exception to this is an unused weapon attribute which would modify ubercharge rate as long as you weren't in a respawn room. The functions it calls are server only, and would require changes to how respawn room entities are handled on the client to fix. So any mods, server plugins, vscript, etc. that uses this plugin will still cause prediction errors
Due to being an unused attribute, and because it would require a change to something in a completely different part of the codebase, I decided that it was out of scope for this PR to fix that.

Related Issue

Source-1-Games Issue 4046

Implementation

Removed a #ifdef GAME_DLL that covered all of the ubercharge rate modification code, the ifdef was left for the PointInRespawnRoom() calls due to the function only being on the server.

Screenshots

Checklist

  • No other PRs implement this idea.
  • This PR does not introduce any regressions.
  • I certify that this PR is my own entirely original work, or I have permission from and have attributed the relevant authors.
  • I have agreed to and signed this project's Contributor License Agreement.
  • This PR targets the tc2-mod branch.
  • This change has been filed as an issue.
  • No other PRs address this.
  • This PR is as minimal as possible.
  • This PR does not introduce any regressions.
  • This PR has been built and locally tested on at least one platform.
  • This PR has been tested on all platforms, on both a dedicated server and on a listen server.

Testing Checklist

Client Server Version
Windows Built & Tested N/A Windows 10 Home 22H2
Linux Untested N/A

Caveats

The unused attribute "mult_uberchargerate_for_healer" (ubercharge rate bonus for healer) still will cause prediction errors due to relying on server code for func_respawnroom entities

Alternatives

All of the code which determines how much ubercharge you get on a specific tick was server only, causing the medigun to constantly cause prediction errors unless you are in a situation where you are getting the default ubercharge per tick (stock medigun, damaged patient, no critheals).

This fixes that by making all possible server code to also be on the client.
The only exception to this is an unused weapon attribute which would modify ubercharge rate as long as you weren't in a respawn room. The functions it calls are server only, and would require changes to how respawn room entities are handled on the client to fix.
@CLAassistant
Copy link

CLAassistant commented Feb 25, 2025

CLA assistant check
All committers have signed the CLA.

Shoutouts to @JustYourOrdinaryNormie for making me aware that my PR didn't fix ubercharge drain prediction errors!

Fixes prediction errors caused by Ubercharge draining by adding client only `DrainCharge`  functioncalls to the medi-gun's `ItemPostFrame` and newly added `ItemBusyFrame` functions.

Additionally, moved the Vaccinator charge removal outside of a server only #ifdef to fix prediction errors from using charges with the Vaccinator.
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