Commit Graph

70 Commits

Author SHA1 Message Date
SmallJoker
3fffa41eaf Remove unused internal functions 2021-08-24 19:44:36 +02:00
SmallJoker
077bed90eb Move default inventory draw calls to separate functions 2021-08-14 15:25:55 +02:00
SmallJoker
aeb9841e3a Remove default hard dependency for use in devtest 2021-07-17 10:35:39 +02:00
David Leal
afd38e0c73
Fix LuaCheck warning (#175) 2021-05-25 19:31:34 +02:00
Oversword
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
Vanessa Dannenberg
860371ecf8 more consistent formspec size decision 2021-03-31 00:52:30 -04:00
Vanessa Dannenberg
44e32df00a translate some strings inside their table 2021-03-09 15:04:11 -05:00
Vanessa Dannenberg
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
Vanessa Dannenberg
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
Vanessa Dannenberg
3e7f005366 always modify and return a table.copy() of the style table 2021-03-09 15:04:11 -05:00
Vanessa Dannenberg
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
Vanessa Dannenberg
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
Vanessa Dannenberg
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
Vanessa Dannenberg
0c05f06fa8 "Please continue to use string.format here to avoid messy code"
Derp :-)
2021-03-09 15:04:11 -05:00
Vanessa Dannenberg
c3679eaf7b fix indent 2021-03-09 15:04:11 -05:00
Vanessa Dannenberg
23a089f174 remove a used-only-once variable 2021-03-09 15:04:11 -05:00
Vanessa Dannenberg
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
Vanessa Dannenberg
603b5d1d4e get rid of uninv global
make all uses of it back into `unified_inventory.`
2021-03-09 15:04:11 -05:00
Vanessa Dannenberg
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
Vanessa Dannenberg
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
Vanessa Dannenberg
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
Vanessa Dannenberg
7a0a44037a remove a couple of unused variables 2021-03-09 15:04:11 -05:00
Vanessa Dannenberg
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
Vanessa Dannenberg
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
Louis Royer
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
David Leal
606ba6a1a3
Add GitHub workflow (#149) 2020-03-25 18:46:35 +01:00
Wuzzy
8e74a80e91 Translation: Fix parameter symbols 2019-10-17 21:05:08 +02:00
Wuzzy
5327261718 Move to MT 5.0.0 translation system 2019-10-17 21:05:08 +02:00
Scott Horvath
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
Emiel van Rooijen
16babc54f3 Add no_prepend[] by default 2019-03-31 12:19:08 +02:00
SmallJoker
54abad72f0 Add item tooltips with mod name
Inspired by #118, @Quent42340
2018-12-12 20:20:11 +01:00
codexp
c1ab7277ab refactor code to use with intllib tool 2018-04-02 13:33:36 +02:00
shivajiva101
2ab5a7c90a fix excessive privilege check 2018-01-03 11:15:53 +01:00
Diego Martínez
2ea417fad0 Search when ENTER is pressed on the search field. 2016-11-29 17:35:40 -03:00
Wuzzy
8770b7df93 Disable useless main buttons 2016-11-06 02:28:45 +01:00
Wuzzy
2a516ac22b Add seperate button for resetting search 2016-08-14 23:35:12 +02:00
Vanessa Ezekowitz
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
Wuzzy
7bba35a911 Flip craft mode when clicking current item in list 2016-08-07 02:14:46 +02:00
Wuzzy
c816666945 Ensure formspec escaping for translated strings 2016-08-06 17:23:46 +02:00
Vanessa Ezekowitz
9fe84789ba Allow per-user "full" mode when "lite" mode is set as global
default (give the user "ui_full" priv to turn it on).

Also, a few whitespace fixes.
2015-10-05 04:24:01 -04:00
HybridDog
babe4380ac disallow repairing tools using the 'to craft grid', allow it to put items of specific groups and (maybe) make it keep the meta of items, remove unused elseif, change a bit translation and use table.concat at one place because I read somewhere that it's faster than .. 2015-08-16 16:40:49 +02:00
Vanessa Ezekowitz
2d6a0ed606 split ui_crafting_form
into craft grid/trash image and a single slot image.  The latter is now
used for a refill slot if user has creative priv or server is in
creative mode.
2015-08-05 08:37:25 -04:00
Vanessa Ezekowitz
f2914b3d4f only show items in crafting guide if they can be crafted or player has creative 2015-07-30 09:13:16 -04:00
Vanessa Ezekowitz
8338b406d3 fix crash in waypoints? 2015-06-28 05:17:43 -04:00
Vanessa Ezekowitz
16e40a2e22 re-arrange a few elements in the crafting guide to eliminate text overlap
Also make sure to chech if lite mode before assuming 4x2 "tab" button layout.
2015-06-28 04:54:48 -04:00
Vanessa Ezekowitz
0a70d8edef Add "lite" mode
Set unified_inventory_lite = true in minetest.conf to enable.

This mode reduces the feature-set of the mod as follows:

* no bags
* no waypoints,
* no home/go-home buttons,
* no set-day/-night buttons,
* smaller creative/craft guide inventory pages (4x6 instead of 8x10)
* fewer paging buttons
* smaller search field
* move "Result: foo" to below the crafting guide grid.
* Move main "tab" buttons to the right, below the search and paging buttons.
* Made "tab" buttons able to use to 2 rows if necessary (max 8 buttons)
2015-06-28 04:15:55 -04:00
Tim
76a9efff71 reduce table lookups during initialization 2015-02-05 10:03:07 +01:00
Tim
1a1bfc3839 supress intllib check warning, this fixes #19 2015-02-05 10:00:10 +01:00
RealBadAngel
0d777362f3 Update tooltips usage due to core changes. 2014-06-24 12:39:12 +02:00
RealBadAngel
f800f39083 More tooltips and translations. 2014-06-22 00:34:35 +02:00