Skip to content

Commit

Permalink
Withdrawals are distracting (#75261)
Browse files Browse the repository at this point in the history
* Update distraction_manager.cpp

added withdrawal distraction to manager

* Update uistate.h

added distraction_withdrawal

* Update distraction_manager.cpp

depluralize withdrawal

* Update suffer.cpp

add withdrawal interrupt to suffer.cpp

* Update enums.h

added withdrawal as a distraction type

* Update activity_type.cpp

addd withdrawal to activity type

* Update src/suffer.cpp

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
Consoleable and github-actions[bot] authored Jul 27, 2024
1 parent ebf95c1 commit b9b3f3f
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/activity_type.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ std::string enum_to_string<distraction_type>( distraction_type data )
case distraction_type::temperature: return "temperature";
case distraction_type::mutation: return "mutation";
case distraction_type::oxygen: return "oxygen";
case distraction_type::withdrawal: return "withdrawal";
// *INDENT-ON*
default:
cata_fatal( "Invalid distraction_type in enum_to_string" );
Expand Down
1 change: 1 addition & 0 deletions src/distraction_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ static const std::vector<configurable_distraction> &get_configurable_distraction
{&uistate.distraction_temperature, translate_marker( "Temperature" ), translate_marker( "This distraction will interrupt your activity when your temperature is very high or very low." )},
{&uistate.distraction_mutation, translate_marker( "Mutation" ), translate_marker( "This distraction will interrupt your activity when you gain or lose a mutation." )},
{&uistate.distraction_oxygen, translate_marker( "Asphyxiation" ), translate_marker( "This distraction will interrupt your activity when you can't breathe." )},
{&uistate.distraction_withdrawal, translate_marker( "Withdrawal" ), translate_marker( "This distraction will interrupt your activity when you have withdrawals." )},
};
return configurable_distractions;
}
Expand Down
1 change: 1 addition & 0 deletions src/enums.h
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,7 @@ enum class distraction_type : int {
temperature,
mutation,
oxygen,
withdrawal,
last,
};

Expand Down
4 changes: 4 additions & 0 deletions src/suffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,10 @@ void suffer::from_addictions( Character &you )
for( addiction &cur_addiction : you.addictions ) {
if( cur_addiction.sated <= 0_turns &&
cur_addiction.intensity >= MIN_ADDICTION_LEVEL ) {
if( uistate.distraction_withdrawal && !you.is_npc() ) {
g->cancel_activity_or_ignore_query( distraction_type::withdrawal,
_( "You start having withdrawals!" ) );
}
cur_addiction.run_effect( you );
}
cur_addiction.sated -= 1_turns;
Expand Down
1 change: 1 addition & 0 deletions src/uistate.h
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ class uistatedata
bool distraction_temperature = true;
bool distraction_mutation = true;
bool distraction_oxygen = true;
bool distraction_withdrawal = true;

Check failure on line 159 in src/uistate.h

View workflow job for this annotation

GitHub Actions / build (src)

Function 'deserialize' appears to be a serialization function for class 'uistatedata' but does not mention field 'distraction_withdrawal'. [cata-serialize,-warnings-as-errors]

Check failure on line 159 in src/uistate.h

View workflow job for this annotation

GitHub Actions / build (src)

Function 'serialize' appears to be a serialization function for class 'uistatedata' but does not mention field 'distraction_withdrawal'. [cata-serialize,-warnings-as-errors]
bool numpad_navigation = false;

// V Menu Stuff
Expand Down

0 comments on commit b9b3f3f

Please sign in to comment.