Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to sleep menu 2 #38768

Merged
merged 20 commits into from
Apr 7, 2020
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion data/json/items/tool/lighting.json
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@
"turns_per_charge": 30,
"revert_to": "glowstick_dead",
"revert_msg": "The glowstick fades out.",
"flags": [ "LIGHT_8", "TRADER_AVOID" ]
"flags": [ "LIGHT_8", "TRADER_AVOID", "SLEEP_IGNORE" ]
},
{
"id": "handflare",
Expand Down
34 changes: 18 additions & 16 deletions data/json/items/tool_armor.json
Original file line number Diff line number Diff line change
Expand Up @@ -1044,6 +1044,7 @@
"type": "TOOL_ARMOR",
"name": { "str": "filter mask" },
"description": "A mask that straps over your mouth and nose and filters air. Protects from smoke, dust, and other contaminants quite well. It must be prepared before use.",
"flags": [ "SLEEP_IGNORE" ],
"weight": "260 g",
"volume": "500 ml",
"price": 3500,
Expand All @@ -1069,6 +1070,7 @@
"name": { "str": "gas mask" },
"category": "clothing",
"description": "A full gas mask that covers the face and eyes. Provides excellent protection from smoke, teargas, and other contaminants. It must be prepared before use.",
"flags": [ "SLEEP_IGNORE" ],
"weight": "897 g",
"volume": "1 L",
"price": 4900,
Expand Down Expand Up @@ -1112,7 +1114,7 @@
"initial_charges": 100,
"ammo": "gasfilter_m",
"use_action": "GASMASK",
"flags": [ "OVERSIZE" ]
"flags": [ "OVERSIZE", "SLEEP_IGNORE" ]
},
{
"id": "mask_fsurvivor",
Expand All @@ -1139,7 +1141,7 @@
"initial_charges": 100,
"ammo": "gasfilter_m",
"use_action": "GASMASK",
"flags": [ "VARSIZE", "STURDY", "SUN_GLASSES" ]
"flags": [ "VARSIZE", "STURDY", "SUN_GLASSES", "SLEEP_IGNORE" ]
},
{
"id": "mask_fsurvivorxl",
Expand All @@ -1166,7 +1168,7 @@
"initial_charges": 100,
"ammo": "gasfilter_m",
"use_action": "GASMASK",
"flags": [ "VARSIZE", "STURDY", "OVERSIZE", "SUN_GLASSES" ]
"flags": [ "VARSIZE", "STURDY", "OVERSIZE", "SUN_GLASSES", "SLEEP_IGNORE" ]
},
{
"id": "mask_bunker",
Expand All @@ -1177,7 +1179,7 @@
"color": "light_gray",
"name": { "str": "firefighter PBA mask" },
"description": "A full-face mask commonly used by firefighters. The protective breathing apparatus provides excellent protection from smoke, flame, and other dangers. It must be prepared before use.",
"flags": [ "VARSIZE", "WATERPROOF", "STURDY", "SUN_GLASSES" ],
"flags": [ "VARSIZE", "WATERPROOF", "STURDY", "SUN_GLASSES", "SLEEP_IGNORE" ],
"price": 100000,
"material": [ "plastic", "nomex" ],
"weight": "1260 g",
Expand Down Expand Up @@ -1221,7 +1223,7 @@
"environmental_protection": 1,
"environmental_protection_with_filter": 15,
"qualities": [ [ "GLARE", 1 ] ],
"flags": [ "VARSIZE", "STURDY", "SUN_GLASSES" ]
"flags": [ "VARSIZE", "STURDY", "SUN_GLASSES", "SLEEP_IGNORE" ]
},
{
"id": "mask_lsurvivor",
Expand Down Expand Up @@ -1249,7 +1251,7 @@
"environmental_protection": 1,
"environmental_protection_with_filter": 15,
"qualities": [ [ "GLARE", 1 ] ],
"flags": [ "VARSIZE", "STURDY", "SUN_GLASSES" ]
"flags": [ "VARSIZE", "STURDY", "SUN_GLASSES", "SLEEP_IGNORE" ]
},
{
"id": "mask_survivor",
Expand All @@ -1276,7 +1278,7 @@
"environmental_protection": 1,
"environmental_protection_with_filter": 15,
"qualities": [ [ "GLARE", 1 ] ],
"flags": [ "VARSIZE", "STURDY", "SUN_GLASSES" ]
"flags": [ "VARSIZE", "STURDY", "SUN_GLASSES", "SLEEP_IGNORE" ]
},
{
"id": "mask_survivorxl",
Expand All @@ -1303,7 +1305,7 @@
"environmental_protection": 1,
"environmental_protection_with_filter": 15,
"qualities": [ [ "GLARE", 1 ] ],
"flags": [ "VARSIZE", "STURDY", "OVERSIZE", "SUN_GLASSES" ]
"flags": [ "VARSIZE", "STURDY", "OVERSIZE", "SUN_GLASSES", "SLEEP_IGNORE" ]
},
{
"id": "mask_wsurvivor",
Expand All @@ -1330,7 +1332,7 @@
"environmental_protection": 1,
"environmental_protection_with_filter": 15,
"qualities": [ [ "GLARE", 1 ] ],
"flags": [ "VARSIZE", "STURDY", "SUN_GLASSES" ]
"flags": [ "VARSIZE", "STURDY", "SUN_GLASSES", "SLEEP_IGNORE" ]
},
{
"id": "mask_wsurvivorxl",
Expand All @@ -1357,7 +1359,7 @@
"environmental_protection": 1,
"environmental_protection_with_filter": 15,
"qualities": [ [ "GLARE", 1 ] ],
"flags": [ "VARSIZE", "STURDY", "OVERSIZE", "SUN_GLASSES" ]
"flags": [ "VARSIZE", "STURDY", "OVERSIZE", "SUN_GLASSES", "SLEEP_IGNORE" ]
},
{
"id": "goggles_nv",
Expand Down Expand Up @@ -2385,7 +2387,7 @@
"price": 1000,
"material": [ "steel" ],
"volume": "250 ml",
"flags": [ "BELTED" ],
"flags": [ "BELTED", "SLEEP_IGNORE" ],
"material_thickness": 1
},
{
Expand Down Expand Up @@ -2421,7 +2423,7 @@
"warmth": 2,
"encumbrance": 27,
"bashing": 8,
"flags": [ "BELTED" ],
"flags": [ "BELTED", "SLEEP_IGNORE" ],
"coverage": 10,
"material_thickness": 2
},
Expand Down Expand Up @@ -2464,7 +2466,7 @@
"warmth": 2,
"encumbrance": 27,
"bashing": 8,
"flags": [ "BELTED" ],
"flags": [ "BELTED", "SLEEP_IGNORE" ],
"coverage": 10,
"material_thickness": 2
},
Expand Down Expand Up @@ -2504,7 +2506,7 @@
"volume": "4 L",
"encumbrance": 15,
"bashing": 4,
"flags": [ "BELTED" ],
"flags": [ "BELTED", "SLEEP_IGNORE" ],
"coverage": 10,
"material_thickness": 2
},
Expand All @@ -2516,7 +2518,7 @@
"weight": "10000 g",
"color": "yellow",
"covers": [ "TORSO" ],
"flags": [ "BELTED" ],
"flags": [ "BELTED", "SLEEP_IGNORE" ],
"to_hit": -1,
"max_charges": 1,
"initial_charges": 1,
Expand Down Expand Up @@ -2551,7 +2553,7 @@
"weight": "2000 g",
"color": "yellow",
"covers": [ "TORSO" ],
"flags": [ "BELTED" ],
"flags": [ "BELTED", "SLEEP_IGNORE" ],
"to_hit": 1,
"max_charges": 1,
"initial_charges": 1,
Expand Down
15 changes: 13 additions & 2 deletions data/mods/CRT_EXPANSION/items/crt_toolarmor.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,17 @@
"material_thickness": 3,
"environmental_protection": 16,
"qualities": [ [ "GLARE", 1 ] ],
"flags": [ "WATERPROOF", "STURDY", "PARTIAL_DEAF", "SUN_GLASSES", "VARSIZE", "GAS_PROOF", "USE_UPS", "NO_UNLOAD" ]
"flags": [
"WATERPROOF",
"STURDY",
"PARTIAL_DEAF",
"SUN_GLASSES",
"VARSIZE",
"GAS_PROOF",
"USE_UPS",
"NO_UNLOAD",
"SLEEP_IGNORE"
]
},
{
"id": "crt_gasmask_on",
Expand Down Expand Up @@ -70,7 +80,8 @@
"TRADER_AVOID",
"GAS_PROOF",
"USE_UPS",
"NO_UNLOAD"
"NO_UNLOAD",
"SLEEP_IGNORE"
]
},
{
Expand Down
1 change: 1 addition & 0 deletions doc/JSON_FLAGS.md
Original file line number Diff line number Diff line change
Expand Up @@ -679,6 +679,7 @@ List of known flags, used in both `terrain.json` and `furniture.json`.
- ```REDUCED_WEIGHT``` ... Gunmod flag; reduces the item's base weight by 25%.
- ```REQUIRES_TINDER``` ... Requires tinder to be present on the tile this item tries to start a fire on.
- ```SLEEP_AID``` ... This item helps in sleeping.
- ```SLEEP_IGNORE``` ... This item is not shown as before-sleep warning.
- ```SLOW_WIELD``` ... Has an additional time penalty upon wielding. For melee weapons and guns this is offset by the relevant skill. Stacks with "NEEDS_UNFOLD".
- ```TACK``` ... Item can be used as tack for a mount.
- ```TIE_UP``` ... Item can be used to tie up a creature.
Expand Down
1 change: 1 addition & 0 deletions src/cata_string_consts.h
Original file line number Diff line number Diff line change
Expand Up @@ -1173,6 +1173,7 @@ static const std::string flag_SHRUB( "SHRUB" );
static const std::string flag_SILENT( "SILENT" );
static const std::string flag_SKINNED( "SKINNED" );
static const std::string flag_SKINTIGHT( "SKINTIGHT" );
static const std::string flag_SLEEP_IGNORE( "SLEEP_IGNORE" );
static const std::string flag_SLOW_WIELD( "SLOW_WIELD" );
static const std::string flag_SMOKABLE( "SMOKABLE" );
static const std::string flag_SMOKED( "SMOKED" );
Expand Down
18 changes: 10 additions & 8 deletions src/handle_action.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -903,21 +903,22 @@ static void sleep()
uilist as_m;
as_m.text = _( "<color_white>Are you sure you want to sleep?</color>" );
// (Y)es/(S)ave before sleeping/(N)o
as_m.entries.emplace_back( 2, true,
get_option<bool>( "FORCE_CAPITAL_YN" ) ? 'N' : 'n',
_( "No." ) );
as_m.entries.emplace_back( 1, g->get_moves_since_last_save(),
get_option<bool>( "FORCE_CAPITAL_YN" ) ? 'S' : 's',
_( "Yes, and save game before sleeping." ) );
as_m.entries.emplace_back( 0, true,
get_option<bool>( "FORCE_CAPITAL_YN" ) ? 'Y' : 'y',
_( "Yes." ) );
as_m.entries.emplace_back( 1, g->get_moves_since_last_save(),
get_option<bool>( "FORCE_CAPITAL_YN" ) ? 'S' : 's',
_( "Yes, and save game before sleeping." ) );
as_m.entries.emplace_back( 2, true,
get_option<bool>( "FORCE_CAPITAL_YN" ) ? 'N' : 'n',
_( "No." ) );

// List all active items, bionics or mutations so player can deactivate them
std::vector<std::string> active;
for( auto &it : u.inv_dump() ) {
if( it->has_flag( flag_LITCIG ) ||
( it->active && ( it->charges > 0 || it->units_remaining( u ) > 0 ) && it->is_tool() ) ) {
( it->active && ( it->charges > 0 || it->units_remaining( u ) > 0 ) && it->is_tool() &&
!it->has_flag( flag_SLEEP_IGNORE ) ) ) {
active.push_back( it->tname() );
}
}
Expand Down Expand Up @@ -958,8 +959,9 @@ static void sleep()
// ask for deactivation
std::stringstream data;
if( !active.empty() ) {
as_m.selected = 2;
data << as_m.text << std::endl;
data << _( "You may want to turn off:" ) << std::endl;
data << _( "You may want to extinguish or turn off:" ) << std::endl;
data << " " << std::endl;
for( auto &a : active ) {
data << "<color_red>" << a << "</color>" << std::endl;
Expand Down