Skip to content

Commit

Permalink
Merge pull request #77426 from RenechCDDA/factions_dont_mind_u_smashi…
Browse files Browse the repository at this point in the history
…ng_corpses

Factions don't mind the player smashing zombie corpses
  • Loading branch information
Maleclypse authored Oct 29, 2024
2 parents ad8047d + d4bcc22 commit 64914b4
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 @@ -905,6 +905,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 @@ -914,7 +920,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
// terrain 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 @@ -1006,8 +1022,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 64914b4

Please sign in to comment.