Commit Graph

5391 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
E 32172676f3 items/mcl_banners: make previews items compatible with side preview
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.
2021-05-02 00:42:12 -04:00
E 164b65a2ca items/mcl_banners: reuse `escape` across functions 2021-05-02 00:42:12 -04:00
E 412c1ac5d6 items/mcl_banners: fix preview masking
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.
2021-05-02 00:42:12 -04:00
E 5d0c9c77cd items/mcl_banners: make `escape` local 2021-05-02 00:42:10 -04:00
E ccc1ce566f items/mcl_crafting_table: remove reference to "mcl_colors" mod
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.
2021-05-02 00:41:53 -04:00
E 519c3814aa mcl_banners, mcl_crafting_table: show banner crafting preview
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.
2021-05-02 00:41:37 -04:00
E 5255c0e6d0 Cherry pick 3ef10cfb30 2021-05-01 21:46:09 -04:00
My favourite Minetest cheat clients are Dragonfire and Waspsaliva. 150868f03b Merge pull request 'mapgen/mcl_mapgen_core: base mushrooms and nether decorations off block seed' (#43) from e/Mineclonia:mapgen-nondet into master
Reviewed-on: Mineclonia/Mineclonia#43
Reviewed-by: erlehmann <nils+git.minetest.land@dieweltistgarnichtso.net>
Reviewed-by: Elias Åström <ryvnf@riseup.net>
2021-05-01 23:41:12 +00:00
My favourite Minetest cheat clients are Dragonfire and Waspsaliva. 659a158c66 Merge branch 'master' into mcl_autogroup 2021-05-01 18:02:18 +00:00
My favourite Minetest cheat clients are Dragonfire and Waspsaliva. 4085d95d96 Merge pull request 'Show preview of new banner pattern when crafting it' (#40) from banners-pattern-preview into master
Reviewed-on: Mineclonia/Mineclonia#40
Reviewed-by: cora <cora@noreply.git.minetest.land>
2021-05-01 17:25:19 +00:00
My favourite Minetest cheat clients are Dragonfire and Waspsaliva. 3009ebb2c6 Merge branch 'master' into mcl_autogroup 2021-04-29 21:24:32 +00:00
E 4ae17b0c8e mapgen/mcl_mapgen_core: base mushrooms and nether decorations off block seed 2021-04-25 23:17:27 -04:00
My favourite Minetest cheat clients are Dragonfire and Waspsaliva. 0d92212e08 Merge pull request 'mapgen/mcl_mapgen_core: move set_node decorations a node callback' (#29) from e/Mineclonia:nether-fix into master
Reviewed-on: Mineclonia/Mineclonia#29
Reviewed-by: Elias Åström <ryvnf@riseup.net>
Reviewed-by: erlehmann <nils+git.minetest.land@dieweltistgarnichtso.net>
2021-04-24 18:51:57 +00:00
Nils Dagsson Moskopp ac5f115f83
Show preview of new banner pattern when crafting it 2021-04-23 17:29:43 +02:00
Elias Åström 31341ca57b Fix crash when blowing up an unknown node
Unknown nodes get a blast resistance of zero.
2021-04-23 16:39:02 +02:00
Elias Åström e52cae28cd Duplicate groupcaps before applying unbreaking 2021-04-23 16:33:22 +02:00
E 2381cb8e84 mapgen/mcl_mapgen_core: move set_node decorations a node callback
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)
2021-04-20 00:41:10 -04:00
Benjamin Schötz e5c324b0d7 Added french, spanish, russian translation for killerbunny-nametag 2021-04-19 20:43:18 +02:00
Benjamin Schötz 82c838e067 Sets killerbunny-label in a translateable way 2021-04-19 20:27:20 +02:00
AFCMS 078586fa1a
Solve quartz not generating in the nether 2021-04-19 00:14:35 +02:00
Nils Dagsson Moskopp c0a76dd24f
Make the server not crash when players are killed by named mobs 2021-04-18 16:51:47 +02:00
Elias Åström 1c6d3c2fea Do not include unnecessary tool_capabilities
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.
2021-04-18 12:45:11 +02:00
Elias Åström d6e1fe42d1 Fix efficiency and unbreaking not working together
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.
2021-04-18 12:45:06 +02:00
Elias Åström 42c7186674 Do not register "creative_breakable" as a diggroup 2021-04-16 22:46:08 +02:00
Elias Åström b57c94df88 Fix crash when digging nodes with fishing rod
Previously the game would crash when digging nodes with a tool which
does not have tool_capabilities in their item definition.
2021-04-16 22:45:36 +02:00
Elias Åström 34af6a2cc3 Assert that both parts of mcl_autogroup exist 2021-04-16 22:45:22 +02:00
Elias Åström 029ebaa388 Rename "tool_multiplier" to "speed" for tools 2021-04-16 22:45:22 +02:00
Elias Åström 2df6ee32be Remove unnecessary code in mcl_item_entity 2021-04-16 22:45:22 +02:00
Elias Åström 9d38f0d01b Fix crash when digging nodes with hoe
Previously the game would crash when digging nodes with a tool which
does not have _mcl_digroups in their item definition.
2021-04-16 22:44:44 +02:00
Elias Åström eb1af8902d Remove _mcl_autogroup depends on mcl_autogroup
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.
2021-04-16 22:35:46 +02:00
Elias Åström d4a3213343 Update README.txt in _mcl_autogroup 2021-04-16 22:35:24 +02:00
Elias Åström 0681fc98d2 Use mod.conf for mcl_autogroup and _mcl_autogroup 2021-04-16 22:35:12 +02:00
Elias Åström 9c961394ec Automatically assign nodes to creative_breakable
If they belong to any digging group.
2021-04-16 22:34:53 +02:00
Elias Åström 64e8b82ff7 Update the groupcaps of all enchanted tools
Not just those enchanted with efficiency.
2021-04-16 22:34:48 +02:00
Elias Åström 54563262f6 Make tools without toolcaps do damage as hand
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.
2021-04-16 22:34:44 +02:00
Elias Åström 6fb56b074f Fix crash when tool_capabilities is nil 2021-04-16 22:34:34 +02:00
Elias Åström 7583223f68 Localize variables in _mcl_autogroup 2021-04-16 22:34:30 +02:00
Elias Åström 9bb39dfba6 Rename _mcl_autogroup_groupcaps to _mcl_diggroups 2021-04-16 22:34:26 +02:00
Elias Åström dcd050a274 Fix typo 2021-04-16 22:34:22 +02:00
Elias Åström ccd53e7f10 Force tools to include levels in their diggroups 2021-04-16 22:34:18 +02:00
Elias Åström 85ff4cee75 Improve documentation of mcl_autogroup 2021-04-16 22:34:14 +02:00
Elias Åström 3308ce812d Move mcl_util.hash to a local function
It is probably unlikely it will be useful at other places in Mineclone2.
2021-04-16 22:34:10 +02:00
Elias Åström e32f17b82a Move efficiency code to its own file 2021-04-16 22:34:04 +02:00
Elias Åström 576dde1dd5 Truncate groupcaps_hash to 8 Base64 digits 2021-04-16 22:33:59 +02:00
Elias Åström b50addac55 Make changes to the mcl_autogroup API
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.
2021-04-16 22:33:55 +02:00
Elias Åström fe883a40bc Use hashing for more efficient groupcaps updating
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.
2021-04-16 22:33:13 +02:00
Elias Åström 4a9561e5dc Update enchanted tools with outdated digging times
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.
2021-04-16 22:33:10 +02:00
Elias Åström c92f0e5ce3 Fix tools not taking wear when rightclicking
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.
2021-04-16 22:33:07 +02:00
Elias Åström ba0a09243b Make mcl_enchanting use the new mcl_autogroups
The function mcl_autogroups.get_groupcaps is used by mods to get the
groupcaps for tools with efficiency enchantments.  This function is used
by mcl_enchanting when enchanting tools with efficiency.
2021-04-16 22:33:00 +02:00