mods that hopefully work for a TechAge-based pack

This commit is contained in:
2026-09-09 06:27:51 -06:00
parent 4e6b08d194
commit c27db2a537
6234 changed files with 375578 additions and 0 deletions
@@ -0,0 +1,10 @@
name: luacheck
on: [push, pull_request]
jobs:
luacheck:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@main
- name: Luacheck
uses: lunarmodules/luacheck@master
+13
View File
@@ -0,0 +1,13 @@
unused_args = false
globals = {
"unified_inventory",
"unified_inventory_plus",
}
read_globals = {
"minetest",
"stamina",
"ItemStack",
"fakelib",
}
+168
View File
@@ -0,0 +1,168 @@
this license is for the code.
any non-code media included in this repository is covered by the contents of MEDIA_LICENSE.txt.
GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
This version of the GNU Lesser General Public License incorporates
the terms and conditions of version 3 of the GNU General Public
License, supplemented by the additional permissions listed below.
0. Additional Definitions.
As used herein, "this License" refers to version 3 of the GNU Lesser
General Public License, and the "GNU GPL" refers to version 3 of the GNU
General Public License.
"The Library" refers to a covered work governed by this License,
other than an Application or a Combined Work as defined below.
An "Application" is any work that makes use of an interface provided
by the Library, but which is not otherwise based on the Library.
Defining a subclass of a class defined by the Library is deemed a mode
of using an interface provided by the Library.
A "Combined Work" is a work produced by combining or linking an
Application with the Library. The particular version of the Library
with which the Combined Work was made is also called the "Linked
Version".
The "Minimal Corresponding Source" for a Combined Work means the
Corresponding Source for the Combined Work, excluding any source code
for portions of the Combined Work that, considered in isolation, are
based on the Application, and not on the Linked Version.
The "Corresponding Application Code" for a Combined Work means the
object code and/or source code for the Application, including any data
and utility programs needed for reproducing the Combined Work from the
Application, but excluding the System Libraries of the Combined Work.
1. Exception to Section 3 of the GNU GPL.
You may convey a covered work under sections 3 and 4 of this License
without being bound by section 3 of the GNU GPL.
2. Conveying Modified Versions.
If you modify a copy of the Library, and, in your modifications, a
facility refers to a function or data to be supplied by an Application
that uses the facility (other than as an argument passed when the
facility is invoked), then you may convey a copy of the modified
version:
a) under this License, provided that you make a good faith effort to
ensure that, in the event an Application does not supply the
function or data, the facility still operates, and performs
whatever part of its purpose remains meaningful, or
b) under the GNU GPL, with none of the additional permissions of
this License applicable to that copy.
3. Object Code Incorporating Material from Library Header Files.
The object code form of an Application may incorporate material from
a header file that is part of the Library. You may convey such object
code under terms of your choice, provided that, if the incorporated
material is not limited to numerical parameters, data structure
layouts and accessors, or small macros, inline functions and templates
(ten or fewer lines in length), you do both of the following:
a) Give prominent notice with each copy of the object code that the
Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the object code with a copy of the GNU GPL and this license
document.
4. Combined Works.
You may convey a Combined Work under terms of your choice that,
taken together, effectively do not restrict modification of the
portions of the Library contained in the Combined Work and reverse
engineering for debugging such modifications, if you also do each of
the following:
a) Give prominent notice with each copy of the Combined Work that
the Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the Combined Work with a copy of the GNU GPL and this license
document.
c) For a Combined Work that displays copyright notices during
execution, include the copyright notice for the Library among
these notices, as well as a reference directing the user to the
copies of the GNU GPL and this license document.
d) Do one of the following:
0) Convey the Minimal Corresponding Source under the terms of this
License, and the Corresponding Application Code in a form
suitable for, and under terms that permit, the user to
recombine or relink the Application with a modified version of
the Linked Version to produce a modified Combined Work, in the
manner specified by section 6 of the GNU GPL for conveying
Corresponding Source.
1) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (a) uses at run time
a copy of the Library already present on the user's computer
system, and (b) will operate properly with a modified version
of the Library that is interface-compatible with the Linked
Version.
e) Provide Installation Information, but only if you would otherwise
be required to provide such information under section 6 of the
GNU GPL, and only to the extent that such information is
necessary to install and execute a modified version of the
Combined Work produced by recombining or relinking the
Application with a modified version of the Linked Version. (If
you use option 4d0, the Installation Information must accompany
the Minimal Corresponding Source and Corresponding Application
Code. If you use option 4d1, you must provide the Installation
Information in the manner specified by section 6 of the GNU GPL
for conveying Corresponding Source.)
5. Combined Libraries.
You may place library facilities that are a work based on the
Library side by side in a single library together with other library
facilities that are not Applications and are not covered by this
License, and convey such a combined library under terms of your
choice, if you do both of the following:
a) Accompany the combined library with a copy of the same work based
on the Library, uncombined with any other library facilities,
conveyed under the terms of this License.
b) Give prominent notice with the combined library that part of it
is a work based on the Library, and explaining where to find the
accompanying uncombined form of the same work.
6. Revised Versions of the GNU Lesser General Public License.
The Free Software Foundation may publish revised and/or new versions
of the GNU Lesser General Public License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the
Library as you received it specifies that a certain numbered version
of the GNU Lesser General Public License "or any later version"
applies to it, you have the option of following the terms and
conditions either of that published version or of any later version
published by the Free Software Foundation. If the Library as you
received it does not specify a version number of the GNU Lesser
General Public License, you may choose any version of the GNU Lesser
General Public License ever published by the Free Software Foundation.
If the Library as you received it specifies that a proxy can decide
whether future versions of the GNU Lesser General Public License shall
apply, that proxy's public statement of acceptance of any version is
permanent authorization for you to choose that version for the
Library.
@@ -0,0 +1,121 @@
Creative Commons Legal Code
CC0 1.0 Universal
CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
HEREUNDER.
Statement of Purpose
The laws of most jurisdictions throughout the world automatically confer
exclusive Copyright and Related Rights (defined below) upon the creator
and subsequent owner(s) (each and all, an "owner") of an original work of
authorship and/or a database (each, a "Work").
Certain owners wish to permanently relinquish those rights to a Work for
the purpose of contributing to a commons of creative, cultural and
scientific works ("Commons") that the public can reliably and without fear
of later claims of infringement build upon, modify, incorporate in other
works, reuse and redistribute as freely as possible in any form whatsoever
and for any purposes, including without limitation commercial purposes.
These owners may contribute to the Commons to promote the ideal of a free
culture and the further production of creative, cultural and scientific
works, or to gain reputation or greater distribution for their Work in
part through the use and efforts of others.
For these and/or other purposes and motivations, and without any
expectation of additional consideration or compensation, the person
associating CC0 with a Work (the "Affirmer"), to the extent that he or she
is an owner of Copyright and Related Rights in the Work, voluntarily
elects to apply CC0 to the Work and publicly distribute the Work under its
terms, with knowledge of his or her Copyright and Related Rights in the
Work and the meaning and intended legal effect of CC0 on those rights.
1. Copyright and Related Rights. A Work made available under CC0 may be
protected by copyright and related or neighboring rights ("Copyright and
Related Rights"). Copyright and Related Rights include, but are not
limited to, the following:
i. the right to reproduce, adapt, distribute, perform, display,
communicate, and translate a Work;
ii. moral rights retained by the original author(s) and/or performer(s);
iii. publicity and privacy rights pertaining to a person's image or
likeness depicted in a Work;
iv. rights protecting against unfair competition in regards to a Work,
subject to the limitations in paragraph 4(a), below;
v. rights protecting the extraction, dissemination, use and reuse of data
in a Work;
vi. database rights (such as those arising under Directive 96/9/EC of the
European Parliament and of the Council of 11 March 1996 on the legal
protection of databases, and under any national implementation
thereof, including any amended or successor version of such
directive); and
vii. other similar, equivalent or corresponding rights throughout the
world based on applicable law or treaty, and any national
implementations thereof.
2. Waiver. To the greatest extent permitted by, but not in contravention
of, applicable law, Affirmer hereby overtly, fully, permanently,
irrevocably and unconditionally waives, abandons, and surrenders all of
Affirmer's Copyright and Related Rights and associated claims and causes
of action, whether now known or unknown (including existing as well as
future claims and causes of action), in the Work (i) in all territories
worldwide, (ii) for the maximum duration provided by applicable law or
treaty (including future time extensions), (iii) in any current or future
medium and for any number of copies, and (iv) for any purpose whatsoever,
including without limitation commercial, advertising or promotional
purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
member of the public at large and to the detriment of Affirmer's heirs and
successors, fully intending that such Waiver shall not be subject to
revocation, rescission, cancellation, termination, or any other legal or
equitable action to disrupt the quiet enjoyment of the Work by the public
as contemplated by Affirmer's express Statement of Purpose.
3. Public License Fallback. Should any part of the Waiver for any reason
be judged legally invalid or ineffective under applicable law, then the
Waiver shall be preserved to the maximum extent permitted taking into
account Affirmer's express Statement of Purpose. In addition, to the
extent the Waiver is so judged Affirmer hereby grants to each affected
person a royalty-free, non transferable, non sublicensable, non exclusive,
irrevocable and unconditional license to exercise Affirmer's Copyright and
Related Rights in the Work (i) in all territories worldwide, (ii) for the
maximum duration provided by applicable law or treaty (including future
time extensions), (iii) in any current or future medium and for any number
of copies, and (iv) for any purpose whatsoever, including without
limitation commercial, advertising or promotional purposes (the
"License"). The License shall be deemed effective as of the date CC0 was
applied by Affirmer to the Work. Should any part of the License for any
reason be judged legally invalid or ineffective under applicable law, such
partial invalidity or ineffectiveness shall not invalidate the remainder
of the License, and in such case Affirmer hereby affirms that he or she
will not (i) exercise any of his or her remaining Copyright and Related
Rights in the Work or (ii) assert any associated claims and causes of
action with respect to the Work, in either case contrary to Affirmer's
express Statement of Purpose.
4. Limitations and Disclaimers.
a. No trademark or patent rights held by Affirmer are waived, abandoned,
surrendered, licensed or otherwise affected by this document.
b. Affirmer offers the Work as-is and makes no representations or
warranties of any kind concerning the Work, express, implied,
statutory or otherwise, including without limitation warranties of
title, merchantability, fitness for a particular purpose, non
infringement, or the absence of latent or other defects, accuracy, or
the present or absence of errors, whether or not discoverable, all to
the greatest extent permissible under applicable law.
c. Affirmer disclaims responsibility for clearing rights of other persons
that may apply to the Work or any use thereof, including without
limitation any person's Copyright and Related Rights in the Work.
Further, Affirmer disclaims responsibility for obtaining any necessary
consents, permissions or other rights required for any use of the
Work.
d. Affirmer understands and acknowledges that Creative Commons is not a
party to this document and has no duty or obligation with respect to
this CC0 or use of the Work.
+45
View File
@@ -0,0 +1,45 @@
# Unified Inventory Plus
Unified Inventory Plus extends Unified Inventory.
It adds 3 button types to the craft page:
- Craft All: crafting a stack and putting the result in the inventory
- Patterns buttons: reorganizing items in the craft inventory following usual patterns
- Rotation button: rotating the craft inventory content
- Clear button: clear the craft inventory content
In `init.lua`, you can easily:
Disable the functionalities you don't want
Disable and reorder patterns
Fully compatible with Skyblock
## Settings
Features can be toggled with the following settings (true per default):
* `unified_inventory_plus.enable_craft_all`
* `unified_inventory_plus.enable_craft_organize`
* `unified_inventory_plus.enable_craft_rotate`
* `unified_inventory_plus.enable_craft_clear`
## Dependencies
- [unified_inventory](https://github.com/minetest-mods/unified_inventory)
- [fakelib](https://content.minetest.net/packages/OgelGames/fakelib/)
#### Optional dependencies
- [stamina](https://github.com/minetest-mods/stamina)
## License
Refer to Unified Inventory for original medias copyright.
Copyright (C) 2017 Bousket
Unified Inventory Plus code is licensed under the CC0
https://creativecommons.org/publicdomain/zero/1.0/
Copyright (C) 2022 fluxionary
Code: LGPL
Media: CC0
## Authors
Bousket - Main mod.
shivajiva101 - Skyblock Integration.
fluxionary - Stamina mod integration, rewrite.
NatureFreshMilk.
Panquesito7.
Binary file not shown.

After

Width:  |  Height:  |  Size: 280 KiB

+150
View File
@@ -0,0 +1,150 @@
local ui = unified_inventory
local uip = unified_inventory_plus
local has = uip.has
local settings = uip.settings
local S = uip.S
local F = minetest.formspec_escape
-- Backup to inject code
uip.craft_all = ui.pages["craft"].get_formspec
ui.pages["craft"] = {
get_formspec = function(player, perplayer_formspec)
local formspec = uip.craft_all(player, perplayer_formspec).formspec
formspec = formspec ..
("image[%f,%f;%f,%f;ui_crafting_long_arrow.png]"):format(
perplayer_formspec.craft_arrow_x,
perplayer_formspec.craft_y,
ui.imgscale,
ui.imgscale * 3) ..
("button[%f,%f;%f,%f;craft_craftall;%s]"):format(
perplayer_formspec.craft_arrow_x + 0.23,
perplayer_formspec.craft_y + 1.50,
perplayer_formspec.btn_size,
perplayer_formspec.btn_size,
F(S("All"))
)
return { formspec = formspec }
end,
}
-- make sure the width is right
local function infer_width(list, expected)
if not expected or expected:is_empty() then
return
end
local width
for i = 1, 3 do
local output, _ = minetest.get_craft_result({ method = "normal", width = i, items = list })
if output.item:to_string() == expected:to_string() then
width = i
break
end
end
if not width then
uip.log("warning", "Can't infer recipe width for %s", expected:to_string())
end
return width
end
-- Craft max possible items and put the result in the main inventory
local function craft_craftall(player)
local player_name = player:get_player_name()
local player_inv = player:get_inventory()
local craft_list = player_inv:get_list("craft")
local expected_result = player_inv:get_stack("craftpreview", 1)
local craft_width = infer_width(craft_list, expected_result)
if not craft_width then
return
end
local num_crafted = 0
-- don't modify player's inventory until we're done, in case something goes wrong (e.g. crash)
-- use a fake inventory instead of a detached inventory, because detached inventory actions all result in packets
-- sent to the player.
local tmp_inv = fakelib.create_inventory()
tmp_inv:set_list("main", player_inv:get_list("main"))
tmp_inv:set_list("craft", craft_list)
while true do
if (
has.stamina and
stamina.get_saturation and
stamina.get_saturation(player) <= settings.craft_all_min_saturation
) then
minetest.chat_send_player(player_name, S("You are too hungry to use Craft All at this time."))
break
end
-- note that get_craft_result can be *very* slow, until minetest 5.7.0 is released.
-- see https://github.com/minetest/minetest/issues/13231
local output, decremented_input = minetest.get_craft_result({
method = "normal",
width = craft_width,
items = craft_list,
})
if output.item:get_name() ~= expected_result:get_name() then
-- the recipe changed, so we've run out of something. stop processing.
break
end
-- minetest.on_craft expects to see the decremented input list.
tmp_inv:set_list("craft", decremented_input.items)
-- invoke callbacks, for compatibility w/ stamina, skyblock, moretrees, etc.
-- note that this is an *undocumented* handler of the minetest lua API, and possibly is subject to change
-- in the future.
output.item = minetest.on_craft(output.item, player, craft_list, tmp_inv)
-- track items added to the inventory, in case we need to remove them later
local added = {}
if tmp_inv:room_for_item("main", output.item) then
tmp_inv:add_item("main", output.item) -- should be no remainder, ignore it
table.insert(added, output.item)
else
-- no room for the output item, stop
break
end
-- we now try to add all replacements.
local all_added = true
for _, replacement_stk in ipairs(output.replacements) do
if tmp_inv:room_for_item("main", replacement_stk) then
tmp_inv:add_item("main", replacement_stk) -- should be no remainder, ignore it
table.insert(added, replacement_stk)
else
all_added = false
break
end
end
if not all_added then
-- if we failed to add all the replacements, remove what we've added, and abort
for _, stk in ipairs(added) do
tmp_inv:remove_item("main", stk) -- should be no remainder, ignore it
end
break
end
-- the craft list can be modified by the callbacks, so re-load it
craft_list = tmp_inv:get_list("craft")
num_crafted = num_crafted + 1
end
player_inv:set_list("craft", craft_list)
player_inv:set_list("main", tmp_inv:get_list("main"))
uip.log("action", "player %s crafts %s %i", player_name, expected_result:to_string(), num_crafted)
end
minetest.register_on_player_receive_fields(function(player, formname, fields)
for k, _ in pairs(fields) do
if k:match("craft_craftall") then
craft_craftall(player)
return
end
end
end)
@@ -0,0 +1,43 @@
-- Clear items in the craft inventory
local ui = unified_inventory
local uip = unified_inventory_plus
-- Backup to inject code
uip.craft_clear = ui.pages["craft"].get_formspec
ui.pages["craft"] = {
get_formspec = function(player, perplayer_formspec)
local formspec = uip.craft_clear(player, perplayer_formspec).formspec
formspec = formspec ..
("image_button[%f,%f;%f,%f;pattern_clear.png;craft_clear;]"):format(
perplayer_formspec.craft_x - perplayer_formspec.btn_spc,
perplayer_formspec.craft_y + ui.imgscale,
perplayer_formspec.btn_size,
perplayer_formspec.btn_size
)
return { formspec = formspec }
end,
}
-- Return items from the craft inventory to the player's inventory
local function craft_clear(player)
local player_inv = player:get_inventory()
local craft_list = player_inv:get_list("craft")
for i, stk in ipairs(craft_list) do
if player_inv:room_for_item("main", stk) then
player_inv:add_item("main", stk)
craft_list[i]:clear()
end
end
player_inv:set_list("craft", craft_list)
end
minetest.register_on_player_receive_fields(function(player, formname, fields)
for k, _ in pairs(fields) do
if k:match("craft_clear") then
craft_clear(player)
end
end
end)
@@ -0,0 +1,170 @@
-- Organize items in the craft inventory following a pattern:
local ui = unified_inventory
local uip = unified_inventory_plus
local default_stack_max = tonumber(minetest.settings:get("default_stack_max")) or 99
-- Backup to inject code
uip.craft_organize = ui.pages["craft"].get_formspec
ui.pages["craft"] = {
get_formspec = function(player, perplayer_formspec)
local formspec = uip.craft_organize(player, perplayer_formspec).formspec
local btnsz = ui.imgscale / 3
local btnspc = ui.imgscale / 2
if perplayer_formspec.pagecols == 4 then
-- UI is in lite mode.
for i, v in ipairs(uip.craft_patterns) do
formspec = formspec ..
("image_button[%f,%f;%f,%f;%s;craft_organize_%i;]"):format(
perplayer_formspec.craft_x + btnspc * (i - 1),
perplayer_formspec.craft_y + 0.1 - btnspc,
btnsz,
btnsz,
v.ico,
i
)
end
else
for i, v in ipairs(uip.craft_patterns) do
formspec = formspec ..
("image_button[%f,%f;%f,%f;%s;craft_organize_%i;]"):format(
perplayer_formspec.craft_x + btnspc * ((i - 1) % 6) + 0.1,
perplayer_formspec.craft_y + 0.22 - (math.ceil(i / 6)) * btnspc,
btnsz,
btnsz,
v.ico,
i
)
end
end
return { formspec = formspec }
end,
}
local function get_pattern_id(fields)
for k, _ in pairs(fields) do
local pattern_id = tonumber(k:match("craft_organize_(.*)"))
if pattern_id then
return pattern_id
end
end
end
local function get_single_item(craft_list)
for _, stk in ipairs(craft_list) do
if not stk:is_empty() then
local item = ItemStack(stk)
item:set_count(1)
return item
end
end
end
local function all_identical(craft_list)
local single_strings = {}
for _, stk in ipairs(craft_list) do
if not stk:is_empty() then
local item = ItemStack(stk)
item:set_count(1)
table.insert(single_strings, item:to_string())
end
end
if #single_strings == 0 then return false end
local first = single_strings[1]
for i = 2, #single_strings do
if first ~= single_strings[i] then
return false
end
end
return true
end
local function count_items(craft_list)
local count = 0
for _, stk in ipairs(craft_list) do
count = count + stk:get_count()
end
return count
end
-- Organize items in the craft inventory following a pattern
local function craft_organize(player, fields)
local player_name = player:get_player_name()
local pattern_id = get_pattern_id(fields)
if not pattern_id or not uip.craft_patterns[pattern_id] then
minetest.chat_send_player(player_name, "Unexpected pattern!?")
return
end
local pattern = uip.craft_patterns[pattern_id].pattern
local pattern_size = #pattern
local player_inv = player:get_inventory()
local craft_list = player_inv:get_list("craft")
local single_item = get_single_item(craft_list)
if not single_item then
-- craft inv is empty
minetest.chat_send_player(player_name, "Inventory empty.")
return
end
if not all_identical(craft_list) then
minetest.chat_send_player(player_name, "You can only organize one type of item.")
return
end
local itemname = single_item:get_name()
local def = minetest.registered_items[itemname]
if not def then
minetest.chat_send_player(player_name, "You can't organize an unknown item.")
return
end
local stacksize = def.stack_max or default_stack_max
local num_items = count_items(craft_list)
if num_items > stacksize * pattern_size then
minetest.chat_send_player(player_name, "Too many items to stack in that pattern.")
return
end
if num_items < pattern_size then
minetest.chat_send_player(player_name, "Not enough items.")
return
end
local new_stack_size = math.floor(num_items / pattern_size)
local remainder = num_items % pattern_size
local new_craft_list = {
ItemStack(), ItemStack(), ItemStack(),
ItemStack(), ItemStack(), ItemStack(),
ItemStack(), ItemStack(), ItemStack(),
}
-- because remainder is strictly less than pattern_size, this should always finish w/ remainder = 0
for _, index in ipairs(pattern) do
local new_item = ItemStack(single_item)
if remainder > 0 then
new_item:set_count(new_stack_size + 1)
remainder = remainder - 1
else
new_item:set_count(new_stack_size)
end
new_craft_list[index] = new_item
end
player_inv:set_list("craft", new_craft_list)
end
minetest.register_on_player_receive_fields(function(player, formname, fields)
for k, _ in pairs(fields) do
if k:match("craft_organize_") then
craft_organize(player, fields)
return
end
end
end)
@@ -0,0 +1,52 @@
-- Rotate items in the craft inventory
local ui = unified_inventory
local uip = unified_inventory_plus
-- Backup to inject code
uip.craft_rotate = ui.pages["craft"].get_formspec
ui.pages["craft"] = {
get_formspec = function(player, perplayer_formspec)
local formspec = uip.craft_rotate(player, perplayer_formspec).formspec
formspec = formspec ..
("image_button[%f,%f;%f,%f;pattern_rotate.png;craft_rotate;]"):format(
perplayer_formspec.craft_x - perplayer_formspec.btn_spc,
perplayer_formspec.craft_y,
perplayer_formspec.btn_size,
perplayer_formspec.btn_size
)
return { formspec = formspec }
end,
}
-- Rotate items in the craft inventory
local function craft_rotate_cw(player)
local player_inv = player:get_inventory()
local craft_list = player_inv:get_list("craft")
-- Rotate corners
local stack = craft_list[1]
craft_list[1] = craft_list[7]
craft_list[7] = craft_list[9]
craft_list[9] = craft_list[3]
craft_list[3] = stack
-- Rotate middle ones
stack = craft_list[2]
craft_list[2] = craft_list[4]
craft_list[4] = craft_list[8]
craft_list[8] = craft_list[6]
craft_list[6] = stack
player_inv:set_list("craft", craft_list)
end
minetest.register_on_player_receive_fields(function(player, formname, fields)
--if not formname:match("craft") then return end
for k, _ in pairs(fields) do
if k:match("craft_rotate") then
craft_rotate_cw(player)
end
end
end)
+58
View File
@@ -0,0 +1,58 @@
-- Unified Inventory Plus for Minetest
local modname = minetest.get_current_modname()
local modpath = minetest.get_modpath(modname)
unified_inventory_plus = {
-- Patterns: (Comment unwanted ones & reorder as you wish: buttons are then placed left to right,
-- then up, 6 on a row) pattern field contains indexes to fill in the craft inventory according
-- to the scheme: (then others for non creatives)
--
-- 1 2 3
-- 4 5 6
-- 7 8 9
craft_patterns = {
{ ico = "pattern_1.png", pattern = { 1 } },
{ ico = "pattern_4.png", pattern = { 1, 2, 4, 5 } },
{ ico = "pattern_9.png", pattern = { 1, 2, 3, 4, 5, 6, 7, 8, 9 } },
{ ico = "pattern_3.png", pattern = { 1, 2, 3 } },
{ ico = "pattern_3b.png", pattern = { 1, 4, 7 } },
{ ico = "pattern_5.png", pattern = { 1, 3, 5, 7, 9 } },
{ ico = "pattern_6.png", pattern = { 1, 4, 5, 7, 8, 9 } },
{ ico = "pattern_6b.png", pattern = { 1, 2, 3, 4, 5, 6 } },
{ ico = "pattern_6c.png", pattern = { 1, 3, 4, 6, 7, 9 } },
{ ico = "pattern_7.png", pattern = { 1, 2, 3, 4, 5, 6, 8 } },
{ ico = "pattern_8.png", pattern = { 1, 2, 3, 4, 6, 7, 8, 9 } },
{ ico = "pattern_10.png", pattern = { 1, 2, 3, 4, 5 } },
},
has = {
stamina = minetest.global_exists("stamina"),
},
log = function(level, message_fmt, ...)
minetest.log(level, "[unified_inventory_plus] " .. message_fmt:format(...))
end,
S = minetest.get_translator("unified_inventory"),
}
local uip = unified_inventory_plus
dofile(modpath .. "/settings.lua")
-- Functionalities are independants.
if uip.settings.enable_craft_all then
dofile(modpath .. "/craft_all.lua")
end
if uip.settings.enable_craft_organize then
dofile(modpath .. "/craft_organize.lua")
end
if uip.settings.enable_craft_rotate then
dofile(modpath .. "/craft_rotate.lua")
end
if uip.settings.enable_craft_clear then
dofile(modpath .. "/craft_clear.lua")
end
+4
View File
@@ -0,0 +1,4 @@
name = unified_inventory_plus
depends = unified_inventory, fakelib
optional_depends = stamina
min_minetest_version = 5.4.0
+11
View File
@@ -0,0 +1,11 @@
local uip = unified_inventory_plus
local settings = minetest.settings
uip.settings = {
enable_craft_all = settings:get_bool("unified_inventory_plus.enable_craft_all", true),
enable_craft_organize = settings:get_bool("unified_inventory_plus.enable_craft_organize", true),
enable_craft_rotate = settings:get_bool("unified_inventory_plus.enable_craft_rotate", true),
enable_craft_clear = settings:get_bool("unified_inventory_plus.enable_craft_clear", true),
craft_all_min_saturation = tonumber(settings:get("unified_inventory_plus.craft_all_min_saturation")) or 1,
}
@@ -0,0 +1,8 @@
unified_inventory_plus.enable_craft_all (enable "all" button) bool true
unified_inventory_plus.enable_craft_organize (enable template buttons) bool true
unified_inventory_plus.enable_craft_rotate (enable rotate buttons) bool true
unified_inventory_plus.enable_craft_clear (enable "clear" button) bool true
# Disable the "craft all" feature if saturation (from the stamina mod) is below a given value.
# Set to -1 always allow "craft all".
unified_inventory_plus.craft_all_min_saturation (Minimum saturation for "craft all") int 1 -1 20
Binary file not shown.

After

Width:  |  Height:  |  Size: 253 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 208 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 259 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 249 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 247 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 248 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 240 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 245 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 250 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 246 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 252 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 238 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 813 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 586 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB