forked from VoxeLibre/VoxeLibre
Compare commits
No commits in common. "mineclonia" and "mineclonxx" have entirely different histories.
mineclonia
...
mineclonxx
|
@ -1,38 +0,0 @@
|
|||
---
|
||||
|
||||
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:
|
|
@ -1,22 +0,0 @@
|
|||
---
|
||||
|
||||
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. -->
|
|
@ -1,51 +0,0 @@
|
|||
<!--
|
||||
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
|
||||
-->
|
102
.luacheckrc
102
.luacheckrc
|
@ -1,102 +0,0 @@
|
|||
std = "min"
|
||||
|
||||
read_globals = {
|
||||
"ItemStack",
|
||||
"dump", "dump2",
|
||||
"vector",
|
||||
"VoxelArea",
|
||||
"minetest",
|
||||
"PseudoRandom",
|
||||
"PerlinNoise",
|
||||
"PcgRandom",
|
||||
|
||||
string = {fields = {"split", "trim"}},
|
||||
table = {fields = {"copy", "getn", "indexof", "insert_all"}},
|
||||
math = {fields = {"hypot", "round"}},
|
||||
}
|
||||
|
||||
-- A config option to allow r/w access to mods which contain
|
||||
-- this one. It only avoids a couple warnings, and may not be
|
||||
-- the behavior we want, so it's disabled by default.
|
||||
local allow_parents=false
|
||||
|
||||
local lfs = require "lfs"
|
||||
|
||||
-- Seed the queue with the mods/ directory
|
||||
local queue={ {"mods"} }
|
||||
|
||||
local function check(dir)
|
||||
-- Get the string of the directory path
|
||||
local sdir=table.concat(dir, "/")
|
||||
-- Save the top-level directory name as a
|
||||
-- fallback in case there's no mod.conf,
|
||||
-- or no name= directive.
|
||||
local name=dir[#dir]
|
||||
|
||||
-- Is there a mod.conf?
|
||||
if lfs.attributes(sdir.."/mod.conf", "mode") == "file" then
|
||||
local deps={}
|
||||
for line in io.lines(sdir.."/mod.conf") do
|
||||
-- Use name= if it's there
|
||||
name=string.match(line, "name *= *([a-zA-Z0-9_]+)") or name
|
||||
-- Get the dependency entries (if they're there)
|
||||
local ents=string.match(line, "depends *=(.*)$")
|
||||
if ents then
|
||||
-- Split them in to the comma-separated names
|
||||
for m in string.gmatch(ents, "([a-zA-Z0-9_]+),?") do
|
||||
table.insert(deps, m)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local glb={ name }
|
||||
if allow_parents then
|
||||
for _, v in pairs(dir) do
|
||||
-- Skip ALL-CAPS names since those tend
|
||||
-- to be collections of mods instead of
|
||||
-- mods themselves.
|
||||
if not string.match(v, "^[A-Z]+$") then
|
||||
table.insert(glb, v)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Tell Luacheck what the directory is allowed to do
|
||||
files[sdir]={
|
||||
globals = glb,
|
||||
read_globals = deps,
|
||||
}
|
||||
elseif lfs.attributes(sdir.."/init.lua", "mode") == "file" then
|
||||
-- No mod.conf, but there's an init.lua here.
|
||||
local glb={ name }
|
||||
if allow_parents then
|
||||
for _, v in pairs(dir) do
|
||||
-- Again, skip ALL-CAPS.
|
||||
if not string.match(v, "^[A-Z]+$") then
|
||||
table.insert(glb, v)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
files[sdir]={ globals=glb }
|
||||
end
|
||||
|
||||
-- Queue any child directories
|
||||
for d in lfs.dir(sdir) do
|
||||
-- Skip hidden directories and parent/current directories.
|
||||
if lfs.attributes(sdir.."/"..d, "mode") == "directory" and not string.match(d, "^%.") then
|
||||
-- Copy dir in to nd (New Dir)
|
||||
local nd={}
|
||||
for k, v in pairs(dir) do
|
||||
nd[k]=v
|
||||
end
|
||||
nd[#nd+1]=d
|
||||
table.insert(queue, nd)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
while #queue > 0 do
|
||||
-- Pop an entry and process it.
|
||||
check(table.remove(queue, 1))
|
||||
end
|
4
API.md
4
API.md
|
@ -17,10 +17,6 @@ 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
|
||||
|
|
|
@ -21,7 +21,7 @@ The basic digging time groups determine by which tools a node can be dug.
|
|||
* `swordy=1`: Diggable by sword (any material), and this node is *not* a cobweb
|
||||
* `swordy_cobweb=1`: Diggable by sword (any material), and this node is a cobweb
|
||||
* `shearsy=1`: Diggable by shears, and this node is *not* wool
|
||||
* `shearsy_wool=1`: Diggable by shears, and this node is wool
|
||||
* `shearsy=wool=1`: Diggable by shears, and this node is wool
|
||||
* `handy=1`: Breakable by hand and this node gives it useful drop when dug by hand. All nodes which are breakable by pickaxe, axe, shovel, sword or shears are also automatically breakable by hand, but not neccess
|
||||
* `creative_breakable=1`: Block is breakable by hand in creative mode. This group is implied if the node belongs to any other digging group
|
||||
|
||||
|
@ -149,7 +149,7 @@ These groups are used mostly for informational purposes
|
|||
* `trapdoor=2`: Open trapdoor
|
||||
* `glass=1`: Glass (full cubes only)
|
||||
* `rail=1`: Rail
|
||||
* `music_record=1`: Music Disc
|
||||
* `music_record`: Music Disc (rating is track ID)
|
||||
* `tnt=1`: Block is TNT
|
||||
* `boat=1`: Boat
|
||||
* `minecart=1`: Minecart
|
||||
|
@ -182,10 +182,6 @@ These groups are used mostly for informational purposes
|
|||
* `redstone_torch=1`: Redstone Torch (lit)
|
||||
* `redstone_torch=2`: Redstone Torch (unlit)
|
||||
|
||||
* `dirt=1`: Uncovered dirt
|
||||
* `dirt=2`: Covered dirt (grass or mycelium or podzol on top)
|
||||
* `dirt=3`: Coarse dirt
|
||||
|
||||
* `plant=1`: Plant or part of a plant
|
||||
* `double_plant`: Part of a double-sized plant. 1 = lower part, 2 = upper part
|
||||
|
||||
|
|
43
README.md
43
README.md
|
@ -1,5 +1,5 @@
|
|||
# Mineclonia
|
||||
An unofficial Minecraft-like game for Minetest. Forked from MineClone2.
|
||||
# MineClone 2
|
||||
An unofficial Minecraft-like game for Minetest. Forked from MineClone by davedevils.
|
||||
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.4.0 or
|
||||
This game requires [Minetest](http://minetest.net) to run (version 5.0.0 or
|
||||
later). So you need to install Minetest first. Only stable versions of Minetest
|
||||
are officially supported.
|
||||
There is no support for running Mineclonia in development versions of Minetest.
|
||||
There is no support for running MineClone 2 in development versions of Minetest.
|
||||
|
||||
To install Mineclonia (if you haven't already), move this directory into the
|
||||
To install MineClone 2 (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 **Mineclonia** is to be a clone of Minecraft and to be released as free software.
|
||||
The main goal of **MineClone 2** 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”)
|
||||
* Mineclonia also includes Optifine features supported by the Minetest
|
||||
* MineClone2 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
|
||||
* Mineclonia will use different graphics and sounds, but with a similar style
|
||||
* MineClone 2 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, Mineclonia is free software (“free” as in “freedom”)!
|
||||
… and finally, MineClone 2 is free software (“free” as in “freedom”)!
|
||||
|
||||
## Reporting bugs
|
||||
Please report all bugs and missing Minecraft features here:
|
||||
|
||||
<https://git.minetest.land/Mineclonia/Mineclonia/issues>
|
||||
<https://git.minetest.land/MineClone2/MineClone2/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 Mineclonia would need for improvement
|
||||
* `MISSING_ENGINE_FEATURES.md`: List of missing features in Minetest which MineClone 2 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 Mineclonia is based on
|
||||
* davedevils: Creator of MineClone on which MineClone 2 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
|
||||
* [EliasFleckenstein03](https://github.com/EliasFleckenstein03): End crystals, enchanting, burning mobs / players, animated chests, bugfixes
|
||||
* 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)
|
||||
* 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 Mineclonia
|
||||
* Minetest's modding community for providing a huge selection of mods, some of which ended up in MineClone 2
|
||||
* 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,9 +273,10 @@ 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
|
||||
Mineclonia is an imitation of Minecraft.
|
||||
MineClone 2 (by kay27, EliasFleckenstein, Wuzzy, davedevils and countless others)
|
||||
is an imitation of Minecraft.
|
||||
|
||||
Mineclonia is free software: you can redistribute it and/or modify
|
||||
MineClone 2 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.
|
||||
|
@ -289,15 +290,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 Mineclonia (GNU GPLv3) or the mod's license.
|
||||
license of MineClone 2 (GNU GPLv3) or the mod's license.
|
||||
|
||||
Mineclonia is a continuation of the discontinued MineClone project by davedevils
|
||||
and the MineClone2 project by Wuzzy.
|
||||
MineClone 2 is a direct continuation of the discontinued MineClone
|
||||
project by davedevils.
|
||||
|
||||
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 Mineclonia and the author is Wuzzy.
|
||||
of MineClone 2 and the author is Wuzzy.
|
||||
|
||||
### License of media (textures and sounds)
|
||||
No non-free licenses are used anywhere.
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
name = Mineclonia
|
||||
name = MineClone 2
|
||||
description = A survival sandbox game. Survive, gather, hunt, build, explore, and do much more.
|
||||
|
|
BIN
menu/header.png
BIN
menu/header.png
Binary file not shown.
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 76 KiB |
BIN
menu/icon.png
BIN
menu/icon.png
Binary file not shown.
Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 3.9 KiB |
|
@ -1,29 +0,0 @@
|
|||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
SVG_FILE=${2%.png}.svg
|
||||
|
||||
# How crisp a Minetest menu icon appears is influenced by image height
|
||||
# and width. Low resolutions lead to blurry edges, as Minetest scales
|
||||
# menu icons up. High resolutions lead to jagged edges, as Minetest
|
||||
# scales menu icons down. Height & width of 72 pixes seem to work.
|
||||
#
|
||||
# Though usually one would export directly to "${3}", Inkscape 1.0 had
|
||||
# its command line options changed by people who apparently think that
|
||||
# backwards compatibility is some kind of swear word: Whereas earlier
|
||||
# Inkscape versions would export to a file called foo.png.tmp, newer
|
||||
# behaviour is to ignore the user's wishes & write to foo.png.png –
|
||||
# unless one asks it to write to a filename with a .png extension,
|
||||
# Inkscape 1.0 changes the filename extension to .png each time.
|
||||
#
|
||||
# As we do not know the extension of "${3}", we have to use the
|
||||
# extension, then rename the resulting file to the proper name;
|
||||
# only that way the export works with Inkscape 1.0 & earlier …
|
||||
>&2 inkscape \
|
||||
--file="${SVG_FILE}" \
|
||||
--export-png="${3}".png \
|
||||
--export-area-page \
|
||||
--export-height 72 \
|
||||
--export-width 72 \
|
||||
|
||||
mv "${3}".png "${3}"
|
8838
menu/icon.svg
8838
menu/icon.svg
File diff suppressed because it is too large
Load Diff
Before Width: | Height: | Size: 509 KiB |
|
@ -4,11 +4,6 @@ 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.
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
MineClone 2 core mod which automatically adds groups to all items. Very important for digging times.
|
|
@ -1,366 +1,170 @@
|
|||
--[[
|
||||
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:
|
||||
--[[ Mining times. Yeah, mining times … Alright, this is going to be FUN!
|
||||
|
||||
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 (the tool speed and its efficiency level)
|
||||
3) Whether the tool is considered as "eligible" for the block
|
||||
2) The tool being used
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
How the mod is used
|
||||
===================
|
||||
Example:
|
||||
mcl_autogroup.digtimes.pickaxey_dig_diamond[1] = 0.2
|
||||
|
||||
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:
|
||||
→ 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.
|
||||
|
||||
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).
|
||||
|
||||
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.
|
||||
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).
|
||||
|
||||
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.
|
||||
]]
|
||||
|
||||
_mcl_diggroups = {
|
||||
handy = { speed = 1, level = 1, uses = 0 },
|
||||
pickaxey = { speed = 1, level = 0, uses = 0 },
|
||||
}
|
||||
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
|
||||
|
||||
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.
|
||||
mcl_autogroup = {}
|
||||
mcl_autogroup.digtimes = {}
|
||||
mcl_autogroup.creativetimes = {} -- Copy of digtimes, except that all values are 0. Used for creative mode
|
||||
|
||||
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)
|
||||
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] = {}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- 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 not ndef then
|
||||
return false
|
||||
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] = {}
|
||||
end
|
||||
|
||||
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 creative_breakable = false
|
||||
|
||||
-- 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
|
||||
|
||||
for i = ndef.groups[g], #gdef.levels do
|
||||
newgroups[g .. "_dig_" .. gdef.levels[i]] = index
|
||||
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
|
||||
newgroups[g .. "_dig"] = index
|
||||
-- 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
|
||||
|
||||
-- Hack in digging times
|
||||
local hardness = ndef._mcl_hardness
|
||||
if not hardness then
|
||||
hardness = 0
|
||||
end
|
||||
|
||||
-- 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)
|
||||
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
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Automatically assign the node to the
|
||||
-- creative_breakable group if it belongs to any digging
|
||||
-- group.
|
||||
newgroups["creative_breakable"] = 1
|
||||
|
||||
if groups_changed then
|
||||
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
|
||||
|
||||
|
|
|
@ -1,3 +1 @@
|
|||
name = _mcl_autogroup
|
||||
author = ryvnf
|
||||
description = MineClone 2 core mod which automatically adds groups to all items. Very important for digging times.
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Adds additional ways for nodes to be attached.
|
|
@ -1,2 +0,0 @@
|
|||
name = mcl_attached
|
||||
description = Adds additional ways for nodes to be attached.
|
|
@ -1,28 +0,0 @@
|
|||
--[[
|
||||
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
|
|
@ -1,3 +0,0 @@
|
|||
name = mcl_autogroup
|
||||
author = ryvnf
|
||||
description = MineClone 2 core mod which automatically adds groups to all items. Very important for digging times.
|
|
@ -1,8 +0,0 @@
|
|||
# mcl_colors
|
||||
Mod providing global table containing legacy minecraft colors to be used in mods.
|
||||
|
||||
## mcl_colors.*
|
||||
Colors by upper name, in hex value.
|
||||
|
||||
## mcl_colors.background.*
|
||||
Background colors by upper name, in hex value.
|
|
@ -1,36 +0,0 @@
|
|||
mcl_colors = {
|
||||
BLACK = "#000000",
|
||||
DARK_BLUE = "#0000AA",
|
||||
DARK_GREEN = "#00AA00",
|
||||
DARK_AQUA = "#00AAAA",
|
||||
DARK_RED = "#AA0000",
|
||||
DARK_PURPLE = "#AA00AA",
|
||||
GOLD = "#FFAA00",
|
||||
GRAY = "#AAAAAA",
|
||||
DARK_GRAY = "#555555",
|
||||
BLUE = "#5555FF",
|
||||
GREEN = "#55FF55",
|
||||
AQUA = "#55FFFF",
|
||||
RED = "#FF5555",
|
||||
LIGHT_PURPLE = "#FF55FF",
|
||||
YELLOW = "#FFFF55",
|
||||
WHITE = "#FFFFFF",
|
||||
background = {
|
||||
BLACK = "#000000",
|
||||
DARK_BLUE = "#00002A",
|
||||
DARK_GREEN = "#002A00",
|
||||
DARK_AQUA = "#002A2A",
|
||||
DARK_RED = "#2A0000",
|
||||
DARK_PURPLE = "#2A002A",
|
||||
GOLD = "#2A2A00",
|
||||
GRAY = "#2A2A2A",
|
||||
DARK_GRAY = "#151515",
|
||||
BLUE = "#15153F",
|
||||
GREEN = "#153F15",
|
||||
AQUA = "#153F3F",
|
||||
RED = "#3F1515",
|
||||
LIGHT_PURPLE = "#3F153F",
|
||||
YELLOW = "#3F3F15",
|
||||
WHITE = "#373501",
|
||||
}
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
name = mcl_colors
|
||||
author = Fleckenstein
|
||||
description = The HTML sequences for the minecraft colors
|
|
@ -57,48 +57,50 @@ local function compute_sphere_rays(radius)
|
|||
local rays = {}
|
||||
local sphere = {}
|
||||
|
||||
local function add_ray(pos)
|
||||
for i=1, 2 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
|
||||
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
|
||||
end
|
||||
|
||||
for i=1,2 do
|
||||
for x = -radius, radius do
|
||||
for z = -radius, radius do
|
||||
for y = -radius, 0 do
|
||||
for y = -radius, 0, 1 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))
|
||||
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 do
|
||||
for z = -radius, 0, 1 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))
|
||||
local pos = { x = x, y = y, z = z }
|
||||
sphere[minetest.hash_node_position(pos)] = pos
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
for _, pos in pairs(sphere) do
|
||||
rays[#rays + 1] = vector.normalize(pos)
|
||||
|
@ -200,10 +202,7 @@ local function trace_explode(pos, strength, raydirs, radius, info, puncher)
|
|||
npos_x - emin_x + 1
|
||||
|
||||
local cid = data[idx]
|
||||
|
||||
-- Set blast resistance to 0 for unknown nodes
|
||||
local br = node_blastres[cid] or 0
|
||||
|
||||
local br = node_blastres[cid]
|
||||
if br < INDESTRUCT_BLASTRES and br > max_blast_resistance then
|
||||
br = max_blast_resistance
|
||||
end
|
||||
|
@ -251,12 +250,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]
|
||||
local y1 = collisionbox[2]
|
||||
local z1 = collisionbox[3]
|
||||
local x2 = collisionbox[4]
|
||||
local y2 = collisionbox[5]
|
||||
local z2 = collisionbox[6]
|
||||
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 x_len = math.abs(x2 - x1)
|
||||
local y_len = math.abs(y2 - y1)
|
||||
local z_len = math.abs(z2 - z1)
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Initialization mod of MineClone 2. Defines some common shared variables and sets up initial default settings which have to be set at the beginning.
|
|
@ -1,2 +1 @@
|
|||
name = mcl_init
|
||||
description = Initialization mod of MineClone 2. Defines some common shared variables and sets up initial default settings which have to be set at the beginning.
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
API for filling a chest with random treasures.
|
|
@ -1,2 +1 @@
|
|||
name = mcl_loot
|
||||
description = API for filling a chest with random treasures.
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Contains particle images of MineClone 2. No code.
|
|
@ -1,2 +1 @@
|
|||
name = mcl_particles
|
||||
description = Contains particle images of MineClone 2. No code.
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
This mod contains the core sounds of MineClone 2 as well as helper function for mods to access them.
|
|
@ -1,2 +1 @@
|
|||
name = mcl_sounds
|
||||
description = This mod contains the core sounds of MineClone 2 as well as helper function for mods to access them.
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
mcl_init
|
|
@ -0,0 +1 @@
|
|||
Helper functions for MineClone 2.
|
|
@ -1,3 +1 @@
|
|||
name = mcl_util
|
||||
description = Helper functions for MineClone 2.
|
||||
depends = mcl_init
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
mcl_init
|
|
@ -0,0 +1 @@
|
|||
Utility functions for worlds and the “dimensions”.
|
|
@ -1,3 +0,0 @@
|
|||
name = mcl_worlds
|
||||
description = Utility functions for worlds and the “dimensions”.
|
||||
depends = mcl_init
|
|
@ -1 +0,0 @@
|
|||
name = walkover
|
|
@ -0,0 +1 @@
|
|||
mcl_core
|
|
@ -1,2 +0,0 @@
|
|||
name = drippingwater
|
||||
depends = mcl_core
|
|
@ -0,0 +1,3 @@
|
|||
mcl_player
|
||||
mcl_core?
|
||||
doc_identifier?
|
|
@ -0,0 +1 @@
|
|||
Adds drivable boats.
|
|
@ -243,7 +243,7 @@ function boat.on_step(self, dtime, moveresult)
|
|||
else
|
||||
local ctrl = self._passenger:get_player_control()
|
||||
if ctrl and ctrl.sneak then
|
||||
detach_object(self._passenger, true)
|
||||
detach_player(self._passenger, true)
|
||||
self._passenger = nil
|
||||
end
|
||||
end
|
||||
|
@ -260,7 +260,7 @@ function boat.on_step(self, dtime, moveresult)
|
|||
return
|
||||
end
|
||||
local yaw = self.object:get_yaw()
|
||||
if ctrl and ctrl.up then
|
||||
if ctrl.up then
|
||||
-- Forwards
|
||||
self._v = self._v + 0.1 * v_factor
|
||||
|
||||
|
@ -269,7 +269,7 @@ function boat.on_step(self, dtime, moveresult)
|
|||
self.object:set_animation({x=0, y=40}, paddling_speed, 0, true)
|
||||
self._animation = 1
|
||||
end
|
||||
elseif ctrl and ctrl.down then
|
||||
elseif ctrl.down then
|
||||
-- Backwards
|
||||
self._v = self._v - 0.1 * v_factor
|
||||
|
||||
|
|
|
@ -1,4 +1 @@
|
|||
name = mcl_boats
|
||||
description = Adds drivable boats.
|
||||
depends = mcl_player
|
||||
optional_depends = mcl_core, doc_identifier
|
||||
|
|
|
@ -155,16 +155,6 @@ function mcl_burning.set_on_fire(obj, burn_time, reason)
|
|||
}) + 1
|
||||
end
|
||||
|
||||
local already_burning = mcl_burning.is_burning(obj)
|
||||
|
||||
|
||||
mcl_burning.set(obj, "float", "burn_time", burn_time)
|
||||
mcl_burning.set(obj, "string", "reason", reason)
|
||||
|
||||
if already_burning then
|
||||
return
|
||||
end
|
||||
|
||||
local hud_id
|
||||
if obj:is_player() then
|
||||
hud_id = mcl_burning.get(obj, "int", "hud_id")
|
||||
|
@ -178,7 +168,8 @@ function mcl_burning.set_on_fire(obj, burn_time, reason)
|
|||
}) + 1
|
||||
end
|
||||
end
|
||||
|
||||
mcl_burning.set(obj, "float", "burn_time", burn_time)
|
||||
mcl_burning.set(obj, "string", "reason", reason)
|
||||
mcl_burning.set(obj, "int", "hud_id", hud_id)
|
||||
mcl_burning.set(obj, "int", "sound_id", sound_id)
|
||||
|
||||
|
@ -294,7 +285,7 @@ function mcl_burning.fire_entity_step(self, dtime)
|
|||
end
|
||||
|
||||
local animation_timer = self.animation_timer + dtime
|
||||
if animation_timer >= ( 1 / mcl_burning.animation_fps ) then
|
||||
if animation_timer >= 0.015 then
|
||||
animation_timer = 0
|
||||
local animation_frame = self.animation_frame + 1
|
||||
if animation_frame > mcl_burning.animation_frames - 1 then
|
||||
|
@ -305,48 +296,3 @@ function mcl_burning.fire_entity_step(self, dtime)
|
|||
end
|
||||
self.animation_timer = animation_timer
|
||||
end
|
||||
|
||||
minetest.register_chatcommand("burn", {
|
||||
params = S("<playername> <duration> <reason>"),
|
||||
description = S("Sets a player on fire for the given amount of seconds with the given reason."),
|
||||
privs = { debug = true },
|
||||
func = function(name, params)
|
||||
local playername, duration, reason = params:match("^(.+) (.+) (.+)$")
|
||||
if not (playername and duration and reason) then
|
||||
return false, S("Error: Parameter missing.")
|
||||
end
|
||||
local player = minetest.get_player_by_name(playername)
|
||||
if not player then
|
||||
return false, S(
|
||||
"Error: Player “@1” not found.",
|
||||
playername
|
||||
)
|
||||
end
|
||||
local duration_number = tonumber(duration)
|
||||
-- Lua numbers are truthy
|
||||
-- NaN is not equal to NaN
|
||||
if not duration_number or (duration_number ~= duration_number) then
|
||||
return false, S(
|
||||
"Error: Duration “@1” is not a number.",
|
||||
duration
|
||||
)
|
||||
end
|
||||
if duration_number < 0 then
|
||||
return false, S(
|
||||
"Error: Duration “@1” is negative.",
|
||||
duration
|
||||
)
|
||||
end
|
||||
mcl_burning.set_on_fire(
|
||||
player,
|
||||
duration_number,
|
||||
reason
|
||||
)
|
||||
return true, S(
|
||||
"Set @1 on fire for @2s for the following reason: @3",
|
||||
playername,
|
||||
duration,
|
||||
reason
|
||||
)
|
||||
end,
|
||||
})
|
||||
|
|
|
@ -2,8 +2,7 @@ local S = minetest.get_translator("mcl_burning")
|
|||
local modpath = minetest.get_modpath("mcl_burning")
|
||||
|
||||
mcl_burning = {
|
||||
animation_frames = tonumber(minetest.settings:get("fire_animation_frames")) or 8,
|
||||
animation_fps = tonumber(minetest.settings:get("fire_animation_fps")) or 30
|
||||
animation_frames = tonumber(minetest.settings:get("fire_animation_frames")) or 8
|
||||
}
|
||||
|
||||
dofile(modpath .. "/api.lua")
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Falling node entities, Minecraft-style
|
|
@ -1,2 +1 @@
|
|||
name = mcl_falling_nodes
|
||||
description = Falling node entities, Minecraft-style
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
flowlib
|
||||
mcl_enchanting
|
|
@ -0,0 +1 @@
|
|||
Dropped items will be attracted to the player like a magnet.
|
|
@ -1,4 +1,3 @@
|
|||
local S = minetest.get_translator("mcl_item_entity")
|
||||
--basic settings
|
||||
local item_drop_settings = {} --settings table
|
||||
item_drop_settings.age = 1.0 --how old a dropped item (_insta_collect==false) has to be before collecting
|
||||
|
@ -166,6 +165,66 @@ 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
|
||||
|
@ -222,20 +281,17 @@ 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 tooldef
|
||||
local toolcaps
|
||||
local tool
|
||||
if digger ~= nil then
|
||||
tool = digger:get_wielded_item()
|
||||
tooldef = minetest.registered_tools[tool:get_name()]
|
||||
toolcaps = tool:get_tool_capabilities()
|
||||
|
||||
if not mcl_autogroup.can_harvest(dug_node.name, tool:get_name()) then
|
||||
if not check_can_drop(dug_node.name, toolcaps) 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:
|
||||
|
@ -247,7 +303,7 @@ function minetest.handle_node_drops(pos, drops, digger)
|
|||
|
||||
local silk_touch_drop = false
|
||||
local nodedef = minetest.registered_nodes[dug_node.name]
|
||||
if shearsy_level and shearsy_level > 0 and nodedef._mcl_shears_drop then
|
||||
if toolcaps ~= nil and toolcaps.groupcaps and toolcaps.groupcaps.shearsy_dig and nodedef._mcl_shears_drop then
|
||||
if nodedef._mcl_shears_drop == true then
|
||||
drops = { dug_node.name }
|
||||
else
|
||||
|
@ -449,7 +505,7 @@ minetest.register_entity(":__builtin:item", {
|
|||
end,
|
||||
|
||||
get_staticdata = function(self)
|
||||
local data = minetest.serialize({
|
||||
return minetest.serialize({
|
||||
itemstring = self.itemstring,
|
||||
always_collect = self.always_collect,
|
||||
age = self.age,
|
||||
|
@ -457,39 +513,6 @@ minetest.register_entity(":__builtin:item", {
|
|||
_flowing = self._flowing,
|
||||
_removed = self._removed,
|
||||
})
|
||||
-- sfan5 guessed that the biggest serializable item
|
||||
-- entity would have a size of 65530 bytes. This has
|
||||
-- been experimentally verified to be still too large.
|
||||
--
|
||||
-- anon5 has calculated that the biggest serializable
|
||||
-- item entity has a size of exactly 65487 bytes:
|
||||
--
|
||||
-- 1. serializeString16 can handle max. 65535 bytes.
|
||||
-- 2. The following engine metadata is always saved:
|
||||
-- • 1 byte (version)
|
||||
-- • 2 byte (length prefix)
|
||||
-- • 14 byte “__builtin:item”
|
||||
-- • 4 byte (length prefix)
|
||||
-- • 2 byte (health)
|
||||
-- • 3 × 4 byte = 12 byte (position)
|
||||
-- • 4 byte (yaw)
|
||||
-- • 1 byte (version 2)
|
||||
-- • 2 × 4 byte = 8 byte (pitch and roll)
|
||||
-- 3. This leaves 65487 bytes for the serialization.
|
||||
if #data > 65487 then -- would crash the engine
|
||||
local stack = ItemStack(self.itemstring)
|
||||
stack:get_meta():from_table(nil)
|
||||
self.itemstring = stack:to_string()
|
||||
minetest.log(
|
||||
"warning",
|
||||
"Overlong item entity metadata removed: “" ..
|
||||
self.itemstring ..
|
||||
"” had serialized length of " ..
|
||||
#data
|
||||
)
|
||||
return self:get_staticdata()
|
||||
end
|
||||
return data
|
||||
end,
|
||||
|
||||
on_activate = function(self, staticdata, dtime_s)
|
||||
|
@ -782,29 +805,3 @@ minetest.register_entity(":__builtin:item", {
|
|||
|
||||
-- Note: on_punch intentionally left out. The player should *not* be able to collect items by punching
|
||||
})
|
||||
|
||||
-- The “getwrittenbook” command was added as a debug aid. It can help
|
||||
-- reproducing situations in which items with lots of metadata trigger
|
||||
-- issues like heavy lag or server crashes. Do not remove this command
|
||||
-- unless another easy way of getting items with overlong meta exists!
|
||||
--
|
||||
-- “/getwrittenbook 65323” creates an item that creates the largest
|
||||
-- possible serializable written book item entity when dropped.
|
||||
--
|
||||
-- “/getwrittenbook 65324” creates an item that creates the smallest
|
||||
-- possible non-serializable written book item entity when dropped.
|
||||
minetest.register_chatcommand("getwrittenbook", {
|
||||
params = S("<Count>"),
|
||||
description = S("Get a written book with a configurable amount of characters."),
|
||||
privs = {debug=true},
|
||||
func = function(name, param)
|
||||
local count = tonumber(param)
|
||||
local itemstack = ItemStack("mcl_books:written_book")
|
||||
local meta = itemstack:get_meta()
|
||||
meta:set_string("description", "")
|
||||
meta:set_string("text", string.rep("x", count))
|
||||
local player = minetest.get_player_by_name(name)
|
||||
local inv = player:get_inventory()
|
||||
inv:add_item("main", itemstack)
|
||||
end
|
||||
})
|
||||
|
|
|
@ -1,3 +1 @@
|
|||
name = mcl_item_entity
|
||||
description = Dropped items will be attracted to the player like a magnet.
|
||||
depends = flowlib, mcl_enchanting
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
mcl_explosions
|
||||
mcl_core
|
||||
mcl_sounds
|
||||
mcl_player
|
||||
mcl_achievements
|
||||
mcl_chests
|
||||
mcl_furnaces
|
||||
mesecons_commandblock
|
||||
mcl_hoppers
|
||||
mcl_tnt
|
||||
mesecons
|
||||
doc_identifier?
|
|
@ -0,0 +1 @@
|
|||
Minecarts are vehicles to move players quickly on rails.
|
|
@ -12,15 +12,14 @@ local function detach_driver(self)
|
|||
if not self._driver then
|
||||
return
|
||||
end
|
||||
mcl_player.player_attached[self._driver] = nil
|
||||
local player = minetest.get_player_by_name(self._driver)
|
||||
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
|
||||
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)
|
||||
|
@ -62,7 +61,7 @@ local function register_entity(entity_id, mesh, textures, drop, on_rightclick, o
|
|||
|
||||
on_rightclick = on_rightclick,
|
||||
|
||||
_driver = nil, -- player who sits in and controls the minecart (only for minecart!)
|
||||
_driver = nil, -- player (or mob) 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
|
||||
|
@ -97,31 +96,12 @@ 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)
|
||||
local pos = self.object:get_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
|
||||
|
||||
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
|
||||
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
|
||||
-- Punch: Pick up minecart (unless TNT was ignited)
|
||||
if self._boomtimer then return end
|
||||
if self._driver then
|
||||
if self._old_pos then
|
||||
self.object:set_pos(self._old_pos)
|
||||
end
|
||||
detach_driver(self)
|
||||
end
|
||||
local pos = self.object:get_pos()
|
||||
|
||||
-- Disable detector rail
|
||||
local rou_pos = vector.round(pos)
|
||||
|
@ -147,61 +127,70 @@ local function register_entity(entity_id, mesh, textures, drop, on_rightclick, o
|
|||
end
|
||||
|
||||
self.object:remove()
|
||||
return
|
||||
end
|
||||
|
||||
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
|
||||
if self._driver then
|
||||
player = minetest.get_player_by_name(self._driver)
|
||||
if player then
|
||||
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}))
|
||||
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
|
||||
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")
|
||||
|
||||
|
||||
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
|
||||
|
||||
|
||||
if g ~= self._railtype and self._railtype ~= nil then
|
||||
-- Detach driver
|
||||
if player then
|
||||
|
@ -300,8 +289,12 @@ local function register_entity(entity_id, mesh, textures, drop, on_rightclick, o
|
|||
end
|
||||
end
|
||||
|
||||
if self._punched then
|
||||
if update.vel 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
|
||||
|
@ -626,17 +619,14 @@ register_minecart(
|
|||
"mcl_minecarts_minecart_normal.png",
|
||||
{"mcl_minecarts:minecart"},
|
||||
function(self, clicker)
|
||||
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
|
||||
if not clicker or not clicker:is_player() then return end
|
||||
if clicker == self._driver then
|
||||
detach_driver(self)
|
||||
elseif not self._driver then
|
||||
self._driver = player_name
|
||||
else
|
||||
local name = clicker:get_player_name()
|
||||
self._driver = clicker
|
||||
self._start_pos = self.object:get_pos()
|
||||
mcl_player.player_attached[player_name] = true
|
||||
mcl_player.player_attached[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)
|
||||
|
@ -647,6 +637,7 @@ 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
|
||||
)
|
||||
|
|
|
@ -1,4 +1 @@
|
|||
name = mcl_minecarts
|
||||
description = Minecarts are vehicles to move players quickly on rails.
|
||||
depends = mcl_explosions, mcl_core, mcl_sounds, mcl_player, mcl_achievements, mcl_chests, mcl_furnaces, mesecons_commandblock, mcl_hoppers, mcl_tnt, mesecons
|
||||
optional_depends = doc_identifier
|
||||
|
|
|
@ -14,8 +14,6 @@ local DEFAULT_FALL_SPEED = -10
|
|||
local FLOP_HEIGHT = 5.0
|
||||
local FLOP_HOR_SPEED = 1.5
|
||||
|
||||
local LIGHT_SUN = minetest.LIGHT_MAX + 1
|
||||
|
||||
local MOB_CAP = {}
|
||||
MOB_CAP.hostile = 70
|
||||
MOB_CAP.passive = 10
|
||||
|
@ -1059,7 +1057,7 @@ local do_env_damage = function(self)
|
|||
if mod_worlds then
|
||||
_, dim = mcl_worlds.y_to_layer(pos.y)
|
||||
end
|
||||
if (self.sunlight_damage ~= 0 or self.ignited_by_sunlight) and (minetest.get_node_light(pos) or 0) == LIGHT_SUN and dim == "overworld" then
|
||||
if (self.sunlight_damage ~= 0 or self.ignited_by_sunlight) and (minetest.get_node_light(pos) or 0) >= minetest.LIGHT_MAX and dim == "overworld" then
|
||||
if self.ignited_by_sunlight then
|
||||
mcl_burning.set_on_fire(self.object, 10)
|
||||
else
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Adds a mob API for mods to add animals or monsters, etc.
|
|
@ -1,4 +1,3 @@
|
|||
name = mcl_mobs
|
||||
depends = mcl_particles
|
||||
optional_depends = mcl_weather, mcl_explosions, mcl_hunger, mcl_worlds, invisibility, lucky_block, cmi, doc_identifier, mcl_armor, mcl_portals, mcl_experience
|
||||
description = Adds a mob API for mods to add animals or monsters, etc.
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
mcl_init
|
||||
mcl_particles
|
||||
default?
|
||||
mcl_mobs
|
||||
mcl_tnt?
|
||||
mcl_bows?
|
||||
mcl_throwing?
|
||||
mcl_fishing?
|
||||
bones?
|
||||
mesecons_materials?
|
||||
mobs_mc_gameconfig?
|
||||
doc_items?
|
|
@ -0,0 +1 @@
|
|||
Adds Minecraft-like monsters and animals.
|
|
@ -28,7 +28,6 @@ Pig=Schwein
|
|||
Polar Bear=Eisbär
|
||||
Rabbit=Kaninchen
|
||||
Killer Bunny=Killerkaninchen
|
||||
The Killer Bunny=Das Killerkaninchen
|
||||
Sheep=Schaf
|
||||
Shulker=Shulker
|
||||
Silverfish=Silberfischchen
|
||||
|
|
|
@ -28,7 +28,6 @@ Pig=Cerdo
|
|||
Polar Bear=Oso polar
|
||||
Rabbit=Conejo
|
||||
Killer Bunny=Conejo asesino
|
||||
The Killer Bunny=El Conejo asesino
|
||||
Sheep=Oveja
|
||||
Shulker=Shulker
|
||||
Silverfish=Lepisma
|
||||
|
|
|
@ -28,7 +28,6 @@ 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
|
||||
|
|
|
@ -28,7 +28,6 @@ Pig=Свинья
|
|||
Polar Bear=Полярный медведь
|
||||
Rabbit=Кролик
|
||||
Killer Bunny=Кролик-убийца
|
||||
The Killer Bunny=Кролик-убийца
|
||||
Sheep=Овца
|
||||
Shulker=Шалкер
|
||||
Silverfish=Чешуйница
|
||||
|
|
|
@ -1,4 +1 @@
|
|||
name = mobs_mc
|
||||
description = Adds Minecraft-like monsters and animals.
|
||||
depends = mcl_init, mcl_particles, mcl_mobs
|
||||
optional_depends = default, mcl_tnt, mcl_bows, mcl_throwing, mcl_fishing, bones, mesecons_materials, mobs_mc_gameconfig, doc_items
|
||||
|
|
|
@ -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 = S("The Killer Bunny")
|
||||
self.nametag = "The Killer Bunny"
|
||||
self._killer_bunny_nametag_set = true
|
||||
end
|
||||
end
|
||||
|
|
|
@ -123,10 +123,6 @@ mobs:register_mob("mobs_mc:snowman", {
|
|||
local pos = self.object:get_pos()
|
||||
minetest.sound_play("mcl_tools_shears_cut", {pos = pos}, true)
|
||||
|
||||
if minetest.registered_items["mcl_farming:pumpkin_face"] then
|
||||
minetest.add_item({x=pos.x, y=pos.y+1.4, z=pos.z}, "mcl_farming:pumpkin_face")
|
||||
end
|
||||
|
||||
-- Wear out
|
||||
if not minetest.is_creative_enabled(clicker:get_player_name()) then
|
||||
item:add_wear(mobs_mc.misc.shears_wear)
|
||||
|
|
|
@ -74,7 +74,7 @@ local professions = {
|
|||
},
|
||||
|
||||
{
|
||||
{ { "mcl_farming:pumpkin", 8, 13 }, E1 },
|
||||
{ { "mcl_farming:pumpkin_face", 8, 13 }, E1 },
|
||||
{ E1, { "mcl_farming:pumpkin_pie", 2, 3} },
|
||||
},
|
||||
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
mcl_init
|
||||
mcl_core
|
|
@ -1,2 +0,0 @@
|
|||
name = mobs_mc_gameconfig
|
||||
depends = mcl_init, mcl_core
|
|
@ -0,0 +1,2 @@
|
|||
mcl_fire
|
||||
mcl_death_messages?
|
|
@ -0,0 +1 @@
|
|||
A mod that adds thunder and lightning effects.
|
|
@ -1,4 +1 @@
|
|||
name = lightning
|
||||
description = A mod that adds thunder and lightning effects.
|
||||
depends = mcl_fire
|
||||
optional_depends = mcl_death_messages
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
mcl_worlds
|
||||
mcl_death_messages
|
|
@ -0,0 +1 @@
|
|||
Deal damage to entities stuck in the deep void
|
|
@ -1,3 +1 @@
|
|||
name = mcl_void_damage
|
||||
description = Deal damage to entities stuck in the deep void
|
||||
depends = mcl_worlds, mcl_death_messages
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
mcl_init
|
||||
mcl_worlds
|
||||
lightning?
|
|
@ -0,0 +1 @@
|
|||
Weather and sky handling: Rain, snow, thunderstorm, End and Nether ambience
|
|
@ -1,4 +1 @@
|
|||
name = mcl_weather
|
||||
description = Weather and sky handling: Rain, snow, thunderstorm, End and Nether ambience
|
||||
depends = mcl_init, mcl_worlds
|
||||
optional_depends = lightning
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Provides an extensible in-game help with texts about gameplay basics (such a crafting), items and advanced usage.
|
|
@ -1,2 +0,0 @@
|
|||
name = doc
|
||||
description = Provides an extensible in-game help with texts about gameplay basics (such a crafting), items and advanced usage.
|
|
@ -0,0 +1,6 @@
|
|||
mcl_core
|
||||
mcl_compass
|
||||
mcl_clock
|
||||
doc
|
||||
sfinv?
|
||||
sfinv_buttons?
|
|
@ -0,0 +1,2 @@
|
|||
The most comprehensive Crafting Guide
|
||||
on Minetest.
|
|
@ -1,5 +1 @@
|
|||
name = mcl_craftguide
|
||||
description = The most comprehensive Crafting Guide
|
||||
on Minetest.
|
||||
depends = mcl_core, mcl_compass, mcl_clock, doc
|
||||
optional_depends = sfinv, sfinv_buttons
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
doc
|
||||
doc_items
|
|
@ -0,0 +1 @@
|
|||
This MineClone 2 mod sets up and configures the Help modpack mods to tailor the help towards MineClone 2.
|
|
@ -1,3 +1 @@
|
|||
name = mcl_doc
|
||||
description = This MineClone 2 mod sets up and configures the Help modpack mods to tailor the help towards MineClone 2.
|
||||
depends = doc, doc_items
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
tt
|
||||
mcl_enchanting
|
|
@ -1,2 +0,0 @@
|
|||
name = mcl_tt
|
||||
depends = tt, mcl_enchanting
|
|
@ -0,0 +1,2 @@
|
|||
sfinv?
|
||||
unified_inventory?
|
|
@ -0,0 +1 @@
|
|||
Adds achievements to Minetest, and an API to register new ones.
|
|
@ -5,4 +5,3 @@ description = Adds achievements to Minetest, and an API to register new ones.
|
|||
license = LGPL 2.1 or later
|
||||
forum = https://forum.minetest.net/viewtopic.php?t=4870
|
||||
version = 2.3.0
|
||||
optional_depends = sfinv, unified_inventory
|
||||
|
|
|
@ -413,7 +413,6 @@ function hb.hide_hudbar(player, identifier)
|
|||
local name = player:get_player_name()
|
||||
local hudtable = hb.get_hudtable(identifier)
|
||||
if hudtable == nil then return false end
|
||||
if hudtable.hudstate[name].hidden == true then return true end
|
||||
if hb.settings.bar_type == "progress_bar" then
|
||||
if hudtable.hudids[name].icon ~= nil then
|
||||
player:hud_change(hudtable.hudids[name].icon, "scale", {x=0,y=0})
|
||||
|
@ -432,7 +431,6 @@ function hb.unhide_hudbar(player, identifier)
|
|||
local name = player:get_player_name()
|
||||
local hudtable = hb.get_hudtable(identifier)
|
||||
if hudtable == nil then return false end
|
||||
if hudtable.hudstate[name].hidden == false then return true end
|
||||
local value = hudtable.hudstate[name].value
|
||||
local max = hudtable.hudstate[name].max
|
||||
if hb.settings.bar_type == "progress_bar" then
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
awards
|
|
@ -1,2 +1 @@
|
|||
name = mcl_achievements
|
||||
depends = awards
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Provides core textures needed by Minetest.
|
|
@ -1,2 +1 @@
|
|||
name = mcl_base_textures
|
||||
description = Provides core textures needed by Minetest.
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue