Commit Graph

5357 Commits

Author SHA1 Message Date
Elias Åström
c8b543991f Automatically assign nodes to creative_breakable
If they belong to any digging group.
2021-03-18 11:35:40 +01:00
Elias Åström
8f9650abe4 Update the groupcaps of all enchanted tools
Not just those enchanted with efficiency.
2021-03-18 11:35:40 +01:00
Elias Åström
4c46eb2b4b 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-03-18 11:35:40 +01:00
Elias Åström
fe770c19a5 Fix crash when tool_capabilities is nil 2021-03-18 11:35:40 +01:00
Elias Åström
0112825a9f Localize variables in _mcl_autogroup 2021-03-18 11:35:40 +01:00
Elias Åström
cff0130506 Rename _mcl_autogroup_groupcaps to _mcl_diggroups 2021-03-18 11:35:40 +01:00
Elias Åström
7b93f68ed8 Fix typo 2021-03-18 11:35:40 +01:00
Elias Åström
ece4c892f4 Force tools to include levels in their diggroups 2021-03-18 11:35:40 +01:00
Elias Åström
bec1f786a6 Improve documentation of mcl_autogroup 2021-03-18 11:35:40 +01:00
Elias Åström
6458565bf9 Move mcl_util.hash to a local function
It is probably unlikely it will be useful at other places in Mineclone2.
2021-03-18 11:35:40 +01:00
Elias Åström
2e9b3c2259 Move efficiency code to its own file 2021-03-18 11:35:40 +01:00
Elias Åström
5193730652 Truncate groupcaps_hash to 8 Base64 digits 2021-03-18 11:35:40 +01:00
Elias Åström
e77473e800 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-03-18 11:35:40 +01:00
Elias Åström
922bdbc601 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-03-18 11:35:40 +01:00
Elias Åström
3241dbbec5 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-03-18 11:35:40 +01:00
Elias Åström
b47733507d 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-03-18 11:35:29 +01:00
Elias Åström
f0528b11d7 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-03-18 11:34:26 +01:00
Elias Åström
503b3a8149 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-03-18 11:34:26 +01:00
Elias Åström
5b5a254b1a Fix tool uses not being set in _mcl_autogroups 2021-03-18 11:34:26 +01:00
Elias Åström
0c90dda04c Rename register_digtime_group to register_diggroup 2021-03-18 11:34:26 +01:00
Elias Åström
fa86d4e5eb Change comments for mcl_autogroup 2021-03-18 11:34:20 +01:00
Elias Åström
f8461d5e90 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-03-18 11:33:18 +01:00
Elias Åström
fb6f5eae7a 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-03-18 11:32:18 +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
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
Code-Sploit
828c1110b1 Implement Depth Strider enchantment 2021-02-27 15:37:25 +00:00
Code-Sploit
578709c93e Add Depth Strider enchantment 2021-02-27 15:35:59 +00:00
Elias Fleckenstein
e5263d854e Localize player_vel_yaw 2021-02-27 15:10:25 +01:00
Elias Fleckenstein
a923b61ac8 Merge branch 'master' of https://git.minetest.land/MineClone2/MineClone2 2021-02-27 15:07:18 +01:00
Elias Fleckenstein
5a0b7bc131 Fix usages of player:get_velocity(), closes #1203 2021-02-27 15:07:10 +01:00
Elias Fleckenstein
68ac84da83 Proper archievement chat messages 2021-02-27 14:51:50 +01:00
Elias Fleckenstein
311e1b74a3 Merge pull request 'Fix French translations' (#1211) from pitchum/MineClone2:master into master
Reviewed-on: https://git.minetest.land/MineClone2/MineClone2/pulls/1211
2021-02-27 13:44:32 +00:00
Elias Fleckenstein
ba1e42a638 Remove debug chat_send_all xD 2021-02-27 14:42:39 +01:00
Elias Fleckenstein
8d5b2ff714 Make boats less annoying on ice 2021-02-27 14:38:53 +01:00
pitchum
d0e789daf2 More fixes in French translations 2021-02-27 13:43:57 +01:00
pitchum
b0f389eb9f Fix French translations for 'Achievement gotten' 2021-02-27 12:15:33 +01:00