centralize node id lookups, add stub translations

This commit is contained in:
FaceDeer 2020-11-15 15:25:05 -07:00
parent b31618e5b0
commit 212b88b227
14 changed files with 208 additions and 136 deletions

View File

@ -6,6 +6,8 @@ local modpath = minetest.get_modpath(minetest.get_current_modname())
--load companion lua files
dofile(modpath.."/config.lua")
dofile(modpath.."/node_ids.lua")
dofile(modpath.."/shared.lua")
dofile(modpath.."/surface_tunnels.lua")
dofile(modpath.."/level1.lua")

View File

@ -2,12 +2,12 @@ if not df_caverns.config.enable_lava_sea then
return
end
local c_air = minetest.get_content_id("air")
local c_lava = minetest.get_content_id("default:lava_source")
local c_meseore = minetest.get_content_id("default:stone_with_mese")
local c_mese_crystal = minetest.get_content_id("df_mapitems:mese_crystal")
local c_mese_crystal_block = minetest.get_content_id("df_mapitems:glow_mese")
local c_obsidian = minetest.get_content_id("default:obsidian")
local c_air = df_caverns.node_id.air
local c_lava = df_caverns.node_id.lava
local c_meseore = df_caverns.node_id.meseore
local c_mese_crystal = df_caverns.node_id.mese_crystal
local c_mese_crystal_block = df_caverns.node_id.mese_crystal_block
local c_obsidian = df_caverns.node_id.obsidian
-------------------------------------------------------------------------------------------

View File

@ -1,13 +1,11 @@
local c_water = minetest.get_content_id("default:water_source")
local c_air = minetest.get_content_id("air")
local c_dirt = minetest.get_content_id("default:dirt")
local c_dirt_moss = minetest.get_content_id("df_mapitems:dirt_with_cave_moss")
local c_gravel = minetest.get_content_id("default:gravel")
local c_wet_flowstone = minetest.get_content_id("df_mapitems:wet_flowstone")
local c_dry_flowstone = minetest.get_content_id("df_mapitems:dry_flowstone")
local c_spindlestem_white = minetest.get_content_id("df_trees:spindlestem_cap_white")
local c_water = df_caverns.node_id.water
local c_air = df_caverns.node_id.air
local c_dirt = df_caverns.node_id.dirt
local c_dirt_moss = df_caverns.node_id.dirt_moss
local c_gravel = df_caverns.node_id.gravel
local c_wet_flowstone = df_caverns.node_id.wet_flowstone
local c_dry_flowstone = df_caverns.node_id.dry_flowstone
local c_spindlestem_white = df_caverns.node_id.spindlestem_white
local tower_cap_shrublist
local fungiwood_shrublist

View File

@ -1,16 +1,19 @@
local c_water = minetest.get_content_id("default:water_source")
local c_air = minetest.get_content_id("air")
local c_dirt = minetest.get_content_id("default:dirt")
local c_dirt_moss = minetest.get_content_id("df_mapitems:dirt_with_cave_moss")
local c_gravel = minetest.get_content_id("default:gravel")
local c_water = df_caverns.node_id.water
local c_air = df_caverns.node_id.air
local c_dirt = df_caverns.node_id.dirt
local c_dirt_moss = df_caverns.node_id.dirt_moss
local c_gravel = df_caverns.node_id.gravel
local c_stillworm = minetest.get_content_id("df_mapitems:dirt_with_stillworm")
local c_pebble_fungus = minetest.get_content_id("df_mapitems:dirt_with_pebble_fungus")
local c_stillworm = df_caverns.node_id.stillworm
local c_pebble_fungus = df_caverns.node_id.pebble_fungus
local c_red = df_caverns.node_id.spindlestem_red
local c_wet_flowstone = minetest.get_content_id("df_mapitems:wet_flowstone")
local c_dry_flowstone = minetest.get_content_id("df_mapitems:dry_flowstone")
local c_wet_flowstone = df_caverns.node_id.wet_flowstone
local c_dry_flowstone = df_caverns.node_id.dry_flowstone
local c_veinstone = df_caverns.node_id.veinstone
local c_pearls = df_caverns.node_id.pearls
local c_veinstone = minetest.get_content_id("df_mapitems:veinstone")
local wall_vein_perlin_params = {
offset = 0,
scale = 1,
@ -22,8 +25,6 @@ local wall_vein_perlin_params = {
flags = "eased",
}
local c_pearls = minetest.get_content_id("df_mapitems:cave_pearls")
local subsea_level = df_caverns.config.level2_min - (df_caverns.config.level2_min - df_caverns.config.level1_min) * 0.33 -- "sea level" for the flooded caverns.
local flooding_threshold = math.min(df_caverns.config.tunnel_flooding_threshold, df_caverns.config.cavern_threshold) -- cavern value out to which we're flooding tunnels and warrens
@ -66,8 +67,6 @@ if minetest.get_modpath("df_farming") then
}
end
local c_red = minetest.get_content_id("df_trees:spindlestem_cap_red")
local goblin_cap_cavern_floor = function(abs_cracks, vert_rand, vi, area, data, data_param2)
local ystride = area.ystride
if abs_cracks < 0.1 then

View File

@ -1,32 +1,22 @@
local c_water = minetest.get_content_id("default:water_source")
local c_air = minetest.get_content_id("air")
local c_desert_sand = minetest.get_content_id("default:desert_sand")
local c_stone_with_coal = minetest.get_content_id("default:stone_with_coal")
local c_silver_sand = minetest.get_content_id("default:silver_sand")
local c_snow = minetest.get_content_id("default:snow")
local c_ice = minetest.get_content_id("default:ice")
local c_hoar_moss = minetest.get_content_id("df_mapitems:ice_with_hoar_moss")
local c_gravel = minetest.get_content_id("default:gravel")
local c_oil = minetest.get_content_id("oil:oil_source")
local c_cobble_fungus_fine = minetest.get_content_id("df_mapitems:cobble_with_floor_fungus_fine")
local c_cobble_fungus = minetest.get_content_id("df_mapitems:cobble_with_floor_fungus")
local c_cobble = minetest.get_content_id("default:cobble")
local c_wet_flowstone = minetest.get_content_id("df_mapitems:wet_flowstone")
local c_dry_flowstone = minetest.get_content_id("df_mapitems:dry_flowstone")
local c_glow_ore = minetest.get_content_id("df_mapitems:glow_ruby_ore")
local c_salty_cobble = minetest.get_content_id("df_mapitems:salty_cobble")
local c_salt_crystal = minetest.get_content_id("df_mapitems:salt_crystal")
local c_sprite
if minetest.get_modpath("ice_sprites") then
c_sprite = minetest.get_content_id("ice_sprites:ice_sprite")
end
local c_water = df_caverns.node_id.water
local c_air = df_caverns.node_id.air
local c_desert_sand = df_caverns.node_id.desert_sand
local c_stone_with_coal = df_caverns.node_id.stone_with_coal
local c_silver_sand = df_caverns.node_id.silver_sand
local c_snow = df_caverns.node_id.snow
local c_ice = df_caverns.node_id.ice
local c_hoar_moss = df_caverns.node_id.hoar_moss
local c_gravel = df_caverns.node_id.gravel
local c_oil = df_caverns.node_id.oil
local c_cobble_fungus_fine = df_caverns.node_id.cobble_fungus_fine
local c_cobble_fungus = df_caverns.node_id.cobble_fungus
local c_cobble = df_caverns.node_id.cobble
local c_wet_flowstone = df_caverns.node_id.wet_flowstone
local c_dry_flowstone = df_caverns.node_id.dry_flowstone
local c_glow_ore = df_caverns.node_id.glow_ore
local c_salty_cobble = df_caverns.node_id.salty_cobble
local c_salt_crystal = df_caverns.node_id.salt_crystal
local c_sprite = df_caverns.node_id.sprite
local subsea_level = math.floor(df_caverns.config.level3_min - (df_caverns.config.level3_min - df_caverns.config.level2_min) * 0.33)
local flooding_threshold = math.min(df_caverns.config.tunnel_flooding_threshold, df_caverns.config.cavern_threshold)

View File

@ -0,0 +1,11 @@
# textdomain: df_caverns
### underworld.lua ###
#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
A glowing pit=Eine leuchtende Grube
#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
Ancient ruin=Alte Ruine
#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
Mysterious seal=Geheimnisvolles Siegel

View File

@ -0,0 +1,11 @@
# textdomain: df_caverns
### underworld.lua ###
#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
A glowing pit=Un pozzo luminoso
#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
Ancient ruin=Antica rovina
#WARNING: AUTOTRANSLATED BY GOOGLE TRANSLATE
Mysterious seal=Sigillo misterioso

73
df_caverns/node_ids.lua Normal file
View File

@ -0,0 +1,73 @@
df_caverns.node_id = {}
minetest.after(1, function() df_caverns.node_id = nil end) -- should only be used during initialization.
if minetest.get_modpath("ice_sprites") then
df_caverns.node_id.sprite = minetest.get_content_id("ice_sprites:ice_sprite")
end
if minetest.get_modpath("fireflies") then
df_caverns.node_id.fireflies = minetest.get_content_id("fireflies:firefly")
end
if minetest.get_modpath("df_farming") then
df_caverns.node_id.dead_fungus = minetest.get_content_id("df_farming:dead_fungus")
end
df_caverns.node_id.air = minetest.get_content_id("air")
df_caverns.node_id.cobble = minetest.get_content_id("default:cobble")
df_caverns.node_id.desert_sand = minetest.get_content_id("default:desert_sand")
df_caverns.node_id.dirt = minetest.get_content_id("default:dirt")
df_caverns.node_id.gravel = minetest.get_content_id("default:gravel")
df_caverns.node_id.ice = minetest.get_content_id("default:ice")
df_caverns.node_id.lava = minetest.get_content_id("default:lava_source")
df_caverns.node_id.meseore = minetest.get_content_id("default:stone_with_mese")
df_caverns.node_id.mossycobble = minetest.get_content_id("default:mossycobble")
df_caverns.node_id.obsidian = minetest.get_content_id("default:obsidian")
df_caverns.node_id.sand = minetest.get_content_id("default:sand")
df_caverns.node_id.silver_sand = minetest.get_content_id("default:silver_sand")
df_caverns.node_id.snow = minetest.get_content_id("default:snow")
df_caverns.node_id.stone = minetest.get_content_id("default:stone")
df_caverns.node_id.stone_with_coal = minetest.get_content_id("default:stone_with_coal")
df_caverns.node_id.water = minetest.get_content_id("default:water_source")
df_caverns.node_id.cobble_fungus = minetest.get_content_id("df_mapitems:cobble_with_floor_fungus")
df_caverns.node_id.cobble_fungus_fine = minetest.get_content_id("df_mapitems:cobble_with_floor_fungus_fine")
df_caverns.node_id.dirt_moss = minetest.get_content_id("df_mapitems:dirt_with_cave_moss")
df_caverns.node_id.dry_flowstone = minetest.get_content_id("df_mapitems:dry_flowstone")
df_caverns.node_id.glow_ore = minetest.get_content_id("df_mapitems:glow_ruby_ore")
df_caverns.node_id.hoar_moss = minetest.get_content_id("df_mapitems:ice_with_hoar_moss")
df_caverns.node_id.mese_crystal = minetest.get_content_id("df_mapitems:mese_crystal")
df_caverns.node_id.mese_crystal_block = minetest.get_content_id("df_mapitems:glow_mese")
df_caverns.node_id.pearls = minetest.get_content_id("df_mapitems:cave_pearls")
df_caverns.node_id.pebble_fungus = minetest.get_content_id("df_mapitems:dirt_with_pebble_fungus")
df_caverns.node_id.salt_crystal = minetest.get_content_id("df_mapitems:salt_crystal")
df_caverns.node_id.salty_cobble = minetest.get_content_id("df_mapitems:salty_cobble")
df_caverns.node_id.stillworm = minetest.get_content_id("df_mapitems:dirt_with_stillworm")
df_caverns.node_id.veinstone = minetest.get_content_id("df_mapitems:veinstone")
df_caverns.node_id.wet_flowstone = minetest.get_content_id("df_mapitems:wet_flowstone")
df_caverns.node_id.spindlestem_red = minetest.get_content_id("df_trees:spindlestem_cap_red")
df_caverns.node_id.spindlestem_white = minetest.get_content_id("df_trees:spindlestem_cap_white")
df_caverns.node_id.amethyst = minetest.get_content_id("df_underworld_items:glow_amethyst")
df_caverns.node_id.glowstone = minetest.get_content_id("df_underworld_items:glowstone")
df_caverns.node_id.pit_plasma = minetest.get_content_id("df_underworld_items:pit_plasma")
df_caverns.node_id.slade = minetest.get_content_id("df_underworld_items:slade")
df_caverns.node_id.slade_block = minetest.get_content_id("df_underworld_items:slade_block")
df_caverns.node_id.oil = minetest.get_content_id("oil:oil_source")
df_caverns.node_id.gas = minetest.get_content_id("mine_gas:gas")
df_caverns.node_id.gas_wisp = minetest.get_content_id("mine_gas:gas_wisp")
df_caverns.node_id.giant_mycelium = minetest.get_content_id("df_primordial_items:giant_hypha_apical_mapgen")
df_caverns.node_id.ivy = minetest.get_content_id("df_primordial_items:jungle_ivy")
df_caverns.node_id.jungle_dirt = minetest.get_content_id("df_primordial_items:dirt_with_jungle_grass")
df_caverns.node_id.mycelial_dirt = minetest.get_content_id("df_primordial_items:dirt_with_mycelium")
df_caverns.node_id.orb = minetest.get_content_id("df_primordial_items:glow_orb_hanging")
df_caverns.node_id.packed_roots = minetest.get_content_id("df_primordial_items:packed_roots")
df_caverns.node_id.plant_matter = minetest.get_content_id("df_primordial_items:plant_matter")
df_caverns.node_id.root_1 = minetest.get_content_id("df_primordial_items:jungle_roots_1")
df_caverns.node_id.root_2 = minetest.get_content_id("df_primordial_items:jungle_roots_2")

View File

@ -2,11 +2,11 @@ if not df_caverns.config.enable_oil_sea then
return
end
local c_oil = minetest.get_content_id("oil:oil_source")
local c_gas = minetest.get_content_id("mine_gas:gas")
local c_gas_wisp = minetest.get_content_id("mine_gas:gas_wisp")
local c_lava = minetest.get_content_id("default:lava_source")
local c_obsidian = minetest.get_content_id("default:obsidian")
local c_oil = df_caverns.node_id.oil
local c_gas = df_caverns.node_id.gas
local c_gas_wisp = df_caverns.node_id.gas_wisp
local c_lava = df_caverns.node_id.lava
local c_obsidian = df_caverns.node_id.obsidian
-------------------------------------------------------------------------------------------

View File

@ -2,6 +2,8 @@ if not df_caverns.config.enable_primordial or not minetest.get_modpath("df_primo
return
end
local c_air = df_caverns.node_id.air
local perlin_cave_primordial = {
offset = 0,
scale = 1,
@ -20,25 +22,15 @@ local perlin_wave_primordial = {
persist = 0.63
}
local c_air = minetest.get_content_id("air")
local giant_mycelium_timer_spread = tonumber(minetest.settings:get("dcaverns_giant_mycelium_timer_spread")) or 10
-----------------------------------------------------------------------------------------
-- Fungal biome
local c_orb = minetest.get_content_id("df_primordial_items:glow_orb_hanging")
local c_mycelial_dirt = minetest.get_content_id("df_primordial_items:dirt_with_mycelium")
local c_dirt = minetest.get_content_id("default:dirt")
local c_giant_mycelium = minetest.get_content_id("df_primordial_items:giant_hypha_apical_mapgen")
local fungal_plants = {
minetest.get_content_id("df_primordial_items:fungal_grass_1"),
minetest.get_content_id("df_primordial_items:fungal_grass_2"),
minetest.get_content_id("df_primordial_items:glow_orb"),
minetest.get_content_id("df_primordial_items:glow_orb_stalks"),
minetest.get_content_id("df_primordial_items:glow_pods"),
}
local c_orb = df_caverns.node_id.orb
local c_mycelial_dirt = df_caverns.node_id.mycelial_dirt
local c_dirt = df_caverns.node_id.dirt
local c_giant_mycelium = df_caverns.node_id.giant_mycelium
local fungal_plant_names = {}
local fungal_plants = {}
@ -145,18 +137,14 @@ for node_name, node_def in pairs(minetest.registered_nodes) do
end
end
local c_jungle_dirt = minetest.get_content_id("df_primordial_items:dirt_with_jungle_grass")
local c_plant_matter = minetest.get_content_id("df_primordial_items:plant_matter")
local c_packed_roots = minetest.get_content_id("df_primordial_items:packed_roots")
local c_glowstone = minetest.get_content_id("df_underworld_items:glowstone")
local c_ivy = minetest.get_content_id("df_primordial_items:jungle_ivy")
local c_root_2 = minetest.get_content_id("df_primordial_items:jungle_roots_2")
local c_root_1 = minetest.get_content_id("df_primordial_items:jungle_roots_1")
local c_fireflies
if minetest.get_modpath("fireflies") then
c_fireflies = minetest.get_content_id("fireflies:firefly")
end
local c_jungle_dirt = df_caverns.node_id.jungle_dirt
local c_plant_matter = df_caverns.node_id.plant_matter
local c_packed_roots = df_caverns.node_id.packed_roots
local c_glowstone = df_caverns.node_id.glowstone
local c_ivy = df_caverns.node_id.ivy
local c_root_2 = df_caverns.node_id.root_2
local c_root_1 = df_caverns.node_id.root_1
local c_fireflies = df_caverns.node_id.fireflies
local jungle_cavern_floor = function(abs_cracks, humidity, vi, area, data, data_param2)
local ystride = area.ystride

View File

@ -1,17 +1,20 @@
-- This file contains code that is used by multiple different cavern layers.
local c_water = minetest.get_content_id("default:water_source")
local c_air = minetest.get_content_id("air")
local c_dirt = minetest.get_content_id("default:dirt")
local c_dirt_moss = minetest.get_content_id("df_mapitems:dirt_with_cave_moss")
local c_cobble_fungus = minetest.get_content_id("df_mapitems:cobble_with_floor_fungus")
local c_cobble_fungus_fine = minetest.get_content_id("df_mapitems:cobble_with_floor_fungus_fine")
local c_cobble = minetest.get_content_id("default:cobble")
local c_mossycobble = minetest.get_content_id("default:mossycobble")
local c_wet_flowstone = minetest.get_content_id("df_mapitems:wet_flowstone")
local c_dry_flowstone = minetest.get_content_id("df_mapitems:dry_flowstone")
local c_air = df_caverns.node_id.air
local c_cobble = df_caverns.node_id.cobble
local c_cobble_fungus = df_caverns.node_id.cobble_fungus
local c_cobble_fungus_fine = df_caverns.node_id.cobble_fungus_fine
local c_dead_fungus = df_caverns.node_id.dead_fungus
local c_dirt = df_caverns.node_id.dirt
local c_dirt_moss = df_caverns.node_id.dirt_moss
local c_dry_flowstone = df_caverns.node_id.dry_flowstone
local c_fireflies = df_caverns.node_id.fireflies
local c_glowstone = df_caverns.node_id.glowstone
local c_ice = df_caverns.node_id.ice
local c_mossycobble = df_caverns.node_id.mossycobble
local c_oil = df_caverns.node_id.oil
local c_water = df_caverns.node_id.water
local c_wet_flowstone = df_caverns.node_id.wet_flowstone
df_caverns.data_param2 = {}
@ -72,11 +75,6 @@ df_caverns.flooded_cavern_floor = function(abs_cracks, vert_rand, vi, area, data
end
end
local c_dead_fungus
if minetest.get_modpath("df_farming") then
c_dead_fungus = minetest.get_content_id("df_farming:dead_fungus")
end
df_caverns.dry_cavern_floor = function(abs_cracks, vert_rand, vi, area, data, data_param2)
if abs_cracks < 0.075 then
df_caverns.stalagmites(abs_cracks, vert_rand, vi, area, data, data_param2, false)
@ -229,6 +227,7 @@ local dfcaverns_mods = {
"ice_sprites:",
"mine_gas:",
}
df_caverns.is_ground_content = function(c_node)
if dfcaverns_nodes then
return not dfcaverns_nodes[c_node]
@ -241,12 +240,12 @@ df_caverns.is_ground_content = function(c_node)
end
end
end
dfcaverns_nodes[minetest.get_content_id("default:ice")] = true -- needed for nethercap cavern water covering
dfcaverns_nodes[minetest.get_content_id("oil:oil_source")] = true -- needed for blackcap oil slicks
if minetest.get_modpath("fireflies") then
dfcaverns_nodes[minetest.get_content_id("fireflies:firefly")] = true -- used in the primordial caverns
dfcaverns_nodes[c_ice] = true -- needed for nethercap cavern water covering
dfcaverns_nodes[c_oil] = true -- needed for blackcap oil slicks
if c_fireflies then
dfcaverns_nodes[c_fireflies] = true -- used in the primordial caverns
end
dfcaverns_nodes[minetest.get_content_id("df_underworld_items:glowstone")] = nil
dfcaverns_nodes[c_glowstone] = nil
dfcaverns_mods = nil
return not dfcaverns_nodes[c_node]
end

View File

@ -1,19 +1,20 @@
local c_water = minetest.get_content_id("default:water_source")
local c_air = minetest.get_content_id("air")
local c_dirt = minetest.get_content_id("default:dirt")
local c_dirt_moss = minetest.get_content_id("df_mapitems:dirt_with_cave_moss")
local c_sand = minetest.get_content_id("default:sand")
local c_gravel = minetest.get_content_id("default:gravel")
local c_wet_flowstone = minetest.get_content_id("df_mapitems:wet_flowstone")
local c_dry_flowstone = minetest.get_content_id("df_mapitems:dry_flowstone")
local c_lava = minetest.get_content_id("default:lava_source")
local c_obsidian = minetest.get_content_id("default:obsidian")
local c_water = df_caverns.node_id.water
local c_air = df_caverns.node_id.air
local c_dirt = df_caverns.node_id.dirt
local c_dirt_moss = df_caverns.node_id.dirt_moss
local c_sand = df_caverns.node_id.sand
local c_gravel = df_caverns.node_id.gravel
local c_wet_flowstone = df_caverns.node_id.wet_flowstone
local c_dry_flowstone = df_caverns.node_id.dry_flowstone
local c_lava = df_caverns.node_id.lava
local c_obsidian = df_caverns.node_id.obsidian
local c_coral_table = {
minetest.get_content_id("df_mapitems:cave_coral_1"),
minetest.get_content_id("df_mapitems:cave_coral_2"),
minetest.get_content_id("df_mapitems:cave_coral_3")
}
local c_coral_table = {}
for node_name, node_def in pairs(minetest.registered_nodes) do
if minetest.get_item_group(node_name, "dfcaverns_cave_coral") > 0 then
table.insert(c_coral_table, minetest.get_content_id(node_name))
end
end
local mushroom_shrublist
local fungispore_shrublist

View File

@ -3,8 +3,8 @@
local y_max = 200
local y_min = df_caverns.config.ymax
local c_stone = minetest.get_content_id("default:stone")
local c_air = minetest.get_content_id("air")
local c_stone = df_caverns.node_id.stone
local c_air = df_caverns.node_id.air
minetest.register_on_generated(function(minp, maxp, seed)
--if out of range of cave definition limits, abort

View File

@ -77,14 +77,14 @@ end
local c_slade = minetest.get_content_id("df_underworld_items:slade")
local c_slade_block = minetest.get_content_id("df_underworld_items:slade_block")
local c_air = minetest.get_content_id("air")
local c_water = minetest.get_content_id("default:water_source")
local c_slade = df_caverns.node_id.slade
local c_slade_block = df_caverns.node_id.slade_block
local c_air = df_caverns.node_id.air
local c_water = df_caverns.node_id.water
local c_glowstone = minetest.get_content_id("df_underworld_items:glowstone")
local c_amethyst = minetest.get_content_id("df_underworld_items:glow_amethyst")
local c_pit_plasma = minetest.get_content_id("df_underworld_items:pit_plasma")
local c_glowstone = df_caverns.node_id.glowstone
local c_amethyst = df_caverns.node_id.amethyst
local c_pit_plasma = df_caverns.node_id.pit_plasma
local MP = minetest.get_modpath(minetest.get_current_modname())
local oubliette_schematic = dofile(MP.."/schematics/oubliette.lua")