mirror of
https://github.com/FaceDeer/dfcaverns.git
synced 2024-12-25 02:10:37 +01:00
enable ores in MCL2, fix some undeclared globals, fix icecap growth in MCL (achievements are a good debugging tool)
This commit is contained in:
parent
b593e3935c
commit
e7d8b3ba42
@ -66,7 +66,7 @@ minetest.register_on_placenode(function(pos, newnode, placer, oldnode, itemstack
|
||||
local achievement = plant_node_achievements[newnode.name]
|
||||
if not achievement then return end
|
||||
local achievement_name = achievement.achievement
|
||||
if not player_awards or player_awards.unlocked[achievement_name] ~= achievement_name then
|
||||
if not player_awards.unlocked or player_awards.unlocked[achievement_name] ~= achievement_name then
|
||||
-- all of the growable plants in DFCaverns are timer-based. If you place
|
||||
-- a seedling or seed and the resulting node has a timer running, then
|
||||
-- it's passed the checks to see if it was placed in a growable area.
|
||||
|
@ -10,6 +10,9 @@ df_achievements = {}
|
||||
|
||||
local old_awards_version = false
|
||||
if awards.run_trigger_callbacks then
|
||||
-- older versions of awards crash when attempting to use newer versions of triggers
|
||||
-- this "run_trigger_callbacks" API call is present in those older versions, so using that
|
||||
-- as a fingerprint to discover them
|
||||
old_awards_version = true
|
||||
else
|
||||
-- used to track the progress of achievements that are based off of other achievements
|
||||
@ -37,6 +40,8 @@ awards.register_achievement = function(achievement_name, achievement_def, ...)
|
||||
achievement_def.trigger = nil
|
||||
end
|
||||
|
||||
-- The achievement being registered has "parent" achievements that progress when it is unlocked,
|
||||
-- track that here
|
||||
if achievement_def._dfcaverns_achievements then
|
||||
for _, parent_achievement in pairs(achievement_def._dfcaverns_achievements) do
|
||||
local parent_source_list = achievement_parents[parent_achievement] or {}
|
||||
|
@ -59,18 +59,22 @@ minetest.register_globalstep(function(dtime)
|
||||
|
||||
local player_name
|
||||
local player_awards
|
||||
local unlocked
|
||||
local player_data
|
||||
local biome
|
||||
local totals
|
||||
|
||||
-- loop through players
|
||||
for _, player in pairs(minetest.get_connected_players()) do
|
||||
player_name = player:get_player_name()
|
||||
player_awards = awards.player(player_name)
|
||||
if player_awards.unlocked["dfcaverns_visit_all_caverns"] ~= "dfcaverns_visit_all_caverns" or
|
||||
player_awards.unlocked["dfcaverns_visit_glowing_pit"] ~= "dfcaverns_visit_glowing_pit" then
|
||||
unlocked = player_awards.unlocked or {}
|
||||
|
||||
if unlocked["dfcaverns_visit_all_caverns"] ~= "dfcaverns_visit_all_caverns" or
|
||||
unlocked["dfcaverns_visit_glowing_pit"] ~= "dfcaverns_visit_glowing_pit" then
|
||||
player_data = get_player_data(player)
|
||||
biome = player_data.biome
|
||||
totals = player_data.totals
|
||||
|
||||
if biome == "towercap" and check_nodes(node_types.towercap, totals) then
|
||||
awards.unlock(player_name, "dfcaverns_visit_tower_cap")
|
||||
elseif biome == "fungiwood" and check_nodes(node_types.fungiwood, totals) then
|
||||
@ -106,7 +110,7 @@ minetest.register_globalstep(function(dtime)
|
||||
awards.unlock(player_name, "dfcaverns_visit_underworld")
|
||||
end
|
||||
if (totals["df_underworld_items:glow_amethyst"] or 0) > 1 and
|
||||
player_awards.unlocked["dfcaverns_visit_glowing_pit"] ~= "dfcaverns_visit_glowing_pit" then
|
||||
unlocked["dfcaverns_visit_glowing_pit"] ~= "dfcaverns_visit_glowing_pit" then
|
||||
local player_pos = player:get_pos()
|
||||
local pit = df_caverns.get_nearest_glowing_pit(player_pos)
|
||||
pit.location.y = player_pos.y
|
||||
@ -122,10 +126,10 @@ minetest.register_globalstep(function(dtime)
|
||||
awards.unlock(player_name, "dfcaverns_visit_primordial_jungle")
|
||||
end
|
||||
end
|
||||
if player_awards.unlocked["dfcaverns_visit_chasm"] ~= "dfcaverns_visit_chasm" and chasms.is_in_chasm(player:get_pos()) then
|
||||
if unlocked["dfcaverns_visit_chasm"] ~= "dfcaverns_visit_chasm" and chasms.is_in_chasm(player:get_pos()) then
|
||||
awards.unlock(player_name, "dfcaverns_visit_chasm")
|
||||
end
|
||||
if player_awards.unlocked["dfcaverns_visit_pit"] ~= "dfcaverns_visit_pit" then
|
||||
if unlocked["dfcaverns_visit_pit"] ~= "dfcaverns_visit_pit" then
|
||||
local pos = player:get_pos()
|
||||
local pos_y = pos.y
|
||||
if pos_y < -30 then -- ignore pits when near the surface
|
||||
|
@ -95,6 +95,8 @@ minetest.register_globalstep(function(dtime)
|
||||
timer = 0
|
||||
|
||||
local player_name
|
||||
local number
|
||||
local ambience
|
||||
|
||||
-- loop through players
|
||||
for _, player in pairs(minetest.get_connected_players()) do
|
||||
|
@ -37,7 +37,10 @@ df_dependencies.mods_required.mcl_mapgen = true
|
||||
|
||||
local old_overworld_min
|
||||
|
||||
local ores_extended = false
|
||||
local extend_ores = function()
|
||||
if ores_extended then return end -- should only do this once.
|
||||
ores_extended = true
|
||||
local ores_registered = {}
|
||||
for key, val in pairs(minetest.registered_ores) do
|
||||
ores_registered[val.ore] = true
|
||||
@ -75,16 +78,19 @@ local extend_ores = function()
|
||||
local blob_copy = deep_copy(stone_blobs)
|
||||
blob_copy.ore = ore
|
||||
blob_copy.clust_num_ores = cluster_size
|
||||
blob_copy.clust_size = math.ceil(math.sqrt(cluster_size))
|
||||
blob_copy.clust_scarcity = cluster_scarcity_cuberoot*cluster_scarcity_cuberoot*cluster_scarcity_cuberoot
|
||||
blob_copy.seed = localseed
|
||||
blob_copy.cluster_scarcity = cluster_scarcity_cuberoot*cluster_scarcity_cuberoot*cluster_scarcity_cuberoot
|
||||
blob_copy.y_min = ymin or stone_blobs.y_min
|
||||
blob_copy.y_max = ymax or stone_blobs.y_max
|
||||
--minetest.debug(dump(blob_copy))
|
||||
minetest.register_ore(blob_copy)
|
||||
end
|
||||
|
||||
local scattered_ore = {
|
||||
wherein = wherein_stonelike,
|
||||
ore_type = "scatter",
|
||||
ore = "mcl_core:stone_with_coal",
|
||||
--ore = "mcl_core:stone_with_coal",
|
||||
clust_scarcity = 525*3,
|
||||
clust_num_ores = 5,
|
||||
clust_size = 3,
|
||||
@ -94,24 +100,27 @@ local extend_ores = function()
|
||||
noise_threshold= 0,
|
||||
}
|
||||
|
||||
local register_scattered_internal = function(ore, cluster_size, cluster_scarcity_cuberoot, threshold, ymin, ymax)
|
||||
local register_scattered_internal = function(ore, cluster_size, cluster_scarcity_cuberoot, threshold, ymin, ymax, wherein)
|
||||
local scattered_copy = deep_copy(scattered_ore)
|
||||
scattered_copy.ore = ore
|
||||
scattered_copy.cluster_size = cluster_size*cluster_size*cluster_size
|
||||
scattered_copy.clust_num_ores = math.ceil(scattered_copy.cluster_size/3)
|
||||
scattered_copy.clust_size = cluster_size*cluster_size*cluster_size
|
||||
scattered_copy.clust_scarcity = cluster_scarcity_cuberoot*cluster_scarcity_cuberoot*cluster_scarcity_cuberoot
|
||||
scattered_copy.clust_num_ores = math.ceil(scattered_copy.clust_size/3)
|
||||
scattered_copy.seed = localseed
|
||||
scattered_copy.cluster_scarcity = cluster_scarcity_cuberoot*cluster_scarcity_cuberoot*cluster_scarcity_cuberoot
|
||||
scattered_copy.threshold = threshold
|
||||
scattered_copy.y_min = ymin or scattered_ore.y_min
|
||||
scattered_copy.y_max = ymax or scattered_ore.y_max
|
||||
scattered_copy.wherein = wherein or scattered_ore.wherein
|
||||
--minetest.debug(dump(scattered_copy))
|
||||
minetest.register_ore(scattered_copy)
|
||||
end
|
||||
local register_scattered = function(ore, cluster_size, cluster_scarcity_cuberoot, ymin, ymax)
|
||||
local register_scattered = function(ore, cluster_size, cluster_scarcity_cuberoot, ymin, ymax, wherein)
|
||||
assert(not (ymin and ymax) or ymin < ymax, "Elevation parameter error for register_scattered")
|
||||
localseed = localseed + 1 -- increment this every time it's called to ensure different distributions
|
||||
-- same seed makes the noise patterns overlap.
|
||||
-- one produces widespread smaller clusters, other produces larger clusters at the peaks of the noise in addition to the smaller ones
|
||||
register_scattered_internal(ore, cluster_size, cluster_scarcity_cuberoot, 0, ymin, ymax)
|
||||
register_scattered_internal(ore, cluster_size*2, cluster_scarcity_cuberoot, 0.25, ymin, ymax)
|
||||
register_scattered_internal(ore, cluster_size, cluster_scarcity_cuberoot, 0, ymin, ymax, wherein)
|
||||
register_scattered_internal(ore, cluster_size*2, cluster_scarcity_cuberoot, 0.25, ymin, ymax, wherein)
|
||||
end
|
||||
|
||||
if ores_registered["mcl_core:diorite"] then
|
||||
@ -130,7 +139,10 @@ local extend_ores = function()
|
||||
table.insert(wherein_stonelike, "mcl_core:granite")
|
||||
end
|
||||
if ores_registered["mcl_core:dirt"] then
|
||||
register_blob("mcl_core:dirt", 33, 15)
|
||||
register_blob("mcl_core:dirt", 33, 15, config.sunless_sea_min)
|
||||
if config.enable_primordial then
|
||||
register_blob("mcl_core:dirt", 33, 15, config.primordial_min, config.primoridal_max)
|
||||
end
|
||||
end
|
||||
if ores_registered["mcl_core:gravel"] then
|
||||
register_blob("mcl_core:gravel", 33, 14)
|
||||
@ -181,19 +193,22 @@ local extend_ores = function()
|
||||
register_scattered("mcl_core:stone_with_copper", 3, 18)
|
||||
end
|
||||
|
||||
if ores_registered["mcl_deepslate:deepslate"] then
|
||||
register_blob("mcl_deepslate:deepslate", 33, 15, lowest_elevation, config.sunless_sea_min) -- it's called deepslate, so put it deep
|
||||
end
|
||||
if ores_registered["mcl_deepslate:tuff"] then
|
||||
register_blob("mcl_deepslate:tuff", 33, 15, lowest_elevation, config.sunless_sea_min)
|
||||
end
|
||||
|
||||
-- more blobs
|
||||
--"mcl_deepslate:deepslate"
|
||||
--"mcl_deepslate:tuff"
|
||||
|
||||
-- apparently very rare
|
||||
--"mcl_deepslate:deepslate_with_emerald"
|
||||
--"mcl_core:stone_with_emerald"
|
||||
if ores_registered["mcl_deepslate:deepslate_with_emerald"] then
|
||||
register_scattered("mcl_deepslate:deepslate_with_emerald", 1, 25, lowest_elevation, config.sunless_sea_min, "mcl_deepslate:deepslate")
|
||||
end
|
||||
if ores_registered["mcl_core:stone_with_emerald"] then
|
||||
register_scattered("mcl_core:stone_with_emerald", 1, 25, lowest_elevation, config.sunless_sea_min)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
if minetest.get_modpath("mcl_init") then -- Mineclone 2
|
||||
|
||||
old_overworld_min = mcl_vars.mg_overworld_min -- remember this for weather control
|
||||
@ -203,9 +218,11 @@ if minetest.get_modpath("mcl_init") then -- Mineclone 2
|
||||
mcl_vars.mg_lava_overworld_max = mcl_vars.mg_overworld_min + 10
|
||||
mcl_vars.mg_end_max = mcl_vars.mg_overworld_min - 2000
|
||||
|
||||
if minetest.settings:get_bool("mcl_generate_ores", true) then
|
||||
-- shouldn't need to worry about the setting, extend_ores checks if the ores
|
||||
-- have already been registered.
|
||||
--if minetest.settings:get_bool("mcl_generate_ores", true) then
|
||||
extend_ores()
|
||||
end
|
||||
--end
|
||||
|
||||
df_dependencies.mods_required.mcl_structures = true
|
||||
-- never mind - add dependency on mcl_strongholds and these will get generated before overworld_min gets changed.
|
||||
@ -248,6 +265,8 @@ if minetest.get_modpath("mcl_mapgen") then -- Mineclone 5
|
||||
.."does not have an mcl_mapgen.on_settings_changed method. This will likely result in "
|
||||
.."altitudes below the original bedrock being inaccessible to players.")
|
||||
end
|
||||
|
||||
extend_ores()
|
||||
end
|
||||
if minetest.get_modpath("mcl_worlds") then
|
||||
local old_has_weather = mcl_worlds.has_weather
|
||||
|
@ -26,7 +26,8 @@ end
|
||||
|
||||
df_trees.nether_cap_growth_permitted = function(pos)
|
||||
local below_name = minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name
|
||||
return minetest.get_item_group(below_name, "cools_lava") > 0 and minetest.get_item_group(below_name, "nether_cap") == 0
|
||||
return (minetest.get_item_group(below_name, "cools_lava") > 0 or minetest.get_item_group(below_name, "ice") > 0)
|
||||
and minetest.get_item_group(below_name, "nether_cap") == 0
|
||||
end
|
||||
|
||||
df_trees.spindlestem_growth_permitted = function(pos)
|
||||
|
@ -16,7 +16,7 @@ looped_node_sound.register = function(def)
|
||||
local max_hear_distance = def.max_hear_distance or 32
|
||||
|
||||
-- Update sound for player
|
||||
function update_player_sound(player)
|
||||
local function update_player_sound(player)
|
||||
local player_name = player:get_player_name()
|
||||
-- Search for nodes in radius around player
|
||||
local ppos = player:get_pos()
|
||||
|
Loading…
Reference in New Issue
Block a user