Commit Graph

292 Commits

Author SHA1 Message Date
SmallJoker
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
SmallJoker
dbe06be68b
Add scroll bar for overflowing tab buttons (#195) 2022-02-26 11:41:15 +01:00
SmallJoker
3074d625e2 Version 4: Feature checks and deprecate internal functions 2022-02-26 11:38:45 +01:00
James William Fletcher
5ac2558da4 Speed up group filtering code
This improves the startup time dramatically by lowering the algorithm complexity.
Mainly noticeable with large inventory sizes.

Written by Test_User, post-edited by SmallJoker
2022-02-26 11:03:21 +01:00
SmallJoker
25c40fea6c Fix filter reset for empty search boxes 2022-01-24 15:20:57 +01:00
SmallJoker
23a45b8131 Only update formspec on search filter changes 2022-01-23 18:15:17 +01:00
Oversword
d6688872c8
Fix two occasional runtime errors (#191) 2021-12-25 17:31:18 +01:00
SmallJoker
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
OgelGames
28a5d4db49
Show wear and description in crafting guide (#189) 2021-11-21 19:42:54 +01:00
Oversword
8c84751ff8
Add u_i initialization and craft registration callbacks (#184)
Main purpose: custom recipe sorting provided by cuszom mods.
2021-10-14 18:38:07 +02:00
SmallJoker
b1c85a2cb8 Fix waypoint initialization order 2021-08-29 07:47:32 +02:00
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
6d123da61c Update translation strings 2021-07-20 20:41:23 +02:00
SmallJoker
d39dd78cb5 Use player meta for waypoints 2021-07-20 20:41:23 +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
SmallJoker
4d4355a741 Home: Fix error on missing write permission 2021-05-13 15:19:46 +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
c044f5e3b0 use the trash slot icon's alpha instead of [combine
also it's supposed to be 128px, not 256px.  fixed that.
2021-03-10 21:20:31 -05:00
Vanessa Dannenberg
608cdfb887 fix refill slot list[] offset also 2021-03-10 12:32:55 -05:00
Vanessa Dannenberg
afb295ec22 fix trash slot list[] offset
(only noticable when listcolors[] allows slots to be visible,
i.e. on mouseover)
2021-03-10 12:26:28 -05:00
Vanessa Dannenberg
a84ce24067 use the ui.list_img_offset variable for offsetting the std inv list[]
so that it'll match every other list that uses it.
2021-03-09 18:31:16 -05:00
Vanessa Dannenberg
a7556c5044 update minimum MT version number 2021-03-09 15:09:46 -05:00
SmallJoker
3d58befe03 Document the API version 2021-03-09 15:04:11 -05:00
Vanessa Dannenberg
d0deba10c8 pngcrush+optipng the new slot textures
and remove the slot image .xcf project file
2021-03-09 15:04:11 -05:00
Vanessa Dannenberg
97b882ad23 add a version number variable to the main table 2021-03-09 15:04:11 -05:00
Vanessa Dannenberg
44e32df00a translate some strings inside their table 2021-03-09 15:04:11 -05:00
Vanessa Dannenberg
40d862298b replace excessive spaces with tabs 2021-03-09 15:04:11 -05:00
Vanessa Dannenberg
0ebc9402ed minor tweaks to the slot images
to make them better-resemble their pre-9-sliced versions
(going to that mode made them slightly bigger and the corners
slightly less round since they aren't blurry anymore)
2021-03-09 15:04:11 -05:00
Vanessa Dannenberg
2c16805ef9 Get rid of the image button left of the crafting guide
It had the same function as clicking the craft result on the
right (just inverted), making it redundant. Click either one more
than once and UI would alternately show usages or recipes.
2021-03-09 15:04:11 -05:00
Vanessa Dannenberg
dc61d2980a Move craft guide a little to the right to make some room. 2021-03-09 15:04:11 -05:00
Vanessa Dannenberg
21f122336f make craft arrow 128px
(same reason as the trash icon)
2021-03-09 15:04:11 -05:00
Vanessa Dannenberg
8ee0eb9fce swap the craft type icon with its word
(makes it look like it used to)
2021-03-09 15:04:11 -05:00
Vanessa Dannenberg
1210dbfe22 make trash slot icon 128px
MT nearest-neighbor-scales images to about 75px if they're 1x1
slot in size (at least on my screen).  Use the next power of 2
above that, so that MT can scale down instead of up.
2021-03-09 15:04:11 -05:00
Vanessa Dannenberg
b8a568d7eb remove unused var, excess whitespace 2021-03-09 15:04:11 -05:00
Vanessa Dannenberg
9ddea6eced fix missing "XYZ" and "no" icon on waypoints show coordinates button 2021-03-09 15:04:11 -05:00
Vanessa Dannenberg
76c9bb9517 Use 9-slicing to build inventory-type backgrounds
This way the slots are all nice and crisp regardless of GUI scale or
image size, and we only need the single slot and its bright version.

This also makes the standard crafting grid into a style table entry that
can be referenced to insert the crafting grid at its proper
style-specific position in any formspec.

And it also makes the craft grid arrow, its X position, and the crafting
grid's result slot X position into style table entries.

Includes a few public helper functions to do most of the work:

`ui.single_slot(xpos, ypos, bright)`

    Does just what it sounds like: it returns a single slot image.
    `xpos` and `ypos` are normal coordinates in slots, as you'd use in
    `image[]` element.  `bright` is a flag that switches to the brighter
    version of the slot image.

`ui.make_trash_slot(xpos, ypos)`

    Creates a single slot, with a one-item `list[]` and a trash can icon
    overlay.

`ui.make_inv_img_grid(xpos, ypos, width, height, bright)`

    Generates a `width` by `height` grid of slot images, using the
    single_slot function above, starting at (`xpos`,`ypos`) for the
    top-left.  Position is as in any `image[]` element, and dimensions
    are in integer numbers of slots (so 8,4 would be a standard inventory).
    `bright` is as above.

All three return a string that can be directly inserted into a formspec.
2021-03-09 15:04:11 -05:00
Vanessa Dannenberg
60d7a6d213 Draw the trash slot by overlaying the bare trash can icon
over the single slot image instead of baking it in.
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
6d892dda5b use local ui=unified_inventory shorthand in init.lua as elsewhere 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
382219c466 move S() calls into waypoints' button table
instead of inside the loop
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
2d200eb9ae Ditto for bags. 2021-03-09 15:04:11 -05:00
Vanessa Dannenberg
b3077898a7 make waypoints explicitly reference full-style vars
(since it does not support lite mode)
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