mirror of
https://github.com/Beanzilla/OreTracker.git
synced 2024-11-25 16:53:48 +01:00
WIP Untested iterating over registered ores
This should work, but I'm not sure how well this will work
This commit is contained in:
parent
600dfbc101
commit
7b00d07e28
@ -95,14 +95,17 @@ orehud.add_ores = function ()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local size = 0
|
minetest.register_on_mods_loaded(function()
|
||||||
local result = "Ores: "
|
orehud.add_ores()
|
||||||
for i, v in ipairs(orehud.ores) do
|
local size = 0
|
||||||
|
local result = "Ores: "
|
||||||
|
for i, v in ipairs(orehud.ores) do
|
||||||
result = result..v.." "
|
result = result..v.." "
|
||||||
size = size + 1
|
size = size + 1
|
||||||
end
|
end
|
||||||
minetest.log("action", "[oretracker-orehud] Found "..size.." ores configured.")
|
minetest.log("action", "[oretracker-orehud] Found "..size.." ores configured.")
|
||||||
minetest.log("action", "[oretracker-orehud] "..result)
|
minetest.log("action", "[oretracker-orehud] "..result)
|
||||||
|
end)
|
||||||
|
|
||||||
-- Itterates an area of nodes for "ores", then adds a waypoint at that nodes position for that "ore".
|
-- Itterates an area of nodes for "ores", then adds a waypoint at that nodes position for that "ore".
|
||||||
orehud.check_player = function(player)
|
orehud.check_player = function(player)
|
||||||
@ -126,8 +129,9 @@ orehud.check_player = function(player)
|
|||||||
distance = string.format("%.0f", math.sqrt(distance))
|
distance = string.format("%.0f", math.sqrt(distance))
|
||||||
local block = "?"
|
local block = "?"
|
||||||
local color = 0xffffff
|
local color = 0xffffff
|
||||||
|
local def = minetest.registered_nodes[node.name] or nil
|
||||||
if string.find(node.name, "coal") then
|
color = 0xc8c84b
|
||||||
|
--[[if string.find(node.name, "coal") then
|
||||||
block = "Coa"
|
block = "Coa"
|
||||||
color = 0xc8c8c8
|
color = 0xc8c8c8
|
||||||
elseif string.find(node.name, "iron") then
|
elseif string.find(node.name, "iron") then
|
||||||
@ -167,6 +171,10 @@ orehud.check_player = function(player)
|
|||||||
block = "Lode"
|
block = "Lode"
|
||||||
color = 0xaf644b
|
color = 0xaf644b
|
||||||
end
|
end
|
||||||
|
]]
|
||||||
|
if def ~= nil then
|
||||||
|
block = def.short_description or def.description
|
||||||
|
end
|
||||||
if block == "?" then
|
if block == "?" then
|
||||||
minetest.log("action", "[oretracker-orehud] Found '"..node.name.."' at "..minetest.pos_to_string(area[i], 1).." which is "..distance.." away from '"..pname..".")
|
minetest.log("action", "[oretracker-orehud] Found '"..node.name.."' at "..minetest.pos_to_string(area[i], 1).." which is "..distance.." away from '"..pname..".")
|
||||||
block = node.name
|
block = node.name
|
||||||
|
Loading…
Reference in New Issue
Block a user