Add ore counter

This commit is contained in:
cora 2022-11-14 21:37:45 +01:00
parent c1e7d0ba76
commit 8d7a43fe0a
3 changed files with 34 additions and 4 deletions

View File

@ -63,17 +63,17 @@ mcl_structures.register_structure("spawncircle",{
mcl_structures.register_structure("spawncircle_lit",{
place_func = function(pos,def,pr)
local p1 = vector.offset(pos,-33,-5,-33)
local p2 = vector.offset(pos,33,5,33)
local p1 = vector.offset(pos,-36,-5,-36)
local p2 = vector.offset(pos,36,5,36)
local nn1 = minetest.find_nodes_in_area_under_air(p1,p2,{"group:solid","group:plant","group:leaves","group:tree","group:mushroom"})
local c1 = {}
local c2 = {}
for k,v in pairs(nn1) do
local dst1=vector.distance(vector.round(vector.new(pos.x,0,pos.z)),vector.round(vector.new(v.x,0,v.z)))
local dst2=vector.distance(vector.round(vector.new(pos.x,0,pos.z)),vector.round(vector.new(v.x,0,v.z)))
if dst1 > 23 and dst1 < 25 then
if dst1 > 20 and dst1 < 22 then
table.insert(c1,v)
elseif dst2 > 31 and dst2 < 33 then
elseif dst2 > 33 and dst2 < 35 then
table.insert(c2,v)
end
end

28
orecount/init.lua Normal file
View File

@ -0,0 +1,28 @@
local orenodes = {
"mcl_core:stone_with_diamond",
"mcl_core:stone_with_iron",
"mcl_core:stone_with_gold",
"mcl_core:stone_with_coal",
"mcl_core:stone_with_lapis",
"mcl_core:stone_with_emerald",
"mcl_core:stone_with_redstone",
"mcl_core:stone_with_redstone_lit",
"mcl_nether:ancient_debris",
"mcl_blackstone:blackstone_gilded",
"mcl_blackstone:nether_gold",
}
mcl_info.register_debug_field("Ores near",{
level = 4,
func = function(pl,pos)
local p1 = vector.offset(pos,-32,-32,-32)
local p2 = vector.offset(pos,32,32,32)
local ores, counts = minetest.find_nodes_in_area(p1,p2,orenodes)
local r = {}
for k,v in pairs(counts) do
if v > 0 then r[k]=v end
end
return dump(r)
end
})

2
orecount/mod.conf Normal file
View File

@ -0,0 +1,2 @@
name = orecount
depends = mcl_info