Commit graph

266 commits

Author SHA1 Message Date
Elias Åström
0f2c487dca 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-03-18 13:59:22 +01:00
Elias Åström
bfe51316ee Merge branch 'mcl_autogroups' 2021-03-18 13:43:58 +01:00
Elias Åström
13268965ee Update README.txt in _mcl_autogroup 2021-03-18 13:40:56 +01:00
Elias Åström
521f96b4ab Use mod.conf for mcl_autogroup and _mcl_autogroup 2021-03-18 13:36:25 +01:00
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
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
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
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
AFCMS
ae18ca7602 fix wrong value in walkover 2021-03-17 10:48:59 +01:00
AFCMS
f35f80d79a fix walkover 2021-03-16 17:31:29 +01:00
AFCMS
2da8be9f78 optimise walkover part2 2021-03-16 11:22:13 +01:00
AFCMS
71bb18cd76 walkover optimisation part1 2021-03-16 11:07:17 +01:00
AFCMS
4b2c963222 performances improvement for mcl_explosions 2021-03-15 01:20:22 +01:00
AFCMS
671de95357 improve performances of controls 2021-03-15 00:35:58 +01:00
AFCMS
787d997e51 fix warnings in mcl_explosion 2021-03-11 23:08:51 +01:00
Elias Fleckenstein
2125c51c9c Fix mcl_util.get_color 2021-03-05 10:20:19 +01:00
Elias Fleckenstein
09671b7ac9 Add simple color validator / parser 2021-03-05 09:37:27 +01:00
Elias Fleckenstein
d57db0444f Use mod.conf in all mods, part 1 2021-03-04 15:22:14 +01:00
Elias Fleckenstein
713f933a99 Merge branch 'master' of https://git.minetest.land/Wuzzy/MineClone2 2021-03-04 10:26:27 +01:00
Elias Fleckenstein
ee084f33a7 Add mcl_colors 2021-03-04 10:26:17 +01: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