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,6 +95,8 @@ orehud.add_ores = function ()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
minetest.register_on_mods_loaded(function()
|
||||||
|
orehud.add_ores()
|
||||||
local size = 0
|
local size = 0
|
||||||
local result = "Ores: "
|
local result = "Ores: "
|
||||||
for i, v in ipairs(orehud.ores) do
|
for i, v in ipairs(orehud.ores) do
|
||||||
@ -103,6 +105,7 @@ for i, v in ipairs(orehud.ores) do
|
|||||||
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