Compare commits
59 Commits
Author | SHA1 | Date | |
---|---|---|---|
da91223c4d | |||
408267754c | |||
b4de48370a | |||
477efe56d3 | |||
8afb51dae8 | |||
734b09b69f | |||
1560d59d4a | |||
e4e175a775 | |||
7a40f36611 | |||
2467e8bb0b | |||
9666834aed | |||
7670356c8c | |||
646d16afd8 | |||
6b54dbc934 | |||
911bed3911 | |||
75fdd57f2a | |||
c8d6312772 | |||
a4e8fac0e6 | |||
eac4a18df2 | |||
2ddaa4ddfb | |||
56b5cb78f2 | |||
813d27d2cc | |||
52464d4486 | |||
e300539dd3 | |||
2cdd03b127 | |||
8db3fb4a41 | |||
d3ad413876 | |||
6219c2f64e | |||
55d364acae | |||
0a8ae9a3d7 | |||
0e2f233234 | |||
aeeac6ac1b | |||
0c4b4e6c4f | |||
7b31c998de | |||
7ee19e3dc5 | |||
60e21627e1 | |||
7e7422def7 | |||
aa10460886 | |||
cef11f5301 | |||
2297b47dc0 | |||
a67ef8b08b | |||
48ab26b4c6 | |||
1389027a22 | |||
629676a975 | |||
20b8110375 | |||
a3fea93a09 | |||
326ee3e098 | |||
60bdfa34fb | |||
9971b8c3e6 | |||
5a14116b69 | |||
222e04d2c4 | |||
8f4c9f28f1 | |||
37e0c21ca3 | |||
057f0cf03f | |||
dca93b7249 | |||
1e9c3ce55a | |||
1627172cce | |||
bd356e4a40 | |||
f26c6af9c4 |
@ -10,6 +10,7 @@ read_globals = {
|
|||||||
"armor",
|
"armor",
|
||||||
"skins",
|
"skins",
|
||||||
"awards",
|
"awards",
|
||||||
|
"hb",
|
||||||
"vector",
|
"vector",
|
||||||
"string",
|
"string",
|
||||||
"table",
|
"table",
|
||||||
|
38
API.md
@ -21,31 +21,33 @@ i3.new_tab("stuff", {
|
|||||||
end,
|
end,
|
||||||
|
|
||||||
formspec = function(player, data, fs)
|
formspec = function(player, data, fs)
|
||||||
fs("label[3,1;This is just a test]")
|
fs"label[3,1;This is just a test]"
|
||||||
end,
|
end,
|
||||||
|
|
||||||
-- Events handling happens here
|
-- Events handling happens here
|
||||||
fields = function(player, data, fields)
|
fields = function(player, data, fields)
|
||||||
|
if fields.mybutton then
|
||||||
|
do_things()
|
||||||
|
end
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
|
||||||
- `player` is an `ObjectRef` to the user.
|
- `player` is an `ObjectRef` to the user.
|
||||||
- `data` are the user data.
|
- `data` are the user data.
|
||||||
- `fs` is the formspec table which is callable with a metamethod. Each call adds a new entry.
|
- `fs` is the formspec table which is callable with a metamethod. Every call adds a new entry.
|
||||||
|
|
||||||
#### `i3.set_fs(player)`
|
#### `i3.set_fs(player)`
|
||||||
|
|
||||||
Updates the current formspec.
|
Update the current formspec.
|
||||||
|
|
||||||
#### `i3.remove_tab(tabname)`
|
#### `i3.remove_tab(tabname)`
|
||||||
|
|
||||||
Deletes a tab by name.
|
Delete a tab by name.
|
||||||
|
|
||||||
#### `i3.get_current_tab(player)`
|
#### `i3.get_current_tab(player)`
|
||||||
|
|
||||||
Returns the current player tab. `player` is an `ObjectRef` to the user.
|
Return the current player tab. `player` is an `ObjectRef` to the user.
|
||||||
|
|
||||||
#### `i3.set_tab(player[, tabname])`
|
#### `i3.set_tab(player[, tabname])`
|
||||||
|
|
||||||
@ -54,7 +56,7 @@ Sets the current tab by name. `player` is an `ObjectRef` to the user.
|
|||||||
|
|
||||||
#### `i3.override_tab(tabname, def)`
|
#### `i3.override_tab(tabname, def)`
|
||||||
|
|
||||||
Overrides a tab by name. `def` is the tab definition like seen in `i3.set_tab`.
|
Override a tab by name. `def` is the tab definition like seen in `i3.set_tab`
|
||||||
|
|
||||||
#### `i3.tabs`
|
#### `i3.tabs`
|
||||||
|
|
||||||
@ -68,9 +70,11 @@ Custom recipes are nonconventional crafts outside the main crafting grid.
|
|||||||
They can be registered in-game dynamically and have a size beyond 3x3 items.
|
They can be registered in-game dynamically and have a size beyond 3x3 items.
|
||||||
|
|
||||||
**Note:** the registration format differs from the default registration format in everything.
|
**Note:** the registration format differs from the default registration format in everything.
|
||||||
The width is automatically calculated depending where you place the commas. Look at the examples attentively.
|
The width is automatically calculated depending where you place the commas.
|
||||||
|
|
||||||
#### Registering a custom crafting type (example)
|
Examples:
|
||||||
|
|
||||||
|
#### Registering a custom crafting type
|
||||||
|
|
||||||
```Lua
|
```Lua
|
||||||
i3.register_craft_type("digging", {
|
i3.register_craft_type("digging", {
|
||||||
@ -79,7 +83,7 @@ i3.register_craft_type("digging", {
|
|||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Registering a custom crafting recipe (examples)
|
#### Registering a custom crafting recipe
|
||||||
|
|
||||||
```Lua
|
```Lua
|
||||||
i3.register_craft {
|
i3.register_craft {
|
||||||
@ -159,7 +163,7 @@ mode is implemented as a recipe filter.
|
|||||||
|
|
||||||
#### `i3.add_recipe_filter(name, function(recipes, player))`
|
#### `i3.add_recipe_filter(name, function(recipes, player))`
|
||||||
|
|
||||||
Adds a recipe filter with the given `name`. The filter function returns the
|
Add a recipe filter with the given `name`. The filter function returns the
|
||||||
recipes to be displayed, given the available recipes and an `ObjectRef` to the
|
recipes to be displayed, given the available recipes and an `ObjectRef` to the
|
||||||
user. Each recipe is a table of the form returned by
|
user. Each recipe is a table of the form returned by
|
||||||
`minetest.get_craft_recipe`.
|
`minetest.get_craft_recipe`.
|
||||||
@ -181,7 +185,7 @@ end)
|
|||||||
|
|
||||||
#### `i3.set_recipe_filter(name, function(recipe, player))`
|
#### `i3.set_recipe_filter(name, function(recipe, player))`
|
||||||
|
|
||||||
Removes all recipe filters and adds a new one.
|
Remove all recipe filters and add a new one.
|
||||||
|
|
||||||
#### `i3.recipe_filters`
|
#### `i3.recipe_filters`
|
||||||
|
|
||||||
@ -207,7 +211,7 @@ Notes:
|
|||||||
|
|
||||||
#### `i3.add_search_filter(name, function(item, values))`
|
#### `i3.add_search_filter(name, function(item, values))`
|
||||||
|
|
||||||
Adds a search filter.
|
Add a search filter.
|
||||||
The search function must return a boolean value (whether the given item should be listed or not).
|
The search function must return a boolean value (whether the given item should be listed or not).
|
||||||
|
|
||||||
- `name` is the filter name.
|
- `name` is the filter name.
|
||||||
@ -241,7 +245,7 @@ Sorting methods are used to filter the player's main inventory.
|
|||||||
|
|
||||||
#### `i3.add_sorting_method(name, def)`
|
#### `i3.add_sorting_method(name, def)`
|
||||||
|
|
||||||
Adds a player inventory sorting method.
|
Add a player inventory sorting method.
|
||||||
|
|
||||||
- `name` is the method name.
|
- `name` is the method name.
|
||||||
- `def` is the method definition.
|
- `def` is the method definition.
|
||||||
@ -276,7 +280,7 @@ A table containing all sorting methods.
|
|||||||
|
|
||||||
#### `i3.compress(item, def)`
|
#### `i3.compress(item, def)`
|
||||||
|
|
||||||
Adds a new group of items to compress.
|
Add a new group of items to compress.
|
||||||
|
|
||||||
- `item` is the item which represent the group of compressed items.
|
- `item` is the item which represent the group of compressed items.
|
||||||
- `def` is a table specifying the substring replace patterns to be used.
|
- `def` is a table specifying the substring replace patterns to be used.
|
||||||
@ -301,7 +305,7 @@ A map of all compressed item groups, indexed by stereotypes.
|
|||||||
|
|
||||||
#### `i3.hud_notif(name, msg[, img])`
|
#### `i3.hud_notif(name, msg[, img])`
|
||||||
|
|
||||||
Shows a Steam-like HUD notification on the bottom-right corner of the screen (experimental).
|
Show a Steam-like HUD notification on the bottom-right corner of the screen (experimental).
|
||||||
|
|
||||||
- `name` is the player name.
|
- `name` is the player name.
|
||||||
- `msg` is the HUD message to show.
|
- `msg` is the HUD message to show.
|
||||||
@ -309,7 +313,7 @@ Shows a Steam-like HUD notification on the bottom-right corner of the screen (ex
|
|||||||
|
|
||||||
#### `i3.get_recipes(item)`
|
#### `i3.get_recipes(item)`
|
||||||
|
|
||||||
Returns a table of recipes and usages of `item`.
|
Return a table of recipes and usages of `item`.
|
||||||
|
|
||||||
#### `i3.export_url`
|
#### `i3.export_url`
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
This mod features a modern, powerful inventory menu with a good user experience.
|
This mod features a modern, powerful inventory menu with a good user experience.
|
||||||
**`i3`** provides a rich [**API**](https://github.com/minetest-mods/i3/blob/master/API.md) for mod developers who want to extend it.
|
**`i3`** provides a rich [**API**](https://github.com/minetest-mods/i3/blob/master/API.md) for mod developers who want to extend it.
|
||||||
|
|
||||||
This mod requires **Minetest 5.4+**
|
This mod requires **Minetest 5.6+**
|
||||||
|
|
||||||
#### List of features:
|
#### List of features:
|
||||||
- Crafting Guide (survival mode only)
|
- Crafting Guide (survival mode only)
|
||||||
@ -43,6 +43,8 @@ To use this mod in the best conditions:
|
|||||||
If the inventory's font size is too big on certain setups (namely Windows 10/11 or 144 DPI display), you should lower the
|
If the inventory's font size is too big on certain setups (namely Windows 10/11 or 144 DPI display), you should lower the
|
||||||
value of the setting `display_density_factor` in your `minetest.conf`. Note that the change is applied after restart.
|
value of the setting `display_density_factor` in your `minetest.conf`. Note that the change is applied after restart.
|
||||||
|
|
||||||
|
You can also use the font size slider in the inventory, settings window.
|
||||||
|
|
||||||
#### Notes
|
#### Notes
|
||||||
|
|
||||||
`i3` uses a larger inventory than the usual inventories in Minetest games.
|
`i3` uses a larger inventory than the usual inventories in Minetest games.
|
||||||
@ -53,4 +55,4 @@ Report bugs on the [**Bug Tracker**](https://github.com/minetest-mods/i3/issues)
|
|||||||
|
|
||||||
**Video review on YouTube:** https://www.youtube.com/watch?v=Xd14BCdEZ3o
|
**Video review on YouTube:** https://www.youtube.com/watch?v=Xd14BCdEZ3o
|
||||||
|
|
||||||

|

|
||||||
|
13
init.lua
@ -20,15 +20,17 @@ local function lf(path)
|
|||||||
end
|
end
|
||||||
|
|
||||||
i3 = {
|
i3 = {
|
||||||
|
version = 1115,
|
||||||
data = core.deserialize(storage:get_string"data") or {},
|
data = core.deserialize(storage:get_string"data") or {},
|
||||||
|
|
||||||
settings = {
|
settings = {
|
||||||
debug_mode = false,
|
debug_mode = false,
|
||||||
max_favs = 6,
|
max_favs = 6,
|
||||||
max_waypoints = 30,
|
max_waypoints = 30,
|
||||||
min_fs_version = 4,
|
min_fs_version = 6,
|
||||||
item_btn_size = 1.1,
|
item_btn_size = 1.1,
|
||||||
drop_bag_on_die = true,
|
drop_bag_on_die = true,
|
||||||
|
wielditem_fade_after = 3,
|
||||||
save_interval = 600, -- Player data save interval (in seconds)
|
save_interval = 600, -- Player data save interval (in seconds)
|
||||||
|
|
||||||
hud_speed = 1,
|
hud_speed = 1,
|
||||||
@ -36,7 +38,6 @@ i3 = {
|
|||||||
|
|
||||||
damage_enabled = core.settings:get_bool"enable_damage",
|
damage_enabled = core.settings:get_bool"enable_damage",
|
||||||
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),
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -51,10 +52,13 @@ i3 = {
|
|||||||
saves = { -- Metadata to save
|
saves = { -- Metadata to save
|
||||||
bag = true,
|
bag = true,
|
||||||
home = true,
|
home = true,
|
||||||
|
font_size = true,
|
||||||
|
hide_tabs = true,
|
||||||
waypoints = true,
|
waypoints = true,
|
||||||
inv_items = true,
|
inv_items = true,
|
||||||
drop_items = true,
|
|
||||||
known_recipes = true,
|
known_recipes = true,
|
||||||
|
wielditem_hud = true,
|
||||||
|
legacy_inventory = true,
|
||||||
},
|
},
|
||||||
|
|
||||||
files = {
|
files = {
|
||||||
@ -92,9 +96,6 @@ i3 = {
|
|||||||
sorting_methods = {},
|
sorting_methods = {},
|
||||||
}
|
}
|
||||||
|
|
||||||
i3.settings.hotbar_len = i3.settings.legacy_inventory and 8 or 9
|
|
||||||
i3.settings.inv_size = 4 * i3.settings.hotbar_len
|
|
||||||
|
|
||||||
i3.files.common()
|
i3.files.common()
|
||||||
i3.files.api(http)
|
i3.files.api(http)
|
||||||
i3.files.compress()
|
i3.files.compress()
|
||||||
|
2
mod.conf
@ -1,4 +1,4 @@
|
|||||||
name = i3
|
name = i3
|
||||||
description = Next-generation inventory
|
description = Next-generation inventory
|
||||||
optional_depends = 3d_armor, skinsdb, awards
|
optional_depends = 3d_armor, skinsdb, awards
|
||||||
min_minetest_version = 5.4
|
min_minetest_version = 5.6
|
||||||
|
@ -3,6 +3,3 @@ 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
|
|
BIN
sounds/i3_heavy_armor.ogg
Normal file
BIN
sounds/i3_heavy_boots.ogg
Normal file
BIN
sounds/i3_heavy_helmet.ogg
Normal file
BIN
sounds/i3_heavy_leggings.ogg
Normal file
BIN
sounds/i3_heavy_shield.ogg
Normal file
BIN
sounds/i3_light_armor.ogg
Normal file
BIN
sounds/i3_light_boots.ogg
Normal file
BIN
sounds/i3_light_helmet.ogg
Normal file
BIN
sounds/i3_light_leggings.ogg
Normal file
BIN
sounds/i3_light_shield.ogg
Normal file
@ -344,7 +344,7 @@ end
|
|||||||
i3.add_sorting_method("alphabetical", {
|
i3.add_sorting_method("alphabetical", {
|
||||||
description = S"Sort items by name (A-Z)",
|
description = S"Sort items by name (A-Z)",
|
||||||
func = function(list, data)
|
func = function(list, data)
|
||||||
sorter(list, data.reverse_sorting, 1)
|
sorter(list, data, 1)
|
||||||
return list
|
return list
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
@ -352,7 +352,7 @@ i3.add_sorting_method("alphabetical", {
|
|||||||
i3.add_sorting_method("numerical", {
|
i3.add_sorting_method("numerical", {
|
||||||
description = S"Sort items by number of items per stack",
|
description = S"Sort items by number of items per stack",
|
||||||
func = function(list, data)
|
func = function(list, data)
|
||||||
sorter(list, data.reverse_sorting, 2)
|
sorter(list, data, 2)
|
||||||
return list
|
return list
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
@ -2,7 +2,7 @@ local replacements = {fuel = {}}
|
|||||||
local http = ...
|
local http = ...
|
||||||
|
|
||||||
IMPORT("maxn", "copy", "insert", "sort", "match", "sub")
|
IMPORT("maxn", "copy", "insert", "sort", "match", "sub")
|
||||||
IMPORT("true_str", "is_table", "valid_item", "table_merge", "table_replace", "rcp_eq")
|
IMPORT("true_str", "is_table", "valid_item", "table_merge", "table_replace", "table_eq")
|
||||||
IMPORT("fmt", "reg_items", "reg_aliases", "reg_nodes", "is_cube", "get_cube", "ItemStack")
|
IMPORT("fmt", "reg_items", "reg_aliases", "reg_nodes", "is_cube", "get_cube", "ItemStack")
|
||||||
IMPORT("is_group", "extract_groups", "item_has_groups", "groups_to_items", "get_group_stereotype")
|
IMPORT("is_group", "extract_groups", "item_has_groups", "groups_to_items", "get_group_stereotype")
|
||||||
|
|
||||||
@ -56,7 +56,6 @@ local function cache_groups(group, groups)
|
|||||||
|
|
||||||
if c > 1 then
|
if c > 1 then
|
||||||
sprite = sprite:gsub("WxH", px .. "x" .. px * c)
|
sprite = sprite:gsub("WxH", px .. "x" .. px * c)
|
||||||
|
|
||||||
i3.groups[group].sprite = sprite
|
i3.groups[group].sprite = sprite
|
||||||
i3.groups[group].count = c
|
i3.groups[group].count = c
|
||||||
end
|
end
|
||||||
@ -249,11 +248,7 @@ local old_clear_craft = core.clear_craft
|
|||||||
core.clear_craft = function(def)
|
core.clear_craft = function(def)
|
||||||
old_clear_craft(def)
|
old_clear_craft(def)
|
||||||
|
|
||||||
if true_str(def) then
|
-- TODO: hide in crafting guide
|
||||||
return -- TODO
|
|
||||||
elseif is_table(def) then
|
|
||||||
return -- TODO
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local function resolve_aliases(hash)
|
local function resolve_aliases(hash)
|
||||||
@ -275,7 +270,7 @@ local function resolve_aliases(hash)
|
|||||||
local rcp_new = copy(i3.recipes_cache[newname][j])
|
local rcp_new = copy(i3.recipes_cache[newname][j])
|
||||||
rcp_new.output = oldname
|
rcp_new.output = oldname
|
||||||
|
|
||||||
if rcp_eq(rcp_old, rcp_new) then
|
if table_eq(rcp_old, rcp_new) then
|
||||||
similar = true
|
similar = true
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
|
@ -6,7 +6,7 @@ local init_hud = i3.files.hud()
|
|||||||
local set_fs = i3.set_fs
|
local set_fs = i3.set_fs
|
||||||
|
|
||||||
IMPORT("slz", "min", "insert", "copy", "ItemStack")
|
IMPORT("slz", "min", "insert", "copy", "ItemStack")
|
||||||
IMPORT("spawn_item", "reset_data", "get_detached_inv")
|
IMPORT("spawn_item", "reset_data", "get_detached_inv", "play_sound", "update_inv_size")
|
||||||
|
|
||||||
core.register_on_player_hpchange(function(player, hpchange)
|
core.register_on_player_hpchange(function(player, hpchange)
|
||||||
local name = player:get_player_name()
|
local name = player:get_player_name()
|
||||||
@ -66,16 +66,89 @@ core.register_on_player_inventory_action(function(player, _, _, info)
|
|||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
if core.global_exists("armor") then
|
if core.global_exists"armor" then
|
||||||
i3.modules.armor = true
|
i3.modules.armor = true
|
||||||
armor:register_on_update(set_fs)
|
|
||||||
|
local group_indexes = {
|
||||||
|
{"armor_head", "i3_heavy_helmet"},
|
||||||
|
{"armor_torso", "i3_heavy_armor"},
|
||||||
|
{"armor_legs", "i3_heavy_leggings"},
|
||||||
|
{"armor_feet", "i3_heavy_boots"},
|
||||||
|
{"armor_shield", "i3_heavy_shield"},
|
||||||
|
}
|
||||||
|
|
||||||
|
local function check_group(def, group)
|
||||||
|
return def.groups[group] and def.groups[group] > 0
|
||||||
|
end
|
||||||
|
|
||||||
|
armor:register_on_equip(function(player, idx, stack)
|
||||||
|
local _, armor_inv = armor:get_valid_player(player, "3d_armor")
|
||||||
|
local def = stack:get_definition()
|
||||||
|
local name = player:get_player_name()
|
||||||
|
local data = i3.data[name]
|
||||||
|
|
||||||
|
for i, v in ipairs(group_indexes) do
|
||||||
|
local group, sound = unpack(v)
|
||||||
|
local stackname = stack:get_name()
|
||||||
|
|
||||||
|
if stackname:find"wood" or stackname:find"stone" or stackname:find"cactus" then
|
||||||
|
sound = sound:gsub("heavy", "light")
|
||||||
|
end
|
||||||
|
|
||||||
|
if i == idx and check_group(def, group) then
|
||||||
|
data.armor_allow = sound
|
||||||
|
return armor:register_on_update(set_fs)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
data.armor_disallow = true
|
||||||
|
armor_inv:remove_item("armor", stack)
|
||||||
|
end)
|
||||||
|
|
||||||
|
armor:register_on_update(function(player)
|
||||||
|
local _, armor_inv = armor:get_valid_player(player, "3d_armor")
|
||||||
|
if not armor_inv then return end
|
||||||
|
|
||||||
|
for i = 1, 5 do
|
||||||
|
local stack = armor_inv:get_stack("armor", i)
|
||||||
|
local def = stack:get_definition()
|
||||||
|
|
||||||
|
for j, v in ipairs(group_indexes) do
|
||||||
|
local group = v[1]
|
||||||
|
|
||||||
|
if check_group(def, group) and i ~= j then
|
||||||
|
armor_inv:set_stack("armor", i, armor_inv:get_stack("armor", j))
|
||||||
|
armor_inv:set_stack("armor", j, stack)
|
||||||
|
|
||||||
|
return play_sound(player:get_player_name(), "i3_cannot", 0.8)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
core.register_on_player_inventory_action(function(player, action, _, info)
|
||||||
|
if action ~= "take" then return end
|
||||||
|
local name = player:get_player_name()
|
||||||
|
local data = i3.data[name]
|
||||||
|
|
||||||
|
if data.armor_disallow then
|
||||||
|
local inv = player:get_inventory()
|
||||||
|
inv:set_stack("main", info.index, info.stack)
|
||||||
|
data.armor_disallow = nil
|
||||||
|
play_sound(name, "i3_cannot", 0.8)
|
||||||
|
|
||||||
|
elseif data.armor_allow then
|
||||||
|
play_sound(name, data.armor_allow, 0.8)
|
||||||
|
data.armor_allow = nil
|
||||||
|
end
|
||||||
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
if core.global_exists("skins") then
|
if core.global_exists"skins" then
|
||||||
i3.modules.skins = true
|
i3.modules.skins = true
|
||||||
end
|
end
|
||||||
|
|
||||||
if core.global_exists("awards") then
|
if core.global_exists"awards" then
|
||||||
i3.modules.awards = true
|
i3.modules.awards = true
|
||||||
|
|
||||||
core.register_on_craft(function(_, player)
|
core.register_on_craft(function(_, player)
|
||||||
@ -138,22 +211,22 @@ local function init_data(player, info)
|
|||||||
data.items = i3.init_items
|
data.items = i3.init_items
|
||||||
data.items_raw = i3.init_items
|
data.items_raw = i3.init_items
|
||||||
data.favs = {}
|
data.favs = {}
|
||||||
data.sort = "alphabetical"
|
|
||||||
data.show_setting = "home"
|
data.show_setting = "home"
|
||||||
data.ignore_hotbar = false
|
data.ignore_hotbar = false
|
||||||
data.auto_sorting = false
|
data.auto_sorting = false
|
||||||
data.reverse_sorting = false
|
data.reverse_sorting = false
|
||||||
data.inv_compress = true
|
data.inv_compress = true
|
||||||
data.export_counts = {}
|
data.crafting_counts = {}
|
||||||
|
data.sort = 1
|
||||||
data.tab = 1
|
data.tab = 1
|
||||||
data.itab = 1
|
data.itab = 1
|
||||||
data.subcat = 1
|
data.subcat = 1
|
||||||
data.scrbar_inv = 0
|
data.scrbar_inv = 0
|
||||||
|
data.font_size = data.font_size or 0
|
||||||
data.lang_code = get_lang_code(info)
|
data.lang_code = get_lang_code(info)
|
||||||
data.fs_version = info.formspec_version
|
data.fs_version = info.formspec_version
|
||||||
|
|
||||||
local inv = player:get_inventory()
|
update_inv_size(player, data)
|
||||||
inv:set_size("main", i3.settings.inv_size)
|
|
||||||
|
|
||||||
core.after(0, set_fs, player)
|
core.after(0, set_fs, player)
|
||||||
end
|
end
|
||||||
|
109
src/common.lua
@ -80,7 +80,7 @@ end
|
|||||||
local function utf8_len(str)
|
local function utf8_len(str)
|
||||||
local c = 0
|
local c = 0
|
||||||
|
|
||||||
for _ in str:gmatch"([%z\1-\127\194-\244][\128-\191]*)" do -- Arguably working duct-tape code
|
for _ in str:gmatch"[%z\1-\127\194-\244][\128-\191]*" do -- Arguably working duct-tape code
|
||||||
c++
|
c++
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -216,18 +216,22 @@ local function array_diff(t1, t2)
|
|||||||
return diff
|
return diff
|
||||||
end
|
end
|
||||||
|
|
||||||
local function rcp_eq(rcp, rcp2)
|
local function table_eq(t1, t2)
|
||||||
if rcp.type ~= rcp2.type then return end
|
local ty1, ty2 = type(t1), type(t2)
|
||||||
if rcp.width ~= rcp2.width then return end
|
if ty1 ~= ty2 then return end
|
||||||
if #rcp.items ~= #rcp2.items then return end
|
|
||||||
if rcp.output ~= rcp2.output then return end
|
|
||||||
|
|
||||||
for i, item in pairs(rcp.items) do
|
if ty1 ~= "table" and ty2 ~= "table" then
|
||||||
if item ~= rcp2.items[i] then return end
|
return t1 == t2
|
||||||
end
|
end
|
||||||
|
|
||||||
for i, item in pairs(rcp2.items) do
|
for k, v in pairs(t1) do
|
||||||
if item ~= rcp.items[i] then return end
|
local v2 = t2[k]
|
||||||
|
if v2 == nil or not table_eq(v, v2) then return end
|
||||||
|
end
|
||||||
|
|
||||||
|
for k, v in pairs(t2) do
|
||||||
|
local v1 = t1[k]
|
||||||
|
if v1 == nil or not table_eq(v1, v) then return end
|
||||||
end
|
end
|
||||||
|
|
||||||
return true
|
return true
|
||||||
@ -408,12 +412,13 @@ end
|
|||||||
local function craft_stack(player, data, craft_rcp)
|
local function craft_stack(player, data, craft_rcp)
|
||||||
local inv = player:get_inventory()
|
local inv = player:get_inventory()
|
||||||
local rcp_usg = craft_rcp and "recipe" or "usage"
|
local rcp_usg = craft_rcp and "recipe" or "usage"
|
||||||
|
local rcp_def = rcp_usg == "recipe" and data.recipes[data.rnum] or data.usages[data.unum]
|
||||||
local output = craft_rcp and data.recipes[data.rnum].output or data.usages[data.unum].output
|
local output = craft_rcp and data.recipes[data.rnum].output or data.usages[data.unum].output
|
||||||
output = ItemStack(output)
|
output = ItemStack(output)
|
||||||
local stackname, stackcount, stackmax = output:get_name(), output:get_count(), output:get_stack_max()
|
local stackname, stackcount, stackmax = output:get_name(), output:get_count(), output:get_stack_max()
|
||||||
local scrbar_val = data[fmt("scrbar_%s", craft_rcp and "rcp" or "usg")] or 1
|
local scrbar_val = data[fmt("scrbar_%s", craft_rcp and "rcp" or "usg")] or 1
|
||||||
|
|
||||||
for name, count in pairs(data.export_counts[rcp_usg].rcp) do
|
for name, count in pairs(data.crafting_counts[rcp_usg].rcp) do
|
||||||
local items = {[name] = count}
|
local items = {[name] = count}
|
||||||
|
|
||||||
if is_group(name) then
|
if is_group(name) then
|
||||||
@ -424,7 +429,7 @@ local function craft_stack(player, data, craft_rcp)
|
|||||||
local remaining = count
|
local remaining = count
|
||||||
|
|
||||||
for _, item in ipairs(item_groups) do
|
for _, item in ipairs(item_groups) do
|
||||||
for _name, _count in pairs(data.export_counts[rcp_usg].inv) do
|
for _name, _count in pairs(data.crafting_counts[rcp_usg].inv) do
|
||||||
if item == _name and remaining > 0 then
|
if item == _name and remaining > 0 then
|
||||||
local c = min(remaining, _count)
|
local c = min(remaining, _count)
|
||||||
items[item] = c
|
items[item] = c
|
||||||
@ -441,6 +446,12 @@ local function craft_stack(player, data, craft_rcp)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if rcp_def.replacements then
|
||||||
|
for _, pair in ipairs(rcp_def.replacements) do
|
||||||
|
get_stack(player, ItemStack(pair[2]))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local count = stackcount * scrbar_val
|
local count = stackcount * scrbar_val
|
||||||
local iter = ceil(count / stackmax)
|
local iter = ceil(count / stackmax)
|
||||||
local leftover = count
|
local leftover = count
|
||||||
@ -470,27 +481,16 @@ local function safe_teleport(player, pos)
|
|||||||
player:set_pos(p)
|
player:set_pos(p)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function get_sorting_idx(name)
|
local function sorter(inv, data, mode)
|
||||||
local idx = 1
|
|
||||||
|
|
||||||
for i, def in ipairs(i3.sorting_methods) do
|
|
||||||
if name == def.name then
|
|
||||||
idx = i
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return idx
|
|
||||||
end
|
|
||||||
|
|
||||||
local function sorter(inv, reverse, mode)
|
|
||||||
sort(inv, function(a, b)
|
sort(inv, function(a, b)
|
||||||
if mode == 1 then
|
if mode == 1 then
|
||||||
a, b = a:get_name(), b:get_name()
|
a = translate(data.lang_code, a:get_short_description())
|
||||||
|
b = translate(data.lang_code, b:get_short_description())
|
||||||
else
|
else
|
||||||
a, b = a:get_count(), b:get_count()
|
a, b = a:get_count(), b:get_count()
|
||||||
end
|
end
|
||||||
|
|
||||||
if reverse then
|
if data.reverse_sorting then
|
||||||
return a > b
|
return a > b
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -557,34 +557,11 @@ local function compress_items(list, start_i)
|
|||||||
return new_inv
|
return new_inv
|
||||||
end
|
end
|
||||||
|
|
||||||
local function drop_items(player, inv, list, start_i, rej, remove)
|
|
||||||
for i = start_i, #list do
|
|
||||||
local stack = list[i]
|
|
||||||
local name = stack:get_name()
|
|
||||||
|
|
||||||
for _, it in ipairs(rej) do
|
|
||||||
if name == it then
|
|
||||||
if not remove then
|
|
||||||
spawn_item(player, stack)
|
|
||||||
end
|
|
||||||
|
|
||||||
inv:set_stack("main", i, ItemStack(""))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return inv:get_list"main"
|
|
||||||
end
|
|
||||||
|
|
||||||
local function sort_inventory(player, data)
|
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 (i3.settings.hotbar_len + 1) or 1
|
local start_i = data.ignore_hotbar and (data.hotbar_len + 1) or 1
|
||||||
|
|
||||||
if true_table(data.drop_items) then
|
|
||||||
list = drop_items(player, inv, list, start_i, data.drop_items, true)
|
|
||||||
end
|
|
||||||
|
|
||||||
if data.inv_compress then
|
if data.inv_compress then
|
||||||
list = compress_items(list, start_i)
|
list = compress_items(list, start_i)
|
||||||
@ -592,8 +569,7 @@ local function sort_inventory(player, data)
|
|||||||
list = pre_sorting(list, start_i)
|
list = pre_sorting(list, start_i)
|
||||||
end
|
end
|
||||||
|
|
||||||
local idx = get_sorting_idx(data.sort)
|
local new_inv = i3.sorting_methods[data.sort].func(list, data)
|
||||||
local new_inv = i3.sorting_methods[idx].func(list, data)
|
|
||||||
if not new_inv then return end
|
if not new_inv then return end
|
||||||
|
|
||||||
if not data.ignore_hotbar then
|
if not data.ignore_hotbar then
|
||||||
@ -617,10 +593,11 @@ local function reset_data(data)
|
|||||||
data.scrbar_usg = 1
|
data.scrbar_usg = 1
|
||||||
data.query_item = nil
|
data.query_item = nil
|
||||||
data.enable_search = nil
|
data.enable_search = nil
|
||||||
|
data.goto_page = nil
|
||||||
data.recipes = nil
|
data.recipes = nil
|
||||||
data.usages = nil
|
data.usages = nil
|
||||||
data.export_rcp = nil
|
data.crafting_rcp = nil
|
||||||
data.export_usg = nil
|
data.crafting_usg = nil
|
||||||
data.alt_items = nil
|
data.alt_items = nil
|
||||||
data.confirm_trash = nil
|
data.confirm_trash = nil
|
||||||
data.show_settings = nil
|
data.show_settings = nil
|
||||||
@ -650,6 +627,24 @@ local function get_detached_inv(name, player_name)
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function update_inv_size(player, data)
|
||||||
|
data.hotbar_len = data.legacy_inventory and 8 or 9
|
||||||
|
data.inv_size = 4 * data.hotbar_len
|
||||||
|
|
||||||
|
local inv = player:get_inventory()
|
||||||
|
inv:set_size("main", data.inv_size)
|
||||||
|
|
||||||
|
player:hud_set_hotbar_itemcount(data.hotbar_len)
|
||||||
|
|
||||||
|
core.after(0, function()
|
||||||
|
if data.legacy_inventory then
|
||||||
|
player:hud_set_hotbar_image"gui_hotbar.png"
|
||||||
|
else
|
||||||
|
player:hud_set_hotbar_image"i3_hotbar.png"
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
-- Much faster implementation of `unpack`
|
-- Much faster implementation of `unpack`
|
||||||
local function createunpack(n)
|
local function createunpack(n)
|
||||||
local ret = {"local t = ... return "}
|
local ret = {"local t = ... return "}
|
||||||
@ -688,7 +683,6 @@ local _ = {
|
|||||||
sorter = sorter,
|
sorter = sorter,
|
||||||
get_recipes = get_recipes,
|
get_recipes = get_recipes,
|
||||||
sort_inventory = sort_inventory,
|
sort_inventory = sort_inventory,
|
||||||
get_sorting_idx = get_sorting_idx,
|
|
||||||
sort_by_category = sort_by_category,
|
sort_by_category = sort_by_category,
|
||||||
apply_recipe_filters = apply_recipe_filters,
|
apply_recipe_filters = apply_recipe_filters,
|
||||||
|
|
||||||
@ -732,6 +726,7 @@ local _ = {
|
|||||||
-- Inventory
|
-- Inventory
|
||||||
get_stack = get_stack,
|
get_stack = get_stack,
|
||||||
craft_stack = craft_stack,
|
craft_stack = craft_stack,
|
||||||
|
update_inv_size = update_inv_size,
|
||||||
get_detached_inv = get_detached_inv,
|
get_detached_inv = get_detached_inv,
|
||||||
get_bag_description = get_bag_description,
|
get_bag_description = get_bag_description,
|
||||||
create_inventory = core.create_detached_inventory,
|
create_inventory = core.create_detached_inventory,
|
||||||
@ -773,7 +768,7 @@ local _ = {
|
|||||||
is_table = is_table,
|
is_table = is_table,
|
||||||
table_merge = table_merge,
|
table_merge = table_merge,
|
||||||
table_replace = table_replace,
|
table_replace = table_replace,
|
||||||
rcp_eq = rcp_eq,
|
table_eq = table_eq,
|
||||||
array_diff = array_diff,
|
array_diff = array_diff,
|
||||||
|
|
||||||
-- Math
|
-- Math
|
||||||
|
@ -10,6 +10,9 @@ local trash = create_inventory("i3_trash", {
|
|||||||
inv:set_list(listname, {})
|
inv:set_list(listname, {})
|
||||||
|
|
||||||
local name = player:get_player_name()
|
local name = player:get_player_name()
|
||||||
|
local data = i3.data[name]
|
||||||
|
data.armor_allow = nil
|
||||||
|
|
||||||
play_sound(name, "i3_trash", 1.0)
|
play_sound(name, "i3_trash", 1.0)
|
||||||
|
|
||||||
if not core.is_creative_enabled(name) then
|
if not core.is_creative_enabled(name) then
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
local set_fs = i3.set_fs
|
local set_fs = i3.set_fs
|
||||||
|
|
||||||
IMPORT("vec_eq", "vec_round")
|
|
||||||
IMPORT("reg_items", "reg_aliases")
|
IMPORT("reg_items", "reg_aliases")
|
||||||
|
IMPORT("min", "max", "vec_eq", "vec_round")
|
||||||
IMPORT("S", "random", "translate", "ItemStack")
|
IMPORT("S", "random", "translate", "ItemStack")
|
||||||
IMPORT("sort", "copy", "insert", "remove", "indexof")
|
IMPORT("sort", "copy", "insert", "remove", "indexof")
|
||||||
IMPORT("fmt", "find", "match", "sub", "lower", "split", "toupper")
|
IMPORT("fmt", "find", "match", "sub", "lower", "split", "toupper")
|
||||||
IMPORT("msg", "is_fav", "pos_to_str", "str_to_pos", "add_hud_waypoint", "play_sound", "reset_data")
|
IMPORT("msg", "is_fav", "pos_to_str", "str_to_pos", "add_hud_waypoint", "play_sound", "reset_data")
|
||||||
IMPORT("search", "get_sorting_idx", "sort_inventory", "sort_by_category", "get_recipes", "get_detached_inv")
|
IMPORT("search", "sort_inventory", "sort_by_category", "get_recipes", "get_detached_inv", "update_inv_size")
|
||||||
IMPORT("valid_item", "get_stack", "craft_stack", "clean_name", "compressible", "check_privs", "safe_teleport")
|
IMPORT("valid_item", "get_stack", "craft_stack", "clean_name", "compressible", "check_privs", "safe_teleport")
|
||||||
|
|
||||||
local function inv_fields(player, data, fields)
|
local function inv_fields(player, data, fields)
|
||||||
@ -19,11 +19,6 @@ local function inv_fields(player, data, fields)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if fields.drop_items then
|
|
||||||
local items = split(fields.drop_items, ",")
|
|
||||||
data.drop_items = items
|
|
||||||
end
|
|
||||||
|
|
||||||
for field in pairs(fields) do
|
for field in pairs(fields) do
|
||||||
if sub(field, 1, 4) == "btn_" then
|
if sub(field, 1, 4) == "btn_" then
|
||||||
data.subcat = indexof(i3.categories, sub(field, 5))
|
data.subcat = indexof(i3.categories, sub(field, 5))
|
||||||
@ -37,6 +32,10 @@ local function inv_fields(player, data, fields)
|
|||||||
data[str] = true
|
data[str] = true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if str == "legacy_inventory" then
|
||||||
|
update_inv_size(player, data)
|
||||||
|
end
|
||||||
|
|
||||||
elseif sub(field, 1, 8) == "setting_" then
|
elseif sub(field, 1, 8) == "setting_" then
|
||||||
data.show_setting = match(field, "_(%w+)$")
|
data.show_setting = match(field, "_(%w+)$")
|
||||||
|
|
||||||
@ -94,6 +93,11 @@ local function inv_fields(player, data, fields)
|
|||||||
data.show_settings = nil
|
data.show_settings = nil
|
||||||
data.waypoint_see = nil
|
data.waypoint_see = nil
|
||||||
data.bag_rename = nil
|
data.bag_rename = nil
|
||||||
|
data.goto_page = nil
|
||||||
|
|
||||||
|
if data.filter == "" then
|
||||||
|
data.enable_search = nil
|
||||||
|
end
|
||||||
|
|
||||||
elseif fields.trash then
|
elseif fields.trash then
|
||||||
data.show_settings = nil
|
data.show_settings = nil
|
||||||
@ -124,19 +128,8 @@ local function inv_fields(player, data, fields)
|
|||||||
elseif fields.sort then
|
elseif fields.sort then
|
||||||
sort_inventory(player, data)
|
sort_inventory(player, data)
|
||||||
|
|
||||||
elseif fields.prev_sort or fields.next_sort then
|
elseif fields.dd_sorting_method then
|
||||||
local idx = get_sorting_idx(data.sort)
|
data.sort = tonumber(fields.dd_sorting_method)
|
||||||
local tot = #i3.sorting_methods
|
|
||||||
|
|
||||||
idx -= (fields.prev_sort and 1 or -1)
|
|
||||||
|
|
||||||
if idx > tot then
|
|
||||||
idx = 1
|
|
||||||
elseif idx == 0 then
|
|
||||||
idx = tot
|
|
||||||
end
|
|
||||||
|
|
||||||
data.sort = i3.sorting_methods[idx].name
|
|
||||||
|
|
||||||
elseif fields.home then
|
elseif fields.home then
|
||||||
if not data.home then
|
if not data.home then
|
||||||
@ -154,6 +147,9 @@ local function inv_fields(player, data, fields)
|
|||||||
elseif fields.bag_rename then
|
elseif fields.bag_rename then
|
||||||
data.bag_rename = true
|
data.bag_rename = true
|
||||||
|
|
||||||
|
elseif fields.sb_font_size then
|
||||||
|
data.font_size = tonumber(fields.sb_font_size:match"-?%d+$")
|
||||||
|
|
||||||
elseif fields.confirm_rename then
|
elseif fields.confirm_rename then
|
||||||
local bag = get_detached_inv("bag", name)
|
local bag = get_detached_inv("bag", name)
|
||||||
local bagstack = bag:get_stack("main", 1)
|
local bagstack = bag:get_stack("main", 1)
|
||||||
@ -186,7 +182,7 @@ local function inv_fields(player, data, fields)
|
|||||||
for _, v in ipairs(data.waypoints) do
|
for _, v in ipairs(data.waypoints) do
|
||||||
if vec_eq(vec_round(pos), vec_round(str_to_pos(v.pos))) then
|
if vec_eq(vec_round(pos), vec_round(str_to_pos(v.pos))) then
|
||||||
play_sound(name, "i3_cannot", 0.8)
|
play_sound(name, "i3_cannot", 0.8)
|
||||||
return msg(name, S"You already set a waypoint at this position")
|
return msg(name, S"You already have set a waypoint at this position")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -301,15 +297,15 @@ local function select_item(player, data, fields)
|
|||||||
data.unum = 1
|
data.unum = 1
|
||||||
data.scrbar_rcp = 1
|
data.scrbar_rcp = 1
|
||||||
data.scrbar_usg = 1
|
data.scrbar_usg = 1
|
||||||
data.export_rcp = nil
|
data.crafting_rcp = nil
|
||||||
data.export_usg = nil
|
data.crafting_usg = nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function rcp_fields(player, data, fields)
|
local function rcp_fields(player, data, fields)
|
||||||
local sb_rcp, sb_usg = fields.scrbar_rcp, fields.scrbar_usg
|
local sb_rcp, sb_usg = fields.scrbar_rcp, fields.scrbar_usg
|
||||||
|
|
||||||
if fields.filter and fields.filter == "" then
|
if not data.hide_tabs and fields.filter and fields.filter == "" then
|
||||||
data.enable_search = nil
|
data.enable_search = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -320,8 +316,11 @@ local function rcp_fields(player, data, fields)
|
|||||||
data.query_item = nil
|
data.query_item = nil
|
||||||
|
|
||||||
elseif fields.enable_search then
|
elseif fields.enable_search then
|
||||||
data.enable_search = true
|
if data.hide_tabs then
|
||||||
return set_fs(player)
|
data.enable_search = not data.enable_search
|
||||||
|
else
|
||||||
|
data.enable_search = true
|
||||||
|
end
|
||||||
|
|
||||||
elseif fields.filter and (fields.key_enter_field == "filter" or fields.search) then
|
elseif fields.filter and (fields.key_enter_field == "filter" or fields.search) then
|
||||||
if fields.filter == "" then
|
if fields.filter == "" then
|
||||||
@ -341,6 +340,14 @@ local function rcp_fields(player, data, fields)
|
|||||||
sort_by_category(data)
|
sort_by_category(data)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
elseif fields.pagenum then
|
||||||
|
data.goto_page = not data.goto_page
|
||||||
|
|
||||||
|
elseif fields.goto_page then
|
||||||
|
local pagenum = tonumber(fields.goto_page)
|
||||||
|
data.pagenum = max(1, min(data.pagemax, pagenum or data.pagenum))
|
||||||
|
data.goto_page = nil
|
||||||
|
|
||||||
elseif fields.prev_page or fields.next_page then
|
elseif fields.prev_page or fields.next_page then
|
||||||
if data.pagemax == 1 then return end
|
if data.pagemax == 1 then return end
|
||||||
data.pagenum -= (fields.prev_page and 1 or -1)
|
data.pagenum -= (fields.prev_page and 1 or -1)
|
||||||
@ -364,13 +371,13 @@ local function rcp_fields(player, data, fields)
|
|||||||
elseif fields.prev_recipe or fields.next_recipe then
|
elseif fields.prev_recipe or fields.next_recipe then
|
||||||
local num = data.rnum + (fields.prev_recipe and -1 or 1)
|
local num = data.rnum + (fields.prev_recipe and -1 or 1)
|
||||||
data.rnum = data.recipes[num] and num or (fields.prev_recipe and #data.recipes or 1)
|
data.rnum = data.recipes[num] and num or (fields.prev_recipe and #data.recipes or 1)
|
||||||
data.export_rcp = nil
|
data.crafting_rcp = nil
|
||||||
data.scrbar_rcp = 1
|
data.scrbar_rcp = 1
|
||||||
|
|
||||||
elseif fields.prev_usage or fields.next_usage then
|
elseif fields.prev_usage or fields.next_usage then
|
||||||
local num = data.unum + (fields.prev_usage and -1 or 1)
|
local num = data.unum + (fields.prev_usage and -1 or 1)
|
||||||
data.unum = data.usages[num] and num or (fields.prev_usage and #data.usages or 1)
|
data.unum = data.usages[num] and num or (fields.prev_usage and #data.usages or 1)
|
||||||
data.export_usg = nil
|
data.crafting_usg = nil
|
||||||
data.scrbar_usg = 1
|
data.scrbar_usg = 1
|
||||||
|
|
||||||
elseif fields.fav then
|
elseif fields.fav then
|
||||||
@ -382,17 +389,17 @@ local function rcp_fields(player, data, fields)
|
|||||||
remove(data.favs, fav)
|
remove(data.favs, fav)
|
||||||
end
|
end
|
||||||
|
|
||||||
elseif fields.export_rcp or fields.export_usg then
|
elseif fields.crafting_rcp or fields.crafting_usg then
|
||||||
if fields.export_rcp then
|
if fields.crafting_rcp then
|
||||||
data.export_rcp = not data.export_rcp
|
data.crafting_rcp = not data.crafting_rcp
|
||||||
|
|
||||||
if not data.export_rcp then
|
if not data.crafting_rcp then
|
||||||
data.scrbar_rcp = 1
|
data.scrbar_rcp = 1
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
data.export_usg = not data.export_usg
|
data.crafting_usg = not data.crafting_usg
|
||||||
|
|
||||||
if not data.export_usg then
|
if not data.crafting_usg then
|
||||||
data.scrbar_usg = 1
|
data.scrbar_usg = 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -405,10 +412,10 @@ local function rcp_fields(player, data, fields)
|
|||||||
craft_stack(player, data, fields.craft_rcp)
|
craft_stack(player, data, fields.craft_rcp)
|
||||||
|
|
||||||
if fields.craft_rcp then
|
if fields.craft_rcp then
|
||||||
data.export_rcp = nil
|
data.crafting_rcp = nil
|
||||||
data.scrbar_rcp = 1
|
data.scrbar_rcp = 1
|
||||||
else
|
else
|
||||||
data.export_usg = nil
|
data.crafting_usg = nil
|
||||||
data.scrbar_usg = 1
|
data.scrbar_usg = 1
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
@ -426,14 +433,14 @@ core.register_on_player_receive_fields(function(player, formname, fields)
|
|||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
-- No-op buttons
|
-- No-op buttons
|
||||||
if fields.player_name or fields.awards or fields.home_pos or fields.pagenum or
|
if fields.player_name or fields.awards or fields.home_pos or fields.no_item or
|
||||||
fields.no_item or fields.no_rcp or fields.select_sorting or fields.sort_method or
|
fields.no_rcp or fields.select_sorting or fields.sort_method or fields.bg_content or
|
||||||
fields.bg_content then
|
fields.quick_crafting then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
--print(dump(fields))
|
-- print(dump(fields))
|
||||||
local data = i3.data[name]
|
local data = i3.data[name]
|
||||||
if not data then return end
|
if not data then return end
|
||||||
|
|
||||||
|
553
src/gui.lua
@ -1,5 +1,4 @@
|
|||||||
local damage_enabled = i3.settings.damage_enabled
|
local damage_enabled = i3.settings.damage_enabled
|
||||||
local hotbar_len = i3.settings.hotbar_len
|
|
||||||
local debug_mode = i3.settings.debug_mode
|
local debug_mode = i3.settings.debug_mode
|
||||||
|
|
||||||
local model_aliases = i3.files.model_alias()
|
local model_aliases = i3.files.model_alias()
|
||||||
@ -11,10 +10,10 @@ local VoxelArea, VoxelManip = VoxelArea, VoxelManip
|
|||||||
IMPORT("find", "match", "sub", "upper")
|
IMPORT("find", "match", "sub", "upper")
|
||||||
IMPORT("vec_new", "vec_sub", "vec_round")
|
IMPORT("vec_new", "vec_sub", "vec_round")
|
||||||
IMPORT("clr", "ESC", "msg", "check_privs")
|
IMPORT("clr", "ESC", "msg", "check_privs")
|
||||||
|
IMPORT("compression_active", "compressible")
|
||||||
IMPORT("min", "max", "floor", "ceil", "round")
|
IMPORT("min", "max", "floor", "ceil", "round")
|
||||||
IMPORT("reg_items", "reg_tools", "reg_entities")
|
IMPORT("reg_items", "reg_tools", "reg_entities")
|
||||||
IMPORT("true_str", "is_fav", "is_num", "str_to_pos")
|
IMPORT("true_str", "is_fav", "is_num", "str_to_pos")
|
||||||
IMPORT("get_sorting_idx", "compression_active", "compressible")
|
|
||||||
IMPORT("get_bag_description", "get_detached_inv", "get_recipes")
|
IMPORT("get_bag_description", "get_detached_inv", "get_recipes")
|
||||||
IMPORT("S", "ES", "translate", "ItemStack", "toupper", "utf8_len")
|
IMPORT("S", "ES", "translate", "ItemStack", "toupper", "utf8_len")
|
||||||
IMPORT("maxn", "sort", "concat", "copy", "insert", "remove", "unpack")
|
IMPORT("maxn", "sort", "concat", "copy", "insert", "remove", "unpack")
|
||||||
@ -37,25 +36,29 @@ local function weird_desc(str)
|
|||||||
return not true_str(str) or find(str, "\n") or not find(str, "%u")
|
return not true_str(str) or find(str, "\n") or not find(str, "%u")
|
||||||
end
|
end
|
||||||
|
|
||||||
local function snip(str, limit)
|
local function snip(str, limit, font_size)
|
||||||
return #str > limit and fmt("%s...", sub(str, 1, limit - 3)) or str
|
limit -= (font_size > 3 and font_size + 1 or font_size)
|
||||||
|
|
||||||
|
if utf8_len(str) > limit then
|
||||||
|
return fmt("%s...", sub(str, 1, limit - 3))
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function get_desc(item)
|
local function get_desc(item, lang_code)
|
||||||
if sub(item, 1, 1) == "_" then
|
if sub(item, 1, 1) == "_" then
|
||||||
item = sub(item, 2)
|
item = sub(item, 2)
|
||||||
end
|
end
|
||||||
|
|
||||||
local def = reg_items[item]
|
local def = reg_items[item]
|
||||||
|
|
||||||
if not def then
|
if not def then
|
||||||
return S("Unknown Item (@1)", item)
|
return S("Unknown Item (@1)", item)
|
||||||
end
|
end
|
||||||
|
|
||||||
local desc = def.description
|
local desc = ItemStack(item):get_short_description()
|
||||||
|
desc = translate(lang_code, desc)
|
||||||
|
|
||||||
if true_str(desc) then
|
if true_str(desc) then
|
||||||
desc = desc:trim():match("[^\n]*"):gsub("_", " ")
|
desc = desc:trim():gsub("_", " ")
|
||||||
|
|
||||||
if not find(desc, "%u") then
|
if not find(desc, "%u") then
|
||||||
desc = toupper(desc)
|
desc = toupper(desc)
|
||||||
@ -78,8 +81,8 @@ local function get_stack_max(inv, data, is_recipe, rcp)
|
|||||||
counts_rcp[it] = (counts_rcp[it] or 0) + 1
|
counts_rcp[it] = (counts_rcp[it] or 0) + 1
|
||||||
end
|
end
|
||||||
|
|
||||||
data.export_counts[rcp_usg] = {}
|
data.crafting_counts[rcp_usg] = {}
|
||||||
data.export_counts[rcp_usg].rcp = counts_rcp
|
data.crafting_counts[rcp_usg].rcp = counts_rcp
|
||||||
|
|
||||||
for i = 1, size do
|
for i = 1, size do
|
||||||
local stack = list[i]
|
local stack = list[i]
|
||||||
@ -107,7 +110,7 @@ local function get_stack_max(inv, data, is_recipe, rcp)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
data.export_counts[rcp_usg].inv = counts_inv
|
data.crafting_counts[rcp_usg].inv = counts_inv
|
||||||
|
|
||||||
for name in pairs(counts_rcp) do
|
for name in pairs(counts_rcp) do
|
||||||
counts[name] = floor((counts_inv[name] or 0) / (counts_rcp[name] or 0))
|
counts[name] = floor((counts_inv[name] or 0) / (counts_rcp[name] or 0))
|
||||||
@ -124,10 +127,13 @@ local function get_stack_max(inv, data, is_recipe, rcp)
|
|||||||
return max_stacks
|
return max_stacks
|
||||||
end
|
end
|
||||||
|
|
||||||
local function get_inv_slots(fs)
|
local function get_inv_slots(data, fs)
|
||||||
local inv_x = i3.settings.legacy_inventory and 0.75 or 0.22
|
local legacy_inventory = data.legacy_inventory
|
||||||
local inv_y = 6.9
|
local hotbar_len = data.hotbar_len
|
||||||
local size, spacing = 1, 0.1
|
local inv_x = legacy_inventory and 0.23 or 0.22
|
||||||
|
local inv_y = legacy_inventory and 6.7 or 6.9
|
||||||
|
local spacing = legacy_inventory and 0.25 or 0.1
|
||||||
|
local size = 1
|
||||||
|
|
||||||
fs"style_type[box;colors=#77777710,#77777710,#777,#777]"
|
fs"style_type[box;colors=#77777710,#77777710,#777,#777]"
|
||||||
|
|
||||||
@ -138,11 +144,12 @@ local function get_inv_slots(fs)
|
|||||||
fs(fmt("style_type[list;size=%f;spacing=%f]", size, spacing),
|
fs(fmt("style_type[list;size=%f;spacing=%f]", size, spacing),
|
||||||
fmt("list[current_player;main;%f,%f;%u,1;]", inv_x, inv_y, hotbar_len))
|
fmt("list[current_player;main;%f,%f;%u,1;]", inv_x, inv_y, hotbar_len))
|
||||||
|
|
||||||
fs(fmt("style_type[list;size=%f;spacing=%f]", size, spacing),
|
fs(fmt("style_type[list;size=%f;spacing=%f,%f]", size, spacing, legacy_inventory and 0.15 or spacing))
|
||||||
fmt("list[current_player;main;%f,%f;%u,%u;%u]", inv_x, inv_y + 1.15,
|
|
||||||
hotbar_len, i3.settings.inv_size / hotbar_len, hotbar_len),
|
|
||||||
"style_type[list;size=1;spacing=0.15]")
|
|
||||||
|
|
||||||
|
fs(fmt("list[current_player;main;%f,%f;%u,%u;%u]", inv_x, inv_y + (legacy_inventory and 1.25 or 1.15),
|
||||||
|
hotbar_len, data.inv_size / hotbar_len, hotbar_len))
|
||||||
|
|
||||||
|
fs"style_type[list;size=1;spacing=0.15]"
|
||||||
fs"listring[current_player;craft]listring[current_player;main]"
|
fs"listring[current_player;craft]listring[current_player;main]"
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -171,17 +178,11 @@ local function get_award_list(data, fs, ctn_len, yextra, award_list, awards_unlo
|
|||||||
title = translate(data.lang_code, title)
|
title = translate(data.lang_code, title)
|
||||||
desc = translate(data.lang_code, desc):gsub("%.$", "")
|
desc = translate(data.lang_code, desc):gsub("%.$", "")
|
||||||
|
|
||||||
local title_lim, _title = 27
|
local title_lim, desc_lim = 27, 39
|
||||||
local desc_lim, _desc = 39
|
|
||||||
local icon_size = 1.1
|
local icon_size = 1.1
|
||||||
|
|
||||||
if #title > title_lim then
|
local _title = snip(title, title_lim, data.font_size) or title
|
||||||
_title = snip(title, title_lim)
|
local _desc = snip(desc, desc_lim, data.font_size) or desc
|
||||||
end
|
|
||||||
|
|
||||||
if #desc > desc_lim then
|
|
||||||
_desc = snip(desc, desc_lim)
|
|
||||||
end
|
|
||||||
|
|
||||||
if not award.unlocked and def.secret then
|
if not award.unlocked and def.secret then
|
||||||
title = ES"Secret award"
|
title = ES"Secret award"
|
||||||
@ -191,7 +192,7 @@ local function get_award_list(data, fs, ctn_len, yextra, award_list, awards_unlo
|
|||||||
local icon = def.icon or "awards_unknown.png"
|
local icon = def.icon or "awards_unknown.png"
|
||||||
|
|
||||||
if not award.unlocked then
|
if not award.unlocked then
|
||||||
icon = fmt("%s^\\[colorize:#000:200", icon)
|
icon = fmt("%s^\\[colorize:#000:220", icon)
|
||||||
end
|
end
|
||||||
|
|
||||||
insert(fs, fmt("image", 0, y, icon_size, icon_size, icon))
|
insert(fs, fmt("image", 0, y, icon_size, icon_size, icon))
|
||||||
@ -301,13 +302,13 @@ end
|
|||||||
|
|
||||||
local function get_waypoint_fs(fs, data, player, yextra, ctn_len)
|
local function get_waypoint_fs(fs, data, player, yextra, ctn_len)
|
||||||
fs(fmt("box[0,%f;4.9,0.6;#bababa25]", yextra + 1.1))
|
fs(fmt("box[0,%f;4.9,0.6;#bababa25]", yextra + 1.1))
|
||||||
label(0, yextra + 0.85, ES"Waypoint name:")
|
label(0, yextra + 0.85, ES"New waypoint" .. ":")
|
||||||
fs(fmt("field[0.1,%f;4.8,0.6;waypoint_name;;]", yextra + 1.1))
|
fs(fmt("field[0.1,%f;4.8,0.6;waypoint_name;;]", yextra + 1.1))
|
||||||
image_button(5.1, yextra + 1.15, 0.5, 0.5, "", "waypoint_add", "")
|
image_button(5.1, yextra + 1.15, 0.5, 0.5, "", "waypoint_add", "")
|
||||||
fs(fmt("tooltip[waypoint_add;%s]", ES"Add waypoint"))
|
fs(fmt("tooltip[waypoint_add;%s]", ES"Add waypoint"))
|
||||||
|
|
||||||
if #data.waypoints == 0 then return end
|
if #data.waypoints == 0 then return end
|
||||||
fs("style_type[label;font=bold;font_size=17]")
|
fs"style_type[label;font=bold;font_size=17]"
|
||||||
|
|
||||||
for i, v in ipairs(data.waypoints) do
|
for i, v in ipairs(data.waypoints) do
|
||||||
local y = yextra + 1.35 + (i - (i * 0.3))
|
local y = yextra + 1.35 + (i - (i * 0.3))
|
||||||
@ -316,11 +317,8 @@ local function get_waypoint_fs(fs, data, player, yextra, ctn_len)
|
|||||||
fs"style_type[box;colors=#bababa30,#bababa30,#bababa05,#bababa05]"
|
fs"style_type[box;colors=#bababa30,#bababa30,#bababa05,#bababa05]"
|
||||||
box(0, y, ctn_len, 0.6, "")
|
box(0, y, ctn_len, 0.6, "")
|
||||||
|
|
||||||
local waypoint_name, lim = v.name, 18
|
local waypoint_name, lim = v.name, 22
|
||||||
|
waypoint_name = snip(waypoint_name, lim, data.font_size) or waypoint_name
|
||||||
if #v.name > lim then
|
|
||||||
waypoint_name = snip(waypoint_name, lim)
|
|
||||||
end
|
|
||||||
|
|
||||||
local hex = fmt("%02x", v.color)
|
local hex = fmt("%02x", v.color)
|
||||||
|
|
||||||
@ -370,16 +368,16 @@ local function get_waypoint_fs(fs, data, player, yextra, ctn_len)
|
|||||||
|
|
||||||
if waypoint_preview then
|
if waypoint_preview then
|
||||||
image(0.25, y - 3.5, 5, 4, PNG.bg_content)
|
image(0.25, y - 3.5, 5, 4, PNG.bg_content)
|
||||||
|
fs"style[area_preview;font_size=16;textcolor=#ddd]"
|
||||||
button(0.25, y - 3.35, 5, 0.55, "area_preview", v.name)
|
button(0.25, y - 3.35, 5, 0.55, "area_preview", v.name)
|
||||||
image_button(4.65, y - 3.25, 0.25, 0.25,
|
image_button(4.65, y - 3.25, 0.25, 0.25, PNG.cancel_hover .. "^\\[brighten", "close_preview", "")
|
||||||
PNG.cancel_hover .. "^\\[brighten", "close_preview", "")
|
|
||||||
|
|
||||||
local pos = str_to_pos(data.waypoints[i].pos)
|
local pos = str_to_pos(data.waypoints[i].pos)
|
||||||
get_isometric_view(fs, pos, 0.6, y - 2.5)
|
get_isometric_view(fs, pos, 0.6, y - 2.5)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
fs"style_type[label;font=normal;font_size=16]"
|
fs"style_type[label;font=normal;font_size=16;textcolor=#fff]"
|
||||||
end
|
end
|
||||||
|
|
||||||
local function get_bag_fs(fs, data, name, esc_name, bag_size, yextra)
|
local function get_bag_fs(fs, data, name, esc_name, bag_size, yextra)
|
||||||
@ -467,7 +465,7 @@ local function get_container(fs, data, player, yoffset, ctn_len, award_list, awa
|
|||||||
end
|
end
|
||||||
|
|
||||||
box(0, yextra + 0.45, ctn_len, 0.045, "#bababa50")
|
box(0, yextra + 0.45, ctn_len, 0.045, "#bababa50")
|
||||||
box((data.subcat - 1) * 1.18, yextra + 0.45, 1, 0.045, "#f9826c")
|
image((data.subcat - 1) * 1.18, yextra + 0.45, 1, 0.045, PNG.highlight)
|
||||||
|
|
||||||
local function not_installed(modname)
|
local function not_installed(modname)
|
||||||
hypertext(0, yextra + 0.9, ctn_len, 0.6, "not_installed",
|
hypertext(0, yextra + 0.9, ctn_len, 0.6, "not_installed",
|
||||||
@ -484,9 +482,40 @@ local function get_container(fs, data, player, yoffset, ctn_len, award_list, awa
|
|||||||
end
|
end
|
||||||
|
|
||||||
local armor_def = armor.def[name]
|
local armor_def = armor.def[name]
|
||||||
fs(fmt("list[detached:%s_armor;armor;0,%f;3,2;]", esc_name, yextra + 0.7))
|
local _, armor_inv = armor:get_valid_player(player, "3d_armor")
|
||||||
label(3.65, yextra + 1.55, fmt("%s: %s", ES"Level", armor_def.level))
|
|
||||||
label(3.65, yextra + 2.05, fmt("%s: %s", ES"Heal", armor_def.heal))
|
fs(fmt("list[detached:%s_armor;armor;0,%f;5,1;]", esc_name, yextra + 0.7))
|
||||||
|
|
||||||
|
for i = 1, 5 do
|
||||||
|
local stack = armor_inv:get_stack("armor", i)
|
||||||
|
|
||||||
|
if stack:is_empty() then
|
||||||
|
local tips = {ES"Helmet", ES"Chest", ES"Leggings", ES"Boots", ES"Shield"}
|
||||||
|
local x = (i - 1) + ((i - 1) * 0.15)
|
||||||
|
local y = yextra + 0.7
|
||||||
|
|
||||||
|
image(x, y, 1, 1, fmt("i3_armor_%u.png", i))
|
||||||
|
tooltip(x, y, 1, 1, tips[i])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local box_len, max_level, max_heal = 4, 85, 60
|
||||||
|
local bar_lvl = (armor_def.level * box_len) / max_level
|
||||||
|
local bar_heal = (armor_def.heal * box_len) / max_heal
|
||||||
|
|
||||||
|
fs"style_type[label;font_size=15]"
|
||||||
|
|
||||||
|
box(0.8, yextra + 1.95, box_len, 0.4, "#101010")
|
||||||
|
fs"style_type[box;colors=#9dc34c80,#9dc34c,#9dc34c,#9dc34c80]"
|
||||||
|
box(0.8, yextra + 1.95, bar_lvl, 0.4, "")
|
||||||
|
label(1.1, yextra + 2.15, ES"Armor level")
|
||||||
|
|
||||||
|
box(0.8, yextra + 2.55, box_len, 0.4, "#101010")
|
||||||
|
fs"style_type[box;colors=#4466aa80,#4466aa,#4466aa,#4466aa80]"
|
||||||
|
box(0.8, yextra + 2.55, bar_heal, 0.4, "")
|
||||||
|
label(1.1, yextra + 2.75, ES"Armor healing")
|
||||||
|
|
||||||
|
fs"style_type[label;font_size=16]"
|
||||||
|
|
||||||
elseif data.subcat == 3 then
|
elseif data.subcat == 3 then
|
||||||
if not i3.modules.skins then
|
if not i3.modules.skins then
|
||||||
@ -547,45 +576,40 @@ local function get_container(fs, data, player, yoffset, ctn_len, award_list, awa
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function show_popup(fs, data)
|
local function show_settings(fs, data)
|
||||||
if data.confirm_trash then
|
if data.confirm_trash then
|
||||||
fs"style_type[box;colors=#999,#999,#808080,#808080]"
|
image(2.8, 10.65, 4.6, 0.7, PNG.bg_goto)
|
||||||
|
label(3.02, 11, "Confirm trash?")
|
||||||
for _ = 1, 3 do
|
image_button(5.07, 10.75, 1, 0.5, "", "confirm_trash_yes", "Yes")
|
||||||
box(2.97, 10.75, 4.3, 0.5, "")
|
image_button(6.17, 10.75, 1, 0.5, "", "confirm_trash_no", "No")
|
||||||
end
|
|
||||||
|
|
||||||
label(3.12, 11, "Confirm trash?")
|
|
||||||
image_button(5.17, 10.75, 1, 0.5, "", "confirm_trash_yes", "Yes")
|
|
||||||
image_button(6.27, 10.75, 1, 0.5, "", "confirm_trash_no", "No")
|
|
||||||
|
|
||||||
elseif data.show_settings then
|
elseif data.show_settings then
|
||||||
fs"style_type[box;colors=#999,#999,#808080,#808080]"
|
image(2.2, 9, 6, 2.35, PNG.bg_content)
|
||||||
|
|
||||||
for _ = 1, 3 do
|
|
||||||
box(2.1, 9.25, 6, 2, "")
|
|
||||||
end
|
|
||||||
|
|
||||||
for _ = 1, 3 do
|
|
||||||
box(2.1, 9.25, 6, 0.5, "#707070")
|
|
||||||
end
|
|
||||||
|
|
||||||
image_button(7.75, 9.35, 0.25, 0.25, PNG.cancel_hover .. "^\\[brighten", "close_settings", "")
|
|
||||||
|
|
||||||
local show_home = data.show_setting == "home"
|
local show_home = data.show_setting == "home"
|
||||||
|
local show_style = data.show_setting == "style"
|
||||||
local show_sorting = data.show_setting == "sorting"
|
local show_sorting = data.show_setting == "sorting"
|
||||||
local show_misc = data.show_setting == "misc"
|
|
||||||
|
|
||||||
fs(fmt("style[setting_home;textcolor=%s;font=bold;sound=i3_click]",
|
fs"style[setting_home,setting_style,setting_sorting;font=bold;font_size=16;sound=i3_click]"
|
||||||
show_home and colors.yellow or "#fff"),
|
fs(fmt("style[setting_home:hovered;textcolor=%s]", show_home and colors.yellow or "#fff"))
|
||||||
fmt("style[setting_sorting;textcolor=%s;font=bold;sound=i3_click]",
|
fs(fmt("style[setting_style:hovered;textcolor=%s]", show_style and colors.yellow or "#fff"))
|
||||||
show_sorting and colors.yellow or "#fff"),
|
fs(fmt("style[setting_sorting:hovered;textcolor=%s]", show_sorting and colors.yellow or "#fff"))
|
||||||
fmt("style[setting_misc;textcolor=%s;font=bold;sound=i3_click]",
|
|
||||||
show_misc and colors.yellow or "#fff"))
|
|
||||||
|
|
||||||
button(2.2, 9.25, 1.8, 0.55, "setting_home", "Home")
|
fs(fmt("style[setting_home;bgimg=%s;bgimg_hovered=%s;bgimg_middle=9;padding=-9;textcolor=%s]",
|
||||||
button(4, 9.25, 1.8, 0.55, "setting_sorting", "Sorting")
|
show_home and PNG.pagenum_hover or "", PNG.pagenum_hover,
|
||||||
button(5.8, 9.25, 1.8, 0.55, "setting_misc", "Misc.")
|
show_home and colors.yellow or "#ddd"),
|
||||||
|
fmt("style[setting_style;bgimg=%s;bgimg_hovered=%s;bgimg_middle=9;padding=-9;textcolor=%s]",
|
||||||
|
show_style and PNG.pagenum_hover or "", PNG.pagenum_hover,
|
||||||
|
show_style and colors.yellow or "#ddd"),
|
||||||
|
fmt("style[setting_sorting;bgimg=%s;bgimg_hovered=%s;bgimg_middle=9;padding=-9;textcolor=%s]",
|
||||||
|
show_sorting and PNG.pagenum_hover or "", PNG.pagenum_hover,
|
||||||
|
show_sorting and colors.yellow or "#ddd"))
|
||||||
|
|
||||||
|
local X = 2.5
|
||||||
|
button(X, 9.1, 1.6, 0.55, "setting_home", "Home")
|
||||||
|
button(X + 1.6, 9.1, 1.6, 0.55, "setting_style", "Style")
|
||||||
|
button(X + 3.2, 9.1, 1.6, 0.55, "setting_sorting", "Sorting")
|
||||||
|
image_button(X + 5, 9.2, 0.25, 0.25, PNG.cancel_hover .. "^\\[brighten", "close_settings", "")
|
||||||
|
|
||||||
if show_home then
|
if show_home then
|
||||||
local coords, c, str = {"X", "Y", "Z"}, 0, ES"No home set"
|
local coords, c, str = {"X", "Y", "Z"}, 0, ES"No home set"
|
||||||
@ -595,44 +619,54 @@ local function show_popup(fs, data)
|
|||||||
"(%-?%d+)", function(a)
|
"(%-?%d+)", function(a)
|
||||||
c++
|
c++
|
||||||
return fmt("<b>%s: <style color=%s font=mono>%s</style></b>",
|
return fmt("<b>%s: <style color=%s font=mono>%s</style></b>",
|
||||||
coords[c], colors.black, a)
|
coords[c], colors.blue, a)
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
hypertext(2.1, 9.9, 6, 0.6, "home_pos", fmt("<global size=16><center>%s</center>", str))
|
hypertext(2.1, 9.9, 6, 0.6, "home_pos", fmt("<global size=16><center>%s</center>", str))
|
||||||
image_button(4.2, 10.4, 1.8, 0.7, "", "set_home", "Set home")
|
image_button(4.2, 10.4, 1.8, 0.7, "", "set_home", "Set home")
|
||||||
|
|
||||||
|
elseif show_style then
|
||||||
|
checkbox(2.6, 9.95, "cb_hide_tabs", "Hide tabs", tostring(data.hide_tabs))
|
||||||
|
checkbox(2.6, 10.4, "cb_legacy_inventory", "Legacy inventory", tostring(data.legacy_inventory))
|
||||||
|
checkbox(2.6, 10.85, "cb_wielditem_hud", "HUD description", tostring(data.wielditem_hud))
|
||||||
|
|
||||||
|
local sign = (data.font_size > 0 and "+") or (data.font_size > 0 and "-") or ""
|
||||||
|
label(5.3, 9.95, ES"Font size" .. fmt(": %s", sign .. data.font_size))
|
||||||
|
|
||||||
|
local range = 5
|
||||||
|
fs(fmt("scrollbaroptions[min=-%u;max=%u;smallstep=1;largestep=1;thumbsize=2]", range, range))
|
||||||
|
fs(fmt("scrollbar[5.3,10.25;2.45,0.3;horizontal;sb_font_size;%d]", data.font_size))
|
||||||
|
|
||||||
|
fs(fmt("tooltip[cb_hide_tabs;%s;#707070;#fff]",
|
||||||
|
ES"Enable this option to change the style of the right panel"),
|
||||||
|
fmt("tooltip[cb_legacy_inventory;%s;#707070;#fff]",
|
||||||
|
ES"Enable this option to set the classic inventory size in Minetest"),
|
||||||
|
fmt("tooltip[cb_wielditem_hud;%s;#707070;#fff]",
|
||||||
|
ES"Enable this option to show the wielded item description in your HUD"))
|
||||||
|
|
||||||
elseif show_sorting then
|
elseif show_sorting then
|
||||||
button(2.1, 9.7, 6, 0.8, "select_sorting", ES"Select the inventory sorting method:")
|
checkbox(2.6, 9.95, "cb_inv_compress", "Compression", tostring(data.inv_compress))
|
||||||
|
checkbox(2.6, 10.4, "cb_reverse_sorting", "Reverse mode", tostring(data.reverse_sorting))
|
||||||
|
checkbox(2.6, 10.85, "cb_ignore_hotbar", "Ignore hotbar", tostring(data.ignore_hotbar))
|
||||||
|
checkbox(5.4, 9.95, "cb_auto_sorting", "Automation", tostring(data.auto_sorting))
|
||||||
|
|
||||||
image_button(2.2, 10.6, 0.35, 0.35, "", "prev_sort", "")
|
local methods = {}
|
||||||
image_button(7.65, 10.6, 0.35, 0.35, "", "next_sort", "")
|
|
||||||
|
|
||||||
fs"style[sort_method;font=bold;font_size=20]"
|
for _, v in ipairs(i3.sorting_methods) do
|
||||||
button(2.55, 10.36, 5.1, 0.8, "sort_method", toupper(data.sort))
|
local name = toupper(v.name)
|
||||||
|
insert(methods, name)
|
||||||
|
end
|
||||||
|
|
||||||
local idx = get_sorting_idx(data.sort)
|
label(5.4, 10.4, ES"Sorting method:")
|
||||||
local desc = i3.sorting_methods[idx].description
|
fs(fmt("dropdown[%f,%f;2.4,0.5;dd_sorting_method;%s;%u;true]",
|
||||||
|
5.4, 10.6, concat(methods, ","), data.sort))
|
||||||
|
|
||||||
|
local desc = i3.sorting_methods[data.sort].description
|
||||||
if desc then
|
if desc then
|
||||||
fs(fmt("tooltip[%s;%s]", "sort_method", desc))
|
tooltip(5.4, 10.6, 2.4, 0.5, ESC(desc))
|
||||||
end
|
end
|
||||||
|
|
||||||
elseif show_misc then
|
|
||||||
checkbox(2.4, 10.05, "cb_inv_compress", "Compression", tostring(data.inv_compress))
|
|
||||||
checkbox(2.4, 10.5, "cb_reverse_sorting", "Reverse mode", tostring(data.reverse_sorting))
|
|
||||||
checkbox(2.4, 10.95, "cb_ignore_hotbar", "Ignore hotbar", tostring(data.ignore_hotbar))
|
|
||||||
checkbox(5.4, 10.05, "cb_auto_sorting", "Automation", tostring(data.auto_sorting))
|
|
||||||
|
|
||||||
for _ = 1, 3 do
|
|
||||||
box(5.4, 10.68, 2.4, 0.45, "#707070")
|
|
||||||
end
|
|
||||||
|
|
||||||
fs("style[drop_items;font_size=15;font=mono;textcolor=#dbeeff]",
|
|
||||||
fmt("field[5.4,10.68;2.4,0.45;drop_items;Remove items:;%s]",
|
|
||||||
ESC(concat(data.drop_items or {}, ","))),
|
|
||||||
"field_close_on_enter[drop_items;false]")
|
|
||||||
|
|
||||||
fs(fmt("tooltip[cb_inv_compress;%s;#707070;#fff]",
|
fs(fmt("tooltip[cb_inv_compress;%s;#707070;#fff]",
|
||||||
ES"Enable this option to compress your inventory"),
|
ES"Enable this option to compress your inventory"),
|
||||||
fmt("tooltip[cb_reverse_sorting;%s;#707070;#fff]",
|
fmt("tooltip[cb_reverse_sorting;%s;#707070;#fff]",
|
||||||
@ -640,10 +674,7 @@ local function show_popup(fs, data)
|
|||||||
fmt("tooltip[cb_ignore_hotbar;%s;#707070;#fff]",
|
fmt("tooltip[cb_ignore_hotbar;%s;#707070;#fff]",
|
||||||
ES"Enable this option to sort your inventory except the hotbar slots"),
|
ES"Enable this option to sort your inventory except the hotbar slots"),
|
||||||
fmt("tooltip[cb_auto_sorting;%s;#707070;#fff]",
|
fmt("tooltip[cb_auto_sorting;%s;#707070;#fff]",
|
||||||
ES"Enable this option to sort your inventory automatically"),
|
ES"Enable this option to sort your inventory automatically"))
|
||||||
fmt("tooltip[drop_items;%s;#707070;#fff]",
|
|
||||||
"Add a comma-separated list of items to remove on inventory sorting.\n" ..
|
|
||||||
"Format: " .. ("mod:item,mod:item, ..."):gsub("(%a+:%a+)", clr("#bddeff", "%1"))))
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -651,10 +682,12 @@ end
|
|||||||
local function get_inventory_fs(player, data, fs)
|
local function get_inventory_fs(player, data, fs)
|
||||||
fs"listcolors[#bababa50;#bababa99]"
|
fs"listcolors[#bababa50;#bababa99]"
|
||||||
|
|
||||||
get_inv_slots(fs)
|
get_inv_slots(data, fs)
|
||||||
|
|
||||||
local props = player:get_properties()
|
local props = player:get_properties()
|
||||||
local ctn_len, ctn_hgt, yoffset = 5.7, 6.3, 0
|
local ctn_len = 5.7
|
||||||
|
local ctn_hgt = data.legacy_inventory and 6.1 or 6.3
|
||||||
|
local yoffset = 0
|
||||||
|
|
||||||
if props.mesh ~= "" then
|
if props.mesh ~= "" then
|
||||||
local anim = player:get_local_animation()
|
local anim = player:get_local_animation()
|
||||||
@ -667,10 +700,10 @@ local function get_inventory_fs(player, data, fs)
|
|||||||
|
|
||||||
local textures = concat(t, ","):gsub("!", ",")
|
local textures = concat(t, ","):gsub("!", ",")
|
||||||
|
|
||||||
--fs("style[player_model;bgcolor=black]")
|
-- fs"style[player_model;bgcolor=black]"
|
||||||
model(0.2, 0.2, armor_skin and 4 or 3.4, ctn_hgt,
|
model(0.2, 0.2, armor_skin and 4 or 3.4, ctn_hgt,
|
||||||
"player_model", props.mesh, textures, "0,-150", "false", "false",
|
"player_model", props.mesh, textures, "0,-150", "false", "false",
|
||||||
fmt("%u,%u%s", anim.x, anim.y, data.fs_version >= 5 and ";30" or ""))
|
fmt("%u,%u;30", anim.x, anim.y))
|
||||||
else
|
else
|
||||||
local size = 2.5
|
local size = 2.5
|
||||||
image(0.7, 0.2, size, size * props.visual_size.y, props.textures[1])
|
image(0.7, 0.2, size, size * props.visual_size.y, props.textures[1])
|
||||||
@ -678,6 +711,7 @@ local function get_inventory_fs(player, data, fs)
|
|||||||
|
|
||||||
local awards_unlocked, award_list, award_list_nb = 0
|
local awards_unlocked, award_list, award_list_nb = 0
|
||||||
local max_val = damage_enabled and 12 or 7
|
local max_val = damage_enabled and 12 or 7
|
||||||
|
max_val += (data.legacy_inventory and 2 or 0)
|
||||||
local bag_size = get_group(ItemStack(data.bag):get_name(), "bag")
|
local bag_size = get_group(ItemStack(data.bag):get_name(), "bag")
|
||||||
|
|
||||||
if data.subcat == 1 and bag_size > 0 then
|
if data.subcat == 1 and bag_size > 0 then
|
||||||
@ -747,10 +781,10 @@ local function get_inventory_fs(player, data, fs)
|
|||||||
fs(fmt("tooltip[%s;%s]", btn_name, tooltip))
|
fs(fmt("tooltip[%s;%s]", btn_name, tooltip))
|
||||||
end
|
end
|
||||||
|
|
||||||
show_popup(fs, data)
|
show_settings(fs, data)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function get_tooltip(item, info, pos)
|
local function get_tooltip(item, info, pos, lang_code)
|
||||||
local tooltip
|
local tooltip
|
||||||
|
|
||||||
if info.groups then
|
if info.groups then
|
||||||
@ -768,7 +802,7 @@ local function get_tooltip(item, info, pos)
|
|||||||
tooltip = S("Any item belonging to the groups: @1", groupstr)
|
tooltip = S("Any item belonging to the groups: @1", groupstr)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
tooltip = info.meta_desc or get_desc(item)
|
tooltip = info.meta_desc or get_desc(item, lang_code)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function add(str)
|
local function add(str)
|
||||||
@ -786,7 +820,7 @@ local function get_tooltip(item, info, pos)
|
|||||||
if info.replace then
|
if info.replace then
|
||||||
for i = 1, #info.replace.items do
|
for i = 1, #info.replace.items do
|
||||||
local rpl = ItemStack(info.replace.items[i]):get_name()
|
local rpl = ItemStack(info.replace.items[i]):get_name()
|
||||||
local desc = clr("#ff0", get_desc(rpl))
|
local desc = clr("#ff0", get_desc(rpl, lang_code))
|
||||||
|
|
||||||
if info.replace.type == "cooking" then
|
if info.replace.type == "cooking" then
|
||||||
tooltip = add(S("Replaced by @1 on smelting", desc))
|
tooltip = add(S("Replaced by @1 on smelting", desc))
|
||||||
@ -813,12 +847,13 @@ local function get_tooltip(item, info, pos)
|
|||||||
|
|
||||||
if several then
|
if several then
|
||||||
for i = 1, #info.tools do
|
for i = 1, #info.tools do
|
||||||
names = fmt("%s\t\t- %s\n", names, clr("#ff0", get_desc(info.tools[i])))
|
names = fmt("%s\t\t- %s\n", names, clr("#ff0", get_desc(info.tools[i], lang_code)))
|
||||||
end
|
end
|
||||||
|
|
||||||
tooltip = add(S("Only drop if using one of these tools: @1", sub(names, 1, -2)))
|
tooltip = add(S("Only drop if using one of these tools: @1", sub(names, 1, -2)))
|
||||||
else
|
else
|
||||||
tooltip = add(S("Only drop if using this tool: @1", clr("#ff0", get_desc(info.tools[1]))))
|
tooltip = add(S("Only drop if using this tool: @1",
|
||||||
|
clr("#ff0", get_desc(info.tools[1], lang_code))))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -830,7 +865,23 @@ local function get_tooltip(item, info, pos)
|
|||||||
return fmt("tooltip[%s;%s]", item, ESC(tooltip))
|
return fmt("tooltip[%s;%s]", item, ESC(tooltip))
|
||||||
end
|
end
|
||||||
|
|
||||||
local function get_output_fs(fs, data, rcp, is_recipe, shapeless, right, btn_size, btn_size2)
|
local function get_true_count(data, count, is_recipe, is_usage)
|
||||||
|
local count_mul = 1
|
||||||
|
|
||||||
|
if is_recipe then
|
||||||
|
count_mul = data.scrbar_rcp
|
||||||
|
elseif is_usage then
|
||||||
|
count_mul = data.scrbar_usg
|
||||||
|
end
|
||||||
|
|
||||||
|
if count_mul then
|
||||||
|
count *= count_mul
|
||||||
|
end
|
||||||
|
|
||||||
|
return count
|
||||||
|
end
|
||||||
|
|
||||||
|
local function get_output_fs(fs, data, rcp, is_recipe, is_usage, shapeless, right, btn_size, btn_size2)
|
||||||
local custom_recipe = i3.craft_types[rcp.type]
|
local custom_recipe = i3.craft_types[rcp.type]
|
||||||
local cooking = rcp.type == "cooking"
|
local cooking = rcp.type == "cooking"
|
||||||
local fuel = rcp.type == "fuel"
|
local fuel = rcp.type == "fuel"
|
||||||
@ -883,7 +934,6 @@ local function get_output_fs(fs, data, rcp, is_recipe, shapeless, right, btn_siz
|
|||||||
local name = item:get_name()
|
local name = item:get_name()
|
||||||
local count = item:get_count()
|
local count = item:get_count()
|
||||||
local wear = item:get_wear()
|
local wear = item:get_wear()
|
||||||
local bt_s = BTN_SIZE * 1.2
|
|
||||||
local _name = fmt("_%s", name)
|
local _name = fmt("_%s", name)
|
||||||
local pos
|
local pos
|
||||||
|
|
||||||
@ -899,11 +949,11 @@ local function get_output_fs(fs, data, rcp, is_recipe, shapeless, right, btn_siz
|
|||||||
inv:set_stack("main", 1, item)
|
inv:set_stack("main", 1, item)
|
||||||
pos = {x = X + 0.11, y = Y}
|
pos = {x = X + 0.11, y = Y}
|
||||||
else
|
else
|
||||||
image(X, Y - 0.11, bt_s, bt_s, PNG.slot)
|
local size = BTN_SIZE * 1.2
|
||||||
item_image_button(
|
slot(X, Y - 0.11, size, size)
|
||||||
X + 0.11, Y, BTN_SIZE, BTN_SIZE,
|
|
||||||
fmt("%s %u %u", name, count * (is_recipe and data.scrbar_rcp or data.scrbar_usg or 1), wear),
|
count = get_true_count(data, count, is_recipe, is_usage)
|
||||||
_name, "")
|
item_image_button(X + 0.11, Y, BTN_SIZE, BTN_SIZE, fmt("%s %u %u", name, count, wear), _name, "")
|
||||||
end
|
end
|
||||||
|
|
||||||
local def = reg_items[name]
|
local def = reg_items[name]
|
||||||
@ -927,11 +977,11 @@ local function get_output_fs(fs, data, rcp, is_recipe, shapeless, right, btn_siz
|
|||||||
}
|
}
|
||||||
|
|
||||||
if next(infos) then
|
if next(infos) then
|
||||||
fs(get_tooltip(_name, infos, pos))
|
fs(get_tooltip(_name, infos, pos, data.lang_code))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function get_grid_fs(fs, data, rcp, is_recipe)
|
local function get_grid_fs(fs, data, rcp, is_recipe, is_usage)
|
||||||
local width = rcp.width or 1
|
local width = rcp.width or 1
|
||||||
local right = 0
|
local right = 0
|
||||||
local btn_size, _btn_size = i3.settings.item_btn_size
|
local btn_size, _btn_size = i3.settings.item_btn_size
|
||||||
@ -998,7 +1048,7 @@ local function get_grid_fs(fs, data, rcp, is_recipe)
|
|||||||
if is_group(name) then
|
if is_group(name) then
|
||||||
groups = group_cache and group_cache.groups or extract_groups(name)
|
groups = group_cache and group_cache.groups or extract_groups(name)
|
||||||
name = group_cache and (group_cache.stereotype or group_cache.items[1]) or
|
name = group_cache and (group_cache.stereotype or group_cache.items[1]) or
|
||||||
groups_to_items(groups)[1]
|
groups_to_items(groups)[1] or ""
|
||||||
end
|
end
|
||||||
|
|
||||||
local label = groups and "\nG" or ""
|
local label = groups and "\nG" or ""
|
||||||
@ -1026,11 +1076,11 @@ local function get_grid_fs(fs, data, rcp, is_recipe)
|
|||||||
end
|
end
|
||||||
|
|
||||||
if not large_recipe then
|
if not large_recipe then
|
||||||
image(X, Y, btn_size, btn_size, PNG.slot)
|
slot(X, Y, btn_size, btn_size)
|
||||||
end
|
end
|
||||||
|
|
||||||
local btn_name = groups and fmt("group!%s!%s", groups[1], name) or name
|
local btn_name = groups and fmt("group!%s!%s", groups[1], name) or name
|
||||||
local _count = count * (is_recipe and data.scrbar_rcp or data.scrbar_usg or 1)
|
count = get_true_count(data, count, is_recipe, is_usage)
|
||||||
|
|
||||||
if group_cache and group_cache.sprite and not large_recipe then
|
if group_cache and group_cache.sprite and not large_recipe then
|
||||||
local sprite = ESC(group_cache.sprite)
|
local sprite = ESC(group_cache.sprite)
|
||||||
@ -1040,11 +1090,11 @@ local function get_grid_fs(fs, data, rcp, is_recipe)
|
|||||||
animated_image(X + 0.01, Y + 0.025, size, size, sprite, group_cache.count, 1500)
|
animated_image(X + 0.01, Y + 0.025, size, size, sprite, group_cache.count, 1500)
|
||||||
label(X + 0.45, Y + 0.18, label)
|
label(X + 0.45, Y + 0.18, label)
|
||||||
|
|
||||||
if _count > 1 then
|
if count > 1 then
|
||||||
label(X + 0.8, Y + 0.9, _count)
|
label(X + 0.8, Y + 0.9, count)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
item_image_button(X, Y, btn_size, btn_size, fmt("%s %u", name, _count), btn_name, label)
|
item_image_button(X, Y, btn_size, btn_size, fmt("%s %u", name, count), btn_name, label)
|
||||||
end
|
end
|
||||||
|
|
||||||
local def = reg_items[name]
|
local def = reg_items[name]
|
||||||
@ -1069,23 +1119,24 @@ local function get_grid_fs(fs, data, rcp, is_recipe)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if next(infos) then
|
if next(infos) then
|
||||||
fs(get_tooltip(btn_name, infos))
|
fs(get_tooltip(btn_name, infos, nil, data.lang_code))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if large_recipe then
|
if large_recipe then
|
||||||
fs("style_type[item_image_button;border=false]")
|
fs"style_type[item_image_button;border=false]"
|
||||||
end
|
end
|
||||||
|
|
||||||
get_output_fs(fs, data, rcp, is_recipe, shapeless, right, btn_size, _btn_size)
|
get_output_fs(fs, data, rcp, is_recipe, is_usage, shapeless, right, btn_size, _btn_size)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function get_rcp_lbl(fs, data, panel, rn, is_recipe)
|
local function get_rcp_lbl(fs, data, panel, rn, is_recipe, is_usage)
|
||||||
local rcp = is_recipe and panel.rcp[data.rnum] or panel.rcp[data.unum]
|
local rcp = is_recipe and panel.rcp[data.rnum] or panel.rcp[data.unum]
|
||||||
|
|
||||||
if rcp.custom then
|
if rcp.custom then
|
||||||
hypertext(data.inv_width + 4.8, data.yoffset + 0.12, 3, 0.6, "custom_rcp",
|
local desc = i3.craft_types[rcp.type].description
|
||||||
fmt("<global size=16><right><i>%s</i></right>", ES"Custom recipe"))
|
hypertext(data.inv_width + 4.8, data.yoffset + 0.12, 3, 1, "custom_rcp",
|
||||||
|
fmt("<right><i><global size=16>%s\n<global size=15>%s</i></right>", ES"Custom recipe", desc))
|
||||||
end
|
end
|
||||||
|
|
||||||
local lbl = ES("Usage @1 of @2", data.unum, rn)
|
local lbl = ES("Usage @1 of @2", data.unum, rn)
|
||||||
@ -1110,7 +1161,7 @@ local function get_rcp_lbl(fs, data, panel, rn, is_recipe)
|
|||||||
image_button(data.inv_width + 7.5, y, size, size, "", next_name, "")
|
image_button(data.inv_width + 7.5, y, size, size, "", next_name, "")
|
||||||
end
|
end
|
||||||
|
|
||||||
get_grid_fs(fs, data, rcp, is_recipe)
|
get_grid_fs(fs, data, rcp, is_recipe, is_usage)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function get_model_fs(fs, data, def, model_alias)
|
local function get_model_fs(fs, data, def, model_alias)
|
||||||
@ -1182,27 +1233,27 @@ local function get_header(fs, data)
|
|||||||
fs(fmt("tooltip[exit;%s]", ES"Back to item list"))
|
fs(fmt("tooltip[exit;%s]", ES"Back to item list"))
|
||||||
|
|
||||||
local desc_lim, name_lim = 34, 35
|
local desc_lim, name_lim = 34, 35
|
||||||
local desc = translate(data.lang_code, get_desc(data.query_item))
|
local desc = get_desc(data.query_item, data.lang_code)
|
||||||
desc = ESC(desc)
|
desc = ESC(desc)
|
||||||
local tech_name = data.query_item
|
local tech_name = data.query_item
|
||||||
local X = data.inv_width + 0.95
|
local X = data.inv_width + 0.95
|
||||||
local Y1 = data.yoffset + 0.47
|
local Y1 = data.yoffset + 0.47
|
||||||
local Y2 = Y1 + 0.5
|
local Y2 = Y1 + 0.5
|
||||||
|
|
||||||
if #desc > desc_lim then
|
local _desc = snip(desc, desc_lim, data.font_size)
|
||||||
|
if _desc then
|
||||||
tooltip(X, Y1 - 0.1, 5.7, 0.24, desc)
|
tooltip(X, Y1 - 0.1, 5.7, 0.24, desc)
|
||||||
desc = snip(desc, desc_lim)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if #tech_name > name_lim then
|
local _tech_name = snip(tech_name, name_lim, data.font_size)
|
||||||
|
if _tech_name then
|
||||||
tooltip(X, Y2 - 0.1, 5.7, 0.24, tech_name)
|
tooltip(X, Y2 - 0.1, 5.7, 0.24, tech_name)
|
||||||
tech_name = snip(tech_name, name_lim)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
fs"style_type[label;font=bold;font_size=20]"
|
fs"style_type[label;font=bold;font_size=20]"
|
||||||
label(X, Y1, desc)
|
label(X, Y1, _desc or desc)
|
||||||
fs"style_type[label;font=mono;font_size=16]"
|
fs"style_type[label;font=mono;font_size=16]"
|
||||||
label(X, Y2, clr(colors.blue, tech_name))
|
label(X, Y2, clr(colors.blue, _tech_name or tech_name))
|
||||||
fs"style_type[label;font=normal;font_size=16]"
|
fs"style_type[label;font=normal;font_size=16]"
|
||||||
|
|
||||||
local def = reg_items[data.query_item]
|
local def = reg_items[data.query_item]
|
||||||
@ -1215,16 +1266,16 @@ local function get_header(fs, data)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function get_export_fs(fs, data, is_recipe, is_usage, max_stacks_rcp, max_stacks_usg)
|
local function get_crafting_fs(fs, data, is_recipe, is_usage, max_stacks_rcp, max_stacks_usg)
|
||||||
local name = is_recipe and "rcp" or "usg"
|
local name = is_recipe and "rcp" or "usg"
|
||||||
local show_export = (is_recipe and data.export_rcp) or (is_usage and data.export_usg)
|
local show_crafting = (is_recipe and data.crafting_rcp) or (is_usage and data.crafting_usg)
|
||||||
|
|
||||||
fs(fmt("style[export_%s;fgimg=%s;fgimg_hovered=%s]",
|
fs(fmt("style[crafting_%s;fgimg=%s;fgimg_hovered=%s;content_offset=0]",
|
||||||
name, fmt("%s", show_export and PNG.export_hover or PNG.export), PNG.export_hover))
|
name, fmt("%s", show_crafting and PNG.crafting_hover or PNG.crafting), PNG.crafting_hover))
|
||||||
image_button(data.inv_width + 7.35, data.yoffset + 0.2, 0.45, 0.45, "", fmt("export_%s", name), "")
|
image_button(data.inv_width + 7.35, data.yoffset + 0.2, 0.45, 0.45, "", fmt("crafting_%s", name), "")
|
||||||
fs(fmt("tooltip[export_%s;%s]", name, ES"Quick crafting"))
|
fs(fmt("tooltip[crafting_%s;%s]", name, ES"Quick crafting"))
|
||||||
|
|
||||||
if not show_export then return end
|
if not show_crafting then return end
|
||||||
|
|
||||||
local craft_max = is_recipe and max_stacks_rcp or max_stacks_usg
|
local craft_max = is_recipe and max_stacks_rcp or max_stacks_usg
|
||||||
local stack_fs = (is_recipe and data.scrbar_rcp) or (is_usage and data.scrbar_usg) or 1
|
local stack_fs = (is_recipe and data.scrbar_rcp) or (is_usage and data.scrbar_usg) or 1
|
||||||
@ -1239,12 +1290,20 @@ local function get_export_fs(fs, data, is_recipe, is_usage, max_stacks_rcp, max_
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local x = data.inv_width + 6.8
|
||||||
|
|
||||||
|
fs"style_type[image,button,image_button;noclip=true]"
|
||||||
|
image(x, data.yoffset + 0.8, 3, 2, PNG.bg_content)
|
||||||
|
fs"style[quick_crafting;font_size=16;textcolor=#ddd]"
|
||||||
|
button(x, data.yoffset + 0.85, 3.05, 0.55, "quick_crafting", ES"Quick Crafting")
|
||||||
|
|
||||||
fs(fmt("style[scrbar_%s;noclip=true]", name),
|
fs(fmt("style[scrbar_%s;noclip=true]", name),
|
||||||
fmt("scrollbaroptions[min=1;max=%u;smallstep=1]", craft_max))
|
fmt("scrollbaroptions[min=1;max=%u;smallstep=1]", craft_max))
|
||||||
|
|
||||||
local x = data.inv_width + 8.1
|
scrollbar(x + 0.2, data.yoffset + 1.45, 2.5, 0.35, "horizontal", fmt("scrbar_%s", name), stack_fs)
|
||||||
scrollbar(x, data.yoffset, 2.5, 0.35, "horizontal", fmt("scrbar_%s", name), stack_fs)
|
button(x + 0.2, data.yoffset + 1.85, 2.5, 0.7, fmt("craft_%s", name), ES("Craft (×@1)", stack_fs))
|
||||||
button(x, data.yoffset + 0.4, 2.5, 0.7, fmt("craft_%s", name), ES("Craft (×@1)", stack_fs))
|
|
||||||
|
fs"style_type[label;font_size=16;textcolor=#fff]"
|
||||||
end
|
end
|
||||||
|
|
||||||
local function get_rcp_extra(fs, data, player, panel, is_recipe, is_usage)
|
local function get_rcp_extra(fs, data, player, panel, is_recipe, is_usage)
|
||||||
@ -1266,18 +1325,18 @@ local function get_rcp_extra(fs, data, player, panel, is_recipe, is_usage)
|
|||||||
end
|
end
|
||||||
|
|
||||||
if is_recipe and max_stacks_rcp == 0 then
|
if is_recipe and max_stacks_rcp == 0 then
|
||||||
data.export_rcp = nil
|
data.crafting_rcp = nil
|
||||||
data.scrbar_rcp = 1
|
data.scrbar_rcp = 1
|
||||||
elseif is_usage and max_stacks_usg == 0 then
|
elseif is_usage and max_stacks_usg == 0 then
|
||||||
data.export_usg = nil
|
data.crafting_usg = nil
|
||||||
data.scrbar_usg = 1
|
data.scrbar_usg = 1
|
||||||
end
|
end
|
||||||
|
|
||||||
if max_stacks_rcp > 0 or max_stacks_usg > 0 then
|
if max_stacks_rcp > 0 or max_stacks_usg > 0 then
|
||||||
get_export_fs(fs, data, is_recipe, is_usage, max_stacks_rcp, max_stacks_usg)
|
get_crafting_fs(fs, data, is_recipe, is_usage, max_stacks_rcp, max_stacks_usg)
|
||||||
end
|
end
|
||||||
|
|
||||||
get_rcp_lbl(fs, data, panel, rn, is_recipe)
|
get_rcp_lbl(fs, data, panel, rn, is_recipe, is_usage)
|
||||||
else
|
else
|
||||||
local lbl = is_recipe and ES"No recipes" or ES"No usages"
|
local lbl = is_recipe and ES"No recipes" or ES"No usages"
|
||||||
button(data.inv_width + 0.1, data.yoffset + (panel.height / 2) - 0.5, 7.8, 1, "no_rcp", lbl)
|
button(data.inv_width + 0.1, data.yoffset + (panel.height / 2) - 0.5, 7.8, 1, "no_rcp", lbl)
|
||||||
@ -1316,44 +1375,116 @@ local function hide_items(player, data)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function get_header_items_fs(fs, data)
|
||||||
|
local X = data.inv_width
|
||||||
|
fs"set_focus[filter;true]"
|
||||||
|
|
||||||
|
if data.hide_tabs then
|
||||||
|
fs(fmt("style[enable_search;bgimg=%s;bgimg_hovered=%s;bgimg_pressed=%s]",
|
||||||
|
data.enable_search and PNG.search_hover or PNG.search, PNG.search_hover, PNG.search_hover))
|
||||||
|
image_button(X + 0.3, 0.2, 0.5, 0.5, "", "enable_search", "")
|
||||||
|
fs(fmt("tooltip[enable_search;%s]", ES"Search"))
|
||||||
|
|
||||||
|
if data.enable_search then
|
||||||
|
image(X + 0.4, 0.75, 3.4, 0.8, PNG.bg_goto)
|
||||||
|
|
||||||
|
fs("style[filter;font_size=16]",
|
||||||
|
fmt("field[%f,%f;3,0.45;filter;;%s]", X + 0.6, 0.95, data.filter),
|
||||||
|
"field_close_on_enter[filter;false]")
|
||||||
|
end
|
||||||
|
|
||||||
|
box(X + 1, 0.2, 0.01, 0.5, "#bababa50")
|
||||||
|
local cat = {{"all", "all items"}, {"node", "nodes only"}, {"item", "items only"}}
|
||||||
|
|
||||||
|
for i in ipairs(cat) do
|
||||||
|
local name, desc = unpack(cat[i])
|
||||||
|
local active = PNG[name .. "_hover"]
|
||||||
|
|
||||||
|
fs(fmt("style[itab_%u;bgimg=%s;bgimg_hovered=%s;bgimg_pressed=%s;sound=i3_tab]",
|
||||||
|
i, data.itab == i and active or PNG[name], active, active))
|
||||||
|
image_button(X + 1.25 + ((i - 1) * 0.7), 0.2, 0.5, 0.5, "", fmt("itab_%s", i), "")
|
||||||
|
fs(fmt("tooltip[itab_%u;Show %s]", i, desc))
|
||||||
|
end
|
||||||
|
else
|
||||||
|
fs(fmt("style[search;bgimg=%s]", PNG.search_hover))
|
||||||
|
image_button(X + 0.35, 0.32, 0.35, 0.35, "", "search", "")
|
||||||
|
fs(fmt("tooltip[search;%s]", ES"Search"))
|
||||||
|
|
||||||
|
if data.enable_search then
|
||||||
|
fs("style[filter;font_size=18]",
|
||||||
|
fmt("field[%f,0.2;3.35,0.6;filter;;%s]", X + 0.85, ESC(data.filter)),
|
||||||
|
"field_close_on_enter[filter;false]")
|
||||||
|
|
||||||
|
if not true_str(data.filter) then
|
||||||
|
image(X + 0.85, 0.75, 4, 0.01, PNG.search_outline_trim .. "^[opacity:100")
|
||||||
|
end
|
||||||
|
else
|
||||||
|
fs"style_type[label;font=italic;font_size=18]"
|
||||||
|
label(X + 0.9, 0.49, clr("#aaa", ES"Search..."))
|
||||||
|
button(X + 0.8, 0.12, 4, 0.8, "enable_search", "")
|
||||||
|
fs"style_type[label;font=normal;font_size=16]"
|
||||||
|
end
|
||||||
|
|
||||||
|
if true_str(data.filter) then
|
||||||
|
image_button(X + 4.3, 0.4, 0.2, 0.2, "", "cancel", "")
|
||||||
|
fs(fmt("tooltip[cancel;%s]", ES"Clear"))
|
||||||
|
box(X + 0.85, 0.75, 3.74, 0.01, "#f9826c")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
image_button(X + 5.27, 0.3, 0.35, 0.35, "", "prev_page", "")
|
||||||
|
image_button(X + 7.45, 0.3, 0.35, 0.35, "", "next_page", "")
|
||||||
|
|
||||||
|
fs(fmt("style[pagenum;bgimg=%s;bgimg_hovered=%s;bgimg_middle=9;padding=-9;sound=i3_click]",
|
||||||
|
data.goto_page and PNG.pagenum_hover or "", PNG.pagenum_hover))
|
||||||
|
|
||||||
|
button(X + 5.8, 0.14, 1.48, 0.7, "pagenum",
|
||||||
|
fmt("%s / %u", clr(colors.yellow, data.pagenum), data.pagemax))
|
||||||
|
|
||||||
|
if data.goto_page then
|
||||||
|
image(X + 4.8, 0.85, 2.9, 0.8, PNG.bg_goto)
|
||||||
|
fs"style_type[label;font_size=16;textcolor=#ddd]"
|
||||||
|
label(X + 5, 1.25, ES"Go to page" .. ":")
|
||||||
|
box(X + 6.5, 1, 1, 0.45, "#bababa10")
|
||||||
|
|
||||||
|
fs(fmt("style[goto_page;font=mono,bold;font_size=16;textcolor=%s]", colors.yellow),
|
||||||
|
fmt("field[%f,%f;1,0.45;goto_page;;%s]", X + 6.55, 1.05, data.pagenum),
|
||||||
|
"field_close_on_enter[goto_page;false]")
|
||||||
|
|
||||||
|
fs"style_type[label;font_size=16;textcolor=#fff]"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function get_minitabs(fs, data, full_height)
|
||||||
|
local _tabs = {"All", "Nodes", "Items"}
|
||||||
|
local tab_len, tab_hgh = 1.8, 0.5
|
||||||
|
|
||||||
|
for i, title in ipairs(_tabs) do
|
||||||
|
local selected = i == data.itab
|
||||||
|
local hover_texture = selected and PNG.tab_small_hover or PNG.tab_small
|
||||||
|
|
||||||
|
fs(fmt([[style_type[image_button;bgimg=%s;bgimg_hovered=%s;
|
||||||
|
bgimg_middle=14,0,-14,-14;padding=-14,0,14,14] ]], hover_texture, PNG.tab_small_hover))
|
||||||
|
|
||||||
|
fs(fmt([[style_type[image_button;noclip=true;font=bold;font_size=16;
|
||||||
|
textcolor=%s;content_offset=0;sound=i3_tab] ]], selected and "#fff" or "#bbb"))
|
||||||
|
fs"style_type[image_button:hovered;textcolor=#fff]"
|
||||||
|
image_button((data.inv_width - 0.65) + (i * (tab_len + 0.1)),
|
||||||
|
full_height, tab_len, tab_hgh, "", fmt("itab_%u", i), title)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local function get_items_fs(fs, data, player, full_height)
|
local function get_items_fs(fs, data, player, full_height)
|
||||||
hide_items(player, data)
|
hide_items(player, data)
|
||||||
|
bg9(data.inv_width + 0.1, 0, 7.9, full_height, PNG.bg_full)
|
||||||
|
|
||||||
local items = data.alt_items or data.items or {}
|
local items = data.alt_items or data.items or {}
|
||||||
local rows, lines = 8, 12
|
local rows, lines = 8, 12
|
||||||
local ipp = rows * lines
|
local ipp = rows * lines
|
||||||
local size = 0.85
|
local size = 0.85
|
||||||
|
|
||||||
bg9(data.inv_width + 0.1, 0, 7.9, full_height, PNG.bg_full, 10)
|
|
||||||
|
|
||||||
if data.enable_search then
|
|
||||||
fs("set_focus[filter]",
|
|
||||||
"style[filter;font_size=18;textcolor=#ccc]",
|
|
||||||
fmt("field[%f,0.2;3.35,0.6;filter;;%s]", data.inv_width + 0.85, ESC(data.filter)),
|
|
||||||
"field_close_on_enter[filter;false]")
|
|
||||||
else
|
|
||||||
fs"style_type[label;font=italic;font_size=18]"
|
|
||||||
label(data.inv_width + 0.9, 0.49, clr("#aaa", ES"Search..."))
|
|
||||||
button(data.inv_width + 0.8, 0.1, 4, 0.8, "enable_search", "")
|
|
||||||
end
|
|
||||||
|
|
||||||
image_button(data.inv_width + 0.35, 0.32, 0.35, 0.35, "", "search", "")
|
|
||||||
image_button(data.inv_width + 5.27, 0.3, 0.35, 0.35, "", "prev_page", "")
|
|
||||||
image_button(data.inv_width + 7.45, 0.3, 0.35, 0.35, "", "next_page", "")
|
|
||||||
|
|
||||||
fs(fmt("tooltip[search;%s]", ES"Search"))
|
|
||||||
|
|
||||||
if true_str(data.filter) then
|
|
||||||
image_button(data.inv_width + 4.3, 0.4, 0.2, 0.2, "", "cancel", "")
|
|
||||||
fs(fmt("tooltip[cancel;%s]", ES"Clear"))
|
|
||||||
box(data.inv_width + 0.85, 0.75, 3.74, 0.01, "#f9826c")
|
|
||||||
end
|
|
||||||
|
|
||||||
data.pagemax = max(1, ceil(#items / ipp))
|
data.pagemax = max(1, ceil(#items / ipp))
|
||||||
|
|
||||||
button(data.inv_width + 5.6, 0.14, 1.88, 0.7, "pagenum",
|
|
||||||
fmt("%s / %u", clr(colors.yellow, data.pagenum), data.pagemax))
|
|
||||||
|
|
||||||
if #items == 0 then
|
if #items == 0 then
|
||||||
local lbl = ES"No item to show"
|
local lbl = ES"No item to show"
|
||||||
local icon, width, offset = PNG.no_result, 4, 2
|
local icon, width, offset = PNG.no_result, 4, 2
|
||||||
@ -1394,20 +1525,7 @@ local function get_items_fs(fs, data, player, full_height)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local _tabs = {"All", "Nodes", "Items"}
|
get_header_items_fs(fs, data)
|
||||||
local tab_len, tab_hgh = 1.8, 0.5
|
|
||||||
|
|
||||||
for i, title in ipairs(_tabs) do
|
|
||||||
local selected = i == data.itab
|
|
||||||
fs(fmt([[style_type[image_button;fgimg=%s;fgimg_hovered=%s;noclip=true;
|
|
||||||
font_size=16;textcolor=%s;content_offset=0;sound=i3_tab] ]],
|
|
||||||
selected and PNG.tab_small_hover or PNG.tab_small,
|
|
||||||
PNG.tab_small_hover, selected and "#fff" or "#ddd"))
|
|
||||||
|
|
||||||
fs"style_type[image_button:hovered;textcolor=#fff]"
|
|
||||||
image_button((data.inv_width - 0.65) + (i * (tab_len + 0.1)),
|
|
||||||
full_height, tab_len, tab_hgh, "", fmt("itab_%u", i), title)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local function get_favs(fs, data)
|
local function get_favs(fs, data)
|
||||||
@ -1420,7 +1538,7 @@ local function get_favs(fs, data)
|
|||||||
local Y = data.yoffset + 0.8
|
local Y = data.yoffset + 0.8
|
||||||
|
|
||||||
if data.query_item == item then
|
if data.query_item == item then
|
||||||
image(X, Y, btn_size, btn_size, PNG.slot)
|
slot(X, Y, btn_size, btn_size)
|
||||||
end
|
end
|
||||||
|
|
||||||
item_image_button(X, Y, btn_size, btn_size, item, name, "")
|
item_image_button(X, Y, btn_size, btn_size, item, name, "")
|
||||||
@ -1440,7 +1558,7 @@ local function get_panels(fs, data, player)
|
|||||||
data.yoffset += panels[i - 1].height + 0.1
|
data.yoffset += panels[i - 1].height + 0.1
|
||||||
end
|
end
|
||||||
|
|
||||||
bg9(data.inv_width + 0.1, data.yoffset, 7.9, panel.height, PNG.bg_full, 10)
|
bg9(data.inv_width + 0.1, data.yoffset, 7.9, panel.height, PNG.bg_full)
|
||||||
|
|
||||||
local is_recipe, is_usage = panel.name == "recipes", panel.name == "usages"
|
local is_recipe, is_usage = panel.name == "recipes", panel.name == "usages"
|
||||||
panel.func(fs, data, player, panel, is_recipe, is_usage)
|
panel.func(fs, data, player, panel, is_recipe, is_usage)
|
||||||
@ -1472,11 +1590,18 @@ local function get_tabs_fs(fs, player, data, full_height)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local selected = i == data.tab
|
local selected = i == data.tab
|
||||||
|
local bgimg = selected and (btm and PNG.tab_hover or PNG.tab_hover_top) or
|
||||||
|
(btm and PNG.tab or PNG.tab_top)
|
||||||
|
local bgimg_hover = btm and PNG.tab_hover or PNG.tab_hover_top
|
||||||
|
|
||||||
fs(fmt([[style_type[image_button;fgimg=%s;fgimg_hovered=%s;noclip=true;
|
local middle = btm and "16,0,-16,-16" or "16,16,-16,-16"
|
||||||
font_size=16;textcolor=%s;content_offset=0;sound=i3_tab] ]],
|
local padding = btm and "-16,0,16,16" or "-16,-16,16,16"
|
||||||
selected and (btm and PNG.tab_hover or PNG.tab_hover_top) or (btm and PNG.tab or PNG.tab_top),
|
|
||||||
btm and PNG.tab_hover or PNG.tab_hover_top, selected and "#fff" or "#ddd"))
|
fs(fmt([[style_type[image_button;bgimg=%s;bgimg_hovered=%s;bgimg_middle=%s;padding=%s] ]],
|
||||||
|
bgimg, bgimg_hover, middle, padding))
|
||||||
|
|
||||||
|
fs(fmt("style_type[image_button;noclip=true;font_size=16;textcolor=%s;content_offset=0;sound=i3_tab]",
|
||||||
|
selected and "#fff" or "#ddd"))
|
||||||
|
|
||||||
local X = (data.inv_width / 2) + (c * (tab_len + 0.1)) - ((tab_len + 0.05) * (shift / 2))
|
local X = (data.inv_width / 2) + (c * (tab_len + 0.1)) - ((tab_len + 0.05) * (shift / 2))
|
||||||
local Y = btm and full_height or -tab_hgh
|
local Y = btm and full_height or -tab_hgh
|
||||||
@ -1486,9 +1611,9 @@ local function get_tabs_fs(fs, player, data, full_height)
|
|||||||
|
|
||||||
if true_str(def.image) then
|
if true_str(def.image) then
|
||||||
local desc = translate(data.lang_code, def.description)
|
local desc = translate(data.lang_code, def.description)
|
||||||
local desc_len = utf8_len(desc)
|
local desc_len = utf8_len(desc) + data.font_size
|
||||||
|
|
||||||
fs("style_type[image;noclip=true]")
|
fs"style_type[image;noclip=true]"
|
||||||
image(X + (tab_len / 2) - ((desc_len * 0.1) / 2) - 0.55, Y + 0.05, 0.35, 0.35, def.image)
|
image(X + (tab_len / 2) - ((desc_len * 0.1) / 2) - 0.55, Y + 0.05, 0.35, 0.35, def.image)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -1501,7 +1626,7 @@ local function get_debug_grid(data, fs, full_height)
|
|||||||
button(-2, full_height - 1, 2, 1, "hide_debug_grid", "Toggle grid")
|
button(-2, full_height - 1, 2, 1, "hide_debug_grid", "Toggle grid")
|
||||||
if data.hide_debug_grid then return end
|
if data.hide_debug_grid then return end
|
||||||
|
|
||||||
fs("style_type[label;font_size=8;noclip=true]")
|
fs"style_type[label;font_size=8;noclip=true]"
|
||||||
local spacing, i = 0.2, 1
|
local spacing, i = 0.2, 1
|
||||||
|
|
||||||
for x = 0, data.inv_width + 8, spacing do
|
for x = 0, data.inv_width + 8, spacing do
|
||||||
@ -1545,7 +1670,7 @@ local function make_fs(player, data)
|
|||||||
fs(fmt("formspec_version[%u]size[%f,%f]no_prepend[]bgcolor[#0000]",
|
fs(fmt("formspec_version[%u]size[%f,%f]no_prepend[]bgcolor[#0000]",
|
||||||
i3.settings.min_fs_version, data.inv_width + 8, full_height), styles)
|
i3.settings.min_fs_version, data.inv_width + 8, full_height), styles)
|
||||||
|
|
||||||
bg9(0, 0, data.inv_width, full_height, PNG.bg_full, 10)
|
bg9(0, 0, data.inv_width, full_height, PNG.bg_full)
|
||||||
|
|
||||||
local tab = i3.tabs[data.tab]
|
local tab = i3.tabs[data.tab]
|
||||||
|
|
||||||
@ -1557,6 +1682,10 @@ local function make_fs(player, data)
|
|||||||
get_panels(fs, data, player)
|
get_panels(fs, data, player)
|
||||||
else
|
else
|
||||||
get_items_fs(fs, data, player, full_height)
|
get_items_fs(fs, data, player, full_height)
|
||||||
|
|
||||||
|
if not data.hide_tabs then
|
||||||
|
get_minitabs(fs, data, full_height)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local visible_tabs = #i3.tabs
|
local visible_tabs = #i3.tabs
|
||||||
@ -1577,7 +1706,15 @@ local function make_fs(player, data)
|
|||||||
msg(data.player_name, fmt("#fs elements: %u", #fs))
|
msg(data.player_name, fmt("#fs elements: %u", #fs))
|
||||||
end
|
end
|
||||||
|
|
||||||
return concat(fs)
|
fs = concat(fs)
|
||||||
|
|
||||||
|
if data.font_size ~= 0 then
|
||||||
|
fs = fs:gsub("([font][global]*)([%s_])size=(%d+)", function(a, b, c)
|
||||||
|
return fmt("%s%ssize=%s", a, b, tostring(tonumber(c) + data.font_size))
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
return fs
|
||||||
end
|
end
|
||||||
|
|
||||||
return make_fs, get_inventory_fs
|
return make_fs, get_inventory_fs
|
||||||
|
68
src/hud.lua
@ -1,9 +1,17 @@
|
|||||||
IMPORT("get_connected_players", "str_to_pos", "add_hud_waypoint")
|
IMPORT("ceil", "get_connected_players", "str_to_pos", "add_hud_waypoint")
|
||||||
|
|
||||||
local function init_hud(player)
|
local function init_hud(player)
|
||||||
local name = player:get_player_name()
|
local name = player:get_player_name()
|
||||||
local data = i3.data[name]
|
local data = i3.data[name]
|
||||||
|
|
||||||
|
local wdesc_y = -90
|
||||||
|
|
||||||
|
if core.global_exists"hb" then
|
||||||
|
wdesc_y -= ceil(hb.hudbars_count / 2) * 5
|
||||||
|
elseif not i3.settings.damage_enabled then
|
||||||
|
wdesc_y += 15
|
||||||
|
end
|
||||||
|
|
||||||
data.hud = {
|
data.hud = {
|
||||||
bg = player:hud_add {
|
bg = player:hud_add {
|
||||||
hud_elem_type = "image",
|
hud_elem_type = "image",
|
||||||
@ -32,14 +40,18 @@ local function init_hud(player)
|
|||||||
z_index = 0xDEAD,
|
z_index = 0xDEAD,
|
||||||
style = 1,
|
style = 1,
|
||||||
},
|
},
|
||||||
}
|
|
||||||
|
|
||||||
if not i3.settings.legacy_inventory then
|
wielditem = player:hud_add {
|
||||||
core.after(0, function()
|
hud_elem_type = "text",
|
||||||
player:hud_set_hotbar_itemcount(i3.settings.hotbar_len)
|
position = {x = 0.5, y = 1},
|
||||||
player:hud_set_hotbar_image"i3_hotbar.png"
|
offset = {x = 0, y = wdesc_y},
|
||||||
end)
|
alignment = {x = 0, y = -1},
|
||||||
end
|
number = 0xffffff,
|
||||||
|
text = "",
|
||||||
|
z_index = 0xDEAD,
|
||||||
|
style = 1,
|
||||||
|
},
|
||||||
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
local function show_hud(player, data)
|
local function show_hud(player, data)
|
||||||
@ -91,6 +103,46 @@ local function show_hud(player, data)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
core.register_globalstep(function(dt)
|
||||||
|
local players = get_connected_players()
|
||||||
|
players[0] = #players
|
||||||
|
|
||||||
|
for i = 1, players[0] do
|
||||||
|
local player = players[i]
|
||||||
|
local name = player:get_player_name()
|
||||||
|
local data = i3.data[name]
|
||||||
|
if not data then return end
|
||||||
|
|
||||||
|
if not data.wielditem_hud then
|
||||||
|
player:hud_change(data.hud.wielditem, "text", "")
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
data.timer = (data.timer or 0) + dt
|
||||||
|
local wieldidx = player:get_wield_index()
|
||||||
|
|
||||||
|
if wieldidx == data.old_wieldidx then
|
||||||
|
if data.timer >= i3.settings.wielditem_fade_after then
|
||||||
|
player:hud_change(data.hud.wielditem, "text", "")
|
||||||
|
end
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
data.timer = 0
|
||||||
|
data.old_wieldidx = wieldidx
|
||||||
|
|
||||||
|
local wielditem = player:get_wielded_item()
|
||||||
|
local meta = wielditem:get_meta()
|
||||||
|
|
||||||
|
local meta_desc = meta:get_string"short_description"
|
||||||
|
meta_desc = meta_desc:gsub("\27", "")
|
||||||
|
meta_desc = core.strip_colors(meta_desc)
|
||||||
|
|
||||||
|
local desc = meta_desc ~= "" and meta_desc or wielditem:get_short_description()
|
||||||
|
player:hud_change(data.hud.wielditem, "text", desc:trim())
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
core.register_globalstep(function()
|
core.register_globalstep(function()
|
||||||
local players = get_connected_players()
|
local players = get_connected_players()
|
||||||
players[0] = #players
|
players[0] = #players
|
||||||
|
@ -1,10 +1,14 @@
|
|||||||
|
local fmt = string.format
|
||||||
|
|
||||||
local PNG = {
|
local PNG = {
|
||||||
blank = "i3_blank.png",
|
blank = "i3_blank.png",
|
||||||
bg = "i3_bg.png",
|
bg = "i3_bg.png",
|
||||||
bg_full = "i3_bg_full.png",
|
bg_full = "i3_bg_full.png",
|
||||||
|
bg_goto = "i3_bg_goto.png",
|
||||||
bg_content = "i3_bg_content.png",
|
bg_content = "i3_bg_content.png",
|
||||||
bar = "i3_bar.png",
|
bar = "i3_bar.png",
|
||||||
hotbar = "i3_hotbar.png",
|
hotbar = "i3_hotbar.png",
|
||||||
|
highlight = "i3_highlight.png",
|
||||||
search = "i3_search.png",
|
search = "i3_search.png",
|
||||||
heart = "i3_heart.png",
|
heart = "i3_heart.png",
|
||||||
heart_half = "i3_heart_half.png",
|
heart_half = "i3_heart_half.png",
|
||||||
@ -22,8 +26,9 @@ local PNG = {
|
|||||||
book = "i3_book.png",
|
book = "i3_book.png",
|
||||||
sign = "i3_sign.png",
|
sign = "i3_sign.png",
|
||||||
cancel = "i3_cancel.png",
|
cancel = "i3_cancel.png",
|
||||||
export = "i3_export.png",
|
crafting = "i3_crafting.png",
|
||||||
slot = "i3_slot.png",
|
slot = "i3_slot.png^\\[resize:128x128",
|
||||||
|
pagenum_hover = "i3_slot.png^\\[resize:128x128^\\[opacity:130",
|
||||||
tab = "i3_tab.png",
|
tab = "i3_tab.png",
|
||||||
tab_small = "i3_tab_small.png",
|
tab_small = "i3_tab_small.png",
|
||||||
tab_top = "i3_tab.png^\\[transformFY",
|
tab_top = "i3_tab.png^\\[transformFY",
|
||||||
@ -44,10 +49,15 @@ local PNG = {
|
|||||||
edit = "i3_edit.png",
|
edit = "i3_edit.png",
|
||||||
no_result = "i3_no_result.png",
|
no_result = "i3_no_result.png",
|
||||||
find_more = "i3_find_more.png",
|
find_more = "i3_find_more.png",
|
||||||
|
search_outline = "i3_search_outline.png",
|
||||||
|
search_outline_trim = "i3_search_outline_trim.png",
|
||||||
|
all = "i3_all.png",
|
||||||
|
node = "i3_node.png",
|
||||||
|
item = "i3_item.png",
|
||||||
|
|
||||||
cancel_hover = "i3_cancel.png^\\[brighten",
|
cancel_hover = "i3_cancel.png^\\[brighten",
|
||||||
search_hover = "i3_search.png^\\[brighten",
|
search_hover = "i3_search.png^\\[brighten",
|
||||||
export_hover = "i3_export.png^\\[brighten",
|
crafting_hover = "i3_crafting.png^\\[brighten",
|
||||||
trash_hover = "i3_trash.png^\\[brighten^\\[colorize:#f00:100",
|
trash_hover = "i3_trash.png^\\[brighten^\\[colorize:#f00:100",
|
||||||
compress_hover = "i3_compress.png^\\[brighten",
|
compress_hover = "i3_compress.png^\\[brighten",
|
||||||
sort_hover = "i3_sort.png^\\[brighten",
|
sort_hover = "i3_sort.png^\\[brighten",
|
||||||
@ -67,6 +77,9 @@ local PNG = {
|
|||||||
exit_hover = "i3_exit.png^\\[brighten",
|
exit_hover = "i3_exit.png^\\[brighten",
|
||||||
home_hover = "i3_home.png^\\[brighten",
|
home_hover = "i3_home.png^\\[brighten",
|
||||||
edit_hover = "i3_edit.png^\\[brighten",
|
edit_hover = "i3_edit.png^\\[brighten",
|
||||||
|
all_hover = "i3_all_on.png^\\[brighten",
|
||||||
|
node_hover = "i3_node_on.png^\\[brighten",
|
||||||
|
item_hover = "i3_item_on.png^\\[brighten",
|
||||||
}
|
}
|
||||||
|
|
||||||
local styles = string.format([[
|
local styles = string.format([[
|
||||||
@ -74,12 +87,15 @@ local styles = string.format([[
|
|||||||
style_type[label,field;font_size=16]
|
style_type[label,field;font_size=16]
|
||||||
style_type[button;border=false;content_offset=0]
|
style_type[button;border=false;content_offset=0]
|
||||||
style_type[image_button,item_image_button,checkbox,dropdown;border=false;sound=i3_click]
|
style_type[image_button,item_image_button,checkbox,dropdown;border=false;sound=i3_click]
|
||||||
style_type[item_image_button;bgimg_hovered=%s]
|
style_type[item_image_button;bgimg_middle=9;padding=-9]
|
||||||
|
style_type[item_image_button:hovered;bgimg=%s]
|
||||||
|
|
||||||
style[;sound=]
|
style[;sound=]
|
||||||
style[nofav;sound=i3_cannot]
|
style[nofav;sound=i3_cannot]
|
||||||
|
style[search;content_offset=0]
|
||||||
style[pagenum,no_item,no_rcp;font=bold;font_size=18]
|
style[pagenum,no_item,no_rcp;font=bold;font_size=18]
|
||||||
style[search;fgimg=%s;content_offset=0]
|
style[enable_search:hovered;bgimg=%s]
|
||||||
|
style[enable_search:pressed;bgimg=%s^[opacity:178]
|
||||||
style[exit;fgimg=%s;fgimg_hovered=%s;content_offset=0]
|
style[exit;fgimg=%s;fgimg_hovered=%s;content_offset=0]
|
||||||
style[cancel;fgimg=%s;fgimg_hovered=%s;content_offset=0]
|
style[cancel;fgimg=%s;fgimg_hovered=%s;content_offset=0]
|
||||||
style[prev_page,prev_recipe,prev_usage,prev_sort,prev_skin;fgimg=%s;fgimg_hovered=%s]
|
style[prev_page,prev_recipe,prev_usage,prev_sort,prev_skin;fgimg=%s;fgimg_hovered=%s]
|
||||||
@ -96,13 +112,13 @@ local styles = string.format([[
|
|||||||
style[confirm_trash_yes;sound=i3_trash]
|
style[confirm_trash_yes;sound=i3_trash]
|
||||||
]],
|
]],
|
||||||
PNG.slot,
|
PNG.slot,
|
||||||
PNG.search_hover,
|
PNG.search_outline, PNG.search_outline,
|
||||||
PNG.exit, PNG.exit_hover,
|
PNG.exit, PNG.exit_hover,
|
||||||
PNG.cancel, PNG.cancel_hover,
|
PNG.cancel, PNG.cancel_hover,
|
||||||
PNG.prev, PNG.prev_hover,
|
PNG.prev, PNG.prev_hover,
|
||||||
PNG.next, PNG.next_hover,
|
PNG.next, PNG.next_hover,
|
||||||
PNG.add, PNG.add_hover,
|
PNG.add, PNG.add_hover,
|
||||||
PNG.edit, PNG.edit_hover)
|
PNG.edit, PNG.edit_hover)
|
||||||
|
|
||||||
local fs_elements = {
|
local fs_elements = {
|
||||||
label = "label[%f,%f;%s]",
|
label = "label[%f,%f;%s]",
|
||||||
@ -111,9 +127,10 @@ local fs_elements = {
|
|||||||
tooltip = "tooltip[%f,%f;%f,%f;%s]",
|
tooltip = "tooltip[%f,%f;%f,%f;%s]",
|
||||||
button = "button[%f,%f;%f,%f;%s;%s]",
|
button = "button[%f,%f;%f,%f;%s;%s]",
|
||||||
checkbox = "checkbox[%f,%f;%s;%s;%s]",
|
checkbox = "checkbox[%f,%f;%s;%s;%s]",
|
||||||
|
slot = "image[%f,%f;%f,%f;" .. fmt("%s;9]", PNG.slot),
|
||||||
item_image = "item_image[%f,%f;%f,%f;%s]",
|
item_image = "item_image[%f,%f;%f,%f;%s]",
|
||||||
hypertext = "hypertext[%f,%f;%f,%f;%s;%s]",
|
hypertext = "hypertext[%f,%f;%f,%f;%s;%s]",
|
||||||
bg9 = "background9[%f,%f;%f,%f;%s;false;%u]",
|
bg9 = "background9[%f,%f;%f,%f;%s;false;12]",
|
||||||
scrollbar = "scrollbar[%f,%f;%f,%f;%s;%s;%u]",
|
scrollbar = "scrollbar[%f,%f;%f,%f;%s;%s;%u]",
|
||||||
model = "model[%f,%f;%f,%f;%s;%s;%s;%s;%s;%s;%s]",
|
model = "model[%f,%f;%f,%f;%s;%s;%s;%s;%s;%s;%s]",
|
||||||
image_button = "image_button[%f,%f;%f,%f;%s;%s;%s]",
|
image_button = "image_button[%f,%f;%f,%f;%s;%s;%s]",
|
||||||
|
@ -11,32 +11,39 @@ mt3:get_meta():set_string("description", "Worn Pick")
|
|||||||
mt3:get_meta():set_string("color", "yellow")
|
mt3:get_meta():set_string("color", "yellow")
|
||||||
mt3:set_wear(10000)
|
mt3:set_wear(10000)
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft {
|
||||||
output = mt:to_string(),
|
output = mt:to_string(),
|
||||||
type = "shapeless",
|
type = "shapeless",
|
||||||
recipe = {
|
recipe = {
|
||||||
"default:wood",
|
"default:wood",
|
||||||
mt2:to_string(),
|
mt2:to_string(),
|
||||||
},
|
},
|
||||||
})
|
}
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft {
|
||||||
output = mt3:to_string(),
|
output = mt3:to_string(),
|
||||||
type = "shapeless",
|
type = "shapeless",
|
||||||
recipe = {
|
recipe = {
|
||||||
"default:pick_mese",
|
"default:pick_mese",
|
||||||
"default:diamond",
|
"default:diamond",
|
||||||
},
|
},
|
||||||
})
|
}
|
||||||
|
|
||||||
|
minetest.clear_craft {
|
||||||
|
recipe = {
|
||||||
|
{"default:sand", "default:sand"},
|
||||||
|
{"default:sand", "default:sand"},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
i3.register_craft {
|
i3.register_craft {
|
||||||
url = "https://raw.githubusercontent.com/minetest-mods/i3/main/tests/test_online_recipe.json"
|
url = "https://raw.githubusercontent.com/minetest-mods/i3/main/tests/test_online_recipe.json"
|
||||||
}
|
}
|
||||||
|
|
||||||
i3.register_craft({
|
i3.register_craft {
|
||||||
result = "default:ladder_wood 2",
|
result = "default:ladder_wood 2",
|
||||||
items = {"default:copper_ingot 7, default:tin_ingot, default:steel_ingot 2"},
|
items = {"default:copper_ingot 7, default:tin_ingot, default:steel_ingot 2"},
|
||||||
})
|
}
|
||||||
|
|
||||||
i3.register_craft {
|
i3.register_craft {
|
||||||
result = "default:tree",
|
result = "default:tree",
|
||||||
@ -56,7 +63,7 @@ i3.register_craft {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
i3.register_craft({
|
i3.register_craft {
|
||||||
grid = {
|
grid = {
|
||||||
"X",
|
"X",
|
||||||
"#",
|
"#",
|
||||||
@ -68,9 +75,9 @@ i3.register_craft({
|
|||||||
['X'] = "default:glass 2",
|
['X'] = "default:glass 2",
|
||||||
},
|
},
|
||||||
result = "default:mese 3",
|
result = "default:mese 3",
|
||||||
})
|
}
|
||||||
|
|
||||||
i3.register_craft({
|
i3.register_craft {
|
||||||
grid = {
|
grid = {
|
||||||
"X",
|
"X",
|
||||||
"#X",
|
"#X",
|
||||||
@ -82,9 +89,9 @@ i3.register_craft({
|
|||||||
['X'] = "default:glass 2",
|
['X'] = "default:glass 2",
|
||||||
},
|
},
|
||||||
result = "default:mese 3",
|
result = "default:mese 3",
|
||||||
})
|
}
|
||||||
|
|
||||||
i3.register_craft({
|
i3.register_craft {
|
||||||
grid = {
|
grid = {
|
||||||
"X",
|
"X",
|
||||||
},
|
},
|
||||||
@ -93,10 +100,10 @@ i3.register_craft({
|
|||||||
['X'] = "default:glass 2",
|
['X'] = "default:glass 2",
|
||||||
},
|
},
|
||||||
result = "default:mese 3",
|
result = "default:mese 3",
|
||||||
})
|
}
|
||||||
|
|
||||||
|
|
||||||
i3.register_craft({
|
i3.register_craft {
|
||||||
grid = {
|
grid = {
|
||||||
"X#",
|
"X#",
|
||||||
},
|
},
|
||||||
@ -105,9 +112,9 @@ i3.register_craft({
|
|||||||
['X'] = "default:glass 2",
|
['X'] = "default:glass 2",
|
||||||
},
|
},
|
||||||
result = "default:mese 3",
|
result = "default:mese 3",
|
||||||
})
|
}
|
||||||
|
|
||||||
i3.register_craft({
|
i3.register_craft {
|
||||||
grid = {
|
grid = {
|
||||||
"X#X",
|
"X#X",
|
||||||
},
|
},
|
||||||
@ -116,9 +123,9 @@ i3.register_craft({
|
|||||||
['X'] = "default:glass 2",
|
['X'] = "default:glass 2",
|
||||||
},
|
},
|
||||||
result = "default:mese 3",
|
result = "default:mese 3",
|
||||||
})
|
}
|
||||||
|
|
||||||
i3.register_craft({
|
i3.register_craft {
|
||||||
grid = {
|
grid = {
|
||||||
"X#XX",
|
"X#XX",
|
||||||
},
|
},
|
||||||
@ -127,9 +134,9 @@ i3.register_craft({
|
|||||||
['X'] = "default:glass 2",
|
['X'] = "default:glass 2",
|
||||||
},
|
},
|
||||||
result = "default:mese 3",
|
result = "default:mese 3",
|
||||||
})
|
}
|
||||||
|
|
||||||
i3.register_craft({
|
i3.register_craft {
|
||||||
grid = {
|
grid = {
|
||||||
"X#XX",
|
"X#XX",
|
||||||
"X#X",
|
"X#X",
|
||||||
@ -139,9 +146,9 @@ i3.register_craft({
|
|||||||
['X'] = "default:glass 2",
|
['X'] = "default:glass 2",
|
||||||
},
|
},
|
||||||
result = "default:mese 3",
|
result = "default:mese 3",
|
||||||
})
|
}
|
||||||
|
|
||||||
i3.register_craft({
|
i3.register_craft {
|
||||||
grid = {
|
grid = {
|
||||||
"X#XX",
|
"X#XX",
|
||||||
"X#X",
|
"X#X",
|
||||||
@ -152,9 +159,9 @@ i3.register_craft({
|
|||||||
['X'] = "default:glass 2",
|
['X'] = "default:glass 2",
|
||||||
},
|
},
|
||||||
result = "default:mese 3",
|
result = "default:mese 3",
|
||||||
})
|
}
|
||||||
|
|
||||||
i3.register_craft({
|
i3.register_craft {
|
||||||
grid = {
|
grid = {
|
||||||
"X##XX",
|
"X##XX",
|
||||||
},
|
},
|
||||||
@ -163,9 +170,9 @@ i3.register_craft({
|
|||||||
['X'] = "default:glass 2",
|
['X'] = "default:glass 2",
|
||||||
},
|
},
|
||||||
result = "default:mese 3",
|
result = "default:mese 3",
|
||||||
})
|
}
|
||||||
|
|
||||||
i3.register_craft({
|
i3.register_craft {
|
||||||
grid = {
|
grid = {
|
||||||
"X##X#X",
|
"X##X#X",
|
||||||
},
|
},
|
||||||
@ -174,9 +181,9 @@ i3.register_craft({
|
|||||||
['X'] = "default:glass 2",
|
['X'] = "default:glass 2",
|
||||||
},
|
},
|
||||||
result = "default:mese 3",
|
result = "default:mese 3",
|
||||||
})
|
}
|
||||||
|
|
||||||
i3.register_craft({
|
i3.register_craft {
|
||||||
grid = {
|
grid = {
|
||||||
"X##X#X",
|
"X##X#X",
|
||||||
"",
|
"",
|
||||||
@ -187,9 +194,9 @@ i3.register_craft({
|
|||||||
['X'] = "default:glass 2",
|
['X'] = "default:glass 2",
|
||||||
},
|
},
|
||||||
result = "default:mese 3",
|
result = "default:mese 3",
|
||||||
})
|
}
|
||||||
|
|
||||||
i3.register_craft({
|
i3.register_craft {
|
||||||
grid = {
|
grid = {
|
||||||
"X #",
|
"X #",
|
||||||
" ## ",
|
" ## ",
|
||||||
@ -201,9 +208,9 @@ i3.register_craft({
|
|||||||
['X'] = "default:glass 2",
|
['X'] = "default:glass 2",
|
||||||
},
|
},
|
||||||
result = "default:mese 3",
|
result = "default:mese 3",
|
||||||
})
|
}
|
||||||
|
|
||||||
i3.register_craft({
|
i3.register_craft {
|
||||||
grid = {
|
grid = {
|
||||||
"X #",
|
"X #",
|
||||||
" ## ",
|
" ## ",
|
||||||
@ -215,9 +222,9 @@ i3.register_craft({
|
|||||||
['X'] = "default:glass",
|
['X'] = "default:glass",
|
||||||
},
|
},
|
||||||
result = "default:mese 3",
|
result = "default:mese 3",
|
||||||
})
|
}
|
||||||
|
|
||||||
i3.register_craft({
|
i3.register_craft {
|
||||||
grid = {
|
grid = {
|
||||||
"X #",
|
"X #",
|
||||||
" ## ",
|
" ## ",
|
||||||
@ -230,9 +237,9 @@ i3.register_craft({
|
|||||||
['X'] = "default:glass",
|
['X'] = "default:glass",
|
||||||
},
|
},
|
||||||
result = "default:mese 3",
|
result = "default:mese 3",
|
||||||
})
|
}
|
||||||
|
|
||||||
i3.register_craft({
|
i3.register_craft {
|
||||||
grid = {
|
grid = {
|
||||||
"X #",
|
"X #",
|
||||||
" ## ",
|
" ## ",
|
||||||
@ -245,10 +252,10 @@ i3.register_craft({
|
|||||||
['X'] = "default:glass",
|
['X'] = "default:glass",
|
||||||
},
|
},
|
||||||
result = "default:mese 3",
|
result = "default:mese 3",
|
||||||
})
|
}
|
||||||
|
|
||||||
|
|
||||||
i3.register_craft({
|
i3.register_craft {
|
||||||
grid = {
|
grid = {
|
||||||
"X #",
|
"X #",
|
||||||
" ## ",
|
" ## ",
|
||||||
@ -262,9 +269,9 @@ i3.register_craft({
|
|||||||
['X'] = "default:glass",
|
['X'] = "default:glass",
|
||||||
},
|
},
|
||||||
result = "default:mese 3",
|
result = "default:mese 3",
|
||||||
})
|
}
|
||||||
|
|
||||||
i3.register_craft({
|
i3.register_craft {
|
||||||
grid = {
|
grid = {
|
||||||
"X #",
|
"X #",
|
||||||
" ## ",
|
" ## ",
|
||||||
@ -278,9 +285,9 @@ i3.register_craft({
|
|||||||
['X'] = "default:glass",
|
['X'] = "default:glass",
|
||||||
},
|
},
|
||||||
result = "default:mese 3",
|
result = "default:mese 3",
|
||||||
})
|
}
|
||||||
|
|
||||||
i3.register_craft({
|
i3.register_craft {
|
||||||
grid = {
|
grid = {
|
||||||
"X #",
|
"X #",
|
||||||
" ## ",
|
" ## ",
|
||||||
@ -294,9 +301,9 @@ i3.register_craft({
|
|||||||
['X'] = "default:glass",
|
['X'] = "default:glass",
|
||||||
},
|
},
|
||||||
result = "default:mese 3",
|
result = "default:mese 3",
|
||||||
})
|
}
|
||||||
|
|
||||||
i3.register_craft({
|
i3.register_craft {
|
||||||
grid = {
|
grid = {
|
||||||
"X #",
|
"X #",
|
||||||
" ## ",
|
" ## ",
|
||||||
@ -310,9 +317,9 @@ i3.register_craft({
|
|||||||
['X'] = "default:glass",
|
['X'] = "default:glass",
|
||||||
},
|
},
|
||||||
result = "default:mese 3",
|
result = "default:mese 3",
|
||||||
})
|
}
|
||||||
|
|
||||||
i3.register_craft({
|
i3.register_craft {
|
||||||
grid = {
|
grid = {
|
||||||
"X #",
|
"X #",
|
||||||
" ## ",
|
" ## ",
|
||||||
@ -328,4 +335,4 @@ i3.register_craft({
|
|||||||
['X'] = "default:glass",
|
['X'] = "default:glass",
|
||||||
},
|
},
|
||||||
result = "default:mese 3",
|
result = "default:mese 3",
|
||||||
})
|
}
|
||||||
|
BIN
textures/i3_all.png
Normal file
After Width: | Height: | Size: 2.3 KiB |
BIN
textures/i3_all_on.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
textures/i3_armor_1.png
Normal file
After Width: | Height: | Size: 186 B |
BIN
textures/i3_armor_2.png
Normal file
After Width: | Height: | Size: 191 B |
BIN
textures/i3_armor_3.png
Normal file
After Width: | Height: | Size: 175 B |
BIN
textures/i3_armor_4.png
Normal file
After Width: | Height: | Size: 167 B |
BIN
textures/i3_armor_5.png
Normal file
After Width: | Height: | Size: 141 B |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 2.0 KiB |
BIN
textures/i3_bg_goto.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
textures/i3_crafting.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 3.1 KiB |
BIN
textures/i3_highlight.png
Normal file
After Width: | Height: | Size: 70 B |
BIN
textures/i3_item.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
textures/i3_item_on.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
textures/i3_node.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
textures/i3_node_on.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
textures/i3_search_outline.png
Normal file
After Width: | Height: | Size: 507 B |
BIN
textures/i3_search_outline_trim.png
Normal file
After Width: | Height: | Size: 304 B |
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 2.4 KiB |