Skip to content

Commit

Permalink
Debug radiation on characters and map tiles
Browse files Browse the repository at this point in the history
  • Loading branch information
RenechCDDA committed Oct 21, 2024
1 parent 79b8ed9 commit c264a0f
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 2 deletions.
7 changes: 7 additions & 0 deletions data/raw/keybindings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2021,6 +2021,13 @@
"name": "Edit fields",
"bindings": [ { "input_method": "keyboard_any", "key": "f" } ]
},
{
"type": "keybinding",
"id": "EDIT_RADS",
"category": "EDITMAP",
"name": "Edit radiation",
"bindings": [ { "input_method": "keyboard_any", "key": "a" } ]
},
{
"type": "keybinding",
"id": "EDIT_TERRAIN",
Expand Down
10 changes: 9 additions & 1 deletion src/debug_menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2249,7 +2249,7 @@ static void character_edit_menu()
}

enum {
D_DESC, D_SKILLS, D_THEORY, D_PROF, D_STATS, D_SPELLS, D_ITEMS, D_DELETE_ITEMS, D_DROP_ITEMS, D_ITEM_WORN,
D_DESC, D_SKILLS, D_THEORY, D_PROF, D_STATS, D_SPELLS, D_ITEMS, D_DELETE_ITEMS, D_DROP_ITEMS, D_ITEM_WORN, D_RADS,
D_HP, D_STAMINA, D_MORALE, D_PAIN, D_NEEDS, D_NORMALIZE_BODY, D_HEALTHY, D_STATUS, D_MISSION_ADD, D_MISSION_EDIT,
D_TELE, D_MUTATE, D_BIONICS, D_CLASS, D_ATTITUDE, D_OPINION, D_PERSONALITY, D_ADD_EFFECT, D_ASTHMA, D_PRINT_VARS,
D_WRITE_EOCS, D_KILL_XP, D_CHECK_TEMP, D_EDIT_VARS, D_FACTION
Expand All @@ -2265,6 +2265,7 @@ static void character_edit_menu()
nmenu.addentry( D_DELETE_ITEMS, true, 'd', "%s", _( "Delete (all) items" ) );
nmenu.addentry( D_DROP_ITEMS, true, 'D', "%s", _( "Drop items" ) );
nmenu.addentry( D_ITEM_WORN, true, 'w', "%s", _( "Wear/wield an item from player's inventory" ) );
nmenu.addentry( D_RADS, true, 'r', "%s", _( "Set radiation" ) );
nmenu.addentry( D_HP, true, 'h', "%s", _( "Set hit points" ) );
nmenu.addentry( D_STAMINA, true, 'S', "%s", _( "Set stamina" ) );
nmenu.addentry( D_MORALE, true, 'o', "%s", _( "Set morale" ) );
Expand Down Expand Up @@ -2347,6 +2348,13 @@ static void character_edit_menu()
}
}
break;
case D_RADS: {
int value;
if( query_int( value, _( "Set rads to? Currently: %d" ), you.get_rad() ) ) {
you.set_rad( value );
}
}
break;
case D_HP:
character_edit_hp_menu( you );
break;
Expand Down
15 changes: 14 additions & 1 deletion src/editmap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,7 @@ std::optional<tripoint_bub_ms> editmap::edit()
ctxt.register_action( "LEVEL_DOWN" );
ctxt.register_action( "EDIT_TRAPS" );
ctxt.register_action( "EDIT_FIELDS" );
ctxt.register_action( "EDIT_RADS" );
ctxt.register_action( "EDIT_TERRAIN" );
ctxt.register_action( "EDIT_FURNITURE" );
ctxt.register_action( "EDIT_OVERMAP" );
Expand Down Expand Up @@ -393,9 +394,10 @@ std::optional<tripoint_bub_ms> editmap::edit()

// \u00A0 is the non-breaking space
info_txt_curr = string_format( pgettext( "keybinding descriptions",
"%s, %s, [%s,%s,%s,%s]\u00A0fast scroll, %s, %s, %s, %s, %s, %s" ),
"%s, %s, %s, [%s,%s,%s,%s]\u00A0fast scroll, %s, %s, %s, %s, %s, %s" ),
ctxt.describe_key_and_name( "EDIT_TRAPS" ),
ctxt.describe_key_and_name( "EDIT_FIELDS" ),
ctxt.describe_key_and_name( "EDIT_RADS" ),
ctxt.get_desc( "LEFT_WIDE", 1 ), ctxt.get_desc( "RIGHT_WIDE", 1 ),
ctxt.get_desc( "UP_WIDE", 1 ), ctxt.get_desc( "DOWN_WIDE", 1 ),
ctxt.describe_key_and_name( "EDITMAP_SHOW_ALL" ),
Expand All @@ -417,6 +419,8 @@ std::optional<tripoint_bub_ms> editmap::edit()
edit_feature<furn_t>();
} else if( action == "EDIT_FIELDS" ) {
edit_fld();
} else if( action == "EDIT_RADS" ) {
edit_rads();
} else if( action == "EDIT_ITEMS" ) {
edit_itm();
} else if( action == "EDIT_TRAPS" ) {
Expand Down Expand Up @@ -1211,6 +1215,15 @@ void editmap::setup_fmenu( uilist &fmenu )
}
}

void editmap::edit_rads() const
{
map &here = get_map();
int value = 0;
if( query_int( value, _( "Set rads to? Currently: %d" ), here.get_radiation( target ) ) ) {
here.set_radiation( target, value );
}
}

void editmap::edit_fld()
{
uilist fmenu;
Expand Down
1 change: 1 addition & 0 deletions src/editmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ class editmap
template<typename T_t>
void edit_feature();
void edit_fld();
void edit_rads() const;
void edit_itm();
void edit_critter( Creature &critter );
void edit_mapgen();
Expand Down

0 comments on commit c264a0f

Please sign in to comment.