Merge branch 'fancy_hotbar_9271_fixed' into dev
Before Width: | Height: | Size: 118 B After Width: | Height: | Size: 112 B |
@ -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({
|
||||
|
@ -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({
|
||||
|
@ -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({
|
||||
|
Before Width: | Height: | Size: 6.2 KiB After Width: | Height: | Size: 1.3 KiB |
BIN
mods/nc_player_hud/textures/nc_player_hud_bar_burn.png
Normal file
After Width: | Height: | Size: 2.6 KiB |
BIN
mods/nc_player_hud/textures/nc_player_hud_bar_injury.png
Normal file
After Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.6 KiB |
BIN
mods/nc_player_hud/textures/nc_player_hud_sel_burn.png
Normal file
After Width: | Height: | Size: 2.7 KiB |
BIN
mods/nc_player_hud/textures/nc_player_hud_sel_injury.png
Normal file
After Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 90 KiB After Width: | Height: | Size: 58 KiB |