|
35 | 35 | #include "cuboid_rectangle.h" |
36 | 36 | #include "cursesdef.h" |
37 | 37 | #include "display.h" |
| 38 | +#include "debug_menu.h" |
38 | 39 | #include "game.h" |
39 | 40 | #include "game_constants.h" |
40 | 41 | #include "game_ui.h" |
@@ -1151,6 +1152,7 @@ static void draw_om_sidebar( ui_adaptor &ui, |
1151 | 1152 | print_hint( "PLACE_SPECIAL", c_light_blue ); |
1152 | 1153 | print_hint( "SET_SPECIAL_ARGS", c_light_blue ); |
1153 | 1154 | print_hint( "LONG_TELEPORT", c_light_blue ); |
| 1155 | + print_hint( "MODIFY_HORDE", c_light_blue ); |
1154 | 1156 | ++y; |
1155 | 1157 | } |
1156 | 1158 |
|
@@ -1628,6 +1630,92 @@ static void set_special_args( tripoint_abs_omt &curs ) |
1628 | 1630 | *maybe_args = args; |
1629 | 1631 | } |
1630 | 1632 |
|
| 1633 | +static void modify_horde_func( tripoint_abs_omt &curs ) |
| 1634 | +{ |
| 1635 | + overmap &map_at_cursor = overmap_buffer.get( project_to<coords::om>( curs ).xy() ); |
| 1636 | + std::vector<std::reference_wrapper<mongroup>> hordes = |
| 1637 | + map_at_cursor.debug_unsafe_get_groups_at( curs ); |
| 1638 | + if( hordes.empty() ) { |
| 1639 | + if( !query_yn( _( "No hordes there. Would you like to make a new horde?" ) ) ) { |
| 1640 | + return; |
| 1641 | + } else { |
| 1642 | + debug_menu::wishmonstergroup( curs ); |
| 1643 | + return; |
| 1644 | + } |
| 1645 | + } |
| 1646 | + uilist horde_list; |
| 1647 | + int entry_num = 0; |
| 1648 | + for( auto &horde_wrapper : hordes ) { |
| 1649 | + mongroup &mg = horde_wrapper.get(); |
| 1650 | + // We do some special handling here to provide the information in as simple a way as possible |
| 1651 | + // emulates horde behavior |
| 1652 | + int displayed_monster_num = mg.monsters.empty() ? mg.population : mg.monsters.size(); |
| 1653 | + std::string horde_description = string_format( _( "group(type: %s) with %d monsters" ), |
| 1654 | + mg.type.c_str(), displayed_monster_num ); |
| 1655 | + horde_list.addentry( entry_num, true, -1, horde_description ); |
| 1656 | + } |
| 1657 | + horde_list.query(); |
| 1658 | + int &selected_group = horde_list.ret; |
| 1659 | + if( selected_group < 0 || static_cast<size_t>( selected_group ) > hordes.size() ) { |
| 1660 | + return; |
| 1661 | + } |
| 1662 | + mongroup &chosen_group = hordes[selected_group]; |
| 1663 | + |
| 1664 | + uilist smenu; |
| 1665 | + smenu.addentry( 0, true, 'I', _( "Set horde's interest (in %%)" ) ); |
| 1666 | + smenu.addentry( 1, true, 'D', _( "Set horde's destination" ) ); |
| 1667 | + smenu.addentry( 2, true, 'P', _( "Modify horde's population" ) ); |
| 1668 | + smenu.addentry( 3, true, 'M', _( "Add a new monster to the horde" ) ); |
| 1669 | + smenu.addentry( 4, true, 'B', _( "Set horde behavior" ) ); |
| 1670 | + smenu.addentry( 5, true, 'T', _( "Set horde's boolean values" ) ); |
| 1671 | + smenu.addentry( 6, true, 'A', _( "Add another horde to this location" ) ); |
| 1672 | + smenu.query(); |
| 1673 | + int new_value = 0; |
| 1674 | + tripoint_abs_omt horde_destination = tripoint_abs_omt_zero; |
| 1675 | + switch( smenu.ret ) { |
| 1676 | + case 0: |
| 1677 | + query_int( new_value, _( "Set interest to what value? Currently %d" ), chosen_group.interest ); |
| 1678 | + chosen_group.set_interest( new_value ); |
| 1679 | + break; |
| 1680 | + case 1: |
| 1681 | + popup( _( "Select a target destination for the horde." ) ); |
| 1682 | + horde_destination = ui::omap::choose_point( true ); |
| 1683 | + if( horde_destination == overmap::invalid_tripoint || horde_destination == tripoint_abs_omt_zero ) { |
| 1684 | + break; |
| 1685 | + } |
| 1686 | + chosen_group.target = project_to<coords::sm>( horde_destination ).xy(); |
| 1687 | + break; |
| 1688 | + case 2: |
| 1689 | + query_int( new_value, _( "Set population to what value? Currently %d" ), chosen_group.population ); |
| 1690 | + chosen_group.population = new_value; |
| 1691 | + break; |
| 1692 | + case 3: |
| 1693 | + debug_menu::wishmonstergroup_mon_selection( chosen_group ); |
| 1694 | + break; |
| 1695 | + case 4: |
| 1696 | + // Screw it we hardcode a popup, if you really want to use this you're welcome to improve it |
| 1697 | + popup( _( "Set behavior to which enum value? Currently %d. \nAccepted values:\n0 = none,\n1 = city,\n2=roam,\n3=nemesis" ), |
| 1698 | + static_cast<int>( chosen_group.behaviour ) ); |
| 1699 | + query_int( new_value, "" ); |
| 1700 | + chosen_group.behaviour = static_cast<mongroup::horde_behaviour>( new_value ); |
| 1701 | + break; |
| 1702 | + case 5: |
| 1703 | + // One day we'll be able to simply convert booleans to strings... |
| 1704 | + chosen_group.horde = query_yn( |
| 1705 | + _( "Set group's \"horde\" value to true? (Select no to set to false) \nCurrently %s" ), |
| 1706 | + chosen_group.horde ? _( "true" ) : _( "false" ) ); |
| 1707 | + chosen_group.dying = query_yn( |
| 1708 | + _( "Set group's \"dying\" value to true? (Select no to set to false) \nCurrently %s" ), |
| 1709 | + chosen_group.dying ? _( "true" ) : _( "false" ) ); |
| 1710 | + break; |
| 1711 | + case 6: |
| 1712 | + debug_menu::wishmonstergroup( curs ); |
| 1713 | + break; |
| 1714 | + default: |
| 1715 | + break; |
| 1716 | + } |
| 1717 | +} |
| 1718 | + |
1631 | 1719 | static std::vector<tripoint_abs_omt> get_overmap_path_to( const tripoint_abs_omt &dest, |
1632 | 1720 | bool driving ) |
1633 | 1721 | { |
@@ -1809,6 +1897,7 @@ static tripoint_abs_omt display() |
1809 | 1897 | ictxt.register_action( "PLACE_SPECIAL" ); |
1810 | 1898 | ictxt.register_action( "SET_SPECIAL_ARGS" ); |
1811 | 1899 | ictxt.register_action( "LONG_TELEPORT" ); |
| 1900 | + ictxt.register_action( "MODIFY_HORDE" ); |
1812 | 1901 | } |
1813 | 1902 | ictxt.register_action( "QUIT" ); |
1814 | 1903 | std::string action; |
@@ -2022,6 +2111,9 @@ static tripoint_abs_omt display() |
2022 | 2111 | g->place_player_overmap( curs ); |
2023 | 2112 | add_msg( _( "You teleport to submap %s." ), curs.to_string() ); |
2024 | 2113 | action = "QUIT"; |
| 2114 | + } else if( action == "MODIFY_HORDE" ) { |
| 2115 | + modify_horde_func( curs ); |
| 2116 | + action = "QUIT"; |
2025 | 2117 | } else if( action == "MISSIONS" ) { |
2026 | 2118 | g->list_missions(); |
2027 | 2119 | } |
@@ -2289,6 +2381,7 @@ void ui::omap::display() |
2289 | 2381 | { |
2290 | 2382 | g->overmap_data = overmap_ui::overmap_draw_data_t(); //reset data |
2291 | 2383 | g->overmap_data.origin_pos = get_player_character().global_omt_location(); |
| 2384 | + g->overmap_data.debug_editor = debug_mode; // always display debug editor if game is in debug mode |
2292 | 2385 | overmap_ui::display(); |
2293 | 2386 | } |
2294 | 2387 |
|
|
0 commit comments