Open brandonsturgeon opened 1 year ago
The idea with webaudio and other lua scripts in the same folder is that they're supposed to be independent from pac. You could just check if pac exists in its dprint function though.
Feel free to change the format too, it's not like anything relies on it.
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 usepac.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.