Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Factions don't mind the player smashing zombie corpses #77426

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
// 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 @@ -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
Loading