Temporarily disable recipe book, fix skin and messaging crashes yay

master
Aurailus 2017-11-12 19:59:31 -08:00
parent e252db0a53
commit 6eb4dde2e0
19 changed files with 66 additions and 47 deletions

View File

@ -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

View File

@ -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

View File

@ -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]
]]

View File

@ -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)

Binary file not shown.

After

Width:  |  Height:  |  Size: 108 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 114 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 107 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 112 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 116 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 121 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 112 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 118 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 113 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 118 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 108 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 106 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 114 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 112 B