Commit Graph

83 Commits

Author SHA1 Message Date
b5de18b196 Categories: remove unknown items after start
This avoids runtime errors caused by removed items
or such that were not registered at all but listed
by default in a pre-defined category.
2024-03-17 16:54:21 +01:00
eb3bb03ebf Option to hide uncraftable items (#240)
This setting only applies to non-creative players.
2024-01-06 12:35:54 +01:00
b590764026 Centre page number label and move refill/trash labels (#221)
* Centre page number label

* Move refill and trash labels
2023-01-04 14:35:46 +01:00
82cdf24045 Improve scroll height calculation (#220) 2022-12-30 21:43:46 +01:00
826d5f4683 Add setting to hide disabled buttons (#217) 2022-10-26 10:05:03 +02:00
9533200e25 Tidy and comment filtering functions 2022-10-05 21:07:11 +02:00
477acd2f89 Change background to rounded corners (#200)
This change is supposed to match the rounded inventory slot design.
2022-04-03 22:30:21 +02:00
19efce45ed Revert "Remove mod name from tooltips"
This reverts commit 64b0248c77.

The mod name may differ from the item name, in which cases it is
helpful to have this information contained in the tooltip.
No information is shown in case the mod name is missing.
2022-03-20 13:45:59 +01:00
dbe06be68b Add scroll bar for overflowing tab buttons (#195) 2022-02-26 11:41:15 +01:00
3074d625e2 Version 4: Feature checks and deprecate internal functions 2022-02-26 11:38:45 +01:00
d6688872c8 Fix two occasional runtime errors (#191) 2021-12-25 17:31:18 +01:00
64b0248c77 Remove mod name from tooltips
Requested in #190. The mod name is not relevant for most players, and the full item name can still be seen in the craft recipe viewer mode.
2021-12-11 17:15:58 +01:00
b1c85a2cb8 Fix waypoint initialization order 2021-08-29 07:47:32 +02:00
3fffa41eaf Remove unused internal functions 2021-08-24 19:44:36 +02:00
077bed90eb Move default inventory draw calls to separate functions 2021-08-14 15:25:55 +02:00
aeb9841e3a Remove default hard dependency for use in devtest 2021-07-17 10:35:39 +02:00
afd38e0c73 Fix LuaCheck warning (#175) 2021-05-25 19:31:34 +02:00
6e6383f082 Add filter-by-category functionality (#171)
- Added API for configuring categories
- Added display for categories above page
- Reduced height of page by 1 row to make room for categories
- Added L/R scroll through when there are more categories than columns
- Added pre-filter methods for categories and uncategorised items
- Added categories for (most) items in the default game


Co-authored-by: Oversword <bionc:oversword.co.uk>
2021-04-05 20:07:14 +02:00
860371ecf8 more consistent formspec size decision 2021-03-31 00:52:30 -04:00
44e32df00a translate some strings inside their table 2021-03-09 15:04:11 -05:00
8e94d86420 don't display the refill slot image if no creative priv/mode
(leftover from when it was part of the craft grid image)

Also fixed a typo in the corresponding list[] element that
made it not work.
2021-03-09 15:04:11 -05:00
37546289bc using a table.copy() to pass the style tables around requires
setting-up items_per_page, standard_inv, and standard_inv_bg
for both tables at init time.
2021-03-09 15:04:11 -05:00
3e7f005366 always modify and return a table.copy() of the style table 2021-03-09 15:04:11 -05:00
5ea0208ffe Multiple related changes to string handling
1) Convert most formspec elements to use string.format(), when the
result would be more readable, or less messy, or at least makes the line
shorter, assuming it looked like it really needed it to begin with.

2) Convert all long `foo..","..bar..";"..baz..bleh..` types of excessive
string concatenation into tables that then get concated only once, when
their containing functions return the final formspec string.

3) In some places in the code, such tables were already being used, and
were named "formspec", while others were named "fs".  I settled on just
one name, "formspec", as it's more readable, if longer.

4) There was a mix of styles of adding items to those tables:

* Some places used line after line of `t[#t + 1] = foo/bar/baz`.
* Others places used the form `t[1] = foo, t[2] = bar, ...`.
* Still others used the form `t[n] = foo, t[n+1] = bar...`,
  with `n` being increased or reset every so often.

Most of them should now be of the third form, with a few of the second.
2021-03-09 15:04:11 -05:00
694553e68b use local "ui" to reference "unified_inventory", where practical
(makes code shorter, easier to read and write)
2021-03-09 15:04:11 -05:00
5a8a75f43b put style-specific settings in their own tables
and switch between them directly, instead of copy-and-modify.
2021-03-09 15:04:11 -05:00
0c05f06fa8 "Please continue to use string.format here to avoid messy code"
Derp :-)
2021-03-09 15:04:11 -05:00
c3679eaf7b fix indent 2021-03-09 15:04:11 -05:00
23a089f174 remove a used-only-once variable 2021-03-09 15:04:11 -05:00
82bc2d3f95 use string.format() to create the standard_inv variables
do it just once, after the lite mode settings are applied
(if applicable)
2021-03-09 15:04:11 -05:00
603b5d1d4e get rid of uninv global
make all uses of it back into `unified_inventory.`
2021-03-09 15:04:11 -05:00
eb4cf5bf47 increase spacing around the text above the items page
("Filter:" and its search key, and the page or "No matches)
Adjust main and page flipping buttons' positions to compensate
2021-03-09 15:04:11 -05:00
97960c552b increase size and tweak position of "give/to grid" buttons
and make them vary in pos with lite vs full mode
2021-03-09 15:04:11 -05:00
81d6a1e796 shift the craft grid and guide down a bit
to make more room for the result string
(and shift the result string down a hair to follow)
2021-03-09 15:04:11 -05:00
7a0a44037a remove a couple of unused variables 2021-03-09 15:04:11 -05:00
167dddaa84 Convert over to formspec version 4
I recreated the original layout as best as practical, but by necessity
there are a few minor positioning changes, since the underlying
hard-wired inventory slots are square now and image positioning is now
scaled by exactly 1.250 in both dimensions (as opposed to roughly 1.25
by 1.16).

Backstage, I also needed to fix the aspect ratios of the various
inventory slot elements.  That meant redesigning the single-slot image
from scratch.  It was already blurry/grainy and a little ugly, and
trying to alter it would have only made it worse.

The slot image is now exactly 56x56 pixels square, set on a 64x64
canvas, so there's a 4 pixel empty space around the edges. The full
256px .xcf workfile is included in the UI folder.

I've re-tiled all slot/inv images from the new single slot.

I also re-rendered the trash can icon from it since it was blurry and
oddly-sized. I couldn't find the original upstream image, so since
they're free, I used one of my Linux system's icons which happens to
resemble it.

I also removed a couple more improper uses of `background[]` where
`image[]` is more appropriate.

There are tons of minor tweaks throughout the code to re-align
everything, and I had to rewrite a few sections to avoid code
duplication and to allow for a little more flexibility (mainly to make
"lite" mode look right).
2021-03-09 15:04:11 -05:00
ebd1d1f245 Improve consistency of inventory (and alike) imagery
In a number of places, background[] is misused to place the
inventory backdrop images.  Where appropriate, image[] is used
instead, so that "ui_form_bg.png" actually serves as the one
and only true background image.

In so doing, I was able to remake the bag inventory images,
making them only big as is actually needed to hold 1, 2, or 3
rows of inventory slots.

This, in turn, allows a standardized main inventory image to
occupy the lower part of the window, which allows for
consistent inventory image positioning and sizing from one
page to another.

I also removed ui_misc_form.png.  Nothing in UI uses it, and
any external mods that used it can just use the standard
inventory and its background.

Lastly, I reduced the background image to 512x384 px.  It was
unnecessarily large before, considering it has no real detail.

The larger inventory images are all 512px wide, and multiples
of 64px in height.  Before, they were oddly sized.
2021-03-01 18:57:50 +01:00
341a438267 Search items by English and translated description (#156)
This works only with Minetest version >= 5.3.0, nothing is changed for
older versions.
2020-07-15 20:21:06 +02:00
606ba6a1a3 Add GitHub workflow (#149) 2020-03-25 18:46:35 +01:00
8e74a80e91 Translation: Fix parameter symbols 2019-10-17 21:05:08 +02:00
5327261718 Move to MT 5.0.0 translation system 2019-10-17 21:05:08 +02:00
86d2a11643 Allow all players to view items regardless of 'creative' priv
This allows any player to see usages of items found
even if item does not have explicit
recipies themselves.
(ex: default:papyrus, found/grown in wild, can be made into paper)
2019-05-28 21:30:55 +02:00
16babc54f3 Add no_prepend[] by default 2019-03-31 12:19:08 +02:00
54abad72f0 Add item tooltips with mod name
Inspired by #118, @Quent42340
2018-12-12 20:20:11 +01:00
c1ab7277ab refactor code to use with intllib tool 2018-04-02 13:33:36 +02:00
2ab5a7c90a fix excessive privilege check 2018-01-03 11:15:53 +01:00
2ea417fad0 Search when ENTER is pressed on the search field. 2016-11-29 17:35:40 -03:00
8770b7df93 Disable useless main buttons 2016-11-06 02:28:45 +01:00
2a516ac22b Add seperate button for resetting search 2016-08-14 23:35:12 +02:00
54d97635ec Merge pull request #64 from Wuzzy2/flipclick
Toggle recipe/usage mode in craft guide when clicking on current item in item list
2016-08-07 12:57:29 -04:00