Compare commits

...

5 Commits

Author SHA1 Message Date
Gerold55 1c75c451d0
Merge pull request #1 from Aurailus/master
Replace thumbnail with screenshot
2017-12-24 22:26:25 -05:00
Aurailus a2b9f1a287 Replace thumbnail with screenshot 2017-12-24 16:55:01 -08:00
Aurailus 08aa1a75bc Add MTBox Meta 2017-12-14 17:59:40 -08:00
Aurailus 29279acf6a Fix some bugs and add some featurex 2017-11-21 22:04:23 -08:00
Aurailus 6eb4dde2e0 Temporarily disable recipe book, fix skin and messaging crashes yay 2017-11-12 19:59:31 -08:00
24 changed files with 102 additions and 65 deletions

5
MTBOX.md Normal file
View File

@ -0,0 +1,5 @@
*Finally, an Inventory Mod that Doesn't Suck!*
AuriInventory is the final inventory mod. Clean. Simple. Expandable. Yours. It has built in support for homes, bags, and messaging, and it integrates with the AuriSkins mod for skin support. It also features a recipe book and creative menu on the right hand side.
(Images coming soon)

14
README.md Normal file
View File

@ -0,0 +1,14 @@
# AuriInventory
*Finally, an Inventory Mod that Doesn't Suck!*
AuriInventory is the final inventory mod. Clean. Simple. Expandable. Yours. It has built in support for homes, bags, and messaging, and it integrates with the AuriSkins mod for skin support. It also features a recipe book and creative menu on the right hand side.
If you're interested, check out the API.md (NYI) document for how to make your own add-on for the mod.
Todo:
- Toggle between cheat and recipe mode
- Teleport button in homes menu
- Search bar
- Messaging
- API.lua

View File

@ -33,7 +33,8 @@ 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 cheat = player:get_attribute("cheatitems") or false
local cheat = true
local inv_size = 6*10
local page = tonumber(player:get_attribute("rbook_page"))

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)

BIN
preview.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 252 KiB

View File

@ -1,30 +1,62 @@
local function spairs(t, order)
-- collect the keys
local keys = {}
for k in pairs(t) do keys[#keys+1] = k end
--[[
Ordered table iterator, allow to iterate on the natural order of the keys of a
table.
-- if order function given, sort by it by passing the table and keys a, b,
-- otherwise just sort the keys
if order then
table.sort(keys, function(a,b) return order(t, a, b) end)
else
table.sort(keys)
end
Example:
]]
-- return the iterator function
local i = 0
return function()
i = i + 1
if keys[i] then
return keys[i], t[keys[i]]
local function __genOrderedIndex( t )
local orderedIndex = {}
for key in pairs(t) do
table.insert( orderedIndex, key )
end
end
table.sort( orderedIndex )
return orderedIndex
end
local function orderedNext(t, state)
-- Equivalent of the next function, but returns the keys in the alphabetic
-- order. We use a temporary ordered key table that is stored in the
-- table being iterated.
local key = nil
--print("orderedNext: state = "..tostring(state) )
if state == nil then
-- the first time, generate the index
t.__orderedIndex = __genOrderedIndex( t )
key = t.__orderedIndex[1]
else
-- fetch the next value
for i = 1,table.getn(t.__orderedIndex) do
if t.__orderedIndex[i] == state then
key = t.__orderedIndex[i+1]
end
end
end
if key then
return key, t[key]
end
-- no more value to return, cleanup
t.__orderedIndex = nil
return
end
local function orderedPairs(t)
-- Equivalent of the pairs() function on tables. Allows to iterate
-- in order
return orderedNext, t, nil
end
--[[
Register recipebook items
iterate through all items and return an ordered list
]]
function auriinventory.load_recipebook_and_reload()
local titems = {}
--Get item list oboi
for key, val in pairs(minetest.registered_items) do
for key, val in orderedPairs(minetest.registered_items) do
if key and key ~= "" and key ~= nil then
if not val.groups.not_in_creative_inventory then
table.insert(titems, key)
@ -32,39 +64,8 @@ function auriinventory.load_recipebook_and_reload()
end
end
end
for x, y in spairs(titems, function(t, a, b)
return string.byte(string.sub(t[b], string.find(t[b], ":", 1)+1, string.find(t[b], ":", 1)+1))
< string.byte(string.sub(t[a], string.find(t[a], ":", 1)+1, string.find(t[a], ":", 1)+1),1)
end) do
table.insert(auriinventory.items, y)
end
titems = auriinventory.items
auriinventory.items = {}
for x, y in spairs(titems, function(t, a, b)
local ind = 1
while true do
local sA = string.sub(t[a], 1, string.find(t[a], ":", 1) - 1)
local sB = string.sub(t[b], 1, string.find(t[b], ":", 1) - 1)
if not string.byte(sA, ind) then return true end
if not string.byte(sB, ind) then return false end
if ind >= math.max(string.len(sA),string.len(sB)) then return nil end
if string.byte(sB,ind) > string.byte(sA,ind) then
return true
elseif string.byte(sB,ind) < string.byte(sA,ind) then
return false
end
ind = ind + 1
end
end) do
table.insert(auriinventory.items, y)
end
auriinventory.items = titems;
print("Auriinventory Initialized with " .. auriinventory.itemcount .. " items.")

BIN
screenshot.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

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