From 6eb4dde2e0ae1f8630c149455cc688efe74984cf Mon Sep 17 00:00:00 2001 From: Aurailus <100Toby1@gmail.com> Date: Sun, 12 Nov 2017 19:59:31 -0800 Subject: [PATCH] Temporarily disable recipe book, fix skin and messaging crashes yay --- fragments.lua | 73 ++++++++++++----------- init.lua | 8 +++ inventories/formspec_bags.lua | 2 +- inventories/formspec_messaging.lua | 30 ++++++---- textures/auriinventory_small_icon.pyxel | Bin 3401 -> 4428 bytes textures/auriinventory_small_icon_00.png | Bin 0 -> 108 bytes textures/auriinventory_small_icon_01.png | Bin 0 -> 114 bytes textures/auriinventory_small_icon_02.png | Bin 0 -> 107 bytes textures/auriinventory_small_icon_03.png | Bin 0 -> 112 bytes textures/auriinventory_small_icon_04.png | Bin 0 -> 116 bytes textures/auriinventory_small_icon_05.png | Bin 0 -> 121 bytes textures/auriinventory_small_icon_06.png | Bin 0 -> 112 bytes textures/auriinventory_small_icon_07.png | Bin 0 -> 118 bytes textures/auriinventory_small_icon_08.png | Bin 0 -> 113 bytes textures/auriinventory_small_icon_09.png | Bin 0 -> 118 bytes textures/auriinventory_small_icon_10.png | Bin 0 -> 108 bytes textures/auriinventory_small_icon_11.png | Bin 0 -> 106 bytes textures/auriinventory_small_icon_12.png | Bin 0 -> 114 bytes textures/auriinventory_small_icon_13.png | Bin 0 -> 112 bytes 19 files changed, 66 insertions(+), 47 deletions(-) create mode 100644 textures/auriinventory_small_icon_00.png create mode 100644 textures/auriinventory_small_icon_01.png create mode 100644 textures/auriinventory_small_icon_02.png create mode 100644 textures/auriinventory_small_icon_03.png create mode 100644 textures/auriinventory_small_icon_04.png create mode 100644 textures/auriinventory_small_icon_05.png create mode 100644 textures/auriinventory_small_icon_06.png create mode 100644 textures/auriinventory_small_icon_07.png create mode 100644 textures/auriinventory_small_icon_08.png create mode 100644 textures/auriinventory_small_icon_09.png create mode 100644 textures/auriinventory_small_icon_10.png create mode 100644 textures/auriinventory_small_icon_11.png create mode 100644 textures/auriinventory_small_icon_12.png create mode 100644 textures/auriinventory_small_icon_13.png diff --git a/fragments.lua b/fragments.lua index 0871bdd..a048c85 100644 --- a/fragments.lua +++ b/fragments.lua @@ -32,39 +32,42 @@ auriinventory.fragments["back"] = [[ ]] function auriinventory.gen_fragment_recipebook(player) - if not player:get_attribute("rbook_page") then player:set_attribute("rbook_page", 0) end - local cheat = player:get_attribute("cheatitems") or false - - local inv_size = 6*10 - local page = tonumber(player:get_attribute("rbook_page")) - if page < 0 then - player:set_attribute("rbook_page",0) - page = 0 - end - if page*inv_size > auriinventory.itemcount then - page = math.floor(auriinventory.itemcount / inv_size) - player:set_attribute("rbook_page",page) - end - local start_index = page * inv_size - - local ind = 1 - local fs = "label[12.6,0;Registered Items (" .. page+1 .. "/" .. math.floor(auriinventory.itemcount/inv_size)+1 .. ")]" - for j = 0, 9 do - for i = 0, 5 do - if auriinventory.items[start_index + ind] then - if cheat then - fs = fs .. "item_image_button[" .. (12.6 + i*0.65) .. "," .. (0.45 + j*0.7) .. ";0.8,0.8;" .. auriinventory.items[start_index + ind] .. ";rbook_item_give_" .. (start_index + ind) .. ";]" - else - fs = fs .. "item_image_button[" .. (12.6 + i*0.65) .. "," .. (0.45 + j*0.7) .. ";0.8,0.8;" .. auriinventory.items[start_index + ind] .. ";rbook_item_recipe_" .. (start_index + ind) .. ";]" - end - end - ind = ind + 1 - end - end - fs = fs .. "image_button[12.6,7.45;0.7,0.8;auriinventory_recipebook_icon_6.png;rbook_firstpage;;false;false;auriinventory_recipebook_icon_7.png]" - fs = fs .. "image_button[13.1,7.45;0.7,0.8;auriinventory_recipebook_icon_0.png;rbook_prevpage;;false;false;auriinventory_recipebook_icon_1.png]" - fs = fs .. "field[13.88,7.99;2.1,0.23;rbook_search;;]" - fs = fs .. "image_button[15.45,7.45;0.7,0.8;auriinventory_recipebook_icon_2.png;rbook_nextpage;;false;false;auriinventory_recipebook_icon_3.png]" - fs = fs .. "image_button[15.95,7.45;0.7,0.8;auriinventory_recipebook_icon_8.png;rbook_lastpage;;false;false;auriinventory_recipebook_icon_9.png]" - return fs + return '[]' end + +-- if not player:get_attribute("rbook_page") then player:set_attribute("rbook_page", 0) end +-- local cheat = player:get_attribute("cheatitems") or false + +-- local inv_size = 6*10 +-- local page = tonumber(player:get_attribute("rbook_page")) +-- if page < 0 then +-- player:set_attribute("rbook_page",0) +-- page = 0 +-- end +-- if page*inv_size > auriinventory.itemcount then +-- page = math.floor(auriinventory.itemcount / inv_size) +-- player:set_attribute("rbook_page",page) +-- end +-- local start_index = page * inv_size + +-- local ind = 1 +-- local fs = "label[12.6,0;Registered Items (" .. page+1 .. "/" .. math.floor(auriinventory.itemcount/inv_size)+1 .. ")]" +-- for j = 0, 9 do +-- for i = 0, 5 do +-- if auriinventory.items[start_index + ind] then +-- if cheat then +-- fs = fs .. "item_image_button[" .. (12.6 + i*0.65) .. "," .. (0.45 + j*0.7) .. ";0.8,0.8;" .. auriinventory.items[start_index + ind] .. ";rbook_item_give_" .. (start_index + ind) .. ";]" +-- else +-- fs = fs .. "item_image_button[" .. (12.6 + i*0.65) .. "," .. (0.45 + j*0.7) .. ";0.8,0.8;" .. auriinventory.items[start_index + ind] .. ";rbook_item_recipe_" .. (start_index + ind) .. ";]" +-- end +-- end +-- ind = ind + 1 +-- end +-- end +-- fs = fs .. "image_button[12.6,7.45;0.7,0.8;auriinventory_recipebook_icon_6.png;rbook_firstpage;;false;false;auriinventory_recipebook_icon_7.png]" +-- fs = fs .. "image_button[13.1,7.45;0.7,0.8;auriinventory_recipebook_icon_0.png;rbook_prevpage;;false;false;auriinventory_recipebook_icon_1.png]" +-- fs = fs .. "field[13.88,7.99;2.1,0.23;rbook_search;;]" +-- fs = fs .. "image_button[15.45,7.45;0.7,0.8;auriinventory_recipebook_icon_2.png;rbook_nextpage;;false;false;auriinventory_recipebook_icon_3.png]" +-- fs = fs .. "image_button[15.95,7.45;0.7,0.8;auriinventory_recipebook_icon_8.png;rbook_lastpage;;false;false;auriinventory_recipebook_icon_9.png]" +-- return fs +-- end diff --git a/init.lua b/init.lua index fd37af2..c1a18b1 100644 --- a/init.lua +++ b/init.lua @@ -108,6 +108,14 @@ minetest.register_on_player_receive_fields(function(player, formname, fields) end end + if fields.messages then + local datatable = minetest.explode_textlist_event(fields.messages) + if datatable.type == "CHG" then + player:set_inventory_formspec(auriinventory.gen_formspec_messaging(player, math.ceil(datatable.index / 2))) + return + end + end + if fields.skinlist then local datatable = minetest.explode_textlist_event(fields.skinlist) if datatable.type == "CHG" then diff --git a/inventories/formspec_bags.lua b/inventories/formspec_bags.lua index 408acf2..22c4b5f 100644 --- a/inventories/formspec_bags.lua +++ b/inventories/formspec_bags.lua @@ -4,7 +4,7 @@ function auriinventory.gen_formspec_bags (player) end local fs = [[ - size[15,8;] + size[17,8;] bgcolor[#222222ee;false] listcolors[#ffffff33;#ffffff55;#888888;#33333399;#ffffff] ]] diff --git a/inventories/formspec_messaging.lua b/inventories/formspec_messaging.lua index 660be40..d8e0cb0 100644 --- a/inventories/formspec_messaging.lua +++ b/inventories/formspec_messaging.lua @@ -1,4 +1,4 @@ -function auriinventory.gen_formspec_messaging (player) +function auriinventory.gen_formspec_messaging (player, index) local fs = [[ size[17,8;] bgcolor[#222222ee;false] @@ -10,21 +10,29 @@ function auriinventory.gen_formspec_messaging (player) label[3,0;Messages] ]] - local playerdata = minetest.deserialize(player:get_attribute("messages")) + local playerdata = minetest.deserialize(player:get_attribute("messages") or {}) fs = fs .. "textlist[3,0.5;3,7.5;messages;" - local first = true - for k, v in pairs(playerdata) do - if not first then fs = fs .. "," else first = false end - if not v.read then fs = fs .. "#ff7777● " end - fs = fs .. v.title .. "," .. "#999999From " .. v.from - v.read = true + if playerdata then + local first = true + for k, v in pairs(playerdata) do + if not first then fs = fs .. "," else first = false end + if not v.read then fs = fs .. "#ff7777● " end + fs = fs .. v.title .. "," .. "#999999From " .. v.from + v.read = true + end + end + fs = fs .. "]" + + if index then + fs = fs .. [[ + textlist[6.5,0.5;5.5,7.5;message;]] .. playerdata[index].message .. [[;-1;true] + image_button[11.4,0.4;0.8,0.8;auriinventory_btn_icon_2.png;delmessage_]] .. index .. [[;;true;false;auriinventory_btn_icon_3.png] + ]] end - player:set_attribute("messages", minetest.serialize(playerdata)) - - fs = fs .. "]textlist[6.5,0.5;5.5,7.5;message;hi,yo,hello0;-1;true]" + player:set_attribute("messages", minetest.serialize(playerdata) or {}) fs = auriinventory.append_fragment(fs, "tabs") fs = fs .. auriinventory.gen_fragment_recipebook(player) diff --git a/textures/auriinventory_small_icon.pyxel b/textures/auriinventory_small_icon.pyxel index 22340f6ebf67709c461f8754e102a8a4d7957c6b..9c951581f93c704a1bce249864bf2b4908c226ee 100644 GIT binary patch delta 2614 zcmZ`*2{@G78~`x*7zc>KTbInR5}_nr6md(U~7bDFlbN;8ONT-*xg z3i`X-EWN5uQ0yHKO-r?QTdbS|cl8Cxf%US2M<$bZRoGt9C{;cD#mAzcSfT7lcJ(XE z@`iGQ7wv>Xu)gt9&#Tgkfu&Ez-9-=7ltPpPckVF{&NF__u%4?W&`yq*2C)g(+?bf~ z`Of3ogZiiJt5NZ_k{&YNuGuGDA5}DVUAQ(8o0S}?NY9$+tu%i%k@TR4IIVl~;_+il z^yHQ2Lv7>(2ls4$Ge3}1b@pP*Mdo(F%3jO?6RkOG_l)WmCM_QMo|@yBKc0KLZ?>AQ zdnd|VV#03fCc`=Y^DwW@^qA@ExeIZ8iC%^yJp=cKS&6>}XYwbH*2(rx(e@4+CHtpZ z=scHAtPk^GC%nV)dFbViA;ub0A0cK4P+R`i0}T|>K) z{iV$_nSJkIAMmo8K^EDRM1Rt$(-4ms!3$BzSy(GZXBI zx>FyGJHW6nzO_ZI`B>Top(1&S;d!0($Ei_O-R?VJL>1yf>6gYBy3wCSW-RNN#utmV zglJp4V7iNFlYMJ;?p)5`btiO@hB#kzM^*xj?jqh0{yuam&xIJ1)7dXf+zHbZgyS)I zBpw$lAiss^mL3+85taxiV-j|g?tJes)_TYUQ4%>U5k_9u83{||BI6RYNk4b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08`)j$& zV(S}O_T7K%+MW4k`H_u$QD-t7IA0cK)UIEAKkq&dB5$D_izzSln6Gc72zCUzWw2uKgU!uL@?*>6bhi`}>C2 zloZV;FS3f0KW&^SUVHye`TqGcK9|jr{m+P+iW&Ijx^6HsFkA*=U_xfdNvupQGSDl? zOJ}^ysPnHgz|WnRO9~{zJGq8gqJEaAi(^Q|t*g^EdL3~PX!|TPO)M&+v(W@dadMe? z1!XK{zc#)cO?rpY1f4<+2Tp%OB)|||sRQY|!riXF$ z`s@BI&GfClR1Hj5(#=HyK$3Oc=U;I!&|P(#-B~NvnxrLeVw{21n)vGt(b$lHI^7 z!F0%hgG2eW%8X*3KHtWAQ?~9+IoOe=Ci#J6%z2lM^8CV}ZET>TP^ zOd<@}%EQSwcy+8nMI?IS0yzr;4gw2KL{bazMlou#J)d;&K^6vvlFXb`a9TuD;H_O5 z6p{}#sR)QUp+-WeKvsx0Lr@Y%(>8f6pS0q0r~)G_3cTl7tO}pp$1lcI$~KviUmWaH zX?|%-PIic?CfGDdWZ$qT1KM7R;h2T&lk=gbbn;8f*l|EiF~efY#cbUwHUk~gg(ez%scH!Hmi?doO_eV!{CO8z6^{0Xr``DTlNa5ox#)9&t;uc GLK6TZ+#-ws literal 0 HcmV?d00001 diff --git a/textures/auriinventory_small_icon_01.png b/textures/auriinventory_small_icon_01.png new file mode 100644 index 0000000000000000000000000000000000000000..1e7ec2001fc3417dce076d416ce3d140cba74db9 GIT binary patch literal 114 zcmeAS@N?(olHy`uVBq!ia0vp^93afW1|*O0@9PFqmYyz-Ar-fh6C9Y;)YSev&R~>g z@XX2nc6=R!%8$B4lQLF=xfP;MRNEU>KSnVIw_Km7;A$b7@L7%F#aizopr E00@*Jvj6}9 literal 0 HcmV?d00001 diff --git a/textures/auriinventory_small_icon_03.png b/textures/auriinventory_small_icon_03.png new file mode 100644 index 0000000000000000000000000000000000000000..bb7cbf6afd33216a1f8071ea367356a48dad7152 GIT binary patch literal 112 zcmeAS@N?(olHy`uVBq!ia0vp^93afW1|*O0@9PFq=AJH&Ar-fh6B?L=g(v@4IMcx0 zpmJZo=h#|~WeL%n?aN#ZSS>^qXHS?e(-zC<=Q)FE&ZHlEI2kspT3igDb@C|C2nJ7A KKbLh*2~7Y}I?fVPaPo&%m%K-?QC5u<{(x O7zR&QKbLh*2~7ZdRwa)B literal 0 HcmV?d00001 diff --git a/textures/auriinventory_small_icon_05.png b/textures/auriinventory_small_icon_05.png new file mode 100644 index 0000000000000000000000000000000000000000..9d575703571fda1274da566f36c51824de782bd0 GIT binary patch literal 121 zcmeAS@N?(olHy`uVBq!ia0vp^93afW1|*O0@9PFq4xTQKAr-fh6BJl{e0=^LHV88m zD74ae_J8v{*8)cYX%)8chBX|KLU~%7{8A`T%>vlu*G{an^LB{Ts5TlFM6 literal 0 HcmV?d00001 diff --git a/textures/auriinventory_small_icon_06.png b/textures/auriinventory_small_icon_06.png new file mode 100644 index 0000000000000000000000000000000000000000..fa099f5342d826e2b0d81f8b477983501dac9c26 GIT binary patch literal 112 zcmeAS@N?(olHy`uVBq!ia0vp^93afW1|*O0@9PFq=AJH&Ar-fh6B-)+TNpTPTDOjm zRau*f`^eFw2U#6+RP5Rq+D!kSJ$sf@n;~&dn1Z%b_!);2vl*5z2&mF4T5<+x1cRrm KpUXO@geCxLFd||A literal 0 HcmV?d00001 diff --git a/textures/auriinventory_small_icon_07.png b/textures/auriinventory_small_icon_07.png new file mode 100644 index 0000000000000000000000000000000000000000..e4907e612f8f7f0d8ec2a86d386d909c2722d3e0 GIT binary patch literal 118 zcmeAS@N?(olHy`uVBq!ia0vp^93afW1|*O0@9PFqww^AIAr-fh6Bw9;g(v^NVZglU zNspv)fI*C)&!%&W0aztYQR?xIIedNQn4+e`#>n1}1@HnXH?XN{;fh?BQgX$q}Ws!1u{qpcxFF Lu6{1-oD!M<7E&bE literal 0 HcmV?d00001 diff --git a/textures/auriinventory_small_icon_09.png b/textures/auriinventory_small_icon_09.png new file mode 100644 index 0000000000000000000000000000000000000000..030ebeb67ffe929d1d22b6b3002761f654adbd77 GIT binary patch literal 118 zcmeAS@N?(olHy`uVBq!ia0vp^93afW1|*O0@9PFqww^AIAr-fh6Bw9;g(v^NVZglU zNx%494T*IeYCFHW8N>)2Y5OR7fz@CQqhKVrEr&Kk;+!xAZKv=v4kuk}1Re~2Vh2s22hY1GLcs+kGY&fw|l=d#Wz Gp$PyMW+5d2 literal 0 HcmV?d00001 diff --git a/textures/auriinventory_small_icon_11.png b/textures/auriinventory_small_icon_11.png new file mode 100644 index 0000000000000000000000000000000000000000..a1c43841272b1f61a84e5bb2d695e7ec9e1eba26 GIT binary patch literal 106 zcmeAS@N?(olHy`uVBq!ia0vp^93afW1|*O0@9PFqhMq2tAr-fh6C4`;2lNR4S-*Pq z;nf^#6!i4?mMd*ws_A+#>DjYqH$)#yX3;*N-g$X8!{tw!^8|NX=mctJ@O1TaS?83{ F1OP|KB#i(7 literal 0 HcmV?d00001 diff --git a/textures/auriinventory_small_icon_12.png b/textures/auriinventory_small_icon_12.png new file mode 100644 index 0000000000000000000000000000000000000000..021cb7ce489e3015b195e6d457d1ab942330a57b GIT binary patch literal 114 zcmeAS@N?(olHy`uVBq!ia0vp^93afW1|*O0@9PFqmYyz-Ar-fh6C9Y;)YSev&R~>g z@Vs*MYGOEp&>X{LwlY?OxfP;EjvsGU{TRg<+;V-Qf~$pS!e=#x(oVBS@4B9+01aXA MboFyt=akR{09pegNB{r; literal 0 HcmV?d00001 diff --git a/textures/auriinventory_small_icon_13.png b/textures/auriinventory_small_icon_13.png new file mode 100644 index 0000000000000000000000000000000000000000..fb389b7d666ddf21f5e286f78e0f34f602786302 GIT binary patch literal 112 zcmeAS@N?(olHy`uVBq!ia0vp^93afW1|*O0@9PFq=AJH&Ar-fh6B?L=g(v@4IMcx0 zppt%OMq{*~k7I1CY?-S8tA(iIYyo-s{#Zso&lyZ}CjHpM$sn=7{7l|tm9s!27(8A5 KT-G@yGywqJV;<%J literal 0 HcmV?d00001