Commit Graph

4 Commits

Author SHA1 Message Date
E 842cc6d1e4 hud/mcl_formspec: add formspec V2 conversion utilities
Formspecs come in different versions. While maintaining the same basic
syntax, version 1->2 changed (among other things) how coordinates work
by eliminating some (previously) built-in spacing and padding. This
commit adds a number of utility functions that can be used to upgrade
a formspec in-place.

- `size2r` returns a string with the provided w,h coordinates converted
  for use with `size[]` in formspec versions 2+
- `i2r` converts a single coordinate from the V1 coordinates system to
  the V2+ "Real" coordinates
- `xy2r` returns a string suitable for use with other elements that
  accept a coordinate pair. It is a simple wrapper for `i2r`.

The formulas used reflect those specified by the Minetest Lua API docs.
2021-05-02 00:54:52 -04:00
Wuzzy da1c3f635c Revert "Add dummy inventory images for backwards-compat"
This reverts commit 73d93ae969.
2020-03-29 14:38:39 +02:00
Wuzzy 73d93ae969 Add dummy inventory images for backwards-compat
In 0.60.0, the inventory rendering of nodes was changed, so images were removed. This caused missing image errors with *existing* node formspecs, however, so empty dummy images are added back.
2020-03-29 14:05:59 +02:00
Wuzzy 7243a25fe6 Generate item slot images on the fly 2020-03-24 18:48:14 +01:00