From 83efd766ba742b056e03539877d9fa11a22ac287 Mon Sep 17 00:00:00 2001 From: scarf Date: Mon, 5 Aug 2024 02:39:16 +0900 Subject: [PATCH] refactor: further remove reference to faction camp (#5147) * refactor: further erase reference to faction camp * docs: remove obsolete flags * refactor: remove unused script --- .../docs/en/mod/json/guides/map/mapgen.md | 1 - .../en/mod/json/reference/creatures/npcs.md | 3 - .../docs/en/mod/json/reference/json_flags.md | 1 - src/faction.cpp | 11 +- tools/update_blueprint_needs.py | 134 ------------------ 5 files changed, 1 insertion(+), 149 deletions(-) delete mode 100755 tools/update_blueprint_needs.py diff --git a/doc/src/content/docs/en/mod/json/guides/map/mapgen.md b/doc/src/content/docs/en/mod/json/guides/map/mapgen.md index d88d413a8242..901b64755250 100644 --- a/doc/src/content/docs/en/mod/json/guides/map/mapgen.md +++ b/doc/src/content/docs/en/mod/json/guides/map/mapgen.md @@ -750,5 +750,4 @@ Not covered in this document: - Advanced terrain tricks for complex floor options. - traps, terrain and you. - update_mapgen (NPC and player triggered map updates). -- faction camp expansion maps. - field emitting furniture. diff --git a/doc/src/content/docs/en/mod/json/reference/creatures/npcs.md b/doc/src/content/docs/en/mod/json/reference/creatures/npcs.md index 94fb5315a862..8e25cf1f7ea9 100644 --- a/doc/src/content/docs/en/mod/json/reference/creatures/npcs.md +++ b/doc/src/content/docs/en/mod/json/reference/creatures/npcs.md @@ -600,9 +600,6 @@ effects should be arranged in a list and are processed in the order listed. | -------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `assign_guard` | Makes the NPC into a guard. If allied and at a camp, they will be assigned to that camp. | | `stop_guard` | Releases the NPC from their guard duty (also see `assign_guard`). Friendly NPCs will return to following. | -| `start_camp` | The NPC will start a faction camp with the player. | -| `recover_camp` | Makes the NPC the overseer of an existing camp that doesn't have an overseer. | -| `remove_overseer` | Makes the NPC stop being an overseer, abandoning the faction camp. | | `wake_up` | Wakes up sleeping, but not sedated, NPCs. | | `reveal_stats` | Reveals the NPC's stats, based on the player's skill at assessing them. | | `end_conversation` | Ends the conversation and makes the NPC ignore you from now on. | diff --git a/doc/src/content/docs/en/mod/json/reference/json_flags.md b/doc/src/content/docs/en/mod/json/reference/json_flags.md index 6ec96c2b0adb..90b79a59b0d6 100644 --- a/doc/src/content/docs/en/mod/json/reference/json_flags.md +++ b/doc/src/content/docs/en/mod/json/reference/json_flags.md @@ -641,7 +641,6 @@ List of known flags, used in both `terrain.json` and `furniture.json`. - `autoclave_full` Check on the progress of the cycle, and collect sterile CBM once cycle is completed. - `bars` Take advantage of AMORPHOUS and slip through the bars. -- `bulletin_board` Use this to arrange tasks for your faction camp. - `cardreader` Use the cardreader with a valid card, or attempt to hack. - `chainfence` Hop over the chain fence. - `controls_gate` Controls the attached gate. diff --git a/src/faction.cpp b/src/faction.cpp index aa2c712b65e1..55ea6adc25ab 100644 --- a/src/faction.cpp +++ b/src/faction.cpp @@ -619,8 +619,7 @@ void faction_manager::display() const ui.mark_resize(); enum class tab_mode : int { - TAB_MYFACTION = 0, - TAB_FOLLOWERS, + TAB_FOLLOWERS = 0, TAB_OTHERFACTIONS, NUM_TABS, FIRST_TAB = 0, @@ -655,7 +654,6 @@ void faction_manager::display() const } const std::vector> tabs = { - { tab_mode::TAB_MYFACTION, _( "YOUR FACTION" ) }, { tab_mode::TAB_FOLLOWERS, _( "YOUR FOLLOWERS" ) }, { tab_mode::TAB_OTHERFACTIONS, _( "OTHER FACTIONS" ) }, }; @@ -671,11 +669,6 @@ void faction_manager::display() const const size_t top_of_page = entries_per_page * ( selection / entries_per_page ); switch( tab ) { - case tab_mode::TAB_MYFACTION: { - const std::string no_camp = _( "You have no camps" ); - mvwprintz( w_missions, point( 31, 4 ), c_light_red, no_camp ); - } - break; case tab_mode::TAB_FOLLOWERS: { const std::string no_ally = _( "You have no followers" ); if( !followers.empty() ) { @@ -760,8 +753,6 @@ void faction_manager::display() const guy = followers[selection]; } active_vec_size = followers.size(); - } else if( tab == tab_mode::TAB_MYFACTION ) { - active_vec_size = 0; } else if( tab == tab_mode::TAB_OTHERFACTIONS ) { if( selection < valfac.size() ) { cur_fac = valfac[selection]; diff --git a/tools/update_blueprint_needs.py b/tools/update_blueprint_needs.py deleted file mode 100755 index 8941fb3d5863..000000000000 --- a/tools/update_blueprint_needs.py +++ /dev/null @@ -1,134 +0,0 @@ -#!/usr/bin/env python3 - -import getopt -import json -import glob -import os -import re -import subprocess -import sys - -def print_help(): - print("\n" - "Update faction camp blueprints with autocalculated requirements from unit test log.\n" - "This tool requires tools/format/json_formatter.\n" - "\n" - " --help prints this message\n" - " --logfile= specify the path to unit test log file\n" - " --action= what to do with reported inconsistencies. (optional)\n" - " update: update with suggested requirements (default)\n" - " suppress: suppress inconsistency warnings\n") - -def dump_json_and_lint(content, path): - with open(path, 'w', encoding='utf-8') as fs: - json.dump(content, fs, indent=2) - json_formatter_name = glob.glob( - 'tools/format/json_formatter.[ec]*') - assert len(json_formatter_name) == 1 - subprocess.run([json_formatter_name[0], path], - stdout=subprocess.DEVNULL) - -def main(argv): - try: - opts, args = getopt.getopt(argv, "", ["help", "logfile=", "action="]) - except getopt.GetoptError: - print_help() - return - - test_log = None - suppress = False - for opt, arg in opts: - if opt == "--help": - print_help() - return - if opt == "--logfile": - test_log = arg - if opt == "--action": - if arg == "update": - suppress = False - elif arg == "suppress": - suppress = True - else: - print_help(); - return - if not test_log: - print_help() - return - - json_dirs = { - "data/json", - "data/mods", - }; - - auto_update_blueprint = re.compile("~~~ auto-update-blueprint: (.+)") - auto_update_blueprint_end = re.compile("~~~ end-auto-update") - json_filename = re.compile(".+\\.json") - - update_blueprints = dict() - - with open(test_log, 'r', encoding='utf-8') as fs: - while True: - line = fs.readline() - if not line: - break - match_result = auto_update_blueprint.match(line) - if match_result: - ident = match_result.group(1) - reqs = "" - complete = False - while True: - line = fs.readline() - if not line: - complete = False - break - if auto_update_blueprint_end.match(line): - complete = True - break - else: - reqs += line - if complete: - update_blueprints[ident] = json.loads(reqs); - print(f"{ident} needs updating") - - if len(update_blueprints) == 0: - print("no inconsistency reported in the test log") - return - - for json_dir in json_dirs: - print(f"walking dir {json_dir}") - for root, dirs, files in os.walk(json_dir): - for file in files: - json_path = os.path.join(root, file) - content = None - changed = False - if json_filename.match(file): - with open(json_path, 'r', encoding='utf-8') as fs: - content = json.load(fs) - if type(content) is list: - for obj in content: - if not (type(obj) is dict - and "type" in obj and obj["type"] == "recipe" - and ("result" in obj or "abstract" in obj)): - continue - if "obsolete" in obj and obj["obsolete"] == True: - continue - ident = None; - if "abstract" in obj: - ident = obj["abstract"] - else: - ident = obj["result"] - if "id_suffix" in obj: - ident += f"_{obj['id_suffix']}" - if ident in update_blueprints: - if suppress: - obj["check_blueprint_needs"] = False - else: - obj["blueprint_needs"] = update_blueprints[ident] - if not changed: - changed = True - print(f"updating {json_path}") - if changed: - dump_json_and_lint(content, json_path) - -if __name__ == "__main__": - main(sys.argv[1:])