Can someone make the full automatic weapon stop targeting non-hostile?

I like to use full automatic weapon, but there is a problem, it will auto shooting non-hostile target nearby if the hostile target are killed on full automatic mode, even sometime shooting on a friendly target,

It was unnecessary for that, and only force nearby target become hostile and attack you, so please, can someone edit this targeting system only shoot hostile?

or make a targeting switch between, all target, no targeting friendly, hostile only?