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

Generic video game play iuse #36223

Merged
merged 1 commit into from Dec 19, 2019
Merged
Changes from all 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
10 changes: 9 additions & 1 deletion src/iuse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4356,6 +4356,7 @@ int iuse::portable_game( player *p, item *it, bool, const tripoint & )
as_m.entries.emplace_back( 3, true, '3', _( "Sokoban" ) );
as_m.entries.emplace_back( 4, true, '4', _( "Minesweeper" ) );
as_m.entries.emplace_back( 5, true, '5', _( "Lights on!" ) );
as_m.entries.emplace_back( 6, true, '6', _( "Play anything for a while" ) );
as_m.query();

switch( as_m.ret ) {
Expand All @@ -4374,6 +4375,9 @@ int iuse::portable_game( player *p, item *it, bool, const tripoint & )
case 5:
loaded_software = "lightson_game";
break;
case 6:
loaded_software = "null";
break;
default:
//Cancel
return 0;
Expand All @@ -4383,8 +4387,12 @@ int iuse::portable_game( player *p, item *it, bool, const tripoint & )
const int moves = to_moves<int>( 15_minutes );

p->add_msg_if_player( _( "You play on your %s for a while." ), it->tname() );
if( loaded_software == "null" ) {
p->assign_activity( activity_id( "ACT_GENERIC_GAME" ), to_moves<int>( 1_hours ), -1,
p->get_item_position( it ), "gaming" );
return it->type->charges_to_use();
}
p->assign_activity( activity_id( "ACT_GAME" ), moves, -1, p->get_item_position( it ), "gaming" );

std::map<std::string, std::string> game_data;
game_data.clear();
int game_score = 0;
Expand Down