Compare commits

...

79 Commits

Author SHA1 Message Date
E 538e3b7e35 project: drop unhelpful fields from bug-report template
Mineclonia/Mineclonia#56 (comment)
2021-05-18 20:41:14 -04:00
E 42205639f6 project: make the headers *actually* level 5
Mineclonia/Mineclonia#56 (comment)
2021-05-18 20:41:14 -04:00
E dd8bcaec50 project: un-bold bug-report environment fields
Mineclonia/Mineclonia#56 (comment)
2021-05-18 20:41:14 -04:00
E 4dd1b00a0a project: ask for definitive sources for Minecraft feature requests 2021-05-18 20:41:14 -04:00
E 32c7fe4741 project: change headings to level 5
Mineclonia/Mineclonia#56 (comment)
2021-05-18 20:41:14 -04:00
E c9c568847c project: change wording of problem section in feature request template
Mineclonia/Mineclonia#56 (comment)
2021-05-18 20:41:14 -04:00
E 838bf0034f project: simplify Feature Request template
Mineclonia/Mineclonia#56 (comment)
2021-05-18 20:41:14 -04:00
E 7f9ad443ac project: simplify Environment section for issue templates 2021-05-18 20:41:14 -04:00
E 1738d57a2c project: add title instructions to PR template 2021-05-18 20:41:14 -04:00
E 438e91d212 project: remove [unknown] tag from issue templates
Reporters aren't expected to know the layout of the mods, and having the
tag in the title may be confusing.

Mineclonia/Mineclonia#56 (comment)
2021-05-18 20:41:14 -04:00
E 9875183a6f project: add optional To do list to PR template
Mineclonia/Mineclonia#56 (comment)
2021-05-18 20:41:14 -04:00
E 95af8196a2 project: add issue & PR templates 2021-05-18 20:41:14 -04:00
Elias Åström f3b0285347 Merge pull request 'mcl_explosions: Adjust explosion entity damage hitbox' (#62) from mcl_explosions2 into master
Reviewed-on: Mineclonia/Mineclonia#62
Reviewed-by: cora <cora@noreply.git.minetest.land>
2021-05-18 18:16:39 +02:00
Elias Åström 4c61fc80c6 Merge pull request 'mcl_explosions: Fix rays for node destruction not being cast in (+X, +Y, +Z) direction from explosion' (#50) from mcl_explosions into master
Reviewed-on: Mineclonia/Mineclonia#50
Reviewed-by: cora <cora@noreply.git.minetest.land>
2021-05-18 16:07:09 +00:00
Elias Åström 7ea25ab172 Merge branch 'master' into mcl_explosions 2021-05-18 16:04:40 +00: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
My favourite Minetest cheat clients are Dragonfire and Waspsaliva. a9d4a85e9a Merge pull request 'Remove wrong preview banner crafting recipes' (#55) from banner-crafting-fix into master
Reviewed-on: Mineclonia/Mineclonia#55
Reviewed-by: E <e@noreply.git.minetest.land>
2021-05-03 14:30:47 +00:00
Nils Dagsson Moskopp ee9f49b86e
Remove wrong preview banner crafting recipes
In commit ac5f115f83, preview banners were introduced and given
crafting recipes. Those crafting recipes were the same as for banners without a pattern. That
change made banners without patterns uncraftable and preview banners craftable instead – this
patch makes banners without patterns craftable again and preview banners uncraftable.
2021-05-02 13:01:00 +02: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
Elias Åström 90f0a6ab2a Merge pull request 'Rewrite mcl_autogroup to reduce metadata for enchanted items' (#8) from mcl_autogroup into master
Reviewed-on: Mineclonia/Mineclonia#8
Reviewed-by: cora <cora@noreply.git.minetest.land>
Reviewed-by: n_to <n_to@noreply.git.minetest.land>
Reviewed-by: erlehmann <nils+git.minetest.land@dieweltistgarnichtso.net>
2021-05-01 21:14:49 +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
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
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
My favourite Minetest cheat clients are Dragonfire and Waspsaliva. d6463fe29a Merge pull request 'Fix crash when blowing up an unknown node' (#38) from mcl_explosions into master
Reviewed-on: Mineclonia/Mineclonia#38
Reviewed-by: n_to <n_to@noreply.git.minetest.land>
Reviewed-by: erlehmann <nils+git.minetest.land@dieweltistgarnichtso.net>
2021-04-24 03:29:09 +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
Elias Åström aa1af725f2 Merge pull request 'Update README.md after forking' (#3) from readme into master
Reviewed-on: Mineclonia/Mineclonia#3
Reviewed-by: Li0n <li0nsdichachu@outlook.com>
2021-04-22 15:18:01 +00: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
My favourite Minetest cheat clients are Dragonfire and Waspsaliva. fda2d41b4e Merge pull request 'Spawns killerbunnys with translateable nametag' (#28) from n_to/Mineclonia:killerbunny_translateable_label into master
Reviewed-on: Mineclonia/Mineclonia#28
Reviewed-by: cora <cora@noreply.git.minetest.land>
Reviewed-by: erlehmann <nils+git.minetest.land@dieweltistgarnichtso.net>
2021-04-20 02:56:32 +00: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
My favourite Minetest cheat clients are Dragonfire and Waspsaliva. bbe07abb0d Merge pull request 'Solve quartz not generating in the nether' (#24) from reintroduce_nether_quartz_ore into master
Reviewed-on: Mineclonia/Mineclonia#24
2021-04-18 23:12:17 +00:00
AFCMS 078586fa1a
Solve quartz not generating in the nether 2021-04-19 00:14:35 +02:00
My favourite Minetest cheat clients are Dragonfire and Waspsaliva. 0761ad0964 Merge pull request 'Make the server not crash when players are killed by named mobs' (#19) from fix_server_crash_when_player_killed_by_named_mob into master
Reviewed-on: Mineclonia/Mineclonia#19
2021-04-18 15:46:20 +00: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
My favourite Minetest cheat clients are Dragonfire and Waspsaliva. b041666c18 Merge pull request 'Revert broken minecart change' (#4) from minecart into master
Reviewed-on: Mineclonia/Mineclonia#4

This code fixes annoying minecart bugs that were introduced with Mineclone2 0.71.0:

• Minecarts going off the rails (#9)
• Minecarts being unable to go back on the rails (#10)
• TNT minecarts being broken (#11)
• Minecarts not being pushed by mobs (#12)

I have verified that it does not break the following features present in Mineclone2 0.70:

• Minecart teleporters
• Minecarts stop at the end of the rail
• Going uphill in a minecart
• Going downhill in a minecart
• Going around curves in a minecart
• Going left at intersections in a minecart with both left and right rail connections
• Going straight ahead at intersections with both right and straight ahead rail connections
• Pushing minecarts
• Powered golden rails make minecarts go faster
• Unpowered golden rails make minecarts stop
• Detector rails activate Redstone circuits
• Minecarts going in circles at maximum speed without glitching off the rails
• Dispensers placing minecarts on top of rail blocks on top of the dispenser
• Going to the Nether in a minecart
• Powered activator rails drop players from minecarts
• Unpowered activator rails do not drop players from minecarts
• Track switching using pistons pushing a Minecart from one track to another
• Minecarts stay on powered rails going up a spiral staircase
• Minecarts can activate note blocks through sensor blocks
• Minecarts can activate Redstone lamps through sensor blocks
2021-04-18 03:29:36 +00:00
Elias Åström 357024ad97 Merge pull request 'Update name in game.conf to Mineclonia' (#2) from game.conf into master
Reviewed-on: Mineclonia/Mineclonia#2
Reviewed-by: erlehmann <nils+git.minetest.land@dieweltistgarnichtso.net>
2021-04-16 22:15:34 +00: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
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 6741aded0b Update name in game.conf to Mineclonia 2021-04-16 16:34:59 +02:00
Elias Åström 15df697836 Update supported Minetest version to 5.4.0 2021-04-16 16:34:08 +02:00
Elias Åström b6b0496a26 Update README.md after forking 2021-04-16 16:34:08 +02:00
Elias Åström ac20baac12 Revert "Slightly tweak minecarts to be more MC-like"
This reverts commit 8af76f835d.
2021-04-16 16:29:06 +02:00
35 changed files with 999 additions and 503 deletions

View File

@ -0,0 +1,38 @@
---
name: "Bug Report"
about: "Use this for when something's broken."
labels:
- bug
- unconfirmed
---
##### What happened?
<!-- Describe what's wrong. -->
##### What did I expect?
<!-- Describe what should be happening instead -->
##### How to get it to happen
<!--
Write down exactly what you did to get the bug to happen
If you need more steps, just keep adding numbers. If you
don't need them all, delete the empty numbers.
-->
1.
2.
3.
##### Environment
Mineclonia Version: <!-- Paste the version of Mineclonia here, if you know it. -->
<!--
Please refer to https://git.minetest.land/Mineclonia/Mineclonia/wiki/Reporting-Bugs
if you need help finding your Minetest version.
-->
Minetest Version:

View File

@ -0,0 +1,22 @@
---
name: "Feature Request"
about: "Mineclonia doesn't do something you need it to"
labels:
- "feature request"
---
##### Problem
<!--
Describe what's wrong.
If you're reporting a missing feature from Minecraft,
please include a link to the Minetest wiki or Mojang bug
tracker entry describing that feature.
-->
##### Solution
<!-- Write down an example of what you'd like to happen. -->

View File

@ -0,0 +1,51 @@
<!--
Please include the main mod this PR affects in the title, including
the leading directory. For example, if you have added a new
type of banner to mcl_banners, the title should look like:
items/mcl_banners: add new banner type
-->
##### Problem
TRACKING ISSUE: #<!-- Tracking issue number -->
<!--
Describe WHAT problem this pull request solves.
If the tracking issue includes all the needed
information, you can leave this section empty.
-->
##### Solution
<!-- Describe HOW this pull request solves its problem. -->
##### Details
<!-- Include any additional information here. -->
##### Testing Steps
<!--
Write how we can verify this patch addresses its problem.
If you need more steps, just keep adding numbers. If you
don't need them all, delete the empty numbers.
-->
1.
2.
3.
<!--
If your pull request still needs work, uncomment the
following section and include a list of things that
need to be done before it's ready for us to look at.
Please remember to put WIP: in front of the title as well.
-->
<!--
##### To do
- [ ] Item 1
- [ ] Item 2
- [ ] Item 3
-->

4
API.md
View File

@ -17,6 +17,10 @@ Items can have these fields:
anvil.
See `mcl_banners` for an example.
Tools can have these fields:
* `_mcl_diggroups`: Specifies the digging groups that a tool can dig and how
efficiently. See `_mcl_autogroup` for more information.
All nodes can have these fields:
* `_mcl_hardness`: Hardness of the block, ranges from 0 to infinity (represented by -1). Determines digging times. Default: 0

View File

@ -1,5 +1,5 @@
# MineClone 2
An unofficial Minecraft-like game for Minetest. Forked from MineClone by davedevils.
# Mineclonia
An unofficial Minecraft-like game for Minetest. Forked from MineClone2.
Developed by many people. Not developed or endorsed by Mojang AB.
Version: 0.71.0
@ -74,24 +74,24 @@ These items do not work yet, but you can get them with `/giveme` for testing:
* Minecart with Command Block: `mcl_minecarts:command_block_minecart`
## Installation
This game requires [Minetest](http://minetest.net) to run (version 5.0.0 or
This game requires [Minetest](http://minetest.net) to run (version 5.4.0 or
later). So you need to install Minetest first. Only stable versions of Minetest
are officially supported.
There is no support for running MineClone 2 in development versions of Minetest.
There is no support for running Mineclonia in development versions of Minetest.
To install MineClone 2 (if you haven't already), move this directory into the
To install Mineclonia (if you haven't already), move this directory into the
“games” directory of your Minetest data directory. Consult the help of
Minetest to learn more.
## Project description
The main goal of **MineClone 2** is to be a clone of Minecraft and to be released as free software.
The main goal of **Mineclonia** is to be a clone of Minecraft and to be released as free software.
* **Target of development: Minecraft, PC Edition, version 1.12** (later known as “Java Edition”)
* MineClone2 also includes Optifine features supported by the Minetest
* Mineclonia also includes Optifine features supported by the Minetest
* Features of later Minecraft versions might sneak in, but they have a low priority
* In general, Minecraft is aimed to be cloned as good as Minetest currently permits (no hacks)
* Cloning the gameplay has highest priority
* MineClone 2 will use different graphics and sounds, but with a similar style
* Mineclonia will use different graphics and sounds, but with a similar style
* Cloning the interface has no priority. It will only be roughly imitated
* Limitations found in Minetest will be written down and reported in the course of development
@ -178,18 +178,18 @@ Technical differences from Minecraft:
* Different sounds (various sources)
* Different engine (Minetest)
… and finally, MineClone 2 is free software (“free” as in “freedom”)!
… and finally, Mineclonia is free software (“free” as in “freedom”)!
## Reporting bugs
Please report all bugs and missing Minecraft features here:
<https://git.minetest.land/MineClone2/MineClone2/issues>
<https://git.minetest.land/Mineclonia/Mineclonia/issues>
## Other readme files
* `LICENSE.txt`: The GPLv3 license text
* `CONTRIBUTING.md`: Information for those who want to contribute
* `MISSING_ENGINE_FEATURES.md`: List of missing features in Minetest which MineClone 2 would need for improvement
* `MISSING_ENGINE_FEATURES.md`: List of missing features in Minetest which Mineclonia would need for improvement
* `API.md`: For Minetest modders who want to mod this game
## Credits
@ -197,15 +197,15 @@ There are so many people to list (sorry). Check out the respective mod directori
### Coding
* [Wuzzy](https://forum.minetest.net/memberlist.php?mode=viewprofile&u=3082): Main programmer of most mods (retired)
* davedevils: Creator of MineClone on which MineClone 2 is based on
* davedevils: Creator of MineClone on which Mineclonia is based on
* [ex-bart](https://github.com/ex-bart): Redstone comparators
* [Rootyjr](https://github.com/Rootyjr): Fishing rod and bugfixes
* [aligator](https://github.com/aligator): Improvement of doors
* [ryvnf](https://github.com/ryvnf): Explosion mechanics
* MysticTempest: Bugfixes
* [bzoss](https://github.com/bzoss): Status effects, potions, brewing stand
* kay27 <kay27@bk.ru>: Experience system, bugfixes, optimizations (Current maintainer)
* [EliasFleckenstein03](https://github.com/EliasFleckenstein03): End crystals, enchanting, burning mobs / players, animated chests, bugfixes (Current maintainer)
* kay27 <kay27@bk.ru>: Experience system, bugfixes, optimizations
* [EliasFleckenstein03](https://github.com/EliasFleckenstein03): End crystals, enchanting, burning mobs / players, animated chests, bugfixes
* epCode: Better player animations, new logo
* 2mac: Fix bug with powered rail
* Lots of other people: TO BE WRITTEN (see mod directories for details)
@ -255,7 +255,7 @@ Various sources. See the respective mod directories for details.
* davedevils for starting MineClone, the original version of this game
* Wuzzy for starting and maintaining MineClone2 for several years
* celeron55 for creating Minetest
* Minetest's modding community for providing a huge selection of mods, some of which ended up in MineClone 2
* Minetest's modding community for providing a huge selection of mods, some of which ended up in Mineclonia
* Jordach for the jukebox music compilation from Big Freaking Dig
* The workaholics who spent way too much time writing for the Minecraft Wiki. It's an invaluable resource for creating this game
* Notch and Jeb for being the major forces behind Minecraft
@ -273,10 +273,9 @@ Copying is an act of love. Please copy and share! <3
Here's the detailed legalese for those who need it:
### License of source code
MineClone 2 (by kay27, EliasFleckenstein, Wuzzy, davedevils and countless others)
is an imitation of Minecraft.
Mineclonia is an imitation of Minecraft.
MineClone 2 is free software: you can redistribute it and/or modify
Mineclonia is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
@ -290,15 +289,15 @@ details.
In the mods you might find in the read-me or license
text files a different license. This counts as dual-licensing.
You can choose which license applies to you: Either the
license of MineClone 2 (GNU GPLv3) or the mod's license.
license of Mineclonia (GNU GPLv3) or the mod's license.
MineClone 2 is a direct continuation of the discontinued MineClone
project by davedevils.
Mineclonia is a continuation of the discontinued MineClone project by davedevils
and the MineClone2 project by Wuzzy.
Mod credits:
See `README.txt` or `README.md` in each mod directory for information about other authors.
For mods that do not have such a file, the license is the source code license
of MineClone 2 and the author is Wuzzy.
of Mineclonia and the author is Wuzzy.
### License of media (textures and sounds)
No non-free licenses are used anywhere.

View File

@ -1,2 +1,2 @@
name = MineClone 2
name = Mineclonia
description = A survival sandbox game. Survive, gather, hunt, build, explore, and do much more.

View File

@ -4,6 +4,11 @@ Specifically, this mod has 2 purposes:
1) Automatically adding the group “solid” for blocks considered “solid” in Minecraft.
2) Generating digging time group for all nodes based on node metadata (it's complicated)
This mod also requires another mod called “mcl_autogroup” to function properly.
“mcl_autogroup” exposes the API used to register digging groups, while this mod
uses those digging groups to set the digging time groups for all the nodes and
tools.
See init.lua for more infos.
The leading underscore in the name “_mcl_autogroup” was added to force Minetest to load this mod as late as possible.

View File

@ -1 +0,0 @@
MineClone 2 core mod which automatically adds groups to all items. Very important for digging times.

View File

@ -1,169 +1,361 @@
--[[ Mining times. Yeah, mining times … Alright, this is going to be FUN!
--[[
This mod implements a HACK to make 100% sure the digging times of all tools
match Minecraft's perfectly. The digging times system of Minetest is very
different, so this weird group trickery has to be used. In Minecraft, each
block has a hardness and the actual Minecraft digging time is determined by
this:
This mod does include a HACK to make 100% sure the digging times of all tools match Minecraft's perfectly.
The digging times system of Minetest is very different, so this weird group trickery has to be used.
In Minecraft, each block has a hardness and the actual Minecraft digging time is determined by this:
1) The block's hardness
2) The tool being used
3) Whether the tool is considered as eligible for the block
2) The tool being used (the tool speed and its efficiency level)
3) Whether the tool is considered as "eligible" for the block
(e.g. only diamond pick eligible for obsidian)
See Minecraft Wiki <http://minecraft.gamepedia.com/Minecraft_Wiki> for more information.
In MineClone 2, all diggable node have the hardness set in the custom field _mcl_hardness (0 by default).
The nodes are also required to specify the eligible tools in groups like pickaxey, shovely, etc.
This mod then calculates the real digging time based on the node meta data. The real digging times
are then added into mcl_autogroup.digtimes where the table indices are group rating and the values are the
digging times in seconds. These digging times can be then added verbatim into the tool definitions.
See Minecraft Wiki <http://minecraft.gamepedia.com/Minecraft_Wiki> for more
information.
Example:
mcl_autogroup.digtimes.pickaxey_dig_diamond[1] = 0.2
How the mod is used
===================
This means that when a node has been assigned the group pickaxey_dig_diamond=1, it can be dug by the
diamond pickaxe in 0.2 seconds.
In MineClone 2, all diggable nodes have the hardness set in the custom field
"_mcl_hardness" (0 by default). These values are used together with digging
groups by this mod to create the correct digging times for nodes. Digging
groups are registered using the following code:
mcl_autogroup.register_diggroup("shovely")
mcl_autogroup.register_diggroup("pickaxey", {
levels = { "wood", "gold", "stone", "iron", "diamond" }
})
The first line registers a simple digging group. The second line registers a
digging group with 5 different levels (in this case one for each material of a
pickaxes).
This strange setup with mcl_autogroup has been done to minimize the amount of required digging times
a single tool needs to use. If this is not being done, the loading time will increase considerably
(>10s).
Nodes indicate that they belong to a particular digging group by being member of
the digging group in their node definition. "mcl_core:dirt" for example has
shovely=1 in its groups. If the digging group has multiple levels the value of
the group indicates which digging level the node requires.
"mcl_core:stone_with_gold" for example has pickaxey=4 because it requires a
pickaxe of level 4 be mined.
]]
For tools to be able to dig nodes of digging groups they need to use the have
the custom field "_mcl_diggroups" function to get the groupcaps. The value of
this field is a table which defines which groups the tool can dig and how
efficiently.
local materials = { "wood", "gold", "stone", "iron", "diamond" }
local basegroups = { "pickaxey", "axey", "shovely" }
local minigroups = { "handy", "shearsy", "swordy", "shearsy_wool", "swordy_cobweb" }
local divisors = {
["wood"] = 2,
["gold"] = 12,
["stone"] = 4,
["iron"] = 6,
["diamond"] = 8,
["handy"] = 1,
["shearsy"] = 15,
["swordy"] = 1.5,
["shearsy_wool"] = 5,
["swordy_cobweb"] = 15,
}
local max_efficiency_level = 5
_mcl_diggroups = {
handy = { speed = 1, level = 1, uses = 0 },
pickaxey = { speed = 1, level = 0, uses = 0 },
}
mcl_autogroup = {}
mcl_autogroup.digtimes = {}
mcl_autogroup.creativetimes = {} -- Copy of digtimes, except that all values are 0. Used for creative mode
The "uses" field indicate how many uses (0 for infinite) a tool has when used on
the specified digging group. The "speed" field is a multiplier to the dig speed
on that digging group.
for m=1, #materials do
for g=1, #basegroups do
mcl_autogroup.digtimes[basegroups[g].."_dig_"..materials[m]] = {}
mcl_autogroup.creativetimes[basegroups[g].."_dig_"..materials[m]] = {}
for e=1, max_efficiency_level do
mcl_autogroup.digtimes[basegroups[g].."_dig_"..materials[m].."_efficiency_"..e] = {}
The "level" field indicates which levels of the group the tool can harvest. A
level of 0 means that the tool cannot harvest blocks of that node. A level of 1
or above means that the tool can harvest nodes with that level or below. See
"mcl_tools/init.lua" for examples on how "_mcl_diggroups" is used in practice.
Information about the mod
=========================
The mod is split up into two parts, mcl_autogroup and _mcl_autogroup.
mcl_autogroup contains the API functions used to register custom digging groups.
_mcl_autogroup contains most of the code. The leading underscore in the name
"_mcl_autogroup" is used to force Minetest to load that part of the mod as late
as possible. Minetest loads mods in reverse alphabetical order.
This also means that it is very important that no mod adds _mcl_autogroup as a
dependency.
--]]
assert(minetest.get_modpath("mcl_autogroup"), "This mod requires the mod mcl_autogroup to function")
-- Returns a table containing the unique "_mcl_hardness" for nodes belonging to
-- each diggroup.
local function get_hardness_values_for_groups()
local maps = {}
local values = {}
for g, _ in pairs(mcl_autogroup.registered_diggroups) do
maps[g] = {}
values[g] = {}
end
for _, ndef in pairs(minetest.registered_nodes) do
for g, _ in pairs(mcl_autogroup.registered_diggroups) do
if ndef.groups[g] ~= nil then
maps[g][ndef._mcl_hardness or 0] = true
end
end
end
for g, map in pairs(maps) do
for k, _ in pairs(map) do
table.insert(values[g], k)
end
end
for g, _ in pairs(mcl_autogroup.registered_diggroups) do
table.sort(values[g])
end
return values
end
-- Returns a table containing a table indexed by "_mcl_hardness_value" to get
-- its index in the list of unique hardnesses for each diggroup.
local function get_hardness_lookup_for_groups(hardness_values)
local map = {}
for g, values in pairs(hardness_values) do
map[g] = {}
for k, v in pairs(values) do
map[g][v] = k
end
end
return map
end
-- Array of unique hardness values for each group which affects dig time.
local hardness_values = get_hardness_values_for_groups()
-- Map indexed by hardness values which return the index of that value in
-- hardness_value. Used for quick lookup.
local hardness_lookup = get_hardness_lookup_for_groups(hardness_values)
local function compute_creativetimes(group)
local creativetimes = {}
for index, hardness in pairs(hardness_values[group]) do
table.insert(creativetimes, 0)
end
return creativetimes
end
-- Get the list of digging times for using a specific tool on a specific
-- diggroup.
--
-- Parameters:
-- group - the group which it is digging
-- can_harvest - if the tool can harvest the block
-- speed - dig speed multiplier for tool (default 1)
-- efficiency - efficiency level for the tool if applicable
local function get_digtimes(group, can_harvest, speed, efficiency)
local speed = speed or 1
if efficiency then
speed = speed + efficiency * efficiency + 1
end
local digtimes = {}
for index, hardness in pairs(hardness_values[group]) do
local digtime = (hardness or 0) / speed
if can_harvest then
digtime = digtime * 1.5
else
digtime = digtime * 5
end
if digtime <= 0.05 then
digtime = 0
else
digtime = math.ceil(digtime * 20) / 20
end
table.insert(digtimes, digtime)
end
return digtimes
end
-- Get one groupcap field for using a specific tool on a specific group.
local function get_groupcap(group, can_harvest, multiplier, efficiency, uses)
return {
times = get_digtimes(group, can_harvest, multiplier, efficiency),
uses = uses,
maxlevel = 0,
}
end
-- Add the groupcaps from a field in "_mcl_diggroups" to the groupcaps of a
-- tool.
local function add_groupcaps(toolname, groupcaps, groupcaps_def, efficiency)
if not groupcaps_def then
return
end
for g, capsdef in pairs(groupcaps_def) do
local mult = capsdef.speed or 1
local uses = capsdef.uses
local def = mcl_autogroup.registered_diggroups[g]
local max_level = def.levels and #def.levels or 1
assert(capsdef.level, toolname .. ' is missing level for ' .. g)
local level = math.min(capsdef.level, max_level)
if def.levels then
groupcaps[g .. "_dig_default"] = get_groupcap(g, false, mult, efficiency, uses)
if level > 0 then
groupcaps[g .. "_dig_" .. def.levels[level]] = get_groupcap(g, true, mult, efficiency, uses)
end
else
groupcaps[g .. "_dig"] = get_groupcap(g, level > 0, mult, efficiency, uses)
end
end
end
for g=1, #minigroups do
mcl_autogroup.digtimes[minigroups[g].."_dig"] = {}
mcl_autogroup.creativetimes[minigroups[g].."_dig"] = {}
for e=1, max_efficiency_level do
mcl_autogroup.digtimes[minigroups[g].."_dig_efficiency_"..e] = {}
mcl_autogroup.creativetimes[minigroups[g].."_dig_efficiency_"..e] = {}
-- Checks if the given node would drop its useful drop if dug by a given tool.
-- Returns true if it will yield its useful drop, false otherwise.
function mcl_autogroup.can_harvest(nodename, toolname)
local ndef = minetest.registered_nodes[nodename]
if minetest.get_item_group(nodename, "dig_immediate") >= 2 then
return true
end
-- Check if it can be dug by tool
local tdef = minetest.registered_tools[toolname]
if tdef and tdef._mcl_diggroups then
for g, gdef in pairs(tdef._mcl_diggroups) do
if ndef.groups[g] then
if ndef.groups[g] <= gdef.level then
return true
end
end
end
end
-- Check if it can be dug by hand
local tdef = minetest.registered_tools[""]
if tdef then
for g, gdef in pairs(tdef._mcl_diggroups) do
if ndef.groups[g] then
if ndef.groups[g] <= gdef.level then
return true
end
end
end
end
return false
end
-- Get one groupcap field for using a specific tool on a specific group.
local function get_groupcap(group, can_harvest, multiplier, efficiency, uses)
return {
times = get_digtimes(group, can_harvest, multiplier, efficiency),
uses = uses,
maxlevel = 0,
}
end
-- Returns the tool_capabilities from a tool definition or a default set of
-- tool_capabilities
local function get_tool_capabilities(tdef)
if tdef.tool_capabilities then
return tdef.tool_capabilities
end
-- If the damage group and punch interval from hand is not included,
-- then the user will not be able to attack with the tool.
local hand_toolcaps = minetest.registered_tools[""].tool_capabilities
return {
full_punch_interval = hand_toolcaps.full_punch_interval,
damage_groups = hand_toolcaps.damage_groups
}
end
-- Get the groupcaps for a tool. This function returns "groupcaps" table of
-- digging which should be put in the "tool_capabilities" of the tool definition
-- or in the metadata of an enchanted tool.
--
-- Parameters:
-- toolname - Name of the tool being enchanted (like "mcl_tools:diamond_pickaxe")
-- efficiency - The efficiency level the tool is enchanted with (default 0)
--
-- NOTE:
-- This function can only be called after mod initialization. Otherwise a mod
-- would have to add _mcl_autogroup as a dependency which would break the mod
-- loading order.
function mcl_autogroup.get_groupcaps(toolname, efficiency)
local tdef = minetest.registered_tools[toolname]
local groupcaps = table.copy(get_tool_capabilities(tdef).groupcaps or {})
add_groupcaps(toolname, groupcaps, tdef._mcl_diggroups, efficiency)
return groupcaps
end
-- Get the wear from using a tool on a digging group.
--
-- Parameters
-- toolname - Name of the tool used
-- diggroup - The name of the diggroup the tool is used on
--
-- NOTE:
-- This function can only be called after mod initialization. Otherwise a mod
-- would have to add _mcl_autogroup as a dependency which would break the mod
-- loading order.
function mcl_autogroup.get_wear(toolname, diggroup)
local tdef = minetest.registered_tools[toolname]
local uses = tdef._mcl_diggroups[diggroup].uses
return math.ceil(65535 / uses)
end
local overwrite = function()
for nname, ndef in pairs(minetest.registered_nodes) do
local groups_changed = false
local newgroups = table.copy(ndef.groups)
if (nname ~= "ignore" and ndef.diggable) then
-- Automatically assign the “solid” group for solid nodes
-- Automatically assign the "solid" group for solid nodes
if (ndef.walkable == nil or ndef.walkable == true)
and (ndef.collision_box == nil or ndef.collision_box.type == "regular")
and (ndef.node_box == nil or ndef.node_box.type == "regular")
and (ndef.groups.not_solid == 0 or ndef.groups.not_solid == nil) then
newgroups.solid = 1
groups_changed = true
end
-- Automatically assign the “opaque” group for opaque nodes
-- Automatically assign the "opaque" group for opaque nodes
if (not (ndef.paramtype == "light" or ndef.sunlight_propagates)) and
(ndef.groups.not_opaque == 0 or ndef.groups.not_opaque == nil) then
newgroups.opaque = 1
groups_changed = true
end
local function calculate_group(hardness, material, diggroup, newgroups, actual_rating, expected_rating, efficiency)
local time, validity_factor
if actual_rating >= expected_rating then
-- Valid tool
validity_factor = 1.5
else
-- Wrong tool (higher digging time)
validity_factor = 5
end
local speed_multiplier = divisors[material]
if efficiency then
speed_multiplier = speed_multiplier + efficiency * efficiency + 1
end
time = (hardness * validity_factor) / speed_multiplier
if time <= 0.05 then
time = 0
else
time = math.ceil(time * 20) / 20
end
table.insert(mcl_autogroup.digtimes[diggroup], time)
if not efficiency then
table.insert(mcl_autogroup.creativetimes[diggroup], 0)
end
newgroups[diggroup] = #mcl_autogroup.digtimes[diggroup]
return newgroups
end
local creative_breakable = false
-- Hack in digging times
local hardness = ndef._mcl_hardness
if not hardness then
hardness = 0
end
-- Assign groups used for digging this node depending on
-- the registered digging groups
for g, gdef in pairs(mcl_autogroup.registered_diggroups) do
creative_breakable = true
local index = hardness_lookup[g][ndef._mcl_hardness or 0]
if ndef.groups[g] then
if gdef.levels then
newgroups[g .. "_dig_default"] = index
-- Handle pickaxey, axey and shovely
for _, basegroup in pairs(basegroups) do
if (hardness ~= -1 and ndef.groups[basegroup]) then
for g=1,#materials do
local diggroup = basegroup.."_dig_"..materials[g]
newgroups = calculate_group(hardness, materials[g], diggroup, newgroups, g, ndef.groups[basegroup])
for e=1,max_efficiency_level do
newgroups = calculate_group(hardness, materials[g], diggroup .. "_efficiency_" .. e, newgroups, g, ndef.groups[basegroup], e)
for i = ndef.groups[g], #gdef.levels do
newgroups[g .. "_dig_" .. gdef.levels[i]] = index
end
groups_changed = true
end
end
end
for m=1, #minigroups do
local minigroup = minigroups[m]
if hardness ~= -1 then
local diggroup = minigroup.."_dig"
-- actual rating
local ar = ndef.groups[minigroup]
if ar == nil then
ar = 0
end
if (minigroup == "handy")
or
(ndef.groups.shearsy_wool and minigroup == "shearsy_wool" and ndef.groups.wool)
or
(ndef.groups.swordy_cobweb and minigroup == "swordy_cobweb" and nname == "mcl_core:cobweb")
or
(ndef.groups[minigroup] and minigroup ~= "swordy_cobweb" and minigroup ~= "shearsy_wool") then
newgroups = calculate_group(hardness, minigroup, diggroup, newgroups, ar, 1)
for e=1,max_efficiency_level do
newgroups = calculate_group(hardness, minigroup, diggroup .. "_efficiency_" .. e, newgroups, ar, 1, e)
end
groups_changed = true
else
newgroups[g .. "_dig"] = index
end
end
end
if groups_changed then
minetest.override_item(nname, {
groups = newgroups
})
end
-- Automatically assign the node to the
-- creative_breakable group if it belongs to any digging
-- group.
newgroups["creative_breakable"] = 1
minetest.override_item(nname, {
groups = newgroups
})
end
end
for tname, tdef in pairs(minetest.registered_tools) do
-- Assign groupcaps for digging the registered digging groups
-- depending on the _mcl_diggroups in the tool definition
if tdef._mcl_diggroups then
local toolcaps = table.copy(get_tool_capabilities(tdef))
toolcaps.groupcaps = mcl_autogroup.get_groupcaps(tname)
minetest.override_item(tname, {
tool_capabilities = toolcaps
})
end
end
end

View File

@ -1 +1,3 @@
name = _mcl_autogroup
author = ryvnf
description = MineClone 2 core mod which automatically adds groups to all items. Very important for digging times.

View File

@ -0,0 +1,28 @@
--[[
This is one part of a mod to replicate the digging times from Minecraft. This
part only exposes a function to register digging groups. The rest of the mod is
implemented and documented in the _mcl_autogroup.
The mod is split up into two parts, mcl_autogroup and _mcl_autogroup.
mcl_autogroup contains the API functions used to register custom digging groups.
_mcl_autogroup contains most of the code. The leading underscore in the name
"_mcl_autogroup" is used to force Minetest to load that part of the mod as late
as possible. Minetest loads mods in reverse alphabetical order.
--]]
mcl_autogroup = {}
mcl_autogroup.registered_diggroups = {}
assert(minetest.get_modpath("_mcl_autogroup"), "This mod requires the mod _mcl_autogroup to function")
-- Register a group as a digging group.
--
-- Parameters:
-- group - Name of the group to register as a digging group
-- def - Table with information about the diggroup (defaults to {} if unspecified)
--
-- Values in def:
-- level - If specified it is an array containing the names of the different
-- digging levels the digging group supports.
function mcl_autogroup.register_diggroup(group, def)
mcl_autogroup.registered_diggroups[group] = def or {}
end

View File

@ -0,0 +1,3 @@
name = mcl_autogroup
author = ryvnf
description = MineClone 2 core mod which automatically adds groups to all items. Very important for digging times.

View File

@ -57,46 +57,44 @@ local function compute_sphere_rays(radius)
local rays = {}
local sphere = {}
for i=1, 2 do
local function add_ray(pos)
sphere[minetest.hash_node_position(pos)] = pos
end
for y = -radius, radius do
for z = -radius, radius do
for x = -radius, 0 do
local d = x * x + y * y + z * z
if d <= radius * radius then
add_ray(vector.new(x, y, z))
add_ray(vector.new(-x, y, z))
break
end
end
end
end
for x = -radius, radius do
for z = -radius, radius do
for y = -radius, 0 do
local d = x * x + y * y + z * z
if d <= radius * radius then
add_ray(vector.new(x, y, z))
add_ray(vector.new(x, -y, z))
break
end
end
end
end
for x = -radius, radius do
for y = -radius, radius do
for z = -radius, radius do
for x = -radius, 0, 1 do
local d = x * x + y * y + z * z
if d <= radius * radius then
local pos = { x = x, y = y, z = z }
sphere[minetest.hash_node_position(pos)] = pos
break
end
end
end
end
end
for i=1,2 do
for x = -radius, radius do
for z = -radius, radius do
for y = -radius, 0, 1 do
local d = x * x + y * y + z * z
if d <= radius * radius then
local pos = { x = x, y = y, z = z }
sphere[minetest.hash_node_position(pos)] = pos
break
end
end
end
end
end
for i=1,2 do
for x = -radius, radius do
for y = -radius, radius do
for z = -radius, 0, 1 do
local d = x * x + y * y + z * z
if d <= radius * radius then
local pos = { x = x, y = y, z = z }
sphere[minetest.hash_node_position(pos)] = pos
break
end
for z = -radius, 0 do
local d = x * x + y * y + z * z
if d <= radius * radius then
add_ray(vector.new(x, y, z))
add_ray(vector.new(x, y, -z))
break
end
end
end
@ -202,7 +200,10 @@ local function trace_explode(pos, strength, raydirs, radius, info, puncher)
npos_x - emin_x + 1
local cid = data[idx]
local br = node_blastres[cid]
-- Set blast resistance to 0 for unknown nodes
local br = node_blastres[cid] or 0
if br < INDESTRUCT_BLASTRES and br > max_blast_resistance then
br = max_blast_resistance
end
@ -250,12 +251,12 @@ local function trace_explode(pos, strength, raydirs, radius, info, puncher)
if collisionbox then
-- Create rays from random points in the collision box
local x1 = collisionbox[1] * 2
local y1 = collisionbox[2] * 2
local z1 = collisionbox[3] * 2
local x2 = collisionbox[4] * 2
local y2 = collisionbox[5] * 2
local z2 = collisionbox[6] * 2
local x1 = collisionbox[1]
local y1 = collisionbox[2]
local z1 = collisionbox[3]
local x2 = collisionbox[4]
local y2 = collisionbox[5]
local z2 = collisionbox[6]
local x_len = math.abs(x2 - x1)
local y_len = math.abs(y2 - y1)
local z_len = math.abs(z2 - z1)

View File

@ -165,66 +165,6 @@ minetest.register_globalstep(function(dtime)
end
end)
local minigroups = { "shearsy", "swordy", "shearsy_wool", "swordy_cobweb" }
local basegroups = { "pickaxey", "axey", "shovely" }
local materials = { "wood", "gold", "stone", "iron", "diamond" }
-- Checks if the given node would drop its useful drop if dug by a tool
-- with the given tool capabilities. Returns true if it will yield its useful
-- drop, false otherwise.
local check_can_drop = function(node_name, tool_capabilities)
local handy = minetest.get_item_group(node_name, "handy")
local dig_immediate = minetest.get_item_group(node_name, "dig_immediate")
if handy == 1 or dig_immediate == 2 or dig_immediate == 3 then
return true
else
local toolgroupcaps
if tool_capabilities then
toolgroupcaps = tool_capabilities.groupcaps
else
return false
end
-- Compare node groups with tool capabilities
for m=1, #minigroups do
local minigroup = minigroups[m]
local g = minetest.get_item_group(node_name, minigroup)
if g ~= 0 then
local plus = minigroup .. "_dig"
if toolgroupcaps[plus] then
return true
end
for e=1,5 do
local effplus = plus .. "_efficiency_" .. e
if toolgroupcaps[effplus] then
return true
end
end
end
end
for b=1, #basegroups do
local basegroup = basegroups[b]
local g = minetest.get_item_group(node_name, basegroup)
if g ~= 0 then
for m=g, #materials do
local plus = basegroup .. "_dig_"..materials[m]
if toolgroupcaps[plus] then
return true
end
for e=1,5 do
local effplus = plus .. "_efficiency_" .. e
if toolgroupcaps[effplus] then
return true
end
end
end
end
end
return false
end
end
-- Stupid workaround to get drops from a drop table:
-- Create a temporary table in minetest.registered_nodes that contains the proper drops,
-- because unfortunately minetest.get_node_drops needs the drop table to be inside a registered node definition
@ -281,17 +221,20 @@ function minetest.handle_node_drops(pos, drops, digger)
-- Check if node will yield its useful drop by the digger's tool
local dug_node = minetest.get_node(pos)
local toolcaps
local tooldef
local tool
if digger ~= nil then
tool = digger:get_wielded_item()
toolcaps = tool:get_tool_capabilities()
tooldef = minetest.registered_tools[tool:get_name()]
if not check_can_drop(dug_node.name, toolcaps) then
if not mcl_autogroup.can_harvest(dug_node.name, tool:get_name()) then
return
end
end
local diggroups = tooldef and tooldef._mcl_diggroups
local shearsy_level = diggroups and diggroups.shearsy and diggroups.shearsy.level
--[[ Special node drops when dug by shears by reading _mcl_shears_drop or with a silk touch tool reading _mcl_silk_touch_drop
from the node definition.
Definition of _mcl_shears_drop / _mcl_silk_touch_drop:
@ -303,7 +246,7 @@ function minetest.handle_node_drops(pos, drops, digger)
local silk_touch_drop = false
local nodedef = minetest.registered_nodes[dug_node.name]
if toolcaps ~= nil and toolcaps.groupcaps and toolcaps.groupcaps.shearsy_dig and nodedef._mcl_shears_drop then
if shearsy_level and shearsy_level > 0 and nodedef._mcl_shears_drop then
if nodedef._mcl_shears_drop == true then
drops = { dug_node.name }
else

View File

@ -12,14 +12,15 @@ local function detach_driver(self)
if not self._driver then
return
end
if self._driver:is_player() then
mcl_player.player_attached[self._driver:get_player_name()] = nil
self._driver:set_detach()
self._driver:set_eye_offset({x=0, y=0, z=0},{x=0, y=0, z=0})
mcl_player.player_set_animation(self._driver, "stand" , 30)
end
mcl_player.player_attached[self._driver] = nil
local player = minetest.get_player_by_name(self._driver)
self._driver = nil
self._start_pos = nil
if player then
player:set_detach()
player:set_eye_offset({x=0, y=0, z=0},{x=0, y=0, z=0})
mcl_player.player_set_animation(player, "stand" , 30)
end
end
local function activate_tnt_minecart(self, timer)
@ -61,7 +62,7 @@ local function register_entity(entity_id, mesh, textures, drop, on_rightclick, o
on_rightclick = on_rightclick,
_driver = nil, -- player (or mob) who sits in and controls the minecart (only for minecart!)
_driver = nil, -- player who sits in and controls the minecart (only for minecart!)
_punched = false, -- used to re-send _velocity and position
_velocity = {x=0, y=0, z=0}, -- only used on punch
_start_pos = nil, -- Used to calculate distance for “On A Rail” achievement
@ -96,101 +97,111 @@ local function register_entity(entity_id, mesh, textures, drop, on_rightclick, o
end
function cart:on_punch(puncher, time_from_last_punch, tool_capabilities, direction)
-- Punch: Pick up minecart (unless TNT was ignited)
if self._boomtimer then return end
if self._driver then
detach_driver(self)
end
local pos = self.object:get_pos()
-- Disable detector rail
local rou_pos = vector.round(pos)
local node = minetest.get_node(rou_pos)
if node.name == "mcl_minecarts:detector_rail_on" then
local newnode = {name="mcl_minecarts:detector_rail", param2 = node.param2}
minetest.swap_node(rou_pos, newnode)
mesecon.receptor_off(rou_pos)
if not self._railtype then
local node = minetest.get_node(vector.floor(pos)).name
self._railtype = minetest.get_item_group(node, "connect_to_raillike")
end
-- Drop items and remove cart entity
if not minetest.is_creative_enabled(puncher:get_player_name()) then
for d=1, #drop do
minetest.add_item(self.object:get_pos(), drop[d])
if not puncher or not puncher:is_player() then
local cart_dir = mcl_minecarts:get_rail_direction(pos, {x=1, y=0, z=0}, nil, nil, self._railtype)
if vector.equals(cart_dir, {x=0, y=0, z=0}) then
return
end
elseif puncher and puncher:is_player() then
local inv = puncher:get_inventory()
for d=1, #drop do
if not inv:contains_item("main", drop[d]) then
inv:add_item("main", drop[d])
self._velocity = vector.multiply(cart_dir, 3)
self._old_pos = nil
self._punched = true
return
end
-- Punch+sneak: Pick up minecart (unless TNT was ignited)
if puncher:get_player_control().sneak and not self._boomtimer then
if self._driver then
if self._old_pos then
self.object:set_pos(self._old_pos)
end
detach_driver(self)
end
-- Disable detector rail
local rou_pos = vector.round(pos)
local node = minetest.get_node(rou_pos)
if node.name == "mcl_minecarts:detector_rail_on" then
local newnode = {name="mcl_minecarts:detector_rail", param2 = node.param2}
minetest.swap_node(rou_pos, newnode)
mesecon.receptor_off(rou_pos)
end
-- Drop items and remove cart entity
if not minetest.is_creative_enabled(puncher:get_player_name()) then
for d=1, #drop do
minetest.add_item(self.object:get_pos(), drop[d])
end
elseif puncher and puncher:is_player() then
local inv = puncher:get_inventory()
for d=1, #drop do
if not inv:contains_item("main", drop[d]) then
inv:add_item("main", drop[d])
end
end
end
self.object:remove()
return
end
self.object:remove()
local vel = self.object:get_velocity()
if puncher:get_player_name() == self._driver then
if math.abs(vel.x + vel.z) > 7 then
return
end
end
local punch_dir = mcl_minecarts:velocity_to_dir(puncher:get_look_dir())
punch_dir.y = 0
local cart_dir = mcl_minecarts:get_rail_direction(pos, punch_dir, nil, nil, self._railtype)
if vector.equals(cart_dir, {x=0, y=0, z=0}) then
return
end
time_from_last_punch = math.min(time_from_last_punch, tool_capabilities.full_punch_interval)
local f = 3 * (time_from_last_punch / tool_capabilities.full_punch_interval)
self._velocity = vector.multiply(cart_dir, f)
self._old_pos = nil
self._punched = true
end
cart.on_activate_by_rail = on_activate_by_rail
function cart:on_step(dtime)
local ctrl, player = nil, nil
local update = {}
local vel = self.object:get_velocity()
local pos, rou_pos, node
pos = self.object:get_pos()
rou_pos = vector.round(pos)
node = minetest.get_node(rou_pos)
local g = minetest.get_item_group(node.name, "connect_to_raillike")
if self._driver and self._driver:is_player() then
player = self._driver
ctrl = player:get_player_control()
-- player detach
if ctrl.sneak then
detach_driver(self)
return
end
if g == self._railtype then
if ctrl.right then
local c = vector.multiply(minetest.yaw_to_dir(self._driver:get_look_horizontal()-1.57), 0.2)
self.object:set_velocity(vector.add(vel, {x=c.x, y=0, z=c.z}))
end
if ctrl.left then
local c = vector.multiply(minetest.yaw_to_dir(self._driver:get_look_horizontal()+1.57), 0.2)
self.object:set_velocity(vector.add(vel, {x=c.x, y=0, z=c.z}))
end
if ctrl.up then
local c = vector.multiply(self._driver:get_look_dir(), 0.2)
self.object:set_velocity(vector.add(vel, {x=c.x, y=0, z=c.z}))
end
if ctrl.down then
local c = vector.multiply(self._driver:get_look_dir(), 0.2)
self.object:set_velocity(vector.subtract(vel, {x=c.x, y=0, z=c.z}))
if self._driver then
player = minetest.get_player_by_name(self._driver)
if player then
ctrl = player:get_player_control()
-- player detach
if ctrl.sneak then
detach_driver(self)
return
end
end
end
local vel = self.object:get_velocity()
local update = {}
if self._last_float_check == nil then
self._last_float_check = 0
else
self._last_float_check = self._last_float_check + dtime
end
local pos, rou_pos, node
-- Drop minecart if it isn't on a rail anymore
if self._last_float_check >= mcl_minecarts.check_float_time then
for _,object in pairs(minetest.get_objects_inside_radius(pos, 1.3)) do
if object ~= self.object then
local mob = object:get_luaentity()
if mob then mob = mob._cmi_is_mob == true end
if mob and (not self._driver) and not object:get_attach() then
self._driver = object
object:set_attach(self.object, "", {x=0, y=-1.75, z=-2}, {x=0, y=0, z=0})
mobs:set_animation(self.object, "stand")
return
end
end
end
pos = self.object:get_pos()
rou_pos = vector.round(pos)
node = minetest.get_node(rou_pos)
local g = minetest.get_item_group(node.name, "connect_to_raillike")
if g ~= self._railtype and self._railtype ~= nil then
-- Detach driver
if player then
@ -289,12 +300,8 @@ local function register_entity(entity_id, mesh, textures, drop, on_rightclick, o
end
end
if update.vel then
if self._punched then
vel = vector.add(vel, self._velocity)
if vel.x>8 then vel.x = 8 end
if vel.x<-8 then vel.x = -8 end
if vel.z>8 then vel.z = 8 end
if vel.z<-8 then vel.z = -8 end
self.object:set_velocity(vel)
self._old_dir.y = 0
elseif vector.equals(vel, {x=0, y=0, z=0}) and (not has_fuel) then
@ -619,14 +626,17 @@ register_minecart(
"mcl_minecarts_minecart_normal.png",
{"mcl_minecarts:minecart"},
function(self, clicker)
if not clicker or not clicker:is_player() then return end
if clicker == self._driver then
local name = clicker:get_player_name()
if not clicker or not clicker:is_player() then
return
end
local player_name = clicker:get_player_name()
if self._driver and player_name == self._driver then
detach_driver(self)
else
local name = clicker:get_player_name()
self._driver = clicker
elseif not self._driver then
self._driver = player_name
self._start_pos = self.object:get_pos()
mcl_player.player_attached[name] = true
mcl_player.player_attached[player_name] = true
clicker:set_attach(self.object, "", {x=0, y=-1.75, z=-2}, {x=0, y=0, z=0})
mcl_player.player_attached[name] = true
minetest.after(0.2, function(name)
@ -637,7 +647,6 @@ register_minecart(
mcl_tmp_message.message(clicker, S("Sneak to dismount"))
end
end, name)
clicker:set_look_horizontal(self.object:get_yaw())
end
end, activate_normal_minecart
)

View File

@ -28,6 +28,7 @@ Pig=Schwein
Polar Bear=Eisbär
Rabbit=Kaninchen
Killer Bunny=Killerkaninchen
The Killer Bunny=Das Killerkaninchen
Sheep=Schaf
Shulker=Shulker
Silverfish=Silberfischchen

View File

@ -28,6 +28,7 @@ Pig=Cerdo
Polar Bear=Oso polar
Rabbit=Conejo
Killer Bunny=Conejo asesino
The Killer Bunny=El Conejo asesino
Sheep=Oveja
Shulker=Shulker
Silverfish=Lepisma

View File

@ -28,6 +28,7 @@ Pig=Cochon
Polar Bear=Ours blanc
Rabbit=Lapin
Killer Bunny=Lapin tueur
The Killer Bunny=Le Lapin tueur
Sheep=Mouton
Shulker=Shulker
Silverfish=Poisson d'argent

View File

@ -28,6 +28,7 @@ Pig=Свинья
Polar Bear=Полярный медведь
Rabbit=Кролик
Killer Bunny=Кролик-убийца
The Killer Bunny=Кролик-убийца
Sheep=Овца
Shulker=Шалкер
Silverfish=Чешуйница

View File

@ -99,7 +99,7 @@ killer_bunny.on_rightclick = nil
killer_bunny.run_velocity = 6
killer_bunny.do_custom = function(self)
if not self._killer_bunny_nametag_set then
self.nametag = "The Killer Bunny"
self.nametag = S("The Killer Bunny")
self._killer_bunny_nametag_set = true
end
end

View File

@ -41,6 +41,9 @@ local msgs = {
["murder"] = {
N("@1 was slain by @2 using [@3]"),
},
["murder_by_named_mob"] = {
N("@1 was slain by @2."),
},
["murder_any"] = {
N("@1 was killed."),
},
@ -212,7 +215,7 @@ minetest.register_on_dieplayer(function(player, reason)
end
hittersubtype = hitter:get_luaentity().name
if hittername then
msg = dmsg("murder", name, hittername)
msg = dmsg("murder_by_named_mob", name, hittername)
elseif hittersubtype ~= nil and hittersubtype ~= "" then
msg = mmsg(hittersubtype, name)
else

View File

@ -35,6 +35,49 @@ mcl_banners.colors = {
["unicolor_light_blue"] = {"light_blue", S("Light Blue Banner"), "mcl_wool:light_blue", "#4040CF", "mcl_dye:lightblue", N("Light Blue") },
}
local pattern_names = {
"",
"border",
"bricks",
"circle",
"creeper",
"cross",
"curly_border",
"diagonal_up_left",
"diagonal_up_right",
"diagonal_right",
"diagonal_left",
"flower",
"gradient",
"gradient_up",
"half_horizontal_bottom",
"half_horizontal",
"half_vertical",
"half_vertical_right",
"thing",
"rhombus",
"skull",
"small_stripes",
"square_bottom_left",
"square_bottom_right",
"square_top_left",
"square_top_right",
"straight_cross",
"stripe_bottom",
"stripe_center",
"stripe_downleft",
"stripe_downright",
"stripe_left",
"stripe_middle",
"stripe_right",
"stripe_top",
"triangle_bottom",
"triangle_top",
"triangles_bottom",
"triangles_top",
}
local colors_reverse = {}
for k,v in pairs(mcl_banners.colors) do
colors_reverse["mcl_banners:banner_item_"..v[1]] = k
@ -300,24 +343,72 @@ minetest.register_node("mcl_banners:hanging_banner", {
end,
})
-- for pattern_name, pattern in pairs(patterns) do
for colorid, colortab in pairs(mcl_banners.colors) do
for i, pattern_name in ipairs(pattern_names) do
local itemid = colortab[1]
local desc = colortab[2]
local wool = colortab[3]
local colorize = colortab[4]
local itemstring = "mcl_banners:banner_item_"..itemid
local inv
if colorize then
inv = "mcl_banners_item_base.png^(mcl_banners_item_overlay.png^[colorize:"..colorize..")"
local itemstring
if pattern_name == "" then
itemstring = "mcl_banners:banner_item_" .. itemid
else
inv = "mcl_banners_item_base.png^mcl_banners_item_overlay.png"
itemstring = "mcl_banners:banner_preview" .. "_" .. pattern_name .. "_" .. itemid
end
local inv
local base
local finished_banner
if pattern_name == "" then
if colorize then
-- Base texture with base color
base = "mcl_banners_item_base.png^(mcl_banners_item_overlay.png^[colorize:"..colorize..")^[resize:32x32"
else
base = "mcl_banners_item_base.png^mcl_banners_item_overlay.png^[resize:32x32"
end
finished_banner = base
else
-- Banner item preview background
base = "mcl_banners_item_base.png^(mcl_banners_item_overlay.png^[colorize:#CCCCCC)^[resize:32x32"
desc = S("Preview Banner")
local pattern = "mcl_banners_" .. pattern_name .. ".png"
local color = colorize
-- Generate layer texture
-- TODO: The layer texture in the icon is squished
-- weirdly because the width/height aspect ratio of
-- the banner icon is 1:1.5, whereas the aspect ratio
-- of the banner entity is 1:2. A solution would be to
-- redraw the pattern textures as low-resolution pixel
-- art and use that instead.
local layer = "(([combine:20x40:-2,-2="..pattern.."^[resize:16x24^[colorize:"..color..":"..layer_ratio.."))"
function escape(text)
return text:gsub("%^", "\\%^"):gsub(":", "\\:") -- :gsub("%(", "\\%("):gsub("%)", "\\%)")
end
finished_banner = "[combine:32x32:0,0=" .. escape(base) .. ":8,4=" .. escape(layer)
end
inv = finished_banner
-- Banner items.
-- This is the player-visible banner item. It comes in 16 base colors.
-- This is the player-visible banner item. It comes in 16 base colors with a lot of patterns.
-- The multiple items are really only needed for the different item images.
-- TODO: Combine the items into only 1 item.
local groups
if pattern_name == "" then
groups = { banner = 1, deco_block = 1, flammable = -1 }
else
groups = { not_in_creative_inventory = 1 }
end
minetest.register_craftitem(itemstring, {
description = desc,
_tt_help = S("Paintable decoration"),
@ -326,7 +417,7 @@ for colorid, colortab in pairs(mcl_banners.colors) do
wield_image = inv,
-- Banner group groups together the banner items, but not the nodes.
-- Used for crafting.
groups = { banner = 1, deco_block = 1, flammable = -1 },
groups = groups,
stack_max = 16,
on_place = function(itemstack, placer, pointed_thing)
@ -477,7 +568,7 @@ for colorid, colortab in pairs(mcl_banners.colors) do
end,
})
if minetest.get_modpath("mcl_core") and minetest.get_modpath("mcl_wool") then
if minetest.get_modpath("mcl_core") and minetest.get_modpath("mcl_wool") and pattern_name == "" then
minetest.register_craft({
output = itemstring,
recipe = {
@ -492,6 +583,7 @@ for colorid, colortab in pairs(mcl_banners.colors) do
-- Add item to node alias
doc.add_entry_alias("nodes", "mcl_banners:standing_banner", "craftitems", itemstring)
end
end
end
if minetest.get_modpath("doc") then

View File

@ -253,6 +253,11 @@ for colorid, colortab in pairs(mcl_banners.colors) do
dye_to_colorid_mapping[colortab[5]] = colorid
end
local dye_to_itemid_mapping = {}
for colorid, colortab in pairs(mcl_banners.colors) do
dye_to_itemid_mapping[colortab[5]] = colortab[1]
end
-- Create a banner description containing all the layer names
mcl_banners.make_advanced_banner_description = function(description, layers)
if layers == nil or #layers == 0 then
@ -491,7 +496,14 @@ local banner_pattern_craft = function(itemstack, player, old_craft_grid, craft_i
imeta:set_string("description", ometa:get_string("description"))
imeta:set_string("name", mname)
end
return itemstack
if craft_predict then
local itemid_prefix = "mcl_banners:banner_preview"
local coloritemid = dye_to_itemid_mapping[dye]
return ItemStack(itemid_prefix .. "_" .. matching_pattern .. "_" .. coloritemid)
else
return itemstack
end
end
minetest.register_craft_predict(function(itemstack, player, old_craft_grid, craft_inv)

View File

@ -1,3 +1,4 @@
mcl_autogroup
mcl_init
mcl_sounds
mcl_particles

View File

@ -3,6 +3,18 @@ mcl_core = {}
-- Repair percentage for toolrepair
mcl_core.repair = 0.05
mcl_autogroup.register_diggroup("handy")
mcl_autogroup.register_diggroup("pickaxey", {
levels = { "wood", "gold", "stone", "iron", "diamond" }
})
mcl_autogroup.register_diggroup("axey")
mcl_autogroup.register_diggroup("shovely")
mcl_autogroup.register_diggroup("shearsy")
mcl_autogroup.register_diggroup("shearsy_wool")
mcl_autogroup.register_diggroup("shearsy_cobweb")
mcl_autogroup.register_diggroup("swordy")
mcl_autogroup.register_diggroup("swordy_cobweb")
-- Load files
local modpath = minetest.get_modpath("mcl_core")
dofile(modpath.."/functions.lua")

View File

@ -108,7 +108,7 @@ minetest.register_node("mcl_core:cobweb", {
liquid_renewable = false,
liquid_range = 0,
walkable = false,
groups = {swordy_cobweb=1,shearsy=1, fake_liquid=1, disable_jump=1, deco_block=1, dig_by_piston=1, dig_by_water=1,destroy_by_lava_flow=1,},
groups = {swordy_cobweb=1, shearsy_cobweb=1, fake_liquid=1, disable_jump=1, deco_block=1, dig_by_piston=1, dig_by_water=1,destroy_by_lava_flow=1,},
drop = "mcl_mobitems:string",
_mcl_shears_drop = true,
sounds = mcl_sounds.node_sound_leaves_defaults(),

View File

@ -155,15 +155,7 @@ mcl_enchanting.enchantments.efficiency = {
description = S("Increases mining speed."),
curse = false,
on_enchant = function(itemstack, level)
local tool_capabilities = itemstack:get_tool_capabilities()
local groupcaps = {}
for group, capability in pairs(tool_capabilities.groupcaps) do
local groupname = group .. "_efficiency_" .. level
capability.times = mcl_autogroup.digtimes[groupname]
groupcaps[groupname] = capability
end
tool_capabilities.groupcaps = groupcaps
itemstack:get_meta():set_tool_capabilities(tool_capabilities)
mcl_enchanting.update_groupcaps(itemstack)
end,
requires_tool = false,
treasure = false,
@ -778,12 +770,17 @@ mcl_enchanting.enchantments.unbreaking = {
description = S("Increases item durability."),
curse = false,
on_enchant = function(itemstack, level)
local tool_capabilities = itemstack:get_tool_capabilities()
for group, capability in pairs(tool_capabilities.groupcaps) do
capability.uses = capability.uses * (1 + level)
local name = itemstack:get_name()
if not minetest.registered_tools[name].tool_capabilities then
return
end
local tool_capabilities = itemstack:get_tool_capabilities()
tool_capabilities.punch_attack_uses = tool_capabilities.punch_attack_uses * (1 + level)
itemstack:get_meta():set_tool_capabilities(tool_capabilities)
-- Unbreaking for groupcaps is handled in this function.
mcl_enchanting.update_groupcaps(itemstack)
end,
requires_tool = true,
treasure = false,

View File

@ -12,11 +12,12 @@ end
function mcl_enchanting.unload_enchantments(itemstack)
local itemdef = itemstack:get_definition()
if itemdef.tool_capabilities then
itemstack:get_meta():set_tool_capabilities(itemdef.tool_capabilities)
itemstack:get_meta():set_tool_capabilities(nil)
end
local meta = itemstack:get_meta()
if meta:get_string("name") == "" then
meta:set_string("description", "")
meta:set_string("groupcaps_hash", "")
end
end
@ -219,6 +220,38 @@ function mcl_enchanting.enchantments_snippet(_, _, itemstack)
end
end
-- Returns the after_use callback function to use when registering an enchanted
-- item. The after_use callback is used to update the tool_capabilities of
-- efficiency enchanted tools with outdated digging times.
--
-- It does this by calling apply_efficiency to reapply the efficiency
-- enchantment. That function is written to use hash values to only update the
-- tool if neccessary.
--
-- This is neccessary for digging times of tools to be in sync when MineClone2
-- or mods add new hardness values.
local function get_after_use_callback(itemdef)
if itemdef.after_use then
-- If the tool already has an after_use, make sure to call that
-- one too.
return function(itemstack, user, node, digparams)
itemdef.after_use(itemstack, user, node, digparams)
mcl_enchanting.update_groupcaps(itemstack)
end
end
-- If the tool does not have after_use, add wear to the tool as if no
-- after_use was registered.
return function(itemstack, user, node, digparams)
if not minetest.is_creative_enabled(user) then
itemstack:add_wear(digparams.wear)
end
local enchantments = mcl_enchanting.get_enchantments(itemstack)
mcl_enchanting.update_groupcaps(itemstack)
end
end
function mcl_enchanting.initialize()
local register_tool_list = {}
local register_item_list = {}
@ -236,6 +269,7 @@ function mcl_enchanting.initialize()
new_def.groups.enchanted = 1
new_def.texture = itemdef.texture or itemname:gsub("%:", "_")
new_def._mcl_enchanting_enchanted_tool = new_name
new_def.after_use = get_after_use_callback(itemdef)
local register_list = register_item_list
if itemdef.type == "tool" then
register_list = register_tool_list

View File

@ -0,0 +1,75 @@
local groupcaps_cache = {}
-- Compute a hash value.
function compute_hash(value)
-- minetest.get_password_hash is quite fast, even if it uses a
-- cryptographic hashing function (SHA-1). It is written in C++ and it
-- is probably hard to write a faster hashing function in Lua.
return string.sub(minetest.get_password_hash("ryvnf", minetest.serialize(value)), 1, 8)
end
-- Get the groupcaps and hash for an enchanted tool. If this function is called
-- repeatedly with the same values it will return data from a cache.
--
-- Parameters:
-- toolname - Name of the tool
-- level - The efficiency level of the tool
--
-- Returns a table with the following two fields:
-- values - The groupcaps table
-- hash - The hash of the groupcaps table
local function get_efficiency_groupcaps(toolname, level)
local toolcache = groupcaps_cache[toolname]
local level = level
if not toolcache then
toolcache = {}
groupcaps_cache[toolname] = toolcache
end
local levelcache = toolcache[level]
if not levelcache then
levelcache = {}
levelcache.values = mcl_autogroup.get_groupcaps(toolname, level)
levelcache.hash = compute_hash(levelcache.values)
toolcache[level] = levelcache
end
return levelcache
end
-- Update groupcaps of an enchanted tool. This function will be called
-- repeatedly to make sure the digging times stored in groupcaps stays in sync
-- when the digging times of nodes can change.
--
-- To make it more efficient it will first check a hash value to determine if
-- the tool needs to be updated.
function mcl_enchanting.update_groupcaps(itemstack)
local name = itemstack:get_name()
if not minetest.registered_tools[name].tool_capabilities then
return
end
local efficiency = mcl_enchanting.get_enchantment(itemstack, "efficiency")
local unbreaking = mcl_enchanting.get_enchantment(itemstack, "unbreaking")
if unbreaking == 0 and efficiency == 0 then
return
end
local groupcaps = get_efficiency_groupcaps(name, efficiency)
local hash = itemstack:get_meta():get_string("groupcaps_hash")
if not hash or hash ~= groupcaps.hash then
local tool_capabilities = itemstack:get_tool_capabilities()
tool_capabilities.groupcaps = table.copy(groupcaps.values)
-- Increase the number of uses depending on the unbreaking level
-- of the tool.
for group, capability in pairs(tool_capabilities.groupcaps) do
capability.uses = capability.uses * (1 + unbreaking)
end
itemstack:get_meta():set_tool_capabilities(tool_capabilities)
itemstack:get_meta():set_string("groupcaps_hash", groupcaps.hash)
end
end

View File

@ -59,6 +59,7 @@ mcl_enchanting = {
}
dofile(modpath .. "/engine.lua")
dofile(modpath .. "/groupcaps.lua")
dofile(modpath .. "/enchantments.lua")
minetest.register_chatcommand("enchant", {

View File

@ -1,2 +1 @@
mcl_sounds
_mcl_autogroup

View File

@ -6,14 +6,7 @@ local S = minetest.get_translator("mcl_tools")
-- Tool definition
--
--[[ Maximum drop level definitions:
- 0: Hand
- 1: Wood / Shears
- 2: Gold
- 3: Stone
- 4: Iron
- 5: Diamond
--[[
dig_speed_class group:
- 1: Painfully slow
- 2: Very slow
@ -26,25 +19,18 @@ dig_speed_class group:
-- The hand
local groupcaps, hand_range, hand_groups
if minetest.is_creative_enabled("") then
-- Instant breaking in creative mode
groupcaps = {
creative_breakable = {times={[1]=0}, uses=0},
}
-- mcl_autogroup provides the creative digging times for all digging groups
for k,v in pairs(mcl_autogroup.creativetimes) do
groupcaps[k] = { times = v, uses = 0 }
end
groupcaps = { creative_breakable = { times = {0}, uses = 0 } }
hand_range = 10
hand_groups = { dig_speed_class = 7 }
else
groupcaps = {
handy_dig = {times=mcl_autogroup.digtimes.handy_dig, uses=0},
}
groupcaps = {}
hand_range = 4
hand_groups = { dig_speed_class = 1 }
end
minetest.register_item(":", {
minetest.register_tool(":", {
type = "none",
_doc_items_longdesc = S("You use your bare hand whenever you are not wielding any item. With your hand you can mine most blocks, but this is the slowest method and only the weakest blocks will yield their useful drop. The hand also deals minor damage by punching. Using the hand is often a last resort, as proper mining tools and weapons are much better.").."\n"..
S("When you are wielding an item which is not a mining tool or a weapon, it will behave as if it were the hand when you start mining or punching.").."\n"..
@ -61,6 +47,17 @@ minetest.register_item(":", {
damage_groups = {fleshy=1},
},
groups = hand_groups,
_mcl_diggroups = {
handy = { speed = 1, level = 1, uses = 0 },
axey = { speed = 1, level = 1, uses = 0 },
shovely = { speed = 1, level = 1, uses = 0 },
pickaxey = { speed = 1, level = 0, uses = 0 },
swordy = { speed = 1, level = 0, uses = 0 },
swordy_cobweb = { speed = 1, level = 0, uses = 0 },
shearsy = { speed = 1, level = 0, uses = 0 },
shearsy_wool = { speed = 1, level = 0, uses = 0 },
shearsy_cobweb = { speed = 1, level = 0, uses = 0 },
}
})
-- Help texts
@ -86,15 +83,15 @@ minetest.register_tool("mcl_tools:pick_wood", {
-- 1/1.2
full_punch_interval = 0.83333333,
max_drop_level=1,
groupcaps={
pickaxey_dig_wood = {times=mcl_autogroup.digtimes.pickaxey_dig_wood, uses=60, maxlevel=0},
},
damage_groups = {fleshy=2},
punch_attack_uses = 30,
},
sound = { breaks = "default_tool_breaks" },
_repair_material = "group:wood",
_mcl_toollike_wield = true,
_mcl_diggroups = {
pickaxey = { speed = 2, level = 1, uses = 60 }
},
})
minetest.register_tool("mcl_tools:pick_stone", {
description = S("Stone Pickaxe"),
@ -106,15 +103,15 @@ minetest.register_tool("mcl_tools:pick_stone", {
-- 1/1.2
full_punch_interval = 0.83333333,
max_drop_level=3,
groupcaps={
pickaxey_dig_stone = {times=mcl_autogroup.digtimes.pickaxey_dig_stone, uses=132, maxlevel=0},
},
damage_groups = {fleshy=3},
punch_attack_uses = 66,
},
sound = { breaks = "default_tool_breaks" },
_repair_material = "mcl_core:cobble",
_mcl_toollike_wield = true,
_mcl_diggroups = {
pickaxey = { speed = 4, level = 3, uses = 132 }
},
})
minetest.register_tool("mcl_tools:pick_iron", {
description = S("Iron Pickaxe"),
@ -126,15 +123,15 @@ minetest.register_tool("mcl_tools:pick_iron", {
-- 1/1.2
full_punch_interval = 0.83333333,
max_drop_level=4,
groupcaps={
pickaxey_dig_iron = {times=mcl_autogroup.digtimes.pickaxey_dig_iron , uses=251, maxlevel=0},
},
damage_groups = {fleshy=4},
punch_attack_uses = 126,
},
sound = { breaks = "default_tool_breaks" },
_repair_material = "mcl_core:iron_ingot",
_mcl_toollike_wield = true,
_mcl_diggroups = {
pickaxey = { speed = 6, level = 4, uses = 251 }
},
})
minetest.register_tool("mcl_tools:pick_gold", {
description = S("Golden Pickaxe"),
@ -146,15 +143,15 @@ minetest.register_tool("mcl_tools:pick_gold", {
-- 1/1.2
full_punch_interval = 0.83333333,
max_drop_level=2,
groupcaps={
pickaxey_dig_gold = {times=mcl_autogroup.digtimes.pickaxey_dig_gold , uses=33, maxlevel=0},
},
damage_groups = {fleshy=2},
punch_attack_uses = 17,
},
sound = { breaks = "default_tool_breaks" },
_repair_material = "mcl_core:gold_ingot",
_mcl_toollike_wield = true,
_mcl_diggroups = {
pickaxey = { speed = 12, level = 2, uses = 33 }
},
})
minetest.register_tool("mcl_tools:pick_diamond", {
description = S("Diamond Pickaxe"),
@ -166,37 +163,17 @@ minetest.register_tool("mcl_tools:pick_diamond", {
-- 1/1.2
full_punch_interval = 0.83333333,
max_drop_level=5,
groupcaps={
pickaxey_dig_diamond = {times=mcl_autogroup.digtimes.pickaxey_dig_diamond, uses=1562, maxlevel=0},
},
damage_groups = {fleshy=5},
punch_attack_uses = 781,
},
sound = { breaks = "default_tool_breaks" },
_repair_material = "mcl_core:diamond",
_mcl_toollike_wield = true,
_mcl_diggroups = {
pickaxey = { speed = 8, level = 5, uses = 1562 }
},
})
local get_shovel_dig_group = function(itemstack)
local itemstring = itemstack:get_name()
local efficiency_level = mcl_enchanting.get_enchantment(itemstack, "efficiency")
local postfix = efficiency_level > 0 and "_efficiency_" .. efficiency_level or ""
if itemstring:find("mcl_tools:shovel_wood") == 1 then
return "shovely_dig_wood" .. postfix
elseif itemstring:find("mcl_tools:shovel_stone") == 1 then
return "shovely_dig_stone" .. postfix
elseif itemstring:find("mcl_tools:shovel_iron") == 1 then
return "shovely_dig_iron" .. postfix
elseif itemstring:find("mcl_tools:shovel_gold") == 1 then
return "shovely_dig_gold" .. postfix
elseif itemstring:find("mcl_tools:shovel_diamond") == 1 then
return "shovely_dig_diamond" .. postfix
else
-- Fallback
return "shovely_dig_wood"
end
end
local make_grass_path = function(itemstack, placer, pointed_thing)
-- Use pointed node's on_rightclick function first, if present
local node = minetest.get_node(pointed_thing.under)
@ -221,15 +198,9 @@ local make_grass_path = function(itemstack, placer, pointed_thing)
end
if not minetest.is_creative_enabled(placer:get_player_name()) then
-- Add wear, as if digging a level 0 shovely node
-- Add wear (as if digging a shovely node)
local toolname = itemstack:get_name()
local def = minetest.registered_items[toolname]
local group = get_shovel_dig_group(itemstack)
local toolcaps = itemstack:get_tool_capabilities()
local base_uses = toolcaps.groupcaps[group].uses
local maxlevel = toolcaps.groupcaps[group].maxlevel
local uses = base_uses * math.pow(3, maxlevel)
local wear = math.ceil(65535 / uses)
local wear = mcl_autogroup.get_wear(toolname, "shovely")
itemstack:add_wear(wear)
end
minetest.sound_play({name="default_grass_footstep", gain=1}, {pos = above}, true)
@ -258,12 +229,7 @@ if minetest.get_modpath("mcl_farming") then
if not minetest.is_creative_enabled(placer:get_player_name()) then
-- Add wear (as if digging a shearsy node)
local toolname = itemstack:get_name()
local def = minetest.registered_items[toolname]
local group = get_shovel_dig_group(toolname)
local base_uses = def.tool_capabilities.groupcaps["shearsy_dig"].uses
local maxlevel = def.tool_capabilities.groupcaps["shearsy_dig"].maxlevel
local uses = base_uses * math.pow(3, maxlevel)
local wear = math.ceil(65535 / uses)
local wear = mcl_autogroup.get_wear(toolname, "shearsy")
itemstack:add_wear(wear)
end
minetest.sound_play({name="default_grass_footstep", gain=1}, {pos = above}, true)
@ -288,9 +254,6 @@ minetest.register_tool("mcl_tools:shovel_wood", {
tool_capabilities = {
full_punch_interval = 1,
max_drop_level=1,
groupcaps={
shovely_dig_wood = {times=mcl_autogroup.digtimes.shovely_dig_wood, uses=60, maxlevel=0},
},
damage_groups = {fleshy=2},
punch_attack_uses = 30,
},
@ -298,6 +261,9 @@ minetest.register_tool("mcl_tools:shovel_wood", {
sound = { breaks = "default_tool_breaks" },
_repair_material = "group:wood",
_mcl_toollike_wield = true,
_mcl_diggroups = {
shovely = { speed = 2, level = 1, uses = 60 }
},
})
minetest.register_tool("mcl_tools:shovel_stone", {
description = S("Stone Shovel"),
@ -309,9 +275,6 @@ minetest.register_tool("mcl_tools:shovel_stone", {
tool_capabilities = {
full_punch_interval = 1,
max_drop_level=3,
groupcaps={
shovely_dig_stone = {times=mcl_autogroup.digtimes.shovely_dig_stone, uses=132, maxlevel=0},
},
damage_groups = {fleshy=3},
punch_attack_uses = 66,
},
@ -319,6 +282,9 @@ minetest.register_tool("mcl_tools:shovel_stone", {
sound = { breaks = "default_tool_breaks" },
_repair_material = "mcl_core:cobble",
_mcl_toollike_wield = true,
_mcl_diggroups = {
shovely = { speed = 4, level = 3, uses = 132 }
},
})
minetest.register_tool("mcl_tools:shovel_iron", {
description = S("Iron Shovel"),
@ -330,9 +296,6 @@ minetest.register_tool("mcl_tools:shovel_iron", {
tool_capabilities = {
full_punch_interval = 1,
max_drop_level=4,
groupcaps={
shovely_dig_iron = {times=mcl_autogroup.digtimes.shovely_dig_iron, uses=251, maxlevel=0},
},
damage_groups = {fleshy=4},
punch_attack_uses = 126,
},
@ -340,6 +303,9 @@ minetest.register_tool("mcl_tools:shovel_iron", {
sound = { breaks = "default_tool_breaks" },
_repair_material = "mcl_core:iron_ingot",
_mcl_toollike_wield = true,
_mcl_diggroups = {
shovely = { speed = 6, level = 4, uses = 251 }
},
})
minetest.register_tool("mcl_tools:shovel_gold", {
description = S("Golden Shovel"),
@ -351,9 +317,6 @@ minetest.register_tool("mcl_tools:shovel_gold", {
tool_capabilities = {
full_punch_interval = 1,
max_drop_level=2,
groupcaps={
shovely_dig_gold = {times=mcl_autogroup.digtimes.shovely_dig_gold, uses=33, maxlevel=0},
},
damage_groups = {fleshy=2},
punch_attack_uses = 17,
},
@ -361,6 +324,9 @@ minetest.register_tool("mcl_tools:shovel_gold", {
sound = { breaks = "default_tool_breaks" },
_repair_material = "mcl_core:gold_ingot",
_mcl_toollike_wield = true,
_mcl_diggroups = {
shovely = { speed = 12, level = 2, uses = 33 }
},
})
minetest.register_tool("mcl_tools:shovel_diamond", {
description = S("Diamond Shovel"),
@ -372,9 +338,6 @@ minetest.register_tool("mcl_tools:shovel_diamond", {
tool_capabilities = {
full_punch_interval = 1,
max_drop_level=5,
groupcaps={
shovely_dig_diamond = {times=mcl_autogroup.digtimes.shovely_dig_diamond, uses=1562, maxlevel=0},
},
damage_groups = {fleshy=5},
punch_attack_uses = 781,
},
@ -382,6 +345,9 @@ minetest.register_tool("mcl_tools:shovel_diamond", {
sound = { breaks = "default_tool_breaks" },
_repair_material = "mcl_core:diamond",
_mcl_toollike_wield = true,
_mcl_diggroups = {
shovely = { speed = 8, level = 5, uses = 1562 }
},
})
-- Axes
@ -395,15 +361,15 @@ minetest.register_tool("mcl_tools:axe_wood", {
tool_capabilities = {
full_punch_interval = 1.25,
max_drop_level=1,
groupcaps={
axey_dig_wood = {times=mcl_autogroup.digtimes.axey_dig_wood, uses=60, maxlevel=0},
},
damage_groups = {fleshy=7},
punch_attack_uses = 30,
},
sound = { breaks = "default_tool_breaks" },
_repair_material = "group:wood",
_mcl_toollike_wield = true,
_mcl_diggroups = {
axey = { speed = 2, level = 1, uses = 60 }
},
})
minetest.register_tool("mcl_tools:axe_stone", {
description = S("Stone Axe"),
@ -414,15 +380,15 @@ minetest.register_tool("mcl_tools:axe_stone", {
tool_capabilities = {
full_punch_interval = 1.25,
max_drop_level=3,
groupcaps={
axey_dig_stone = {times=mcl_autogroup.digtimes.axey_dig_stone, uses=132, maxlevel=0},
},
damage_groups = {fleshy=9},
punch_attack_uses = 66,
},
sound = { breaks = "default_tool_breaks" },
_repair_material = "mcl_core:cobble",
_mcl_toollike_wield = true,
_mcl_diggroups = {
axey = { speed = 4, level = 3, uses = 132 }
},
})
minetest.register_tool("mcl_tools:axe_iron", {
description = S("Iron Axe"),
@ -434,15 +400,15 @@ minetest.register_tool("mcl_tools:axe_iron", {
-- 1/0.9
full_punch_interval = 1.11111111,
max_drop_level=4,
groupcaps={
axey_dig_iron = {times=mcl_autogroup.digtimes.axey_dig_iron, uses=251, maxlevel=0},
},
damage_groups = {fleshy=9},
punch_attack_uses = 126,
},
sound = { breaks = "default_tool_breaks" },
_repair_material = "mcl_core:iron_ingot",
_mcl_toollike_wield = true,
_mcl_diggroups = {
axey = { speed = 6, level = 4, uses = 251 }
},
})
minetest.register_tool("mcl_tools:axe_gold", {
description = S("Golden Axe"),
@ -453,15 +419,15 @@ minetest.register_tool("mcl_tools:axe_gold", {
tool_capabilities = {
full_punch_interval = 1.0,
max_drop_level=2,
groupcaps={
axey_dig_gold= {times=mcl_autogroup.digtimes.axey_dig_gold, uses=33, maxlevel=0},
},
damage_groups = {fleshy=7},
punch_attack_uses = 17,
},
sound = { breaks = "default_tool_breaks" },
_repair_material = "mcl_core:gold_ingot",
_mcl_toollike_wield = true,
_mcl_diggroups = {
axey = { speed = 12, level = 2, uses = 33 }
},
})
minetest.register_tool("mcl_tools:axe_diamond", {
description = S("Diamond Axe"),
@ -472,15 +438,15 @@ minetest.register_tool("mcl_tools:axe_diamond", {
tool_capabilities = {
full_punch_interval = 1.0,
max_drop_level=5,
groupcaps={
axey_dig_diamond = {times=mcl_autogroup.digtimes.axey_dig_diamond, uses=1562, maxlevel=0},
},
damage_groups = {fleshy=9},
punch_attack_uses = 781,
},
sound = { breaks = "default_tool_breaks" },
_repair_material = "mcl_core:diamond",
_mcl_toollike_wield = true,
_mcl_diggroups = {
axey = { speed = 8, level = 5, uses = 1562 }
},
})
-- Swords
@ -494,16 +460,16 @@ minetest.register_tool("mcl_tools:sword_wood", {
tool_capabilities = {
full_punch_interval = 0.625,
max_drop_level=1,
groupcaps={
swordy_dig = {times=mcl_autogroup.digtimes.swordy_dig , uses=60, maxlevel=0},
swordy_cobweb_dig = {times=mcl_autogroup.digtimes.swordy_cobweb_dig , uses=60, maxlevel=0},
},
damage_groups = {fleshy=4},
punch_attack_uses = 60,
},
sound = { breaks = "default_tool_breaks" },
_repair_material = "group:wood",
_mcl_toollike_wield = true,
_mcl_diggroups = {
swordy = { speed = 2, level = 1, uses = 60 },
swordy_cobweb = { speed = 2, level = 1, uses = 60 }
},
})
minetest.register_tool("mcl_tools:sword_stone", {
description = S("Stone Sword"),
@ -514,16 +480,16 @@ minetest.register_tool("mcl_tools:sword_stone", {
tool_capabilities = {
full_punch_interval = 0.625,
max_drop_level=3,
groupcaps={
swordy_dig = {times=mcl_autogroup.digtimes.swordy_dig , uses=132, maxlevel=0},
swordy_cobweb_dig = {times=mcl_autogroup.digtimes.swordy_cobweb_dig , uses=132, maxlevel=0},
},
damage_groups = {fleshy=5},
punch_attack_uses = 132,
},
sound = { breaks = "default_tool_breaks" },
_repair_material = "mcl_core:cobble",
_mcl_toollike_wield = true,
_mcl_diggroups = {
swordy = { speed = 4, level = 3, uses = 132 },
swordy_cobweb = { speed = 4, level = 3, uses = 132 }
},
})
minetest.register_tool("mcl_tools:sword_iron", {
description = S("Iron Sword"),
@ -534,16 +500,16 @@ minetest.register_tool("mcl_tools:sword_iron", {
tool_capabilities = {
full_punch_interval = 0.625,
max_drop_level=4,
groupcaps={
swordy_dig = {times=mcl_autogroup.digtimes.swordy_dig, uses=251, maxlevel=0},
swordy_cobweb_dig = {times=mcl_autogroup.digtimes.swordy_cobweb_dig , uses=251, maxlevel=0},
},
damage_groups = {fleshy=6},
punch_attack_uses = 251,
},
sound = { breaks = "default_tool_breaks" },
_repair_material = "mcl_core:iron_ingot",
_mcl_toollike_wield = true,
_mcl_diggroups = {
swordy = { speed = 6, level = 4, uses = 251 },
swordy_cobweb = { speed = 6, level = 4, uses = 251 }
},
})
minetest.register_tool("mcl_tools:sword_gold", {
description = S("Golden Sword"),
@ -554,16 +520,16 @@ minetest.register_tool("mcl_tools:sword_gold", {
tool_capabilities = {
full_punch_interval = 0.625,
max_drop_level=2,
groupcaps={
swordy_dig = {times=mcl_autogroup.digtimes.swordy_dig, uses=33, maxlevel=0},
swordy_cobweb_dig = {times=mcl_autogroup.digtimes.swordy_cobweb_dig, uses=33, maxlevel=0},
},
damage_groups = {fleshy=4},
punch_attack_uses = 33,
},
sound = { breaks = "default_tool_breaks" },
_repair_material = "mcl_core:gold_ingot",
_mcl_toollike_wield = true,
_mcl_diggroups = {
swordy = { speed = 12, level = 2, uses = 33 },
swordy_cobweb = { speed = 12, level = 2, uses = 33 }
},
})
minetest.register_tool("mcl_tools:sword_diamond", {
description = S("Diamond Sword"),
@ -574,16 +540,16 @@ minetest.register_tool("mcl_tools:sword_diamond", {
tool_capabilities = {
full_punch_interval = 0.625,
max_drop_level=5,
groupcaps={
swordy_dig = {times=mcl_autogroup.digtimes.swordy_dig, uses=1562, maxlevel=0},
swordy_cobweb_dig = {times=mcl_autogroup.digtimes.swordy_cobweb_dig, uses=1562, maxlevel=0},
},
damage_groups = {fleshy=7},
punch_attack_uses = 1562,
},
sound = { breaks = "default_tool_breaks" },
_repair_material = "mcl_core:diamond",
_mcl_toollike_wield = true,
_mcl_diggroups = {
swordy = { speed = 8, level = 5, uses = 1562 },
swordy_cobweb = { speed = 8, level = 5, uses = 1562 }
},
})
--Shears
@ -598,14 +564,15 @@ minetest.register_tool("mcl_tools:shears", {
tool_capabilities = {
full_punch_interval = 0.5,
max_drop_level=1,
groupcaps={
shearsy_dig = {times=mcl_autogroup.digtimes.shearsy_dig, uses=238, maxlevel=0},
shearsy_wool_dig = {times=mcl_autogroup.digtimes.shearsy_wool_dig, uses=238, maxlevel=0},
}
},
on_place = carve_pumpkin,
sound = { breaks = "default_tool_breaks" },
_mcl_toollike_wield = true,
_mcl_diggroups = {
shearsy = { speed = 1.5, level = 1, uses = 238 },
shearsy_wool = { speed = 5, level = 1, uses = 238 },
shearsy_cobweb = { speed = 15, level = 1, uses = 238 }
},
})

View File

@ -2043,7 +2043,7 @@ local function register_dimension_ores()
})
-- Nether quartz
if minetest.settings:get("mcl_generate_ores") == "true" then
if minetest.settings:get_bool("mcl_generate_ores", true) then
minetest.register_ore({
ore_type = "scatter",
ore = "mcl_nether:quartz_ore",

View File

@ -1747,7 +1747,6 @@ local function generate_tree_decorations(minp, maxp, seed, data, param2_data, ar
return lvm_used
end
local pr_shroom = PseudoRandom(os.time()-24359)
-- Generate mushrooms in caves manually.
-- Minetest's API does not support decorations in caves yet. :-(
local generate_underground_mushrooms = function(minp, maxp, seed)
@ -1758,6 +1757,7 @@ local generate_underground_mushrooms = function(minp, maxp, seed)
return
end
local pr_shroom = PseudoRandom(seed)
local bpos
local stone = minetest.find_nodes_in_area_under_air(minp, maxp, {"mcl_core:stone", "mcl_core:dirt", "mcl_core:mycelium", "mcl_core:podzol", "mcl_core:andesite", "mcl_core:diorite", "mcl_core:granite", "mcl_core:stone_with_coal", "mcl_core:stone_with_iron", "mcl_core:stone_with_gold"})
@ -1775,7 +1775,6 @@ local generate_underground_mushrooms = function(minp, maxp, seed)
end
end
local pr_nether = PseudoRandom(os.time()+667)
local nether_wart_chance
if mg_name == "v6" then
nether_wart_chance = 85
@ -1806,6 +1805,8 @@ local generate_nether_decorations = function(minp, maxp, seed)
end
local pr_nether = PseudoRandom(seed)
-- Eternal fire on netherrack
special_deco(rack, function(bpos)
-- Eternal fire on netherrack
@ -2207,17 +2208,19 @@ local function basic(vm, data, data2, emin, emax, area, minp, maxp, blockseed)
lvm_used = true
end
return lvm_used, shadow
end
local function basic_node(minp, maxp, blockseed)
if mg_name ~= "singlenode" then
-- Generate special decorations
generate_underground_mushrooms(minp, maxp, blockseed)
generate_nether_decorations(minp, maxp, blockseed)
generate_structures(minp, maxp, blockseed, biomemap)
generate_structures(minp, maxp, blockseed, minetest.get_mapgen_object("biomemap"))
end
return lvm_used, shadow
end
mcl_mapgen_core.register_generator("main", basic, nil, 1, true)
mcl_mapgen_core.register_generator("main", basic, basic_node, 1, true)
-- "Trivial" (actually NOT) function to just read the node and some stuff to not just return "ignore", like 5.3.0 does.
-- p: Position, if it's wrong, {name="error"} node will return.