From 8e1d5bee429b492f08b5a169e501ee30f272dd43 Mon Sep 17 00:00:00 2001 From: Vortex <73261680+Vortex2Oblivion@users.noreply.github.com> Date: Fri, 10 Jan 2025 14:53:53 -0500 Subject: [PATCH] show script line number in hscript traces --- source/modding/scripts/languages/HScript.hx | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/source/modding/scripts/languages/HScript.hx b/source/modding/scripts/languages/HScript.hx index b92e7eacbc..533daba5f8 100644 --- a/source/modding/scripts/languages/HScript.hx +++ b/source/modding/scripts/languages/HScript.hx @@ -1,5 +1,6 @@ package modding.scripts.languages; +import haxe.PosInfos; import states.PlayState; import openfl.utils.Assets; import sys.io.File; @@ -173,9 +174,16 @@ class HScript extends Script { trace(class_name + " isn't a valid class or enum!", WARNING); }); - set("trace", function(value:Dynamic) { - trace(value); - }); + + set("trace", Reflect.makeVarArgs(function(el) { + @:privateAccess + var inf = cast {fileName: path, lineNumber: interp.curExpr.line}; + var v = el.shift(); + if (el.length > 0) + inf.customParams = el; + + haxe.Log.trace(Std.string(v), inf); + })); set("load", function(path:String) { var newScript:HScript = new HScript(path);