holograms 🔗
holograms is a server-side sprite hologram API for Luanti.
Text rendering uses signs_lib fonts and supports color tokens when color_lib is present.
Features 🔗
- holograms saved in mod storage
- dynamic holograms via provider callbacks
- alignment support:
left,center,right
Admin-only Commands 🔗
/hologram add <name> <here|x,y,z|~,~,~|~,~2,~4> <text>/hologram move <name> [here|x,y,z|~,~,~|~,~2,~4]/hologram edit <name> <text>/hologram list/hologram delete <name>/hologram size <name> <scale>
Global API 🔗
All functions are on the global table holograms.
holograms.upsert(name, pos, text[, opts]) -> ok, entry|errholograms.remove(name[, opts]) -> ok, err, entryholograms.set_scale(name, scale[, opts]) -> ok, err, entryholograms.register_provider(provider_id, def) -> ok, errholograms.unregister_provider(provider_id) -> ok, errholograms.refresh_provider(provider_id[, player_or_name]) -> ok, errholograms.get(name) -> entry|nilholograms.list([opts]) -> {entry, ...}
Entry Shape 🔗
An entry contains:
namepos = {x, y, z}text_rawscalealignrevisiontransient
Upsert Options 🔗
Supported opts fields:
persist(defaulttrue)scalealign(left|center|right)allow_newlines(falseby default unless enabled in config)
Provider API 🔗
Register a provider with:
def.for_player(player) -> result_tabledef.interval(seconds, minimum0.1)
Provider result_table fields:
enabled = falseto hide/removenameorkey(optional; auto-generated if omitted)pos = {x, y, z}textscale(optional)align(optional)allow_newlines(optional)
Integration Example 🔗
local HOLO = rawget(_G, "holograms")
if not HOLO then
return
end
-- Static/durable hologram
local ok, res = HOLO.upsert("spawn_info", {x = 0, y = 10, z = 0}, "Welcome!", {
persist = true,
scale = 1.2,
align = "center",
})
-- Dynamic per-player hologram
HOLO.register_provider("example_status", {
interval = 1.0,
for_player = function(player)
local p = player:get_pos()
return {
name = "status_" .. player:get_player_name(),
pos = {x = p.x, y = p.y + 3, z = p.z},
text = "Tracking: " .. player:get_player_name(),
scale = 1.0,
align = "center",
allow_newlines = false,
}
end,
})
Finally!
This is one of those mods I've never had time to make myself but that I wished had existed 6 years ago, and it's finally here!
I haven't tried it thoroughly, but it seems to do what it should; the commands are intuitive and also allow you to edit an already placed hologram, which is very nice. The only little suggestions I could give are to allow a special "here" position token in the add command for lazy people on Windows having to click ALT+126 three times to get the ~, and maybe allow scaling text >1 (right now that only stretches the hologram vertically, making it ugly).
Other than that, good job, thanks for your work on this!