diff --git a/src/creature.cpp b/src/creature.cpp index b29342914b466..f200c620b1acb 100644 --- a/src/creature.cpp +++ b/src/creature.cpp @@ -1128,13 +1128,14 @@ void Creature::deal_projectile_attack( Creature *source, dealt_projectile_attack add_msg_player_or_npc( m_warning, _( "You avoid %s projectile!" ), - _( " avoids %s projectile." ), + get_option( "LOG_MONSTER_ATTACK_MONSTER" ) ? _( " avoids %s projectile." ) : "", source->disp_name( true ) ); } else { add_msg_player_or_npc( m_warning, _( "You avoid an incoming projectile!" ), - _( " avoids an incoming projectile." ) ); + get_option( "LOG_MONSTER_ATTACK_MONSTER" ) ? _( " avoids an incoming projectile." ) : + "" ); } return; } diff --git a/src/game.cpp b/src/game.cpp index e03de68f751c3..31e79923e55ef 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -10915,19 +10915,22 @@ point game::place_player( const tripoint &dest_loc, bool quick ) and_the_rest += counts[i]; } } - if( names.size() == 1 ) { - add_msg( _( "You see here %s." ), names[0] ); - } else if( names.size() == 2 ) { - add_msg( _( "You see here %s and %s." ), names[0], names[1] ); - } else if( names.size() == 3 ) { - add_msg( _( "You see here %s, %s, and %s." ), names[0], names[1], names[2] ); - } else if( and_the_rest < 7 ) { - add_msg( n_gettext( "You see here %s, %s and %d more item.", - "You see here %s, %s and %d more items.", - and_the_rest ), - names[0], names[1], and_the_rest ); - } else { - add_msg( _( "You see here %s and many more items." ), names[0] ); + + if( get_option( "LOG_ITEMS_ON_THE_GROUND" ) ) { + if( names.size() == 1 ) { + add_msg( _( "You see here %s." ), names[0] ); + } else if( names.size() == 2 ) { + add_msg( _( "You see here %s and %s." ), names[0], names[1] ); + } else if( names.size() == 3 ) { + add_msg( _( "You see here %s, %s, and %s." ), names[0], names[1], names[2] ); + } else if( and_the_rest < 7 ) { + add_msg( n_gettext( "You see here %s, %s and %d more item.", + "You see here %s, %s and %d more items.", + and_the_rest ), + names[0], names[1], and_the_rest ); + } else { + add_msg( _( "You see here %s and many more items." ), names[0] ); + } } } } diff --git a/src/mattack_actors.cpp b/src/mattack_actors.cpp index a8ec6cb6c19ee..3010f57b362c3 100644 --- a/src/mattack_actors.cpp +++ b/src/mattack_actors.cpp @@ -219,7 +219,7 @@ bool leap_actor::call( monster &z ) const bool seen = player_view.sees( z ); // We can see them jump... z.setpos( chosen ); seen |= player_view.sees( z ); // ... or we can see them land - if( seen ) { + if( seen && get_option( "LOG_MONSTER_MOVEMENT" ) ) { add_msg( message, z.name() ); } @@ -717,8 +717,9 @@ bool melee_actor::call( monster &z ) const game_message_type msg_type = target->is_avatar() ? m_warning : m_info; sfx::play_variant_sound( "mon_bite", "bite_miss", sfx::get_heard_volume( z.pos() ), sfx::get_heard_angle( z.pos() ) ); - target->add_msg_player_or_npc( msg_type, miss_msg_u, miss_msg_npc, z.name(), - body_part_name_accusative( bp_id ) ); + target->add_msg_player_or_npc( msg_type, miss_msg_u, + get_option( "LOG_MONSTER_ATTACK_MONSTER" ) ? miss_msg_npc : to_translation( "" ), + z.name(), body_part_name_accusative( bp_id ) ); return true; } @@ -726,8 +727,9 @@ bool melee_actor::call( monster &z ) const if( hitspread < 0 ) { sfx::play_variant_sound( "mon_bite", "bite_miss", sfx::get_heard_volume( z.pos() ), sfx::get_heard_angle( z.pos() ) ); - target->add_msg_player_or_npc( msg_type, miss_msg_u, miss_msg_npc, mon_name, - body_part_name_accusative( bp_id ) ); + target->add_msg_player_or_npc( msg_type, miss_msg_u, + get_option( "LOG_MONSTER_ATTACK_MONSTER" ) ? miss_msg_npc : to_translation( "" ), + mon_name, body_part_name_accusative( bp_id ) ); return true; } } @@ -857,8 +859,9 @@ bool melee_actor::call( monster &z ) const } else { sfx::play_variant_sound( "mon_bite", "bite_miss", sfx::get_heard_volume( z.pos() ), sfx::get_heard_angle( z.pos() ) ); - target->add_msg_player_or_npc( msg_type, no_dmg_msg_u, no_dmg_msg_npc, mon_name, - body_part_name_accusative( bp_id ) ); + target->add_msg_player_or_npc( msg_type, no_dmg_msg_u, + get_option( "LOG_MONSTER_ATTACK_MONSTER" ) ? no_dmg_msg_npc : to_translation( "" ), + mon_name, body_part_name_accusative( bp_id ) ); if( !effects_require_dmg ) { for( const mon_effect_data &eff : effects ) { if( x_in_y( eff.chance, 100 ) ) { @@ -873,7 +876,9 @@ bool melee_actor::call( monster &z ) const if( throw_strength > 0 ) { if( g->fling_creature( target, coord_to_angle( z.pos(), target->pos() ), throw_strength ) ) { - target->add_msg_player_or_npc( msg_type, throw_msg_u, throw_msg_npc, mon_name ); + target->add_msg_player_or_npc( msg_type, throw_msg_u, + get_option( "LOG_MONSTER_ATTACK_MONSTER" ) ? throw_msg_npc : to_translation( "" ), + mon_name ); // Items strapped to you may fall off as you hit the ground // when you break out of a grab you have a chance to lose some things from your pockets @@ -917,8 +922,9 @@ void melee_actor::on_damage( monster &z, Creature &target, dealt_damage_instance const bodypart_id &bp = dealt.bp_hit ; const std::string mon_name = get_player_character().sees( z.pos() ) ? z.disp_name( false, true ) : _( "Something" ); - target.add_msg_player_or_npc( msg_type, hit_dmg_u, hit_dmg_npc, mon_name, - body_part_name_accusative( bp ) ); + target.add_msg_player_or_npc( msg_type, hit_dmg_u, + get_option( "LOG_MONSTER_ATTACK_MONSTER" ) ? hit_dmg_npc : to_translation( "" ), + mon_name, body_part_name_accusative( bp ) ); for( const mon_effect_data &eff : effects ) { if( x_in_y( eff.chance, 100 ) ) { diff --git a/src/monmove.cpp b/src/monmove.cpp index bc506801f7007..2fd7492c97e68 100644 --- a/src/monmove.cpp +++ b/src/monmove.cpp @@ -37,6 +37,7 @@ #include "monster_oracle.h" #include "mtype.h" #include "npc.h" +#include "options.h" #include "pathfinding.h" #include "pimpl.h" #include "rng.h" @@ -1780,15 +1781,19 @@ bool monster::move_to( const tripoint &p, bool force, bool step_on_critter, if( flies() ) { moves -= 100; force = true; - add_msg_if_player_sees( *this, _( "The %1$s flies over the %2$s." ), name(), - here.has_flag_furn( ter_furn_flag::TFLAG_CLIMBABLE, p ) ? here.furnname( p ) : - here.tername( p ) ); + if( get_option( "LOG_MONSTER_MOVEMENT" ) ) { + add_msg_if_player_sees( *this, _( "The %1$s flies over the %2$s." ), name(), + here.has_flag_furn( ter_furn_flag::TFLAG_CLIMBABLE, p ) ? here.furnname( p ) : + here.tername( p ) ); + } } else if( climbs() ) { moves -= 150; force = true; - add_msg_if_player_sees( *this, _( "The %1$s climbs over the %2$s." ), name(), - here.has_flag_furn( ter_furn_flag::TFLAG_CLIMBABLE, p ) ? here.furnname( p ) : - here.tername( p ) ); + if( get_option( "LOG_MONSTER_MOVEMENT" ) ) { + add_msg_if_player_sees( *this, _( "The %1$s climbs over the %2$s." ), name(), + here.has_flag_furn( ter_furn_flag::TFLAG_CLIMBABLE, p ) ? here.furnname( p ) : + here.tername( p ) ); + } } } } @@ -1827,27 +1832,29 @@ bool monster::move_to( const tripoint &p, bool force, bool step_on_critter, has_flag( mon_flag_AQUATIC ) || ( can_submerge() && !here.veh_at( destination ) ) ) && here.is_divable( destination ); - //Birds and other flying creatures flying over the deep water terrain - if( was_water && flies() ) { - if( one_in( 4 ) ) { - add_msg_if_player_sees( *this, m_warning, _( "A %1$s flies over the %2$s!" ), - name(), here.tername( pos() ) ); - } - } else if( was_water && !will_be_water ) { - // Use more dramatic messages for swimming monsters - add_msg_if_player_sees( *this, m_warning, - //~ Message when a monster emerges from water - //~ %1$s: monster name, %2$s: leaps/emerges, %3$s: terrain name - pgettext( "monster movement", "A %1$s %2$s from the %3$s!" ), - name(), swims() || - has_flag( mon_flag_AQUATIC ) ? _( "leaps" ) : _( "emerges" ), here.tername( pos() ) ); - } else if( !was_water && will_be_water ) { - add_msg_if_player_sees( *this, m_warning, pgettext( "monster movement", - //~ Message when a monster enters water - //~ %1$s: monster name, %2$s: dives/sinks, %3$s: terrain name - "A %1$s %2$s into the %3$s!" ), - name(), swims() || - has_flag( mon_flag_AQUATIC ) ? _( "dives" ) : _( "sinks" ), here.tername( destination ) ); + if( get_option( "LOG_MONSTER_MOVEMENT" ) ) { + //Birds and other flying creatures flying over the deep water terrain + if( was_water && flies() ) { + if( one_in( 4 ) ) { + add_msg_if_player_sees( *this, m_warning, _( "A %1$s flies over the %2$s!" ), + name(), here.tername( pos() ) ); + } + } else if( was_water && !will_be_water ) { + // Use more dramatic messages for swimming monsters + add_msg_if_player_sees( *this, m_warning, + //~ Message when a monster emerges from water + //~ %1$s: monster name, %2$s: leaps/emerges, %3$s: terrain name + pgettext( "monster movement", "A %1$s %2$s from the %3$s!" ), + name(), swims() || + has_flag( mon_flag_AQUATIC ) ? _( "leaps" ) : _( "emerges" ), here.tername( pos() ) ); + } else if( !was_water && will_be_water ) { + add_msg_if_player_sees( *this, m_warning, pgettext( "monster movement", + //~ Message when a monster enters water + //~ %1$s: monster name, %2$s: dives/sinks, %3$s: terrain name + "A %1$s %2$s into the %3$s!" ), + name(), swims() || + has_flag( mon_flag_AQUATIC ) ? _( "dives" ) : _( "sinks" ), here.tername( destination ) ); + } } optional_vpart_position vp_orig = here.veh_at( pos() ); diff --git a/src/monster.cpp b/src/monster.cpp index 37f83bbc8d699..b2e185fb84e5e 100644 --- a/src/monster.cpp +++ b/src/monster.cpp @@ -1909,13 +1909,15 @@ bool monster::melee_attack( Creature &target, float accuracy ) add_msg( m_good, _( "Your %1$s hits %2$s for %3$d damage!" ), get_name(), target.disp_name(), total_dealt ); } - if( !u_see_me && u_see_target ) { - add_msg( _( "Something hits the %1$s!" ), target.disp_name() ); - } else if( !u_see_target ) { - add_msg( _( "The %1$s hits something!" ), name() ); - } else { - //~ %1$s: attacker name, %2$s: target creature name - add_msg( _( "The %1$s hits %2$s!" ), name(), target.disp_name() ); + if( get_option( "LOG_MONSTER_ATTACK_MONSTER" ) ) { + if( !u_see_me && u_see_target ) { + add_msg( _( "Something hits the %1$s!" ), target.disp_name() ); + } else if( !u_see_target ) { + add_msg( _( "The %1$s hits something!" ), name() ); + } else { + //~ %1$s: attacker name, %2$s: target creature name + add_msg( _( "The %1$s hits %2$s!" ), name(), target.disp_name() ); + } } } } else if( target.is_avatar() ) { @@ -1941,7 +1943,7 @@ bool monster::melee_attack( Creature &target, float accuracy ) body_part_name_accusative( dealt_dam.bp_hit ), target.disp_name( true ), target.skin_name() ); - } else { + } else if( get_option( "LOG_MONSTER_ATTACK_MONSTER" ) ) { //~ $1s is monster name, %2$s is that monster target name, //~ $3s is target armor name. add_msg( _( "%1$s hits %2$s but is stopped by its %3$s." ), @@ -2127,13 +2129,13 @@ bool monster::move_effects( bool ) bool immediate_break = type->in_species( species_FISH ) || type->in_species( species_MOLLUSK ) || type->in_species( species_ROBOT ) || type->bodytype == "snake" || type->bodytype == "blob"; if( !immediate_break && rng( 0, 900 ) > type->melee_dice * type->melee_sides * 1.5 ) { - if( u_see_me ) { + if( u_see_me && get_option( "LOG_MONSTER_MOVE_EFFECTS" ) ) { add_msg( _( "The %s struggles to break free of its bonds." ), name() ); } } else if( immediate_break ) { remove_effect( effect_tied ); if( tied_item ) { - if( u_see_me ) { + if( u_see_me && get_option( "LOG_MONSTER_MOVE_EFFECTS" ) ) { add_msg( _( "The %s easily slips out of its bonds." ), name() ); } here.add_item_or_charges( pos(), *tied_item ); @@ -2147,7 +2149,7 @@ bool monster::move_effects( bool ) here.add_item_or_charges( pos(), *tied_item ); } tied_item.reset(); - if( u_see_me ) { + if( u_see_me && get_option( "LOG_MONSTER_MOVE_EFFECTS" ) ) { if( broken ) { add_msg( _( "The %s snaps the bindings holding it down." ), name() ); } else { @@ -2161,11 +2163,11 @@ bool monster::move_effects( bool ) } if( has_effect( effect_downed ) ) { if( rng( 0, 40 ) > type->melee_dice * type->melee_sides * 1.5 ) { - if( u_see_me ) { + if( u_see_me && get_option( "LOG_MONSTER_MOVE_EFFECTS" ) ) { add_msg( _( "The %s struggles to stand." ), name() ); } } else { - if( u_see_me ) { + if( u_see_me && get_option( "LOG_MONSTER_MOVE_EFFECTS" ) ) { add_msg( _( "The %s climbs to its feet!" ), name() ); } remove_effect( effect_downed ); @@ -2174,7 +2176,7 @@ bool monster::move_effects( bool ) } if( has_effect( effect_webbed ) ) { if( x_in_y( type->melee_dice * type->melee_sides, 6 * get_effect_int( effect_webbed ) ) ) { - if( u_see_me ) { + if( u_see_me && get_option( "LOG_MONSTER_MOVE_EFFECTS" ) ) { add_msg( _( "The %s breaks free of the webs!" ), name() ); } remove_effect( effect_webbed ); @@ -2184,7 +2186,7 @@ bool monster::move_effects( bool ) if( has_effect( effect_lightsnare ) ) { if( x_in_y( type->melee_dice * type->melee_sides, 12 ) ) { remove_effect( effect_lightsnare ); - if( u_see_me ) { + if( u_see_me && get_option( "LOG_MONSTER_MOVE_EFFECTS" ) ) { add_msg( _( "The %s escapes the light snare!" ), name() ); } } @@ -2196,7 +2198,7 @@ bool monster::move_effects( bool ) remove_effect( effect_heavysnare ); here.spawn_item( pos(), "rope_6" ); here.spawn_item( pos(), "snare_trigger" ); - if( u_see_me ) { + if( u_see_me && get_option( "LOG_MONSTER_MOVE_EFFECTS" ) ) { add_msg( _( "The %s escapes the heavy snare!" ), name() ); } } @@ -2207,7 +2209,7 @@ bool monster::move_effects( bool ) if( type->melee_dice * type->melee_sides >= 18 ) { if( x_in_y( type->melee_dice * type->melee_sides, 200 ) ) { remove_effect( effect_beartrap ); - if( u_see_me ) { + if( u_see_me && get_option( "LOG_MONSTER_MOVE_EFFECTS" ) ) { add_msg( _( "The %s escapes the bear trap!" ), name() ); } } @@ -2217,7 +2219,7 @@ bool monster::move_effects( bool ) if( has_effect( effect_crushed ) ) { if( x_in_y( type->melee_dice * type->melee_sides, 100 ) ) { remove_effect( effect_crushed ); - if( u_see_me ) { + if( u_see_me && get_option( "LOG_MONSTER_MOVE_EFFECTS" ) ) { add_msg( _( "The %s frees itself from the rubble!" ), name() ); } } @@ -2233,7 +2235,7 @@ bool monster::move_effects( bool ) if( rng( 0, 40 ) > type->melee_dice * type->melee_sides ) { return false; } else { - if( u_see_me ) { + if( u_see_me && get_option( "LOG_MONSTER_MOVE_EFFECTS" ) ) { add_msg( _( "The %s escapes the pit!" ), name() ); } remove_effect( effect_in_pit ); @@ -2259,7 +2261,7 @@ bool monster::move_effects( bool ) if( grabber == nullptr ) { remove_effect( grab.get_id() ); add_msg_debug( debugmode::DF_MATTACK, "Orphan grab found and removed" ); - if( u_see_me ) { + if( u_see_me && get_option( "LOG_MONSTER_MOVE_EFFECTS" ) ) { add_msg( _( "The %s is no longer grabbed!" ), name() ); } continue; @@ -2271,7 +2273,7 @@ bool monster::move_effects( bool ) if( !x_in_y( monster, grab_str ) ) { return false; } else { - if( u_see_me ) { + if( u_see_me && get_option( "LOG_MONSTER_MOVE_EFFECTS" ) ) { add_msg( _( "The %s breaks free from the %s's grab!" ), name(), grabber->name() ); } remove_effect( grab.get_id() ); diff --git a/src/options.cpp b/src/options.cpp index defa4cd379e73..0d87df972d4a0 100644 --- a/src/options.cpp +++ b/src/options.cpp @@ -1777,6 +1777,34 @@ void options_manager::add_options_interface() add_empty_line(); + add_option_group( "interface", Group( "additional_messages_in_log", + to_translation( "Additional messages in the log" ), + to_translation( "If true, some additional messages will be shown in the sidebar message log." ) ), + [&]( const std::string & page_id ) { + + add( "LOG_ITEMS_ON_THE_GROUND", page_id, to_translation( "Items on the ground" ), + to_translation( "Show messages about items lying on the ground when character steps on tile with them." ), + true + ); + + add( "LOG_MONSTER_MOVEMENT", page_id, to_translation( "Special monster movement" ), + to_translation( "Show messages about special monster movement: flying over the fence, diving into the water etc." ), + true + ); + + add( "LOG_MONSTER_MOVE_EFFECTS", page_id, to_translation( "Monster attempts to free itself" ), + to_translation( "Show messages about monster trying to free itself from effects preventing it from moving: downed, tied etc." ), + true + ); + + add( "LOG_MONSTER_ATTACK_MONSTER", page_id, to_translation( "Monster/NPC attacking monster/NPC" ), + to_translation( "Show messages about non-playable creatures attacking other non-playable creatures." ), + true + ); + } ); + + add_empty_line(); + add_option_group( "interface", Group( "naming_opts", to_translation( "Naming Options" ), to_translation( "Options regarding the naming of items." ) ), [&]( const std::string & page_id ) {