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.
The newly-added preview items (#40) didn't play nice with the side
preview image, mostly because the "layers" metadata wasn't generated,
and they didn't record the base color of the actual banner being crafted.
This commit re-adds that (and other) metadata.
The `layer` string was inherited from the old patch, which I frankly
don't understand. I restructured it to `follow make_banner_texture` more
closely, with the addition of the mcl_banners_front mask, which
prevents the rear portions of the patterns from showing up.
The numbers in the final `[combine` and `[resize` steps are arbitrary,
and were derived by trial-and-error.
This patch was technically backported from a later version of
MineClone2. Between the point where Mineclonia forked, and the point
where this patch was developed, MineClone2 introduced a "mcl_colors"
mod which, presumably just lists some colors. This commit removes
references to that mod, as it doesn't exist in our history.
A preview of a crafted banner is now shown next to the craft result box
to help players visualize what they're crafting. Due to the formspec
version, the preview can't be shown over top of the actual result slot.
A utility function (mcl_banners.get_overlay) is added to generate
formspec-able texture strings for arbitrary banners.
During the rewrite in 89e55e9065, a queue system was added to allow
using both VoxelManip-based generation steps, and set_node-based steps,
however some set_node-based steps (underground mushrooms, nether
decorations, and structures) were missed and remained in a VoxelManip
step. The result is that the changes made by the set_node stages were
overwritten after the (now-stale) VoxelManip data was committed later.
(ref. Mineclonia/Mineclonia#26)
This commit makes enchanted tools which have no use for
tool_capabilities to not include it in their metadata. It does this by
not including tool_capabilities in the metadata of an enchanted tool if
at least one of two cases is true:
(1) The tool is not enchanted with unbreaking or efficiency
(2) The tool does not have tool_capabilities defined in its definition
The first case covers situations like having a pickaxe only being
enchanted with silk_touch. The second case covers situations like a
piece of armor being enchanted with unbreaking.
This commit fixes an issue were tools enchanted with both efficiency and
unbreaking would loose the effect of one of the enchantments in some
conditions.
It looks like the dependency might cause problems with the mod loading
order and lead to situations were _mcl_autogroup is not loaded after all
the other mods. Because _mcl_autogroup begins with an underscore it
should always be loaded after mcl_autogroup anyways.
If the tool_capabilities defaults to {} if unspecified the tool, then
users will not be able to attack with the tool at all. This solves that
by including the damage_group and full_punch_interval from the hand into
the tool_capabilities when it is nil.
Group levels are now specified as a list of names when registering a
digging group. Digging groups which do not have specified levels will
support tools having two levels, 0 and 1 where 0 means the tool can dig
but not harvest the node and 1 means it can also harvest the node. If
more levels are required one has to specifiy them when registering the
digging group.
This adds the metadata field "groupcaps_hash" to tools enchanted with
efficiency. This value contains a hash of the groupcaps field in
tool_capabilities. This value gets compared to the expected hash value
to determine if the tools tool_capabilities should be updated according
to commit af31f8189e8e5c2b.
This commit makes efficiency more efficient.
Because of the way digging times is implemented in Mineclone2, it is
possible for the digging times of efficiency enchanted tools to become
outdated.
This fixes that by automatically updating the tools tool_capabilities
after each time the tool is used.
Added the API function mcl_autogroup.get_wear which is used to get the
tool wear for digging a node of a group. This is used by mcl_tools to
compute the wear of shovels and shears when rightclicking to create
grass paths and carve pumpkins.