Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Debug prints seem pretty neglected in PAC3. This PR aims to make it slightly more usable.
Summary
Remove
pace.dprint
pac.dprint
andpace.dprint
were identical and had multiple declarations.Instead, we just use
pac.dprint
for everything, even if it happens in the editor realm.This also means we only have a single
pac.dprint
defined in the Shared util file.Create a new
pac_debug
convarInstead of relying on vars set on the
pac
/pace
tables, this new convar determines if the debug prints should happen. It has three levels:0
: Off1
: Debug Logs2
: Debug Logs + TraceThis closely matches the original behavior, but makes it easier to use.
Format
I think the current format is pretty gross, but I left it as-is. If you'd like me to change that here, I'd be happy to do that.
Problems
pac.debug
vs.pac_debug
There are other cases around the addon that rely on
pac.debug
to change the behavior, so without changing those, a developer would need to setpac.debug = true
andpac_debug 1
.We could change all
if pac.debug
toif debugConVar:GetInt() > 0
(or whatever) and then we could just have the single convar.If that's preferable, I can do that in this PR.
Webaudio
The webaudio file has its own
dprint
function that uses thewebaudio.debug
var to decide whether or not to print.I left it alone because I wasn't sure why they were separate, but if you think it's within the scope of this PR, I can make it use the standard
pac.dprint
as well.