Commit Graph

79 Commits

Author SHA1 Message Date
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
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
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
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
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
Maksim
f25426911d
Fix teleport sounds when teleport fails (#155) 2020-07-10 21:58:45 +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
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
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
Panquesito7
4403b696be Replace deprecated functions with newer ones (#131)
These commits makes more compatibility with MT/MTG 5.0.0+ versions.
However, these commits breaks compatibility with the 0.4-series.
2019-06-16 10:26:40 +02:00
SmallJoker
b871ccfc41 Use table.concat to build formspecs, style cleanups 2019-03-31 11:29:10 +02:00
SmallJoker
e9b4b52dc1 Biggest stacks first, smallest as late as possible
Split stacks ~evenly
Fast skip occupied slots
2019-03-30 22:53:36 +01:00
SmallJoker
bcb96d6caf Improve craftguide_craft() speed: Move stacks 2019-03-30 22:53:36 +01:00
SmallJoker
850ee9cbc0 Improve callback execution, add giveme guards 2019-02-17 15:14:38 +01:00
codexp
3988f4c572 Merge origin/master to refactor-translation branch (resolving conflicts) 2018-06-23 15:37:13 +02:00
SmallJoker
edd00f222c Replace deprecated function names, unify creative check 2018-06-23 15:02:23 +02:00
codexp
934757edd6 FIX: do not translate direction 2018-04-08 22:21:44 +02:00
codexp
c1ab7277ab refactor code to use with intllib tool 2018-04-02 13:33:36 +02:00
ForbiddenJ
7ab8825460 Make trash configurable but preserve default functionality 2017-03-01 16:28:40 -06:00
Vanessa Ezekowitz
2e00206f58 Merge pull request #81 from Wuzzy2/master
Disable useless main buttons
2016-11-27 13:36:02 -05:00
Vanessa Ezekowitz
e57a5f80b4 Merge pull request #80 from Wuzzy2/give
Also enable “Give me” for creative mode and priv
2016-11-27 13:31:12 -05:00
Wuzzy
8770b7df93 Disable useless main buttons 2016-11-06 02:28:45 +01:00
Wuzzy
a661f54e72 Also enable “Give me” for creative mode and priv 2016-11-06 01:48:05 +01:00
Wuzzy
8e98b00021 Also show “real” item name in craft result 2016-10-29 14:20:11 +02:00
Wuzzy
15f5b8e804 Craftguide: Use better tooltips for group buttons 2016-08-14 23:36:12 +02:00
Wuzzy
0678056716 Fix horizontally flipped crafting recipes in guide 2016-08-14 13:17:41 +02:00
Wuzzy
3bc3fae648 Hide “To crafting grid:” for crafts with size > 3 2016-08-14 13:16:30 +02:00
Wuzzy
2ef76af687 Apply size optimizations for large craftings
Also prevent huge crafting recipes from being displayed for stability reasons.
2016-08-14 13:16:30 +02:00
Wuzzy
c1fcc06059 Fix horizontal craft guide offset for large crafts 2016-08-14 13:16:30 +02:00
Wuzzy
f8082a0e35 Fix crafting guide grid button sizes for size>4 2016-08-14 13:16:30 +02:00
Wuzzy
5c57915159 Attempt to make large crafting recipes displayable 2016-08-14 13:16:30 +02:00
Wuzzy
a1e7b650ab Guide: Allow to move back and forth in alternates 2016-08-14 10:56:24 +02:00
Vanessa Ezekowitz
23a27b38ae Revert "Show real item name in craft guide"
Players don't really like this, neither do I.
See the comments attached to the original commit.
Sorry, Wuzzy. :-(

This reverts commit fe00059eea.
2016-08-13 18:19:29 -04:00
Wuzzy
fe00059eea Show real item name in craft guide 2016-08-08 09:19:23 -04:00
Wuzzy
c816666945 Ensure formspec escaping for translated strings 2016-08-06 17:23:46 +02:00
Wuzzy
8ffc8e9323 Fix translation strings for recipe alternations 2016-08-06 16:34:16 +02:00
Wuzzy
115e0bfaf4 Collect missing strings for translation 2016-08-05 19:34:40 +02:00
RealBadAngel
b3c6c92286 Remove count from item_image_button label,
item_image_buttons can now display properly item stacks
2016-02-09 04:42:45 +01:00
DonBatman
df1309a6fd Added listring/shift click to craft grid 2015-10-09 19:25:49 -07: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
Prot
2355dc6fc2 require "home" privilege to use home/sethome buttons 2015-07-19 17:01:36 -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