Compare commits
No commits in common. "4d63521f545c7ac570b51256c57ebea016aae9a5" and "2b3df66a7df4e97e8552cf881cf16e382d22860e" have entirely different histories.
4d63521f54
...
2b3df66a7d
|
@ -0,0 +1,24 @@
|
|||
---
|
||||
name: Bug report
|
||||
about: Create a report to help us improve
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Describe the bug**
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
**To Reproduce**
|
||||
Steps to reproduce the behavior.
|
||||
|
||||
**Screenshots**
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
|
||||
**Additional context**
|
||||
- Mod version? Release or git?
|
||||
- Engine version?
|
||||
- LuaJIT enabled?
|
||||
- Operating system?
|
||||
- Did you try to disable other mods except i3?
|
|
@ -0,0 +1,21 @@
|
|||
name: Luacheck
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
|
||||
luacheck:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
- name: Setup ‘lua’
|
||||
uses: leafo/gh-actions-lua@v8
|
||||
with:
|
||||
luaVersion: 5.1
|
||||
- name: Setup ‘luarocks’
|
||||
uses: leafo/gh-actions-luarocks@v4
|
||||
- name: Setup ‘luacheck’
|
||||
run: luarocks install luacheck
|
||||
- name: Run ‘luacheck’ linter
|
||||
run: cd util; lua luacheck.lua
|
Before Width: | Height: | Size: 7.4 KiB |
Before Width: | Height: | Size: 15 KiB |
9
API.md
|
@ -16,8 +16,6 @@
|
|||
|
||||
### Tabs
|
||||
|
||||
![Screenshot of the inventory with the below example tab in focus.](.res/api-tabs.png)
|
||||
|
||||
#### `i4.new_tab(name, def)`
|
||||
|
||||
- `name` is the tab name.
|
||||
|
@ -28,8 +26,8 @@ Custom tabs can be added to the `i4` inventory as follow (example):
|
|||
```Lua
|
||||
i4.new_tab("stuff", {
|
||||
description = "Stuff",
|
||||
image = "speech_icon.png", -- Optional, add an image next to the tab description
|
||||
slots = true, -- Optional, whether the inventory slots are shown or not. Disabled by default.
|
||||
image = "image.png", -- Optional, add an image next to the tab description
|
||||
slots = true -- Optional, whether the inventory slots are shown or not. Disabled by default.
|
||||
|
||||
--
|
||||
-- The functions below are all optional
|
||||
|
@ -92,7 +90,6 @@ A list of registered tabs.
|
|||
---
|
||||
|
||||
### Footer buttons
|
||||
![Screenshot of the inventory with the below example footer-button.](.res/api-footer_button.png)
|
||||
|
||||
`i4.new_footer_button(name, def)`
|
||||
|
||||
|
@ -238,7 +235,7 @@ Recipes can be registered from a given URL containing a JSON file (HTTP support
|
|||
|
||||
```Lua
|
||||
i4.register_craft {
|
||||
url = "https://hak.xwx.moe/jadedctrl/minetest-i4/src/master/i4/tests/test_online_recipe.json"
|
||||
url = "https://raw.githubusercontent.com/minetest-mods/i4/main/tests/test_online_recipe.json"
|
||||
}
|
||||
```
|
||||
|
||||
|
|
|
@ -1,37 +1,23 @@
|
|||
# Licenses
|
||||
## Media
|
||||
### Sounds
|
||||
Sounds by Lone_Wolf are under the [CC0](https://creativecommons.org/publicdomain/zero/1.0/):
|
||||
* [`i3_tab.ogg`](sounds/i3_tab.ogg)
|
||||
* [`i3_click.ogg`](sounds/i3_click.ogg)
|
||||
* [`i3_cannot.ogg`](sounds/i3_cannot.ogg)
|
||||
Licenses of media (sounds)
|
||||
--------------------------
|
||||
|
||||
Sounds by MadPanCake are also under the CC0:
|
||||
* [`i3_craft.ogg`](sounds/i3_craft.ogg) — https://freesound.org/people/MadPanCake/sounds/567849/
|
||||
Lone_Wolf (CC0):
|
||||
i3_tab.ogg
|
||||
i3_click.ogg
|
||||
i3_cannot.ogg
|
||||
|
||||
```
|
||||
No Copyright
|
||||
|
||||
The person who associated a work with this deed has dedicated the work to the
|
||||
public domain by waiving all of his or her rights to the work worldwide under
|
||||
copyright law, including all related and neighboring rights, to the extent
|
||||
allowed by law.
|
||||
|
||||
You can copy, modify, distribute and perform the work, even for commercial
|
||||
purposes, all without asking permission.
|
||||
|
||||
For more details:
|
||||
https://creativecommons.org/publicdomain/zero/1.0/
|
||||
```
|
||||
MadPanCake (CC0):
|
||||
i3_craft.ogg (https://freesound.org/people/MadPanCake/sounds/567849/)
|
||||
|
||||
|
||||
|
||||
### Textures
|
||||
Textures by paramat are under the [CC BY-SA 3.0](https://creativecommons.org/licenses/by-sa/3.0/):
|
||||
* [`i3_arrow.png`](textures/i3_arrow.png) — derived from a texture by BlockMen (also CC BY-SA 3.0)
|
||||
* [`i3_hotbar.png`](textures/i3_hotbar.png)
|
||||
Licenses of media (textures)
|
||||
----------------------------
|
||||
|
||||
paramat (CC BY-SA 3.0):
|
||||
i3_arrow.png - derived from a texture by BlockMen (CC BY-SA 3.0)
|
||||
i3_hotbar.png
|
||||
|
||||
```
|
||||
You are free to:
|
||||
Share — copy and redistribute the material in any medium or format.
|
||||
Adapt — remix, transform, and build upon the material for any purpose, even commercially.
|
||||
|
@ -59,15 +45,12 @@ rights may limit how you use the material.
|
|||
|
||||
For more details:
|
||||
http://creativecommons.org/licenses/by-sa/3.0/
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Source code
|
||||
### MIT
|
||||
Code from i3 by Jean-Patrick Guerrero and i3 contributors (SmallJoker & anonymous) is under the MIT license, as follows:
|
||||
License of source code #1 (MIT)
|
||||
-------------------------------
|
||||
|
||||
```
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2020-2023 Jean-Patrick Guerrero and contributors.
|
||||
|
@ -89,14 +72,11 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
```
|
||||
|
||||
|
||||
|
||||
### GPLv3
|
||||
Code for i4 by Jaidyn Ann is under the [GNU GPLv3](https://www.gnu.org/licenses/gpl-3.0.html), as follows:
|
||||
|
||||
```
|
||||
License of source code #2 (GPLv3)
|
||||
---------------------------------
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
|
@ -771,4 +751,4 @@ may consider it more useful to permit linking proprietary applications with
|
|||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
||||
```
|
||||
|
88
README.md
|
@ -1,69 +1,61 @@
|
|||
# ![i4](.res/i4_logo_scaled.png)
|
||||
![i4 logo](res/i4_logo_scaled.png)
|
||||
|
||||
![A screenshot of Minetest displaying i3’s inventory.](.res/screenshot.png)
|
||||
#### **`i4`** is an inventory mod for Minetest.
|
||||
|
||||
[i4](https://hak.xwx.moe/jadedctrl/minetest-i4) is an inventory system for Minetest with a focus on cohesion. It is a fork of [i3](https://github.com/minetest-mods/i3), the “next-generation inventory.” Primary differences to `i3` include an extended [API](API.md), more efficient use of screen-space, and general house-keeping.
|
||||
This mod features a modern, powerful inventory menu with a good user experience.
|
||||
**`i4`** provides a rich [**API**](API.md) for mod developers who want to extend it.
|
||||
|
||||
This mod requires Minetest 5.6+, as it uses newer additions to the formspec API.
|
||||
This mod requires **Minetest 5.6+**
|
||||
|
||||
#### List of features:
|
||||
- Crafting Guide (survival mode only)
|
||||
- Progressive Mode¹
|
||||
- Quick Crafting
|
||||
- 3D Player Model Real-Time Preview
|
||||
- Isometric Map Preview
|
||||
- Inventory Sorting (+ options: compression, reverse mode, automation, etc.)
|
||||
- Item List Compression (**`moreblocks`** is supported)
|
||||
- Item Bookmarks
|
||||
- Waypoints
|
||||
- Bags
|
||||
- Home
|
||||
|
||||
## Features
|
||||
* Crafting guide
|
||||
* Progressive mode
|
||||
* Quick-crafting
|
||||
* 3D player model real-time preview
|
||||
* Isometric map preview
|
||||
* Fine-tunable inventory sorting
|
||||
* Item list compression (with `moreblocks` support)
|
||||
* Item bookmarks
|
||||
* Waypoints
|
||||
* Bags
|
||||
* Home (built-in or minetest_game’s `sethome`)
|
||||
**¹** *This mode is a Terraria-like system that shows recipes you can craft from items you ever had in your inventory.
|
||||
To enable it: `i4_progressive_mode = true` in `minetest.conf`.*
|
||||
|
||||
#### This mod officially supports the following mods:
|
||||
- [**`3d_armor`**](https://content.minetest.net/packages/stu/3d_armor/)
|
||||
- [**`skinsdb`**](https://content.minetest.net/packages/bell07/skinsdb/)
|
||||
- [**`awards`**](https://content.minetest.net/packages/rubenwardy/awards/)
|
||||
|
||||
### Officially-supported mods
|
||||
These mods have menus built-into i4:
|
||||
#### Recommendations
|
||||
|
||||
* [**`3d_armor`**](https://content.minetest.net/packages/stu/3d_armor/)
|
||||
* [**`skinsdb`**](https://content.minetest.net/packages/bell07/skinsdb/)
|
||||
* [**`awards`**](https://content.minetest.net/packages/rubenwardy/awards/)
|
||||
|
||||
|
||||
## Configuration
|
||||
There is currently two [`minetest.conf`](https://wiki.minetest.net/Minetest.conf) settings used by i4:
|
||||
|
||||
* `i4_progressive_mode = false` — A discovery-based system, where the crafting guide only displays recipes whose components you have held before.
|
||||
* `i4_inventory_size = 32` — Players’ inventory-size. Defaults to 32 (or 36, if i3 was previously in use). Only accepted values are 32 and 36.
|
||||
|
||||
|
||||
## Notes
|
||||
i4 uses a larger inventory than the usual inventories in Minetest games.
|
||||
Thus, most chests will be unadapted to this inventory size.
|
||||
The i4 inventory is 9 slots wide by default, such as Minecraft.
|
||||
|
||||
Please report bugs on the [bug tracker](https:///hak.xwx.moe/jadedctrl/minetest-i4/issues) — I don’t bite!
|
||||
|
||||
|
||||
### Recommendations
|
||||
To use this mod in the best conditions:
|
||||
|
||||
- Use LuaJIT
|
||||
- Use the default Freetype font style
|
||||
|
||||
#### Troubleshooting
|
||||
|
||||
### Troubleshooting
|
||||
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.
|
||||
|
||||
You can also use the font size slider in the inventory, settings window.
|
||||
|
||||
#### Notes
|
||||
|
||||
## Source code
|
||||
https://hak.xwx.moe/jadedctrl/minetest-i4
|
||||
`i4` uses a larger inventory than the usual inventories in Minetest games.
|
||||
Thus, most chests will be unadapted to this inventory size.
|
||||
The `i4` inventory is 9 slots wide by default, such as Minecraft.
|
||||
|
||||
Sounds are under the [CC0](LICENSE.md#sounds), by Lone_Wolf & MadPanCake.
|
||||
Textures are under the [CC BY-SA 3.0](LICENSE.md#textures), by paramat & BlockMen.
|
||||
Source code for i4 is under the [GNU GPLv3](LICENSE.md#gplv3), with contributions by Jaidyn Ann `<jadedctrl@posteo.at>`.
|
||||
Code from i3 is under the [MIT license](LICENSE.md#mit), and is by Jean-Patrick Guerrero (with contributions by SmallJoker & anonymous).
|
||||
Report bugs on the [**Bug Tracker**](https:///notabug.org/jadedctrl/i4).
|
||||
|
||||
![Preview](res/screenshot.png)
|
||||
|
||||
#### License
|
||||
|
||||
Sounds are under the CC0, by Lone_Wolf & MadPanCake.
|
||||
Textures are under the CC BY-SA 3.0, by paramat & BlockMen.
|
||||
Source code from 2024 onward is under the GNU GPLv3, contributions by Jaidyn Ann (jadedctrl).
|
||||
Source code pre-2024 is under the MIT license, by Jean-Patrick Guerrero; contributions by SmallJoker & anonymous.
|
||||
|
||||
See [LICENSE.md](LICENSE.md) for details.
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
# i3→i4 Conversion Mod
|
||||
|
||||
This mod is very bare-bones, and it only exists to bridge the gap between i3 and i4.
|
||||
|
||||
Player data from i3 is transferred to i4; and mods that support i3 also work with i4, so long as this mod is present.
|
21
i3/init.lua
|
@ -1,21 +0,0 @@
|
|||
-- This is a placeholder mod, to mimic i3’s presence for mods that test for it.
|
||||
-- It also migrates data from i3 to i4.
|
||||
|
||||
local storage = core.get_mod_storage("i3")
|
||||
local data = core.deserialize(storage:get_string"data") or {}
|
||||
|
||||
if data and not i4.imported then
|
||||
-- i3 stores all user-data in a mod-data table; we copy it verbatim to i4.
|
||||
i4.data = data
|
||||
|
||||
-- By default, i4’s inventory-size is 32; i3’s, however, is 36. i4 will
|
||||
-- default to 36 at init-time if data was imported from i3. But since we’re
|
||||
-- only importing now (and i4 has already been initialized), we need to do
|
||||
-- it ourselves this time.
|
||||
if not i4.settings.inventory_size then
|
||||
i4.settings.inventory_size = 36
|
||||
end
|
||||
|
||||
-- Mark data as imported, so we don’t go through this song-and-dance again.
|
||||
i4.imported = true
|
||||
end
|
|
@ -1,3 +0,0 @@
|
|||
name = i3
|
||||
description = Conversion mod for i3 to i4
|
||||
depends = i4
|
|
@ -1,5 +0,0 @@
|
|||
# i4
|
||||
This is the primary mod for i4; please see the modpack’s [README.md](../README.md).
|
||||
It should be in the directory immediately above this one.
|
||||
|
||||
Alternatively, visit the [Git repository](https://notabug.org/jadedctrl/minetest_i4).
|
|
@ -27,7 +27,6 @@ i4 = {
|
|||
|
||||
damage_enabled = core.settings:get_bool"enable_damage",
|
||||
progressive_mode = core.settings:get_bool"i4_progressive_mode" or core.settings:get_bool"i3_progressive_mode",
|
||||
inventory_size = tonumber(core.settings:get"i4_inventory_size") or (storage:get_int"imported_from_i3" and 36),
|
||||
},
|
||||
|
||||
categories = {
|
||||
|
@ -53,7 +52,7 @@ i4 = {
|
|||
wielditem_hud = true,
|
||||
ignore_hotbar = true,
|
||||
reverse_sorting = true,
|
||||
hotbar_len = true,
|
||||
legacy_inventory = true,
|
||||
},
|
||||
|
||||
default_data = {
|
||||
|
@ -61,7 +60,6 @@ i4 = {
|
|||
font_size = 0,
|
||||
collapse = true,
|
||||
inv_compress = true,
|
||||
hotbar_len = 8,
|
||||
},
|
||||
|
||||
files = {
|
|
@ -1,4 +1,4 @@
|
|||
name = i4
|
||||
description = Cohesive and featureful inventory mod
|
||||
description = Next-generation inventory
|
||||
optional_depends = 3d_armor, skinsdb, awards
|
||||
min_minetest_version = 5.6
|
|
@ -1,3 +0,0 @@
|
|||
name = i4
|
||||
title = i4
|
||||
description = Featureful and cohesive inventory mod
|
Before Width: | Height: | Size: 371 B After Width: | Height: | Size: 371 B |
Before Width: | Height: | Size: 248 B After Width: | Height: | Size: 248 B |
Before Width: | Height: | Size: 41 KiB After Width: | Height: | Size: 41 KiB |
|
@ -1,7 +1,2 @@
|
|||
# The progressive mode shows recipes you can craft from items you ever had in your inventory.
|
||||
i4_progressive_mode (Learn crafting recipes progressively) bool false
|
||||
|
||||
# This sets users’ inventory-size. For now, the only accepted values are 32 and 36.
|
||||
# If this is value is lowered, any players that might lose items will have their items
|
||||
# dropped on the ground.
|
||||
i4_inventory_size (Change the size of players’ inventory) int 32
|
||||
|
|
|
@ -338,9 +338,6 @@ i4.new_footer_button("home", {
|
|||
description = S"Go home",
|
||||
image = "i3_home.png",
|
||||
fields = home_footer_fields,
|
||||
access = function(player, data)
|
||||
return minetest.check_player_privs(player:get_player_name(), {home = true})
|
||||
end
|
||||
})
|
||||
|
||||
i4.register_craft_type("digging", {
|
|
@ -228,7 +228,7 @@ local function init_data(player, info)
|
|||
data.lang_code = get_lang_code(info)
|
||||
data.fs_version = info.formspec_version
|
||||
|
||||
update_inv_size(player, data, i4.settings.inventory_size)
|
||||
update_inv_size(player, data)
|
||||
|
||||
core.after(0, set_fs, player)
|
||||
end
|
||||
|
@ -237,19 +237,17 @@ local function save_data(player_name)
|
|||
local _data = copy(i4.data)
|
||||
|
||||
for name, v in pairs(_data) do
|
||||
for dat in pairs(v) do
|
||||
if not i4.saves[dat] then
|
||||
_data[name][dat] = nil
|
||||
for dat in pairs(v) do
|
||||
if not i4.saves[dat] then
|
||||
_data[name][dat] = nil
|
||||
|
||||
if player_name and i4.data[player_name] then
|
||||
i4.data[player_name][dat] = nil -- To free up some memory
|
||||
end
|
||||
if player_name and i4.data[player_name] then
|
||||
i4.data[player_name][dat] = nil -- To free up some memory
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- This seems like as good a point as any to save whether or not we
|
||||
-- imported data from i3.
|
||||
storage:set_string("data", slz(_data))
|
||||
if i4.imported then
|
||||
storage:set_int("imported_from_i3", 1)
|
||||
|
@ -264,7 +262,6 @@ insert(core.registered_on_joinplayers, 1, function(player)
|
|||
return outdated(name)
|
||||
end
|
||||
|
||||
|
||||
init_data(player, info)
|
||||
init_bags(player)
|
||||
init_hud(player)
|
|
@ -674,27 +674,17 @@ local function get_detached_inv(name, player_name)
|
|||
}
|
||||
end
|
||||
|
||||
-- Change a player’s inventory-size to new_size.
|
||||
local function update_inv_size(player, data, new_size)
|
||||
data.hotbar_len = new_size / 4
|
||||
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()
|
||||
local inv_size = inv:get_size("main")
|
||||
-- Drop items that can’t fit in new inventory size.
|
||||
if inv_size > new_size then
|
||||
sort_inventory(player, data)
|
||||
for i = new_size + 1, inv_size, 1 do
|
||||
minetest.item_drop(inv:get_stack("main", i), player, player:get_pos())
|
||||
end
|
||||
end
|
||||
|
||||
inv:set_size("main", new_size)
|
||||
inv:set_size("main", data.inv_size)
|
||||
|
||||
player:hud_set_hotbar_itemcount(data.hotbar_len)
|
||||
|
||||
core.after(0, function()
|
||||
local hotbar_img = data.hotbar_len == 8 and "gui_hotbar.png" or data.hotbar_len == 9 and "i3_hotbar.png"
|
||||
player:hud_set_hotbar_image(hotbar_img)
|
||||
player:hud_set_hotbar_image(data.legacy_inventory and "gui_hotbar.png" or "i3_hotbar.png")
|
||||
end)
|
||||
end
|
||||
|
|
@ -40,7 +40,9 @@ local function inv_fields(player, data, fields)
|
|||
data[str] = true
|
||||
end
|
||||
|
||||
if str == "collapse" then
|
||||
if str == "legacy_inventory" then
|
||||
update_inv_size(player, data)
|
||||
elseif str == "collapse" then
|
||||
search(data)
|
||||
end
|
||||
|
|
@ -615,9 +615,7 @@ local function settings_footer_fs(player, data, fs)
|
|||
-- i4 stores home coordinates with one decimal of precision, as the blow fmt() statement
|
||||
-- assumes. So we need to trim sethome’s coordinates to one decimal, likewise.
|
||||
local home_pos = sethome.get(player:get_player_name())
|
||||
if home_pos then
|
||||
home = string.format("(%.1f,%.1f,%.1f)", home_pos.x, home_pos.y, home_pos.z)
|
||||
end
|
||||
home = string.format("(%.1f,%.1f,%.1f)", home_pos.x, home_pos.y, home_pos.z)
|
||||
end
|
||||
|
||||
if home then
|
||||
|
@ -636,6 +634,7 @@ local function settings_footer_fs(player, data, fs)
|
|||
|
||||
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))
|
||||
|
||||
if not recipe_filter_set() then
|
||||
|
@ -651,6 +650,8 @@ local function settings_footer_fs(player, data, fs)
|
|||
|
||||
fs("tooltip[cb_hide_tabs;%s;#32333899;#fff]",
|
||||
ES"Enable this option to change the style of the right panel")
|
||||
fs("tooltip[cb_legacy_inventory;%s;#32333899;#fff]",
|
||||
ES"Enable this option to set the classic inventory size in Minetest")
|
||||
fs("tooltip[cb_wielditem_hud;%s;#32333899;#fff]",
|
||||
ES"Enable this option to show the wielded item description in your HUD")
|
||||
fs("tooltip[cb_collapse;%s;#32333899;#fff]",
|
||||
|
@ -693,17 +694,13 @@ end
|
|||
-- Get the inventory-footer’s formspec.
|
||||
local function get_footer(fs, data, player)
|
||||
-- Render individual footer buttons.
|
||||
local i = 1
|
||||
local starting_x = 3.43 - (.3 * (#i4.footer_buttons - 4)) -- Center the icons
|
||||
for _, btn in ipairs(i4.footer_buttons) do
|
||||
if not btn.access or btn.access(player, data) then
|
||||
local btn_name = "footer_" .. btn.name
|
||||
fs("style[%s;fgimg=%s;fgimg_hovered=%s^\\[brighten^\\[colorize:#fff:100;content_offset=0]",
|
||||
btn_name, btn.image, btn.image)
|
||||
image_button(i + starting_x - (i * 0.4), 11.43, 0.35, 0.35, "", btn_name, "")
|
||||
fs("tooltip[%s;%s;#32333899;#fff]", btn_name, btn.description)
|
||||
i++
|
||||
end
|
||||
for i, btn in ipairs(i4.footer_buttons) do
|
||||
local btn_name = "footer_" .. btn.name
|
||||
fs("style[%s;fgimg=%s;fgimg_hovered=%s^\\[brighten^\\[colorize:#fff:100;content_offset=0]",
|
||||
btn_name, btn.image, btn.image)
|
||||
image_button(i + starting_x - (i * 0.4), 11.43, 0.35, 0.35, "", btn_name, "")
|
||||
fs("tooltip[%s;%s;#32333899;#fff]", btn_name, btn.description)
|
||||
end
|
||||
|
||||
-- Render the current-selected button’s formspec, if one is active.
|
||||
|
@ -717,11 +714,11 @@ local function get_footer(fs, data, player)
|
|||
end
|
||||
|
||||
local function get_slots(fs, data, player)
|
||||
local inv_size = player:get_inventory():get_size("main")
|
||||
local legacy_inventory = data.legacy_inventory
|
||||
local hotbar_len = data.hotbar_len
|
||||
local inv_x = (inv_size == 32 and 0.23) or (inv_size == 36 and 0.22)
|
||||
local inv_y = (inv_size == 32 and 6.7) or (inv_size == 36 and 6.9)
|
||||
local spacing = (inv_size == 32 and 0.25) or (inv_size == 36 and 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]"
|
||||
|
@ -733,12 +730,10 @@ local function get_slots(fs, data, player)
|
|||
fs("style_type[list;size=%f;spacing=%f]", size, spacing)
|
||||
fs("list[current_player;main;%f,%f;%u,1;]", inv_x, inv_y, hotbar_len)
|
||||
|
||||
fs("style_type[list;size=%f;spacing=%f,%f]", size, spacing,
|
||||
(inv_size == 32 and 0.15) or (inv_size == 36 and spacing))
|
||||
fs("style_type[list;size=%f;spacing=%f,%f]", size, spacing, legacy_inventory and 0.15 or spacing)
|
||||
|
||||
fs("list[current_player;main;%f,%f;%u,%u;%u]", inv_x, inv_y
|
||||
+ ((inv_size == 32 and 1.25) or (inv_size == 36 and 1.15)),
|
||||
hotbar_len, inv_size / hotbar_len, hotbar_len)
|
||||
fs("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"listring[current_player;craft]listring[current_player;main]"
|
||||
|
||||
|
@ -747,9 +742,8 @@ end
|
|||
|
||||
local function get_inventory_fs(player, data, fs)
|
||||
local props = player:get_properties()
|
||||
local inv_size = player:get_inventory():get_size("main")
|
||||
local ctn_len = 5.7
|
||||
local ctn_hgt = (inv_size == 32 and 6.1) or (inv_size == 36 and 6.3)
|
||||
local ctn_hgt = data.legacy_inventory and 6.1 or 6.3
|
||||
local yoffset = 0
|
||||
|
||||
if props.mesh ~= "" then
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 186 B After Width: | Height: | Size: 186 B |
Before Width: | Height: | Size: 191 B After Width: | Height: | Size: 191 B |
Before Width: | Height: | Size: 175 B After Width: | Height: | Size: 175 B |
Before Width: | Height: | Size: 167 B After Width: | Height: | Size: 167 B |
Before Width: | Height: | Size: 141 B After Width: | Height: | Size: 141 B |
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 382 B After Width: | Height: | Size: 382 B |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 378 B After Width: | Height: | Size: 378 B |
Before Width: | Height: | Size: 372 B After Width: | Height: | Size: 372 B |
Before Width: | Height: | Size: 459 B After Width: | Height: | Size: 459 B |
Before Width: | Height: | Size: 209 B After Width: | Height: | Size: 209 B |
Before Width: | Height: | Size: 70 B After Width: | Height: | Size: 70 B |
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 67 B After Width: | Height: | Size: 67 B |
Before Width: | Height: | Size: 146 B After Width: | Height: | Size: 146 B |
Before Width: | Height: | Size: 146 B After Width: | Height: | Size: 146 B |
Before Width: | Height: | Size: 146 B After Width: | Height: | Size: 146 B |
Before Width: | Height: | Size: 927 B After Width: | Height: | Size: 927 B |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 404 B After Width: | Height: | Size: 404 B |
Before Width: | Height: | Size: 749 B After Width: | Height: | Size: 749 B |
Before Width: | Height: | Size: 528 B After Width: | Height: | Size: 528 B |
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.3 KiB |
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 227 B After Width: | Height: | Size: 227 B |
Before Width: | Height: | Size: 867 B After Width: | Height: | Size: 867 B |
Before Width: | Height: | Size: 198 B After Width: | Height: | Size: 198 B |