Merge branch 'fancy_hotbar_9271_fixed' into dev

This commit is contained in:
Aaron Suen 2020-09-04 12:35:20 -04:00
commit 7c985e9bd5
11 changed files with 729 additions and 1632 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 118 B

After

Width:  |  Height:  |  Size: 112 B

View File

@ -10,8 +10,8 @@ local modname = minetest.get_current_modname()
local irradiated = modname .. ":irradiated"
nodecore.register_virtual_item(irradiated, {
description = "Burn",
inventory_image = modname .. "_base.png^[mask:"
.. modname .. "_icon_mask.png",
inventory_image = "[combine:1x1",
hotbar_type = "burn",
})
nodecore.register_healthfx({

View File

@ -8,7 +8,8 @@ local modname = minetest.get_current_modname()
local injured = modname .. ":injured"
nodecore.register_virtual_item(injured, {
description = "Injury",
inventory_image = modname .. "_injured.png"
inventory_image = "[combine:1x1",
hotbar_type = "injury",
})
nodecore.register_healthfx({

View File

@ -1,14 +1,42 @@
-- LUALOCALS < ---------------------------------------------------------
local math, nodecore
= math, nodecore
local math, minetest, nodecore
= math, minetest, nodecore
local math_floor
= math.floor
-- LUALOCALS > ---------------------------------------------------------
local modname = minetest.get_current_modname()
local hotbar_slots = 8
local bar_scale = 32
nodecore.register_playerstep({
label = "hotbar images",
action = function(player, data)
local bar = "[combine:" .. (hotbar_slots * bar_scale) .. "x" .. bar_scale
local inv = player:get_inventory()
for i = 1, hotbar_slots do
local stack = inv:get_stack("main", i)
local def = stack and (not stack:is_empty()) and stack:get_definition()
local suff = (i == player:get_wield_index()) and "_sel" or "_bar"
if def and def.hotbar_type then
suff = suff .. "_" .. def.hotbar_type
end
bar = bar .. ":" .. (i * bar_scale - bar_scale) .. ",0="
.. modname .. suff .. ".png\\^[resize\\:" .. bar_scale
.. "x" .. bar_scale
end
if data.hotbar ~= bar then
data.hotbar = bar
player:hud_set_hotbar_image(bar)
end
end
})
nodecore.register_on_joinplayer("setup hotbar", function(player)
player:hud_set_hotbar_itemcount(8)
player:hud_set_hotbar_image("nc_player_hud_bar.png")
player:hud_set_hotbar_selected_image("nc_player_hud_sel.png")
player:hud_set_hotbar_itemcount(hotbar_slots)
player:hud_set_hotbar_selected_image("[combine:1x1")
end)
nodecore.register_playerstep({

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.2 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

File diff suppressed because it is too large Load Diff

Before

Width:  |  Height:  |  Size: 90 KiB

After

Width:  |  Height:  |  Size: 58 KiB