Commit graph

5698 commits

Author SHA1 Message Date
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
Elias Åström
64e353a9c2 Fix some nodes not being diggable
Previously some nodes like "mcl_flowers:double_grass_top" would be
undiggable.  This was because they did not define _mcl_hardness and it
was not defaulted to 0 in all parts of _mcl_autogroup.
2021-04-16 22:32:56 +02:00
Elias Åström
ecccc2058a Fix tool uses not being set in _mcl_autogroups 2021-04-16 22:32:53 +02:00
Elias Åström
bb5094f657 Rename register_digtime_group to register_diggroup 2021-04-16 22:32:49 +02:00
Elias Åström
a342652960 Change comments for mcl_autogroup 2021-04-16 22:32:46 +02:00
Elias Åström
ffbbe91bc5 Remove mcl_autogroups.get_groupcaps
Requiring tool definitions to call a function in _mcl_autogroup means
that they need to be loaded after _mcl_autogroup.  This can cause
problems because _mcl_autogroup needs to be loaded after all tool and
node definitions are completed.

Because of this the API is changed so tool definitions instead put the
data used to generate groupcaps in the custom field
_mcl_autogroup_groupcaps.  _mcl_autogroup will then go through all
registered tools and update the groupcaps for every tool where this
field is present.  This means that no mod ever has to depend on
_mcl_autogroup.
2021-04-16 22:31:57 +02:00
Elias Åström
012e150b59 Rewrite mcl_autogroup
These changes are primarly made to make mcl_autogroup more efficient.
Previously enchanted tools required storing around 21 kB of metadata due
to the way the previous version of the mod was implemented.  This caused
a lot of lag and a huge amount of network traffic.  With the changes
enchanted tools won't require more than 1 kB of metadata.

The mod is also rewritten to use an API to register digging groups and
compute the groupcaps for tools.  This will make it easier for modders
to register custom digging groups.

The mod is now split up into two parts.  One part called "mcl_autogroup"
to implement the API for registering custom digging groups, and the
other part called "_mcl_autogroup" which contains most of the code which
has to be loaded after most mods.
2021-04-16 22:31:42 +02:00
Elias Fleckenstein
e9182a9506 Update version and credits 2021-03-01 18:32:03 +01:00
Elias Fleckenstein
9dbde4ce33 New MineClone2 logo 2021-03-01 18:22:08 +01:00
Elias Åström
97bd3777e1 Merge branch 'master' of https://git.minetest.land/Wuzzy/MineClone2 2021-03-01 16:10:55 +01:00
Elias Åström
1b9857219d Lower drop rate of TNT to 25 %
So it becomes consistent with Minecraft 1.12.
2021-03-01 16:08:52 +01:00
Elias Fleckenstein
f5b590901e Merge branch 'master' of https://git.minetest.land/Wuzzy/MineClone2 2021-03-01 10:52:07 +01:00
Elias Fleckenstein
95b0a495bc Fix #1152 2021-03-01 10:51:57 +01:00
kay27
8af76f835d Slightly tweak minecarts to be more MC-like 2021-03-01 01:43:00 +04:00
Elias Åström
53041a0d62 Add setting to bypass protection in mcl_explosions 2021-02-28 16:06:48 +01:00
Elias Fleckenstein
961e5a249f Merge pull request 'Depth Strider enchantment' (#1214) from Code-Sploit/MineClone2:master into master
Reviewed-on: https://git.minetest.land/MineClone2/MineClone2/pulls/1214
2021-02-28 14:09:37 +00:00
Code-Sploit
83ade6fadd Merge branch 'master' into master 2021-02-28 14:04:10 +00:00
Code-Sploit
6ab0e0fa86 Do some calculating 2021-02-28 14:02:48 +00:00
kay27
05a3b4e60c Wrap https://github.com/minetest/minetest/issues/10995 around, thanks @SmallJoker 2021-02-28 16:35:21 +04:00
epCode
9f66238aaa Transform mcl_meshhand_female.b3d to correct rotation 2021-02-27 11:36:18 -08:00
kay27
6f2f427777 fix a typo 2021-02-27 23:31:01 +04:00
kay27
abc0bb9e8e Fix dir_to_rotation() 2021-02-27 23:20:57 +04:00
kay27
21e6c5ad1f Fix https://git.minetest.land/MineClone2/MineClone2/issues/1216 2021-02-27 22:44:34 +04:00
kay27
bf81bb7f07 Translatable archievement chat messages 2021-02-27 22:16:29 +04:00
Code-Sploit
99b5dff849 Fix another bug 2021-02-27 16:13:05 +00:00
Code-Sploit
de9d838642 Fix a bug and improve some things
Bugs:
1) When player is in liquid and takes off his/her boots, he/her still has increased speed.

Improve:
1) Check for liquid group instead of node names
2021-02-27 16:10:11 +00:00