From 57b65bd350a92009b8aae3df4e500d747eec25ca Mon Sep 17 00:00:00 2001 From: sys4-fr Date: Fri, 7 Sep 2018 23:06:49 +0200 Subject: [PATCH] Version MFF. --- README.txt | 0 depends.txt | 2 +- description.txt | 0 init.lua | 30 ++++++++++++++-------- textures/inventory_icon_backpack_free.png | Bin 386 -> 348 bytes textures/inventory_icon_backpack_full.png | Bin 720 -> 345 bytes textures/inventory_icon_bags_large.png | Bin 670 -> 660 bytes textures/inventory_icon_bags_medium.png | Bin 922 -> 836 bytes textures/inventory_icon_bags_small.png | Bin 699 -> 625 bytes 9 files changed, 20 insertions(+), 12 deletions(-) mode change 100644 => 100755 README.txt mode change 100644 => 100755 depends.txt mode change 100644 => 100755 description.txt mode change 100644 => 100755 init.lua mode change 100644 => 100755 textures/inventory_icon_backpack_free.png mode change 100644 => 100755 textures/inventory_icon_backpack_full.png mode change 100644 => 100755 textures/inventory_icon_bags_large.png mode change 100644 => 100755 textures/inventory_icon_bags_medium.png mode change 100644 => 100755 textures/inventory_icon_bags_small.png diff --git a/README.txt b/README.txt old mode 100644 new mode 100755 diff --git a/depends.txt b/depends.txt old mode 100644 new mode 100755 index 20b7c42..7e882b3 --- a/depends.txt +++ b/depends.txt @@ -1 +1 @@ -unified_inventory? +unified_inventory diff --git a/description.txt b/description.txt old mode 100644 new mode 100755 diff --git a/init.lua b/init.lua old mode 100644 new mode 100755 index e9e4e14..2809673 --- a/init.lua +++ b/init.lua @@ -16,7 +16,15 @@ function inventory_icon.get_inventory_state(inv, listname) end function inventory_icon.replace_icon(name) - return "inventory_icon_"..name + local icon = "" + if name:find("small") then + icon = "inventory_icon_bags_small.png" + elseif name:find("medium") then + icon = "inventory_icon_bags_medium.png" + elseif name:find("large") then + icon = "inventory_icon_bags_large.png" + end + return icon end minetest.register_on_joinplayer(function(player) @@ -60,7 +68,7 @@ minetest.register_on_joinplayer(function(player) scale = { x = 1, y = 1 } local occupied, size = inventory_icon.get_inventory_state(player:get_inventory(), "bag"..i.."contents") text = string.format("%d/%d", occupied, size) - icon = inventory_icon.replace_icon(minetest.registered_items[bag:get_name()].inventory_image) + icon = inventory_icon.replace_icon(bag:get_name()) if occupied >= size then icon = icon .. "^" .. inventory_icon.COLORIZE_STRING end @@ -91,12 +99,11 @@ minetest.register_on_leaveplayer(function(player) inventory_icon.hudids[player:get_player_name()] = nil end) -inventory_icon.timer = 0 -minetest.register_globalstep(function(dtime) - inventory_icon.timer = inventory_icon.timer + dtime - if inventory_icon.timer > 1 then - for playername,hudids in pairs(inventory_icon.hudids) do - local player = minetest.get_player_by_name(playername) +local function tick() + minetest.after(1, tick) + for playername,hudids in pairs(inventory_icon.hudids) do + local player = minetest.get_player_by_name(playername) + if player then local occupied, size = inventory_icon.get_inventory_state(player:get_inventory(), "main") local icon, color if occupied >= size then @@ -120,7 +127,7 @@ minetest.register_globalstep(function(dtime) scale = { x = 1, y = 1 } local occupied, size = inventory_icon.get_inventory_state(player:get_inventory(), "bag"..i.."contents") text = string.format("%d/%d", occupied, size) - icon = inventory_icon.replace_icon(minetest.registered_items[bag:get_name()].inventory_image) + icon = inventory_icon.replace_icon(bag:get_name()) if occupied >= size then icon = icon .. "^" .. inventory_icon.COLORIZE_STRING end @@ -133,6 +140,7 @@ minetest.register_globalstep(function(dtime) end end end - inventory_icon.timer = 0 end -end) +end + +tick() diff --git a/textures/inventory_icon_backpack_free.png b/textures/inventory_icon_backpack_free.png old mode 100644 new mode 100755 index 799f712afc1809fef7dcee9e2ef8976cd3da44b3..b58285d68692b02bc51782ea5cc934c5bb6744e6 GIT binary patch delta 286 zcmV+(0pb3F1Ka|T7zqdi0002%urRcdAv1pf@<~KNRCoc6(@~DZAPj@yQRAPv|Bbf+ ztAb`CtzY@%v_X8HXwRpM#BcyQsr&qU=b@-&b{({PsfeGhFzG*iq3GOr7}#}7Ia#Q> z*Y>6g@nVsVfmKYSPl1v`zy&TNU4haVAtWsoOqWpS*trTWBBlbxf*}s~h0rxe=4XG} ztwZ*{;gQJz4|b(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w;sUcvc|+d@K6z6kklk(DWR8@|fQv@Of=F*j0t$F>q* zIz#Ky9DlIT>O|Li-wEzre`NR1v)v@d3p{nemsw^%F0D`o} z0=8e1#g|q*$1xOCIE*n#HwEr5VQOLE1`hoZZ#T4$(%Gt@zhJ;6z&Jm_$OBLu6zrSl zAidOgDW1dLB4M75F@c`a8tZez~=Qw{Smr#z8zin%6H6x`Q^7CeDhq1+xf7tDFe pgpa;b16O70DU)3K&~VAa!~gnB5ksJ5%c%eW002ovPDHLkV1hx8M??Ss diff --git a/textures/inventory_icon_bags_large.png b/textures/inventory_icon_bags_large.png old mode 100644 new mode 100755 index 21da733a4bda5fd9ecca832a67f808b82bd4f7fa..ebe3d91f292515d0e0e136ea3116024d58df7391 GIT binary patch delta 646 zcmV;10(t$O1(XGl8Gi!+002a!ipBr{0XtAkR7C&)000000ssIE1_loY2M`Ab7z_*> z4GkO)4jm2-9u5v65D+5~5hfE8C=?Va6cj2TAS)FWEEX0w8yh$r961~uI~^T79UVL# z9zGr(KOY}JARs{?AVMJ_L?R+ZA|gg3BS<79OC=>uCMHiOCx1~WC{-#dSyfe9EiGIw zE?q7zV=*ygGBRc}GiN|RXf!lwG&FBFH*q*Pb2&M5Iy!edJ9s=icy4ZaJUn_mJ$*ht zem_5cOiX`2KY&0$fO2wxfPjHOK!QO*gF!)qPfvtGLWM#?hC@S#Lqmu}M2ba4i$z6@ zMn;WBMvg~EkAFu;kVr_8NJy7UOPNeen@vrePEMUpPNY&&rBYI=RaLB3R<2i9vsqcS zT3WbVT)A9ax?NqnU0uFkU%+5s!eL>;WMso(VaQ};%VlMXif@zv0004WQchCWu`UEr6b9h$&d%ChhJ;8I#N&v@3x8;|UP+W5z*|VvYAPXYge7a; zb!V<-DKuvM)oJdRb8^oKesZjK>URo%BzzY~25ODu>|es6fvhJA`ua{f3I|4pl2WY@ zESb7=(@rR1fxOM!q|$br12uUGSc(WN$A^fYe^+Y z`jRcLoqvRFNn!5Zrgx>GYdf8UY}wGvn~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@FHPukv01jATtu7sn8b(^D^d`-uh$u+=|!Ut<1umx5!-1LZ*Thi5vq6ZrKm zFiI;Ha&a<0bW`biu=mSvi-5(({iZ7eYkz95Gws>Gqv{y&R1gL+f)2_VOZuii)}`yVy(>8Q!{FVUxX~m_;_ul@m}Y}{hm$%Hzn5O zAbr-<32LrKazf;nz%)PFUp<&5!lt;yAE zSBRLDz5SiyBh(Ql)+#%B#f0i5o5~WsL{4leTC3019hID$>$PXa%>=h)8`Y$6R49c~Na?B|L@*1p61QE{-L$nq#2Ss- zyg12Z%w%4=clKdw%EK^JHv@PxkLmK!3BDhY$Dc$wIEPvj8_I zCx3^k;{DqO{(zy`1mjI`T6s^p!n!f8TRhjQHRRv>f)Qov<`uxb#h54|*Es(o7I=UUIjmA^BeEoX8B?x5W zm!U!-f!|)eN`Kgto~^vPD&!D!X45T=puFB_q(r8s?!tTh{b2XLeeXkGF1G?-j*a~Z zqlXV~gG(n)%(NDP_Mj}feK{yz4GLr3S8Az=ODikuOn)?S|Gw9&W_osZ9_GsBc{p|G z&@T9Ca`G`8J$SIcwFp#$vRC0VlgX^h{flyWo$Di^r;CfA7D%mz>Zk-l-%d=_;EOY7 zmSJz{GL4Q8q zVtpVN+3=$qig!X!SpRtI);&0P?AUf_WHRfN zx6C}SMqn=FdL`sGcDA*XhI)_lz)DaWZ_Rk`Ct-d0^y%I3tW=tTt7BuemYfOK2t1jc zZ9*n=z>S?Px;@59crLm>KEHMsRI8z5o-ZskpnpT|E#Qi_@%00>D%PDHLkV1l@g(0Tv> diff --git a/textures/inventory_icon_bags_small.png b/textures/inventory_icon_bags_small.png old mode 100644 new mode 100755 index 904d48147c22330212f934be0985a702701cfae1..fd370d6460ef70fbfc0fce63ce64655502aa2f8a GIT binary patch delta 611 zcmV-p0-XK31@Q!s8Gi!+002a!ipBr{0W45VR7C&)000009uW~F78WNL7b_tlEFT{& zAt5dt955y(F(M*5EG#@HCp{!2Ln|vsH#b%^G+01DU^zKrL_}viJ!ef#Y(YV7LPBm; zRdGZ_byZb(NJx1|NP0*}dPzxpN=bW4N_qR@dcsioWnqn;AXJd{Q?$8R6m&AY>~}suz#3+*(9h19K+!qm+kIei(=)G zlb-X0-_AMvGjA1sALlM`YV2~_L2+h*wiT%uBc17Qh(N`%qM=m&FX6<*wUS*8SF;Pz z-wugqxtbSE2krxfVgjKn^R4h`|wV@m|!5BT$Zk{{95kb#;O1@o_LUHdc{0Gcf`Bu3TAG?b<=09NnFr3H-Wg6Ua6+ zfXA<1f!DcQCZ;ZaTL|1gdp3bWVeW+Q5PH=W9a)ndPc~er5*z zJu(84QVHzt>3;$Do<9f2dV9g8g9j5hcKdd!HW9dc`g8*6x;ijFH3bG=z62MK9|se| z!{FA#hv37|5Lj3YO>pDr(F6`(y_%{m1R8$|YL*19TQ_bD4mdan^7%ZdONTo&M5O+E z{~okAH-nWeEj8u?Pp|)x1h4;4u|NCiQ{ej9Gq5i9dw=(uHQ>!~;QrA+|ALOz*3cze zwt%;BcAOg+NL9B6CP%|`D;0|s(=HP^-rmsx{*2wwy<GE{6X@Kw735z3RdHU3K2ePCf>K