Compare commits
10 Enmetoj
2b3df66a7d
...
4d63521f54
Author | SHA1 | Date | |
---|---|---|---|
Jaidyn Ann | 4d63521f54 | ||
Jaidyn Ann | 4c8688190a | ||
Jaidyn Ann | 80ab1f0a3c | ||
Jaidyn Ann | 66ddd2571c | ||
Jaidyn Ann | 73627499da | ||
Jaidyn Ann | e49a197fc3 | ||
Jaidyn Ann | db5e959063 | ||
Jaidyn Ann | e8a34fa861 | ||
Jaidyn Ann | 83d9074e06 | ||
Jaidyn Ann | 4f0b41b61f |
|
@ -1,24 +0,0 @@
|
||||||
---
|
|
||||||
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?
|
|
|
@ -1,21 +0,0 @@
|
||||||
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
|
|
After Width: | Height: | Size: 7.4 KiB |
After Width: | Height: | Size: 15 KiB |
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 |
9
API.md
|
@ -16,6 +16,8 @@
|
||||||
|
|
||||||
### Tabs
|
### Tabs
|
||||||
|
|
||||||
|
![Screenshot of the inventory with the below example tab in focus.](.res/api-tabs.png)
|
||||||
|
|
||||||
#### `i4.new_tab(name, def)`
|
#### `i4.new_tab(name, def)`
|
||||||
|
|
||||||
- `name` is the tab name.
|
- `name` is the tab name.
|
||||||
|
@ -26,8 +28,8 @@ Custom tabs can be added to the `i4` inventory as follow (example):
|
||||||
```Lua
|
```Lua
|
||||||
i4.new_tab("stuff", {
|
i4.new_tab("stuff", {
|
||||||
description = "Stuff",
|
description = "Stuff",
|
||||||
image = "image.png", -- Optional, add an image next to the tab description
|
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.
|
slots = true, -- Optional, whether the inventory slots are shown or not. Disabled by default.
|
||||||
|
|
||||||
--
|
--
|
||||||
-- The functions below are all optional
|
-- The functions below are all optional
|
||||||
|
@ -90,6 +92,7 @@ A list of registered tabs.
|
||||||
---
|
---
|
||||||
|
|
||||||
### Footer buttons
|
### Footer buttons
|
||||||
|
![Screenshot of the inventory with the below example footer-button.](.res/api-footer_button.png)
|
||||||
|
|
||||||
`i4.new_footer_button(name, def)`
|
`i4.new_footer_button(name, def)`
|
||||||
|
|
||||||
|
@ -235,7 +238,7 @@ Recipes can be registered from a given URL containing a JSON file (HTTP support
|
||||||
|
|
||||||
```Lua
|
```Lua
|
||||||
i4.register_craft {
|
i4.register_craft {
|
||||||
url = "https://raw.githubusercontent.com/minetest-mods/i4/main/tests/test_online_recipe.json"
|
url = "https://hak.xwx.moe/jadedctrl/minetest-i4/src/master/i4/tests/test_online_recipe.json"
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -1,23 +1,37 @@
|
||||||
Licenses of media (sounds)
|
# 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)
|
||||||
|
|
||||||
Lone_Wolf (CC0):
|
Sounds by MadPanCake are also under the CC0:
|
||||||
i3_tab.ogg
|
* [`i3_craft.ogg`](sounds/i3_craft.ogg) — https://freesound.org/people/MadPanCake/sounds/567849/
|
||||||
i3_click.ogg
|
|
||||||
i3_cannot.ogg
|
|
||||||
|
|
||||||
MadPanCake (CC0):
|
```
|
||||||
i3_craft.ogg (https://freesound.org/people/MadPanCake/sounds/567849/)
|
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/
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Licenses of media (textures)
|
### 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)
|
||||||
paramat (CC BY-SA 3.0):
|
* [`i3_hotbar.png`](textures/i3_hotbar.png)
|
||||||
i3_arrow.png - derived from a texture by BlockMen (CC BY-SA 3.0)
|
|
||||||
i3_hotbar.png
|
|
||||||
|
|
||||||
|
```
|
||||||
You are free to:
|
You are free to:
|
||||||
Share — copy and redistribute the material in any medium or format.
|
Share — copy and redistribute the material in any medium or format.
|
||||||
Adapt — remix, transform, and build upon the material for any purpose, even commercially.
|
Adapt — remix, transform, and build upon the material for any purpose, even commercially.
|
||||||
|
@ -45,12 +59,15 @@ rights may limit how you use the material.
|
||||||
|
|
||||||
For more details:
|
For more details:
|
||||||
http://creativecommons.org/licenses/by-sa/3.0/
|
http://creativecommons.org/licenses/by-sa/3.0/
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
License of source code #1 (MIT)
|
## Source code
|
||||||
-------------------------------
|
### MIT
|
||||||
|
Code from i3 by Jean-Patrick Guerrero and i3 contributors (SmallJoker & anonymous) is under the MIT license, as follows:
|
||||||
|
|
||||||
|
```
|
||||||
The MIT License (MIT)
|
The MIT License (MIT)
|
||||||
|
|
||||||
Copyright (c) 2020-2023 Jean-Patrick Guerrero and contributors.
|
Copyright (c) 2020-2023 Jean-Patrick Guerrero and contributors.
|
||||||
|
@ -72,11 +89,14 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
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
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
THE SOFTWARE.
|
THE SOFTWARE.
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
License of source code #2 (GPLv3)
|
### GPLv3
|
||||||
---------------------------------
|
Code for i4 by Jaidyn Ann is under the [GNU GPLv3](https://www.gnu.org/licenses/gpl-3.0.html), as follows:
|
||||||
|
|
||||||
|
```
|
||||||
GNU GENERAL PUBLIC LICENSE
|
GNU GENERAL PUBLIC LICENSE
|
||||||
Version 3, 29 June 2007
|
Version 3, 29 June 2007
|
||||||
|
|
||||||
|
@ -751,4 +771,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
|
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
|
Public License instead of this License. But first, please read
|
||||||
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
||||||
|
```
|
88
README.md
|
@ -1,61 +1,69 @@
|
||||||
![i4 logo](res/i4_logo_scaled.png)
|
# ![i4](.res/i4_logo_scaled.png)
|
||||||
|
|
||||||
#### **`i4`** is an inventory mod for Minetest.
|
![A screenshot of Minetest displaying i3’s inventory.](.res/screenshot.png)
|
||||||
|
|
||||||
This mod features a modern, powerful inventory menu with a good user experience.
|
[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.
|
||||||
**`i4`** provides a rich [**API**](API.md) for mod developers who want to extend it.
|
|
||||||
|
|
||||||
This mod requires **Minetest 5.6+**
|
This mod requires Minetest 5.6+, as it uses newer additions to the formspec API.
|
||||||
|
|
||||||
#### 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
|
|
||||||
|
|
||||||
**¹** *This mode is a Terraria-like system that shows recipes you can craft from items you ever had in your inventory.
|
## Features
|
||||||
To enable it: `i4_progressive_mode = true` in `minetest.conf`.*
|
* 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 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/)
|
|
||||||
|
|
||||||
#### Recommendations
|
### Officially-supported mods
|
||||||
|
These mods have menus built-into i4:
|
||||||
|
|
||||||
|
* [**`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:
|
To use this mod in the best conditions:
|
||||||
|
|
||||||
- Use LuaJIT
|
- Use LuaJIT
|
||||||
- Use the default Freetype font style
|
- Use the default Freetype font style
|
||||||
|
|
||||||
#### 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
|
### 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
|
||||||
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.
|
You can also use the font size slider in the inventory, settings window.
|
||||||
|
|
||||||
#### Notes
|
|
||||||
|
|
||||||
`i4` uses a larger inventory than the usual inventories in Minetest games.
|
## Source code
|
||||||
Thus, most chests will be unadapted to this inventory size.
|
https://hak.xwx.moe/jadedctrl/minetest-i4
|
||||||
The `i4` inventory is 9 slots wide by default, such as Minecraft.
|
|
||||||
|
|
||||||
Report bugs on the [**Bug Tracker**](https:///notabug.org/jadedctrl/i4).
|
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.
|
||||||
![Preview](res/screenshot.png)
|
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).
|
||||||
#### 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.
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
# 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.
|
|
@ -0,0 +1,21 @@
|
||||||
|
-- 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
|
|
@ -0,0 +1,3 @@
|
||||||
|
name = i3
|
||||||
|
description = Conversion mod for i3 to i4
|
||||||
|
depends = i4
|
|
@ -0,0 +1,5 @@
|
||||||
|
# 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,6 +27,7 @@ i4 = {
|
||||||
|
|
||||||
damage_enabled = core.settings:get_bool"enable_damage",
|
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",
|
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 = {
|
categories = {
|
||||||
|
@ -52,7 +53,7 @@ i4 = {
|
||||||
wielditem_hud = true,
|
wielditem_hud = true,
|
||||||
ignore_hotbar = true,
|
ignore_hotbar = true,
|
||||||
reverse_sorting = true,
|
reverse_sorting = true,
|
||||||
legacy_inventory = true,
|
hotbar_len = true,
|
||||||
},
|
},
|
||||||
|
|
||||||
default_data = {
|
default_data = {
|
||||||
|
@ -60,6 +61,7 @@ i4 = {
|
||||||
font_size = 0,
|
font_size = 0,
|
||||||
collapse = true,
|
collapse = true,
|
||||||
inv_compress = true,
|
inv_compress = true,
|
||||||
|
hotbar_len = 8,
|
||||||
},
|
},
|
||||||
|
|
||||||
files = {
|
files = {
|
|
@ -1,4 +1,4 @@
|
||||||
name = i4
|
name = i4
|
||||||
description = Next-generation inventory
|
description = Cohesive and featureful inventory mod
|
||||||
optional_depends = 3d_armor, skinsdb, awards
|
optional_depends = 3d_armor, skinsdb, awards
|
||||||
min_minetest_version = 5.6
|
min_minetest_version = 5.6
|
|
@ -338,6 +338,9 @@ i4.new_footer_button("home", {
|
||||||
description = S"Go home",
|
description = S"Go home",
|
||||||
image = "i3_home.png",
|
image = "i3_home.png",
|
||||||
fields = home_footer_fields,
|
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", {
|
i4.register_craft_type("digging", {
|
|
@ -228,7 +228,7 @@ local function init_data(player, info)
|
||||||
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
|
||||||
|
|
||||||
update_inv_size(player, data)
|
update_inv_size(player, data, i4.settings.inventory_size)
|
||||||
|
|
||||||
core.after(0, set_fs, player)
|
core.after(0, set_fs, player)
|
||||||
end
|
end
|
||||||
|
@ -248,6 +248,8 @@ local function save_data(player_name)
|
||||||
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))
|
storage:set_string("data", slz(_data))
|
||||||
if i4.imported then
|
if i4.imported then
|
||||||
storage:set_int("imported_from_i3", 1)
|
storage:set_int("imported_from_i3", 1)
|
||||||
|
@ -262,6 +264,7 @@ insert(core.registered_on_joinplayers, 1, function(player)
|
||||||
return outdated(name)
|
return outdated(name)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
init_data(player, info)
|
init_data(player, info)
|
||||||
init_bags(player)
|
init_bags(player)
|
||||||
init_hud(player)
|
init_hud(player)
|
|
@ -674,17 +674,27 @@ local function get_detached_inv(name, player_name)
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
local function update_inv_size(player, data)
|
-- Change a player’s inventory-size to new_size.
|
||||||
data.hotbar_len = data.legacy_inventory and 8 or 9
|
local function update_inv_size(player, data, new_size)
|
||||||
data.inv_size = 4 * data.hotbar_len
|
data.hotbar_len = new_size / 4
|
||||||
|
|
||||||
local inv = player:get_inventory()
|
local inv = player:get_inventory()
|
||||||
inv:set_size("main", data.inv_size)
|
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)
|
||||||
|
|
||||||
player:hud_set_hotbar_itemcount(data.hotbar_len)
|
player:hud_set_hotbar_itemcount(data.hotbar_len)
|
||||||
|
|
||||||
core.after(0, function()
|
core.after(0, function()
|
||||||
player:hud_set_hotbar_image(data.legacy_inventory and "gui_hotbar.png" or "i3_hotbar.png")
|
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)
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
|
@ -40,9 +40,7 @@ local function inv_fields(player, data, fields)
|
||||||
data[str] = true
|
data[str] = true
|
||||||
end
|
end
|
||||||
|
|
||||||
if str == "legacy_inventory" then
|
if str == "collapse" then
|
||||||
update_inv_size(player, data)
|
|
||||||
elseif str == "collapse" then
|
|
||||||
search(data)
|
search(data)
|
||||||
end
|
end
|
||||||
|
|
|
@ -615,8 +615,10 @@ local function settings_footer_fs(player, data, fs)
|
||||||
-- i4 stores home coordinates with one decimal of precision, as the blow fmt() statement
|
-- 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.
|
-- assumes. So we need to trim sethome’s coordinates to one decimal, likewise.
|
||||||
local home_pos = sethome.get(player:get_player_name())
|
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)
|
home = string.format("(%.1f,%.1f,%.1f)", home_pos.x, home_pos.y, home_pos.z)
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
if home then
|
if home then
|
||||||
str = home:gsub(",", " "):sub(2,-2):gsub("%.%d", ""):gsub(
|
str = home:gsub(",", " "):sub(2,-2):gsub("%.%d", ""):gsub(
|
||||||
|
@ -634,7 +636,6 @@ local function settings_footer_fs(player, data, fs)
|
||||||
|
|
||||||
elseif show_style then
|
elseif show_style then
|
||||||
checkbox(2.6, 9.95, "cb_hide_tabs", "Hide tabs", tostring(data.hide_tabs))
|
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))
|
checkbox(2.6, 10.85, "cb_wielditem_hud", "HUD description", tostring(data.wielditem_hud))
|
||||||
|
|
||||||
if not recipe_filter_set() then
|
if not recipe_filter_set() then
|
||||||
|
@ -650,8 +651,6 @@ local function settings_footer_fs(player, data, fs)
|
||||||
|
|
||||||
fs("tooltip[cb_hide_tabs;%s;#32333899;#fff]",
|
fs("tooltip[cb_hide_tabs;%s;#32333899;#fff]",
|
||||||
ES"Enable this option to change the style of the right panel")
|
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]",
|
fs("tooltip[cb_wielditem_hud;%s;#32333899;#fff]",
|
||||||
ES"Enable this option to show the wielded item description in your HUD")
|
ES"Enable this option to show the wielded item description in your HUD")
|
||||||
fs("tooltip[cb_collapse;%s;#32333899;#fff]",
|
fs("tooltip[cb_collapse;%s;#32333899;#fff]",
|
||||||
|
@ -694,13 +693,17 @@ end
|
||||||
-- Get the inventory-footer’s formspec.
|
-- Get the inventory-footer’s formspec.
|
||||||
local function get_footer(fs, data, player)
|
local function get_footer(fs, data, player)
|
||||||
-- Render individual footer buttons.
|
-- Render individual footer buttons.
|
||||||
|
local i = 1
|
||||||
local starting_x = 3.43 - (.3 * (#i4.footer_buttons - 4)) -- Center the icons
|
local starting_x = 3.43 - (.3 * (#i4.footer_buttons - 4)) -- Center the icons
|
||||||
for i, btn in ipairs(i4.footer_buttons) do
|
for _, btn in ipairs(i4.footer_buttons) do
|
||||||
|
if not btn.access or btn.access(player, data) then
|
||||||
local btn_name = "footer_" .. btn.name
|
local btn_name = "footer_" .. btn.name
|
||||||
fs("style[%s;fgimg=%s;fgimg_hovered=%s^\\[brighten^\\[colorize:#fff:100;content_offset=0]",
|
fs("style[%s;fgimg=%s;fgimg_hovered=%s^\\[brighten^\\[colorize:#fff:100;content_offset=0]",
|
||||||
btn_name, btn.image, btn.image)
|
btn_name, btn.image, btn.image)
|
||||||
image_button(i + starting_x - (i * 0.4), 11.43, 0.35, 0.35, "", btn_name, "")
|
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)
|
fs("tooltip[%s;%s;#32333899;#fff]", btn_name, btn.description)
|
||||||
|
i++
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Render the current-selected button’s formspec, if one is active.
|
-- Render the current-selected button’s formspec, if one is active.
|
||||||
|
@ -714,11 +717,11 @@ local function get_footer(fs, data, player)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function get_slots(fs, data, player)
|
local function get_slots(fs, data, player)
|
||||||
local legacy_inventory = data.legacy_inventory
|
local inv_size = player:get_inventory():get_size("main")
|
||||||
local hotbar_len = data.hotbar_len
|
local hotbar_len = data.hotbar_len
|
||||||
local inv_x = legacy_inventory and 0.23 or 0.22
|
local inv_x = (inv_size == 32 and 0.23) or (inv_size == 36 and 0.22)
|
||||||
local inv_y = legacy_inventory and 6.7 or 6.9
|
local inv_y = (inv_size == 32 and 6.7) or (inv_size == 36 and 6.9)
|
||||||
local spacing = legacy_inventory and 0.25 or 0.1
|
local spacing = (inv_size == 32 and 0.25) or (inv_size == 36 and 0.1)
|
||||||
local size = 1
|
local size = 1
|
||||||
|
|
||||||
fs"style_type[box;colors=#77777710,#77777710,#777,#777]"
|
fs"style_type[box;colors=#77777710,#77777710,#777,#777]"
|
||||||
|
@ -730,10 +733,12 @@ local function get_slots(fs, data, player)
|
||||||
fs("style_type[list;size=%f;spacing=%f]", size, spacing)
|
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("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, legacy_inventory and 0.15 or spacing)
|
fs("style_type[list;size=%f;spacing=%f,%f]", size, spacing,
|
||||||
|
(inv_size == 32 and 0.15) or (inv_size == 36 and spacing))
|
||||||
|
|
||||||
fs("list[current_player;main;%f,%f;%u,%u;%u]", inv_x, inv_y + (legacy_inventory and 1.25 or 1.15),
|
fs("list[current_player;main;%f,%f;%u,%u;%u]", inv_x, inv_y
|
||||||
hotbar_len, data.inv_size / hotbar_len, hotbar_len)
|
+ ((inv_size == 32 and 1.25) or (inv_size == 36 and 1.15)),
|
||||||
|
hotbar_len, inv_size / hotbar_len, hotbar_len)
|
||||||
|
|
||||||
fs"listring[current_player;craft]listring[current_player;main]"
|
fs"listring[current_player;craft]listring[current_player;main]"
|
||||||
|
|
||||||
|
@ -742,8 +747,9 @@ end
|
||||||
|
|
||||||
local function get_inventory_fs(player, data, fs)
|
local function get_inventory_fs(player, data, fs)
|
||||||
local props = player:get_properties()
|
local props = player:get_properties()
|
||||||
|
local inv_size = player:get_inventory():get_size("main")
|
||||||
local ctn_len = 5.7
|
local ctn_len = 5.7
|
||||||
local ctn_hgt = data.legacy_inventory and 6.1 or 6.3
|
local ctn_hgt = (inv_size == 32 and 6.1) or (inv_size == 36 and 6.3)
|
||||||
local yoffset = 0
|
local yoffset = 0
|
||||||
|
|
||||||
if props.mesh ~= "" then
|
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 |
Before Width: | Height: | Size: 150 B After Width: | Height: | Size: 150 B |
Before Width: | Height: | Size: 70 B After Width: | Height: | Size: 70 B |