Commit graph

266 commits

Author SHA1 Message Date
cora
79766bff23
Fix server crash when players dig unknown nodes
Digging unknown nodes crashes the Clamity Minetest server, which
runs modified Minetest: https://github.com/ClamityAnarchy/minetest
Crashes did occur with commit d5434bf008 of that Minetest version.

This commit makes unknown nodes explicitly not harvestable.
2021-06-17 23:39:13 +02:00
Elias Åström
c1bed0a826 Merge branch 'master' into mod.conf 2021-05-23 16:15:56 +00:00
Elias Åström
f3b0285347 Merge pull request 'mcl_explosions: Adjust explosion entity damage hitbox' (#62) from mcl_explosions2 into master
Reviewed-on: https://git.minetest.land/Mineclonia/Mineclonia/pulls/62
Reviewed-by: cora <cora@noreply.git.minetest.land>
2021-05-18 18:16:39 +02:00
Elias Åström
7ea25ab172 Merge branch 'master' into mcl_explosions 2021-05-18 16:04:40 +00:00
Elias Åström
5d3514880a Move data from deprecated files to mod.conf
Move data from deprecated files (depends.txt and description.txt) into
fields in mod.conf for all mods.
2021-05-16 13:44:04 +02:00
Elias Åström
d9bbf4879c Adjust explosion entity damage hitbox
In mcl_explosions the hitbox used for calculating the damage of an
entity is its collisionbox multiplied by two.  This commit removes the
multiplication by two because that makes explosion damage behave weirdly
in some circumstances.  It was most likely implemented that way because
of a misinterpretation of the Minecraft wiki.
2021-05-09 14:41:05 +02:00
Elias Åström
74d4986d1d Fix rays not being cast in a specific direction
A bug was introduced in 679e2b1b which caused explosions to not cast
rays for environment destruction in the (+X, +Y, +Z) direction.  This
commit fixes that.
2021-05-01 17:25:10 +02:00
erlehmann
3009ebb2c6 Merge branch 'master' into mcl_autogroup 2021-04-29 21:24:32 +00: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
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
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
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
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
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 Åström
53041a0d62 Add setting to bypass protection in mcl_explosions 2021-02-28 16:06:48 +01:00
kay27
47db5c5917 Make mcl_loot/get_random_slots() deterministic 2021-02-22 21:58:35 +04:00
kay27
89e55e9065 Add sub-map generators queue, fix https://git.minetest.land/MineClone2/MineClone2/issues/993 and https://git.minetest.land/MineClone2/MineClone2/issues/1060 2021-02-22 03:15:32 +04:00
Elias Åström
5972322639 Remove backward compatible names in explosion info
Appears like they were not used anywhere.
2021-02-16 21:36:37 +01:00
Elias Åström
d5ea06bb47 Fix center of bounding box calculation 2021-02-16 21:33:26 +01:00
kay27
3b196da12f Speedup placing villages 1/2 (update mcl_tools through Gitea, as direct push doesn't work) 2021-02-10 13:04:49 +00:00
Elias Åström
948438bd1c Add max_blast_resistance to mcl_explosions.explode
If the option is specified, then the explosion will treat all
non-indestructible nodes as having a blast resistance of no more than
the value of the option.
2021-01-26 17:04:22 +01:00
Elias Åström
34274486c7 Add griefing option to mcl_explosions.explode
When set to false explosions will only affect entities and not destroy
nodes.
2021-01-26 17:04:22 +01:00
Elias Åström
e3d2284485 Refactor some stuff in mcl_explosions 2021-01-26 17:04:22 +01:00
Elias Åström
4a07b0607f Improve API of mcl_explosions.explode
Replace the 'no_sound' and 'no_particle' options in the 'info' parameter
with 'sound' and 'particles'.  But also has backwards compatability for
the old parameter names.
2021-01-26 17:04:22 +01:00
Elias Åström
c907df9669 Tiny code style cleanup in mcl_explosions 2021-01-26 17:04:22 +01:00
Elias Åström
5ecb56452e Fix creeper explosions only doing 1/2 heart damage
The solution was to move the creeper explosions to originate from the
center of the creepers collisionbox and not its entity position.
2021-01-26 17:04:22 +01:00
MysticTempest
41bd803185 Add support for mcimported worlds by clearing out singlenode mapgen, and adding a toggleable fix for converted double_plants. 2021-01-26 17:04:22 +01:00
kay27
1a2c500873 Restore missing 'died formspec' after player exploded being in the bed 2021-01-20 01:46:52 +04:00