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.
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.
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).
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.
M screenshot.png
M textures/bags_large.png
M textures/bags_medium.png
M textures/bags_small.png
M textures/ui_1_icon.png
M textures/ui_2_icon.png
M textures/ui_3_icon.png
M textures/ui_4_icon.png
M textures/ui_5_icon.png
M textures/ui_bags_icon.png
M textures/ui_bags_lg_form.png
M textures/ui_bags_main_form.png
M textures/ui_bags_med_form.png
M textures/ui_bags_sm_form.png
M textures/ui_blank_image.png
M textures/ui_blue_icon_background.png
M textures/ui_circular_arrows_icon.png
M textures/ui_craft_icon.png
M textures/ui_craftgrid_icon.png
M textures/ui_craftguide_form.png
M textures/ui_craftguide_icon.png
M textures/ui_crafting_form.png
M textures/ui_doubleleft_icon.png
M textures/ui_doubleright_icon.png
M textures/ui_form_bg.png
M textures/ui_gohome_icon.png
M textures/ui_green_icon_background.png
M textures/ui_group.png
M textures/ui_home_icon.png
M textures/ui_left_icon.png
M textures/ui_main_inventory.png
M textures/ui_misc_form.png
M textures/ui_moon_icon.png
M textures/ui_no.png
M textures/ui_off_icon.png
M textures/ui_ok_icon.png
M textures/ui_on_icon.png
M textures/ui_pencil_icon.png
M textures/ui_red_icon_background.png
M textures/ui_right_icon.png
M textures/ui_search_icon.png
M textures/ui_sethome_icon.png
M textures/ui_skip_backward_icon.png
M textures/ui_skip_forward_icon.png
M textures/ui_sun_icon.png
M textures/ui_trash_icon.png
M textures/ui_waypoint_set_icon.png
M textures/ui_waypoints_icon.png
M textures/ui_xyz_icon.png
M textures/ui_xyz_off_icon.png
M textures/ui_xyz_on_icon.png
When the craft guide is showing a craft, the output slot is now a button,
which causes the craft guide to show ways in which that output can be
used. This mirrors the way input slots are buttons that show recipes
for the selected ingredient. Usages of an item can be iterated through
in the same way as recipes for the item. This incidentally offers some
ability to retrace one's steps through a crafting chain, without storing
actual history.
When the current craft guide item has no recipes, show a "no" symbol
instead of an ingredient grid, alongside the "No recipes" message.
When no item is selected in the craft guide, leave the recipe space empty.