Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix error when item isn't provided to core.hud_replace_builtin #12484

Merged
merged 3 commits into from
Jul 2, 2022

Conversation

rubenwardy
Copy link
Member

@rubenwardy rubenwardy commented Jun 28, 2022

Context: https://forum.minetest.net/viewtopic.php?f=18&t=28131

In the wild: https://github.com/CasimirKaPazi/Voxelgarden/blob/b0893e89b08cc8702f21805c7316599f2dc98983/mods/default/gui.lua#L2

To do

This PR is Ready for Review.

How to test

local health_bar_definition =
{
	hud_elem_type = "statbar",
	position = { x=0.5, y=1 },
	text = "heart.png",
	number = 20,
	direction = 0,
	size = {x=16, y=16},
	offset = {x=(-9*24)-12, y=-(48+24+8)},
}

minetest.hud_replace_builtin("health", health_bar_definition)

@rubenwardy rubenwardy added @ Script API Bugfix 🐛 PRs that fix a bug Trivial The change is a trivial bug fix, documentation or maintenance change, as per the Git Guidelines labels Jun 28, 2022
builtin/game/statbars.lua Outdated Show resolved Hide resolved
@SmallJoker SmallJoker changed the title Fix crash when item isn't provided to core.hud_replace_builtin Fix error when item isn't provided to core.hud_replace_builtin Jul 2, 2022
@rubenwardy rubenwardy merged commit b095dc4 into minetest:master Jul 2, 2022
@rubenwardy rubenwardy deleted the fix-nominial-nil branch July 2, 2022 17:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bugfix 🐛 PRs that fix a bug @ Script API Trivial The change is a trivial bug fix, documentation or maintenance change, as per the Git Guidelines
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants