Skip to content

Commit

Permalink
Replace statbar with scaled image to remove deprecation warning
Browse files Browse the repository at this point in the history
  • Loading branch information
TeTpaAka committed Jul 16, 2015
1 parent 7a9fa4a commit f696cb1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
quests 1.0
quests 1.1

quests is a simple quest framework for minetest that lets you define your own quests and handels the representation.

Expand Down
11 changes: 6 additions & 5 deletions hud.lua
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,9 @@ function quests.update_hud(playername)
hud_element.value = quests.active_quests[playername][hud_element.name].value
player:hud_change(hud_element.id, "text", get_quest_hud_string(hud_element.name, quests.active_quests[playername][hud_element.name]))
if (hud_element.id_bar ~= nil) then
player:hud_change(hud_element.id_bar, "number", math.floor(40 * hud_element.value / quests.registered_quests[hud_element.name].max))
player:hud_change(hud_element.id_bar, "scale",
{ x = math.floor(20 * hud_element.value / quests.registered_quests[hud_element.name].max),
y = 1})
end
end
if (i ~= j) then
Expand Down Expand Up @@ -155,13 +157,12 @@ function quests.update_hud(playername)
position = { x = hud_config.position.x, y = hud_config.position.y },
offset = { x = hud_config.offset.x, y = hud_config.offset.y + counter * 40 + 22 },
text = "quests_questbar_background.png" })
id_bar = player:hud_add({hud_elem_type = "statbar",
scale = { x = 1, y = 1 },
-- size = { x = 2, y = 4 },
id_bar = player:hud_add({hud_elem_type = "image",
scale = { x = math.floor(20 * questspecs.value / quests.registered_quests[questname].max),
y = 1 },
alignment = { x = 1, y = 1 },
position = { x = hud_config.position.x, y = hud_config.position.y },
offset = { x = hud_config.offset.x + 2, y = hud_config.offset.y + counter * 40 + 24 },
number = math.floor(40 * questspecs.value / quests.registered_quests[questname].max),
text = "quests_questbar.png" })
end

Expand Down

0 comments on commit f696cb1

Please sign in to comment.