Skip to content

Commit

Permalink
Factions don't mind the player smashing zombie corpses
Browse files Browse the repository at this point in the history
  • Loading branch information
RenechCDDA committed Oct 29, 2024
1 parent 79b8ed9 commit 9f7cc9f
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions src/handle_action.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -902,6 +902,12 @@ static void haul_toggle()
get_avatar().toggle_hauling();
}

static bool is_smashable_corpse( const item &maybe_corpse )
{
return maybe_corpse.is_corpse() && maybe_corpse.damage() < maybe_corpse.max_damage() &&
maybe_corpse.can_revive();
}

static void smash()
{
const bool allow_floor_bash = debug_mode; // Should later become "true"
Expand All @@ -911,7 +917,17 @@ static void smash()
}
tripoint_bub_ms smashp = tripoint_bub_ms( *smashp_ );

if( !g->warn_player_maybe_anger_local_faction( true ) ) {
// Little hack: If there's a smashable corpse, it'll always be bashed first. So don't bother warning about
// terain smashing unless it's actually possible.
bool smashable_corpse_at_target = false;
for( const item &maybe_corpse : get_map().i_at( smashp ) ) {
if( is_smashable_corpse( maybe_corpse ) ) {
smashable_corpse_at_target = true;
break;
}
}

if( !smashable_corpse_at_target && !g->warn_player_maybe_anger_local_faction( true ) ) {
return; // player declined to smash faction's stuff
}

Expand Down Expand Up @@ -1003,8 +1019,7 @@ avatar::smash_result avatar::smash( tripoint_bub_ms &smashp )

bool should_pulp = false;
for( const item &maybe_corpse : here.i_at( smashp ) ) {
if( maybe_corpse.is_corpse() && maybe_corpse.damage() < maybe_corpse.max_damage() &&
maybe_corpse.can_revive() ) {
if( is_smashable_corpse( maybe_corpse ) ) {
if( maybe_corpse.get_mtype()->bloodType()->has_acid &&
!is_immune_field( fd_acid ) ) {
if( !query_yn( _( "Are you sure you want to pulp an acid filled corpse?" ) ) ) {
Expand Down

0 comments on commit 9f7cc9f

Please sign in to comment.