Rotate optics and doors from NodeCore with ease.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
1.0 KiB

local nodecore
= nodecore
local LABEL_ROTATION_HINT = "rotation hint"
local TEX_ROTATE_FACE = "nc_extended_rotating_hud_rotate_face.png"
local TEX_ROTATE_EDGE = "nc_extended_rotating_hud_rotate_edge.png"
local hud = {}
function hud.update_player_hud(player, state)
local function crosshair_hud_element(texture)
return {
label = LABEL_ROTATION_HINT,
hud_elem_type = "image",
text = texture,
position = { x = 0.5, y = 0.5 },
offset = { x = 0, y = 0 },
alignment = { x = 0, y = 0 },
scale = { x = 1, y = 1 },
quick = true
}
end
local mode = state and state.mode
if mode == "face" then
local texture = TEX_ROTATE_FACE
if state.invert then texture = texture .. "^[transformFX" end
texture = texture .. "^[opacity:" .. 192
nodecore.hud_set(player, crosshair_hud_element(texture))
else
nodecore.hud_set(player, { label = LABEL_ROTATION_HINT, ttl = 0 })
end
end
return hud