Commit Graph

258 Commits

Author SHA1 Message Date
Vanessa Dannenberg
1334ca0202 make craft arrow 128px
(same reason as the trash icon)
2021-03-08 14:11:45 -05:00
Vanessa Dannenberg
cfe21b93fb swap the craft type icon with its word
(makes it look like it used to)
2021-03-08 14:04:02 -05:00
Vanessa Dannenberg
036804716e 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-08 13:15:24 -05:00
Vanessa Dannenberg
6da359e9d2 remove unused var, excess whitespace 2021-03-08 12:56:04 -05:00
Vanessa Dannenberg
e4f6e1adc4 fix missing "XYZ" and "no" icon on waypoints show coordinates button 2021-03-08 12:53:14 -05:00
Vanessa Dannenberg
ea4151dfa7 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-08 12:32:13 -05:00
Vanessa Dannenberg
d063af1d27 Draw the trash slot by overlaying the bare trash can icon
over the single slot image instead of baking it in.
2021-03-08 09:53:25 -05:00
Vanessa Dannenberg
250d038d0b 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-08 09:14:21 -05:00
Vanessa Dannenberg
8a7d8268ad use local ui=unified_inventory shorthand in init.lua as elsewhere 2021-03-08 05:10:16 -05:00
Vanessa Dannenberg
51de368949 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-08 05:10:16 -05:00
Vanessa Dannenberg
e61ae0e149 always modify and return a table.copy() of the style table 2021-03-08 05:10:00 -05:00
Vanessa Dannenberg
531442c63e move S() calls into waypoints' button table
instead of inside the loop
2021-03-08 05:10:00 -05:00
Vanessa Dannenberg
62881d9938 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-08 05:10:00 -05:00
Vanessa Dannenberg
55692900f9 use local "ui" to reference "unified_inventory", where practical
(makes code shorter, easier to read and write)
2021-03-08 05:10:00 -05:00
Vanessa Dannenberg
d52303a89e Ditto for bags. 2021-03-08 05:10:00 -05:00
Vanessa Dannenberg
b9e4b9e455 make waypoints explicitly reference full-style vars
(since it does not support lite mode)
2021-03-08 05:10:00 -05:00
Vanessa Dannenberg
4d52ebe774 put style-specific settings in their own tables
and switch between them directly, instead of copy-and-modify.
2021-03-08 05:10:00 -05:00
Vanessa Dannenberg
73ce55646c "Please continue to use string.format here to avoid messy code"
Derp :-)
2021-03-08 05:10:00 -05:00
Vanessa Dannenberg
4b39bc86cb fix indent 2021-03-08 05:10:00 -05:00
Vanessa Dannenberg
0df814d9d4 remove a used-only-once variable 2021-03-08 05:10:00 -05:00
Vanessa Dannenberg
8056bdf966 use string.format() to create the standard_inv variables
do it just once, after the lite mode settings are applied
(if applicable)
2021-03-08 05:10:00 -05:00
Vanessa Dannenberg
7e27f584eb get rid of uninv global
make all uses of it back into `unified_inventory.`
2021-03-08 05:09:54 -05:00
Vanessa Dannenberg
5140853a3a 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-07 04:26:11 -05:00
Vanessa Dannenberg
a0c06516f4 increase size and tweak position of "give/to grid" buttons
and make them vary in pos with lite vs full mode
2021-03-07 04:13:36 -05:00
Vanessa Dannenberg
5ec4b986bb 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-07 03:57:39 -05:00
Vanessa Dannenberg
0616d1f76b 9-slice the background image 2021-03-06 19:05:27 -05:00
Vanessa Dannenberg
eb6697aa0d remove a couple of unused variables 2021-03-06 16:37:35 -05:00
Vanessa Dannenberg
a5a09bcd3a bump minimum version to 5.4.0 2021-03-06 13:35:34 -05:00
Vanessa Dannenberg
e8e1d4d705 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-06 13:22:20 -05:00
Vanessa Dannenberg
fbbf786caf Tweak spacing between bags page top row and bag's inv 2021-03-01 18:57:50 +01:00
Vanessa Dannenberg
ae124b02c2 Tweak trash can icon 2021-03-01 18:57:50 +01: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
IFRFSX
0f756a5d33
Update translation for zh_CN and zh_TW (#161) 2020-12-15 19:17:10 +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
SmallJoker
d86592841e Remove unused 0.4.x files, multiline description 2020-07-11 19:51:42 +02:00
Maksim
f25426911d
Fix teleport sounds when teleport fails (#155) 2020-07-10 21:58:45 +02:00
David Leal
04b2edceb4
LuaCheck: Add hb as a global (#154)
`hb` global is from HudBars by Wuzzy2.
2020-06-06 13:09:08 +02:00
SmallJoker
5a24e9f6fc Fix item name position, also for hudbars 2020-06-05 21:30:53 +02:00
CarlosBarrazaE
eb96c89b5d
Update the Spanish language (#144)
Complete missing translations; error corrections.

Co-authored-by: David Leal <halfpacho@gmail.com>
2020-05-01 18:15:08 +02:00
David Leal
606ba6a1a3
Add GitHub workflow (#149) 2020-03-25 18:46:35 +01:00
SmallJoker
c0bd9977be Modernize. Bags: use strings 2020-03-21 18:57:53 +01:00
IFRFSX
26e0e41593
Improve traditional Chinese zh_TW (#143) 2020-02-12 19:14:22 +01:00
IFRFSX
a89245c41b
Add traditional Chinese translation (#142) 2020-02-02 16:24:57 +01:00
IFRFSX
f5c982cc85 Add Chinese Translation (#141) 2020-01-15 13:02:48 +01:00
Hamlet
05f7430216 Add Italian l10n (#140) 2019-11-21 18:59:48 +01:00
Andrey Kozlovskiy
ca6d9a10df Implement new crafting algorithm (#132)
* Implement new crafting algorithm

* Take craft width into account when creating craft index
* Fix moving logic, correctly check for empty stacks
* Return early when there's not enough items for craft
* Bound match_count with smallest stack_max value, take from inventory only if needed
* Continue if item can't be moved to the current position.
* Fix metadata loss and. Improve placement for some corner cases.
* Drop items from oversized stacks on the ground
* Place items exactly as displayed in the guide
* One source list one destination. Try to take from destination list first
2019-10-26 17:22:33 +02:00
Wuzzy
4a1414bacc Convert *.po files to *.tr files
This script was used, together with manual fixing:

https://gitlab.com/4w/xtend/blob/master/xtend_default/tools/convert_po_file_to_tr_file/convert_po_file_to_tr_file.lua
2019-10-17 21:05:08 +02: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
SmallJoker
04b1cb9e7d Fix error on invalid item_button_ fields
Also reduce the player inventory sending by one. If a formspec is sent, it'll also take the newest known search text
2019-08-02 16:39:43 +02:00