Skip to content

Commit

Permalink
Changed some names in the file
Browse files Browse the repository at this point in the history
  • Loading branch information
DevonX committed Apr 14, 2022
1 parent aedca82 commit 6fb39f0
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions mods/noita-mp/files/scripts/noita-components/name-tags.lua
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@

function PlayerNameFunction(playerName)
gui = gui or GuiCreate()
GuiStartFrame(gui)
local x1, y1 = GuiGetScreenDimensions(gui)
x1, y1 = x1/2, y1/2
local screenWidth, screenHeight = GuiGetScreenDimensions(gui)
screenWidth, screenHeight = screenWidth/2, screenHeight/2

local entityId = GetUpdatedEntityID()
local x, y = EntityGetTransform(entityId)

function getEntityPositionOnScreen(entityId)
local camX, camY = GameGetCameraPos()
return x1+((x-camX)*1.5),y1+((y-camY)*1.5)
return screenWidth+((x-camX)*1.5),screenHeight+((y-camY)*1.5)
end

local xL, yL = getEntityPositionOnScreen(EntityGetWithTag("player_unit")[1])
local entityX, entityY = getEntityPositionOnScreen(EntityGetWithTag("player_unit")[1])
local playerNameLength = string.len(playerName)
local playerNameMid = xL -(playerNameLength*2)
local playerNameMid = entityX -(playerNameLength*2)

GuiText(gui,playerNameMid,yL,playerName)
GuiText(gui,playerNameMid,entityY,playerName)
end

PlayerNameFunction("testname")

0 comments on commit 6fb39f0

Please sign in to comment.