Noob here, needing help setting up data tables

Winter94
Member
 
Posts: 43
Joined: Sat Jan 11, 2020 17:15
In-game: Azrael Winter WintersKnight

Noob here, needing help setting up data tables

by Winter94 » Fri Jan 24, 2020 14:04

Hey, I'm working on a table for ores and minerals, and I cant figure out what I've done wrong. Can someone help me?
Code: Select all
underforge.minerals = {}

local mineral_list {name, desc, strata, rarity,} = {
   {"corundum",      "Corundum",         "gneiss",         10*10*10,},
   {"corundum",      "Corundum",         "mica",            10*10*10,},
   {"corundum",      "Corundum",         "schist",         10*10*10,},
   {"corundum",      "Corundum",         "pegmatite",      10*10*10,},
   {"tetrahedrite",   "Tetrahedrite",      "diorite",         10*10*10,},
   {"tetrahedrite",   "Tetrahedrite",      "pegmatite",      10*10*10,},
   {"tetrahedrite",   "Tetrahedrite",      "phyllite",         10*10*10,},
   {"cassiterite",      "Cassiterite",      "andesite",         10*10*10,},
   {"cassiterite",      "Cassiterite",      "basalt",         10*10*10,},
   {"cassiterite",      "Cassiterite",      "gabbro",         10*10*10,},
   }

local function register_ore(name, desc, strata, rarity, texture)
   local ore = {
      name = "underforge:"..name,
      description = desc,
      drop = "underforge:"..name.."_chunk",
      wherein = strata,
      clust_scarcity = rarity,
      clust_size = 5,
      clust_num_ores = 10,
      tiles = {strata..".png" ^ "ore_"..name..".png"},
      groups = {stone=1, minerals=1},
   }
end

   minetest.register_craftitem("underforge:"..name, {
      description = ("Chunk of" ..desc ),
      inventory_image = "chunk_"..name..".png",
   })
 

User avatar
Nathan.S
Member
 
Posts: 973
Joined: Wed Sep 24, 2014 17:47
Location: Bigsby Texas
GitHub: NathanSalapat
IRC: NathanS21
In-game: NathanS21

Re: Noob here, needing help setting up data tables

by Nathan.S » Fri Jan 24, 2020 14:35

Are you ever calling the register_ore function? In the code you provided that function is never called with the data from the table. With the table you provided you probably want to use a loop to go through each entry in the table and run the function, or you could remove the function, and just input the data from the table directly into the ore registration with a loop.
I record Minetest videos, Mod reviews, Modding tutorials, and Lets plays.
Check out my website, and brand new Minetest Modding Course
 

Winter94
Member
 
Posts: 43
Joined: Sat Jan 11, 2020 17:15
In-game: Azrael Winter WintersKnight

Re: Noob here, needing help setting up data tables

by Winter94 » Fri Jan 24, 2020 14:44

yeah, I'm trying to loop the info through the table. how do I go about doing that? I watched your video, Nathan, on your website, and thats how I got this far. I think I'm missing some part to do with ipairs, or something, but im uncertain as to how to type it out.
Gotta say, Nathan, you do good work, and your website has been a big help, but you need to update some of your videos now that you have more experience. :)
 

Winter94
Member
 
Posts: 43
Joined: Sat Jan 11, 2020 17:15
In-game: Azrael Winter WintersKnight

Re: Noob here, needing help setting up data tables

by Winter94 » Fri Jan 24, 2020 15:53

EDIT: ok, rewatched your videos a few times, and managed to (i think, fix the table). here's as the code currently sits:
Code: Select all
underforge.minerals = {}

local mineral_table = {
   {"corundum",      "Corundum",         "underforge:gneiss",         10*10*10,},
   {"corundum",      "Corundum",         "underforge:mica",            10*10*10,},
   {"corundum",      "Corundum",         "underforge:schist",         10*10*10,},
   {"corundum",      "Corundum",         "underforge:pegmatite",         10*10*10,},
   {"tetrahedrite",   "Tetrahedrite",      "underforge:diorite",         10*10*10,},
   {"tetrahedrite",   "Tetrahedrite",      "underforge:pegmatite",         10*10*10,},
   {"tetrahedrite",   "Tetrahedrite",      "underforge:phyllite",         10*10*10,},
   {"cassiterite",      "Cassiterite",      "underforge:andesite",         10*10*10,},
   {"cassiterite",      "Cassiterite",      "underforge:basalt",         10*10*10,},
   {"cassiterite",      "Cassiterite",      "underforge:gabbro",         10*10*10,},
   }

for i in ipairs (mineral_table) do
    local name = mineral_table[i][1]
    local desc = mineral_table[i][2]
    local strata = mineral_table[i][3]
    local rarity = mineral_table[i][4]

local function register_ore(name, desc, strata, rarity, texture)
   local ore = {
      name = "underforge:"..name,
      description = desc,
      drop = "underforge:"..name.."_chunk",
      wherein = strata,
      clust_scarcity = rarity,
      clust_size = 5,
      clust_num_ores = 10,
      tiles = {strata..".png" ^ "ore_"..name..".png"},
      groups = {stone=1, minerals=1},
   }
end

   minetest.register_craftitem("underforge:"..name, {
      description = ("Chunk of" ..desc ),
      inventory_image = "chunk_"..name..".png",
   })
end

and now im getting this error.
Code: Select all
-------------
  Separator
-------------

2020-01-24 09:43:47: WARNING[Main]: Irrlicht: OpenGL driver version is not 1.2 or better.
2020-01-24 09:43:47: WARNING[Main]: Irrlicht: Failed to load OpenGL's multitexture extension, proceeding without.
2020-01-24 09:43:47: WARNING[Main]: Irrlicht: Warning: OpenGL device only has one texture unit. Disabling multitexturing.
2020-01-24 09:43:47: ERROR[Main]: Irrlicht: GL_INVALID_ENUM
2020-01-24 09:43:47: ERROR[Main]: Irrlicht: Could not bind Texture
2020-01-24 09:44:43: ACTION[Main]: World at [C:\Users\XA-26483\Desktop\MINETEST\minetest-5.1.0-win64\bin\..\worlds\test UFlite III]
2020-01-24 09:44:43: ACTION[Main]: Server for gameid="minetest" listening on 0.0.0.0:54634.
2020-01-24 09:44:48: WARNING[Main]: Irrlicht: PNG warning: iCCP: known incorrect sRGB profile
2020-01-24 09:44:48: WARNING[Main]: Irrlicht: PNG warning: iCCP: known incorrect sRGB profile
2020-01-24 09:44:48: WARNING[Main]: Irrlicht: PNG warning: iCCP: known incorrect sRGB profile
2020-01-24 09:44:48: WARNING[Main]: Irrlicht: PNG warning: iCCP: known incorrect sRGB profile
2020-01-24 09:44:48: WARNING[Main]: Irrlicht: PNG warning: iCCP: cHRM chunk does not match sRGB
2020-01-24 09:44:49: WARNING[Main]: Irrlicht: PNG warning: iCCP: known incorrect sRGB profile
2020-01-24 09:44:49: WARNING[Main]: Irrlicht: PNG warning: iCCP: cHRM chunk does not match sRGB
2020-01-24 09:44:49: WARNING[Main]: Irrlicht: PNG warning: iCCP: known incorrect sRGB profile
2020-01-24 09:44:49: WARNING[Main]: Irrlicht: PNG warning: iCCP: cHRM chunk does not match sRGB
2020-01-24 09:44:49: WARNING[Main]: Irrlicht: PNG warning: iCCP: known incorrect sRGB profile
2020-01-24 09:44:49: WARNING[Main]: Irrlicht: PNG warning: iCCP: cHRM chunk does not match sRGB
2020-01-24 09:44:49: WARNING[Main]: Irrlicht: PNG warning: iCCP: known incorrect sRGB profile
2020-01-24 09:44:49: WARNING[Main]: Irrlicht: PNG warning: iCCP: cHRM chunk does not match sRGB
2020-01-24 09:44:49: WARNING[Main]: Irrlicht: PNG warning: iCCP: known incorrect sRGB profile
2020-01-24 09:44:49: WARNING[Main]: Irrlicht: PNG warning: iCCP: cHRM chunk does not match sRGB
2020-01-24 09:44:49: WARNING[Main]: Irrlicht: PNG warning: iCCP: known incorrect sRGB profile
2020-01-24 09:44:49: WARNING[Main]: Irrlicht: PNG warning: iCCP: cHRM chunk does not match sRGB
2020-01-24 09:44:49: WARNING[Main]: Irrlicht: PNG warning: iCCP: known incorrect sRGB profile
2020-01-24 09:44:49: WARNING[Main]: Irrlicht: PNG warning: iCCP: cHRM chunk does not match sRGB
2020-01-24 09:44:49: WARNING[Main]: Irrlicht: PNG warning: iCCP: known incorrect sRGB profile
2020-01-24 09:44:49: WARNING[Main]: Irrlicht: PNG warning: iCCP: cHRM chunk does not match sRGB
2020-01-24 09:44:49: WARNING[Main]: Irrlicht: PNG warning: iCCP: known incorrect sRGB profile
2020-01-24 09:44:49: WARNING[Main]: Irrlicht: PNG warning: iCCP: known incorrect sRGB profile
2020-01-24 09:44:49: WARNING[Main]: Irrlicht: PNG warning: iCCP: known incorrect sRGB profile
2020-01-24 09:44:49: WARNING[Main]: Irrlicht: PNG warning: iCCP: known incorrect sRGB profile
2020-01-24 09:44:49: WARNING[Main]: Irrlicht: PNG warning: iCCP: known incorrect sRGB profile
2020-01-24 09:44:49: WARNING[Main]: Irrlicht: PNG warning: iCCP: cHRM chunk does not match sRGB
2020-01-24 09:44:49: WARNING[Main]: Irrlicht: PNG warning: iCCP: known incorrect sRGB profile
2020-01-24 09:44:49: WARNING[Main]: Irrlicht: PNG warning: iCCP: known incorrect sRGB profile
2020-01-24 09:44:49: WARNING[Main]: Irrlicht: PNG warning: iCCP: known incorrect sRGB profile
2020-01-24 09:44:49: WARNING[Main]: Irrlicht: PNG warning: iCCP: known incorrect sRGB profile
2020-01-24 09:44:49: WARNING[Main]: Irrlicht: PNG warning: iCCP: known incorrect sRGB profile
2020-01-24 09:44:49: WARNING[Main]: Irrlicht: PNG warning: iCCP: cHRM chunk does not match sRGB
2020-01-24 09:44:49: WARNING[Main]: Irrlicht: PNG warning: iCCP: known incorrect sRGB profile
2020-01-24 09:44:49: WARNING[Main]: Irrlicht: PNG warning: iCCP: cHRM chunk does not match sRGB
2020-01-24 09:44:49: WARNING[Main]: Irrlicht: PNG warning: iCCP: known incorrect sRGB profile
2020-01-24 09:44:49: WARNING[Main]: Irrlicht: PNG warning: iCCP: cHRM chunk does not match sRGB
2020-01-24 09:44:49: WARNING[Main]: Irrlicht: PNG warning: iCCP: known incorrect sRGB profile
2020-01-24 09:44:49: WARNING[Main]: Irrlicht: PNG warning: iCCP: cHRM chunk does not match sRGB
2020-01-24 09:44:49: WARNING[Main]: Irrlicht: PNG warning: iCCP: known incorrect sRGB profile
2020-01-24 09:44:49: WARNING[Main]: Irrlicht: PNG warning: iCCP: known incorrect sRGB profile
2020-01-24 09:44:49: WARNING[Main]: Irrlicht: PNG warning: iCCP: known incorrect sRGB profile
2020-01-24 09:44:49: WARNING[Main]: Irrlicht: PNG warning: iCCP: known incorrect sRGB profile
2020-01-24 09:44:49: WARNING[Main]: Irrlicht: PNG warning: iCCP: known incorrect sRGB profile
2020-01-24 09:44:49: WARNING[Main]: Irrlicht: PNG warning: iCCP: cHRM chunk does not match sRGB
2020-01-24 09:44:49: WARNING[Main]: Irrlicht: PNG warning: iCCP: known incorrect sRGB profile
2020-01-24 09:44:49: WARNING[Main]: Irrlicht: PNG warning: iCCP: cHRM chunk does not match sRGB
2020-01-24 09:44:49: WARNING[Main]: Irrlicht: PNG warning: iCCP: known incorrect sRGB profile
2020-01-24 09:44:49: WARNING[Main]: Irrlicht: PNG warning: iCCP: cHRM chunk does not match sRGB
2020-01-24 09:44:49: WARNING[Main]: Irrlicht: PNG warning: iCCP: known incorrect sRGB profile
2020-01-24 09:44:49: WARNING[Main]: Irrlicht: PNG warning: iCCP: cHRM chunk does not match sRGB
2020-01-24 09:44:49: WARNING[Main]: Irrlicht: PNG warning: iCCP: known incorrect sRGB profile
2020-01-24 09:44:49: WARNING[Main]: Irrlicht: PNG warning: iCCP: cHRM chunk does not match sRGB
2020-01-24 09:44:49: WARNING[Main]: Irrlicht: PNG warning: iCCP: known incorrect sRGB profile
2020-01-24 09:44:49: WARNING[Main]: Irrlicht: PNG warning: iCCP: cHRM chunk does not match sRGB
2020-01-24 09:44:49: WARNING[Main]: Irrlicht: PNG warning: iCCP: known incorrect sRGB profile
2020-01-24 09:44:49: WARNING[Main]: Irrlicht: PNG warning: iCCP: cHRM chunk does not match sRGB
2020-01-24 09:44:49: WARNING[Main]: Irrlicht: PNG warning: iCCP: known incorrect sRGB profile
2020-01-24 09:44:49: WARNING[Main]: Irrlicht: PNG warning: iCCP: cHRM chunk does not match sRGB
2020-01-24 09:44:49: WARNING[Main]: Irrlicht: PNG warning: iCCP: known incorrect sRGB profile
2020-01-24 09:44:49: WARNING[Main]: Irrlicht: PNG warning: iCCP: cHRM chunk does not match sRGB
2020-01-24 09:44:49: WARNING[Main]: Irrlicht: PNG warning: iCCP: known incorrect sRGB profile
2020-01-24 09:44:49: WARNING[Main]: Irrlicht: PNG warning: iCCP: cHRM chunk does not match sRGB
2020-01-24 09:44:49: ERROR[Main]: generateImage(): Could not load image "underforge_fiery_dust.png" while building texture; Creating a dummy image
2020-01-24 09:44:50: ERROR[Main]: generateImage(): Could not load image "underforge_alexandrite_crystal.png" while building texture; Creating a dummy image
2020-01-24 09:44:50: ERROR[Main]: generateImage(): Could not load image "underforge_fluorite_crystal.png" while building texture; Creating a dummy image
2020-01-24 09:44:50: ERROR[Main]: generateImage(): Could not load image "underforge_garnet_ore.png" while building texture; Creating a dummy image
2020-01-24 09:44:50: ACTION[Server]: singleplayer [127.0.0.1] joins game.
2020-01-24 09:44:50: ACTION[Server]: singleplayer joins game. List of players: singleplayer
2020-01-24 09:44:50: ERROR[Main]: Irrlicht: GL_INVALID_ENUM
2020-01-24 09:44:50: ERROR[Main]: Irrlicht: Could not bind Texture
2020-01-24 09:44:51: ERROR[Main]: Irrlicht: GL_INVALID_ENUM
2020-01-24 09:44:51: ERROR[Main]: Irrlicht: Could not bind Texture
2020-01-24 09:44:58: ACTION[Server]: singleplayer granted (server, shout, fly, password, creative, bring, kick, teleport, ban, noclip, home, privs, fast, basic_privs, debug, give, protection_bypass, rollback, settime, interact) privileges to singleplayer
2020-01-24 09:45:20: WARNING[Emerge-0]: Undeclared global variable "c_coal_ore" accessed at ...est-5.1.0-win64\bin\..\mods\underforge_lite/worldgen.lua:209
2020-01-24 09:45:20: WARNING[Emerge-0]: Undeclared global variable "c_coal_ore" accessed at ...est-5.1.0-win64\bin\..\mods\underforge_lite/worldgen.lua:183
2020-01-24 09:45:30: ERROR[Main]: Irrlicht: GL_INVALID_ENUM
2020-01-24 09:45:30: ERROR[Main]: Irrlicht: Could not bind Texture
2020-01-24 09:45:34: WARNING[Emerge-0]: Undeclared global variable "c_green_mushroom" accessed at ...est-5.1.0-win64\bin\..\mods\underforge_lite/worldgen.lua:227
2020-01-24 09:45:54: ACTION[Server]: singleplayer takes default:mese_post_light from creative inventory
2020-01-24 09:46:00: ACTION[Server]: singleplayer takes default:torch from creative inventory
2020-01-24 09:46:03: ACTION[Server]: singleplayer places node default:mese_post_light at (104,-38,-229)
2020-01-24 09:46:12: ACTION[Server]: singleplayer places node default:mese_post_light at (102,-38,-219)
2020-01-24 09:46:19: WARNING[Emerge-0]: Undeclared global variable "c_mycena_chlorophos" accessed at ...est-5.1.0-win64\bin\..\mods\underforge_lite/worldgen.lua:257
2020-01-24 09:46:27: WARNING[Emerge-0]: Assignment to undeclared global "dirs" inside a function at ...st-5.1.0-win64\bin\..\mods\underforge_lite/functions.lua:149.
2020-01-24 09:46:27: WARNING[Emerge-0]: Assignment to undeclared global "dirs_c" inside a function at ...st-5.1.0-win64\bin\..\mods\underforge_lite/functions.lua:150.
2020-01-24 09:46:27: WARNING[Emerge-0]: Undeclared global variable "alt" accessed at ...st-5.1.0-win64\bin\..\mods\underforge_lite/functions.lua:152
2020-01-24 09:46:27: WARNING[Emerge-0]: Undeclared global variable "alt" accessed at ...st-5.1.0-win64\bin\..\mods\underforge_lite/functions.lua:157
2020-01-24 09:46:27: WARNING[Emerge-0]: Undeclared global variable "alt" accessed at ...st-5.1.0-win64\bin\..\mods\underforge_lite/functions.lua:162
2020-01-24 09:46:27: WARNING[Emerge-0]: Undeclared global variable "alt" accessed at ...st-5.1.0-win64\bin\..\mods\underforge_lite/functions.lua:167
2020-01-24 09:46:27: WARNING[Emerge-0]: Undeclared global variable "alt" accessed at ...st-5.1.0-win64\bin\..\mods\underforge_lite/functions.lua:172
2020-01-24 09:46:27: WARNING[Emerge-0]: Undeclared global variable "alt" accessed at ...st-5.1.0-win64\bin\..\mods\underforge_lite/functions.lua:177
2020-01-24 09:46:35: WARNING[Emerge-0]: Undeclared global variable "c_mycena_chlorophos" accessed at ...est-5.1.0-win64\bin\..\mods\underforge_lite/worldgen.lua:289
2020-01-24 09:47:06: WARNING[Emerge-0]: Undeclared global variable "c_coal_ore" accessed at ...est-5.1.0-win64\bin\..\mods\underforge_lite/worldgen.lua:304
2020-01-24 09:47:07: ERROR[Main]: ServerError: AsyncErr: Lua: finishGenRuntime error from mod 'underforge' in callback environment_OnGenerated(): ...est-5.1.0-win64\bin\..\mods\underforge_lite/worldgen.lua:573: attempt to call a nil value
2020-01-24 09:47:07: ERROR[Main]: stack traceback:
2020-01-24 09:47:07: ERROR[Main]:    ...est-5.1.0-win64\bin\..\mods\underforge_lite/worldgen.lua:573: in function <...est-5.1.0-win64\bin\..\mods\underforge_lite/worldgen.lua:517>
2020-01-24 09:47:07: ERROR[Main]:    ...ST\minetest-5.1.0-win64\bin\..\builtin\game\register.lua:429: in function <...ST\minetest-5.1.0-win64\bin\..\builtin\game\register.lua:413>
2020-01-24 09:47:08: ACTION[Main]: Server: Shutting down
2020-01-24 09:47:21: ERROR[Main]: Please choose a name!

here's my worldgen file:
Code: Select all
-- used blocks
local c_air = minetest.get_content_id("air")
local c_stone = minetest.get_content_id("default:stone")

local c_water = minetest.get_content_id("default:water_source")
local c_lava = minetest.get_content_id("default:lava_source")
local c_dirt = minetest.get_content_id("default:dirt")
local c_cobble = minetest.get_content_id("default:cobble")
local c_cobblestair = minetest.get_content_id("stairs:stair_cobble")
local c_coalblock = minetest.get_content_id("default:coalblock")

local c_dust = minetest.get_content_id("underforge:dust")
local c_coal_dust = minetest.get_content_id("underforge:coal_dust")

-----Mushrooms-----
local c_agaricus_bisporus = minetest.get_content_id("underforge:agaricus_bisporus")
local c_amanita_muscaria = minetest.get_content_id("underforge:amanita_muscaria")
local c_amanita_phalloides = minetest.get_content_id("underforge:amanita_phalloides")
local c_armillaria_mellea = minetest.get_content_id("underforge:armillaria_mellea")
local c_mycena_cholorophos = minetest.get_content_id("underforge:mycena_chlorophos")
local c_mycena_haematopus = minetest.get_content_id("underforge:mycena_haematopus")
local c_mycena_interrupta = minetest.get_content_id("underforge:mycena_interrupta")
local c_mycena_luxaeterna = minetest.get_content_id("underforge:mycena_luxaeterna")
local c_dark_tuber = minetest.get_content_id("underforge:dark_tuber")
-------------------
local c_mossy_dirt = minetest.get_content_id("underforge:mossy_dirt")
local c_torchberries = minetest.get_content_id("underforge:torchberries")
local c_moss = minetest.get_content_id("underforge:moss")
local c_dry_moss = minetest.get_content_id("underforge:dry_moss")
local c_underground_bush = minetest.get_content_id("underforge:underground_bush")
local c_dead_bush = minetest.get_content_id("underforge:dead_bush")
local c_mould = minetest.get_content_id("underforge:mould")
local c_underground_vine = minetest.get_content_id("underforge:underground_vine")

local c_amethyst_ore = minetest.get_content_id("underforge:amethyst_ore")
local c_amethyst_crystal = minetest.get_content_id("underforge:amethyst_crystal")
local c_emerald_ore = minetest.get_content_id("underforge:emerald_ore")
local c_emerald_crystal = minetest.get_content_id("underforge:emerald_crystal")
local c_ruby_ore = minetest.get_content_id("underforge:ruby_ore")
local c_ruby_crystal = minetest.get_content_id("underforge:ruby_crystal")
local c_sapphire_ore = minetest.get_content_id("underforge:saphire_ore")
local c_sapphire_crystal = minetest.get_content_id("underforge:saphire_crystal")
local c_aquamarine_ore = minetest.get_content_id("underforge:aquamarine_ore")
local c_aquamarine_crystal = minetest.get_content_id("underforge:aquamarine_crystal")
local c_quartz_ore = minetest.get_content_id("underforge:quartz_ore")
local c_quartz_crystal = minetest.get_content_id("underforge:quartz_crystal")
local c_topaz_ore = minetest.get_content_id("underforge:topaz_ore")
local c_topaz_crystal = minetest.get_content_id("underforge:topaz_crystal")
local c_onyx_ore = minetest.get_content_id("underforge:onyx_ore")
local c_onyx_crystal = minetest.get_content_id("underforge:onyx_crystal")


local c_fire = minetest.get_content_id("fire:permanent_flame")
local c_fiery_dust = minetest.get_content_id("underforge:fiery_dust")
local c_fiery_vine = minetest.get_content_id("underforge:fiery_vine")
local c_lava_crack = minetest.get_content_id("underforge:lava_crack")

local c_quartz_block = minetest.get_content_id("underforge:quartz_block")
local c_aquamarine_block = minetest.get_content_id("underforge:aquamarine_block")
local c_amethyst_block = minetest.get_content_id("underforge:amethyst_block")

local c_basalt = minetest.get_content_id("underforge:basalt")
local c_obsidian = minetest.get_content_id("default:obsidian")
local c_pumice = minetest.get_content_id("underforge:pumice")
local c_volcanic_tuff = minetest.get_content_id("underforge:volcanic_tuff")

--[[local c_amphibolite = minetest.get_content_id("underforge:amphibolite")
local c_andesite = minetest.get_content_id("underforge:andesite")
local c_basalt = minetest.get_content_id("underforge:basalt")
local c_chalk = minetest.get_content_id("underforge:chalk")
local c_chert = minetest.get_content_id("underforge:chert")
local c_diorite = minetest.get_content_id("underforge:diorite")
local c_dolomite = minetest.get_content_id("underforge:dolomite")
local c_feldspar = minetest.get_content_id("underforge:feldspar")
local c_flint = minetest.get_content_id("underforge:flint")
local c_gabbro = minetest.get_content_id("underforge:gabbro")
local c_gneiss = minetest.get_content_id("underforge:gneiss")
local c_granite = minetest.get_content_id("underforge:granite")
local c_jasper = minetest.get_content_id("underforge:jasper")
local c_kimberlite = minetest.get_content_id("underforge:kimberlite")
local c_limestone = minetest.get_content_id("underforge:limestone")
local c_marble = minetest.get_content_id("underforge:marble")
local c_mica = minetest.get_content_id("underforge:mica")
local c_olivine = minetest.get_content_id("underforge:olivine")
local c_pegmatite = minetest.get_content_id("underforge:pegmatite")
local c_phyllite = minetest.get_content_id("underforge:phyllite")
local c_pumice = minetest.get_content_id("underforge:pumice")
local c_quartzite = minetest.get_content_id("underforge:quartzite")
local c_schist = minetest.get_content_id("underforge:schist")
local c_shale = minetest.get_content_id("underforge:shale")
local c_slate = minetest.get_content_id("underforge:slate")
local c_volcanic_tuff = minetest.get_content_id("underforge:volcanic_tuff")--]]

function underforge.use_stone(vi, data, id)
   underforge.functions.replace(vi, data, c_stone, underforge.stone.defs[id].base)
   underforge.functions.replace(vi, data, c_cobble, underforge.stone.defs[id].cobble)
   underforge.functions.replace(vi, data, c_cobblestair, underforge.stone.defs[id].stair)
end


---------- Biome Definitions ----------

underforge.biomegen = {
   --Dolomite
   [1] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "dolomite")
   end,
   --Limestone
   [2] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "limestone")
   end,
   --Schist
   [3] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "schist")
   end,
   --Andesite
   [4] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "andesite")
   end,
   --Phyllite
   [5] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "phyllite")
   end,
   --Quartzite
   [6] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "quartzite")
   end,
   --Mica
   [7] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "mica")
   end,
   --Slate
   [8] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "slate")
   end,
   --Gneiss
   [9] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "gneiss")
   end,
   --Chalk
   [10] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "chalk")
   end,
   --Feldspar
   [11] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "feldspar")
   end,
   --Basalt
   [12] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "basalt")
   end,
   --Diorite
   [13] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "diorite")
   end,
   --Chert
   [14] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "chert")
   end,
   --Granite
   [15] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "granite")
   end,
   --Gabbro
   [16] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "gabbro")
   end,
   --Dolomite Cave
   [17] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "dolomite")
      underforge.functions.ore(vi, data, underforge.stone.defs["dolomite"].base, c_water, 1/2000)      
   end,
   --Limestone Dust
   [18] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "limestone")
      underforge.functions.in_floor(x, y, z, vi, area, data, c_stone, c_air, c_dust, 1, underforge.stone.defs["limestone"].base)      
   end,
   --Coal
   [19] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "shale")
      underforge.functions.in_floor(x, y, z, vi, area, data, c_stone, c_air, c_coal_dust, 1/9, underforge.stone.defs["shale"].base)
      --underforge.functions.ore(vi, data, underforge.stone.defs["shale"].base, c_coal_dust, 1/9)
      underforge.functions.ore(vi, data, underforge.stone.defs["shale"].base, c_coal_ore, 1/201)
   end,
   --Marble
   [20] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "marble")
   end,
   --Fungi
   [21] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "amphibolite")
      underforge.functions.on_floor(x, y, z, vi, area, data, c_stone, c_air, c_mycena_luxaeterna, 1/18, underforge.stone.defs["amphibolite"].base)
      underforge.functions.on_floor(x, y, z, vi, area, data, c_stone, c_air, c_mycena_haematopus, 1/18, underforge.stone.defs["amphibolite"].base)
      underforge.functions.on_wall_w(x, y, z, vi, area, data, p2data, c_stone, c_air, c_mould, 1/9, lastlayer, underforge.stone.defs["amphibolite"].base)
      underforge.functions.ore(vi, data, underforge.stone.defs["amphibolite"].base, c_water, 1/2000)      
   end,
   --Torchberries
   [22] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "jasper")
      underforge.functions.on_roof(x, y, z, vi, area, data, c_stone, c_air, c_torchberries, 1/30, lastlayer, underforge.stone.defs["jasper"].base)      
      underforge.functions.on_floor(x, y, z, vi, area, data, c_stone, c_air, c_agaricus_bisporus, 1/18, underforge.stone.defs["jasper"].base)
      underforge.functions.ore(vi, data, underforge.stone.defs["jasper"].base, c_water, 1/2000)      
   end,
   --Tubers
   [23] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "pegmatite")
      underforge.functions.on_floor(x, y, z, vi, area, data, c_stone, c_air, c_amanita_phalloides, 1/18, underforge.stone.defs["pegmatite"].base)      
      underforge.functions.on_floor_rr(x, y, z, vi, area, data, p2data, c_stone, c_air, c_dark_tuber, 1/50, underforge.stone.defs["pegmatite"].base)      
      underforge.functions.ore(vi, data, underforge.stone.defs["pegmatite"].base, c_coal_ore, 1/201)
      underforge.functions.ore(vi, data, underforge.stone.defs["pegmatite"].base, c_water, 1/2000)      
   end,
   --Jasper & Flint
   [24] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "jasper")
      underforge.functions.ore(vi, data, underforge.stone.defs["flint"].base, 1/50)
   end,
   --Quartz
   [25] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "quartzite")
      underforge.functions.ore(vi, data, underforge.stone.defs["quartzite"].base, c_quartz_ore, 1/50)
      underforge.functions.on_wall_f(x, y, z, vi, area, data, p2data, c_stone, c_air, c_quartz_crystal, 1/50, lastlayer, underforge.stone.defs["quartzite"].base)
      underforge.functions.ore(vi, data, underforge.stone.defs["quartzite"].base, c_water, 1/2000)      
   end,
   --Emerald
   [26] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "olivine")
      underforge.functions.on_floor(x, y, z, vi, area, data, c_stone, c_air, c_green_mushroom, 1/18, underforge.stone.defs["olivine"].base)            
      underforge.functions.ore(vi, data, underforge.stone.defs["olivine"].base, c_emerald_ore, 1/201)
      underforge.functions.on_wall_f(x, y, z, vi, area, data, p2data, c_stone, c_air, c_emerald_crystal, 1/201, lastlayer, underforge.stone.defs["olivine"].base)
   end,
   --Moss
   [27] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "basalt")
      underforge.functions.on_wall_w(x, y, z, vi, area, data, p2data, c_stone, c_air, c_moss, 1/3, lastlayer, underforge.stone.defs["basalt"].base)
      underforge.functions.on_wall_w(x, y, z, vi, area, data, p2data, c_dirt, c_air, c_moss, 1/3, lastlayer)
      underforge.functions.on_floor(x, y, z, vi, area, data, c_stone, c_air, c_mycena_luxaeterna, 1/18, underforge.stone.defs["basalt"].base)
      underforge.functions.ore(vi, data, underforge.stone.defs["basalt"].base, c_water, 1/2000)      
   end,
   --Flint
   [28] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "flint")
   end,
   --Feldspar 2
   [29] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "feldspar")
   end,
   --Mica 2
   [30] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "mica")
   end,
   --Torchberry Jungle
   [31] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "granite")
      underforge.functions.on_roof(x, y, z, vi, area, data, c_stone, c_air, c_torchberries, 1/30, lastlayer, underforge.stone.defs["granite"].base)      
      underforge.functions.on_floor(x, y, z, vi, area, data, c_stone, c_air, c_agaricus_bisporus, 1/30, underforge.stone.defs["granite"].base)
      underforge.functions.on_floor(x, y, z, vi, area, data, c_stone, c_air, c_amanita_muscaria, 1/30, underforge.stone.defs["granite"].base)
      underforge.functions.on_floor(x, y, z, vi, area, data, c_stone, c_air, c_mycena_chlorophos, 1/30, underforge.stone.defs["granite"].base)
      underforge.functions.on_floor(x, y, z, vi, area, data, c_stone, c_air, c_mycena_luxaeterna, 1/30, underforge.stone.defs["granite"].base)
      underforge.functions.ore(vi, data, underforge.stone.defs["granite"].base, c_mossy_dirt, 1/100)
   end,
   --Fungus Jungle
   [32] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "andesite")
      underforge.functions.ore(vi, data, underforge.stone.defs["andesite"].base, c_mossy_dirt, 1/100)
      underforge.functions.on_wall_w(x, y, z, vi, area, data, p2data, c_stone, c_air, c_mould, 1/9, lastlayer, underforge.stone.defs["andesite"].base)
      underforge.functions.on_wall_w(x, y, z, vi, area, data, p2data, c_stone, c_air, c_underground_vine, 1/15, lastlayer, underforge.stone.defs["andesite"].base)      
      underforge.functions.on_floor(x, y, z, vi, area, data, c_stone, c_air, c_agaricus_bisporus, 1/30, underforge.stone.defs["andesite"].base)
      underforge.functions.on_floor(x, y, z, vi, area, data, c_stone, c_air, c_amanita_muscaria, 1/30, underforge.stone.defs["andesite"].base)
      underforge.functions.on_floor(x, y, z, vi, area, data, c_stone, c_air, c_mycena_chlorophos, 1/30, underforge.stone.defs["andesite"].base)
      underforge.functions.on_floor(x, y, z, vi, area, data, c_stone, c_air, c_mycena_luxaeterna, 1/30, underforge.stone.defs["andesite"].base)
      underforge.functions.ore(vi, data, underforge.stone.defs["andesite"].base, c_water, 1/2000)      
   end,
   --Lava Springs
   [33] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "marble")
      underforge.functions.ore(vi, data, underforge.stone.defs["marble"].base, c_lava, 1/2000)            
   end,
   --Fungus Jungle 2
   [32] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "olivine")
      underforge.functions.ore(vi, data, underforge.stone.defs["olivine"].base, c_mossy_dirt, 1/100)
      underforge.functions.on_wall_w(x, y, z, vi, area, data, p2data, c_stone, c_air, c_mould, 1/9, lastlayer, underforge.stone.defs["olivine"].base)
      underforge.functions.on_wall_w(x, y, z, vi, area, data, p2data, c_stone, c_air, c_moss, 1/9, lastlayer, underforge.stone.defs["olivine"].base)
      underforge.functions.on_wall_w(x, y, z, vi, area, data, p2data, c_stone, c_air, c_underground_vine, 1/15, lastlayer, underforge.stone.defs["olivine"].base)      
      underforge.functions.on_floor(x, y, z, vi, area, data, c_stone, c_air, c_agaricus_bisporus, 1/30, underforge.stone.defs["olivine"].base)
      underforge.functions.on_floor(x, y, z, vi, area, data, c_stone, c_air, c_amanita_muscaria, 1/30, underforge.stone.defs["olivine"].base)
      underforge.functions.on_floor(x, y, z, vi, area, data, c_stone, c_air, c_amanita_phalloides, 1/30, underforge.stone.defs["olivine"].base)
      underforge.functions.on_floor(x, y, z, vi, area, data, c_stone, c_air, c_armillaria_mellea, 1/30, underforge.stone.defs["olivine"].base)
      underforge.functions.on_floor(x, y, z, vi, area, data, c_stone, c_air, c_mycena_chlorophos, 1/30, underforge.stone.defs["olivine"].base)
      underforge.functions.on_floor(x, y, z, vi, area, data, c_stone, c_air, c_mycena_haematopus, 1/30, underforge.stone.defs["olivine"].base)
      underforge.functions.on_floor(x, y, z, vi, area, data, c_stone, c_air, c_mycena_interrupta, 1/30, underforge.stone.defs["olivine"].base)
      underforge.functions.on_floor(x, y, z, vi, area, data, c_stone, c_air, c_mycena_luxaeterna, 1/30, underforge.stone.defs["olivine"].base)
      underforge.functions.ore(vi, data, underforge.stone.defs["olivine"].base, c_water, 1/2000)      
   end,
   --Gneiss 2
   [35] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "gneiss")
   end,
   --Coal 2
   [36] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "shale")
      underforge.functions.in_floor(x, y, z, vi, area, data, c_stone, c_air, c_coal_dust, 1/9, underforge.stone.defs["shale"].base)
      --underforge.functions.ore(vi, data, underforge.stone.defs["shale"].base, c_coal_dust, 1/9)
      underforge.functions.ore(vi, data, underforge.stone.defs["shale"].base, c_coal_ore, 1/201)
   end,
   --Fungi 2
   [37] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "phyllite")
      underforge.functions.on_floor(x, y, z, vi, area, data, c_stone, c_air, c_mycena_haematopus, 1/40, underforge.stone.defs["phyllite"].base)
      underforge.functions.on_floor(x, y, z, vi, area, data, c_stone, c_air, c_amanita_muscaria, 1/40, underforge.stone.defs["phyllite"].base)
      underforge.functions.on_floor(x, y, z, vi, area, data, c_stone, c_air, c_armillaria_mellea, 1/20, underforge.stone.defs["phyllite"].base)
      underforge.functions.on_floor(x, y, z, vi, area, data, c_stone, c_air, c_mycena_chlorophos, 1/20, underforge.stone.defs["phyllite"].base)
      underforge.functions.on_wall_w(x, y, z, vi, area, data, p2data, c_stone, c_air, c_mould, 1/9, lastlayer, underforge.stone.defs["phyllite"].base)
      underforge.functions.ore(vi, data, underforge.stone.defs["phyllite"].base, c_water, 1/2000)      
   end,
   --Volcanic
   [38] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "volcanic_tuff")
      underforge.functions.in_floor(x, y, z, vi, area, data, c_stone, c_air, c_obsidian, 1/50, underforge.stone.defs["volcanic_tuff"].base)
      underforge.functions.ore(vi, data, underforge.stone.defs["pumice"].base, c_fiery_dust, 1/13)
      underforge.functions.on_floor(x, y, z, vi, area, data, c_stone, c_air, c_amanita_phalloides, 1/18, underforge.stone.defs["volcanic_tuff"].base)
   end,
   --Quartz 2
   [25] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "quartzite")
      underforge.functions.ore(vi, data, underforge.stone.defs["quartzite"].base, c_quartz_ore, 1/50)
      underforge.functions.on_wall_f(x, y, z, vi, area, data, p2data, c_stone, c_air, c_quartz_crystal, 1/50, lastlayer, underforge.stone.defs["quartzite"].base)
      underforge.functions.ore(vi, data, underforge.stone.defs["quartzite"].base, c_water, 1/2000)      
   end,
   --Schist 2
   [40] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "schist")
   end,
   --Amethyst & Sapphire
   [41] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "gabbro")
      underforge.functions.on_floor(x, y, z, vi, area, data, c_stone, c_air, c_mycena_interrupta, 1/18, underforge.stone.defs["gabbro"].base)            
      underforge.functions.ore(vi, data, underforge.stone.defs["gabbro"].base, c_sapphire_ore, 1/201)
      underforge.functions.ore(vi, data, underforge.stone.defs["gabbro"].base, c_amethyst_ore, 1/201)
      underforge.functions.on_wall_f(x, y, z, vi, area, data, p2data, c_stone, c_air, c_sapphire_crystal, 1/201, lastlayer, underforge.stone.defs["gabbro"].base)
      underforge.functions.on_wall_f(x, y, z, vi, area, data, p2data, c_stone, c_air, c_amethyst_crystal, 1/201, lastlayer, underforge.stone.defs["gabbro"].base)
      underforge.functions.on_wall_w(x, y, z, vi, area, data, p2data, c_stone, c_air, c_underground_vine, 1/15, lastlayer, underforge.stone.defs["gabbro"].base)      
      underforge.functions.ore(vi, data, underforge.stone.defs["gabbro"].base, c_water, 1/2000)      
   end,
   --Ruby Caves
   [42] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "jasper")
      underforge.functions.on_floor(x, y, z, vi, area, data, c_stone, c_air, c_amanita_muscaria, 1/18, underforge.stone.defs["jasper"].base)            
      underforge.functions.ore(vi, data, underforge.stone.defs["jasper"].base, c_ruby_ore, 1/201)
      underforge.functions.in_floor(x, y, z, vi, area, data, c_air, c_stone, c_ruby_dust, 1/450, underforge.stone.defs["jasper"].base)      
      underforge.functions.on_wall_f(x, y, z, vi, area, data, p2data, c_stone, c_air, c_ruby_crystal, 1/201, lastlayer, underforge.stone.defs["jasper"].base)
      underforge.functions.ore(vi, data, underforge.stone.defs["jasper"].base, c_water, 1/2000)      
   end,
   --Phyllite 2
   [43] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "phyllite")
   end,
   --Chert 2
   [44] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "chert")
   end,
   --Quartz 3
   [45] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "quartzite")
      underforge.functions.ore(vi, data, underforge.stone.defs["quartzite"].base, c_quartz_ore, 1/50)
      underforge.functions.on_wall_f(x, y, z, vi, area, data, p2data, c_stone, c_air, c_quartz_crystal, 1/50, lastlayer, underforge.stone.defs["quartzite"].base)
      underforge.functions.ore(vi, data, underforge.stone.defs["quartzite"].base, c_water, 1/2000)      
   end,
   --Aquamarine & Amethyst
   [46] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "diorite")
      underforge.functions.ore(vi, data, underforge.stone.defs["diorite"].base, c_aquamarine_ore, 1/50)
      underforge.functions.on_wall_f(x, y, z, vi, area, data, p2data, c_stone, c_air, c_aquamarine_crystal, 1/50, lastlayer, underforge.stone.defs["diorite"].base)
      underforge.functions.ore(vi, data, underforge.stone.defs["diorite"].base, c_amethyst_ore, 1/50)
      underforge.functions.on_wall_f(x, y, z, vi, area, data, p2data, c_stone, c_air, c_amethyst_crystal, 1/50, lastlayer, underforge.stone.defs["diorite"].base)
      underforge.functions.ore(vi, data, underforge.stone.defs["diorite"].base, c_water, 1/2000)      
   end,
   --Pegmatite 2
   [47] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "pegmatite")
   end,
   --Lava Jungle
   [48] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "gabbro")
      underforge.functions.ore(vi, data, underforge.stone.defs["gabbro"].base, c_mossy_dirt, 1/100)
      underforge.functions.on_floor(x, y, z, vi, area, data, c_stone, c_air, c_amanita_muscaria, 1/18, underforge.stone.defs["gabbro"].base)
      underforge.functions.on_floor(x, y, z, vi, area, data, c_stone, c_air, c_armillaria_mellea, 1/18, underforge.stone.defs["gabbro"].base)
      underforge.functions.on_wall_w(x, y, z, vi, area, data, p2data, c_stone, c_air, c_underground_vine, 1/15, lastlayer, underforge.stone.defs["gabbro"].base)      
      underforge.functions.ore(vi, data, underforge.stone.defs["gabbro"].base, c_lava, 1/5000)      
   end,
   --Slate 2
   [49] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "slate")
   end,
   --Diamonds
   [50] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "kimberlite")
      underforge.functions.ore(vi, data, underforge.stone.defs["kimberlite"].base, c_diamond_ore, 1/18)
      underforge.functions.ore(vi, data, c_diamond_ore, c_diamond_block, 1/72)
      underforge.functions.ore(vi, data, underforge.stone.defs["kimberlite"].base, c_lava, 1/1000)      
   end,
   --Lava Jungle 2
   [51] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "mica")
      underforge.functions.ore(vi, data, underforge.stone.defs["mica"].base, c_mossy_dirt, 1/100)
      underforge.functions.on_floor(x, y, z, vi, area, data, c_stone, c_air, c_amanita_muscaria, 1/18, underforge.stone.defs["mica"].base)
      underforge.functions.on_floor(x, y, z, vi, area, data, c_stone, c_air, c_armillaria_mellea, 1/18, underforge.stone.defs["mica"].base)
      underforge.functions.on_wall_w(x, y, z, vi, area, data, p2data, c_stone, c_air, c_underground_vine, 1/15, lastlayer, underforge.stone.defs["mica"].base)      
      underforge.functions.ore(vi, data, underforge.stone.defs["mica"].base, c_lava, 1/5000)      
   end,
   --Copper
   [52] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "gneiss")
      underforge.functions.ore(vi, data, underforge.stone.defs["gneiss"].base, c_copper_ore, 1/201)
      underforge.functions.ore(vi, data, underforge.stone.defs["gneiss"].base, c_lava, 1/1000)      
   end,
   --Hot Slate
   [53] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "slate")
      underforge.functions.ore(vi, data, c_obsidian, c_lava, 1/1000)      
   end,
   --Chalk 2
   [54] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "chalk")
   end,
   --Wet Mica
   [55] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "mica")
      underforge.functions.replace(vi, data, c_air, c_water)
   end,
   --Emerald 2
   [56] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "mica")
      underforge.functions.on_floor(x, y, z, vi, area, data, c_stone, c_air, c_mycena_chlorophos, 1/18, underforge.stone.defs["mica"].base)            
      underforge.functions.ore(vi, data, underforge.stone.defs["mica"].base, c_emerald_ore, 1/201)
      underforge.functions.on_wall_f(x, y, z, vi, area, data, p2data, c_stone, c_air, c_emerald_crystal, 1/201, lastlayer, underforge.stone.defs["mica"].base)
   end,
   --Diamonds
   [57] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "kimberlite")
      underforge.functions.ore(vi, data, underforge.stone.defs["kimberlite"].base, c_diamond_ore, 1/18)
      underforge.functions.ore(vi, data, c_diamond_ore, c_diamond_block, 1/72)
      underforge.functions.ore(vi, data, underforge.stone.defs["kimberlite"].base, c_lava, 1/1000)      
   end,
   --Crystal Caves
   [58] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "amphibolite")
      underforge.functions.on_floor(x, y, z, vi, area, data, c_stone, c_air, c_mycena_luxaeterna, 1/30, underforge.stone.defs["amphibolite"].base)            
      underforge.functions.ore(vi, data, underforge.stone.defs["amphibolite"].base, c_sapphire_ore, 1/201)
      underforge.functions.ore(vi, data, underforge.stone.defs["amphibolite"].base, c_amethyst_ore, 1/201)
      underforge.functions.ore(vi, data, underforge.stone.defs["amphibolite"].base, c_quartz_ore_ore, 1/201)
      underforge.functions.ore(vi, data, underforge.stone.defs["amphibolite"].base, c_emerald_ore_ore, 1/201)
      underforge.functions.ore(vi, data, underforge.stone.defs["amphibolite"].base, c_ruby_ore, 1/201)
      underforge.functions.on_wall_f(x, y, z, vi, area, data, p2data, c_stone, c_air, c_sapphire_crystal, 1/201, lastlayer, underforge.stone.defs["gabbro"].base)
      underforge.functions.on_wall_f(x, y, z, vi, area, data, p2data, c_stone, c_air, c_amethyst_crystal, 1/201, lastlayer, underforge.stone.defs["gabbro"].base)
      underforge.functions.on_wall_f(x, y, z, vi, area, data, p2data, c_stone, c_air, c_quartz_crystal_crystal, 1/201, lastlayer, underforge.stone.defs["gabbro"].base)
      underforge.functions.on_wall_f(x, y, z, vi, area, data, p2data, c_stone, c_air, c_emerald_crystal, 1/201, lastlayer, underforge.stone.defs["gabbro"].base)
      underforge.functions.on_wall_f(x, y, z, vi, area, data, p2data, c_stone, c_air, c_ruby_crystal, 1/201, lastlayer, underforge.stone.defs["gabbro"].base)
      underforge.functions.on_wall_w(x, y, z, vi, area, data, p2data, c_stone, c_air, c_underground_vine, 1/15, lastlayer, underforge.stone.defs["gabbro"].base)      
      underforge.functions.ore(vi, data, underforge.stone.defs["amphibolite"].base, c_water, 1/2000)      
   end,
   --Volcanic Granite
   [59] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "granite")
      underforge.functions.ore(vi, data, underforge.stone.defs["granite"].base, c_obsidian, 1/200)      
      underforge.functions.ore(vi, data, underforge.stone.defs["pumice"].base, c_lava, 1/300)      
   end,
   --Lava
   [60] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "pumice")
      underforge.functions.replace(vi, data, c_air, c_lava)      
   end,
   --Volcanic Basalt
   [61] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "basalt")
      underforge.functions.ore(vi, data, underforge.stone.defs["basalt"].base, c_obsidian, 1/200)      
      underforge.functions.ore(vi, data, underforge.stone.defs["pumice"].base, c_lava, 1/300)      
   end,
   --Volcanic Tuff
   [62] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.functions.replace(vi, data, c_stone, c_volcanic_tuff)
      underforge.functions.replace(vi, data, c_cobble, c_volcanic_tuff)
      underforge.functions.ore(vi, data, underforge.stone.defs["volcanic_tuff"].base, c_obsidian, 1/100)      
      underforge.functions.ore(vi, data, underforge.stone.defs["pumice"].base, c_lava, 1/300)      
      underforge.functions.replace(vi, data, c_air, c_lava)         
      underforge.use_stone(vi, data, "volcanic_tuff")
   end,
}

local np_darkness = {
   offset = 0,
   scale = 1,
   spread = {x=200, y=200, z=200},
   seed = 6830,
   octaves = 3,
   persist = 0.5
}

local np_water = {
   offset = 0,
   scale = 1,
   spread = {x=200, y=200, z=200},
   seed = 6831,
   octaves = 3,
   persist = 0.5
}

local np_pressure = {
   offset = 0,
   scale = 1,
   spread = {x=200, y=200, z=200},
   seed = 6832,
   octaves = 3,
   persist = 0.5
}

minetest.register_on_generated(function(minp, maxp, seed)

   --easy reference to commonly used values
   --local t1 = os.clock()
   local x1 = maxp.x
   local y1 = maxp.y
   local z1 = maxp.z
   local x0 = minp.x
   local y0 = minp.y
   local z0 = minp.z
      
   local vm, emin, emax = minetest.get_mapgen_object("voxelmanip")
   local area = VoxelArea:new{MinEdge=emin, MaxEdge=emax}
   local data = vm:get_data()
   local p2data = vm:get_param2_data()
      
   --mandatory values
   local sidelen = x1 - x0 + 1 --length of a mapblock
   local chulens = {x=sidelen, y=sidelen, z=sidelen} --table of chunk edges
   local chulens2D = {x=sidelen, y=sidelen, z=1}
   local minposxyz = {x=x0, y=y0, z=z0} --bottom corner
   local minposxz = {x=x0, y=z0} --2D bottom corner
   
   local nvals_darkness = minetest.get_perlin_map(np_darkness, chulens):get3dMap_flat(minposxyz)
   local nvals_water = minetest.get_perlin_map(np_water, chulens):get3dMap_flat(minposxyz)
   local nvals_pressure = minetest.get_perlin_map(np_pressure, chulens):get3dMap_flat(minposxyz)
   
   local nixyz = 1 --3D node index
   local nixz = 1 --2D node index
   local nixyz2 = 1 --second 3D index for second loop
   

   for z = z0, z1 do -- for each xy plane progressing northwards
      --increment indices
      nixyz = nixyz + 1

      for y = y0, y1 do -- for each x row progressing upwards   

         local vi = area:index(x0, y, z)
         for x = x0, x1 do -- for each node do
            
            local darkness = nvals_darkness[nixyz2]
            local water = nvals_water[nixyz2]
            local pressure = underforge.functions.get_pressure(y, nvals_pressure[nixyz2])

            --[[if y > -100 then -- limit the biome variety near surface
               darkness = -0.01*y*darkness - 1 - 0.01*y
               water = -0.01*y*water - 1 - 0.01*y
            end--]]
            local biome = underforge.functions.get_biome(darkness, water, pressure) + 1

            if (biome < 1) or (biome > 62) then
               print(string.format("Wrong biome %i", biome))
               biome = 1
            end

            underforge.biomegen[biome](x, y, z, vi, data, p2data, area, y == y1)

            nixyz2 = nixyz2 + 1
            nixz = nixz + 1
            vi = vi + 1
         end
         nixz = nixz - sidelen --shift the 2D index back
      end
      nixz = nixz + sidelen --shift the 2D index up a layer
   end

   --send data back to voxelmanip
   vm:set_data(data)
   vm:set_param2_data(p2data)
   --calc lighting
   vm:set_lighting({day=0, night=0})
   vm:calc_lighting()
   --write it to world
   vm:write_to_map(data)

   --local chugent = math.ceil((os.clock() - t1) * 1000) --grab how long it took
   --print ("[caverealms] "..chugent.." ms") --tell people how long
end)


can you or anyone help me with this mess?
 

zing269
Member
 
Posts: 108
Joined: Sat Apr 30, 2016 19:10

Re: Noob here, needing help setting up data tables

by zing269 » Sat Jan 25, 2020 01:06

you declared c_mycena_cholorophos but used c_mycena_chlorophos, cho vs chl.

c_coal_ore is not defined in worldgen.

I'm sure dir, dir_c, and alt are similar problems, maybe an embedded space or something.
 

Winter94
Member
 
Posts: 43
Joined: Sat Jan 11, 2020 17:15
In-game: Azrael Winter WintersKnight

Re: Noob here, needing help setting up data tables

by Winter94 » Sat Jan 25, 2020 03:06

ok, i fixed the typo with mycena chlorophos, and added
local c_lignite = minetest.get_content_id("underforge:lignite")
as well as replacing every instance of c_coal_ore with c_lignite
and here's the thing, I love my keyboard to death(I have a Poseidon Z Blue by Thermaltake), and its the only remaining component of my old gaming PC(currently on and old notebook laptop, so when my code does actually run, i average 4-8 fps). The problem is, I live in a house with pets and children, and even though I take it apart and clean it about once a month, it still ends up getting cat/dog/children hair and dust under the keys, causing it to studder sometimes, and either not completely press a key(rare),or double-press a key(common). You can imagine how this affects my code, and so far while typing this I've had to correct 5 errors.
TLDR: Keyboard constantly gets dust/hair under keys, and you are probably right about there being an extra space somewhere, even though I've combed over it many times.
Last edited by Winter94 on Sat Jan 25, 2020 03:22, edited 1 time in total.
 

Winter94
Member
 
Posts: 43
Joined: Sat Jan 11, 2020 17:15
In-game: Azrael Winter WintersKnight

Re: Noob here, needing help setting up data tables

by Winter94 » Sat Jan 25, 2020 03:19

UPDATE
Ok, after the help I've recieved from the good people of these forums, and many headaches, I feel I am getting very close(I can taste victory, don'tcha know?). But I'm not there yet, and there is no rest for the weary. Here's my updated mineral table:
Code: Select all
underforge.minerals = {}

local mineral_table = { --name, desc, strata, rarity
   {"corundum",      "Corundum",         "gneiss",         10*10*10,},
   {"corundum",      "Corundum",         "mica",            10*10*10,},
   {"corundum",      "Corundum",         "schist",         10*10*10,},
   {"corundum",      "Corundum",         "pegmatite",      10*10*10,},
   {"tetrahedrite",   "Tetrahedrite",      "diorite",         10*10*10,},
   {"tetrahedrite",   "Tetrahedrite",      "pegmatite",      10*10*10,},
   {"tetrahedrite",   "Tetrahedrite",      "phyllite",         10*10*10,},
   {"cassiterite",      "Cassiterite",      "andesite",         10*10*10,},
   {"cassiterite",      "Cassiterite",      "basalt",         10*10*10,},
   {"cassiterite",      "Cassiterite",      "gabbro",         10*10*10,},
   {"sphalerite",      "Sphalerite",      "andesite",         10*10*10,},
   {"sphalerite",      "Sphalerite",      "dolomite",         10*10*10,},
   {"sphalerite",      "Sphalerite",      "gneiss",         10*10*10,},
   {"bismuthinite",   "Bismuthinite",      "diorite",         10*10*10,},
   {"bismuthinite",   "Bismuthinite",      "granite",         10*10*10,},
   {"bismuthinite",   "Bismuthinite",      "pegmatite",      10*10*10,},
   }

for i in ipairs (mineral_table) do
    local name      = mineral_table[i][1]
    local desc      = mineral_table[i][2]
    local strata   = mineral_table[i][3]
    local rarity   = mineral_table[i][4]

minetest.register_node("underforge:"..name){
   description   = desc,
   tiles      = '"strata..".png"^"ore_"..name..".png"',
   groups      = {cracky = 3, minerals = 1},
   drop      = "underforge:"..name.."_chunk",
   sounds      = default.node_sound_stone_defaults(),
   }

minetest.register_ore("underforge:"..name){
   ore_type      = "scatter",
   ore            = "underforge:"..name.."_in_"..strata,
   wherein         = "underforge:"..strata,
   clust_scarcity   = {rarity},
   clust_size      = 5,
   clust_num_ores   = 10,
   }

minetest.register_craftitem("underforge:"..name){
      description = S("Chunk of" ..desc ),
      groups = {rocks = 1, minerals = 2},
      inventory_image = "chunk_"..name..".png",
   }
end

Here's The worldgen file:
Code: Select all
-- used blocks
local c_air = minetest.get_content_id("air")
local c_stone = minetest.get_content_id("default:stone")

local c_water = minetest.get_content_id("default:water_source")
local c_lava = minetest.get_content_id("default:lava_source")
local c_dirt = minetest.get_content_id("default:dirt")
local c_cobble = minetest.get_content_id("default:cobble")
local c_cobblestair = minetest.get_content_id("stairs:stair_cobble")
local c_coalblock = minetest.get_content_id("default:coalblock")

local c_dust = minetest.get_content_id("underforge:dust")
local c_coal_dust = minetest.get_content_id("underforge:coal_dust")

-----Mushrooms-----
local c_agaricus_bisporus = minetest.get_content_id("underforge:agaricus_bisporus")
local c_amanita_muscaria = minetest.get_content_id("underforge:amanita_muscaria")
local c_amanita_phalloides = minetest.get_content_id("underforge:amanita_phalloides")
local c_armillaria_mellea = minetest.get_content_id("underforge:armillaria_mellea")
local c_mycena_chlorophos = minetest.get_content_id("underforge:mycena_chlorophos")
local c_mycena_haematopus = minetest.get_content_id("underforge:mycena_haematopus")
local c_mycena_interrupta = minetest.get_content_id("underforge:mycena_interrupta")
local c_mycena_luxaeterna = minetest.get_content_id("underforge:mycena_luxaeterna")
local c_dark_tuber = minetest.get_content_id("underforge:dark_tuber")
-------------------
local c_mossy_dirt = minetest.get_content_id("underforge:mossy_dirt")
local c_torchberries = minetest.get_content_id("underforge:torchberries")
local c_moss = minetest.get_content_id("underforge:moss")
local c_dry_moss = minetest.get_content_id("underforge:dry_moss")
local c_underground_bush = minetest.get_content_id("underforge:underground_bush")
local c_dead_bush = minetest.get_content_id("underforge:dead_bush")
local c_mould = minetest.get_content_id("underforge:mould")
local c_underground_vine = minetest.get_content_id("underforge:underground_vine")
-------------------
local c_lignite = minetest.get_content_id("underforge:lignite")
-------------------
local c_amethyst_ore = minetest.get_content_id("underforge:amethyst_ore")
local c_amethyst_crystal = minetest.get_content_id("underforge:amethyst_crystal")
local c_emerald_ore = minetest.get_content_id("underforge:emerald_ore")
local c_emerald_crystal = minetest.get_content_id("underforge:emerald_crystal")
local c_ruby_ore = minetest.get_content_id("underforge:ruby_ore")
local c_ruby_crystal = minetest.get_content_id("underforge:ruby_crystal")
local c_sapphire_ore = minetest.get_content_id("underforge:saphire_ore")
local c_sapphire_crystal = minetest.get_content_id("underforge:saphire_crystal")
local c_aquamarine_ore = minetest.get_content_id("underforge:aquamarine_ore")
local c_aquamarine_crystal = minetest.get_content_id("underforge:aquamarine_crystal")
local c_quartz_ore = minetest.get_content_id("underforge:quartz_ore")
local c_quartz_crystal = minetest.get_content_id("underforge:quartz_crystal")
local c_topaz_ore = minetest.get_content_id("underforge:topaz_ore")
local c_topaz_crystal = minetest.get_content_id("underforge:topaz_crystal")
local c_onyx_ore = minetest.get_content_id("underforge:onyx_ore")
local c_onyx_crystal = minetest.get_content_id("underforge:onyx_crystal")


local c_fire = minetest.get_content_id("fire:permanent_flame")
local c_fiery_dust = minetest.get_content_id("underforge:fiery_dust")
local c_fiery_vine = minetest.get_content_id("underforge:fiery_vine")
local c_lava_crack = minetest.get_content_id("underforge:lava_crack")

local c_quartz_block = minetest.get_content_id("underforge:quartz_block")
local c_aquamarine_block = minetest.get_content_id("underforge:aquamarine_block")
local c_amethyst_block = minetest.get_content_id("underforge:amethyst_block")

local c_basalt = minetest.get_content_id("underforge:basalt")
local c_obsidian = minetest.get_content_id("default:obsidian")
local c_pumice = minetest.get_content_id("underforge:pumice")
local c_volcanic_tuff = minetest.get_content_id("underforge:volcanic_tuff")

--[[local c_amphibolite = minetest.get_content_id("underforge:amphibolite")
local c_andesite = minetest.get_content_id("underforge:andesite")
local c_basalt = minetest.get_content_id("underforge:basalt")
local c_chalk = minetest.get_content_id("underforge:chalk")
local c_chert = minetest.get_content_id("underforge:chert")
local c_diorite = minetest.get_content_id("underforge:diorite")
local c_dolomite = minetest.get_content_id("underforge:dolomite")
local c_feldspar = minetest.get_content_id("underforge:feldspar")
local c_flint = minetest.get_content_id("underforge:flint")
local c_gabbro = minetest.get_content_id("underforge:gabbro")
local c_gneiss = minetest.get_content_id("underforge:gneiss")
local c_granite = minetest.get_content_id("underforge:granite")
local c_jasper = minetest.get_content_id("underforge:jasper")
local c_kimberlite = minetest.get_content_id("underforge:kimberlite")
local c_limestone = minetest.get_content_id("underforge:limestone")
local c_marble = minetest.get_content_id("underforge:marble")
local c_mica = minetest.get_content_id("underforge:mica")
local c_olivine = minetest.get_content_id("underforge:olivine")
local c_pegmatite = minetest.get_content_id("underforge:pegmatite")
local c_phyllite = minetest.get_content_id("underforge:phyllite")
local c_pumice = minetest.get_content_id("underforge:pumice")
local c_quartzite = minetest.get_content_id("underforge:quartzite")
local c_schist = minetest.get_content_id("underforge:schist")
local c_shale = minetest.get_content_id("underforge:shale")
local c_slate = minetest.get_content_id("underforge:slate")
local c_volcanic_tuff = minetest.get_content_id("underforge:volcanic_tuff")--]]

function underforge.use_stone(vi, data, id)
   underforge.functions.replace(vi, data, c_stone, underforge.stone.defs[id].base)
   underforge.functions.replace(vi, data, c_cobble, underforge.stone.defs[id].cobble)
   underforge.functions.replace(vi, data, c_cobblestair, underforge.stone.defs[id].stair)
end


---------- Biome Definitions ----------

underforge.biomegen = {
   --Dolomite
   [1] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "dolomite")
   end,
   --Limestone
   [2] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "limestone")
   end,
   --Schist
   [3] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "schist")
   end,
   --Andesite
   [4] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "andesite")
   end,
   --Phyllite
   [5] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "phyllite")
   end,
   --Quartzite
   [6] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "quartzite")
   end,
   --Mica
   [7] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "mica")
   end,
   --Slate
   [8] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "slate")
   end,
   --Gneiss
   [9] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "gneiss")
   end,
   --Chalk
   [10] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "chalk")
   end,
   --Feldspar
   [11] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "feldspar")
   end,
   --Basalt
   [12] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "basalt")
   end,
   --Diorite
   [13] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "diorite")
   end,
   --Chert
   [14] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "chert")
   end,
   --Granite
   [15] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "granite")
   end,
   --Gabbro
   [16] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "gabbro")
   end,
   --Dolomite Cave
   [17] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "dolomite")
      underforge.functions.ore(vi, data, underforge.stone.defs["dolomite"].base, c_water, 1/2000)      
   end,
   --Limestone Dust
   [18] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "limestone")
      underforge.functions.in_floor(x, y, z, vi, area, data, c_stone, c_air, c_dust, 1, underforge.stone.defs["limestone"].base)      
   end,
   --Coal
   [19] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "shale")
      underforge.functions.in_floor(x, y, z, vi, area, data, c_stone, c_air, c_coal_dust, 1/9, underforge.stone.defs["shale"].base)
      --underforge.functions.ore(vi, data, underforge.stone.defs["shale"].base, c_coal_dust, 1/9)
      underforge.functions.ore(vi, data, underforge.stone.defs["shale"].base, c_lignite, 1/201)
   end,
   --Marble
   [20] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "marble")
   end,
   --Fungi
   [21] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "amphibolite")
      underforge.functions.on_floor(x, y, z, vi, area, data, c_stone, c_air, c_mycena_luxaeterna, 1/18, underforge.stone.defs["amphibolite"].base)
      underforge.functions.on_floor(x, y, z, vi, area, data, c_stone, c_air, c_mycena_haematopus, 1/18, underforge.stone.defs["amphibolite"].base)
      underforge.functions.on_wall_w(x, y, z, vi, area, data, p2data, c_stone, c_air, c_mould, 1/9, lastlayer, underforge.stone.defs["amphibolite"].base)
      underforge.functions.ore(vi, data, underforge.stone.defs["amphibolite"].base, c_water, 1/2000)      
   end,
   --Torchberries
   [22] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "jasper")
      underforge.functions.on_roof(x, y, z, vi, area, data, c_stone, c_air, c_torchberries, 1/30, lastlayer, underforge.stone.defs["jasper"].base)      
      underforge.functions.on_floor(x, y, z, vi, area, data, c_stone, c_air, c_agaricus_bisporus, 1/18, underforge.stone.defs["jasper"].base)
      underforge.functions.ore(vi, data, underforge.stone.defs["jasper"].base, c_water, 1/2000)      
   end,
   --Tubers
   [23] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "pegmatite")
      underforge.functions.on_floor(x, y, z, vi, area, data, c_stone, c_air, c_amanita_phalloides, 1/18, underforge.stone.defs["pegmatite"].base)      
      underforge.functions.on_floor_rr(x, y, z, vi, area, data, p2data, c_stone, c_air, c_dark_tuber, 1/50, underforge.stone.defs["pegmatite"].base)      
      underforge.functions.ore(vi, data, underforge.stone.defs["pegmatite"].base, c_lignite, 1/201)
      underforge.functions.ore(vi, data, underforge.stone.defs["pegmatite"].base, c_water, 1/2000)      
   end,
   --Jasper & Flint
   [24] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "jasper")
      underforge.functions.ore(vi, data, underforge.stone.defs["flint"].base, 1/50)
   end,
   --Quartz
   [25] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "quartzite")
      underforge.functions.ore(vi, data, underforge.stone.defs["quartzite"].base, c_quartz_ore, 1/50)
      underforge.functions.on_wall_f(x, y, z, vi, area, data, p2data, c_stone, c_air, c_quartz_crystal, 1/50, lastlayer, underforge.stone.defs["quartzite"].base)
      underforge.functions.ore(vi, data, underforge.stone.defs["quartzite"].base, c_water, 1/2000)      
   end,
   --Emerald
   [26] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "olivine")
      underforge.functions.on_floor(x, y, z, vi, area, data, c_stone, c_air, c_green_mushroom, 1/18, underforge.stone.defs["olivine"].base)            
      underforge.functions.ore(vi, data, underforge.stone.defs["olivine"].base, c_emerald_ore, 1/201)
      underforge.functions.on_wall_f(x, y, z, vi, area, data, p2data, c_stone, c_air, c_emerald_crystal, 1/201, lastlayer, underforge.stone.defs["olivine"].base)
   end,
   --Moss
   [27] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "basalt")
      underforge.functions.on_wall_w(x, y, z, vi, area, data, p2data, c_stone, c_air, c_moss, 1/3, lastlayer, underforge.stone.defs["basalt"].base)
      underforge.functions.on_wall_w(x, y, z, vi, area, data, p2data, c_dirt, c_air, c_moss, 1/3, lastlayer)
      underforge.functions.on_floor(x, y, z, vi, area, data, c_stone, c_air, c_mycena_luxaeterna, 1/18, underforge.stone.defs["basalt"].base)
      underforge.functions.ore(vi, data, underforge.stone.defs["basalt"].base, c_water, 1/2000)      
   end,
   --Flint
   [28] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "flint")
   end,
   --Feldspar 2
   [29] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "feldspar")
   end,
   --Mica 2
   [30] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "mica")
   end,
   --Torchberry Jungle
   [31] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "granite")
      underforge.functions.on_roof(x, y, z, vi, area, data, c_stone, c_air, c_torchberries, 1/30, lastlayer, underforge.stone.defs["granite"].base)      
      underforge.functions.on_floor(x, y, z, vi, area, data, c_stone, c_air, c_agaricus_bisporus, 1/30, underforge.stone.defs["granite"].base)
      underforge.functions.on_floor(x, y, z, vi, area, data, c_stone, c_air, c_amanita_muscaria, 1/30, underforge.stone.defs["granite"].base)
      underforge.functions.on_floor(x, y, z, vi, area, data, c_stone, c_air, c_mycena_chlorophos, 1/30, underforge.stone.defs["granite"].base)
      underforge.functions.on_floor(x, y, z, vi, area, data, c_stone, c_air, c_mycena_luxaeterna, 1/30, underforge.stone.defs["granite"].base)
      underforge.functions.ore(vi, data, underforge.stone.defs["granite"].base, c_mossy_dirt, 1/100)
   end,
   --Fungus Jungle
   [32] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "andesite")
      underforge.functions.ore(vi, data, underforge.stone.defs["andesite"].base, c_mossy_dirt, 1/100)
      underforge.functions.on_wall_w(x, y, z, vi, area, data, p2data, c_stone, c_air, c_mould, 1/9, lastlayer, underforge.stone.defs["andesite"].base)
      underforge.functions.on_wall_w(x, y, z, vi, area, data, p2data, c_stone, c_air, c_underground_vine, 1/15, lastlayer, underforge.stone.defs["andesite"].base)      
      underforge.functions.on_floor(x, y, z, vi, area, data, c_stone, c_air, c_agaricus_bisporus, 1/30, underforge.stone.defs["andesite"].base)
      underforge.functions.on_floor(x, y, z, vi, area, data, c_stone, c_air, c_amanita_muscaria, 1/30, underforge.stone.defs["andesite"].base)
      underforge.functions.on_floor(x, y, z, vi, area, data, c_stone, c_air, c_mycena_chlorophos, 1/30, underforge.stone.defs["andesite"].base)
      underforge.functions.on_floor(x, y, z, vi, area, data, c_stone, c_air, c_mycena_luxaeterna, 1/30, underforge.stone.defs["andesite"].base)
      underforge.functions.ore(vi, data, underforge.stone.defs["andesite"].base, c_water, 1/2000)      
   end,
   --Lava Springs
   [33] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "marble")
      underforge.functions.ore(vi, data, underforge.stone.defs["marble"].base, c_lava, 1/2000)            
   end,
   --Fungus Jungle 2
   [32] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "olivine")
      underforge.functions.ore(vi, data, underforge.stone.defs["olivine"].base, c_mossy_dirt, 1/100)
      underforge.functions.on_wall_w(x, y, z, vi, area, data, p2data, c_stone, c_air, c_mould, 1/9, lastlayer, underforge.stone.defs["olivine"].base)
      underforge.functions.on_wall_w(x, y, z, vi, area, data, p2data, c_stone, c_air, c_moss, 1/9, lastlayer, underforge.stone.defs["olivine"].base)
      underforge.functions.on_wall_w(x, y, z, vi, area, data, p2data, c_stone, c_air, c_underground_vine, 1/15, lastlayer, underforge.stone.defs["olivine"].base)      
      underforge.functions.on_floor(x, y, z, vi, area, data, c_stone, c_air, c_agaricus_bisporus, 1/30, underforge.stone.defs["olivine"].base)
      underforge.functions.on_floor(x, y, z, vi, area, data, c_stone, c_air, c_amanita_muscaria, 1/30, underforge.stone.defs["olivine"].base)
      underforge.functions.on_floor(x, y, z, vi, area, data, c_stone, c_air, c_amanita_phalloides, 1/30, underforge.stone.defs["olivine"].base)
      underforge.functions.on_floor(x, y, z, vi, area, data, c_stone, c_air, c_armillaria_mellea, 1/30, underforge.stone.defs["olivine"].base)
      underforge.functions.on_floor(x, y, z, vi, area, data, c_stone, c_air, c_mycena_chlorophos, 1/30, underforge.stone.defs["olivine"].base)
      underforge.functions.on_floor(x, y, z, vi, area, data, c_stone, c_air, c_mycena_haematopus, 1/30, underforge.stone.defs["olivine"].base)
      underforge.functions.on_floor(x, y, z, vi, area, data, c_stone, c_air, c_mycena_interrupta, 1/30, underforge.stone.defs["olivine"].base)
      underforge.functions.on_floor(x, y, z, vi, area, data, c_stone, c_air, c_mycena_luxaeterna, 1/30, underforge.stone.defs["olivine"].base)
      underforge.functions.ore(vi, data, underforge.stone.defs["olivine"].base, c_water, 1/2000)      
   end,
   --Gneiss 2
   [35] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "gneiss")
   end,
   --Coal 2
   [36] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "shale")
      underforge.functions.in_floor(x, y, z, vi, area, data, c_stone, c_air, c_coal_dust, 1/9, underforge.stone.defs["shale"].base)
      --underforge.functions.ore(vi, data, underforge.stone.defs["shale"].base, c_coal_dust, 1/9)
      underforge.functions.ore(vi, data, underforge.stone.defs["shale"].base, c_lignite, 1/201)
   end,
   --Fungi 2
   [37] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "phyllite")
      underforge.functions.on_floor(x, y, z, vi, area, data, c_stone, c_air, c_mycena_haematopus, 1/40, underforge.stone.defs["phyllite"].base)
      underforge.functions.on_floor(x, y, z, vi, area, data, c_stone, c_air, c_amanita_muscaria, 1/40, underforge.stone.defs["phyllite"].base)
      underforge.functions.on_floor(x, y, z, vi, area, data, c_stone, c_air, c_armillaria_mellea, 1/20, underforge.stone.defs["phyllite"].base)
      underforge.functions.on_floor(x, y, z, vi, area, data, c_stone, c_air, c_mycena_chlorophos, 1/20, underforge.stone.defs["phyllite"].base)
      underforge.functions.on_wall_w(x, y, z, vi, area, data, p2data, c_stone, c_air, c_mould, 1/9, lastlayer, underforge.stone.defs["phyllite"].base)
      underforge.functions.ore(vi, data, underforge.stone.defs["phyllite"].base, c_water, 1/2000)      
   end,
   --Volcanic
   [38] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "volcanic_tuff")
      underforge.functions.in_floor(x, y, z, vi, area, data, c_stone, c_air, c_obsidian, 1/50, underforge.stone.defs["volcanic_tuff"].base)
      underforge.functions.ore(vi, data, underforge.stone.defs["pumice"].base, c_fiery_dust, 1/13)
      underforge.functions.on_floor(x, y, z, vi, area, data, c_stone, c_air, c_amanita_phalloides, 1/18, underforge.stone.defs["volcanic_tuff"].base)
   end,
   --Quartz 2
   [25] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "quartzite")
      underforge.functions.ore(vi, data, underforge.stone.defs["quartzite"].base, c_quartz_ore, 1/50)
      underforge.functions.on_wall_f(x, y, z, vi, area, data, p2data, c_stone, c_air, c_quartz_crystal, 1/50, lastlayer, underforge.stone.defs["quartzite"].base)
      underforge.functions.ore(vi, data, underforge.stone.defs["quartzite"].base, c_water, 1/2000)      
   end,
   --Schist 2
   [40] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "schist")
   end,
   --Amethyst & Sapphire
   [41] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "gabbro")
      underforge.functions.on_floor(x, y, z, vi, area, data, c_stone, c_air, c_mycena_interrupta, 1/18, underforge.stone.defs["gabbro"].base)            
      underforge.functions.ore(vi, data, underforge.stone.defs["gabbro"].base, c_sapphire_ore, 1/201)
      underforge.functions.ore(vi, data, underforge.stone.defs["gabbro"].base, c_amethyst_ore, 1/201)
      underforge.functions.on_wall_f(x, y, z, vi, area, data, p2data, c_stone, c_air, c_sapphire_crystal, 1/201, lastlayer, underforge.stone.defs["gabbro"].base)
      underforge.functions.on_wall_f(x, y, z, vi, area, data, p2data, c_stone, c_air, c_amethyst_crystal, 1/201, lastlayer, underforge.stone.defs["gabbro"].base)
      underforge.functions.on_wall_w(x, y, z, vi, area, data, p2data, c_stone, c_air, c_underground_vine, 1/15, lastlayer, underforge.stone.defs["gabbro"].base)      
      underforge.functions.ore(vi, data, underforge.stone.defs["gabbro"].base, c_water, 1/2000)      
   end,
   --Ruby Caves
   [42] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "jasper")
      underforge.functions.on_floor(x, y, z, vi, area, data, c_stone, c_air, c_amanita_muscaria, 1/18, underforge.stone.defs["jasper"].base)            
      underforge.functions.ore(vi, data, underforge.stone.defs["jasper"].base, c_ruby_ore, 1/201)
      underforge.functions.in_floor(x, y, z, vi, area, data, c_air, c_stone, c_ruby_dust, 1/450, underforge.stone.defs["jasper"].base)      
      underforge.functions.on_wall_f(x, y, z, vi, area, data, p2data, c_stone, c_air, c_ruby_crystal, 1/201, lastlayer, underforge.stone.defs["jasper"].base)
      underforge.functions.ore(vi, data, underforge.stone.defs["jasper"].base, c_water, 1/2000)      
   end,
   --Phyllite 2
   [43] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "phyllite")
   end,
   --Chert 2
   [44] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "chert")
   end,
   --Quartz 3
   [45] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "quartzite")
      underforge.functions.ore(vi, data, underforge.stone.defs["quartzite"].base, c_quartz_ore, 1/50)
      underforge.functions.on_wall_f(x, y, z, vi, area, data, p2data, c_stone, c_air, c_quartz_crystal, 1/50, lastlayer, underforge.stone.defs["quartzite"].base)
      underforge.functions.ore(vi, data, underforge.stone.defs["quartzite"].base, c_water, 1/2000)      
   end,
   --Aquamarine & Amethyst
   [46] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "diorite")
      underforge.functions.ore(vi, data, underforge.stone.defs["diorite"].base, c_aquamarine_ore, 1/50)
      underforge.functions.on_wall_f(x, y, z, vi, area, data, p2data, c_stone, c_air, c_aquamarine_crystal, 1/50, lastlayer, underforge.stone.defs["diorite"].base)
      underforge.functions.ore(vi, data, underforge.stone.defs["diorite"].base, c_amethyst_ore, 1/50)
      underforge.functions.on_wall_f(x, y, z, vi, area, data, p2data, c_stone, c_air, c_amethyst_crystal, 1/50, lastlayer, underforge.stone.defs["diorite"].base)
      underforge.functions.ore(vi, data, underforge.stone.defs["diorite"].base, c_water, 1/2000)      
   end,
   --Pegmatite 2
   [47] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "pegmatite")
   end,
   --Lava Jungle
   [48] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "gabbro")
      underforge.functions.ore(vi, data, underforge.stone.defs["gabbro"].base, c_mossy_dirt, 1/100)
      underforge.functions.on_floor(x, y, z, vi, area, data, c_stone, c_air, c_amanita_muscaria, 1/18, underforge.stone.defs["gabbro"].base)
      underforge.functions.on_floor(x, y, z, vi, area, data, c_stone, c_air, c_armillaria_mellea, 1/18, underforge.stone.defs["gabbro"].base)
      underforge.functions.on_wall_w(x, y, z, vi, area, data, p2data, c_stone, c_air, c_underground_vine, 1/15, lastlayer, underforge.stone.defs["gabbro"].base)      
      underforge.functions.ore(vi, data, underforge.stone.defs["gabbro"].base, c_lava, 1/5000)      
   end,
   --Slate 2
   [49] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "slate")
   end,
   --Diamonds
   [50] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "kimberlite")
      underforge.functions.ore(vi, data, underforge.stone.defs["kimberlite"].base, c_diamond_ore, 1/18)
      underforge.functions.ore(vi, data, c_diamond_ore, c_diamond_block, 1/72)
      underforge.functions.ore(vi, data, underforge.stone.defs["kimberlite"].base, c_lava, 1/1000)      
   end,
   --Lava Jungle 2
   [51] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "mica")
      underforge.functions.ore(vi, data, underforge.stone.defs["mica"].base, c_mossy_dirt, 1/100)
      underforge.functions.on_floor(x, y, z, vi, area, data, c_stone, c_air, c_amanita_muscaria, 1/18, underforge.stone.defs["mica"].base)
      underforge.functions.on_floor(x, y, z, vi, area, data, c_stone, c_air, c_armillaria_mellea, 1/18, underforge.stone.defs["mica"].base)
      underforge.functions.on_wall_w(x, y, z, vi, area, data, p2data, c_stone, c_air, c_underground_vine, 1/15, lastlayer, underforge.stone.defs["mica"].base)      
      underforge.functions.ore(vi, data, underforge.stone.defs["mica"].base, c_lava, 1/5000)      
   end,
   --Copper
   [52] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "gneiss")
      underforge.functions.ore(vi, data, underforge.stone.defs["gneiss"].base, c_copper_ore, 1/201)
      underforge.functions.ore(vi, data, underforge.stone.defs["gneiss"].base, c_lava, 1/1000)      
   end,
   --Hot Slate
   [53] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "slate")
      underforge.functions.ore(vi, data, c_obsidian, c_lava, 1/1000)      
   end,
   --Chalk 2
   [54] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "chalk")
   end,
   --Wet Mica
   [55] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "mica")
      underforge.functions.replace(vi, data, c_air, c_water)
   end,
   --Emerald 2
   [56] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "mica")
      underforge.functions.on_floor(x, y, z, vi, area, data, c_stone, c_air, c_mycena_chlorophos, 1/18, underforge.stone.defs["mica"].base)            
      underforge.functions.ore(vi, data, underforge.stone.defs["mica"].base, c_emerald_ore, 1/201)
      underforge.functions.on_wall_f(x, y, z, vi, area, data, p2data, c_stone, c_air, c_emerald_crystal, 1/201, lastlayer, underforge.stone.defs["mica"].base)
   end,
   --Diamonds
   [57] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "kimberlite")
      underforge.functions.ore(vi, data, underforge.stone.defs["kimberlite"].base, c_diamond_ore, 1/18)
      underforge.functions.ore(vi, data, c_diamond_ore, c_diamond_block, 1/72)
      underforge.functions.ore(vi, data, underforge.stone.defs["kimberlite"].base, c_lava, 1/1000)      
   end,
   --Crystal Caves
   [58] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "amphibolite")
      underforge.functions.on_floor(x, y, z, vi, area, data, c_stone, c_air, c_mycena_luxaeterna, 1/30, underforge.stone.defs["amphibolite"].base)            
      underforge.functions.ore(vi, data, underforge.stone.defs["amphibolite"].base, c_sapphire_ore, 1/201)
      underforge.functions.ore(vi, data, underforge.stone.defs["amphibolite"].base, c_amethyst_ore, 1/201)
      underforge.functions.ore(vi, data, underforge.stone.defs["amphibolite"].base, c_quartz_ore_ore, 1/201)
      underforge.functions.ore(vi, data, underforge.stone.defs["amphibolite"].base, c_emerald_ore_ore, 1/201)
      underforge.functions.ore(vi, data, underforge.stone.defs["amphibolite"].base, c_ruby_ore, 1/201)
      underforge.functions.on_wall_f(x, y, z, vi, area, data, p2data, c_stone, c_air, c_sapphire_crystal, 1/201, lastlayer, underforge.stone.defs["gabbro"].base)
      underforge.functions.on_wall_f(x, y, z, vi, area, data, p2data, c_stone, c_air, c_amethyst_crystal, 1/201, lastlayer, underforge.stone.defs["gabbro"].base)
      underforge.functions.on_wall_f(x, y, z, vi, area, data, p2data, c_stone, c_air, c_quartz_crystal_crystal, 1/201, lastlayer, underforge.stone.defs["gabbro"].base)
      underforge.functions.on_wall_f(x, y, z, vi, area, data, p2data, c_stone, c_air, c_emerald_crystal, 1/201, lastlayer, underforge.stone.defs["gabbro"].base)
      underforge.functions.on_wall_f(x, y, z, vi, area, data, p2data, c_stone, c_air, c_ruby_crystal, 1/201, lastlayer, underforge.stone.defs["gabbro"].base)
      underforge.functions.on_wall_w(x, y, z, vi, area, data, p2data, c_stone, c_air, c_underground_vine, 1/15, lastlayer, underforge.stone.defs["gabbro"].base)      
      underforge.functions.ore(vi, data, underforge.stone.defs["amphibolite"].base, c_water, 1/2000)      
   end,
   --Volcanic Granite
   [59] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "granite")
      underforge.functions.ore(vi, data, underforge.stone.defs["granite"].base, c_obsidian, 1/200)      
      underforge.functions.ore(vi, data, underforge.stone.defs["pumice"].base, c_lava, 1/300)      
   end,
   --Lava
   [60] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "pumice")
      underforge.functions.replace(vi, data, c_air, c_lava)      
   end,
   --Volcanic Basalt
   [61] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.use_stone(vi, data, "basalt")
      underforge.functions.ore(vi, data, underforge.stone.defs["basalt"].base, c_obsidian, 1/200)      
      underforge.functions.ore(vi, data, underforge.stone.defs["pumice"].base, c_lava, 1/300)      
   end,
   --Volcanic Tuff
   [62] = function(x, y, z, vi, data, p2data, area, lastlayer)
      underforge.functions.replace(vi, data, c_stone, c_volcanic_tuff)
      underforge.functions.replace(vi, data, c_cobble, c_volcanic_tuff)
      underforge.functions.ore(vi, data, underforge.stone.defs["volcanic_tuff"].base, c_obsidian, 1/100)      
      underforge.functions.ore(vi, data, underforge.stone.defs["pumice"].base, c_lava, 1/300)      
      underforge.functions.replace(vi, data, c_air, c_lava)         
      underforge.use_stone(vi, data, "volcanic_tuff")
   end,
}

local np_darkness = {
   offset = 0,
   scale = 1,
   spread = {x=200, y=200, z=200},
   seed = 6830,
   octaves = 3,
   persist = 0.5
}

local np_water = {
   offset = 0,
   scale = 1,
   spread = {x=200, y=200, z=200},
   seed = 6831,
   octaves = 3,
   persist = 0.5
}

local np_pressure = {
   offset = 0,
   scale = 1,
   spread = {x=200, y=200, z=200},
   seed = 6832,
   octaves = 3,
   persist = 0.5
}

minetest.register_on_generated(function(minp, maxp, seed)

   --easy reference to commonly used values
   --local t1 = os.clock()
   local x1 = maxp.x
   local y1 = maxp.y
   local z1 = maxp.z
   local x0 = minp.x
   local y0 = minp.y
   local z0 = minp.z
      
   local vm, emin, emax = minetest.get_mapgen_object("voxelmanip")
   local area = VoxelArea:new{MinEdge=emin, MaxEdge=emax}
   local data = vm:get_data()
   local p2data = vm:get_param2_data()
      
   --mandatory values
   local sidelen = x1 - x0 + 1 --length of a mapblock
   local chulens = {x=sidelen, y=sidelen, z=sidelen} --table of chunk edges
   local chulens2D = {x=sidelen, y=sidelen, z=1}
   local minposxyz = {x=x0, y=y0, z=z0} --bottom corner
   local minposxz = {x=x0, y=z0} --2D bottom corner
   
   local nvals_darkness = minetest.get_perlin_map(np_darkness, chulens):get3dMap_flat(minposxyz)
   local nvals_water = minetest.get_perlin_map(np_water, chulens):get3dMap_flat(minposxyz)
   local nvals_pressure = minetest.get_perlin_map(np_pressure, chulens):get3dMap_flat(minposxyz)
   
   local nixyz = 1 --3D node index
   local nixz = 1 --2D node index
   local nixyz2 = 1 --second 3D index for second loop
   

   for z = z0, z1 do -- for each xy plane progressing northwards
      --increment indices
      nixyz = nixyz + 1

      for y = y0, y1 do -- for each x row progressing upwards   

         local vi = area:index(x0, y, z)
         for x = x0, x1 do -- for each node do
            
            local darkness = nvals_darkness[nixyz2]
            local water = nvals_water[nixyz2]
            local pressure = underforge.functions.get_pressure(y, nvals_pressure[nixyz2])

            --[[if y > -100 then -- limit the biome variety near surface
               darkness = -0.01*y*darkness - 1 - 0.01*y
               water = -0.01*y*water - 1 - 0.01*y
            end--]]
            local biome = underforge.functions.get_biome(darkness, water, pressure) + 1

            if (biome < 1) or (biome > 62) then
               print(string.format("Wrong biome %i", biome))
               biome = 1
            end

            underforge.biomegen[biome](x, y, z, vi, data, p2data, area, y == y1)

            nixyz2 = nixyz2 + 1
            nixz = nixz + 1
            vi = vi + 1
         end
         nixz = nixz - sidelen --shift the 2D index back
      end
      nixz = nixz + sidelen --shift the 2D index up a layer
   end

   --send data back to voxelmanip
   vm:set_data(data)
   vm:set_param2_data(p2data)
   --calc lighting
   vm:set_lighting({day=0, night=0})
   vm:calc_lighting()
   --write it to world
   vm:write_to_map(data)

   --local chugent = math.ceil((os.clock() - t1) * 1000) --grab how long it took
   --print ("[caverealms] "..chugent.." ms") --tell people how long
end)

And HERE's the new error:
Code: Select all
2020-01-24 21:07:16: WARNING[Main]: Irrlicht: OpenGL driver version is not 1.2 or better.
2020-01-24 21:07:16: WARNING[Main]: Irrlicht: Failed to load OpenGL's multitexture extension, proceeding without.
2020-01-24 21:07:16: WARNING[Main]: Irrlicht: Warning: OpenGL device only has one texture unit. Disabling multitexturing.
2020-01-24 21:07:16: ERROR[Main]: Irrlicht: GL_INVALID_ENUM
2020-01-24 21:07:16: ERROR[Main]: Irrlicht: Could not bind Texture
2020-01-24 21:07:19: ERROR[Main]: ModError: Failed to load and run script from C:\Users\XA-26483\Desktop\MINETEST\minetest-5.1.0-win64\bin\..\mods\underforge_lite\init.lua:
2020-01-24 21:07:19: ERROR[Main]: ...ST\minetest-5.1.0-win64\bin\..\builtin\game\register.lua:207: attempt to index local 'nodedef' (a nil value)
2020-01-24 21:07:19: ERROR[Main]: stack traceback:
2020-01-24 21:07:19: ERROR[Main]:    ...ST\minetest-5.1.0-win64\bin\..\builtin\game\register.lua:207: in function 'register_node'
2020-01-24 21:07:19: ERROR[Main]:    ...est-5.1.0-win64\bin\..\mods\underforge_lite/minerals.lua:28: in main chunk
2020-01-24 21:07:19: ERROR[Main]:    [C]: in function 'dofile'
2020-01-24 21:07:19: ERROR[Main]:    ...inetest-5.1.0-win64\bin\..\mods\underforge_lite\init.lua:19: in main chunk
2020-01-24 21:07:19: ERROR[Main]: Check debug.txt for details.
2020-01-24 21:07:19: ACTION[Main]: Server: Shutting down
2020-01-24 21:07:27: ERROR[Main]: Please choose a name!

I think that its telling me that I seriously screwed or mislabeled something, because the nodes arent being registered with minetest. Did I goof when I changed it from 'local register_node' to minetest.register_node? (changing it back to local register_node gives a syntax error)
 

User avatar
Nathan.S
Member
 
Posts: 973
Joined: Wed Sep 24, 2014 17:47
Location: Bigsby Texas
GitHub: NathanSalapat
IRC: NathanS21
In-game: NathanS21

Re: Noob here, needing help setting up data tables

by Nathan.S » Sat Jan 25, 2020 03:30

Do you have the code online someplace?

Is all the code in one file, or do you have it broken into multiple files? Sometimes Minetest will complain if you call specific code in a mod before defining it. My guess is the error about 'nodef' is in your minetest.get_content_id lines being called before those nodes are being defined.
I record Minetest videos, Mod reviews, Modding tutorials, and Lets plays.
Check out my website, and brand new Minetest Modding Course
 

Winter94
Member
 
Posts: 43
Joined: Sat Jan 11, 2020 17:15
In-game: Azrael Winter WintersKnight
 

User avatar
Nathan.S
Member
 
Posts: 973
Joined: Wed Sep 24, 2014 17:47
Location: Bigsby Texas
GitHub: NathanSalapat
IRC: NathanS21
In-game: NathanS21

Re: Noob here, needing help setting up data tables

by Nathan.S » Sat Jan 25, 2020 05:18

minerals.lua lines 28, and 45 should not have the closing parenthesis, that should be on lines 34, and 49 after the closing curly brace.

register_ore doesn't use a name like you have in line 36 it should look like this.
Code: Select all
minetest.register_ore({
   ore_type      = "scatter",
   ore            = "underforge:"..name.."_in_"..strata,
   wherein         = "underforge:"..strata,
   clust_scarcity   = {rarity},
   clust_size      = 5,
   clust_num_ores   = 10,
})


Line 46 shouldn't have the 'S(' surrounding the description, that's only needed when you're providing translations, and it doesn't look like you are.

Fix those errors and the mod should load. :)
I record Minetest videos, Mod reviews, Modding tutorials, and Lets plays.
Check out my website, and brand new Minetest Modding Course
 

Winter94
Member
 
Posts: 43
Joined: Sat Jan 11, 2020 17:15
In-game: Azrael Winter WintersKnight

Re: Noob here, needing help setting up data tables

by Winter94 » Sat Jan 25, 2020 15:06

its now giving an error that its trying to perform arithmetic on a string.This
tiles = strata..".png"^"ore_"..name..".png",
is where the problem is. its registering the hat(the up arrow "^") as a mathematical symbol(i think its the symbol for declaring an exponent). How do I make it register the texture overlay properly?
 

Winter94
Member
 
Posts: 43
Joined: Sat Jan 11, 2020 17:15
In-game: Azrael Winter WintersKnight
 

User avatar
Nathan.S
Member
 
Posts: 973
Joined: Wed Sep 24, 2014 17:47
Location: Bigsby Texas
GitHub: NathanSalapat
IRC: NathanS21
In-game: NathanS21

Re: Noob here, needing help setting up data tables

by Nathan.S » Sat Jan 25, 2020 17:27

You need to enclose the entire texture string within quotes, so it should look like this.
Code: Select all
tiles   = '"strata..".png"^"ore_"..name..".png"',
I record Minetest videos, Mod reviews, Modding tutorials, and Lets plays.
Check out my website, and brand new Minetest Modding Course
 

Winter94
Member
 
Posts: 43
Joined: Sat Jan 11, 2020 17:15
In-game: Azrael Winter WintersKnight

Re: Noob here, needing help setting up data tables

by Winter94 » Sat Jan 25, 2020 17:52

when I did that, it gave me this error:
Code: Select all
2020-01-25 11:50:12: WARNING[Main]: Irrlicht: OpenGL driver version is not 1.2 or better.
2020-01-25 11:50:12: WARNING[Main]: Irrlicht: Failed to load OpenGL's multitexture extension, proceeding without.
2020-01-25 11:50:12: WARNING[Main]: Irrlicht: Warning: OpenGL device only has one texture unit. Disabling multitexturing.
2020-01-25 11:50:12: ERROR[Main]: Irrlicht: GL_INVALID_ENUM
2020-01-25 11:50:12: ERROR[Main]: Irrlicht: Could not bind Texture
2020-01-25 11:50:29: ERROR[Main]: ModError: Failed to load and run script from C:\Users\XA-26483\Desktop\MINETEST\minetest-5.1.0-win64\bin\..\mods\underforge_lite\init.lua:
2020-01-25 11:50:29: ERROR[Main]: ...ST\minetest-5.1.0-win64\bin\..\builtin\game\register.lua:504: bad argument #1 to 'orig_reg_fn' (table expected, got string)
2020-01-25 11:50:29: ERROR[Main]: stack traceback:
2020-01-25 11:50:29: ERROR[Main]:    [C]: in function 'orig_reg_fn'
2020-01-25 11:50:29: ERROR[Main]:    ...ST\minetest-5.1.0-win64\bin\..\builtin\game\register.lua:504: in function 'register_ore'
2020-01-25 11:50:29: ERROR[Main]:    ...est-5.1.0-win64\bin\..\mods\underforge_lite/minerals.lua:38: in main chunk
2020-01-25 11:50:29: ERROR[Main]:    [C]: in function 'dofile'
2020-01-25 11:50:29: ERROR[Main]:    ...inetest-5.1.0-win64\bin\..\mods\underforge_lite\init.lua:19: in main chunk
2020-01-25 11:50:29: ERROR[Main]: Check debug.txt for details.
2020-01-25 11:50:29: ACTION[Main]: Server: Shutting down
2020-01-25 11:50:46: ERROR[Main]: Please choose a name!
 

User avatar
Nathan.S
Member
 
Posts: 973
Joined: Wed Sep 24, 2014 17:47
Location: Bigsby Texas
GitHub: NathanSalapat
IRC: NathanS21
In-game: NathanS21

Re: Noob here, needing help setting up data tables

by Nathan.S » Sat Jan 25, 2020 18:55

Looks like you forgot to fix the minetest.register_ore portion of the code.
I record Minetest videos, Mod reviews, Modding tutorials, and Lets plays.
Check out my website, and brand new Minetest Modding Course
 

Winter94
Member
 
Posts: 43
Joined: Sat Jan 11, 2020 17:15
In-game: Azrael Winter WintersKnight

Re: Noob here, needing help setting up data tables

by Winter94 » Sat Jan 25, 2020 19:07

can you point it out? I thought I had fixed it already... :(
 

User avatar
Nathan.S
Member
 
Posts: 973
Joined: Wed Sep 24, 2014 17:47
Location: Bigsby Texas
GitHub: NathanSalapat
IRC: NathanS21
In-game: NathanS21

Re: Noob here, needing help setting up data tables

by Nathan.S » Sat Jan 25, 2020 19:37

in minerals.lua

Code: Select all
   minetest.register_ore({
      ore_type      = "scatter",
      ore            = "underforge:"..name.."_in_"..strata,
      wherein         = "underforge:"..strata,
      clust_scarcity   = {rarity},
      clust_size      = 5,
      clust_num_ores   = 10,
   })


This is what you should have, you don't put a name in the first line like you do for registering nodes and craftitems.
I record Minetest videos, Mod reviews, Modding tutorials, and Lets plays.
Check out my website, and brand new Minetest Modding Course
 

Winter94
Member
 
Posts: 43
Joined: Sat Jan 11, 2020 17:15
In-game: Azrael Winter WintersKnight

Re: Noob here, needing help setting up data tables

by Winter94 » Sat Jan 25, 2020 20:37

ok, fixed that, and its running instead of erroring out, but my textures arent loading, and now for some strange reason I have pockets of default stone generating which before i had never seen.
 

User avatar
Nathan.S
Member
 
Posts: 973
Joined: Wed Sep 24, 2014 17:47
Location: Bigsby Texas
GitHub: NathanSalapat
IRC: NathanS21
In-game: NathanS21

Re: Noob here, needing help setting up data tables

by Nathan.S » Sat Jan 25, 2020 20:42

Take a look in creative inventory to see if you have the textures assigned correctly. Any textures that don't exist will just show as solid colors and minetest will give you error about the texture not existing, you can then look for typos in the texture names. The pockets of stone has to be mapgen related, but I don't know too much about mapgen so I can't help with that.
I record Minetest videos, Mod reviews, Modding tutorials, and Lets plays.
Check out my website, and brand new Minetest Modding Course
 

Winter94
Member
 
Posts: 43
Joined: Sat Jan 11, 2020 17:15
In-game: Azrael Winter WintersKnight

Re: Noob here, needing help setting up data tables

by Winter94 » Sun Jan 26, 2020 14:01

I think I figured out what the issue with pockets of default stone was, I havent seen it happen again, anyway.
The textures should be assigned correctly, I checked the textures folder and the code, and it matches, but when i look in creative inventory, it shows my ores as having words saying NOTEXTURE
EDIT: I was missing a set of brackets and one instance of "underforge_", now fixed, textures finally displaying properly.
unfortunately, now I have an issue with my worldgen not being able to tell what its generating, or somesuch nonsense.
But I think thats a post for a different thread.
Thank you all for your help.
 


Return to Modding Discussion



Who is online

Users browsing this forum: No registered users and 1 guest