Skip to content

Commit

Permalink
Disallow certain activities while riding (#33165)
Browse files Browse the repository at this point in the history
* disallow certain activities while riding

* file replaced in error

* astylin

* move comments back to where they referred to previously

* full stop - punctuation

* remove from handcuffs iuse, as it dosnt appear to be somethign the player activates

* generalise messages

* clang-tidy value stored is never read

* commit to trigger rebuild

* astyle
  • Loading branch information
davidpwbrown authored and kevingranade committed Aug 25, 2019
1 parent 60e0ca9 commit 20d267b
Show file tree
Hide file tree
Showing 5 changed files with 324 additions and 89 deletions.
13 changes: 12 additions & 1 deletion src/bionics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ void npc::check_or_use_weapon_cbm( const bionic_id &cbm_id )
bool player::activate_bionic( int b, bool eff_only )
{
bionic &bio = ( *my_bionics )[b];

const bool mounted = is_mounted();
if( bio.incapacitated_time > 0_turns ) {
add_msg( m_info, _( "Your %s is shorting out and can't be activated." ),
bionics[bio.id].name );
Expand Down Expand Up @@ -356,6 +356,10 @@ bool player::activate_bionic( int b, bool eff_only )

mod_moves( -100 );
} else if( bio.id == "bio_time_freeze" ) {
if( mounted ) {
add_msg_if_player( m_info, _( "You cannot activate that while mounted." ) );
return false;
}
mod_moves( power_level );
power_level = 0;
add_msg_if_player( m_good, _( "Your speed suddenly increases!" ) );
Expand All @@ -371,6 +375,10 @@ bool player::activate_bionic( int b, bool eff_only )
add_effect( effect_teleglow, rng( 5_minutes, 40_minutes ) );
}
} else if( bio.id == "bio_teleport" ) {
if( mounted ) {
add_msg_if_player( m_info, _( "You cannot activate that while mounted." ) );
return false;
}
g->teleport();
add_effect( effect_teleglow, 30_minutes );
mod_moves( -100 );
Expand Down Expand Up @@ -1512,6 +1520,9 @@ bool player::can_install_bionics( const itype &type, player &installer, bool aut
debugmsg( "Tried to install NULL bionic" );
return false;
}
if( is_mounted() ) {
return false;
}
int assist_bonus = installer.get_effect_int( effect_assisted );

const bionic_id &bioid = type.bionic->id;
Expand Down
5 changes: 4 additions & 1 deletion src/handle_action.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -883,7 +883,10 @@ static void wait()
static void sleep()
{
player &u = g->u;

if( u.is_mounted() ) {
u.add_msg_if_player( m_info, _( "You cannot sleep while mounted." ) );
return;
}
uilist as_m;
as_m.text = _( "Are you sure you want to sleep?" );
// (Y)es/(S)ave before sleeping/(N)o
Expand Down
Loading

0 comments on commit 20d267b

Please sign in to comment.