From f6d9c04f6e98fb381a61b6132372a4f8fa88320d Mon Sep 17 00:00:00 2001 From: FaceDeer Date: Fri, 31 Jan 2020 13:52:51 -0700 Subject: [PATCH] make mapping kit requirement more flexible --- settlements/buildings.lua | 9 ++++++--- settlements/mod.conf | 2 +- settlements/settingtypes.txt | 8 +++++--- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/settlements/buildings.lua b/settlements/buildings.lua index 650f435..d5e995e 100644 --- a/settlements/buildings.lua +++ b/settlements/buildings.lua @@ -13,9 +13,12 @@ local settlement_waypoint_def = { default_color = 0xFFFFFF, discovery_volume_radius = tonumber(minetest.settings:get("settlements_discovery_range")) or 30, } -if minetest.settings:get_bool("settlements_hud_requires_mapping_kit", true) - and minetest.registered_items["map:mapping_kit"] then - settlement_waypoint_def.visibility_requires_item = "map:mapping_kit" +if minetest.settings:get_bool("settlements_hud_requires_item", true) then + local item_required = minetest.settings:get("settlements_hud_item_required") + if item_required == nil or item_required == "" then + item_required = "map:mapping_kit" + end + settlement_waypoint_def.visibility_requires_item = item_required end if minetest.settings:get_bool("settlements_show_in_hud", true) then settlement_waypoint_def.visibility_volume_radius = tonumber(minetest.settings:get("settlements_visibility_range")) or 600 diff --git a/settlements/mod.conf b/settlements/mod.conf index ea7158c..93f7391 100644 --- a/settlements/mod.conf +++ b/settlements/mod.conf @@ -1,4 +1,4 @@ name = settlements description = API for adding small settlements to map generation. depends = named_waypoints -optional_depends = commoditymarket, map, intllib +optional_depends = commoditymarket, intllib diff --git a/settlements/settingtypes.txt b/settlements/settingtypes.txt index 51cde64..c885185 100644 --- a/settlements/settingtypes.txt +++ b/settlements/settingtypes.txt @@ -7,8 +7,10 @@ settlements_generate_books (Generate books to populate shelves in settlements) b #existing discoveries will not be removed and will be visible again if #this is reenabled) settlements_show_in_hud (Show settlement names in HUD) bool true -#Players can still discover the locations of settlements without a map, but waypoints -#will only be visible in their hud if they have a mapping kit in their inventory -settlements_hud_requires_mapping_kit (Require mapping kit to view waypoints) bool true +settlements_hud_requires_item (Require an item to view waypoints) bool true +#Players can still discover the locations of settlements 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. +settlements_hud_item_required (Specify the item or group required) string map:mapping_kit settlements_discovery_range (Settlement discovery range) int 30 settlements_visibility_range (Settlement visibility range) int 600