RimWorld

RimWorld

Avoid Friendly Fire - 1.6
16 Comments
MatrixVirus 14 Aug @ 7:34pm 
work for vehicles from VVE?
PathToV1ctory  [author] 14 Aug @ 6:42pm 
@JimmSlimm
Thank you for the kind words, but the vast majority of this mod was done by the original author, Falconne. I have adopted it for maintenance, and only made some minor adjustments to try and optimize.

Those seem like good suggestions for optimizing it even further, thank you very much! I'll test them sometime soon.
JimmSlimm 14 Aug @ 2:35pm 
Hey, I just wanted to say that your mod is awesome, and I learned a lot from your code on GitHub while working on my own project.
To give something back, I found a couple of ways to optimize your GetFireCone function that should give a really nice performance boost.
Here's an image explaining the ideas: https://postimg.cc/sQy6GsKB
And here's the code changes you'd need: https://justpaste.it/6kn41
Jarrod 5 Aug @ 6:30pm 
@GetUrAssToMars I'm like 90% sure this *is* tied to the skill. There's a setting to make it *not* tied to the shooting skill.
GetUrAssToMars 5 Aug @ 8:38am 
It would be amazing if this could be somehow tied into the pawns ranged skill.
Jarrod 5 Aug @ 6:20am 
Yo bless you for the optimizations. It makes this work way better with the "search and destroy" mod which turned the game into a slideshow when you turned it on. Now it's smooth as butter.
PathToV1ctory  [author] 4 Aug @ 3:45pm 
V1.6.1 - Optimized logic for checking if it is safe for pawns to fire. Now checks the firecone for pawns, instead of checking if pawns are in the firecone.


In testing, this update made me able to maintain 60TPS (8-10ms/t) with 15 friendlies and 120 enemies in combat.
The previous version brought me down to <30TPS (well over 40ms/t) in a similar situation; less than half of the target TPS for 1x speed.
ObscureParticle 4 Aug @ 9:15am 
@Guedez, depends on the difficulty, at higher difficulties friendly fire is more likely to happen, and when you have high dmg weapons like lances or such, these can easily one shot a pawn, it's even an issue when you have multiple people hunting.
Guedez 4 Aug @ 5:27am 
Is this mod even needed? I feel like bullets barely ever hit friendlies at all. I have my pawns in a lazy circle formation and they shoot through each other with no issue. I see one friendly fire hit every 300 bullets or something
ObscureParticle 30 Jul @ 5:35pm 
Can I use this without HugsLib?
fbarba2017 27 Jul @ 8:18am 
YASSS Thank you for this!!
BlueTressym 24 Jul @ 8:39pm 
Thank you for saving this mod, much appreciated.
PathToV1ctory  [author] 24 Jul @ 8:29am 
To me, turning off friendly fire feels weird and kind of cheaty, because it absolutely SHOULD be able to happen. It just should occur very very rarely, in specific circumstances, when you decide the risk is worth the reward.

Removing friendly fire entirely makes REALLY cheesy tactics possible, like a pawn stopping raiders at a door while getting friendly bullets sprayed straight through them. It just makes your pawns better with no consequence. Positioning relative to the gunners matters a lot less.

This mod instead makes your pawns smart enough to NOT shoot near each other (unless specifically told to). It's similar, but not the same. Your firing line will stop firing when a pawn moves in between them and their target. In order to prevent friendly fire, you lose out on possible damage.
bugsbony 24 Jul @ 8:26am 
Thanks for porting this mod.

@Bakker Joop: this mod is very different from disabling friendly fire. It allows you to tell your pawns to not fire if there is a chance of friendly fire.
ThroatGOAT 24 Jul @ 5:31am 
You a real one for that, Bakker.
Bakker Joop 24 Jul @ 4:49am 
For anyone using this mod: You can disable friendly fire in the story teller settings (or set it to any percentage you want) in the vanilla game. This mod is not needed.