Compare commits

..

1 Commits

Author SHA1 Message Date
cora 2604379fe3 Implement respiration 2022-10-16 03:30:34 +02:00
4038 changed files with 10248 additions and 41238 deletions

View File

@ -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

View File

@ -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!

View File

@ -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!

View File

@ -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?

View File

@ -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!

2
.gitignore vendored
View File

@ -3,5 +3,3 @@
*.blend1 *.blend1
*.blend2 *.blend2
*.blend3 *.blend3
/.idea/
*.xcf

1
API.md
View File

@ -41,7 +41,6 @@ A lot of things are possible by using one of the APIs in the mods. Note that not
* Beds: `ITEMS/mcl_beds` * Beds: `ITEMS/mcl_beds`
* Buckets: `ITEMS/mcl_buckets` * Buckets: `ITEMS/mcl_buckets`
* Dispenser support: `ITEMS/REDSTONE/mcl_dispensers` * Dispenser support: `ITEMS/REDSTONE/mcl_dispensers`
* Campfires: `ITEMS/mcl_campfires`
### Mobs ### Mobs
* Mobs: `ENTITIES/mcl_mobs` * Mobs: `ENTITIES/mcl_mobs`

View File

@ -60,7 +60,7 @@ representative at an online or offline event.
Instances of abusive, harassing, or otherwise unacceptable behavior may be Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at 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 complaints will be reviewed and investigated promptly and fairly.
All community leaders are obligated to respect the privacy and security of the All community leaders are obligated to respect the privacy and security of the

View File

@ -2,8 +2,8 @@
So you want to contribute to MineClone2? So you want to contribute to MineClone2?
Wow, thank you! :-) Wow, thank you! :-)
MineClone2 is maintained by AncientMariner and Nicu. If you have any MineClone2 is maintained by Nicu and Cora. If you have any
problems or questions, contact us on Discord/Matrix (See Links section below). problems or questions, contact us (See Links section below).
You can help with MineClone2's development in many different ways, You can help with MineClone2's development in many different ways,
whether you're a programmer or not. whether you're a programmer or not.
@ -240,7 +240,7 @@ work causes problems, we ask you fix the issues as soon as possible.
### Changing Gameplay ### Changing Gameplay
Pull Requests that change gameplay have to be properly researched and Pull Requests that change gameplay have to be properly researched and
need to state their sources. These PRs also need the maintainer's approval need to state their sources. These PRs also need Fleckenstein's approval
before they are merged. before they are merged.
You can use these sources: You can use these sources:
@ -375,7 +375,7 @@ merged.
- Resolving conflicts and problems within the community - Resolving conflicts and problems within the community
#### Current maintainers #### Current maintainers
* AncientMariner - responsible for gameplay review, publishing releases, * Cora - responsible for gameplay review, publishing releases,
technical guidelines technical guidelines
* Nicu - responsible for community related issues * Nicu - responsible for community related issues

View File

@ -8,13 +8,12 @@
## Maintainers ## Maintainers
* AncientMariner
* Nicu * Nicu
* cora
## Previous Maintainers ## Previous Maintainers
* Fleckenstein * Fleckenstein
* jordan4ibanez * jordan4ibanez
* cora
## Developers ## Developers
* bzoss * bzoss
@ -34,9 +33,6 @@
* RandomLegoBrick * RandomLegoBrick
* SumianVoice * SumianVoice
* MrRar * MrRar
* talamh
* Faerraven / Michieal
* FossFanatic
## Contributors ## Contributors
* Laurent Rocher * Laurent Rocher
@ -70,6 +66,7 @@
* Benjamin Schötz * Benjamin Schötz
* Doloment * Doloment
* Sydney Gems * Sydney Gems
* talamh
* Emily2255 * Emily2255
* Emojigit * Emojigit
* FinishedFragment * FinishedFragment
@ -88,21 +85,6 @@
* opfromthestart * opfromthestart
* snowyu * snowyu
* FaceDeer * FaceDeer
* Faerraven / Michieal
* FossFanatic
* Herbert West
* GuyLiner
* 3raven
* anarquimico
* TheOnlyJoeEnderman
* Ranko Saotome
* Gregor Parzefall
* Wbjitscool
* b3nderman
* CyberMango
* gldrk
* SmokeyDope
* atomdmac
## MineClone5 ## MineClone5
* kay27 * kay27
@ -113,7 +95,7 @@
* chmodsayshello * chmodsayshello
* 3raven * 3raven
* PrairieWind * PrairieWind
* Gustavo6046 / wallabra * Gustavo1
* CableGuy67 * CableGuy67
* MrRar * MrRar
@ -154,13 +136,11 @@
* jordan4ibanez * jordan4ibanez
* paramat * paramat
* cora * cora
* Faerraven / Michieal
## 3D Models ## 3D Models
* 22i * 22i
* tobyplowy * tobyplowy
* epCode * epCode
* Faerraven / Michieal
## Textures ## Textures
* XSSheep * XSSheep
@ -174,8 +154,6 @@
* MysticTempest * MysticTempest
* RandomLegoBrick * RandomLegoBrick
* cora * cora
* Faerraven / Michieal
* Nicu
## Translations ## Translations
* Wuzzy * Wuzzy
@ -189,13 +167,9 @@
* Emojigit * Emojigit
* snowyu * snowyu
* 3raven * 3raven
* SakuraRiu
* anarquimico
## Funders ## Funders
* 40W * 40W
* bauknecht
* Cora
## Special thanks ## Special thanks
* celeron55 for creating Minetest * celeron55 for creating Minetest
@ -203,4 +177,3 @@
* wsor for working tirelessly in the shadows for the good of all of us, particularly helping with solving contentDB and copyright issues. * 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 * 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 * 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/

View File

@ -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 * `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 * `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 * `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 #### Footnotes

View File

@ -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!

View File

@ -2,6 +2,8 @@
An unofficial Minecraft-like game for Minetest. Forked from MineClone by davedevils. An unofficial Minecraft-like game for Minetest. Forked from MineClone by davedevils.
Developed by many people. Not developed or endorsed by Mojang AB. Developed by many people. Not developed or endorsed by Mojang AB.
Version: 0.80 (in development)
### Gameplay ### Gameplay
You start in a randomly-generated world made entirely of cubes. You can explore 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 the world and dig and build almost every block in the world to create new
@ -156,7 +158,7 @@ The following features are incomplete:
* Some monsters and animals * Some monsters and animals
* Redstone-related things * Redstone-related things
* Some special minecarts (hopper and chest minecarts work) * Special minecarts
* A couple of non-trivial blocks and items * A couple of non-trivial blocks and items
Bonus features (not found in Minecraft): Bonus features (not found in Minecraft):

View File

@ -1,75 +0,0 @@
### Standard Release
#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"
### Hotfix Release
##### Prepare release branch
When hotfixing, you should never release new features. Any new code increases risk of new bugs which has additional testing/release concerns.
To mitigate this, you just release the last release, and the relevant bug fix. For this, we do the following:
* Create release branch from the last release tag, push it:
git checkout -b release/0.82.1 0.82.0
git push origin release/0.82.1
##### Prepare feature branch and fix
* Create feature branch from that release branch (can review it to check only fix is there, nothing else, and use to also merge into master separately)
git checkout -b hotfix_bug_1_branch
* Fix crash/serious bug and commit
* Push branch and create pr to the release and also the master branch (Do not rebase, to reduce merge conflict risk. Do not delete after first merge or it needs to be repushed)
##### Update version and tag the release
* After all fixes are in release branch, pull it locally (best to avoid a merge conflict as feature branch will need to be merged into master also, which already changed version):
* Update version in game.conf to hotfix version and commit it. Example: version=0.82.1
* Tag it, push tag and branch:
git tag 0.82.1
git push origin 0.82.1
git push origin release/0.82.1
Note: If you have to do more than 1 hotfix release, can do it on the same release branch.
### Release via ContentDB
* Go to MineClone2 page (https://content.minetest.net/packages/Wuzzy/mineclone2/)
* Click +Release
* Enter the release tag number in the title and Git reference box. For example (without quotes): "0.82.1"
* In the minimum minetest version, put the oldest supported version (as of 14/02/2023 it is 5.5), leave the Maximum minetest version blank
* Click save. Release is now live.
##### Inform people
* Add a comment to the forum post with the release number and what is involved, and maintainer will update main post.
* Add a comment in Discord announcement

View File

@ -1,4 +1,2 @@
title = MineClone 2 title = MineClone 2
description = A survival sandbox game. Survive, gather, hunt, build, explore, and do much more. description = A survival sandbox game. Survive, gather, hunt, build, explore, and do much more.
disallowed_mapgens = v6
version=0.82.0-SNAPSHOT

Binary file not shown.

Before

Width:  |  Height:  |  Size: 83 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 990 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 865 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 916 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 606 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 628 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 82 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 81 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 82 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 82 KiB

After

Width:  |  Height:  |  Size: 76 KiB

BIN
menu/overlay.1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

BIN
menu/overlay.2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 119 KiB

BIN
menu/overlay.3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 121 KiB

BIN
menu/overlay.4.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 118 KiB

BIN
menu/overlay.5.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 122 KiB

BIN
menu/overlay.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 91 KiB

Binary file not shown.

View File

@ -204,7 +204,7 @@ end
-- Checks if the given node would drop its useful drop if dug by a given tool. -- 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. -- 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] local ndef = minetest.registered_nodes[nodename]
if not ndef then if not ndef then
@ -228,9 +228,7 @@ function mcl_autogroup.can_harvest(nodename, toolname, player)
end end
-- Check if it can be dug by hand -- Check if it can be dug by hand
if not player or not player:is_player() then return false end local tdef = minetest.registered_tools[""]
local name = player:get_inventory():get_stack("hand", 1):get_name()
local tdef = minetest.registered_items[name]
if tdef then if tdef then
for g, gdef in pairs(tdef._mcl_diggroups) do for g, gdef in pairs(tdef._mcl_diggroups) do
if ndef.groups[g] then 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, -- If the damage group and punch interval from hand is not included,
-- then the user will not be able to attack with the tool. -- 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 { return {
full_punch_interval = hand_toolcaps.full_punch_interval, full_punch_interval = hand_toolcaps.full_punch_interval,
damage_groups = hand_toolcaps.damage_groups 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 -- would have to add _mcl_autogroup as a dependency which would break the mod
-- loading order. -- loading order.
function mcl_autogroup.get_groupcaps(toolname, efficiency) 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 {}) local groupcaps = table.copy(get_tool_capabilities(tdef).groupcaps or {})
add_groupcaps(toolname, groupcaps, tdef._mcl_diggroups, efficiency) add_groupcaps(toolname, groupcaps, tdef._mcl_diggroups, efficiency)
return groupcaps return groupcaps
@ -352,7 +350,7 @@ local function overwrite()
end end
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 -- Assign groupcaps for digging the registered digging groups
-- depending on the _mcl_diggroups in the tool definition -- depending on the _mcl_diggroups in the tool definition
if tdef._mcl_diggroups then if tdef._mcl_diggroups then
@ -362,12 +360,6 @@ local function overwrite()
minetest.override_item(tname, { minetest.override_item(tname, {
tool_capabilities = toolcaps 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 end
end end

View File

@ -5,8 +5,6 @@
-- Nodes in group "supported_node" can be placed on any node that does not -- 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. -- have the "airlike" drawtype. Carpets are an example of this type.
local pairs = pairs
local math = math
local vector = vector local vector = vector
local facedir_to_dir = minetest.facedir_to_dir 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 -- 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. -- minetest.check_single_for_falling() function as in the builtin function.
-- --
---@param p Vector
local function drop_attached_node(p) local function drop_attached_node(p)
local n = get_node(p) local n = get_node(p)
local drops = get_node_drops(n, "") local drops = get_node_drops(n, "")
local def = registered_nodes[n.name] local def = registered_nodes[n.name]
if def and def.preserve_metadata then if def and def.preserve_metadata then
local oldmeta = get_meta(p):to_table().fields local oldmeta = get_meta(p):to_table().fields
-- Copy pos and node because the callback can modify them. -- Copy pos and node because the callback can modify them.
local pos_copy = vector.copy(p) local pos_copy = vector.new(p)
local node_copy = { name = n.name, param1 = n.param1, param2 = n.param2 } local node_copy = {name=n.name, param1=n.param1, param2=n.param2}
local drop_stacks = {} local drop_stacks = {}
for k, v in pairs(drops) do for k, v in pairs(drops) do
drop_stacks[k] = ItemStack(v) drop_stacks[k] = ItemStack(v)
@ -42,18 +38,16 @@ local function drop_attached_node(p)
drops = drop_stacks drops = drop_stacks
def.preserve_metadata(pos_copy, node_copy, oldmeta, drops) def.preserve_metadata(pos_copy, node_copy, oldmeta, drops)
end end
if def and def.sounds and def.sounds.fall then 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 end
remove_node(p) remove_node(p)
for _, item in pairs(drops) do for _, item in pairs(drops) do
local pos = vector.offset(p, local pos = {
math.random() / 2 - 0.25, x = p.x + math.random()/2 - 0.25,
math.random() / 2 - 0.25, y = p.y + math.random()/2 - 0.25,
math.random() / 2 - 0.25 z = p.z + math.random()/2 - 0.25,
) }
add_item(pos, item) add_item(pos, item)
end end
end end
@ -96,3 +90,4 @@ function minetest.check_single_for_falling(pos)
return false return false
end end

View File

@ -1,11 +1,10 @@
# mcl_autogroup # mcl_autogroup
This mod emulate digging times from mc. This mod emulate digging times from mc.
## mcl_autogroup.can_harvest(nodename, toolname, player) ## mcl_autogroup.can_harvest(nodename, toolname)
Return true if <nodename> can be dig with <toolname> by <player>. Return true if <nodename> can be dig with <toolname>.
* nodename: string, valid nodename * nodename: string, valid nodename
* toolname: (optional) string, valid toolname * toolname: (optional) string, valid toolname
* player: (optinal) ObjectRef, valid player
## mcl_autogroup.get_groupcaps(toolname, efficiency) ## mcl_autogroup.get_groupcaps(toolname, efficiency)
This function is used to calculate diggroups for tools. This function is used to calculate diggroups for tools.

View File

@ -12,7 +12,6 @@ mcl_damage = {
drown = {bypasses_armor = true}, drown = {bypasses_armor = true},
starve = {bypasses_armor = true, bypasses_magic = true}, starve = {bypasses_armor = true, bypasses_magic = true},
cactus = {}, cactus = {},
sweet_berry = {},
fall = {bypasses_armor = true}, fall = {bypasses_armor = true},
fly_into_wall = {bypasses_armor = true}, -- unused fly_into_wall = {bypasses_armor = true}, -- unused
out_of_world = {bypasses_armor = true, bypasses_magic = true, bypasses_invulnerability = true, bypasses_totem = true}, out_of_world = {bypasses_armor = true, bypasses_magic = true, bypasses_invulnerability = true, bypasses_totem = true},
@ -155,6 +154,7 @@ end, true)
minetest.register_on_player_hpchange(function(player, hp_change, mt_reason) minetest.register_on_player_hpchange(function(player, hp_change, mt_reason)
if not damage_enabled then return 0 end if not damage_enabled then return 0 end
if player:get_hp() > 0 then if player:get_hp() > 0 then
mt_reason.approved = true
if hp_change < 0 then if hp_change < 0 then
mcl_damage.run_damage_callbacks(player, -hp_change, mcl_damage.from_mt(mt_reason)) mcl_damage.run_damage_callbacks(player, -hp_change, mcl_damage.from_mt(mt_reason))
end end
@ -162,7 +162,9 @@ minetest.register_on_player_hpchange(function(player, hp_change, mt_reason)
end, false) end, false)
minetest.register_on_dieplayer(function(player, mt_reason) minetest.register_on_dieplayer(function(player, mt_reason)
mcl_damage.run_death_callbacks(player, mcl_damage.from_mt(mt_reason)) if mt_reason.approved then
mcl_damage.run_death_callbacks(player, mcl_damage.from_mt(mt_reason))
end
minetest.log("action","Player "..player:get_player_name().." died at "..minetest.pos_to_string(vector.round(player:get_pos()))) minetest.log("action","Player "..player:get_player_name().." died at "..minetest.pos_to_string(vector.round(player:get_pos())))
end) end)

View File

@ -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

View File

@ -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,
})

View File

@ -1,3 +0,0 @@
name = mcl_events
author = cora
depends = mcl_mobs,mcl_bossbars, mcl_info

View File

@ -130,10 +130,10 @@ local function add_particles(pos, radius)
time = 0.125, time = 0.125,
minpos = pos, minpos = pos,
maxpos = pos, maxpos = pos,
minvel = vector.new(-radius, -radius, -radius), minvel = {x = -radius, y = -radius, z = -radius},
maxvel = vector.new(radius, radius, radius), maxvel = {x = radius, y = radius, z = radius},
minacc = vector.zero(), minacc = vector.new(),
maxacc = vector.zero(), maxacc = vector.new(),
minexptime = 0.5, minexptime = 0.5,
maxexptime = 1.0, maxexptime = 1.0,
minsize = radius * 0.5, 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_z = math.floor(rpos_z + 0.5)
local npos = { x = npos_x, y = npos_y, z = npos_z } local npos = { x = npos_x, y = npos_y, z = npos_z }
local idx = (npos_z - emin_z) * zstride + (npos_y - emin_y) * ystride + 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 cid = data[idx]
local br = node_blastres[cid] or INDESTRUCT_BLASTRES 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_y = rdir_y / rdir_len
rdir_z = rdir_z / 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_x = rpos_x + rdir_x * STEP_LENGTH
rpos_y = rpos_y + rdir_y * STEP_LENGTH rpos_y = rpos_y + rdir_y * STEP_LENGTH
rpos_z = rpos_z + rdir_z * 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_y = math.floor(rpos_y + 0.5)
local npos_z = math.floor(rpos_z + 0.5) local npos_z = math.floor(rpos_z + 0.5)
local idx = (npos_z - emin_z) * zstride + (npos_y - emin_y) * ystride + 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 cid = data[idx]
@ -333,17 +333,16 @@ local function trace_explode(pos, strength, raydirs, radius, info, direct, sourc
end end
if sleep_formspec_doesnt_close_mt53 then if sleep_formspec_doesnt_close_mt53 then
minetest.after(0.3, minetest.after(0.3, function() -- 0.2 is minimum delay for closing old formspec and open died formspec -- TODO: REMOVE THIS IN THE FUTURE
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
if not obj:is_player() then return
return end
end mcl_util.deal_damage(obj, damage, {type = "explosion", direct = direct, source = source})
mcl_util.deal_damage(obj, damage, { type = "explosion", direct = direct, source = source })
obj:add_velocity(vector.multiply(punch_dir, impact * 20)) obj:add_velocity(vector.multiply(punch_dir, impact * 20))
end) end)
else 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 if obj:is_player() or ent.tnt_knockback then
obj:add_velocity(vector.multiply(punch_dir, impact * 20)) obj:add_velocity(vector.multiply(punch_dir, impact * 20))
@ -389,24 +388,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 -- We use bulk_set_node instead of LVM because we want to have on_destruct and
-- on_construct being called -- on_construct being called
if #airs > 0 then if #airs > 0 then
bulk_set_node(airs, { name = "air" }) bulk_set_node(airs, {name="air"})
end end
if #fires > 0 then if #fires > 0 then
bulk_set_node(fires, { name = "mcl_fire:fire" }) bulk_set_node(fires, {name="mcl_fire:fire"})
end end
-- Update falling nodes -- Update falling nodes
for a = 1, #airs do for a=1, #airs do
local p = airs[a] 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 end
for f = 1, #fires do for f=1, #fires do
local p = fires[f] 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 end
-- Log explosion -- Log explosion
minetest.log("action", "Explosion at " .. pos_to_string(pos) .. " with strength " .. strength .. " and radius " .. minetest.log("action", "Explosion at "..pos_to_string(pos).." with strength "..strength.." and radius "..radius)
radius)
end end
-- Create an explosion with strength at pos. -- Create an explosion with strength at pos.
@ -430,11 +428,6 @@ end
-- griefing - If true, the explosion will destroy nodes (default: true) -- griefing - If true, the explosion will destroy nodes (default: true)
-- grief_protected - If true, the explosion will also destroy nodes which have -- grief_protected - If true, the explosion will also destroy nodes which have
-- been protected (default: false) -- 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) function mcl_explosions.explode(pos, strength, info, direct, source)
if info == nil then if info == nil then
info = {} info = {}

View File

@ -1,2 +0,0 @@
# textdomain:mcl_explosions
@1 was caught in an explosion.=@1は爆発に巻き込まれた。

View File

@ -3,26 +3,26 @@ mcl_vars = {}
mcl_vars.redstone_tick = 0.1 mcl_vars.redstone_tick = 0.1
-- GUI / inventory menu settings --- GUI / inventory menu settings
mcl_vars.gui_slots = "listcolors[#9990;#FFF7;#FFF0;#000;#FFF]" mcl_vars.gui_slots = "listcolors[#9990;#FFF7;#FFF0;#000;#FFF]"
-- nonbg is added as formspec prepend in mcl_formspec_prepend -- nonbg is added as formspec prepend in mcl_formspec_prepend
mcl_vars.gui_nonbg = table.concat({ mcl_vars.gui_nonbg = mcl_vars.gui_slots ..
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[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[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[field;textcolor=#323232]", "style_type[label;textcolor=#323232]"..
"style_type[label;textcolor=#323232]", "style_type[textarea;textcolor=#323232]"..
"style_type[textarea;textcolor=#323232]", "style_type[checkbox;textcolor=#323232]"
"style_type[checkbox;textcolor=#323232]",
})
-- Background stuff must be manually added by mods (no formspec prepend) -- Background stuff must be manually added by mods (no formspec prepend)
mcl_vars.gui_bg_color = "bgcolor[#00000000]" mcl_vars.gui_bg_color = "bgcolor[#00000000]"
mcl_vars.gui_bg_img = "background9[1,1;1,1;mcl_base_textures_background9.png;true;7]" 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 -- 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 -- Mapgen variables
local mg_name = minetest.get_mapgen_setting("mg_name") 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.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.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) 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) 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.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 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_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 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 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 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) / local mapgen_limit_b = math.floor(math.min(mcl_vars.mapgen_limit, mcl_vars.MAX_MAP_GENERATION_LIMIT) / mcl_vars.MAP_BLOCKSIZE)
mcl_vars.MAP_BLOCKSIZE)
local mapgen_limit_min = -mapgen_limit_b * 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 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 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. 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_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 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) local function coordinate_to_block(x)
return math.floor(x / mcl_vars.MAP_BLOCKSIZE) return math.floor(x / mcl_vars.MAP_BLOCKSIZE)
end end
---@param x integer
---@return integer
local function coordinate_to_chunk(x) local function coordinate_to_chunk(x)
return math.floor((coordinate_to_block(x) - central_chunk_offset) / mcl_vars.chunksize) return math.floor((coordinate_to_block(x) - central_chunk_offset) / mcl_vars.chunksize)
end end
---@param pos Vector
---@return Vector
function mcl_vars.pos_to_block(pos) function mcl_vars.pos_to_block(pos)
return vector.new( return {
coordinate_to_block(pos.x), x = coordinate_to_block(pos.x),
coordinate_to_block(pos.y), y = coordinate_to_block(pos.y),
coordinate_to_block(pos.z) z = coordinate_to_block(pos.z)
) }
end end
---@param pos Vector
---@return Vector
function mcl_vars.pos_to_chunk(pos) function mcl_vars.pos_to_chunk(pos)
return vector.new( return {
coordinate_to_chunk(pos.x), x = coordinate_to_chunk(pos.x),
coordinate_to_chunk(pos.y), y = coordinate_to_chunk(pos.y),
coordinate_to_chunk(pos.z) z = coordinate_to_chunk(pos.z)
) }
end end
local k_positive = math.ceil(mcl_vars.MAX_MAP_GENERATION_LIMIT / mcl_vars.chunk_size_in_nodes) 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_z = k_positive * 2
local k_positive_y = k_positive_z * k_positive_z local k_positive_y = k_positive_z * k_positive_z
---@param pos Vector
---@return integer
function mcl_vars.get_chunk_number(pos) -- unsigned int function mcl_vars.get_chunk_number(pos) -- unsigned int
local c = mcl_vars.pos_to_chunk(pos) 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.z + k_positive) * k_positive_z +
c.x + k_positive c.x + k_positive
end end
if not superflat and not singlenode then if not superflat and not singlenode then
@ -131,8 +117,11 @@ elseif singlenode then
mcl_vars.mg_bedrock_is_rough = false mcl_vars.mg_bedrock_is_rough = false
else else
-- Classic superflat -- 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_min = ground - 3
mcl_vars.mg_overworld_max_official = mcl_vars.mg_overworld_min + minecraft_height_limit 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 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_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_bottom_min = mcl_vars.mg_nether_min
mcl_vars.mg_bedrock_nether_top_max = mcl_vars.mg_nether_max 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 if not superflat then
mcl_vars.mg_bedrock_nether_bottom_max = mcl_vars.mg_bedrock_nether_bottom_min + 4 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 mcl_vars.mg_bedrock_nether_top_min = mcl_vars.mg_bedrock_nether_top_max - 4
@ -192,16 +180,14 @@ minetest.craftitemdef_default.stack_max = 64
math.randomseed(os.time()) math.randomseed(os.time())
local chunks = {} -- intervals of chunks generated local chunks = {} -- intervals of chunks generated
---@param pos Vector
function mcl_vars.add_chunk(pos) function mcl_vars.add_chunk(pos)
local n = mcl_vars.get_chunk_number(pos) -- unsigned int local n = mcl_vars.get_chunk_number(pos) -- unsigned int
local prev local prev
for i, d in pairs(chunks) do for i, d in pairs(chunks) do
if n <= d[2] then -- we've found it 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[2]) or (n >= d[1]) then return end -- already here
if n == d[1] - 1 then -- right before: if n == d[1]-1 then -- right before:
if prev and (prev[2] == n - 1) then if prev and (prev[2] == n-1) then
prev[2] = d[2] prev[2] = d[2]
table.remove(chunks, i) table.remove(chunks, i)
return return
@ -209,20 +195,17 @@ function mcl_vars.add_chunk(pos)
d[1] = n d[1] = n
return return
end 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 prev[2] = n
return return
end end
table.insert(chunks, i, { n, n }) -- insert new interval before i table.insert(chunks, i, {n, n}) -- insert new interval before i
return return
end end
prev = d prev = d
end end
chunks[#chunks + 1] = { n, n } chunks[#chunks+1] = {n, n}
end end
---@param pos Vector
---@return boolean
function mcl_vars.is_generated(pos) function mcl_vars.is_generated(pos)
local n = mcl_vars.get_chunk_number(pos) -- unsigned int local n = mcl_vars.get_chunk_number(pos) -- unsigned int
for i, d in pairs(chunks) do for i, d in pairs(chunks) do
@ -233,46 +216,47 @@ function mcl_vars.is_generated(pos)
return false return false
end end
---"Trivial" (actually NOT) function to just read the node and some stuff to not just return "ignore", like mt 5.4 does. -- "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. -- p: 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. -- force: 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 -- 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.
---@return node # Node definition, eg. `{name="air"}`. Unfortunately still can return `{name="ignore"}`. --
---@nodiscard -- returns node definition, eg. {name="air"}. Unfortunately still can return {name="ignore"}.
function mcl_vars.get_node(pos, force, us_timeout) function mcl_vars.get_node(p, force, us_timeout)
-- check initial circumstances -- 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 -- try common way
local node = minetest.get_node(pos) local node = minetest.get_node(p)
if node.name ~= "ignore" then if node.name ~= "ignore" then
return node return node
end end
-- copy vector to get sure it won't changed by other threads -- copy table to get sure it won't changed by other threads
local pos_copy = vector.copy(pos) local pos = {x=p.x,y=p.y,z=p.z}
-- try LVM -- try LVM
minetest.get_voxel_manip():read_from_map(pos_copy, pos_copy) minetest.get_voxel_manip():read_from_map(pos, pos)
node = minetest.get_node(pos_copy) node = minetest.get_node(pos)
if node.name ~= "ignore" or not force then if node.name ~= "ignore" or not force then
return node return node
end end
-- all ways failed - need to emerge (or forceload if generated) -- 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.chat_send_all("IMPOSSIBLE! Please report this to MCL2 issue tracker!")
minetest.forceload_block(pos_copy) minetest.forceload_block(pos)
else else
minetest.emerge_area(pos_copy, pos_copy) minetest.emerge_area(pos, pos)
end end
local t = minetest.get_us_time() 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 while (not node or node.name == "ignore") and (minetest.get_us_time() - t < us_timeout) do
node = minetest.get_node(pos_copy) node = minetest.get_node(pos)
end end
return node return node

View File

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

Before

Width:  |  Height:  |  Size: 126 B

After

Width:  |  Height:  |  Size: 126 B

View File

Before

Width:  |  Height:  |  Size: 127 B

After

Width:  |  Height:  |  Size: 127 B

View File

Before

Width:  |  Height:  |  Size: 91 B

After

Width:  |  Height:  |  Size: 91 B

View File

Before

Width:  |  Height:  |  Size: 137 B

After

Width:  |  Height:  |  Size: 137 B

View File

Before

Width:  |  Height:  |  Size: 145 B

After

Width:  |  Height:  |  Size: 145 B

View File

Before

Width:  |  Height:  |  Size: 125 B

After

Width:  |  Height:  |  Size: 125 B

View File

Before

Width:  |  Height:  |  Size: 183 B

After

Width:  |  Height:  |  Size: 183 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 262 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 B

View File

Before

Width:  |  Height:  |  Size: 126 B

After

Width:  |  Height:  |  Size: 126 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 216 B

View File

Before

Width:  |  Height:  |  Size: 144 B

After

Width:  |  Height:  |  Size: 144 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

Before

Width:  |  Height:  |  Size: 101 B

After

Width:  |  Height:  |  Size: 101 B

View File

Before

Width:  |  Height:  |  Size: 148 B

After

Width:  |  Height:  |  Size: 148 B

View File

Before

Width:  |  Height:  |  Size: 154 B

After

Width:  |  Height:  |  Size: 154 B

View File

Before

Width:  |  Height:  |  Size: 155 B

After

Width:  |  Height:  |  Size: 155 B

View File

Before

Width:  |  Height:  |  Size: 165 B

After

Width:  |  Height:  |  Size: 165 B

View File

@ -11,22 +11,42 @@ Creative Commons Attribution 3.0 Unported (CC BY-SA 3.0)
http://creativecommons.org/licenses/by/3.0/ http://creativecommons.org/licenses/by/3.0/
Glass breaking sounds (CC BY 3.0): Glass breaking sounds (CC BY 3.0):
1: http://www.freesound.org/people/cmusounddesign/sounds/71947/ 1: http://www.freesound.org/people/cmusounddesign/sounds/71947/
2: http://www.freesound.org/people/Tomlija/sounds/97669/ 2: http://www.freesound.org/people/Tomlija/sounds/97669/
3: http://www.freesound.org/people/lsprice/sounds/88808/ 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 default_tool_breaks.ogg by EdgardEdition (CC BY 3.0), http://www.freesound.org/people/EdgardEdition
Mito551 (sounds) (CC BY-SA 3.0): 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_dig_oddly_breakable_by_hand.ogg
default_dug_node.*.ogg default_dug_node.1.ogg
default_grass_footstep.*.ogg default_dug_node.2.ogg
default_gravel_footstep.*.ogg default_grass_footstep.1.ogg
default_place_node.*.ogg default_grass_footstep.2.ogg
default_place_node_hard.*.ogg default_grass_footstep.3.ogg
default_wood_footstep.*.ogg default_gravel_footstep.1.ogg
default_dirt_footstep.*.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 default_glass_footstep.ogg
Metal sounds: Metal sounds:
@ -34,64 +54,35 @@ Metal sounds:
- https://www.freesound.org/people/yadronoff/sounds/320397/ - https://www.freesound.org/people/yadronoff/sounds/320397/
default_dug_metal.*.ogg - Iwan Gabovitch - qubodup - CC0 default_dug_metal.*.ogg - Iwan Gabovitch - qubodup - CC0
- http://opengameart.org/users/qubodup - http://opengameart.org/users/qubodup
default_metal_footstep.*.ogg - (CC0 1.0) - CC0 1.0 default_metal_footstep.*.ogg - Ottomaani138 - CC0
- https://freesound.org/people/mypantsfelldown/sounds/398937/ - https://www.freesound.org/people/Ottomaani138/sounds/232692/
default_place_node_metal.*.ogg - Ogrebane - CC0 default_place_node_metal.*.ogg - Ogrebane - CC0
- http://opengameart.org/content/wood-and-metal-sound-effects-volume-2 - 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/ 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/ https://www.freesound.org/people/blukotek/sounds/251660/
default_dig_snappy.ogg default_dig_snappy.ogg
sonictechtonic (CC BY 3.0): sonictechtonic (CC BY 3.0)
https://www.freesound.org/people/sonictechtonic/sounds/241872/ https://www.freesound.org/people/sonictechtonic/sounds/241872/
player_damage.ogg player_damage.ogg
Sheyvan (CC0 1.0): Voxelands project <http://www.voxelands.com/> (CC BY-SA 3.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):
mcl_sounds_place_node_water.ogg mcl_sounds_place_node_water.ogg
mcl_sounds_dug_water.ogg mcl_sounds_dug_water.ogg
(Note: Artists from the Voxelands project include: sdzen, darkrose, sapier, (Note: Artists from the Voxelands project include: sdzen, darkrose, sapier,
Tom Peter, Telaron, juskiddink) 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 default_place_node_lava.ogg
Adam_N (CC0 1.0): Adam_N (CC0 1.0):
@ -99,7 +90,7 @@ Adam_N (CC0 1.0):
Source: <https://www.freesound.org/people/Adam_N/sounds/346692/> Source: <https://www.freesound.org/people/Adam_N/sounds/346692/>
Alecia Shepherd (CC BY-SA 4.0): 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> Source: SnowSong sound and music pack <https://opengameart.org/content/snowsong-sound-and-music-pack>
Unknown authors (WTFPL): Unknown authors (WTFPL):

View File

@ -11,7 +11,7 @@ function mcl_sounds.node_sound_defaults(table)
table.dug = table.dug or table.dug = table.dug or
{name="default_dug_node", gain=0.25} {name="default_dug_node", gain=0.25}
table.dig = table.dig or 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 table.place = table.place or
{name="default_place_node_hard", gain=1.0} {name="default_place_node_hard", gain=1.0}
return table return table
@ -20,11 +20,11 @@ end
function mcl_sounds.node_sound_stone_defaults(table) function mcl_sounds.node_sound_stone_defaults(table)
table = table or {} table = table or {}
table.footstep = table.footstep 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 table.dug = table.dug or
{name="default_hard_footstep", gain=1.0} {name="default_hard_footstep", gain=1.0}
table.dig = table.dig or 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) mcl_sounds.node_sound_defaults(table)
return table return table
end end
@ -32,13 +32,13 @@ end
function mcl_sounds.node_sound_metal_defaults(table) function mcl_sounds.node_sound_metal_defaults(table)
table = table or {} table = table or {}
table.footstep = table.footstep 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 table.dug = table.dug or
{name="default_dug_metal", gain=0.5} {name="default_dug_metal", gain=1.0}
table.dig = table.dig or table.dig = table.dig or
{name="default_dig_metal", gain=0.5} {name="default_dig_metal", gain=1.0}
table.place = table.place or 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) mcl_sounds.node_sound_defaults(table)
return table return table
end end
@ -46,11 +46,11 @@ end
function mcl_sounds.node_sound_dirt_defaults(table) function mcl_sounds.node_sound_dirt_defaults(table)
table = table or {} table = table or {}
table.footstep = table.footstep 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} {name="default_dirt_footstep", gain=1.0}
table.dug = table.dug or
{name="default_dirt_footstep", gain=1.5}
table.dig = table.dig or table.dig = table.dig or
{name="default_dig_crumbly", gain=0.4} {name="default_dig_crumbly", gain=1.0}
table.place = table.place or table.place = table.place or
{name="default_place_node", gain=1.0} {name="default_place_node", gain=1.0}
mcl_sounds.node_sound_defaults(table) mcl_sounds.node_sound_defaults(table)
@ -60,25 +60,11 @@ end
function mcl_sounds.node_sound_sand_defaults(table) function mcl_sounds.node_sound_sand_defaults(table)
table = table or {} table = table or {}
table.footstep = table.footstep 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 table.dug = table.dug or
{name="default_sand_footstep", gain=0.15} {name="default_sand_footstep", gain=1.0}
table.dig = table.dig or 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)
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}
table.place = table.place or table.place = table.place or
{name="default_place_node", gain=1.0} {name="default_place_node", gain=1.0}
mcl_sounds.node_sound_defaults(table) mcl_sounds.node_sound_defaults(table)
@ -92,33 +78,21 @@ function mcl_sounds.node_sound_snow_defaults(table)
table.dug = table.dug or table.dug = table.dug or
{name="pedology_snow_soft_footstep", gain=1.0} {name="pedology_snow_soft_footstep", gain=1.0}
table.dig = table.dig or 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 table.place = table.place or
{name="default_place_node", gain=1.0} {name="default_place_node", gain=1.0}
mcl_sounds.node_sound_defaults(table) mcl_sounds.node_sound_defaults(table)
return table return table
end 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) function mcl_sounds.node_sound_wood_defaults(table)
table = table or {} table = table or {}
table.footstep = table.footstep 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 table.dug = table.dug or
{name="default_wood_footstep", gain=1.0} {name="default_wood_footstep", gain=1.0}
table.dig = table.dig or 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) mcl_sounds.node_sound_defaults(table)
return table return table
end end
@ -154,11 +128,11 @@ end
function mcl_sounds.node_sound_glass_defaults(table) function mcl_sounds.node_sound_glass_defaults(table)
table = table or {} table = table or {}
table.footstep = table.footstep 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 table.dug = table.dug or
{name="default_break_glass", gain=1.0} {name="default_break_glass", gain=1.0}
table.dig = table.dig or 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) mcl_sounds.node_sound_defaults(table)
return table return table
end end

Binary file not shown.

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More