CombatExtended-Continued / CombatExtended

Combat Extended mod for RimWorld
377 stars 255 forks source link

[Bug]: Friendly factions caught in crossfire cause relations loss when not the pawn target #2459

Open pogoman opened 1 year ago

pogoman commented 1 year ago

Latest version CE. To test spawn trade caravan, spawn mech behind caravan, shoot mech with minigun. You should not actually lose faction relations for this action. The reason you do in CE is intendedTarget is never set when creating DamageInfo. This needs to be set here: image and here: image

Without these changes this function is always false: image

pogoman commented 1 year ago

And for explosions add intendedTarget to launch: image and address all compiler errors: image etc

pogoman commented 1 year ago

and for amour: image

N7Huntsman commented 1 year ago

How does this compare to vanilla behavior? Because it seems fairly reasonable to me that you lose relations for hitting a neutral/friendly NPC with gunfire--intentional, or not.

pogoman commented 1 year ago

Vanilla you do not lose relations. It's why the mutual crossfire function exists. Note you have to be targeting a mutual hostile you can't just shoot a wall behind an ally or something. I realise there is some level of exploitability with this function working however when it comes to game design i would argue being able to exploit a mechanic in niche situations (the friendly faction basically has to be directly between you and the enemy), is far less detrimental than the experience of being severely punished for something that isn't your fault. Additionally this is a single player game, i can choose to not exploit a mechanic and feel good about not doing it. What doesn't feel good is going from +100 to -100 with the Empire in 1.5 seconds because the AI decided to wander between a Minigun burst and centipede (this is not an exaggeration one burst is all it takes and it has happened to me numerous times). I play commitment mode and events that make you want to stop playing the game like this are imo major problems. Yes i can devmode it but i would prefer it didn't happen in the first place which is why i dug through the code. It was the same with the running for cover mechanic getting pawns killed because they were more scared of smoke than bullets. Punishing the player for bad AI behaviour/events they can't control makes them want to stop playing the game.

Hope that makes sense! I'm clearly a little passionate about the issue aha so if you do decide to address it i can provide a PR if that helps.

pogoman commented 1 year ago

Again if you want to test Vanilla give your pawn a Minigun spawn a trade caravan spawn a centipede behind the caravan target the centipede with the Minigun and you will hit loads of friendlies with no relations loss.