Skip to content

Commit 164c3f3

Browse files
committed
Mutations can have a custom activation message
1 parent 79b8ed9 commit 164c3f3

File tree

4 files changed

+8
-2
lines changed

4 files changed

+8
-2
lines changed

doc/MUTATIONS.md

+1
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ Note that **all new traits that can be obtained through mutation must be purifia
173173
}
174174
],
175175
"active": true, // When set the mutation is an active mutation that the player needs to activate (default: false).
176+
"activation_msg": "Time to rock and roll", // Optional, default "You activate your %s." where %s is replaced with the mutation's name.
176177
"starts_active": true, // When true, this 'active' mutation starts active (default: false, requires 'active').
177178
"cost": 8, // Cost to activate this mutation. Needs one of the hunger, thirst, or sleepiness values set to true (default: 0).
178179
"time": 100, // Sets the amount of (turns * current player speed ) time units that need to pass before the cost is to be paid again. Needs to be higher than one to have any effect (default: 0).

src/mutation.h

+1
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ struct mutation_branch {
199199
bool mixed_effect = false;
200200
bool startingtrait = false;
201201
bool activated = false;
202+
translation activation_msg;
202203
// Should it activate as soon as it is gained?
203204
bool starts_active = false;
204205
// Should it destroy gear on restricted body parts? (otherwise just pushes it off)

src/mutation_data.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,8 @@ void mutation_branch::load( const JsonObject &jo, const std::string_view src )
399399
optional( jo, was_loaded, "can_only_eat", can_only_eat );
400400
optional( jo, was_loaded, "can_only_heal_with", can_only_heal_with );
401401
optional( jo, was_loaded, "can_heal_with", can_heal_with );
402+
optional( jo, was_loaded, "activation_msg", activation_msg,
403+
to_translation( "You activate your %s." ) );
402404

403405
optional( jo, was_loaded, "butchering_quality", butchering_quality, 0 );
404406

src/mutation_ui.cpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,8 @@ void avatar::power_mutations()
441441
( !mut_data.thirst || get_thirst() <= 400 ) &&
442442
( !mut_data.sleepiness || get_sleepiness() <= 400 ) &&
443443
( !mut_data.mana || magic->available_mana() >= mut_data.cost ) ) {
444-
add_msg_if_player( m_neutral, _( "You activate your %s." ), mutation_name( mut_data.id ) );
444+
add_msg_if_player( m_neutral,
445+
string_format( mut_data.activation_msg, mutation_name( mut_data.id ) ) );
445446
// Reset menu in advance
446447
ui.reset();
447448
activate_mutation( mut_id );
@@ -615,7 +616,8 @@ void avatar::power_mutations()
615616
( !mut_data.thirst || get_thirst() <= 400 ) &&
616617
( !mut_data.sleepiness || get_sleepiness() <= 400 ) &&
617618
( !mut_data.mana || magic->available_mana() >= mut_data.cost ) ) {
618-
add_msg_if_player( m_neutral, _( "You activate your %s." ), mutation_name( mut_data.id ) );
619+
add_msg_if_player( m_neutral,
620+
string_format( mut_data.activation_msg, mutation_name( mut_data.id ) ) );
619621
// Reset menu in advance
620622
ui.reset();
621623
activate_mutation( mut_id );

0 commit comments

Comments
 (0)