Add legacy_inventory setting (disabled by default)
This commit is contained in:
parent
382ff397a5
commit
cacb9a29fd
6
init.lua
6
init.lua
|
@ -9,8 +9,6 @@ end
|
||||||
i3 = {
|
i3 = {
|
||||||
modules = {},
|
modules = {},
|
||||||
MAX_FAVS = 6,
|
MAX_FAVS = 6,
|
||||||
INV_SIZE = 4*9,
|
|
||||||
HOTBAR_LEN = 9,
|
|
||||||
ITEM_BTN_SIZE = 1.1,
|
ITEM_BTN_SIZE = 1.1,
|
||||||
DROP_BAG_ON_DIE = true,
|
DROP_BAG_ON_DIE = true,
|
||||||
MIN_FORMSPEC_VERSION = 4,
|
MIN_FORMSPEC_VERSION = 4,
|
||||||
|
@ -75,9 +73,13 @@ i3 = {
|
||||||
},
|
},
|
||||||
|
|
||||||
progressive_mode = core.settings:get_bool"i3_progressive_mode",
|
progressive_mode = core.settings:get_bool"i3_progressive_mode",
|
||||||
|
legacy_inventory = core.settings:get_bool"i3_legacy_inventory",
|
||||||
item_compression = core.settings:get_bool("i3_item_compression", true),
|
item_compression = core.settings:get_bool("i3_item_compression", true),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
i3.HOTBAR_LEN = i3.legacy_inventory and 8 or 9
|
||||||
|
i3.INV_SIZE = 4 * i3.HOTBAR_LEN
|
||||||
|
|
||||||
i3.files.common()
|
i3.files.common()
|
||||||
i3.files.api(http)
|
i3.files.api(http)
|
||||||
i3.files.compress()
|
i3.files.compress()
|
||||||
|
|
|
@ -3,3 +3,6 @@ i3_progressive_mode (Learn crafting recipes progressively) bool false
|
||||||
|
|
||||||
# Regroup the items of the same type in the item list.
|
# Regroup the items of the same type in the item list.
|
||||||
i3_item_compression (Regroup items of the same type) bool true
|
i3_item_compression (Regroup items of the same type) bool true
|
||||||
|
|
||||||
|
# Set the inventory size to common chests size (8*4).
|
||||||
|
i3_legacy_inventory (Legacy inventory size) bool false
|
|
@ -539,7 +539,7 @@ local function sort_inventory(player, data)
|
||||||
local inv = player:get_inventory()
|
local inv = player:get_inventory()
|
||||||
local list = inv:get_list"main"
|
local list = inv:get_list"main"
|
||||||
local size = inv:get_size"main"
|
local size = inv:get_size"main"
|
||||||
local start_i = data.ignore_hotbar and 10 or 1
|
local start_i = data.ignore_hotbar and (i3.HOTBAR_LEN + 1) or 1
|
||||||
|
|
||||||
if true_table(data.drop_items) then
|
if true_table(data.drop_items) then
|
||||||
list = drop_items(player, inv, list, start_i, data.drop_items)
|
list = drop_items(player, inv, list, start_i, data.drop_items)
|
||||||
|
|
|
@ -122,7 +122,9 @@ local function get_stack_max(inv, data, is_recipe, rcp)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function get_inv_slots(fs)
|
local function get_inv_slots(fs)
|
||||||
local inv_x, inv_y, size, spacing = 0.22, 6.9, 1, 0.1
|
local inv_x = i3.legacy_inventory and 0.75 or 0.22
|
||||||
|
local inv_y = 6.9
|
||||||
|
local size, spacing = 1, 0.1
|
||||||
|
|
||||||
fs"style_type[box;colors=#77777710,#77777710,#777,#777]"
|
fs"style_type[box;colors=#77777710,#77777710,#777,#777]"
|
||||||
|
|
||||||
|
|
|
@ -34,11 +34,13 @@ local function init_hud(player)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if not i3.legacy_inventory then
|
||||||
core.after(0, function()
|
core.after(0, function()
|
||||||
player:hud_set_hotbar_itemcount(i3.HOTBAR_LEN)
|
player:hud_set_hotbar_itemcount(i3.HOTBAR_LEN)
|
||||||
player:hud_set_hotbar_image"i3_hotbar.png"
|
player:hud_set_hotbar_image"i3_hotbar.png"
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local function show_hud(player, data)
|
local function show_hud(player, data)
|
||||||
-- It would better to have an engine function `hud_move` to only need
|
-- It would better to have an engine function `hud_move` to only need
|
||||||
|
|
Ŝarĝante…
Reference in New Issue