Compare commits
16 Commits
master
...
mobs_head_
Author | SHA1 | Date |
---|---|---|
epCode | e5ff73af3a | |
epCode | d0d7facfd7 | |
epCode | 65b0908135 | |
epCode | 7d68c4faf3 | |
epCode | 7eee604074 | |
epCode | e5a090168f | |
epCode | 7e14870e38 | |
epCode | daa8a5c3ea | |
epCode | 2909de882a | |
epCode | 1d4046beea | |
epCode | cbb4c93e0c | |
epCode | 761cb8b366 | |
epCode | 9ece73a92f | |
epCode | b991bb5291 | |
epCode | 36ddec9812 | |
epCode | a2a06cc3ee |
|
@ -1,12 +0,0 @@
|
|||
root = true
|
||||
|
||||
[*]
|
||||
end_of_line = lf
|
||||
|
||||
[*.lua]
|
||||
charset = utf8
|
||||
indent_style = tab
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
keep_one_space_between_table_and_bracket = false
|
||||
spaces_around_operators = true
|
|
@ -1,36 +0,0 @@
|
|||
---
|
||||
|
||||
name: "Bug report"
|
||||
about: "File a bug report"
|
||||
labels:
|
||||
|
||||
- unconfirmed
|
||||
- bug
|
||||
|
||||
---
|
||||
|
||||
<!--
|
||||
Thanks for taking the time to fill out this bug report!
|
||||
|
||||
Please follow our contributing guidelines first:
|
||||
https://git.minetest.land/MineClone2/MineClone2/src/branch/master/CONTRIBUTING.md#rules-about-both-bugs-and-feature-requests
|
||||
|
||||
By submitting this issue, you agree to follow our Code of Conduct:
|
||||
https://git.minetest.land/MineClone2/MineClone2/src/branch/master/CODE_OF_CONDUCT.md
|
||||
-->
|
||||
|
||||
<!--
|
||||
What version of MineClone2 are you using? We do not provide support for outdated versions of MineClone2.
|
||||
Current latest version is listed here, at the top:
|
||||
https://git.minetest.land/MineClone2/MineClone2/tags
|
||||
-->
|
||||
MineClone2 version:
|
||||
|
||||
### What happened?
|
||||
Report about the bug! Please send large log snippets as an attachement file.
|
||||
|
||||
### What should happen:
|
||||
Tell us what should happen!
|
||||
|
||||
### Steps to reproduce
|
||||
Tell us how we can reproduce the bug!
|
|
@ -1,26 +0,0 @@
|
|||
---
|
||||
|
||||
name: "Feature request"
|
||||
about: "File a feature request not in Minecraft"
|
||||
labels:
|
||||
|
||||
- "non-Minecraft feature"
|
||||
- "needs discussion"
|
||||
|
||||
---
|
||||
|
||||
<!--
|
||||
Got a new non-Minecraft feature request? Explain to us why we should consider your idea.
|
||||
|
||||
Please follow our contributing guidelines first:
|
||||
https://git.minetest.land/MineClone2/MineClone2/src/branch/master/CONTRIBUTING.md#rules-about-both-bugs-and-feature-requests
|
||||
|
||||
By submitting this issue, you agree to follow our Code of Conduct:
|
||||
https://git.minetest.land/MineClone2/MineClone2/src/branch/master/CODE_OF_CONDUCT.md
|
||||
-->
|
||||
|
||||
### Feature
|
||||
Tell us about your requested feature not in Minecraft!
|
||||
|
||||
### Why
|
||||
Tell us why should we implement it!
|
|
@ -1,25 +0,0 @@
|
|||
---
|
||||
|
||||
name: "Missing Feature request"
|
||||
about: "File a missing feature request in Minecraft but not in MineClone2"
|
||||
labels:
|
||||
|
||||
- "missing feature"
|
||||
|
||||
---
|
||||
|
||||
<!--
|
||||
Thanks for taking the time to fill out this missing feature request!
|
||||
|
||||
Please follow our contributing guidelines first:
|
||||
https://git.minetest.land/MineClone2/MineClone2/src/branch/master/CONTRIBUTING.md#rules-about-both-bugs-and-feature-requests
|
||||
|
||||
By submitting this issue, you agree to follow our Code of Conduct:
|
||||
https://git.minetest.land/MineClone2/MineClone2/src/branch/master/CODE_OF_CONDUCT.md
|
||||
-->
|
||||
|
||||
### Current feature in Minecraft
|
||||
Tell us about the feature currently in Minecraft! What is it like on Minecraft?
|
||||
|
||||
### Current feature in MineClone2
|
||||
Tell us about the feature currently in MineClone2! What is different?
|
|
@ -1,20 +0,0 @@
|
|||
---
|
||||
|
||||
name: "Pull request"
|
||||
about: "Submit a pull request"
|
||||
labels:
|
||||
|
||||
---
|
||||
|
||||
<!--
|
||||
Please follow our contributing guidelines first:
|
||||
https://git.minetest.land/MineClone2/MineClone2/src/branch/master/CONTRIBUTING.md#how-you-can-help-as-a-programmer
|
||||
|
||||
By submitting this pull request, you agree to follow our Code of Conduct:
|
||||
https://git.minetest.land/MineClone2/MineClone2/src/branch/master/CODE_OF_CONDUCT.md
|
||||
-->
|
||||
|
||||
Tell us about your pull request! Reference related issues, if necessary
|
||||
|
||||
### Testing
|
||||
Tell us how to test your changes!
|
|
@ -3,5 +3,3 @@
|
|||
*.blend1
|
||||
*.blend2
|
||||
*.blend3
|
||||
/.idea/
|
||||
*.xcf
|
2
API.md
|
@ -42,7 +42,7 @@ A lot of things are possible by using one of the APIs in the mods. Note that not
|
|||
* Buckets: `ITEMS/mcl_buckets`
|
||||
* Dispenser support: `ITEMS/REDSTONE/mcl_dispensers`
|
||||
|
||||
### Mobs
|
||||
## Mobs
|
||||
* Mobs: `ENTITIES/mcl_mobs`
|
||||
|
||||
MineClone 2 uses its own mobs framework, called “Mobs Redo: MineClone 2 Edition” or “MRM” for short.
|
||||
|
|
|
@ -60,7 +60,7 @@ representative at an online or offline event.
|
|||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||
reported to the community leaders responsible for enforcement at
|
||||
ancientmariner_dev@proton.me.
|
||||
eliasfleckenstein@web.de.
|
||||
All complaints will be reviewed and investigated promptly and fairly.
|
||||
|
||||
All community leaders are obligated to respect the privacy and security of the
|
||||
|
|
123
CONTRIBUTING.md
|
@ -2,7 +2,7 @@
|
|||
So you want to contribute to MineClone2?
|
||||
Wow, thank you! :-)
|
||||
|
||||
MineClone2 is maintained by Nicu and Cora. If you have any
|
||||
MineClone2 is maintained by Nicu and Fleckenstein. If you have any
|
||||
problems or questions, contact us (See Links section below).
|
||||
|
||||
You can help with MineClone2's development in many different ways,
|
||||
|
@ -11,9 +11,18 @@ whether you're a programmer or not.
|
|||
## MineClone2's development target is to...
|
||||
- Crucially, create a stable, moddable, free/libre clone of Minecraft
|
||||
based on the Minetest engine with polished features, usable in both
|
||||
singleplayer and multiplayer. Currently, a lot of Minecraft features
|
||||
are already implemented.
|
||||
Polishing existing features is always welcome.
|
||||
singleplayer and multiplayer. Currently, most of **Minecraft Java
|
||||
Edition 1.12.2** features are already implemented and polishing existing
|
||||
features are prioritized over new feature requests.
|
||||
- With lessened priority yet strictly, implement features targetting
|
||||
**Minecraft version 1.17 + OptiFine** (OptiFine only as far as supported
|
||||
by the Minetest Engine). This means features in parity with the listed
|
||||
Minecraft experiences are prioritized over those that don't fulfill this
|
||||
scope.
|
||||
- Optionally, create a performant experience that will run relatively
|
||||
well on really low spec computers. Unfortunately, due to Minecraft's
|
||||
mechanisms and Minetest engine's limitations along with a very small
|
||||
playerbase on low spec computers, optimizations are hard to investigate.
|
||||
|
||||
## Links
|
||||
* [Mesehub](https://git.minetest.land/MineClone2/MineClone2)
|
||||
|
@ -36,10 +45,8 @@ referenced frequently because of its usefulness. As such, it is valuable
|
|||
in learning how git works and its terminology. It can also help you
|
||||
keeping your game updated, and easily test pull requests.
|
||||
|
||||
Look at our wiki for some concrete guides:
|
||||
https://git.minetest.land/MineClone2/MineClone2/wiki/
|
||||
|
||||
## How you can help as a non-programmer
|
||||
|
||||
As someone who does not know how to write programs in Lua or does not
|
||||
know how to use the Minetest API, you can still help us out a lot. For
|
||||
example, by opening an issue in the
|
||||
|
@ -51,10 +58,12 @@ you can report a bug or request a feature.
|
|||
discussion.
|
||||
* Choose a descriptive title (e.g. not just "crash", "bug" or "question"
|
||||
).
|
||||
* Please write in plain, understandable English. It will be easier to
|
||||
communicate.
|
||||
* Please start the issue title with a capital letter.
|
||||
* Always check the currently opened issues before creating a new one.
|
||||
Try not to report bugs that have already been reported or request features
|
||||
that already have been requested. This can often be ambiguous though.
|
||||
If in doubt open an issue!
|
||||
Don't report bugs that have already been reported or request features
|
||||
that already have been requested.
|
||||
* If you know about Minetest's inner workings, please think about
|
||||
whether the bug / the feature that you are reporting / requesting is
|
||||
actually an issue with Minetest itself, and if it is, head to the
|
||||
|
@ -64,9 +73,6 @@ instead.
|
|||
an issue, feel free to ask on the Discord / Matrix server or the IRC
|
||||
channel.
|
||||
|
||||
The link to the mesehub registration page is: https://git.minetest.land/user/sign_up
|
||||
(It appears to sometimes get lost on the page itsself)
|
||||
|
||||
### Reporting bugs
|
||||
* A bug is an unintended behavior or, in the worst case, a crash.
|
||||
However, it is not a bug if you believe something is missing in the
|
||||
|
@ -105,28 +111,23 @@ would report issues will pull requests similar to when you were
|
|||
reporting bugs that are the mainline (See Reporting bugs section). You
|
||||
can find currently open pull requests here:
|
||||
<https://git.minetest.land/MineClone2/MineClone2/pulls>. Note that pull
|
||||
requests that start with a `WIP:` are not done yet and therefore could
|
||||
still undergo substantial change. Testing these is still helpful however
|
||||
because that is the reason developers put them up as WIP so other people
|
||||
can have a look at the PR.
|
||||
requests that start with a `WIP:` are not done yet, and therefore might
|
||||
not work, so it's not very useful to try them out yet.
|
||||
|
||||
### Contributing assets
|
||||
Due to license problems, MineClone2 cannot use Minecraft's assets,
|
||||
therefore we are always looking for asset contributions.
|
||||
|
||||
To contribute assets, it can be useful to learn git basics and read
|
||||
the section for Programmers of this document, however this is not required.
|
||||
It's also a good idea to join the Discord server
|
||||
Due to license problems, MineClone2 unfortunately cannot use
|
||||
Minecraft's assets, therefore we are always looking for asset
|
||||
contributions. To contribute assets, it can be useful to learn git
|
||||
basics and read the section for Programmers of this document, however
|
||||
this is not required. It's also a good idea to join the Discord server
|
||||
(or alternatively IRC or Matrix).
|
||||
|
||||
#### Textures
|
||||
For textures we use the Pixel Perfection texture pack. For older Minecraft
|
||||
features that is mostly enough but a lot of the newer textures in it are
|
||||
copies or slight modifications of the original MC textures so great caution
|
||||
needs to be taken when using any textures coming from Minecraft texture
|
||||
packs.
|
||||
If you want to make such contributions, join our Discord server. Demands
|
||||
for textures will be communicated there.
|
||||
For textures we use the Pixel Perfection texture pack. This is mostly
|
||||
enough; however in some cases - e.g. for newer Minecraft features, it's
|
||||
useful to have texture artists around. If you want to make such
|
||||
contributions, join our Discord server. Demands for textures will be
|
||||
communicated there.
|
||||
|
||||
#### Sounds
|
||||
MineClone2 currently does not have a consistent way to handle sounds.
|
||||
|
@ -250,25 +251,16 @@ of the results)
|
|||
* [Official Minecraft Wiki](https://minecraft.fandom.com/wiki/Minecraft_Wiki)
|
||||
(Include a link to the specific page you used)
|
||||
|
||||
### Guidelines
|
||||
### Stick to our guidelines
|
||||
|
||||
#### Git Guidelines
|
||||
* Pushing to master is disabled - don't even try it.
|
||||
* Every change is tracked as a PR.
|
||||
* All but the tiniest changes require at least one approval from a Developer
|
||||
* To update branches we use rebase not merge (so we don't end up with
|
||||
excessive git bureaucracy commits in master)
|
||||
* We use merge to add the commits from a PR/branch to master
|
||||
* Submodules should only be used if a) upstream is highly reliable and
|
||||
b) it is 100% certain that no mcl2 specific changes to the code will be
|
||||
needed (this has never been the case before, hence mcl2 is submodule free so far)
|
||||
* Commit messages should be descriptive and never contain mcl2 specific
|
||||
issueids - there are other projects who might use commits from mcl2 and
|
||||
it will confuse their issue trackers.
|
||||
* Try to group your submissions best as you can:
|
||||
* Try to keep your PRs small: In some cases things reasonably be can't
|
||||
split up but in general multiple small PRs are better than a big one.
|
||||
* Similarly multiple small commits are better than a giant one. (use git commit -p)
|
||||
* We use merge rather than rebase or squash merge
|
||||
* We don't use git submodules.
|
||||
* Your commit names should be relatively descriptive, e.g. when saying
|
||||
"Fix #issueid", the commit message should also contain the title of the
|
||||
issue.
|
||||
* Try to keep your commits as atomic as possible (advise, but completely
|
||||
optional)
|
||||
|
||||
#### Code Guidelines
|
||||
* Each mod must provide `mod.conf`.
|
||||
|
@ -351,23 +343,36 @@ Active and trusted contributors are often granted write access to the
|
|||
MineClone2 repository.
|
||||
|
||||
#### Developer responsibilities
|
||||
- If you have developer privileges you can just open a new branch in the
|
||||
mcl2 repository (which is preferred). From that you create a pull request.
|
||||
This way other people can review your changes and make sure they work
|
||||
before they get merged.
|
||||
- If you do not (yet) have developer privs you do your work on a branch
|
||||
on your private repository e.g. using the "fork" function on mesehub.
|
||||
- Any developer is welcome to review, test and merge PRs. A PR needs
|
||||
at least one approval (by someone else than the author) but the maintainers
|
||||
are usually relatively quick to react to new submissions.
|
||||
- You should not push things directly to
|
||||
MineClone2 master - rather, do your work on a branch on your private
|
||||
repository, then create a pull request. This way other people can review
|
||||
your changes and make sure they work before they get merged.
|
||||
- Merge PRs only when they have recieved the necessary feedback and have
|
||||
been tested by at least two different people (including the author of
|
||||
the pull request), to avoid crashes or the introduction of new bugs.
|
||||
- You may also be assigned to issues or pull
|
||||
requests as a developer. In this case it is your responsibility to fix
|
||||
the issue / review and merge the pull request when it is ready. You can
|
||||
also unassign yourself from the issue / PR if you have no time or don't
|
||||
want to take care of it for some other reason. After all, everyone is a
|
||||
volunteer and we can't expect you to do work that you are not interested
|
||||
in. **The important thing is that you make sure to inform us if you
|
||||
won't take care of something that has been assigned to you.**
|
||||
- Please assign yourself to something that you want to work on to avoid
|
||||
duplicate work.
|
||||
- As a developer, it should be easy to reach you about your work. You
|
||||
should be in at least one of the public MineClone2 discussion rooms -
|
||||
preferrably Discord, but if you really don't like Discord, Matrix
|
||||
or IRC are fine too.
|
||||
|
||||
### Maintainer status
|
||||
Maintainers carry the main responsibility for the project.
|
||||
|
||||
#### Maintainer responsibilities
|
||||
- Making sure issues are addressed and pull requests are reviewed and
|
||||
merged.
|
||||
merged, by assigning either themselves or Developers to issues / PRs
|
||||
- Making releases
|
||||
- Making sure guidelines are kept
|
||||
- Making project decisions based on community feedback
|
||||
- Granting/revoking developer access
|
||||
- Enforcing the code of conduct (See CODE_OF_CONDUCT.md)
|
||||
|
@ -375,8 +380,8 @@ merged.
|
|||
- Resolving conflicts and problems within the community
|
||||
|
||||
#### Current maintainers
|
||||
* Cora - responsible for gameplay review, publishing releases,
|
||||
technical guidelines
|
||||
* Fleckenstein - responsible for gameplay review, publishing releases,
|
||||
technical guidelines and issue/PR delegation
|
||||
* Nicu - responsible for community related issues
|
||||
|
||||
#### Release process
|
||||
|
|
55
CREDITS.md
|
@ -8,13 +8,12 @@
|
|||
|
||||
|
||||
## Maintainers
|
||||
* AncientMariner
|
||||
* Nicu
|
||||
* cora
|
||||
|
||||
## Previous Maintainers
|
||||
* Fleckenstein
|
||||
* jordan4ibanez
|
||||
* cora
|
||||
|
||||
## Developers
|
||||
* bzoss
|
||||
|
@ -28,15 +27,6 @@
|
|||
* Code-Sploit
|
||||
* NO11
|
||||
* kabou
|
||||
* rudzik8
|
||||
* chmodsayshello
|
||||
* PrairieWind
|
||||
* RandomLegoBrick
|
||||
* SumianVoice
|
||||
* MrRar
|
||||
* talamh
|
||||
* Faerraven / Michieal
|
||||
* FossFanatic
|
||||
|
||||
## Contributors
|
||||
* Laurent Rocher
|
||||
|
@ -70,6 +60,7 @@
|
|||
* Benjamin Schötz
|
||||
* Doloment
|
||||
* Sydney Gems
|
||||
* talamh
|
||||
* Emily2255
|
||||
* Emojigit
|
||||
* FinishedFragment
|
||||
|
@ -80,25 +71,6 @@
|
|||
* Sven792
|
||||
* aldum
|
||||
* Dieter44
|
||||
* Pepebotella
|
||||
* MrRar
|
||||
* Lazerbeak12345
|
||||
* mrminer
|
||||
* Thunder1035
|
||||
* opfromthestart
|
||||
* snowyu
|
||||
* FaceDeer
|
||||
* Faerraven / Michieal
|
||||
* FossFanatic
|
||||
* Herbert West
|
||||
* GuyLiner
|
||||
* 3raven
|
||||
* anarquimico
|
||||
* TheOnlyJoeEnderman
|
||||
* Ranko Saotome
|
||||
* Gregor Parzefall
|
||||
* Wbjitscool
|
||||
* b3nderman
|
||||
|
||||
## MineClone5
|
||||
* kay27
|
||||
|
@ -106,12 +78,10 @@
|
|||
* epCode
|
||||
* NO11
|
||||
* j45
|
||||
* chmodsayshello
|
||||
* 3raven
|
||||
* PrairieWind
|
||||
* Gustavo6046 / wallabra
|
||||
* PrarieWind
|
||||
* Gustavo1
|
||||
* CableGuy67
|
||||
* MrRar
|
||||
|
||||
## Mineclonia
|
||||
* erlehmann
|
||||
|
@ -149,14 +119,11 @@
|
|||
* 4Evergreen4
|
||||
* jordan4ibanez
|
||||
* paramat
|
||||
* cora
|
||||
* Faerraven / Michieal
|
||||
|
||||
## 3D Models
|
||||
* 22i
|
||||
* tobyplowy
|
||||
* epCode
|
||||
* Faerraven / Michieal
|
||||
|
||||
## Textures
|
||||
* XSSheep
|
||||
|
@ -167,11 +134,6 @@
|
|||
* yutyo
|
||||
* NO11
|
||||
* kay27
|
||||
* MysticTempest
|
||||
* RandomLegoBrick
|
||||
* cora
|
||||
* Faerraven / Michieal
|
||||
* Nicu
|
||||
|
||||
## Translations
|
||||
* Wuzzy
|
||||
|
@ -181,21 +143,12 @@
|
|||
* pitchum
|
||||
* todoporlalibertad
|
||||
* Marcin Serwin
|
||||
* Pepebotella
|
||||
* Emojigit
|
||||
* snowyu
|
||||
* 3raven
|
||||
* SakuraRiu
|
||||
|
||||
## Funders
|
||||
* 40W
|
||||
* bauknecht
|
||||
* Cora
|
||||
|
||||
## Special thanks
|
||||
* celeron55 for creating Minetest
|
||||
* Jordach for the jukebox music compilation from Big Freaking Dig
|
||||
* wsor for working tirelessly in the shadows for the good of all of us, particularly helping with solving contentDB and copyright issues.
|
||||
* 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
|
||||
* Dark Reaven Music (https://soundcloud.com/dark-reaven-music) for the main menu theme (Calmed Cube), which is licensed under https://creativecommons.org/licenses/by-sa/3.0/
|
||||
|
|
|
@ -74,8 +74,6 @@ Please read <http://minecraft.gamepedia.com/Breaking> to learn how digging times
|
|||
* `coral_species=X`: Specifies the species of a coral; equal X means equal species
|
||||
* `set_on_fire=X`: Sets any (not fire-resistant) mob or player on fire for X seconds when touching
|
||||
* `compostability=X`: Item can be used on a composter block; X (1-100) is the % chance of adding a level of compost
|
||||
* `leaves=X`: Node will spotaneously decay if no tree trunk nodes remain within 6 blocks distance.
|
||||
* `leaves_orphan`: See above, these nodes are in the process of decayed.
|
||||
|
||||
#### Footnotes
|
||||
|
||||
|
|
|
@ -1,21 +0,0 @@
|
|||
Survive, farm, build, explore, play with friends, and do much more. Inspired by a well known block game, pushing beyond.
|
||||
|
||||
How to play:
|
||||
|
||||
#### Download Minetest
|
||||
- Navigate to https://www.minetest.net/ to download the client.
|
||||
- Once installed, open and select the "Content" tab
|
||||
|
||||
#### Install MineClone2 from ContentDB
|
||||
- Click "Browse Online Content" and filter by Games (select "Games" from the dropdown box)
|
||||
- Find "MineClone2" (should be first on the list or on the first page)
|
||||
- Click the [+] button next to MineClone2 and wait for download to finish
|
||||
- Click "Back to Main Menu"
|
||||
|
||||
#### Create new world and play
|
||||
- Click "Start Game" tab
|
||||
- At the bottom click the MineClone2 icon (the 2 dirt with grass blocks)
|
||||
- Click "New", give your world a name
|
||||
- You can leave seed blank or put in a word of your choice
|
||||
- Select your new world
|
||||
- Click "Play Game" and enjoy!
|
20
README.md
|
@ -2,6 +2,8 @@
|
|||
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.75 (in development)
|
||||
|
||||
### Gameplay
|
||||
You start in a randomly-generated world made entirely of cubes. You can explore
|
||||
the world and dig and build almost every block in the world to create new
|
||||
|
@ -89,11 +91,11 @@ The MineClone2 repository is hosted at Mesehub. To contribute or report issues,
|
|||
## Target
|
||||
- Crucially, create a stable, moddable, free/libre clone of Minecraft
|
||||
based on the Minetest engine with polished features, usable in both
|
||||
singleplayer and multiplayer. Currently, a lot of **Minecraft Java
|
||||
Edition** features are already implemented and polishing existing
|
||||
singleplayer and multiplayer. Currently, most of **Minecraft Java
|
||||
Edition 1.12.2** features are already implemented and polishing existing
|
||||
features are prioritized over new feature requests.
|
||||
- With lessened priority yet strictly, implement features targetting
|
||||
**Current Minecraft versions + OptiFine** (OptiFine only as far as supported
|
||||
**Minecraft version 1.17 + OptiFine** (OptiFine only as far as supported
|
||||
by the Minetest Engine). This means features in parity with the listed
|
||||
Minecraft experiences are prioritized over those that don't fulfill this
|
||||
scope.
|
||||
|
@ -106,7 +108,8 @@ playerbase on low spec computers, optimizations are hard to investigate.
|
|||
This game is currently in **beta** stage.
|
||||
It is playable, but not yet feature-complete.
|
||||
Backwards-compability is not entirely guaranteed, updating your world might cause small bugs.
|
||||
If you want to use the development version of MineClone2 in production, the master branch is usually relatively stable. The testing branch often features some experimental PRs and should be considered less stable.
|
||||
If you want to use the git version of MineClone2 in production, consider using the production branch.
|
||||
It is updated weekly and contains relatively stable code for servers.
|
||||
|
||||
The following main features are available:
|
||||
|
||||
|
@ -121,7 +124,7 @@ The following main features are available:
|
|||
* Most blocks in the overworld
|
||||
* Water and lava
|
||||
* Weather
|
||||
* 28 biomes + 5 Nether Biomes
|
||||
* 28 biomes
|
||||
* The Nether, a fiery underworld in another dimension
|
||||
* Redstone circuits (partially)
|
||||
* Minecarts (partial)
|
||||
|
@ -156,10 +159,10 @@ The following features are incomplete:
|
|||
|
||||
* Some monsters and animals
|
||||
* Redstone-related things
|
||||
* Some special minecarts (hopper and chest minecarts work)
|
||||
* Special minecarts
|
||||
* A couple of non-trivial blocks and items
|
||||
|
||||
Bonus features (not found in Minecraft):
|
||||
Bonus features (not found in Minecraft 1.12):
|
||||
|
||||
* Built-in crafting guide which shows you crafting and smelting recipes
|
||||
* In-game help system containing extensive help about gameplay basics, blocks, items and more
|
||||
|
@ -172,9 +175,6 @@ Bonus features (not found in Minecraft):
|
|||
* Nether Brick Fence Gate
|
||||
* Red Nether Brick Fence
|
||||
* Red Nether Brick Fence Gate
|
||||
* Structure replacements - these small variants of Minecraft structures serve as replacements until we can get large structures working:
|
||||
* Woodland Cabin (Mansions)
|
||||
* Nether Outpost (Fortress)
|
||||
|
||||
Technical differences from Minecraft:
|
||||
|
||||
|
|
|
@ -1,170 +0,0 @@
|
|||
# MineClone2
|
||||
Un jeu non-officiel similaire à Minecraft pour Minetest. Forké depuis Mineclone par davedevils. Développé par de nombreuses personnes. Ni développé ou supporté par Mojang AB.
|
||||
|
||||
Version: 0.79 (en dévelopment)
|
||||
|
||||
### Gameplay
|
||||
|
||||
Vous atterissez dans un monde fait entièrement de cubes et généré aléatoirement. Vous pouvez explorer le monde, miner et construire presque n'importe quel bloc pour créer de nouvelles structures. Vous pouvez choisir de jouer en "mode survie" dans lequel vous devez combattre des monstres et la faim et progresser lentement dans différents aspects du jeu, comme l'extraction de minerai, l'agriculture, la construction de machines et ainsi de suite. Ou alors vous pouvez jouer en "mode créatif" où vous pouvez construire à peu près n'importe quoi instantanément.
|
||||
|
||||
### Résumé du Gameplay
|
||||
|
||||
* Jeu de type bac-à-sable, sans objetifs
|
||||
* Survie : combattre des monstres hostiles et la faim
|
||||
* Creuser pour du minerai et d'autres trésors
|
||||
* Magie : gagner de l'expérience et enchanter les outils
|
||||
* Utiliser les blocs ramassés pour construire de magnifiques bâtiments, votre imagination est la limite
|
||||
* Ramasser des fleurs (et d'autres sources de teinture) et colorez votre monde
|
||||
* Trouvez des graines et commencez à cultiver
|
||||
* Trouvez ou fabriquez des centaines d'objets
|
||||
* Construisez un réseau ferroviaire complexe et amusez vous avec les wagonnets
|
||||
* En mode créatif vous pouvez construire presque n'importe quoi gratuitement et sans limite
|
||||
|
||||
## Comment jouer (démarrer rapidement)
|
||||
### Commencer
|
||||
* **Frappez un arbre** jusqu'à ce qu'il casse et donne du bois
|
||||
* Placez le **bois dans la grille 2x2** (la "grille de fabrication" de votre menu d'inventaire) et fabriquez 4 planches de bois
|
||||
* Placer les 4 planches de bois dans la grille 2x2 et **fabriquez une table d'artisanat**
|
||||
* **Cliquez droit la table d'artisanat** (icone livre) pour apprendre toutes les recettes possibles
|
||||
* **Fabriquez une pioche de bois** pour miner la pierre
|
||||
* Différents outils minent différentes sortes de blocs. Essayez les !
|
||||
* Continuez à jouer comme vous voulez. Amusez vous !
|
||||
|
||||
### Agriculture
|
||||
* Trouvez des graines
|
||||
* Fabriquez une houe
|
||||
* Cliquez droit la terre ou des blocs similaires avec la houe pour créer des terres agricoles
|
||||
* Placer des graines sur des terres agricoles et regardez les pousser
|
||||
* Récoltez les plantes une fois matûres
|
||||
* Les terres agricoles proche de l'eau deviennent humides et accélèrent la croissance
|
||||
|
||||
### Four
|
||||
* Fabriquer un Four
|
||||
* Le four permet d'obtenir plus d'objets
|
||||
* L'emplacement du haut doit contienir un objet fondable (par ex : minerai de fer)
|
||||
* L'emplacement du bas doit contienir un objet combustible (par ex : charbon)
|
||||
* Voir le guide d'artisanat pour en apprendre plus sur les objets fondables et combustibles
|
||||
|
||||
### Aide supplémentaire
|
||||
Plus d'aide à propos du jeu, des blocs, objets et plus encore peuvent être trouvés dans le jeu. Vous pouvez accéder à l'aide depuis le menu inventaire.
|
||||
|
||||
### Objets spéciaux
|
||||
Les objets suivants sont intéressants pour le mode Créatif et pour les constructeurs de cartes d'aventure. Ils ne peuvent être obtenus dans le jeu ou dans l'inventaire créatif.
|
||||
|
||||
* Barrière : `mcl_core:barrier`
|
||||
|
||||
Utilisez la commande de chat `/giveme` pour les obtenir. Voir l'aide interne au jeu pour une explication.
|
||||
|
||||
## Installation
|
||||
Ce jeu nécessite [Minetest](http://minetest.net) pour fonctionner (version 5.4.1 ou plus). Vous devez donc installer Minetest d'abord. Seules les versions stables de Minetest sont officielement supportées.
|
||||
Il n'y a pas de support de MineClone2 dans les versions développement de Minetest.
|
||||
|
||||
Pour installer MineClone2 (si ce n'est pas déjà fait), déplacez ce dossier dans le dossier “games” de Minetest. Consultez l'aide de Minetest pour en apprendre plus.
|
||||
|
||||
## Liens utiles
|
||||
Le dépôt de MineClone2 est hébergé sur Mesehub. Pour contribuer ou rapporter des problèmes, aller là-bas.
|
||||
|
||||
* Mesehub: <https://git.minetest.land/MineClone2/MineClone2>
|
||||
* Discord: <https://discord.gg/xE4z8EEpDC>
|
||||
* YouTube <https://www.youtube.com/channel/UClI_YcsXMF3KNeJtoBfnk9A>
|
||||
* IRC: <https://web.libera.chat/#mineclone2>
|
||||
* Matrix: <https://app.element.io/#/room/#mc2:matrix.org>
|
||||
* Reddit: <https://www.reddit.com/r/MineClone2/>
|
||||
* Minetest forums: <https://forum.minetest.net/viewtopic.php?f=50&t=16407>
|
||||
* ContentDB: <https://content.minetest.net/packages/wuzzy/mineclone2/>
|
||||
* OpenCollective: <https://opencollective.com/mineclone2>
|
||||
|
||||
## Objectif
|
||||
* Créer un clone stable, moddable, libre et gratuit basé sur le moteur de jeu Minetest avec des fonctionalités abouties, utilisable à la fois en mode solo et multijoueur. Actuellement, beaucoup des fonctionalités de **Minecraft Java Edition** sont déjà implémentées et leur amélioration est prioritaire sur les nouvelles demandes.
|
||||
* Avec une priorité moindre, implémenter les fonctionalités des versions **Minecraft + OptiFine** (OtiFine autant que supporté par le moteur Minetest). Cela signifie que les fonctionalités présentes dans les versions listées sont priorisées.
|
||||
* Dans l'idéal, créer une expérience performante qui tourne bien sur des ordinateurs à basse performance. Malheureusement, en raison des mécanismes de Minecraft et des limitations du moteur Minetest ainsi que de la petite taille de la communauté de joueurs sur des ordinateurs à basse performances, les optimisations sont difficiles à explorer.
|
||||
|
||||
## Statut de complétion
|
||||
Ce jeu est actuellement au stade **beta**.
|
||||
Il est jouable mais incomplet en fonctionalités.
|
||||
La rétro-compatibilité n'est pas entièrement garantie, mettre votre monde à jour peut causer de petits bugs.
|
||||
Si vous voulez utiliser la version de développement de MineClone2 en production, la branche master est habituellement relativement stable. Les branches de test fusionnent souvent des pull requests expérimentales et doivent être considérées comme moins stable.
|
||||
|
||||
Les principales fonctionalités suivantes sont disponibles :
|
||||
|
||||
* Outils, armes
|
||||
* Armure
|
||||
* Système de fabrication : grille 2x2, table d'artisanat (grille 3x3), four, incluant un guide de fabrication
|
||||
* Coffres, grands coffres, coffre ender, boite de shulker
|
||||
* Fours, entonnoirs
|
||||
* Faim
|
||||
* La plupart des monstres et animaux
|
||||
* Tout les minerais de Minecraft
|
||||
* La plupart des blocs de l'overworld
|
||||
* Eau et lave
|
||||
* Météo
|
||||
* 28 biomes + 5 biomes du nether
|
||||
* Le Nether, monde souterrain brûlant dans une autre dimension
|
||||
* Circuits Redstone (partiel)
|
||||
* Effets de Statut (partiel)
|
||||
* Expérience
|
||||
* Enchantement
|
||||
* Brassage, potions, flèches trempées (partiel)
|
||||
* Bâteaux
|
||||
* Feu
|
||||
* Blocs de construction : escaliers, dalles, portes, trappes, barrière, portillon, muret
|
||||
* Horloge
|
||||
* Boussole
|
||||
* Eponge
|
||||
* Bloc de slime
|
||||
* Petites plantes et pousses
|
||||
* Teintures
|
||||
* Bannières
|
||||
* Blocs de décoration : verre, verre teinté, vitres, barres de fer, terre cuites (et couleurs), têtes et plus
|
||||
* Cadres d'objets
|
||||
* Juke-boxes
|
||||
* Livres pour écrire
|
||||
* Commandes
|
||||
* Villages
|
||||
* L'End
|
||||
* et plus !
|
||||
|
||||
Les fonctionalités suivantes sont incomplètes :
|
||||
|
||||
* certains monstres et animaux
|
||||
* certains composants de Redstone
|
||||
* Wagonnets spéciaux
|
||||
* quelques blocs et objets non-triviaux
|
||||
|
||||
Fonctionalités bonus (absentes de Minecraft) :
|
||||
|
||||
* Guide d'artisanat intégré au jeu qui montre les recettes d'artisanat et de cuisson
|
||||
* Système d'aide intégré au jeu contenant des informations à propos des techniques de base, blocs, objets et plus
|
||||
* Recettes d'artisanat temporaires. Elles existent uniquement pour rendre des objets accessibles qui ne le seraient pas autrement sauf en mode créatif. Elles seront retirées au cours de l'avancement du développement et de l'ajout de nouvelles fonctionalités.
|
||||
* Pousses dans les coffres en mapgen v6
|
||||
* Entièrement moddable (grâce la puissante API lua de Minetest)
|
||||
* Nouveaux blocs et objets :
|
||||
* Outil de recherche, montre l'aide de ce qu'il touche
|
||||
* Plus de dalles et d'escaliers
|
||||
* Portillon en briques du Nether
|
||||
* Barrière en briques du Nether rouges
|
||||
* Portillon en briques du Nether rouges
|
||||
* Structures de remplacement - ces petites variantes de structures de Minecraft servent de remplacement en attendant qu'on arrive à en faire fonctionner de plus grandes :
|
||||
* Cabine dans les bois (Manoir des bois)
|
||||
* Avant-poste du Nether (Forteresse)
|
||||
|
||||
Différences techniques avec Minecraft :
|
||||
* Limite en hauteur de 31000 blocs (bien plus grand que Minecraft)
|
||||
* Taille horizontale du monde 62000×62000 blocs (bien plus petit que Minecraft mais toujours très grand)
|
||||
* Toujours assez incomplet et buggé
|
||||
* Des blocs, objets, ennemis et fonctionalités manquent
|
||||
* Quelques objets ont des noms légèrement différents pour être plus faciles à distinguer
|
||||
* Des musiques différentes pour le juke-boxe
|
||||
* Des textures différentes (Pixel Perfection)
|
||||
* Des sons différents (sources diverses)
|
||||
* Un moteur de jeu différent (Minetest)
|
||||
* Des bonus cachés différents
|
||||
...et enfin MineClone2 est un logiciel libre !
|
||||
|
||||
## Autres fichiers readme
|
||||
|
||||
* `LICENSE.txt`: Le texte de la license GPLv3
|
||||
* `CONTRIBUTING.md`: Information pour ceux qui veulent contribuer
|
||||
* `API.md`: Pour les modders Minetest qui veulent modder ce jeu
|
||||
* `LEGAL.md`: Information légale
|
||||
* `CREDITS.md`: Liste des contributeurs
|
22
RELEASE.md
|
@ -1,22 +0,0 @@
|
|||
#File to document release steps with a view to evolving into a script
|
||||
|
||||
#Update CREDITS.md
|
||||
#Update version in game.conf
|
||||
|
||||
lua tools/generate_ingame_credits.lua
|
||||
|
||||
git add CREDITS.md
|
||||
git add mods/HUD/mcl_credits/people.lua
|
||||
git add game.conf
|
||||
|
||||
#git add RELEASE.md
|
||||
|
||||
git commit -m "Pre-release update credits and set version 0.82.0"
|
||||
|
||||
git tag 0.82.0
|
||||
|
||||
git push origin 0.82.0
|
||||
|
||||
#Update version in game.conf to -SNAPSHOT
|
||||
|
||||
git commit -m "Post-release set version 0.82.0-SNAPSHOT"
|
|
@ -1,4 +1,2 @@
|
|||
title = MineClone 2
|
||||
description = A survival sandbox game. Survive, gather, hunt, build, explore, and do much more.
|
||||
disallowed_mapgens = v6
|
||||
version=0.82.0-SNAPSHOT
|
Before Width: | Height: | Size: 83 KiB |
Before Width: | Height: | Size: 1.1 MiB |
Before Width: | Height: | Size: 990 KiB |
Before Width: | Height: | Size: 1.3 MiB |
Before Width: | Height: | Size: 1.1 MiB |
Before Width: | Height: | Size: 1.7 MiB |
Before Width: | Height: | Size: 1.3 MiB |
Before Width: | Height: | Size: 1.6 MiB |
Before Width: | Height: | Size: 2.0 MiB |
Before Width: | Height: | Size: 865 KiB |
Before Width: | Height: | Size: 916 KiB |
Before Width: | Height: | Size: 606 KiB |
BIN
menu/footer.png
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 628 B |
Before Width: | Height: | Size: 82 KiB |
Before Width: | Height: | Size: 81 KiB |
Before Width: | Height: | Size: 82 KiB |
BIN
menu/header.png
Before Width: | Height: | Size: 82 KiB After Width: | Height: | Size: 76 KiB |
After Width: | Height: | Size: 68 KiB |
After Width: | Height: | Size: 119 KiB |
After Width: | Height: | Size: 121 KiB |
After Width: | Height: | Size: 118 KiB |
After Width: | Height: | Size: 122 KiB |
After Width: | Height: | Size: 91 KiB |
BIN
menu/theme.ogg
|
@ -204,7 +204,7 @@ 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, player)
|
||||
function mcl_autogroup.can_harvest(nodename, toolname)
|
||||
local ndef = minetest.registered_nodes[nodename]
|
||||
|
||||
if not ndef then
|
||||
|
@ -228,9 +228,7 @@ function mcl_autogroup.can_harvest(nodename, toolname, player)
|
|||
end
|
||||
|
||||
-- Check if it can be dug by hand
|
||||
if not player or not player:is_player() then return false end
|
||||
local name = player:get_inventory():get_stack("hand", 1):get_name()
|
||||
local tdef = minetest.registered_items[name]
|
||||
local tdef = minetest.registered_tools[""]
|
||||
if tdef then
|
||||
for g, gdef in pairs(tdef._mcl_diggroups) do
|
||||
if ndef.groups[g] then
|
||||
|
@ -262,7 +260,7 @@ local function get_tool_capabilities(tdef)
|
|||
|
||||
-- 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 = mcl_meshhand.survival_hand_tool_caps
|
||||
local hand_toolcaps = minetest.registered_tools[""].tool_capabilities
|
||||
return {
|
||||
full_punch_interval = hand_toolcaps.full_punch_interval,
|
||||
damage_groups = hand_toolcaps.damage_groups
|
||||
|
@ -282,7 +280,7 @@ end
|
|||
-- 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_items[toolname]
|
||||
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
|
||||
|
@ -352,7 +350,7 @@ local function overwrite()
|
|||
end
|
||||
end
|
||||
|
||||
for tname, tdef in pairs(minetest.registered_items) do
|
||||
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
|
||||
|
@ -362,12 +360,6 @@ local function overwrite()
|
|||
minetest.override_item(tname, {
|
||||
tool_capabilities = toolcaps
|
||||
})
|
||||
else
|
||||
-- This is needed to deal damage when punching mobs
|
||||
-- with random items in hand in survival mode
|
||||
minetest.override_item(tname, {
|
||||
tool_capabilities = mcl_meshhand.survival_hand_tool_caps
|
||||
})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -5,8 +5,6 @@
|
|||
-- Nodes in group "supported_node" can be placed on any node that does not
|
||||
-- have the "airlike" drawtype. Carpets are an example of this type.
|
||||
|
||||
local pairs = pairs
|
||||
local math = math
|
||||
local vector = vector
|
||||
|
||||
local facedir_to_dir = minetest.facedir_to_dir
|
||||
|
@ -24,17 +22,15 @@ local add_item = minetest.add_item
|
|||
-- We need this to do the exact same dropping node handling in our override
|
||||
-- minetest.check_single_for_falling() function as in the builtin function.
|
||||
--
|
||||
---@param p Vector
|
||||
local function drop_attached_node(p)
|
||||
local n = get_node(p)
|
||||
local drops = get_node_drops(n, "")
|
||||
local def = registered_nodes[n.name]
|
||||
|
||||
if def and def.preserve_metadata then
|
||||
local oldmeta = get_meta(p):to_table().fields
|
||||
-- Copy pos and node because the callback can modify them.
|
||||
local pos_copy = vector.copy(p)
|
||||
local node_copy = { name = n.name, param1 = n.param1, param2 = n.param2 }
|
||||
local pos_copy = vector.new(p)
|
||||
local node_copy = {name=n.name, param1=n.param1, param2=n.param2}
|
||||
local drop_stacks = {}
|
||||
for k, v in pairs(drops) do
|
||||
drop_stacks[k] = ItemStack(v)
|
||||
|
@ -42,18 +38,16 @@ local function drop_attached_node(p)
|
|||
drops = drop_stacks
|
||||
def.preserve_metadata(pos_copy, node_copy, oldmeta, drops)
|
||||
end
|
||||
|
||||
if def and def.sounds and def.sounds.fall then
|
||||
minetest.sound_play(def.sounds.fall, { pos = p }, true)
|
||||
core.sound_play(def.sounds.fall, {pos = p}, true)
|
||||
end
|
||||
|
||||
remove_node(p)
|
||||
for _, item in pairs(drops) do
|
||||
local pos = vector.offset(p,
|
||||
math.random() / 2 - 0.25,
|
||||
math.random() / 2 - 0.25,
|
||||
math.random() / 2 - 0.25
|
||||
)
|
||||
local pos = {
|
||||
x = p.x + math.random()/2 - 0.25,
|
||||
y = p.y + math.random()/2 - 0.25,
|
||||
z = p.z + math.random()/2 - 0.25,
|
||||
}
|
||||
add_item(pos, item)
|
||||
end
|
||||
end
|
||||
|
@ -96,3 +90,4 @@ function minetest.check_single_for_falling(pos)
|
|||
|
||||
return false
|
||||
end
|
||||
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
# mcl_autogroup
|
||||
This mod emulate digging times from mc.
|
||||
|
||||
## mcl_autogroup.can_harvest(nodename, toolname, player)
|
||||
Return true if <nodename> can be dig with <toolname> by <player>.
|
||||
## mcl_autogroup.can_harvest(nodename, toolname)
|
||||
Return true if <nodename> can be dig with <toolname>.
|
||||
* nodename: string, valid nodename
|
||||
* toolname: (optional) string, valid toolname
|
||||
* player: (optinal) ObjectRef, valid player
|
||||
|
||||
## mcl_autogroup.get_groupcaps(toolname, efficiency)
|
||||
This function is used to calculate diggroups for tools.
|
||||
|
|
|
@ -12,7 +12,6 @@ mcl_damage = {
|
|||
drown = {bypasses_armor = true},
|
||||
starve = {bypasses_armor = true, bypasses_magic = true},
|
||||
cactus = {},
|
||||
sweet_berry = {},
|
||||
fall = {bypasses_armor = true},
|
||||
fly_into_wall = {bypasses_armor = true}, -- unused
|
||||
out_of_world = {bypasses_armor = true, bypasses_magic = true, bypasses_invulnerability = true, bypasses_totem = true},
|
||||
|
@ -34,8 +33,6 @@ mcl_damage = {
|
|||
}
|
||||
}
|
||||
|
||||
local damage_enabled = minetest.settings:get_bool("enabled_damage",true)
|
||||
|
||||
function mcl_damage.register_modifier(func, priority)
|
||||
table.insert(mcl_damage.modifiers, {func = func, priority = priority or 0})
|
||||
end
|
||||
|
@ -142,7 +139,6 @@ function mcl_damage.register_type(name, def)
|
|||
end
|
||||
|
||||
minetest.register_on_player_hpchange(function(player, hp_change, mt_reason)
|
||||
if not damage_enabled then return 0 end
|
||||
if hp_change < 0 then
|
||||
if player:get_hp() <= 0 then
|
||||
return 0
|
||||
|
@ -153,8 +149,8 @@ minetest.register_on_player_hpchange(function(player, hp_change, mt_reason)
|
|||
end, true)
|
||||
|
||||
minetest.register_on_player_hpchange(function(player, hp_change, mt_reason)
|
||||
if not damage_enabled then return 0 end
|
||||
if player:get_hp() > 0 then
|
||||
mt_reason.approved = true
|
||||
if hp_change < 0 then
|
||||
mcl_damage.run_damage_callbacks(player, -hp_change, mcl_damage.from_mt(mt_reason))
|
||||
end
|
||||
|
@ -162,10 +158,12 @@ minetest.register_on_player_hpchange(function(player, hp_change, mt_reason)
|
|||
end, false)
|
||||
|
||||
minetest.register_on_dieplayer(function(player, mt_reason)
|
||||
mcl_damage.run_death_callbacks(player, mcl_damage.from_mt(mt_reason))
|
||||
minetest.log("action","Player "..player:get_player_name().." died at "..minetest.pos_to_string(vector.round(player:get_pos())))
|
||||
if mt_reason.approved then
|
||||
mcl_damage.run_death_callbacks(player, mcl_damage.from_mt(mt_reason))
|
||||
end
|
||||
end)
|
||||
|
||||
minetest.register_on_mods_loaded(function()
|
||||
table.sort(mcl_damage.modifiers, function(a, b) return a.priority < b.priority end)
|
||||
end)
|
||||
|
||||
|
|
|
@ -1,27 +0,0 @@
|
|||
## mcl_events
|
||||
### Registering Events
|
||||
`mlc_events.register_event("name",def)`
|
||||
|
||||
#### Event Definition
|
||||
{
|
||||
stage = 0,
|
||||
max_stage = 1,
|
||||
percent = 100,
|
||||
bars = {},
|
||||
completed = false,
|
||||
cond_start = function() end,
|
||||
--return table of paramtables e.g. { { player = playername, pos = position, ... } }, custom parameters will be passed to the event object/table
|
||||
on_step = function(event) end,
|
||||
--this function is run every game step when the event is active
|
||||
on_start = function(event) end,
|
||||
-- this function is run when the event starts
|
||||
on_stage_begin = function(event) end,
|
||||
-- this function runs when a new stage of the event starts
|
||||
cond_progress = function(event) end, --return false or next stage id
|
||||
--this function checks if the event should progress to the next (or any other) stage
|
||||
cond_complete = function(event) end,
|
||||
--return true if event finished successfully
|
||||
}
|
||||
|
||||
### Debugging
|
||||
* /event_start <event> -- starts the given event at the current player coordinates
|
|
@ -1,155 +0,0 @@
|
|||
mcl_events = {}
|
||||
mcl_events.registered_events = {}
|
||||
local disabled_events = minetest.settings:get("mcl_disabled_events")
|
||||
if disabled_events then disabled_events = disabled_events:split(",")
|
||||
else disabled_events = {} end
|
||||
local DBG = minetest.settings:get_bool("mcl_logging_event_api",false)
|
||||
local active_events = {}
|
||||
|
||||
local event_tpl = {
|
||||
stage = 0,
|
||||
max_stage = 1,
|
||||
percent = 100,
|
||||
bars = {},
|
||||
completed = false,
|
||||
cond_start = function(event) end, --return table of positions
|
||||
on_step = function(event) end,
|
||||
on_start = function(event) end,
|
||||
on_stage_begin = function(event) end,
|
||||
cond_progress = function(event) end, --return next stage
|
||||
cond_complete = function(event) end, --return success
|
||||
}
|
||||
|
||||
local function mcl_log(m,l)
|
||||
if DBG then
|
||||
if not l then l = "action" end
|
||||
minetest.log(l,"[mcl_events] "..m)
|
||||
end
|
||||
end
|
||||
|
||||
function mcl_events.register_event(name,def)
|
||||
if table.indexof(disabled_events,name) ~= -1 then return end
|
||||
mcl_events.registered_events[name] = def
|
||||
mcl_events.registered_events[name].name = name
|
||||
end
|
||||
|
||||
local function addbars(self)
|
||||
if not self.enable_bossbar then return end
|
||||
for _,player in pairs(minetest.get_connected_players()) do
|
||||
if vector.distance(self.pos,player:get_pos()) < 64 then
|
||||
local bar = mcl_bossbars.add_bar(player, {color = "red", text = self.readable_name .. ": Wave "..self.stage.." / "..self.max_stage, percentage = self.percent }, true,1)
|
||||
table.insert(self.bars,bar)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function start_event(p,e)
|
||||
mcl_log("[mcl_events] Event started: "..e.readable_name.." at "..minetest.pos_to_string(vector.round(p.pos)))
|
||||
local idx = #active_events + 1
|
||||
active_events[idx] = table.copy(e)
|
||||
setmetatable(active_events[idx],{__index = event_tpl})
|
||||
for k,v in pairs(p) do active_events[idx][k] = v end
|
||||
active_events[idx].stage = 0
|
||||
active_events[idx].percent = 100
|
||||
active_events[idx].bars = {}
|
||||
active_events[idx].time_start = os.time()
|
||||
if active_events[idx].on_start then
|
||||
active_events[idx]:on_start(p.pos)
|
||||
end
|
||||
addbars(active_events[idx])
|
||||
end
|
||||
|
||||
local function finish_event(self,idx)
|
||||
mcl_log("[mcl_events] Finished: "..self.readable_name.." at "..minetest.pos_to_string(vector.round(self.pos)))
|
||||
if self.on_complete then self:on_complete() end
|
||||
for _,b in pairs(self.bars) do
|
||||
mcl_bossbars.remove_bar(b)
|
||||
end
|
||||
table.remove(active_events,idx)
|
||||
end
|
||||
|
||||
local etime = 0
|
||||
function check_events(dtime)
|
||||
--process active events
|
||||
for idx,ae in pairs(active_events) do
|
||||
if ae.cond_complete and ae:cond_complete() then
|
||||
ae.finished = true
|
||||
finish_event(ae,idx)
|
||||
elseif not ae.cond_complete and ae.max_stage and ae.max_stage <= ae.stage then
|
||||
ae.finished = true
|
||||
finish_event(ae,idx)
|
||||
elseif not ae.finished and ae.cond_progress then
|
||||
local p = ae:cond_progress()
|
||||
if p == true then
|
||||
ae.stage = ae.stage + 1
|
||||
if ae:on_stage_begin() == true then
|
||||
mcl_log("[mcl_events] Event "..ae.readable_name.." at "..minetest.pos_to_string(vector.round(ae.pos)).." failed at stage_begin of stage "..ae.stage )
|
||||
active_events[idx] = nil
|
||||
end
|
||||
elseif tonumber(p) then
|
||||
ae.stage = tonumber(p) or ae.stage + 1
|
||||
ae:on_stage_begin()
|
||||
end
|
||||
elseif not ae.finished and ae.on_step then
|
||||
ae:on_step(dtime)
|
||||
end
|
||||
addbars(ae)
|
||||
end
|
||||
-- check if a new event should be started
|
||||
etime = etime - dtime
|
||||
if etime > 0 then return end
|
||||
etime = 10
|
||||
for _,e in pairs(mcl_events.registered_events) do
|
||||
local pp = e.cond_start()
|
||||
if pp then
|
||||
--minetest.log("It's gonna start the raid maybe")
|
||||
for _,p in pairs(pp) do
|
||||
local start = true
|
||||
if e.exclusive_to_area then
|
||||
for _,ae in pairs(active_events) do
|
||||
if e.name == ae.name and vector.distance(p.pos,ae.pos) < e.exclusive_to_area then start = false end
|
||||
end
|
||||
end
|
||||
if start then
|
||||
--minetest.log("It's gonna start the raid definitely")
|
||||
start_event(p,e)
|
||||
elseif DBG then
|
||||
mcl_log("[mcl_events] Event "..e.readable_name.." already active at "..minetest.pos_to_string(vector.round(p.pos)))
|
||||
end
|
||||
end
|
||||
else
|
||||
--minetest.log("Do not start this raid")
|
||||
end
|
||||
end
|
||||
for idx,ae in pairs(active_events) do
|
||||
local player_near = false
|
||||
for _,pl in pairs(minetest.get_connected_players()) do
|
||||
if ae.pos and vector.distance(pl:get_pos(),ae.pos) < 64 then player_near = true end
|
||||
end
|
||||
if ae.pos and not player_near then
|
||||
mcl_log("[mcl_events] Event "..ae.readable_name.." at "..minetest.pos_to_string(vector.round(ae.pos)).." aborted - no players near." )
|
||||
active_events[idx] = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
minetest.register_globalstep(check_events)
|
||||
|
||||
mcl_info.register_debug_field("Active Events",{
|
||||
level = 4,
|
||||
func = function(pl,pos)
|
||||
return tostring(#active_events)
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_chatcommand("event_start",{
|
||||
privs = {debug = true},
|
||||
description = "Debug command to start events",
|
||||
func = function(pname,param)
|
||||
local p = minetest.get_player_by_name(pname)
|
||||
local evdef = mcl_events.registered_events[param]
|
||||
if not evdef then return false,"Event "..param.." doesn't exist.'" end
|
||||
start_event({pos=p:get_pos(),player=pname,factor=1},evdef)
|
||||
return true,"Started event "..param
|
||||
end,
|
||||
})
|
|
@ -1,3 +0,0 @@
|
|||
name = mcl_events
|
||||
author = cora
|
||||
depends = mcl_mobs,mcl_bossbars, mcl_info
|
|
@ -130,10 +130,10 @@ local function add_particles(pos, radius)
|
|||
time = 0.125,
|
||||
minpos = pos,
|
||||
maxpos = pos,
|
||||
minvel = vector.new(-radius, -radius, -radius),
|
||||
maxvel = vector.new(radius, radius, radius),
|
||||
minacc = vector.zero(),
|
||||
maxacc = vector.zero(),
|
||||
minvel = {x = -radius, y = -radius, z = -radius},
|
||||
maxvel = {x = radius, y = radius, z = radius},
|
||||
minacc = vector.new(),
|
||||
maxacc = vector.new(),
|
||||
minexptime = 0.5,
|
||||
maxexptime = 1.0,
|
||||
minsize = radius * 0.5,
|
||||
|
@ -207,7 +207,7 @@ local function trace_explode(pos, strength, raydirs, radius, info, direct, sourc
|
|||
local npos_z = math.floor(rpos_z + 0.5)
|
||||
local npos = { x = npos_x, y = npos_y, z = npos_z }
|
||||
local idx = (npos_z - emin_z) * zstride + (npos_y - emin_y) * ystride +
|
||||
npos_x - emin_x + 1
|
||||
npos_x - emin_x + 1
|
||||
|
||||
local cid = data[idx]
|
||||
local br = node_blastres[cid] or INDESTRUCT_BLASTRES
|
||||
|
@ -288,7 +288,7 @@ local function trace_explode(pos, strength, raydirs, radius, info, direct, sourc
|
|||
rdir_y = rdir_y / rdir_len
|
||||
rdir_z = rdir_z / rdir_len
|
||||
|
||||
for i = 0, rdir_len / STEP_LENGTH do
|
||||
for i=0, rdir_len / STEP_LENGTH do
|
||||
rpos_x = rpos_x + rdir_x * STEP_LENGTH
|
||||
rpos_y = rpos_y + rdir_y * STEP_LENGTH
|
||||
rpos_z = rpos_z + rdir_z * STEP_LENGTH
|
||||
|
@ -296,7 +296,7 @@ local function trace_explode(pos, strength, raydirs, radius, info, direct, sourc
|
|||
local npos_y = math.floor(rpos_y + 0.5)
|
||||
local npos_z = math.floor(rpos_z + 0.5)
|
||||
local idx = (npos_z - emin_z) * zstride + (npos_y - emin_y) * ystride +
|
||||
npos_x - emin_x + 1
|
||||
npos_x - emin_x + 1
|
||||
|
||||
|
||||
local cid = data[idx]
|
||||
|
@ -333,17 +333,17 @@ local function trace_explode(pos, strength, raydirs, radius, info, direct, sourc
|
|||
end
|
||||
|
||||
if sleep_formspec_doesnt_close_mt53 then
|
||||
minetest.after(0.3,
|
||||
function() -- 0.2 is minimum delay for closing old formspec and open died formspec -- TODO: REMOVE THIS IN THE FUTURE
|
||||
if not obj:is_player() then
|
||||
return
|
||||
end
|
||||
mcl_util.deal_damage(obj, damage, { type = "explosion", direct = direct, source = source })
|
||||
minetest.after(0.3, function() -- 0.2 is minimum delay for closing old formspec and open died formspec -- TODO: REMOVE THIS IN THE FUTURE
|
||||
if not obj:is_player() then
|
||||
return
|
||||
end
|
||||
|
||||
obj:add_velocity(vector.multiply(punch_dir, impact * 20))
|
||||
end)
|
||||
mcl_util.deal_damage(obj, damage, {type = "explosion", direct = direct, source = source})
|
||||
|
||||
obj:add_velocity(vector.multiply(punch_dir, impact * 20))
|
||||
end)
|
||||
else
|
||||
mcl_util.deal_damage(obj, damage, { type = "explosion", direct = direct, source = source })
|
||||
mcl_util.deal_damage(obj, damage, {type = "explosion", direct = direct, source = source})
|
||||
|
||||
if obj:is_player() or ent.tnt_knockback then
|
||||
obj:add_velocity(vector.multiply(punch_dir, impact * 20))
|
||||
|
@ -389,24 +389,23 @@ local function trace_explode(pos, strength, raydirs, radius, info, direct, sourc
|
|||
-- We use bulk_set_node instead of LVM because we want to have on_destruct and
|
||||
-- on_construct being called
|
||||
if #airs > 0 then
|
||||
bulk_set_node(airs, { name = "air" })
|
||||
bulk_set_node(airs, {name="air"})
|
||||
end
|
||||
if #fires > 0 then
|
||||
bulk_set_node(fires, { name = "mcl_fire:fire" })
|
||||
bulk_set_node(fires, {name="mcl_fire:fire"})
|
||||
end
|
||||
-- Update falling nodes
|
||||
for a = 1, #airs do
|
||||
for a=1, #airs do
|
||||
local p = airs[a]
|
||||
check_for_falling(vector.offset(p, 0, 1, 0))
|
||||
check_for_falling({x=p.x, y=p.y+1, z=p.z})
|
||||
end
|
||||
for f = 1, #fires do
|
||||
for f=1, #fires do
|
||||
local p = fires[f]
|
||||
check_for_falling(vector.offset(p, 0, 1, 0))
|
||||
check_for_falling({x=p.x, y=p.y+1, z=p.z})
|
||||
end
|
||||
|
||||
-- Log explosion
|
||||
minetest.log("action", "Explosion at " .. pos_to_string(pos) .. " with strength " .. strength .. " and radius " ..
|
||||
radius)
|
||||
minetest.log("action", "Explosion at "..pos_to_string(pos).." with strength "..strength.." and radius "..radius)
|
||||
end
|
||||
|
||||
-- Create an explosion with strength at pos.
|
||||
|
@ -430,11 +429,6 @@ end
|
|||
-- griefing - If true, the explosion will destroy nodes (default: true)
|
||||
-- grief_protected - If true, the explosion will also destroy nodes which have
|
||||
-- been protected (default: false)
|
||||
---@param pos Vector
|
||||
---@param strength number
|
||||
---@param info {drop_chance: number, max_blast_resistance: number, sound: boolean, particles: boolean, fire: boolean, griefing: boolean, grief_protected: boolean}
|
||||
---@param direct? ObjectRef
|
||||
---@param source? ObjectRef
|
||||
function mcl_explosions.explode(pos, strength, info, direct, source)
|
||||
if info == nil then
|
||||
info = {}
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
# textdomain:mcl_explosions
|
||||
@1 was caught in an explosion.=@1は爆発に巻き込まれた。
|
|
@ -3,26 +3,26 @@ mcl_vars = {}
|
|||
|
||||
mcl_vars.redstone_tick = 0.1
|
||||
|
||||
-- GUI / inventory menu settings
|
||||
--- GUI / inventory menu settings
|
||||
mcl_vars.gui_slots = "listcolors[#9990;#FFF7;#FFF0;#000;#FFF]"
|
||||
|
||||
-- nonbg is added as formspec prepend in mcl_formspec_prepend
|
||||
mcl_vars.gui_nonbg = table.concat({
|
||||
mcl_vars.gui_slots,
|
||||
"style_type[image_button;border=false;bgimg=mcl_inventory_button9.png;bgimg_pressed=mcl_inventory_button9_pressed.png;bgimg_middle=2,2]",
|
||||
"style_type[button;border=false;bgimg=mcl_inventory_button9.png;bgimg_pressed=mcl_inventory_button9_pressed.png;bgimg_middle=2,2]",
|
||||
"style_type[field;textcolor=#323232]",
|
||||
"style_type[label;textcolor=#323232]",
|
||||
"style_type[textarea;textcolor=#323232]",
|
||||
"style_type[checkbox;textcolor=#323232]",
|
||||
})
|
||||
mcl_vars.gui_nonbg = mcl_vars.gui_slots ..
|
||||
"style_type[image_button;border=false;bgimg=mcl_inventory_button9.png;bgimg_pressed=mcl_inventory_button9_pressed.png;bgimg_middle=2,2]"..
|
||||
"style_type[button;border=false;bgimg=mcl_inventory_button9.png;bgimg_pressed=mcl_inventory_button9_pressed.png;bgimg_middle=2,2]"..
|
||||
"style_type[field;textcolor=#323232]"..
|
||||
"style_type[label;textcolor=#323232]"..
|
||||
"style_type[textarea;textcolor=#323232]"..
|
||||
"style_type[checkbox;textcolor=#323232]"
|
||||
|
||||
-- Background stuff must be manually added by mods (no formspec prepend)
|
||||
mcl_vars.gui_bg_color = "bgcolor[#00000000]"
|
||||
mcl_vars.gui_bg_img = "background9[1,1;1,1;mcl_base_textures_background9.png;true;7]"
|
||||
|
||||
-- Legacy
|
||||
mcl_vars.inventory_header = ""
|
||||
|
||||
-- Tool wield size
|
||||
mcl_vars.tool_wield_scale = vector.new(1.8, 1.8, 1)
|
||||
mcl_vars.tool_wield_scale = { x = 1.8, y = 1.8, z = 1 }
|
||||
|
||||
-- Mapgen variables
|
||||
local mg_name = minetest.get_mapgen_setting("mg_name")
|
||||
|
@ -35,69 +35,55 @@ mcl_vars.chunksize = math.max(1, tonumber(minetest.get_mapgen_setting("chunksize
|
|||
mcl_vars.MAP_BLOCKSIZE = math.max(1, minetest.MAP_BLOCKSIZE or 16)
|
||||
mcl_vars.mapgen_limit = math.max(1, tonumber(minetest.get_mapgen_setting("mapgen_limit")) or 31000)
|
||||
mcl_vars.MAX_MAP_GENERATION_LIMIT = math.max(1, minetest.MAX_MAP_GENERATION_LIMIT or 31000)
|
||||
|
||||
local central_chunk_offset = -math.floor(mcl_vars.chunksize / 2)
|
||||
|
||||
mcl_vars.central_chunk_offset_in_nodes = central_chunk_offset * mcl_vars.MAP_BLOCKSIZE
|
||||
mcl_vars.chunk_size_in_nodes = mcl_vars.chunksize * mcl_vars.MAP_BLOCKSIZE
|
||||
|
||||
local central_chunk_min_pos = central_chunk_offset * mcl_vars.MAP_BLOCKSIZE
|
||||
local central_chunk_max_pos = central_chunk_min_pos + mcl_vars.chunk_size_in_nodes - 1
|
||||
local ccfmin = central_chunk_min_pos - mcl_vars.MAP_BLOCKSIZE -- Fullminp/fullmaxp of central chunk, in nodes
|
||||
local ccfmax = central_chunk_max_pos + mcl_vars.MAP_BLOCKSIZE
|
||||
local mapgen_limit_b = math.floor(math.min(mcl_vars.mapgen_limit, mcl_vars.MAX_MAP_GENERATION_LIMIT) /
|
||||
mcl_vars.MAP_BLOCKSIZE)
|
||||
local mapgen_limit_b = math.floor(math.min(mcl_vars.mapgen_limit, mcl_vars.MAX_MAP_GENERATION_LIMIT) / mcl_vars.MAP_BLOCKSIZE)
|
||||
local mapgen_limit_min = -mapgen_limit_b * mcl_vars.MAP_BLOCKSIZE
|
||||
local mapgen_limit_max = (mapgen_limit_b + 1) * mcl_vars.MAP_BLOCKSIZE - 1
|
||||
local numcmin = math.max(math.floor((ccfmin - mapgen_limit_min) / mcl_vars.chunk_size_in_nodes), 0) -- Number of complete chunks from central chunk
|
||||
local numcmax = math.max(math.floor((mapgen_limit_max - ccfmax) / mcl_vars.chunk_size_in_nodes), 0) -- fullminp/fullmaxp to effective mapgen limits.
|
||||
|
||||
mcl_vars.mapgen_edge_min = central_chunk_min_pos - numcmin * mcl_vars.chunk_size_in_nodes
|
||||
mcl_vars.mapgen_edge_max = central_chunk_max_pos + numcmax * mcl_vars.chunk_size_in_nodes
|
||||
|
||||
---@param x integer
|
||||
---@return integer
|
||||
local function coordinate_to_block(x)
|
||||
return math.floor(x / mcl_vars.MAP_BLOCKSIZE)
|
||||
end
|
||||
|
||||
---@param x integer
|
||||
---@return integer
|
||||
local function coordinate_to_chunk(x)
|
||||
return math.floor((coordinate_to_block(x) - central_chunk_offset) / mcl_vars.chunksize)
|
||||
end
|
||||
|
||||
---@param pos Vector
|
||||
---@return Vector
|
||||
function mcl_vars.pos_to_block(pos)
|
||||
return vector.new(
|
||||
coordinate_to_block(pos.x),
|
||||
coordinate_to_block(pos.y),
|
||||
coordinate_to_block(pos.z)
|
||||
)
|
||||
return {
|
||||
x = coordinate_to_block(pos.x),
|
||||
y = coordinate_to_block(pos.y),
|
||||
z = coordinate_to_block(pos.z)
|
||||
}
|
||||
end
|
||||
|
||||
---@param pos Vector
|
||||
---@return Vector
|
||||
function mcl_vars.pos_to_chunk(pos)
|
||||
return vector.new(
|
||||
coordinate_to_chunk(pos.x),
|
||||
coordinate_to_chunk(pos.y),
|
||||
coordinate_to_chunk(pos.z)
|
||||
)
|
||||
return {
|
||||
x = coordinate_to_chunk(pos.x),
|
||||
y = coordinate_to_chunk(pos.y),
|
||||
z = coordinate_to_chunk(pos.z)
|
||||
}
|
||||
end
|
||||
|
||||
local k_positive = math.ceil(mcl_vars.MAX_MAP_GENERATION_LIMIT / mcl_vars.chunk_size_in_nodes)
|
||||
local k_positive_z = k_positive * 2
|
||||
local k_positive_y = k_positive_z * k_positive_z
|
||||
|
||||
---@param pos Vector
|
||||
---@return integer
|
||||
function mcl_vars.get_chunk_number(pos) -- unsigned int
|
||||
local c = mcl_vars.pos_to_chunk(pos)
|
||||
return (c.y + k_positive) * k_positive_y +
|
||||
return
|
||||
(c.y + k_positive) * k_positive_y +
|
||||
(c.z + k_positive) * k_positive_z +
|
||||
c.x + k_positive
|
||||
c.x + k_positive
|
||||
end
|
||||
|
||||
if not superflat and not singlenode then
|
||||
|
@ -131,8 +117,11 @@ elseif singlenode then
|
|||
mcl_vars.mg_bedrock_is_rough = false
|
||||
else
|
||||
-- Classic superflat
|
||||
local ground = tonumber(minetest.get_mapgen_setting("mgflat_ground_level")) or 8
|
||||
|
||||
local ground = minetest.get_mapgen_setting("mgflat_ground_level")
|
||||
ground = tonumber(ground)
|
||||
if not ground then
|
||||
ground = 8
|
||||
end
|
||||
mcl_vars.mg_overworld_min = ground - 3
|
||||
mcl_vars.mg_overworld_max_official = mcl_vars.mg_overworld_min + minecraft_height_limit
|
||||
mcl_vars.mg_bedrock_overworld_min = mcl_vars.mg_overworld_min
|
||||
|
@ -149,7 +138,6 @@ mcl_vars.mg_nether_min = -29067 -- Carefully chosen to be at a mapchunk border
|
|||
mcl_vars.mg_nether_max = mcl_vars.mg_nether_min + 128
|
||||
mcl_vars.mg_bedrock_nether_bottom_min = mcl_vars.mg_nether_min
|
||||
mcl_vars.mg_bedrock_nether_top_max = mcl_vars.mg_nether_max
|
||||
mcl_vars.mg_nether_deco_max = mcl_vars.mg_nether_max -11 -- this is so ceiling decorations don't spill into other biomes as bedrock generation calls minetest.generate_decorations to put netherrack under the bedrock
|
||||
if not superflat then
|
||||
mcl_vars.mg_bedrock_nether_bottom_max = mcl_vars.mg_bedrock_nether_bottom_min + 4
|
||||
mcl_vars.mg_bedrock_nether_top_min = mcl_vars.mg_bedrock_nether_top_max - 4
|
||||
|
@ -174,8 +162,7 @@ end
|
|||
mcl_vars.mg_end_min = -27073 -- Carefully chosen to be at a mapchunk border
|
||||
mcl_vars.mg_end_max_official = mcl_vars.mg_end_min + minecraft_height_limit
|
||||
mcl_vars.mg_end_max = mcl_vars.mg_overworld_min - 2000
|
||||
mcl_vars.mg_end_platform_pos = { x = 100, y = mcl_vars.mg_end_min + 64, z = 0 }
|
||||
mcl_vars.mg_end_exit_portal_pos = vector.new(0, mcl_vars.mg_end_min + 71, 0)
|
||||
mcl_vars.mg_end_platform_pos = { x = 100, y = mcl_vars.mg_end_min + 74, z = 0 }
|
||||
|
||||
-- Realm barrier used to safely separate the End from the void below the Overworld
|
||||
mcl_vars.mg_realm_barrier_overworld_end_max = mcl_vars.mg_end_max
|
||||
|
@ -192,16 +179,14 @@ minetest.craftitemdef_default.stack_max = 64
|
|||
math.randomseed(os.time())
|
||||
|
||||
local chunks = {} -- intervals of chunks generated
|
||||
|
||||
---@param pos Vector
|
||||
function mcl_vars.add_chunk(pos)
|
||||
local n = mcl_vars.get_chunk_number(pos) -- unsigned int
|
||||
local prev
|
||||
for i, d in pairs(chunks) do
|
||||
if n <= d[2] then -- we've found it
|
||||
if (n == d[2]) or (n >= d[1]) then return end -- already here
|
||||
if n == d[1] - 1 then -- right before:
|
||||
if prev and (prev[2] == n - 1) then
|
||||
if n == d[1]-1 then -- right before:
|
||||
if prev and (prev[2] == n-1) then
|
||||
prev[2] = d[2]
|
||||
table.remove(chunks, i)
|
||||
return
|
||||
|
@ -209,20 +194,17 @@ function mcl_vars.add_chunk(pos)
|
|||
d[1] = n
|
||||
return
|
||||
end
|
||||
if prev and (prev[2] == n - 1) then --join to previous
|
||||
if prev and (prev[2] == n-1) then --join to previous
|
||||
prev[2] = n
|
||||
return
|
||||
end
|
||||
table.insert(chunks, i, { n, n }) -- insert new interval before i
|
||||
table.insert(chunks, i, {n, n}) -- insert new interval before i
|
||||
return
|
||||
end
|
||||
prev = d
|
||||
end
|
||||
chunks[#chunks + 1] = { n, n }
|
||||
chunks[#chunks+1] = {n, n}
|
||||
end
|
||||
|
||||
---@param pos Vector
|
||||
---@return boolean
|
||||
function mcl_vars.is_generated(pos)
|
||||
local n = mcl_vars.get_chunk_number(pos) -- unsigned int
|
||||
for i, d in pairs(chunks) do
|
||||
|
@ -233,46 +215,47 @@ function mcl_vars.is_generated(pos)
|
|||
return false
|
||||
end
|
||||
|
||||
---"Trivial" (actually NOT) function to just read the node and some stuff to not just return "ignore", like mt 5.4 does.
|
||||
---@param pos Vector Position, if it's wrong, `{name="error"}` node will return.
|
||||
---@param force? boolean Optional (default: `false`), Do the maximum to still read the node within us_timeout.
|
||||
---@param us_timeout? number Optional (default: `244 = 0.000244 s = 1/80/80/80`), set it at least to `3000000` to let mapgen to finish its job
|
||||
---@return node # Node definition, eg. `{name="air"}`. Unfortunately still can return `{name="ignore"}`.
|
||||
---@nodiscard
|
||||
function mcl_vars.get_node(pos, force, us_timeout)
|
||||
-- "Trivial" (actually NOT) function to just read the node and some stuff to not just return "ignore", like mt 5.4 does.
|
||||
-- p: Position, if it's wrong, {name="error"} node will return.
|
||||
-- force: optional (default: false) - Do the maximum to still read the node within us_timeout.
|
||||
-- us_timeout: optional (default: 244 = 0.000244 s = 1/80/80/80), set it at least to 3000000 to let mapgen to finish its job.
|
||||
--
|
||||
-- returns node definition, eg. {name="air"}. Unfortunately still can return {name="ignore"}.
|
||||
function mcl_vars.get_node(p, force, us_timeout)
|
||||
-- check initial circumstances
|
||||
if not pos or not pos.x or not pos.y or not pos.z then return { name = "error" } end
|
||||
if not p or not p.x or not p.y or not p.z then return {name="error"} end
|
||||
|
||||
-- try common way
|
||||
local node = minetest.get_node(pos)
|
||||
local node = minetest.get_node(p)
|
||||
if node.name ~= "ignore" then
|
||||
return node
|
||||
end
|
||||
|
||||
-- copy vector to get sure it won't changed by other threads
|
||||
local pos_copy = vector.copy(pos)
|
||||
-- copy table to get sure it won't changed by other threads
|
||||
local pos = {x=p.x,y=p.y,z=p.z}
|
||||
|
||||
-- try LVM
|
||||
minetest.get_voxel_manip():read_from_map(pos_copy, pos_copy)
|
||||
node = minetest.get_node(pos_copy)
|
||||
minetest.get_voxel_manip():read_from_map(pos, pos)
|
||||
node = minetest.get_node(pos)
|
||||
if node.name ~= "ignore" or not force then
|
||||
return node
|
||||
end
|
||||
|
||||
-- all ways failed - need to emerge (or forceload if generated)
|
||||
if mcl_vars.is_generated(pos_copy) then
|
||||
local us_timeout = us_timeout or 244
|
||||
if mcl_vars.is_generated(pos) then
|
||||
minetest.chat_send_all("IMPOSSIBLE! Please report this to MCL2 issue tracker!")
|
||||
minetest.forceload_block(pos_copy)
|
||||
minetest.forceload_block(pos)
|
||||
else
|
||||
minetest.emerge_area(pos_copy, pos_copy)
|
||||
minetest.emerge_area(pos, pos)
|
||||
end
|
||||
|
||||
local t = minetest.get_us_time()
|
||||
|
||||
node = minetest.get_node(pos_copy)
|
||||
node = minetest.get_node(pos)
|
||||
|
||||
while (not node or node.name == "ignore") and (minetest.get_us_time() - t < (us_timeout or 244)) do
|
||||
node = minetest.get_node(pos_copy)
|
||||
while (not node or node.name == "ignore") and (minetest.get_us_time() - t < us_timeout) do
|
||||
node = minetest.get_node(pos)
|
||||
end
|
||||
|
||||
return node
|
||||
|
|
Before Width: | Height: | Size: 144 B |
|
@ -11,22 +11,42 @@ Creative Commons Attribution 3.0 Unported (CC BY-SA 3.0)
|
|||
http://creativecommons.org/licenses/by/3.0/
|
||||
|
||||
Glass breaking sounds (CC BY 3.0):
|
||||
1: http://www.freesound.org/people/cmusounddesign/sounds/71947/
|
||||
2: http://www.freesound.org/people/Tomlija/sounds/97669/
|
||||
3: http://www.freesound.org/people/lsprice/sounds/88808/
|
||||
1: http://www.freesound.org/people/cmusounddesign/sounds/71947/
|
||||
2: http://www.freesound.org/people/Tomlija/sounds/97669/
|
||||
3: http://www.freesound.org/people/lsprice/sounds/88808/
|
||||
|
||||
default_tool_breaks.ogg by EdgardEdition (CC BY 3.0), http://www.freesound.org/people/EdgardEdition
|
||||
|
||||
Mito551 (sounds) (CC BY-SA 3.0):
|
||||
default_dig_crumbly.ogg
|
||||
default_dig_choppy.ogg
|
||||
default_dig_cracky.ogg
|
||||
default_dig_crumbly.1.ogg
|
||||
default_dig_crumbly.2.ogg
|
||||
default_dig_oddly_breakable_by_hand.ogg
|
||||
default_dug_node.*.ogg
|
||||
default_grass_footstep.*.ogg
|
||||
default_gravel_footstep.*.ogg
|
||||
default_place_node.*.ogg
|
||||
default_place_node_hard.*.ogg
|
||||
default_wood_footstep.*.ogg
|
||||
default_dirt_footstep.*.ogg
|
||||
default_dug_node.1.ogg
|
||||
default_dug_node.2.ogg
|
||||
default_grass_footstep.1.ogg
|
||||
default_grass_footstep.2.ogg
|
||||
default_grass_footstep.3.ogg
|
||||
default_gravel_footstep.1.ogg
|
||||
default_gravel_footstep.2.ogg
|
||||
default_gravel_footstep.3.ogg
|
||||
default_gravel_footstep.4.ogg
|
||||
default_grass_footstep.1.ogg
|
||||
default_place_node.1.ogg
|
||||
default_place_node.2.ogg
|
||||
default_place_node.3.ogg
|
||||
default_place_node_hard.1.ogg
|
||||
default_place_node_hard.2.ogg
|
||||
default_hard_footstep.1.ogg
|
||||
default_hard_footstep.2.ogg
|
||||
default_hard_footstep.3.ogg
|
||||
default_sand_footstep.1.ogg
|
||||
default_sand_footstep.2.ogg
|
||||
default_wood_footstep.1.ogg
|
||||
default_wood_footstep.2.ogg
|
||||
default_dirt_footstep.1.ogg
|
||||
default_dirt_footstep.2.ogg
|
||||
default_glass_footstep.ogg
|
||||
|
||||
Metal sounds:
|
||||
|
@ -34,64 +54,35 @@ Metal sounds:
|
|||
- https://www.freesound.org/people/yadronoff/sounds/320397/
|
||||
default_dug_metal.*.ogg - Iwan Gabovitch - qubodup - CC0
|
||||
- http://opengameart.org/users/qubodup
|
||||
default_metal_footstep.*.ogg - (CC0 1.0) - CC0 1.0
|
||||
- https://freesound.org/people/mypantsfelldown/sounds/398937/
|
||||
default_metal_footstep.*.ogg - Ottomaani138 - CC0
|
||||
- https://www.freesound.org/people/Ottomaani138/sounds/232692/
|
||||
default_place_node_metal.*.ogg - Ogrebane - CC0
|
||||
- http://opengameart.org/content/wood-and-metal-sound-effects-volume-2
|
||||
|
||||
AGFX (CC BY 3.0):
|
||||
AGFX (CC BY 3.0)
|
||||
https://www.freesound.org/people/AGFX/packs/1253/
|
||||
default_water_footstep.*.ogg
|
||||
default_water_footstep.1.ogg
|
||||
default_water_footstep.2.ogg
|
||||
default_water_footstep.3.ogg
|
||||
(default_water_footstep.4.ogg is silent)
|
||||
|
||||
blukotek (CC0 1.0):
|
||||
blukotek (CC0 1.0)
|
||||
https://www.freesound.org/people/blukotek/sounds/251660/
|
||||
default_dig_snappy.ogg
|
||||
|
||||
sonictechtonic (CC BY 3.0):
|
||||
sonictechtonic (CC BY 3.0)
|
||||
https://www.freesound.org/people/sonictechtonic/sounds/241872/
|
||||
player_damage.ogg
|
||||
|
||||
Sheyvan (CC0 1.0):
|
||||
https://freesound.org/people/Sheyvan/sounds/476113/
|
||||
default_dig_choppy.*.ogg
|
||||
|
||||
lolamadeus (CC0 1.0):
|
||||
https://freesound.org/people/lolamadeus/sounds/179341/
|
||||
default_gravel_dig.*.ogg
|
||||
default_gravel_dug.*.ogg
|
||||
|
||||
Benboncan (CC BY 3.0):
|
||||
https://freesound.org/people/Benboncan/sounds/71823/
|
||||
default_dig_cracky.*.ogg
|
||||
|
||||
Erdie (CC BY 3.0):
|
||||
https://freesound.org/people/Erdie/sounds/41579/
|
||||
default_hard_footstep.*.ogg
|
||||
|
||||
worthahep88 (CC0 1.0):
|
||||
https://freesound.org/people/worthahep88/sounds/319224/
|
||||
default_sand_footstep.*.ogg
|
||||
|
||||
dheming (CC BY 3.0):
|
||||
https://freesound.org/people/dheming/sounds/268023/
|
||||
default_ice_dig.*.ogg
|
||||
|
||||
InspectorJ (CC BY 3.0):
|
||||
https://freesound.org/people/InspectorJ/sounds/416967/
|
||||
default_ice_footstep.*.ogg
|
||||
|
||||
Angel_Perez_Grandi (CC BY 3.0):
|
||||
https://freesound.org/people/Angel_Perez_Grandi/sounds/49190/
|
||||
default_ice_dug.ogg
|
||||
|
||||
Voxelands project <http://www.voxelands.com/> (CC BY-SA 3.0):
|
||||
Voxelands project <http://www.voxelands.com/> (CC BY-SA 3.0)
|
||||
mcl_sounds_place_node_water.ogg
|
||||
mcl_sounds_dug_water.ogg
|
||||
|
||||
(Note: Artists from the Voxelands project include: sdzen, darkrose, sapier,
|
||||
Tom Peter, Telaron, juskiddink)
|
||||
|
||||
Michel Baradari <https://opengameart.org/content/lava-splash> (CC BY 3.0):
|
||||
Michel Baradari <https://opengameart.org/content/lava-splash> (CC BY 3.0)
|
||||
|
||||
default_place_node_lava.ogg
|
||||
|
||||
Adam_N (CC0 1.0):
|
||||
|
@ -99,7 +90,7 @@ Adam_N (CC0 1.0):
|
|||
Source: <https://www.freesound.org/people/Adam_N/sounds/346692/>
|
||||
|
||||
Alecia Shepherd (CC BY-SA 4.0):
|
||||
mcl_sounds_cloth.*.ogg
|
||||
mcl_sounds_cloth.ogg
|
||||
Source: SnowSong sound and music pack <https://opengameart.org/content/snowsong-sound-and-music-pack>
|
||||
|
||||
Unknown authors (WTFPL):
|
||||
|
|
|
@ -11,7 +11,7 @@ function mcl_sounds.node_sound_defaults(table)
|
|||
table.dug = table.dug or
|
||||
{name="default_dug_node", gain=0.25}
|
||||
table.dig = table.dig or
|
||||
{name="default_dig_oddly_breakable_by_hand", gain=0.5}
|
||||
{name="default_dig_oddly_breakable_by_hand", gain=1.0}
|
||||
table.place = table.place or
|
||||
{name="default_place_node_hard", gain=1.0}
|
||||
return table
|
||||
|
@ -20,11 +20,11 @@ end
|
|||
function mcl_sounds.node_sound_stone_defaults(table)
|
||||
table = table or {}
|
||||
table.footstep = table.footstep or
|
||||
{name="default_hard_footstep", gain=0.2}
|
||||
{name="default_hard_footstep", gain=0.5}
|
||||
table.dug = table.dug or
|
||||
{name="default_hard_footstep", gain=1.0}
|
||||
table.dig = table.dig or
|
||||
{name="default_dig_cracky", gain=0.5}
|
||||
{name="default_dig_cracky", gain=1.0}
|
||||
mcl_sounds.node_sound_defaults(table)
|
||||
return table
|
||||
end
|
||||
|
@ -32,13 +32,13 @@ end
|
|||
function mcl_sounds.node_sound_metal_defaults(table)
|
||||
table = table or {}
|
||||
table.footstep = table.footstep or
|
||||
{name="default_metal_footstep", gain=0.2}
|
||||
{name="default_metal_footstep", gain=0.5}
|
||||
table.dug = table.dug or
|
||||
{name="default_dug_metal", gain=0.5}
|
||||
{name="default_dug_metal", gain=1.0}
|
||||
table.dig = table.dig or
|
||||
{name="default_dig_metal", gain=0.5}
|
||||
{name="default_dig_metal", gain=1.0}
|
||||
table.place = table.place or
|
||||
{name="default_place_node_metal", gain=0.5}
|
||||
{name="default_place_node_metal", gain=1.0}
|
||||
mcl_sounds.node_sound_defaults(table)
|
||||
return table
|
||||
end
|
||||
|
@ -46,11 +46,11 @@ end
|
|||
function mcl_sounds.node_sound_dirt_defaults(table)
|
||||
table = table or {}
|
||||
table.footstep = table.footstep or
|
||||
{name="default_dirt_footstep", gain=0.25}
|
||||
table.dug = table.dug or
|
||||
{name="default_dirt_footstep", gain=1.0}
|
||||
table.dug = table.dug or
|
||||
{name="default_dirt_footstep", gain=1.5}
|
||||
table.dig = table.dig or
|
||||
{name="default_dig_crumbly", gain=0.4}
|
||||
{name="default_dig_crumbly", gain=1.0}
|
||||
table.place = table.place or
|
||||
{name="default_place_node", gain=1.0}
|
||||
mcl_sounds.node_sound_defaults(table)
|
||||
|
@ -60,25 +60,11 @@ end
|
|||
function mcl_sounds.node_sound_sand_defaults(table)
|
||||
table = table or {}
|
||||
table.footstep = table.footstep or
|
||||
{name="default_sand_footstep", gain=0.05}
|
||||
{name="default_sand_footstep", gain=0.5}
|
||||
table.dug = table.dug or
|
||||
{name="default_sand_footstep", gain=0.15}
|
||||
{name="default_sand_footstep", gain=1.0}
|
||||
table.dig = table.dig or
|
||||
{name="default_dig_crumbly", gain=0.4}
|
||||
table.place = table.place or
|
||||
{name="default_place_node", gain=1.0}
|
||||
mcl_sounds.node_sound_defaults(table)
|
||||
return table
|
||||
end
|
||||
|
||||
function mcl_sounds.node_sound_gravel_defaults(table)
|
||||
table = table or {}
|
||||
table.footstep = table.footstep or
|
||||
{name="default_gravel_footstep", gain=0.25}
|
||||
table.dug = table.dug or
|
||||
{name="default_gravel_dug", gain=1.0}
|
||||
table.dig = table.dig or
|
||||
{name="default_gravel_dig", gain=0.35}
|
||||
{name="default_dig_crumbly", gain=1.0}
|
||||
table.place = table.place or
|
||||
{name="default_place_node", gain=1.0}
|
||||
mcl_sounds.node_sound_defaults(table)
|
||||
|
@ -92,33 +78,21 @@ function mcl_sounds.node_sound_snow_defaults(table)
|
|||
table.dug = table.dug or
|
||||
{name="pedology_snow_soft_footstep", gain=1.0}
|
||||
table.dig = table.dig or
|
||||
{name="pedology_snow_soft_footstep", gain=1.0}
|
||||
{name="default_dig_crumbly", gain=1.0}
|
||||
table.place = table.place or
|
||||
{name="default_place_node", gain=1.0}
|
||||
mcl_sounds.node_sound_defaults(table)
|
||||
return table
|
||||
end
|
||||
|
||||
function mcl_sounds.node_sound_ice_defaults(table)
|
||||
table = table or {}
|
||||
table.footstep = table.footstep or
|
||||
{name="default_ice_footstep", gain=0.15}
|
||||
table.dug = table.dug or
|
||||
{name="default_ice_dug", gain=0.5}
|
||||
table.dig = table.dig or
|
||||
{name="default_ice_dig", gain=0.5}
|
||||
mcl_sounds.node_sound_defaults(table)
|
||||
return table
|
||||
end
|
||||
|
||||
function mcl_sounds.node_sound_wood_defaults(table)
|
||||
table = table or {}
|
||||
table.footstep = table.footstep or
|
||||
{name="default_wood_footstep", gain=0.15}
|
||||
{name="default_wood_footstep", gain=0.5}
|
||||
table.dug = table.dug or
|
||||
{name="default_wood_footstep", gain=1.0}
|
||||
table.dig = table.dig or
|
||||
{name="default_dig_choppy", gain=0.4}
|
||||
{name="default_dig_choppy", gain=1.0}
|
||||
mcl_sounds.node_sound_defaults(table)
|
||||
return table
|
||||
end
|
||||
|
@ -154,11 +128,11 @@ end
|
|||
function mcl_sounds.node_sound_glass_defaults(table)
|
||||
table = table or {}
|
||||
table.footstep = table.footstep or
|
||||
{name="default_glass_footstep", gain=0.3}
|
||||
{name="default_glass_footstep", gain=0.5}
|
||||
table.dug = table.dug or
|
||||
{name="default_break_glass", gain=1.0}
|
||||
table.dig = table.dig or
|
||||
{name="default_dig_cracky", gain=0.5}
|
||||
{name="default_dig_cracky", gain=1.0}
|
||||
mcl_sounds.node_sound_defaults(table)
|
||||
return table
|
||||
end
|
||||
|
|
|
@ -2,8 +2,8 @@ mcl_util = {}
|
|||
|
||||
-- Updates all values in t using values from to*.
|
||||
function table.update(t, ...)
|
||||
for _, to in ipairs {...} do
|
||||
for k, v in pairs(to) do
|
||||
for _, to in ipairs{...} do
|
||||
for k,v in pairs(to) do
|
||||
t[k] = v
|
||||
end
|
||||
end
|
||||
|
@ -12,8 +12,8 @@ end
|
|||
|
||||
-- Updates nil values in t using values from to*.
|
||||
function table.update_nil(t, ...)
|
||||
for _, to in ipairs {...} do
|
||||
for k, v in pairs(to) do
|
||||
for _, to in ipairs{...} do
|
||||
for k,v in pairs(to) do
|
||||
if t[k] == nil then
|
||||
t[k] = v
|
||||
end
|
||||
|
@ -22,28 +22,6 @@ function table.update_nil(t, ...)
|
|||
return t
|
||||
end
|
||||
|
||||
local LOGGING_ON = minetest.settings:get_bool("mcl_logging_default", false)
|
||||
local LOG_MODULE = "[MCL2]"
|
||||
function mcl_util.mcl_log(message, module, bypass_default_logger)
|
||||
local selected_module = LOG_MODULE
|
||||
if module then
|
||||
selected_module = module
|
||||
end
|
||||
if (bypass_default_logger or LOGGING_ON) and message then
|
||||
minetest.log(selected_module .. " " .. message)
|
||||
end
|
||||
end
|
||||
|
||||
function mcl_util.file_exists(name)
|
||||
if type(name) ~= "string" then return end
|
||||
local f = io.open(name)
|
||||
if not f then
|
||||
return false
|
||||
end
|
||||
f:close()
|
||||
return true
|
||||
end
|
||||
|
||||
-- Based on minetest.rotate_and_place
|
||||
|
||||
--[[
|
||||
|
@ -68,7 +46,7 @@ function mcl_util.rotate_axis_and_place(itemstack, placer, pointed_thing, infini
|
|||
local undef = minetest.registered_nodes[unode.name]
|
||||
if undef and undef.on_rightclick then
|
||||
undef.on_rightclick(pointed_thing.under, unode, placer,
|
||||
itemstack, pointed_thing)
|
||||
itemstack, pointed_thing)
|
||||
return
|
||||
end
|
||||
local fdir = minetest.dir_to_facedir(placer:get_look_dir())
|
||||
|
@ -150,23 +128,23 @@ end
|
|||
function mcl_util.get_double_container_neighbor_pos(pos, param2, side)
|
||||
if side == "right" then
|
||||
if param2 == 0 then
|
||||
return {x = pos.x - 1, y = pos.y, z = pos.z}
|
||||
return {x=pos.x-1, y=pos.y, z=pos.z}
|
||||
elseif param2 == 1 then
|
||||
return {x = pos.x, y = pos.y, z = pos.z + 1}
|
||||
return {x=pos.x, y=pos.y, z=pos.z+1}
|
||||
elseif param2 == 2 then
|
||||
return {x = pos.x + 1, y = pos.y, z = pos.z}
|
||||
return {x=pos.x+1, y=pos.y, z=pos.z}
|
||||
elseif param2 == 3 then
|
||||
return {x = pos.x, y = pos.y, z = pos.z - 1}
|
||||
return {x=pos.x, y=pos.y, z=pos.z-1}
|
||||
end
|
||||
else
|
||||
if param2 == 0 then
|
||||
return {x = pos.x + 1, y = pos.y, z = pos.z}
|
||||
return {x=pos.x+1, y=pos.y, z=pos.z}
|
||||
elseif param2 == 1 then
|
||||
return {x = pos.x, y = pos.y, z = pos.z - 1}
|
||||
return {x=pos.x, y=pos.y, z=pos.z-1}
|
||||
elseif param2 == 2 then
|
||||
return {x = pos.x - 1, y = pos.y, z = pos.z}
|
||||
return {x=pos.x-1, y=pos.y, z=pos.z}
|
||||
elseif param2 == 3 then
|
||||
return {x = pos.x, y = pos.y, z = pos.z + 1}
|
||||
return {x=pos.x, y=pos.y, z=pos.z+1}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -184,7 +162,7 @@ end
|
|||
function mcl_util.get_eligible_transfer_item_slot(src_inventory, src_list, dst_inventory, dst_list, condition)
|
||||
local size = src_inventory:get_size(src_list)
|
||||
local stack
|
||||
for i = 1, size do
|
||||
for i=1, size do
|
||||
stack = src_inventory:get_stack(src_list, i)
|
||||
if not stack:is_empty() and (condition == nil or condition(stack, src_inventory, src_list, dst_inventory, dst_list)) then
|
||||
return i
|
||||
|
@ -287,10 +265,10 @@ function mcl_util.move_item_container(source_pos, destination_pos, source_list,
|
|||
-- Main inventory for most container types
|
||||
if sctype == 2 or sctype == 3 or sctype == 5 or sctype == 6 or sctype == 7 then
|
||||
source_list = "main"
|
||||
-- Furnace: output
|
||||
-- Furnace: output
|
||||
elseif sctype == 4 then
|
||||
source_list = "dst"
|
||||
-- Unknown source container type. Bail out
|
||||
-- Unknown source container type. Bail out
|
||||
else
|
||||
return false
|
||||
end
|
||||
|
@ -343,7 +321,7 @@ function mcl_util.move_item_container(source_pos, destination_pos, source_list,
|
|||
-- Main inventory for most container types
|
||||
if dctype == 2 or dctype == 3 or dctype == 5 or dctype == 6 or dctype == 7 then
|
||||
destination_list = "main"
|
||||
-- Furnace source slot
|
||||
-- Furnace source slot
|
||||
elseif dctype == 4 then
|
||||
destination_list = "src"
|
||||
end
|
||||
|
@ -408,7 +386,7 @@ end
|
|||
-- Returns true if item (itemstring or ItemStack) can be used as a furnace fuel.
|
||||
-- Returns false otherwise
|
||||
function mcl_util.is_fuel(item)
|
||||
return minetest.get_craft_result({method = "fuel", width = 1, items = {item}}).time ~= 0
|
||||
return minetest.get_craft_result({method="fuel", width=1, items={item}}).time ~= 0
|
||||
end
|
||||
|
||||
-- Returns a on_place function for plants
|
||||
|
@ -455,7 +433,7 @@ function mcl_util.generate_on_place_plant_function(condition)
|
|||
|
||||
if success then
|
||||
if idef.sounds and idef.sounds.place then
|
||||
minetest.sound_play(idef.sounds.place, {pos = pointed_thing.above, gain = 1}, true)
|
||||
minetest.sound_play(idef.sounds.place, {pos=pointed_thing.above, gain=1}, true)
|
||||
end
|
||||
end
|
||||
itemstack = new_itemstack
|
||||
|
@ -612,12 +590,10 @@ function mcl_util.get_object_name(object)
|
|||
end
|
||||
|
||||
function mcl_util.replace_mob(obj, mob)
|
||||
if not obj then return end
|
||||
local rot = obj:get_yaw()
|
||||
local pos = obj:get_pos()
|
||||
obj:remove()
|
||||
obj = minetest.add_entity(pos, mob)
|
||||
if not obj then return end
|
||||
obj:set_yaw(rot)
|
||||
return obj
|
||||
end
|
||||
|
@ -634,380 +610,3 @@ function mcl_util.get_pointed_thing(player, liquid)
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- This following part is 2 wrapper functions + helpers for
|
||||
-- object:set_bones
|
||||
-- and player:set_properties preventing them from being resent on
|
||||
-- every globalstep when they have not changed.
|
||||
|
||||
local function roundN(n, d)
|
||||
if type(n) ~= "number" then return n end
|
||||
local m = 10 ^ d
|
||||
return math.floor(n * m + 0.5) / m
|
||||
end
|
||||
|
||||
local function close_enough(a, b)
|
||||
local rt = true
|
||||
if type(a) == "table" and type(b) == "table" then
|
||||
for k, v in pairs(a) do
|
||||
if roundN(v, 2) ~= roundN(b[k], 2) then
|
||||
rt = false
|
||||
break
|
||||
end
|
||||
end
|
||||
else
|
||||
rt = roundN(a, 2) == roundN(b, 2)
|
||||
end
|
||||
return rt
|
||||
end
|
||||
|
||||
local function props_changed(props, oldprops)
|
||||
local changed = false
|
||||
local p = {}
|
||||
for k, v in pairs(props) do
|
||||
if not close_enough(v, oldprops[k]) then
|
||||
p[k] = v
|
||||
changed = true
|
||||
end
|
||||
end
|
||||
return changed, p
|
||||
end
|
||||
|
||||
--tests for roundN
|
||||
local test_round1 = 15
|
||||
local test_round2 = 15.00199999999
|
||||
local test_round3 = 15.00111111
|
||||
local test_round4 = 15.00999999
|
||||
|
||||
assert(roundN(test_round1, 2) == roundN(test_round1, 2))
|
||||
assert(roundN(test_round1, 2) == roundN(test_round2, 2))
|
||||
assert(roundN(test_round1, 2) == roundN(test_round3, 2))
|
||||
assert(roundN(test_round1, 2) ~= roundN(test_round4, 2))
|
||||
|
||||
-- tests for close_enough
|
||||
local test_cb = {-0.35, 0, -0.35, 0.35, 0.8, 0.35} --collisionboxes
|
||||
local test_cb_close = {-0.351213, 0, -0.35, 0.35, 0.8, 0.351212}
|
||||
local test_cb_diff = {-0.35, 0, -1.35, 0.35, 0.8, 0.35}
|
||||
|
||||
local test_eh = 1.65 --eye height
|
||||
local test_eh_close = 1.65123123
|
||||
local test_eh_diff = 1.35
|
||||
|
||||
local test_nt = {r = 225, b = 225, a = 225, g = 225} --nametag
|
||||
local test_nt_diff = {r = 225, b = 225, a = 0, g = 225}
|
||||
|
||||
assert(close_enough(test_cb, test_cb_close))
|
||||
assert(not close_enough(test_cb, test_cb_diff))
|
||||
assert(close_enough(test_eh, test_eh_close))
|
||||
assert(not close_enough(test_eh, test_eh_diff))
|
||||
assert(not close_enough(test_nt, test_nt_diff)) --no floats involved here
|
||||
|
||||
--tests for properties_changed
|
||||
local test_properties_set1 = {collisionbox = {-0.35, 0, -0.35, 0.35, 0.8, 0.35}, eye_height = 0.65,
|
||||
nametag_color = {r = 225, b = 225, a = 225, g = 225}}
|
||||
local test_properties_set2 = {collisionbox = {-0.35, 0, -0.35, 0.35, 0.8, 0.35}, eye_height = 1.35,
|
||||
nametag_color = {r = 225, b = 225, a = 225, g = 225}}
|
||||
|
||||
local test_p1, _ = props_changed(test_properties_set1, test_properties_set1)
|
||||
local test_p2, _ = props_changed(test_properties_set1, test_properties_set2)
|
||||
|
||||
assert(not test_p1)
|
||||
assert(test_p2)
|
||||
|
||||
function mcl_util.set_properties(obj, props)
|
||||
local changed, p = props_changed(props, obj:get_properties())
|
||||
if changed then
|
||||
obj:set_properties(p)
|
||||
end
|
||||
end
|
||||
|
||||
function mcl_util.set_bone_position(obj, bone, pos, rot)
|
||||
local current_pos, current_rot = obj:get_bone_position(bone)
|
||||
local pos_equal = not pos or vector.equals(vector.round(current_pos), vector.round(pos))
|
||||
local rot_equal = not rot or vector.equals(vector.round(current_rot), vector.round(rot))
|
||||
if not pos_equal or not rot_equal then
|
||||
obj:set_bone_position(bone, pos or current_pos, rot or current_rot)
|
||||
end
|
||||
end
|
||||
|
||||
---Return a function to use in `on_place`.
|
||||
---
|
||||
---Allow to bypass the `buildable_to` node field in a `on_place` callback.
|
||||
---
|
||||
---You have to make sure that the nodes you return true for have `buildable_to = true`.
|
||||
---@param func fun(node_name: string): boolean Return `true` if node must not replace the buildable_to node which have `node_name`
|
||||
---@return fun(itemstack: ItemStack, placer: ObjectRef, pointed_thing: pointed_thing, param2: integer): ItemStack?
|
||||
function mcl_util.bypass_buildable_to(func)
|
||||
--------------------------
|
||||
-- MINETEST CODE: UTILS --
|
||||
--------------------------
|
||||
|
||||
local function copy_pointed_thing(pointed_thing)
|
||||
return {
|
||||
type = pointed_thing.type,
|
||||
above = pointed_thing.above and vector.copy(pointed_thing.above),
|
||||
under = pointed_thing.under and vector.copy(pointed_thing.under),
|
||||
ref = pointed_thing.ref,
|
||||
}
|
||||
end
|
||||
|
||||
local function user_name(user)
|
||||
return user and user:get_player_name() or ""
|
||||
end
|
||||
|
||||
-- Returns a logging function. For empty names, does not log.
|
||||
local function make_log(name)
|
||||
return name ~= "" and minetest.log or function() end
|
||||
end
|
||||
|
||||
local function check_attached_node(p, n, group_rating)
|
||||
local def = core.registered_nodes[n.name]
|
||||
local d = vector.zero()
|
||||
if group_rating == 3 then
|
||||
-- always attach to floor
|
||||
d.y = -1
|
||||
elseif group_rating == 4 then
|
||||
-- always attach to ceiling
|
||||
d.y = 1
|
||||
elseif group_rating == 2 then
|
||||
-- attach to facedir or 4dir direction
|
||||
if (def.paramtype2 == "facedir" or
|
||||
def.paramtype2 == "colorfacedir") then
|
||||
-- Attach to whatever facedir is "mounted to".
|
||||
-- For facedir, this is where tile no. 5 point at.
|
||||
|
||||
-- The fallback vector here is in case 'facedir to dir' is nil due
|
||||
-- to voxelmanip placing a wallmounted node without resetting a
|
||||
-- pre-existing param2 value that is out-of-range for facedir.
|
||||
-- The fallback vector corresponds to param2 = 0.
|
||||
d = core.facedir_to_dir(n.param2) or vector.new(0, 0, 1)
|
||||
elseif (def.paramtype2 == "4dir" or
|
||||
def.paramtype2 == "color4dir") then
|
||||
-- Similar to facedir handling
|
||||
d = core.fourdir_to_dir(n.param2) or vector.new(0, 0, 1)
|
||||
end
|
||||
elseif def.paramtype2 == "wallmounted" or
|
||||
def.paramtype2 == "colorwallmounted" then
|
||||
-- Attach to whatever this node is "mounted to".
|
||||
-- This where tile no. 2 points at.
|
||||
|
||||
-- The fallback vector here is used for the same reason as
|
||||
-- for facedir nodes.
|
||||
d = core.wallmounted_to_dir(n.param2) or vector.new(0, 1, 0)
|
||||
else
|
||||
d.y = -1
|
||||
end
|
||||
local p2 = vector.add(p, d)
|
||||
local nn = core.get_node(p2).name
|
||||
local def2 = core.registered_nodes[nn]
|
||||
if def2 and not def2.walkable then
|
||||
return false
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
return function(itemstack, placer, pointed_thing, param2)
|
||||
-------------------
|
||||
-- MINETEST CODE --
|
||||
-------------------
|
||||
local def = itemstack:get_definition()
|
||||
if def.type ~= "node" or pointed_thing.type ~= "node" then
|
||||
return itemstack
|
||||
end
|
||||
|
||||
local under = pointed_thing.under
|
||||
local oldnode_under = minetest.get_node_or_nil(under)
|
||||
local above = pointed_thing.above
|
||||
local oldnode_above = minetest.get_node_or_nil(above)
|
||||
local playername = user_name(placer)
|
||||
local log = make_log(playername)
|
||||
|
||||
if not oldnode_under or not oldnode_above then
|
||||
log("info", playername .. " tried to place"
|
||||
.. " node in unloaded position " .. minetest.pos_to_string(above))
|
||||
return itemstack
|
||||
end
|
||||
|
||||
local olddef_under = minetest.registered_nodes[oldnode_under.name]
|
||||
olddef_under = olddef_under or minetest.nodedef_default
|
||||
local olddef_above = minetest.registered_nodes[oldnode_above.name]
|
||||
olddef_above = olddef_above or minetest.nodedef_default
|
||||
|
||||
if not olddef_above.buildable_to and not olddef_under.buildable_to then
|
||||
log("info", playername .. " tried to place"
|
||||
.. " node in invalid position " .. minetest.pos_to_string(above)
|
||||
.. ", replacing " .. oldnode_above.name)
|
||||
return itemstack
|
||||
end
|
||||
|
||||
---------------------
|
||||
-- CUSTOMIZED CODE --
|
||||
---------------------
|
||||
|
||||
-- Place above pointed node
|
||||
local place_to = vector.copy(above)
|
||||
|
||||
-- If node under is buildable_to, check for callback result and place into it instead
|
||||
if olddef_under.buildable_to and not func(oldnode_under.name) then
|
||||
log("info", "node under is buildable to")
|
||||
place_to = vector.copy(under)
|
||||
end
|
||||
|
||||
-------------------
|
||||
-- MINETEST CODE --
|
||||
-------------------
|
||||
|
||||
if minetest.is_protected(place_to, playername) then
|
||||
log("action", playername
|
||||
.. " tried to place " .. def.name
|
||||
.. " at protected position "
|
||||
.. minetest.pos_to_string(place_to))
|
||||
minetest.record_protection_violation(place_to, playername)
|
||||
return itemstack
|
||||
end
|
||||
|
||||
local oldnode = minetest.get_node(place_to)
|
||||
local newnode = {name = def.name, param1 = 0, param2 = param2 or 0}
|
||||
|
||||
-- Calculate direction for wall mounted stuff like torches and signs
|
||||
if def.place_param2 ~= nil then
|
||||
newnode.param2 = def.place_param2
|
||||
elseif (def.paramtype2 == "wallmounted" or
|
||||
def.paramtype2 == "colorwallmounted") and not param2 then
|
||||
local dir = vector.subtract(under, above)
|
||||
newnode.param2 = minetest.dir_to_wallmounted(dir)
|
||||
-- Calculate the direction for furnaces and chests and stuff
|
||||
elseif (def.paramtype2 == "facedir" or
|
||||
def.paramtype2 == "colorfacedir" or
|
||||
def.paramtype2 == "4dir" or
|
||||
def.paramtype2 == "color4dir") and not param2 then
|
||||
local placer_pos = placer and placer:get_pos()
|
||||
if placer_pos then
|
||||
local dir = vector.subtract(above, placer_pos)
|
||||
newnode.param2 = minetest.dir_to_facedir(dir)
|
||||
log("info", "facedir: " .. newnode.param2)
|
||||
end
|
||||
end
|
||||
|
||||
local metatable = itemstack:get_meta():to_table().fields
|
||||
|
||||
-- Transfer color information
|
||||
if metatable.palette_index and not def.place_param2 then
|
||||
local color_divisor = nil
|
||||
if def.paramtype2 == "color" then
|
||||
color_divisor = 1
|
||||
elseif def.paramtype2 == "colorwallmounted" then
|
||||
color_divisor = 8
|
||||
elseif def.paramtype2 == "colorfacedir" then
|
||||
color_divisor = 32
|
||||
elseif def.paramtype2 == "color4dir" then
|
||||
color_divisor = 4
|
||||
elseif def.paramtype2 == "colordegrotate" then
|
||||
color_divisor = 32
|
||||
end
|
||||
if color_divisor then
|
||||
local color = math.floor(metatable.palette_index / color_divisor)
|
||||
local other = newnode.param2 % color_divisor
|
||||
newnode.param2 = color * color_divisor + other
|
||||
end
|
||||
end
|
||||
|
||||
-- Check if the node is attached and if it can be placed there
|
||||
local an = minetest.get_item_group(def.name, "attached_node")
|
||||
if an ~= 0 and
|
||||
not check_attached_node(place_to, newnode, an) then
|
||||
log("action", "attached node " .. def.name ..
|
||||
" cannot be placed at " .. minetest.pos_to_string(place_to))
|
||||
return itemstack
|
||||
end
|
||||
|
||||
log("action", playername .. " places node "
|
||||
.. def.name .. " at " .. minetest.pos_to_string(place_to))
|
||||
|
||||
-- Add node and update
|
||||
minetest.add_node(place_to, newnode)
|
||||
|
||||
-- Play sound if it was done by a player
|
||||
if playername ~= "" and def.sounds and def.sounds.place then
|
||||
minetest.sound_play(def.sounds.place, {
|
||||
pos = place_to,
|
||||
exclude_player = playername,
|
||||
}, true)
|
||||
end
|
||||
|
||||
local take_item = true
|
||||
|
||||
-- Run callback
|
||||
if def.after_place_node then
|
||||
-- Deepcopy place_to and pointed_thing because callback can modify it
|
||||
local place_to_copy = vector.copy(place_to)
|
||||
local pointed_thing_copy = copy_pointed_thing(pointed_thing)
|
||||
if def.after_place_node(place_to_copy, placer, itemstack,
|
||||
pointed_thing_copy) then
|
||||
take_item = false
|
||||
end
|
||||
end
|
||||
|
||||
-- Run script hook
|
||||
for _, callback in ipairs(minetest.registered_on_placenodes) do
|
||||
-- Deepcopy pos, node and pointed_thing because callback can modify them
|
||||
local place_to_copy = vector.copy(place_to)
|
||||
local newnode_copy = {name = newnode.name, param1 = newnode.param1, param2 = newnode.param2}
|
||||
local oldnode_copy = {name = oldnode.name, param1 = oldnode.param1, param2 = oldnode.param2}
|
||||
local pointed_thing_copy = copy_pointed_thing(pointed_thing)
|
||||
if callback(place_to_copy, newnode_copy, placer, oldnode_copy, itemstack, pointed_thing_copy) then
|
||||
take_item = false
|
||||
end
|
||||
end
|
||||
|
||||
if take_item then
|
||||
itemstack:take_item()
|
||||
end
|
||||
return itemstack
|
||||
end
|
||||
end
|
||||
|
||||
--[[Check for a protection violation in a given area.
|
||||
--
|
||||
-- Applies is_protected() to a 3D lattice of points in the defined volume. The points are spaced
|
||||
-- evenly throughout the volume and have a spacing similar to, but no larger than, "interval".
|
||||
--
|
||||
-- @param pos1 A position table of the area volume's first edge.
|
||||
-- @param pos2 A position table of the area volume's second edge.
|
||||
-- @param player The player performing the action.
|
||||
-- @param interval Optional. Max spacing between checked points at the volume.
|
||||
-- Default: Same as minetest.is_area_protected.
|
||||
--
|
||||
-- @return true on protection violation detection. false otherwise.
|
||||
--
|
||||
-- @notes *All corners and edges of the defined volume are checked.
|
||||
]]
|
||||
function mcl_util.check_area_protection(pos1, pos2, player, interval)
|
||||
local name = player and player:get_player_name() or ""
|
||||
|
||||
local protected_pos = minetest.is_area_protected(pos1, pos2, name, interval)
|
||||
if protected_pos then
|
||||
minetest.record_protection_violation(protected_pos, name)
|
||||
return true
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
--[[Check for a protection violation on a single position.
|
||||
--
|
||||
-- @param position A position table to check for protection violation.
|
||||
-- @param player The player performing the action.
|
||||
--
|
||||
-- @return true on protection violation detection. false otherwise.
|
||||
]]
|
||||
function mcl_util.check_position_protection(position, player)
|
||||
local name = player and player:get_player_name() or ""
|
||||
|
||||
if minetest.is_protected(position, name) then
|
||||
minetest.record_protection_violation(position, name)
|
||||
return true
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
|
|
|
@ -28,10 +28,11 @@ end)
|
|||
local timer = 0
|
||||
minetest.register_globalstep(function(dtime)
|
||||
timer = timer + dtime
|
||||
if timer >= 0.6 then
|
||||
if timer >= 0.3 then
|
||||
for _, player in pairs(get_connected_players()) do
|
||||
local ppos = player:get_pos()
|
||||
local npos = vector.add(ppos, vector.new(0, -0.1, 0))
|
||||
ppos.y = ceil(ppos.y)
|
||||
local npos = vector.add(ppos, vector.new(0, -1, 0))
|
||||
if npos then
|
||||
local node = get_node(npos)
|
||||
if node then
|
||||
|
|
|
@ -13,21 +13,11 @@ local function is_group(pos, group)
|
|||
end
|
||||
|
||||
local is_water = flowlib.is_water
|
||||
local function is_river_water(p)
|
||||
local n = minetest.get_node(p).name
|
||||
if n == "mclx_core:river_water_source" or n == "mclx_core:river_water_flowing" then
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
local function is_ice(pos)
|
||||
return is_group(pos, "ice")
|
||||
end
|
||||
|
||||
local function is_fire(pos)
|
||||
return is_group(pos, "set_on_fire")
|
||||
end
|
||||
|
||||
local function get_sign(i)
|
||||
if i == 0 then
|
||||
return 0
|
||||
|
@ -56,7 +46,7 @@ end
|
|||
|
||||
local function set_attach(boat)
|
||||
boat._driver:set_attach(boat.object, "",
|
||||
{x = 0, y = 1.5, z = 1}, {x = 0, y = 0, z = 0})
|
||||
{x = 0, y = 0.42, z = -1}, {x = 0, y = 0, z = 0})
|
||||
end
|
||||
|
||||
local function set_double_attach(boat)
|
||||
|
@ -65,13 +55,9 @@ local function set_double_attach(boat)
|
|||
boat._passenger:set_attach(boat.object, "",
|
||||
{x = 0, y = 0.42, z = -2.2}, {x = 0, y = 0, z = 0})
|
||||
end
|
||||
local function set_choat_attach(boat)
|
||||
boat._driver:set_attach(boat.object, "",
|
||||
{x = 0, y = 1.5, z = 1}, {x = 0, y = 0, z = 0})
|
||||
end
|
||||
|
||||
local function attach_object(self, obj)
|
||||
if self._driver and not self._inv_id then
|
||||
if self._driver then
|
||||
if self._driver:is_player() then
|
||||
self._passenger = obj
|
||||
else
|
||||
|
@ -81,11 +67,7 @@ local function attach_object(self, obj)
|
|||
set_double_attach(self)
|
||||
else
|
||||
self._driver = obj
|
||||
if self._inv_id then
|
||||
set_choat_attach(self)
|
||||
else
|
||||
set_attach(self)
|
||||
end
|
||||
set_attach(self)
|
||||
end
|
||||
|
||||
local visual_size = get_visual_size(obj)
|
||||
|
@ -109,7 +91,6 @@ local function attach_object(self, obj)
|
|||
end
|
||||
|
||||
local function detach_object(obj, change_pos)
|
||||
if not obj or not obj:get_pos() then return end
|
||||
obj:set_detach()
|
||||
obj:set_properties({visual_size = get_visual_size(obj)})
|
||||
if obj:is_player() then
|
||||
|
@ -132,11 +113,11 @@ local boat = {
|
|||
pointable = true,
|
||||
-- Warning: Do not change the position of the collisionbox top surface,
|
||||
-- lowering it causes the boat to fall through the world if underwater
|
||||
collisionbox = {-0.5, -0.15, -0.5, 0.5, 0.55, 0.5},
|
||||
selectionbox = {-0.7, -0.15, -0.7, 0.7, 0.55, 0.7},
|
||||
collisionbox = {-0.5, -0.35, -0.5, 0.5, 0.3, 0.5},
|
||||
selectionbox = {-0.7, -0.35, -0.7, 0.7, 0.3, 0.7},
|
||||
visual = "mesh",
|
||||
mesh = "mcl_boats_boat.b3d",
|
||||
textures = { "mcl_boats_texture_oak_boat.png", "blank.png" },
|
||||
textures = {"mcl_boats_texture_oak_boat.png", "mcl_boats_texture_oak_boat.png", "mcl_boats_texture_oak_boat.png", "mcl_boats_texture_oak_boat.png", "mcl_boats_texture_oak_boat.png"},
|
||||
visual_size = boat_visual_size,
|
||||
hp_max = boat_max_hp,
|
||||
damage_texture_modifier = "^[colorize:white:0",
|
||||
|
@ -147,7 +128,7 @@ local boat = {
|
|||
_last_v = 0, -- Temporary speed variable
|
||||
_removed = false, -- If true, boat entity is considered removed (e.g. after punch) and should be ignored
|
||||
_itemstring = "mcl_boats:boat", -- Itemstring of the boat item (implies boat type)
|
||||
_animation = 0, -- 0: not animated; 1: paddling forwards; -1: paddling backwards
|
||||
_animation = 0, -- 0: not animated; 1: paddling forwards; -1: paddling forwards
|
||||
_regen_timer = 0,
|
||||
_damage_anim = 0,
|
||||
}
|
||||
|
@ -170,14 +151,8 @@ function boat.on_activate(self, staticdata, dtime_s)
|
|||
self._last_v = self._v
|
||||
self._itemstring = data.itemstring
|
||||
|
||||
-- Update the texutes for existing old boat entity instances.
|
||||
-- Maybe remove this in the future.
|
||||
if #data.textures ~= 2 then
|
||||
local has_chest = self._itemstring:find("chest")
|
||||
data.textures = {
|
||||
data.textures[1]:gsub("_chest", ""),
|
||||
has_chest and "mcl_chests_normal.png" or "blank.png"
|
||||
}
|
||||
while #data.textures < 5 do
|
||||
table.insert(data.textures, data.textures[1])
|
||||
end
|
||||
|
||||
self.object:set_properties({textures = data.textures})
|
||||
|
@ -221,8 +196,6 @@ end
|
|||
|
||||
function boat.on_step(self, dtime, moveresult)
|
||||
mcl_burning.tick(self.object, dtime, self)
|
||||
-- mcl_burning.tick may remove object immediately
|
||||
if not self.object:get_pos() then return end
|
||||
|
||||
self._v = get_v(self.object:get_velocity()) * get_sign(self._v)
|
||||
local v_factor = 1
|
||||
|
@ -231,21 +204,16 @@ function boat.on_step(self, dtime, moveresult)
|
|||
local on_water = true
|
||||
local on_ice = false
|
||||
local in_water = is_water({x=p.x, y=p.y-boat_y_offset+1, z=p.z})
|
||||
local in_river_water = is_river_water({x=p.x, y=p.y-boat_y_offset+1, z=p.z})
|
||||
local waterp = {x=p.x, y=p.y-boat_y_offset - 0.1, z=p.z}
|
||||
if not is_water(waterp) then
|
||||
on_water = false
|
||||
if not in_water and is_ice(waterp) then
|
||||
on_ice = true
|
||||
elseif is_fire({x=p.x, y=p.y-boat_y_offset, z=p.z}) then
|
||||
boat.on_death(self, nil)
|
||||
self.object:remove()
|
||||
return
|
||||
else
|
||||
v_slowdown = 0.04
|
||||
v_factor = 0.5
|
||||
end
|
||||
elseif in_water and not in_river_water then
|
||||
elseif in_water then
|
||||
on_water = false
|
||||
in_water = true
|
||||
v_factor = 0.75
|
||||
|
@ -377,18 +345,7 @@ function boat.on_step(self, dtime, moveresult)
|
|||
else
|
||||
p.y = p.y + 1
|
||||
local is_obsidian_boat = self.object:get_luaentity()._itemstring == "mcl_boats:boat_obsidian"
|
||||
if is_river_water(p) then
|
||||
local y = self.object:get_velocity().y
|
||||
if y >= 5 then
|
||||
y = 5
|
||||
elseif y < 0 then
|
||||
new_acce = {x = 0, y = 10, z = 0}
|
||||
else
|
||||
new_acce = {x = 0, y = 2, z = 0}
|
||||
end
|
||||
new_velo = get_velocity(self._v, self.object:get_yaw(), y)
|
||||
self.object:set_pos(self.object:get_pos())
|
||||
elseif is_water(p) and not is_river_water(p) or is_obsidian_boat then
|
||||
if is_water(p) or is_obsidian_boat then
|
||||
-- Inside water: Slowly sink
|
||||
local y = self.object:get_velocity().y
|
||||
y = y - 0.01
|
||||
|
@ -428,18 +385,13 @@ end
|
|||
-- Register one entity for all boat types
|
||||
minetest.register_entity("mcl_boats:boat", boat)
|
||||
|
||||
local cboat = table.copy(boat)
|
||||
cboat.textures = { "mcl_boats_texture_oak_chest_boat.png", "mcl_chests_normal.png" }
|
||||
cboat._itemstring = "mcl_boats:chest_boat"
|
||||
cboat.collisionbox = {-0.5, -0.15, -0.5, 0.5, 0.75, 0.5}
|
||||
cboat.selectionbox = {-0.7, -0.15, -0.7, 0.7, 0.75, 0.7}
|
||||
|
||||
minetest.register_entity("mcl_boats:chest_boat", cboat)
|
||||
mcl_entity_invs.register_inv("mcl_boats:chest_boat","Boat",27)
|
||||
|
||||
local boat_ids = { "boat", "boat_spruce", "boat_birch", "boat_jungle", "boat_acacia", "boat_dark_oak", "boat_obsidian", "boat_mangrove", "chest_boat", "chest_boat_spruce", "chest_boat_birch", "chest_boat_jungle", "chest_boat_acacia", "chest_boat_dark_oak", "chest_boat_mangrove" }
|
||||
local names = { S("Oak Boat"), S("Spruce Boat"), S("Birch Boat"), S("Jungle Boat"), S("Acacia Boat"), S("Dark Oak Boat"), S("Obsidian Boat"), S("Mangrove Boat"), S("Oak Chest Boat"), S("Spruce Chest Boat"), S("Birch Chest Boat"), S("Jungle Chest Boat"), S("Acacia Chest Boat"), S("Dark Oak Chest Boat"), S("Mangrove Chest Boat") }
|
||||
local craftstuffs = { "mcl_core:wood", "mcl_core:sprucewood", "mcl_core:birchwood", "mcl_core:junglewood", "mcl_core:acaciawood", "mcl_core:darkwood", "mcl_core:obsidian", "mcl_mangrove:mangrove_wood" }
|
||||
local boat_ids = { "boat", "boat_spruce", "boat_birch", "boat_jungle", "boat_acacia", "boat_dark_oak", "boat_obsidian" }
|
||||
local names = { S("Oak Boat"), S("Spruce Boat"), S("Birch Boat"), S("Jungle Boat"), S("Acacia Boat"), S("Dark Oak Boat"), S("Obsidian Boat") }
|
||||
local craftstuffs = {}
|
||||
if minetest.get_modpath("mcl_core") then
|
||||
craftstuffs = { "mcl_core:wood", "mcl_core:sprucewood", "mcl_core:birchwood", "mcl_core:junglewood", "mcl_core:acaciawood", "mcl_core:darkwood", "mcl_core:obsidian" }
|
||||
end
|
||||
local images = { "oak", "spruce", "birch", "jungle", "acacia", "dark_oak", "obsidian" }
|
||||
|
||||
for b=1, #boat_ids do
|
||||
local itemstring = "mcl_boats:"..boat_ids[b]
|
||||
|
@ -455,21 +407,6 @@ for b=1, #boat_ids do
|
|||
end
|
||||
tt_help = S("Water vehicle")
|
||||
|
||||
local inventory_image
|
||||
local texture
|
||||
local id = boat_ids[b]
|
||||
if id:find("chest") then
|
||||
if id == "chest_boat" then id = "oak" end
|
||||
local id = id:gsub("chest_boat_", "")
|
||||
inventory_image = "mcl_boats_" .. id .. "_chest_boat.png"
|
||||
texture = "mcl_boats_texture_" .. id .. "_boat.png"
|
||||
else
|
||||
if id == "boat" then id = "oak" end
|
||||
local id = id:gsub("boat_", "")
|
||||
inventory_image = "mcl_boats_" .. id .. "_boat.png"
|
||||
texture = "mcl_boats_texture_" .. id .. "_boat.png"
|
||||
end
|
||||
|
||||
minetest.register_craftitem(itemstring, {
|
||||
description = names[b],
|
||||
_tt_help = tt_help,
|
||||
|
@ -477,7 +414,7 @@ for b=1, #boat_ids do
|
|||
_doc_items_entry_name = helpname,
|
||||
_doc_items_longdesc = longdesc,
|
||||
_doc_items_usagehelp = usagehelp,
|
||||
inventory_image = inventory_image,
|
||||
inventory_image = "mcl_boats_"..images[b].."_boat.png",
|
||||
liquids_pointable = true,
|
||||
groups = { boat = 1, transport = 1},
|
||||
stack_max = 1,
|
||||
|
@ -504,15 +441,10 @@ for b=1, #boat_ids do
|
|||
else
|
||||
pos = vector.add(pos, vector.multiply(dir, boat_y_offset_ground))
|
||||
end
|
||||
local boat_ent = "mcl_boats:boat"
|
||||
local chest_tex = "blank.png"
|
||||
if itemstring:find("chest") then
|
||||
boat_ent = "mcl_boats:chest_boat"
|
||||
chest_tex = "mcl_chests_normal.png"
|
||||
end
|
||||
local boat = minetest.add_entity(pos, boat_ent)
|
||||
local boat = minetest.add_entity(pos, "mcl_boats:boat")
|
||||
local texture = "mcl_boats_texture_"..images[b].."_boat.png"
|
||||
boat:get_luaentity()._itemstring = itemstring
|
||||
boat:set_properties({ textures = { texture, chest_tex } })
|
||||
boat:set_properties({textures = { texture, texture, texture, texture, texture }})
|
||||
boat:set_yaw(placer:get_look_horizontal())
|
||||
if not minetest.is_creative_enabled(placer:get_player_name()) then
|
||||
itemstack:take_item()
|
||||
|
@ -532,22 +464,13 @@ for b=1, #boat_ids do
|
|||
})
|
||||
|
||||
local c = craftstuffs[b]
|
||||
if not itemstring:find("chest") then
|
||||
minetest.register_craft({
|
||||
output = itemstring:gsub(":boat",":chest_boat"),
|
||||
recipe = {
|
||||
{"mcl_chests:chest"},
|
||||
{itemstring},
|
||||
},
|
||||
})
|
||||
minetest.register_craft({
|
||||
output = itemstring,
|
||||
recipe = {
|
||||
{c, "", c},
|
||||
{c, c, c},
|
||||
},
|
||||
})
|
||||
end
|
||||
minetest.register_craft({
|
||||
output = itemstring,
|
||||
recipe = {
|
||||
{c, "", c},
|
||||
{c, c, c},
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
minetest.register_craft({
|
||||
|
|
|
@ -9,5 +9,4 @@ Oak Boat=Bateau en Chêne
|
|||
Rightclick on a water source to place the boat. Rightclick the boat to enter it. Use [Left] and [Right] to steer, [Forwards] to speed up and [Backwards] to slow down or move backwards. Use [Sneak] to leave the boat, punch the boat to make it drop as an item.=Faites un clic droit sur une source d'eau pour placer le bateau. Faites un clic droit sur le bateau pour y entrer. Utilisez [Gauche] et [Droite] pour diriger, [Avant] pour accélérer et [Arrière] pour ralentir ou reculer. Utilisez [Sneak] pour le quitter, frappez le bateau pour le faire tomber en tant qu'objet.
|
||||
Spruce Boat=Bateau en Sapin
|
||||
Water vehicle=Véhicule aquatique
|
||||
Sneak to dismount=Se baisser pour descendre
|
||||
Obsidian Boat=Bateau en Obsidienne
|
||||
Sneak to dismount=
|
|
@ -1,13 +0,0 @@
|
|||
# textdomain: mcl_boats
|
||||
Acacia Boat=アカシアのボート
|
||||
Birch Boat=シラカバのボート
|
||||
Boat=ボート
|
||||
Boats are used to travel on the surface of water.=ボートは、水面を移動するために使われます。
|
||||
Dark Oak Boat=ダークオークのボート
|
||||
Jungle Boat=ジャングルのボート
|
||||
Oak Boat=オークのボート
|
||||
Rightclick on a water source to place the boat. Rightclick the boat to enter it. Use [Left] and [Right] to steer, [Forwards] to speed up and [Backwards] to slow down or move backwards. Use [Sneak] to leave the boat, punch the boat to make it drop as an item.=水源を右クリックすると、ボートが配置されます。ボートを右クリックすると、乗り込みます。[左][右]で舵取り、[前]で加速、[後]で減速または後退します。[スニーク]でボートから離れ、ボートをパンチするとアイテムとしてドロップします。
|
||||
Spruce Boat=トウヒのボート
|
||||
Water vehicle=水上用の乗物
|
||||
Sneak to dismount=スニークで降りる
|
||||
Obsidian Boat=黒曜石のボート
|
|
@ -10,4 +10,3 @@ Rightclick on a water source to place the boat. Rightclick the boat to enter it.
|
|||
Spruce Boat=
|
||||
Water vehicle=
|
||||
Sneak to dismount=
|
||||
Obsidian Boat=
|
|
@ -1,5 +1,7 @@
|
|||
name = mcl_boats
|
||||
author = PilzAdam
|
||||
description = Adds drivable boats.
|
||||
depends = mcl_player, flowlib, mcl_title, mcl_entity_invs
|
||||
depends = mcl_player, flowlib, mcl_title
|
||||
optional_depends = mcl_core, doc_identifier
|
||||
|
||||
|
||||
|
|
Before Width: | Height: | Size: 6.3 KiB |
Before Width: | Height: | Size: 6.3 KiB |
Before Width: | Height: | Size: 6.3 KiB |
Before Width: | Height: | Size: 6.4 KiB |
Before Width: | Height: | Size: 6.2 KiB |
Before Width: | Height: | Size: 6.3 KiB |
Before Width: | Height: | Size: 6.3 KiB |