forked from VoxeLibre/VoxeLibre
Merge branch 'master' into simplified_palette_index
This commit is contained in:
commit
39bcf2f961
|
@ -0,0 +1,36 @@
|
||||||
|
---
|
||||||
|
|
||||||
|
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!
|
|
@ -0,0 +1,26 @@
|
||||||
|
---
|
||||||
|
|
||||||
|
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!
|
|
@ -0,0 +1,25 @@
|
||||||
|
---
|
||||||
|
|
||||||
|
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?
|
|
@ -0,0 +1,20 @@
|
||||||
|
---
|
||||||
|
|
||||||
|
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!
|
|
@ -158,7 +158,7 @@ The following features are incomplete:
|
||||||
|
|
||||||
* Some monsters and animals
|
* Some monsters and animals
|
||||||
* Redstone-related things
|
* Redstone-related things
|
||||||
* Special minecarts
|
* Some special minecarts (hopper and chest minecarts work)
|
||||||
* 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):
|
||||||
|
|
|
@ -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 = mcl_vars.gui_slots ..
|
mcl_vars.gui_nonbg = table.concat({
|
||||||
"style_type[image_button;border=false;bgimg=mcl_inventory_button9.png;bgimg_pressed=mcl_inventory_button9_pressed.png;bgimg_middle=2,2]"..
|
mcl_vars.gui_slots,
|
||||||
"style_type[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[field;textcolor=#323232]"..
|
"style_type[button;border=false;bgimg=mcl_inventory_button9.png;bgimg_pressed=mcl_inventory_button9_pressed.png;bgimg_middle=2,2]",
|
||||||
"style_type[label;textcolor=#323232]"..
|
"style_type[field;textcolor=#323232]",
|
||||||
"style_type[textarea;textcolor=#323232]"..
|
"style_type[label;textcolor=#323232]",
|
||||||
"style_type[checkbox;textcolor=#323232]"
|
"style_type[textarea;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 = { x = 1.8, y = 1.8, z = 1 }
|
mcl_vars.tool_wield_scale = vector.new(1.8, 1.8, 1)
|
||||||
|
|
||||||
-- Mapgen variables
|
-- Mapgen variables
|
||||||
local mg_name = minetest.get_mapgen_setting("mg_name")
|
local mg_name = minetest.get_mapgen_setting("mg_name")
|
||||||
|
@ -35,53 +35,67 @@ 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) / 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_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 {
|
return vector.new(
|
||||||
x = coordinate_to_block(pos.x),
|
coordinate_to_block(pos.x),
|
||||||
y = coordinate_to_block(pos.y),
|
coordinate_to_block(pos.y),
|
||||||
z = coordinate_to_block(pos.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 {
|
return vector.new(
|
||||||
x = coordinate_to_chunk(pos.x),
|
coordinate_to_chunk(pos.x),
|
||||||
y = coordinate_to_chunk(pos.y),
|
coordinate_to_chunk(pos.y),
|
||||||
z = coordinate_to_chunk(pos.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
|
return (c.y + k_positive) * k_positive_y +
|
||||||
(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
|
||||||
|
@ -117,11 +131,8 @@ 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 = minetest.get_mapgen_setting("mgflat_ground_level")
|
local ground = tonumber(minetest.get_mapgen_setting("mgflat_ground_level")) or 8
|
||||||
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
|
||||||
|
@ -181,6 +192,8 @@ 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
|
||||||
|
@ -207,6 +220,9 @@ function mcl_vars.add_chunk(pos)
|
||||||
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
|
||||||
|
@ -217,47 +233,46 @@ 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.
|
||||||
-- p: Position, if it's wrong, {name="error"} node will return.
|
---@param pos Vector 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.
|
---@param force? boolean 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.
|
---@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"}`.
|
||||||
-- returns node definition, eg. {name="air"}. Unfortunately still can return {name="ignore"}.
|
---@nodiscard
|
||||||
function mcl_vars.get_node(p, force, us_timeout)
|
function mcl_vars.get_node(pos, force, us_timeout)
|
||||||
-- check initial circumstances
|
-- check initial circumstances
|
||||||
if not p or not p.x or not p.y or not p.z then return {name="error"} end
|
if not pos or not pos.x or not pos.y or not pos.z then return { name = "error" } end
|
||||||
|
|
||||||
-- try common way
|
-- try common way
|
||||||
local node = minetest.get_node(p)
|
local node = minetest.get_node(pos)
|
||||||
if node.name ~= "ignore" then
|
if node.name ~= "ignore" then
|
||||||
return node
|
return node
|
||||||
end
|
end
|
||||||
|
|
||||||
-- copy table to get sure it won't changed by other threads
|
-- copy vector to get sure it won't changed by other threads
|
||||||
local pos = {x=p.x,y=p.y,z=p.z}
|
local pos_copy = vector.copy(pos)
|
||||||
|
|
||||||
-- try LVM
|
-- try LVM
|
||||||
minetest.get_voxel_manip():read_from_map(pos, pos)
|
minetest.get_voxel_manip():read_from_map(pos_copy, pos_copy)
|
||||||
node = minetest.get_node(pos)
|
node = minetest.get_node(pos_copy)
|
||||||
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)
|
||||||
local us_timeout = us_timeout or 244
|
if mcl_vars.is_generated(pos_copy) then
|
||||||
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)
|
minetest.forceload_block(pos_copy)
|
||||||
else
|
else
|
||||||
minetest.emerge_area(pos, pos)
|
minetest.emerge_area(pos_copy, pos_copy)
|
||||||
end
|
end
|
||||||
|
|
||||||
local t = minetest.get_us_time()
|
local t = minetest.get_us_time()
|
||||||
|
|
||||||
node = minetest.get_node(pos)
|
node = minetest.get_node(pos_copy)
|
||||||
|
|
||||||
while (not node or node.name == "ignore") and (minetest.get_us_time() - t < us_timeout) do
|
while (not node or node.name == "ignore") and (minetest.get_us_time() - t < (us_timeout or 244)) do
|
||||||
node = minetest.get_node(pos)
|
node = minetest.get_node(pos_copy)
|
||||||
end
|
end
|
||||||
|
|
||||||
return node
|
return node
|
||||||
|
|
|
@ -14,24 +14,17 @@ local function mcl_log (message)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
minetest.register_on_joinplayer(function(player)
|
minetest.register_on_joinplayer(function(player)
|
||||||
local name
|
pool[player:get_player_name()] = 0
|
||||||
name = player:get_player_name()
|
|
||||||
pool[name] = 0
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
minetest.register_on_leaveplayer(function(player)
|
minetest.register_on_leaveplayer(function(player)
|
||||||
local name
|
pool[player:get_player_name()] = nil
|
||||||
name = player:get_player_name()
|
|
||||||
pool[name] = nil
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|
||||||
local has_awards = minetest.get_modpath("awards")
|
local has_awards = minetest.get_modpath("awards")
|
||||||
|
|
||||||
local mcl_item_entity = {}
|
mcl_item_entity = {}
|
||||||
|
|
||||||
--basic settings
|
--basic settings
|
||||||
local item_drop_settings = {} --settings table
|
local item_drop_settings = {} --settings table
|
||||||
|
@ -52,16 +45,23 @@ local function get_gravity()
|
||||||
return tonumber(minetest.settings:get("movement_gravity")) or 9.81
|
return tonumber(minetest.settings:get("movement_gravity")) or 9.81
|
||||||
end
|
end
|
||||||
|
|
||||||
local registered_pickup_achievement = {}
|
mcl_item_entity.registered_pickup_achievement = {}
|
||||||
|
|
||||||
--TODO: remove limitation of 1 award per itemname
|
---Register an achievement that will be unlocked on pickup.
|
||||||
|
---
|
||||||
|
---TODO: remove limitation of 1 award per itemname
|
||||||
|
---@param itemname string
|
||||||
|
---@param award string
|
||||||
function mcl_item_entity.register_pickup_achievement(itemname, award)
|
function mcl_item_entity.register_pickup_achievement(itemname, award)
|
||||||
if not has_awards then
|
if not has_awards then
|
||||||
minetest.log("warning", "[mcl_item_entity] Trying to register pickup achievement ["..award.."] for ["..itemname.."] while awards missing")
|
minetest.log("warning",
|
||||||
elseif registered_pickup_achievement[itemname] then
|
"[mcl_item_entity] Trying to register pickup achievement [" .. award .. "] for [" ..
|
||||||
minetest.log("error", "[mcl_item_entity] Trying to register already existing pickup achievement ["..award.."] for ["..itemname.."]")
|
itemname .. "] while awards missing")
|
||||||
|
elseif mcl_item_entity.registered_pickup_achievement[itemname] then
|
||||||
|
minetest.log("error",
|
||||||
|
"[mcl_item_entity] Trying to register already existing pickup achievement [" .. award .. "] for [" .. itemname .. "]")
|
||||||
else
|
else
|
||||||
registered_pickup_achievement[itemname] = award
|
mcl_item_entity.registered_pickup_achievement[itemname] = award
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -74,11 +74,13 @@ mcl_item_entity.register_pickup_achievement("mcl_nether:ancient_debris", "mcl:hi
|
||||||
mcl_item_entity.register_pickup_achievement("mcl_end:dragon_egg", "mcl:PickUpDragonEgg")
|
mcl_item_entity.register_pickup_achievement("mcl_end:dragon_egg", "mcl:PickUpDragonEgg")
|
||||||
mcl_item_entity.register_pickup_achievement("mcl_armor:elytra", "mcl:skysTheLimit")
|
mcl_item_entity.register_pickup_achievement("mcl_armor:elytra", "mcl:skysTheLimit")
|
||||||
|
|
||||||
|
---@param object ObjectRef
|
||||||
|
---@param player ObjectRef
|
||||||
local function check_pickup_achievements(object, player)
|
local function check_pickup_achievements(object, player)
|
||||||
if has_awards then
|
if has_awards then
|
||||||
local itemname = ItemStack(object:get_luaentity().itemstring):get_name()
|
local itemname = ItemStack(object:get_luaentity().itemstring):get_name()
|
||||||
local playername = player:get_player_name()
|
local playername = player:get_player_name()
|
||||||
for name,award in pairs(registered_pickup_achievement) do
|
for name, award in pairs(mcl_item_entity.registered_pickup_achievement) do
|
||||||
if itemname == name or minetest.get_item_group(itemname, name) ~= 0 then
|
if itemname == name or minetest.get_item_group(itemname, name) ~= 0 then
|
||||||
awards.unlock(playername, award)
|
awards.unlock(playername, award)
|
||||||
end
|
end
|
||||||
|
@ -86,16 +88,23 @@ local function check_pickup_achievements(object, player)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---@param object ObjectRef
|
||||||
|
---@param luaentity Luaentity
|
||||||
|
---@param ignore_check? boolean
|
||||||
local function enable_physics(object, luaentity, ignore_check)
|
local function enable_physics(object, luaentity, ignore_check)
|
||||||
if luaentity.physical_state == false or ignore_check == true then
|
if luaentity.physical_state == false or ignore_check == true then
|
||||||
luaentity.physical_state = true
|
luaentity.physical_state = true
|
||||||
object:set_properties({
|
object:set_properties({
|
||||||
physical = true
|
physical = true
|
||||||
})
|
})
|
||||||
object:set_acceleration({x=0,y=-get_gravity(),z=0})
|
object:set_acceleration(vector.new(0, -get_gravity(), 0))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---@param object ObjectRef
|
||||||
|
---@param luaentity Luaentity
|
||||||
|
---@param ignore_check? boolean
|
||||||
|
---@param reset_movement? boolean
|
||||||
local function disable_physics(object, luaentity, ignore_check, reset_movement)
|
local function disable_physics(object, luaentity, ignore_check, reset_movement)
|
||||||
if luaentity.physical_state == true or ignore_check == true then
|
if luaentity.physical_state == true or ignore_check == true then
|
||||||
luaentity.physical_state = false
|
luaentity.physical_state = false
|
||||||
|
@ -103,14 +112,13 @@ local function disable_physics(object, luaentity, ignore_check, reset_movement)
|
||||||
physical = false
|
physical = false
|
||||||
})
|
})
|
||||||
if reset_movement ~= false then
|
if reset_movement ~= false then
|
||||||
object:set_velocity({x=0,y=0,z=0})
|
object:set_velocity(vector.zero())
|
||||||
object:set_acceleration({x=0,y=0,z=0})
|
object:set_acceleration(vector.zero())
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
minetest.register_globalstep(function(_)
|
||||||
minetest.register_globalstep(function(dtime)
|
|
||||||
tick = not tick
|
tick = not tick
|
||||||
|
|
||||||
for _, player in pairs(minetest.get_connected_players()) do
|
for _, player in pairs(minetest.get_connected_players()) do
|
||||||
|
@ -135,15 +143,18 @@ minetest.register_globalstep(function(dtime)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
local inv = player:get_inventory()
|
local inv = player:get_inventory()
|
||||||
local checkpos = {x=pos.x,y=pos.y + item_drop_settings.player_collect_height,z=pos.z}
|
local checkpos = vector.offset(pos, 0, item_drop_settings.player_collect_height, 0)
|
||||||
|
|
||||||
--magnet and collection
|
--magnet and collection
|
||||||
for _, object in pairs(minetest.get_objects_inside_radius(checkpos, item_drop_settings.xp_radius_magnet)) do
|
for _, object in pairs(minetest.get_objects_inside_radius(checkpos, item_drop_settings.xp_radius_magnet)) do
|
||||||
if not object:is_player() and vector.distance(checkpos, object:get_pos()) < item_drop_settings.radius_magnet and object:get_luaentity() and object:get_luaentity().name == "__builtin:item" and object:get_luaentity()._magnet_timer and (object:get_luaentity()._insta_collect or (object:get_luaentity().age > item_drop_settings.age)) then
|
if not object:is_player() and vector.distance(checkpos, object:get_pos()) < item_drop_settings.radius_magnet and
|
||||||
|
object:get_luaentity() and object:get_luaentity().name == "__builtin:item" and object:get_luaentity()._magnet_timer
|
||||||
|
and (object:get_luaentity()._insta_collect or (object:get_luaentity().age > item_drop_settings.age)) then
|
||||||
|
|
||||||
if object:get_luaentity()._magnet_timer >= 0 and object:get_luaentity()._magnet_timer < item_drop_settings.magnet_time and inv and inv:room_for_item("main", ItemStack(object:get_luaentity().itemstring)) then
|
if object:get_luaentity()._magnet_timer >= 0 and
|
||||||
|
object:get_luaentity()._magnet_timer < item_drop_settings.magnet_time and inv and
|
||||||
|
inv:room_for_item("main", ItemStack(object:get_luaentity().itemstring)) then
|
||||||
|
|
||||||
-- Collection
|
-- Collection
|
||||||
if not object:get_luaentity()._removed then
|
if not object:get_luaentity()._removed then
|
||||||
|
@ -158,8 +169,8 @@ minetest.register_globalstep(function(dtime)
|
||||||
object:get_luaentity().target = checkpos
|
object:get_luaentity().target = checkpos
|
||||||
object:get_luaentity()._removed = true
|
object:get_luaentity()._removed = true
|
||||||
|
|
||||||
object:set_velocity({x=0,y=0,z=0})
|
object:set_velocity(vector.zero())
|
||||||
object:set_acceleration({x=0,y=0,z=0})
|
object:set_acceleration(vector.zero())
|
||||||
|
|
||||||
object:move_to(checkpos)
|
object:move_to(checkpos)
|
||||||
|
|
||||||
|
@ -179,7 +190,6 @@ minetest.register_globalstep(function(dtime)
|
||||||
local entity = object:get_luaentity()
|
local entity = object:get_luaentity()
|
||||||
entity.collector = player:get_player_name()
|
entity.collector = player:get_player_name()
|
||||||
entity.collected = true
|
entity.collected = true
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -194,6 +204,11 @@ end)
|
||||||
|
|
||||||
local tmp_id = 0
|
local tmp_id = 0
|
||||||
|
|
||||||
|
---@param drop string|drop_definition
|
||||||
|
---@param toolname string
|
||||||
|
---@param param2 integer
|
||||||
|
---@param paramtype2 paramtype2
|
||||||
|
---@return string[]
|
||||||
local function get_drops(drop, toolname, param2, paramtype2)
|
local function get_drops(drop, toolname, param2, paramtype2)
|
||||||
tmp_id = tmp_id + 1
|
tmp_id = tmp_id + 1
|
||||||
local tmp_node_name = "mcl_item_entity:" .. tmp_id
|
local tmp_node_name = "mcl_item_entity:" .. tmp_id
|
||||||
|
@ -265,7 +280,7 @@ function minetest.handle_node_drops(pos, drops, digger)
|
||||||
* table: Drop every itemstring in this table when dug by shears _mcl_silk_touch_drop
|
* table: Drop every itemstring in this table when dug by shears _mcl_silk_touch_drop
|
||||||
]]
|
]]
|
||||||
|
|
||||||
local enchantments = tool and mcl_enchanting.get_enchantments(tool, "silk_touch")
|
local enchantments = tool and mcl_enchanting.get_enchantments(tool)
|
||||||
|
|
||||||
local silk_touch_drop = false
|
local silk_touch_drop = false
|
||||||
local nodedef = minetest.registered_nodes[dug_node.name]
|
local nodedef = minetest.registered_nodes[dug_node.name]
|
||||||
|
@ -294,7 +309,8 @@ function minetest.handle_node_drops(pos, drops, digger)
|
||||||
local max_count = fortune_drop.max_count + fortune_level * (fortune_drop.factor or 1)
|
local max_count = fortune_drop.max_count + fortune_level * (fortune_drop.factor or 1)
|
||||||
local chance = fortune_drop.chance or fortune_drop.get_chance and fortune_drop.get_chance(fortune_level)
|
local chance = fortune_drop.chance or fortune_drop.get_chance and fortune_drop.get_chance(fortune_level)
|
||||||
if not chance or math.random() < chance then
|
if not chance or math.random() < chance then
|
||||||
drops = discrete_uniform_distribution(fortune_drop.multiply and drops or fortune_drop.items, min_count, max_count, fortune_drop.cap)
|
drops = discrete_uniform_distribution(fortune_drop.multiply and drops or fortune_drop.items, min_count, max_count,
|
||||||
|
fortune_drop.cap)
|
||||||
elseif fortune_drop.override then
|
elseif fortune_drop.override then
|
||||||
drops = {}
|
drops = {}
|
||||||
end
|
end
|
||||||
|
@ -348,7 +364,7 @@ end
|
||||||
function minetest.item_drop(itemstack, dropper, pos)
|
function minetest.item_drop(itemstack, dropper, pos)
|
||||||
if dropper and dropper:is_player() then
|
if dropper and dropper:is_player() then
|
||||||
local v = dropper:get_look_dir()
|
local v = dropper:get_look_dir()
|
||||||
local p = {x=pos.x, y=pos.y+1.2, z=pos.z}
|
local p = vector.offset(pos, 0, 1.2, 0)
|
||||||
local cs = itemstack:get_count()
|
local cs = itemstack:get_count()
|
||||||
if dropper:get_player_control().sneak then
|
if dropper:get_player_control().sneak then
|
||||||
cs = 1
|
cs = 1
|
||||||
|
@ -548,7 +564,7 @@ minetest.register_entity(":__builtin:item", {
|
||||||
local z = math.random(5, 10) / 10 * v
|
local z = math.random(5, 10) / 10 * v
|
||||||
if math.random(0, 10) < 5 then z = -z end
|
if math.random(0, 10) < 5 then z = -z end
|
||||||
local y = math.random(2, 4)
|
local y = math.random(2, 4)
|
||||||
self.object:set_velocity({x=x, y=y, z=z})
|
self.object:set_velocity(vector.new(x, y, z))
|
||||||
end
|
end
|
||||||
self.random_velocity = 0
|
self.random_velocity = 0
|
||||||
end,
|
end,
|
||||||
|
@ -696,8 +712,8 @@ minetest.register_entity(":__builtin:item", {
|
||||||
self._forcetimer = 0
|
self._forcetimer = 0
|
||||||
|
|
||||||
self.object:set_armor_groups({ immortal = 1 })
|
self.object:set_armor_groups({ immortal = 1 })
|
||||||
-- self.object:set_velocity({x = 0, y = 2, z = 0})
|
-- self.object:set_velocity(vector.new(0, 2, 0))
|
||||||
self.object:set_acceleration({x = 0, y = -get_gravity(), z = 0})
|
self.object:set_acceleration(vector.new(0, -get_gravity(), 0))
|
||||||
self:set_item(self.itemstring)
|
self:set_item(self.itemstring)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
|
@ -745,8 +761,8 @@ minetest.register_entity(":__builtin:item", {
|
||||||
self.object:set_properties({
|
self.object:set_properties({
|
||||||
physical = false
|
physical = false
|
||||||
})
|
})
|
||||||
self.object:set_velocity({x=0,y=0,z=0})
|
self.object:set_velocity(vector.zero())
|
||||||
self.object:set_acceleration({x=0,y=0,z=0})
|
self.object:set_acceleration(vector.zero())
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
self.age = self.age + dtime
|
self.age = self.age + dtime
|
||||||
|
@ -761,21 +777,22 @@ minetest.register_entity(":__builtin:item", {
|
||||||
-- Delete corrupted item entities. The itemstring MUST be non-empty on its first step,
|
-- Delete corrupted item entities. The itemstring MUST be non-empty on its first step,
|
||||||
-- otherwise there might have some data corruption.
|
-- otherwise there might have some data corruption.
|
||||||
if self.itemstring == "" then
|
if self.itemstring == "" then
|
||||||
minetest.log("warning", "Item entity with empty itemstring found at "..minetest.pos_to_string(self.object:get_pos()).. "! Deleting it now.")
|
minetest.log("warning",
|
||||||
|
"Item entity with empty itemstring found at " .. minetest.pos_to_string(self.object:get_pos()) ..
|
||||||
|
"! Deleting it now.")
|
||||||
self._removed = true
|
self._removed = true
|
||||||
self.object:remove()
|
self.object:remove()
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local p = self.object:get_pos()
|
local p = self.object:get_pos()
|
||||||
|
|
||||||
-- If hopper has taken item, it has gone, and no operations should be conducted on this item
|
-- If hopper has taken item, it has gone, and no operations should be conducted on this item
|
||||||
if hopper_take_item(self, p) then
|
if hopper_take_item(self, p) then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local node = minetest.get_node_or_nil(p)
|
local node = minetest.get_node(p)
|
||||||
local in_unloaded = (node == nil)
|
local in_unloaded = node.name == "ignore"
|
||||||
|
|
||||||
if in_unloaded then
|
if in_unloaded then
|
||||||
-- Don't infinetly fall into unloaded map
|
-- Don't infinetly fall into unloaded map
|
||||||
|
@ -791,7 +808,7 @@ minetest.register_entity(":__builtin:item", {
|
||||||
|
|
||||||
local nn = node.name
|
local nn = node.name
|
||||||
local is_in_water = (minetest.get_item_group(nn, "liquid") ~= 0)
|
local is_in_water = (minetest.get_item_group(nn, "liquid") ~= 0)
|
||||||
local nn_above = minetest.get_node({x=p.x, y=p.y+0.1, z=p.z}).name
|
local nn_above = minetest.get_node(vector.offset(p, 0, 0.1, 0)).name
|
||||||
-- make sure it's more or less stationary and is at water level
|
-- make sure it's more or less stationary and is at water level
|
||||||
local sleep_threshold = 0.3
|
local sleep_threshold = 0.3
|
||||||
local is_floating = false
|
local is_floating = false
|
||||||
|
@ -804,8 +821,8 @@ minetest.register_entity(":__builtin:item", {
|
||||||
end
|
end
|
||||||
|
|
||||||
if is_floating and self.physical_state == true then
|
if is_floating and self.physical_state == true then
|
||||||
self.object:set_velocity({x = 0, y = 0, z = 0})
|
self.object:set_velocity(vector.zero())
|
||||||
self.object:set_acceleration({x = 0, y = 0, z = 0})
|
self.object:set_acceleration(vector.zero())
|
||||||
disable_physics(self.object, self)
|
disable_physics(self.object, self)
|
||||||
end
|
end
|
||||||
-- If no collector was found for a long enough time, declare the magnet as disabled
|
-- If no collector was found for a long enough time, declare the magnet as disabled
|
||||||
|
@ -875,7 +892,7 @@ minetest.register_entity(":__builtin:item", {
|
||||||
end
|
end
|
||||||
-- If none of the 4 sides is free, shoot upwards
|
-- If none of the 4 sides is free, shoot upwards
|
||||||
if shootdir == nil then
|
if shootdir == nil then
|
||||||
shootdir = { x=0, y=1, z=0 }
|
shootdir = vector.new(0, 1, 0)
|
||||||
local nn = minetest.get_node(vector.add(p, shootdir)).name
|
local nn = minetest.get_node(vector.add(p, shootdir)).name
|
||||||
if nn == "ignore" then
|
if nn == "ignore" then
|
||||||
-- Do not push into ignore
|
-- Do not push into ignore
|
||||||
|
@ -885,7 +902,7 @@ minetest.register_entity(":__builtin:item", {
|
||||||
|
|
||||||
-- Set new item moving speed accordingly
|
-- Set new item moving speed accordingly
|
||||||
local newv = vector.multiply(shootdir, 3)
|
local newv = vector.multiply(shootdir, 3)
|
||||||
self.object:set_acceleration({x = 0, y = 0, z = 0})
|
self.object:set_acceleration(vector.zero())
|
||||||
self.object:set_velocity(newv)
|
self.object:set_velocity(newv)
|
||||||
disable_physics(self.object, self, false, false)
|
disable_physics(self.object, self, false, false)
|
||||||
|
|
||||||
|
@ -941,7 +958,7 @@ minetest.register_entity(":__builtin:item", {
|
||||||
-- Set new item moving speed into the direciton of the liquid
|
-- Set new item moving speed into the direciton of the liquid
|
||||||
local newv = vector.multiply(vec, f)
|
local newv = vector.multiply(vec, f)
|
||||||
-- Swap to acceleration instead of a static speed to better mimic MC mechanics.
|
-- Swap to acceleration instead of a static speed to better mimic MC mechanics.
|
||||||
self.object:set_acceleration({x = newv.x, y = -0.22, z = newv.z})
|
self.object:set_acceleration(vector.new(newv.x, -0.22, newv.z))
|
||||||
|
|
||||||
self.physical_state = true
|
self.physical_state = true
|
||||||
self._flowing = true
|
self._flowing = true
|
||||||
|
@ -956,7 +973,8 @@ minetest.register_entity(":__builtin:item", {
|
||||||
local vec = {
|
local vec = {
|
||||||
x = 0 - cur_vec.x * 0.9,
|
x = 0 - cur_vec.x * 0.9,
|
||||||
y = 3 - cur_vec.y * 0.9,
|
y = 3 - cur_vec.y * 0.9,
|
||||||
z = 0 -cur_vec.z*0.9}
|
z = 0 - cur_vec.z * 0.9
|
||||||
|
}
|
||||||
self.object:set_acceleration(vec)
|
self.object:set_acceleration(vec)
|
||||||
-- slow down the item in water
|
-- slow down the item in water
|
||||||
local vel = self.object:get_velocity()
|
local vel = self.object:get_velocity()
|
||||||
|
@ -980,7 +998,7 @@ minetest.register_entity(":__builtin:item", {
|
||||||
end
|
end
|
||||||
|
|
||||||
-- If node is not registered or node is walkably solid and resting on nodebox
|
-- If node is not registered or node is walkably solid and resting on nodebox
|
||||||
local nn = minetest.get_node({x=p.x, y=p.y-0.5, z=p.z}).name
|
local nn = minetest.get_node(vector.offset(p, 0, -0.5, 0)).name
|
||||||
local def = minetest.registered_nodes[nn]
|
local def = minetest.registered_nodes[nn]
|
||||||
local v = self.object:get_velocity()
|
local v = self.object:get_velocity()
|
||||||
local is_on_floor = def and (def.walkable
|
local is_on_floor = def and (def.walkable
|
||||||
|
|
|
@ -136,9 +136,16 @@ mcl_weather.skycolor = {
|
||||||
local biomesky
|
local biomesky
|
||||||
local biomefog
|
local biomefog
|
||||||
if mg_name ~= "v6" and mg_name ~= "singlenode" then
|
if mg_name ~= "v6" and mg_name ~= "singlenode" then
|
||||||
local biome = minetest.get_biome_name(minetest.get_biome_data(player:get_pos()).biome)
|
local biome_index = minetest.get_biome_data(player:get_pos()).biome
|
||||||
biomesky = minetest.registered_biomes[biome]._mcl_skycolor
|
local biome_name = minetest.get_biome_name(biome_index)
|
||||||
biomefog = minetest.registered_biomes[biome]._mcl_fogcolor
|
local biome = minetest.registered_biomes[biome_name]
|
||||||
|
if biome then
|
||||||
|
--minetest.log("action", string.format("Biome found for number: %s in biome: %s", tostring(biome_index), biome_name))
|
||||||
|
biomesky = biome._mcl_skycolor
|
||||||
|
biomefog = biome._mcl_fogcolor
|
||||||
|
else
|
||||||
|
--minetest.log("action", string.format("No biome for number: %s in biome: %s", tostring(biome_index), biome_name))
|
||||||
|
end
|
||||||
end
|
end
|
||||||
if (mcl_weather.state == "none") then
|
if (mcl_weather.state == "none") then
|
||||||
-- Clear weather
|
-- Clear weather
|
||||||
|
|
|
@ -3,7 +3,7 @@ local S = minetest.get_translator(minetest.get_current_modname())
|
||||||
mcl_cocoas = {}
|
mcl_cocoas = {}
|
||||||
|
|
||||||
-- Place cocoa
|
-- Place cocoa
|
||||||
function mcl_cocoas.place(itemstack, placer, pt, plantname)
|
local function cocoa_place(itemstack, placer, pt, plantname)
|
||||||
-- check if pointing at a node
|
-- check if pointing at a node
|
||||||
if not pt or pt.type ~= "node" then
|
if not pt or pt.type ~= "node" then
|
||||||
return
|
return
|
||||||
|
@ -90,7 +90,11 @@ local crop_def = {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
groups = {
|
groups = {
|
||||||
handy=1,axey=1, cocoa=1, not_in_creative_inventory=1, dig_by_water=1, destroy_by_lava_flow=1, dig_by_piston=1, attached_node_facedir=1,
|
handy = 1, axey = 1,
|
||||||
|
dig_by_water=1, destroy_by_lava_flow=1, dig_by_piston=1,
|
||||||
|
attached_node_facedir=1,
|
||||||
|
not_in_creative_inventory=1,
|
||||||
|
cocoa=1
|
||||||
},
|
},
|
||||||
sounds = mcl_sounds.node_sound_wood_defaults(),
|
sounds = mcl_sounds.node_sound_wood_defaults(),
|
||||||
on_rotate = false,
|
on_rotate = false,
|
||||||
|
|
|
@ -1,11 +1,9 @@
|
||||||
local mcl_skins_enabled = minetest.global_exists("mcl_skins")
|
local mcl_skins_enabled = minetest.global_exists("mcl_skins")
|
||||||
|
|
||||||
-- This is a fake node that should never be placed in the world
|
---This is a fake node that should never be placed in the world
|
||||||
|
---@type node_definition
|
||||||
local node_def = {
|
local node_def = {
|
||||||
description = "",
|
use_texture_alpha = "opaque",
|
||||||
use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "opaque" or false,
|
|
||||||
visual_scale = 1,
|
|
||||||
wield_scale = {x=1,y=1,z=1},
|
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
drawtype = "mesh",
|
drawtype = "mesh",
|
||||||
node_placement_prediction = "",
|
node_placement_prediction = "",
|
||||||
|
@ -16,7 +14,7 @@ local node_def = {
|
||||||
minetest.remove_node(pos)
|
minetest.remove_node(pos)
|
||||||
end,
|
end,
|
||||||
drop = "",
|
drop = "",
|
||||||
on_drop = function() return "" end,
|
on_drop = function(_, _, _) return ItemStack() end,
|
||||||
groups = { dig_immediate = 3, not_in_creative_inventory = 1 },
|
groups = { dig_immediate = 3, not_in_creative_inventory = 1 },
|
||||||
range = minetest.registered_items[""].range
|
range = minetest.registered_items[""].range
|
||||||
}
|
}
|
||||||
|
@ -54,6 +52,6 @@ if mcl_skins_enabled then
|
||||||
end)
|
end)
|
||||||
else
|
else
|
||||||
minetest.register_on_joinplayer(function(player)
|
minetest.register_on_joinplayer(function(player)
|
||||||
player:get_inventory():set_stack("hand", 1, "mcl_meshhand:hand")
|
player:get_inventory():set_stack("hand", 1, ItemStack("mcl_meshhand:hand"))
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue