WIP for iterating ores registered

Duh, I should get the Short Description (or Description) and boom,
done.
This commit is contained in:
Apollo 2024-07-01 23:21:03 -04:00
parent c45fae5ad9
commit 600dfbc101
2 changed files with 13 additions and 1 deletions

@ -7,6 +7,10 @@ Combines various tech to allow advanced mining operations.
* Orehud: The original Oretracker mod with a single command to toggle the mod on or off per individual player. * Orehud: The original Oretracker mod with a single command to toggle the mod on or off per individual player.
* Xray: Based on Orehud except tracks non-ores and makes them appear invisible. * Xray: Based on Orehud except tracks non-ores and makes them appear invisible.
## What's New (July 1st 2024)
* Iterate ores and generate names and detection via that (No more hard coding for itemstring to Name, but no more colors based on ore)
## Orehud ## Orehud
Displays ore positions via the player's HUD. Displays ore positions via the player's HUD.
@ -30,4 +34,3 @@ Yes, because xray interacts server side, all clients can make use of a single pl
* Improve Xray and Orehud so the api can litterally add new nodes (so I don't need to release updates for others to add support for their mods/games) * Improve Xray and Orehud so the api can litterally add new nodes (so I don't need to release updates for others to add support for their mods/games)
* Possibly add a formspec for Xray so you could customize your xray, per player (i.e. know a node you don't want to see, just add it via the formspec) * Possibly add a formspec for Xray so you could customize your xray, per player (i.e. know a node you don't want to see, just add it via the formspec)

@ -45,6 +45,7 @@ orehud.ores = {}
dofile(orehud.modpath .. "/api.lua") dofile(orehud.modpath .. "/api.lua")
--[[
-- Use api to assign ores we know/should be caring about -- Use api to assign ores we know/should be caring about
if orehud.gamemode == "MCL2" or orehud.gamemode == "MCL5" then if orehud.gamemode == "MCL2" or orehud.gamemode == "MCL5" then
orehud.add_ore("mcl_core:stone_with_coal") orehud.add_ore("mcl_core:stone_with_coal")
@ -86,6 +87,13 @@ end
if orehud.gamemode == "NC" then if orehud.gamemode == "NC" then
orehud.add_ore("nc_lode:ore") orehud.add_ore("nc_lode:ore")
end end
]]
orehud.add_ores = function ()
for _, item in ipairs(minetest.registered_ores) do
orehud.add_ore(item)
end
end
local size = 0 local size = 0
local result = "Ores: " local result = "Ores: "
@ -118,6 +126,7 @@ 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
if string.find(node.name, "coal") then if string.find(node.name, "coal") then
block = "Coa" block = "Coa"
color = 0xc8c8c8 color = 0xc8c8c8