|
5 | 5 | #include <cmath>
|
6 | 6 | #include <cstddef>
|
7 | 7 | #include <exception>
|
| 8 | +#include <filesystem> |
8 | 9 | #include <iterator>
|
9 | 10 | #include <list>
|
10 | 11 | #include <map>
|
|
29 | 30 | #include "bodypart.h"
|
30 | 31 | #include "calendar.h"
|
31 | 32 | #include "cata_lazy.h"
|
| 33 | +#include "cata_path.h" |
32 | 34 | #include "cata_utility.h"
|
33 | 35 | #include "catacharset.h"
|
34 | 36 | #include "character.h"
|
|
58 | 60 | #include "faction.h"
|
59 | 61 | #include "faction_camp.h"
|
60 | 62 | #include "field.h"
|
| 63 | +#include "filesystem.h" |
61 | 64 | #include "flag.h"
|
62 | 65 | #include "flat_set.h"
|
63 | 66 | #include "flexbuffer_json.h"
|
|
107 | 110 | #include "output.h"
|
108 | 111 | #include "overmap_ui.h"
|
109 | 112 | #include "overmapbuffer.h"
|
| 113 | +#include "path_info.h" |
110 | 114 | #include "pickup.h"
|
111 | 115 | #include "pimpl.h"
|
112 | 116 | #include "player_activity.h"
|
@@ -4764,6 +4768,23 @@ talk_effect_fun_t::func f_place_override( const JsonObject &jo, std::string_view
|
4764 | 4768 | };
|
4765 | 4769 | }
|
4766 | 4770 |
|
| 4771 | +talk_effect_fun_t::func f_clear_dimension( const JsonObject &jo, std::string_view member, |
| 4772 | + std::string_view ) |
| 4773 | +{ |
| 4774 | + str_or_var target_dimension = get_str_or_var( jo.get_member( member ), member, true ); |
| 4775 | + |
| 4776 | + return [target_dimension]( dialogue const & d ) { |
| 4777 | + const std::string target_dimension_id = target_dimension.evaluate( |
| 4778 | + d ); |
| 4779 | + const std::vector<cata_path> dimensions_query = get_directories_with( target_dimension_id, |
| 4780 | + PATH_INFO::dimensions_save_path() ); |
| 4781 | + if( dimensions_query.size() == 1 ) { |
| 4782 | + std::filesystem::remove_all( ( PATH_INFO::dimensions_save_path() / |
| 4783 | + target_dimension_id ).get_unrelative_path() ); |
| 4784 | + } |
| 4785 | + }; |
| 4786 | +} |
| 4787 | + |
4767 | 4788 | talk_effect_fun_t::func f_mapgen_update( const JsonObject &jo, std::string_view member,
|
4768 | 4789 | std::string_view )
|
4769 | 4790 | {
|
@@ -7890,6 +7911,7 @@ parsers = {
|
7890 | 7911 | { "set_npc_cbm_reserve_rule", jarg::member, &talk_effect_fun::f_npc_cbm_reserve_rule },
|
7891 | 7912 | { "set_npc_cbm_recharge_rule", jarg::member, &talk_effect_fun::f_npc_cbm_recharge_rule },
|
7892 | 7913 | { "map_spawn_item", jarg::member, &talk_effect_fun::f_spawn_item },
|
| 7914 | + { "clear_dimension", jarg::member, &talk_effect_fun::f_clear_dimension }, |
7893 | 7915 | { "mapgen_update", jarg::member, &talk_effect_fun::f_mapgen_update },
|
7894 | 7916 | { "alter_timed_events", jarg::member, &talk_effect_fun::f_alter_timed_events },
|
7895 | 7917 | { "revert_location", jarg::member, &talk_effect_fun::f_revert_location },
|
|
0 commit comments