Cataclysm-dda: Player should be able to attack friendly monsters

Created on 14 Jul 2018  路  9Comments  路  Source: CleverRaven/Cataclysm-DDA

You should be able to attack them regardless, regardless of friendly/hostile status. Currently, you cannot, no matter how well you aim, until the effect completely wears off.

<Suggestion / Discussion> Aiming Character / Player Monsters stale

Most helpful comment

We just need an ability to aim wherever we want, no matter which objects/creatures/what else is located there.
Somewhat related: #21967.

All 9 comments

Poor Aavak :'(
Him and Rycon account for a lot of new traffic...

The code in question starts on line 894 of ranged.cpp

    auto update_targets = [&]( int range, std::vector<Creature *>& targets, int &idx, tripoint &dst ) {
    targets = pc.get_targetable_creatures( range );

    targets.erase( std::remove_if( targets.begin(), targets.end(), [&]( const Creature *e ) {
        return pc.attitude_to( *e ) == Creature::Attitude::A_FRIENDLY;
    } ), targets.end() );

    if( targets.empty() ) {
        idx = -1;
        return;
    }

    std::sort( targets.begin(), targets.end(), [&]( const Creature *lhs, const Creature *rhs ) {
        return rl_dist( lhs->pos(), pc.pos() ) < rl_dist( rhs->pos(), pc.pos() );
    } );

    // @todo: last_target should be member of target_handler
    const auto found = std::find( targets.begin(), targets.end(), g->last_target.lock().get() );
    idx = found != targets.end() ? std::distance( targets.begin(), found ) : 0;
    dst = targets[ target ]->pos();
    };

We could remove the targets.erase() line but then friendly pets would be suggested as potential targets more often that you'd really want.
Change it to something like:

return pc.attitude_to( *e ) == Creature::Attitude::A_FRIENDLY && !e.is_zombie();
??? Because no one REALLY cares about accidentally killing a pet zombie

It's not a case of wanting them suggested as targets, but about when you DO target them specifically and deliberately attack them (NPCs too!), it should actually attempt an attack against them instead of whistling right by.

And yes, Aavak is who had this happen that I saw, but that death was entirely his own fault for not running away from the zombie grenadier afterwards :P His interactions just made me note this issue, is all.

This is also an issue for mycus characters, it is quite possible to end up with multiple fungaloids and/or spores inside your base/vehicle with no way to remove them except fire, explosives, or unaimed firing at the square.

We just need an ability to aim wherever we want, no matter which objects/creatures/what else is located there.
Somewhat related: #21967.

That plus an option to attack neutral/friendly target in melee -- not everyone uses ranged weaponry, though just letting you target ranged would be a huge improvement.

maybe my memery serves me wrong but there at least was similiar issue with infr red googles allowing you to see enemies in night but not shoot on them.dont know if it is still problem.

Renamed title to more generic issue.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

This issue has been automatically closed due to lack of activity. This does not mean that we do not value the issue. Feel free to request that it be re-opened if you are going to actively work on it

Was this page helpful?
0 / 5 - 0 ratings