diff --git a/mods/nc_lux/radiation.lua b/mods/nc_lux/radiation.lua
index 84f493d6..c5be81e2 100644
--- a/mods/nc_lux/radiation.lua
+++ b/mods/nc_lux/radiation.lua
@@ -12,8 +12,8 @@ local irradiated = modname .. ":irradiated"
minetest.register_craftitem(irradiated, {
description = "Burn",
stack_max = 1,
- inventory_image = modname .. "_base.png^[mask:"
- .. modname .. "_icon_mask.png",
+ inventory_image = "[combine:1x1",
+ hotbar_type = "burn",
wield_image = hand.wield_image,
wield_scale = hand.wield_scale,
on_drop = function(stack) return stack end,
diff --git a/mods/nc_player_health/injury.lua b/mods/nc_player_health/injury.lua
index ea713636..8940a654 100644
--- a/mods/nc_player_health/injury.lua
+++ b/mods/nc_player_health/injury.lua
@@ -10,7 +10,8 @@ local injured = modname .. ":injured"
minetest.register_craftitem(injured, {
description = "Injury",
stack_max = 1,
- inventory_image = modname .. "_injured.png",
+ inventory_image = "[combine:1x1",
+ hotbar_type = "injury",
wield_image = hand.wield_image,
wield_scale = hand.wield_scale,
on_drop = function(stack) return stack end,
diff --git a/mods/nc_player_hud/setup.lua b/mods/nc_player_hud/setup.lua
index 2eda212d..c3a72bf7 100644
--- a/mods/nc_player_hud/setup.lua
+++ b/mods/nc_player_hud/setup.lua
@@ -1,10 +1,12 @@
-- LUALOCALS < ---------------------------------------------------------
-local math, minetest, nodecore, pairs
- = math, minetest, nodecore, pairs
+local math, minetest, nodecore
+ = math, minetest, nodecore
local math_floor
= math.floor
-- LUALOCALS > ---------------------------------------------------------
+local hotbar_slots = 8
+
local function breathimg(br)
local o = 255 * (1 - br / 11)
if o == 0 then return "" end
@@ -34,11 +36,51 @@ end
minetest.register_on_priv_grant(grantrevoke)
minetest.register_on_priv_revoke(grantrevoke)
+local hotbars = {}
+
+local bar_scale = 32
+local function sethotbar(player)
+ local bar = "[combine:" .. (hotbar_slots * bar_scale) .. "x" .. bar_scale
+ local sel = "nc_player_hud_sel"
+ local inv = player:get_inventory()
+ for i = 1, hotbar_slots do
+ local img = "nc_player_hud_bar"
+ local stack = inv:get_stack("main", i)
+ local def = stack and (not stack:is_empty()) and stack:get_definition()
+ if def and def.hotbar_type then
+ img = img .. "_" .. def.hotbar_type
+ if i == player:get_wield_index() then
+ sel = sel .. "_" .. def.hotbar_type
+ end
+ end
+ bar = bar .. ":" .. (i * bar_scale - bar_scale) .. ",0=" .. img
+ .. ".png"--\\^[resize\\:" .. bar_scale .. "x" .. bar_scale
+ end
+ sel = sel .. ".png^[resize:" .. bar_scale .. "x" .. bar_scale
+
+ local pname = player:get_player_name()
+ local old = hotbars[pname]
+ if not old then
+ old = {}
+ hotbars[pname] = old
+ end
+ if old.bar ~= bar then
+ player:hud_set_hotbar_image(bar)
+ old.bar = bar
+ end
+ if old.sel ~= sel then
+ player:hud_set_hotbar_selected_image(sel)
+ old.sel = sel
+ end
+end
+
+minetest.register_on_leaveplayer(function(player)
+ hotbars[player:get_player_name()] = nil
+ end)
+
minetest.register_on_joinplayer(function(player)
sethudflags(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")
+ sethotbar(player)
if not minetest.settings:get_bool("enable_damage") then
player:set_breath(11)
@@ -61,5 +103,6 @@ minetest.register_globalstep(function()
label = "breath",
text = breathimg(player:get_breath())
})
+ sethotbar(player)
end
end)
diff --git a/mods/nc_player_hud/textures/nc_player_hud_bar.png b/mods/nc_player_hud/textures/nc_player_hud_bar.png
index 7bb836cb..96d03d31 100644
Binary files a/mods/nc_player_hud/textures/nc_player_hud_bar.png and b/mods/nc_player_hud/textures/nc_player_hud_bar.png differ
diff --git a/mods/nc_player_hud/textures/nc_player_hud_bar_burn.png b/mods/nc_player_hud/textures/nc_player_hud_bar_burn.png
new file mode 100644
index 00000000..1dc9663b
Binary files /dev/null and b/mods/nc_player_hud/textures/nc_player_hud_bar_burn.png differ
diff --git a/mods/nc_player_hud/textures/nc_player_hud_bar_injury.png b/mods/nc_player_hud/textures/nc_player_hud_bar_injury.png
new file mode 100644
index 00000000..00eab225
Binary files /dev/null and b/mods/nc_player_hud/textures/nc_player_hud_bar_injury.png differ
diff --git a/mods/nc_player_hud/textures/nc_player_hud_sel.png b/mods/nc_player_hud/textures/nc_player_hud_sel.png
index bc62589f..e410d6a7 100644
Binary files a/mods/nc_player_hud/textures/nc_player_hud_sel.png and b/mods/nc_player_hud/textures/nc_player_hud_sel.png differ
diff --git a/mods/nc_player_hud/textures/nc_player_hud_sel_burn.png b/mods/nc_player_hud/textures/nc_player_hud_sel_burn.png
new file mode 100644
index 00000000..172e449f
Binary files /dev/null and b/mods/nc_player_hud/textures/nc_player_hud_sel_burn.png differ
diff --git a/mods/nc_player_hud/textures/nc_player_hud_sel_injury.png b/mods/nc_player_hud/textures/nc_player_hud_sel_injury.png
new file mode 100644
index 00000000..0ccae6af
Binary files /dev/null and b/mods/nc_player_hud/textures/nc_player_hud_sel_injury.png differ
diff --git a/mods/nc_player_hud/textures/src/huds.svg b/mods/nc_player_hud/textures/src/huds.svg
index 097921be..45967ab9 100644
--- a/mods/nc_player_hud/textures/src/huds.svg
+++ b/mods/nc_player_hud/textures/src/huds.svg
@@ -10,12 +10,12 @@
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
- width="292.05151mm"
- height="76.025345mm"
- viewBox="0 0 292.05152 76.025346"
+ width="103.83915mm"
+ height="146.90298mm"
+ viewBox="0 0 103.83915 146.90299"
version="1.1"
id="svg8"
- inkscape:version="0.92.1 r15371"
+ inkscape:version="0.92.4 (5da689c313, 2019-01-14)"
sodipodi:docname="huds.svg">
@@ -43,133 +43,12 @@
offset="1"
id="stop4544" />
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ style="color-interpolation-filters:sRGB"
+ id="filter3752"
+ x="-0.05941727"
+ width="1.1188345"
+ y="-0.060594272"
+ height="1.1211885">
+
+
+ inkscape:snap-center="true"
+ inkscape:window-width="1366"
+ inkscape:window-height="718"
+ inkscape:window-x="0"
+ inkscape:window-y="21"
+ inkscape:window-maximized="1" />
@@ -746,1163 +514,463 @@
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
- transform="translate(184.98757,-176.70911)">
+ transform="translate(201.57008,-217.93825)">
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ inkscape:export-xdpi="395.28"
+ inkscape:export-ydpi="395.28">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
+ inkscape:export-ydpi="494.09723"
+ transform="translate(0,95.524079)">
+ inkscape:connector-curvature="0" />
+ inkscape:connector-curvature="0" />
+ inkscape:connector-curvature="0" />
+ inkscape:connector-curvature="0" />
+ inkscape:connector-curvature="0" />
+ inkscape:connector-curvature="0" />
+ inkscape:connector-curvature="0" />
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+ style="fill:none;stroke:#000000;stroke-width:0.69999999;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;filter:url(#filter3752)"
+ d="m -131.35229,350.83862 17.06541,-6.23442 c 0,0 3.04161,-20.98105 0.73969,-15.85024 -2.30192,5.1308 -5.04455,3.13397 -6.12876,5.70608 -1.17692,2.79206 2.35712,6.94823 0.21133,9.08747 -0.94821,0.94531 -3.18208,0.94234 -4.01539,-0.10567 -1.20807,-1.51934 2.08386,-3.99768 1.16235,-5.70608 -0.36019,-0.66777 -1.36364,-0.96189 -2.11336,-0.84535 -0.76649,0.11914 -1.05942,1.72148 -1.79636,1.47935 -2.64066,-0.8676 0.56342,-7.10829 -2.03865,-8.08555 -1.57477,-0.59144 -3.58602,1.28656 -4.15,2.87136 -1.15764,3.25299 4.48888,6.895 2.87999,9.95008 -0.34901,0.66273 -1.44514,1.00185 -2.13326,0.70601 -1.17977,-0.50722 -0.37285,-3.70817 -1.63786,-3.48706 -3.00603,0.52542 4.64058,7.57264 -0.85045,9.11522 -5.49103,1.54258 2.80532,1.3988 2.80532,1.3988 z"
+ id="path3422-5"
+ clip-path="url(#clipPath3700)"
+ inkscape:connector-curvature="0" />