make mapping kit requirement more flexible

This commit is contained in:
FaceDeer 2020-01-31 14:13:35 -07:00
parent e59144a33b
commit 96e6ecefe7
3 changed files with 25 additions and 17 deletions

View File

@ -1,4 +1,4 @@
name = df_caverns
description = Adds vast underground caverns in the style of Dwarf Fortress, complete with underground flora in diverse biomes. Also adds stalactite/stalagmite decorations in the smaller tunnels.
depends = default, subterrane, df_trees, df_mapitems
optional_depends = df_farming, ice_sprites, oil, df_underworld_items, magma_conduits, bones_loot, named_waypoints, map, namegen
optional_depends = df_farming, ice_sprites, oil, df_underworld_items, magma_conduits, bones_loot, named_waypoints, namegen

View File

@ -41,18 +41,22 @@ dfcaverns_underworld_glowing_pit_mapblocks(Average pit spacing measured in mapbl
[Underworld feature HUD]
dfcaverns_underworld_hud_requires_item (Require an item to view waypoints) bool true
#Players can still discover the locations of volcanoes without this, but waypoints
#will only be visible in their hud if they have this item in their inventory. You can also
#specify "group:groupname" here. Leave it blank to default to map:mapping_kit.
dfcaverns_underworld_hud_item_required (Specify the item or group required) string map:mapping_kit
dfcaverns_show_pits_in_hud (Show pit locations in HUD) bool true
dfcaverns_pit_hud_requires_mapping_kit (Require mapping kit to show pits) bool true
dfcaverns_pit_discovery_range (Pit discovery range) int 60
dfcaverns_pit_visibility_range (Pit visibility range) int 500
dfcaverns_show_seals_in_hud (Seal locations in HUD) bool true
dfcaverns_seal_hud_requires_mapping_kit (Require mapping kit to show seals) bool true
dfcaverns_seal_discovery_range (Seal discovery range) int 10
dfcaverns_seal_visibility_range (Seal visibility range) int 200
dfcaverns_show_ruins_in_hud (Ruin locations visible in HUD) bool true
dfcaverns_ruin_hud_requires_mapping_kit (Require mapping kit to show ruins) bool true
dfcaverns_ruin_discovery_range (Ruin discovery range) int 40
dfcaverns_ruin_visibility_range (Ruin visibility range) int 250

View File

@ -13,15 +13,23 @@ local name_pit = function() end
local name_ruin = function() end
if named_waypoints_path then
local item_required = nil
if minetest.settings:get_bool("dfcaverns_underworld_hud_requires_item", true) then
local setting_item_required = minetest.settings:get("dfcaverns_underworld_hud_item_required")
if setting_item_required == nil or setting_item_required == "" then
setting_item_required = "map:mapping_kit"
end
item_required = setting_item_required
end
local pit_waypoint_def = {
default_name = S("A glowing pit"),
default_color = 0xFF88FF,
discovery_volume_radius = tonumber(minetest.settings:get("dfcaverns_pit_discovery_range")) or 60,
visibility_requires_item = item_required,
}
if minetest.settings:get_bool("dfcaverns_pit_hud_requires_mapping_kit", true)
and minetest.registered_items["map:mapping_kit"] then
pit_waypoint_def.visibility_requires_item = "map:mapping_kit"
end
if minetest.settings:get_bool("dfcaverns_show_pits_in_hud", true) then
pit_waypoint_def.visibility_volume_radius = tonumber(minetest.settings:get("dfcaverns_pit_visibility_range")) or 500
pit_waypoint_def.on_discovery = named_waypoints.default_discovery_popup
@ -32,11 +40,9 @@ if named_waypoints_path then
default_name = S("Mysterious seal"),
default_color = 0x9C2233,
discovery_volume_radius = tonumber(minetest.settings:get("dfcaverns_seal_discovery_range")) or 10,
visibility_requires_item = item_required,
}
if minetest.settings:get_bool("dfcaverns_seal_hud_requires_mapping_kit", true)
and minetest.registered_items["map:mapping_kit"] then
seal_waypoint_def.visibility_requires_item = "map:mapping_kit"
end
if minetest.settings:get_bool("dfcaverns_show_seals_in_hud", true) then
seal_waypoint_def.visibility_volume_radius = tonumber(minetest.settings:get("dfcaverns_seal_visibility_range")) or 200
seal_waypoint_def.on_discovery = named_waypoints.default_discovery_popup
@ -56,15 +62,13 @@ if named_waypoints_path then
local underworld_ruin_def = {
default_name = S("Ancient ruin"),
discovery_volume_radius = tonumber(minetest.settings:get("dfcaverns_ruin_discovery_range")) or 40,
visibility_requires_item = item_required,
}
if minetest.settings:get_bool("dfcaverns_show_ruins_in_hud", true) then
underworld_ruin_def.visibility_volume_radius = tonumber(minetest.settings:get("dfcaverns_ruin_visibility_range")) or 250
underworld_ruin_def.on_discovery = named_waypoints.default_discovery_popup
end
if minetest.settings:get_bool("dfcaverns_ruin_hud_requires_mapping_kit", true)
and minetest.registered_items["map:mapping_kit"] then
underworld_ruin_def.visibility_requires_item = "map:mapping_kit"
end
named_waypoints.register_named_waypoints("underworld_ruins", underworld_ruin_def)
end
end