Removing local hud elements
- PolySaken
- Member
- Posts: 817
- Joined: Thu Nov 09, 2017 05:18
- GitHub: PolySaken-I-Am
- In-game: PolySaken
- Location: Wānaka, Aotearoa
- Contact:
Removing local hud elements
Does anyone know how to remove hud elements from the client side? I want to replace them with custom elems.
Guidebook Lib, for in-game docs | Poly Decor, some cool blocks | Vision Lib, an all-purpose library.
- Krock
- Developer
- Posts: 4650
- Joined: Thu Oct 03, 2013 07:48
- GitHub: SmallJoker
- Location: Switzerland
- Contact:
Re: Removing local hud elements
Search the HUD by its properties. CSM code example:
Code: Select all
minetest.register_chatcommand("health", {
params = "",
description = "Remove healthbar",
func = function(param)
local player = minetest.localplayer
local id
for i = 0, 10 do
local def = player:hud_get(i)
if def and
def.type == "statbar" and
def.text == "heart.png" then
id = i
break
end
end
if not id then
return false, "Health statbar not found"
end
player:hud_remove(id)
return true, "Removed!"
end
})
Look, I programmed a bug for you. >> Mod Search Engine << - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>
- PolySaken
- Member
- Posts: 817
- Joined: Thu Nov 09, 2017 05:18
- GitHub: PolySaken-I-Am
- In-game: PolySaken
- Location: Wānaka, Aotearoa
- Contact:
Re: Removing local hud elements
cool, thanks.Krock wrote:Search the HUD by its properties. CSM code example:Code: Select all
minetest.register_chatcommand("health", { params = "", description = "Remove healthbar", func = function(param) local player = minetest.localplayer local id for i = 0, 10 do local def = player:hud_get(i) if def and def.type == "statbar" and def.text == "heart.png" then id = i break end end if not id then return false, "Health statbar not found" end player:hud_remove(id) return true, "Removed!" end })
Guidebook Lib, for in-game docs | Poly Decor, some cool blocks | Vision Lib, an all-purpose library.
Who is online
Users browsing this forum: No registered users and 1 guest