From 3e2835419decace2479bf2c29dc00c0c6fa61926 Mon Sep 17 00:00:00 2001 From: Vftdan Date: Sat, 14 Oct 2023 12:14:25 +0300 Subject: [PATCH] wallhack: print distance to each entity --- augment/modules/wh.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/augment/modules/wh.lua b/augment/modules/wh.lua index 6ebeb54..955c072 100644 --- a/augment/modules/wh.lua +++ b/augment/modules/wh.lua @@ -30,6 +30,10 @@ return function() return {x = u.x + v.x, y = u.y + v.y, z = u.z + v.z} end + local function vec3Abs(v) + return math.sqrt(dotProduct3(v, v)) + end + local function toFrontCoords(entity) local dotResult = dotProduct3(entity, playerLookVector) if dotResult >= 0.0 then @@ -80,7 +84,7 @@ return function() if player.isSneaking then cache[id].text.setText(entity.name .. "\n" .. textutils.serialize(entity)) else - cache[id].text.setText(("%s\n{%.2f, %.2f, %.2f}"):format(entity.name, entity.x, entity.y, entity.z)) + cache[id].text.setText(("%s\n|{%.2f, %.2f, %.2f}| = %.2f"):format(entity.name, entity.x, entity.y, entity.z, vec3Abs(entity))) end if entityFront.flipped then cache[id].text.setColor(0x00FFFFFF)