RimWorld

RimWorld

2,845 ratings
Avoid Friendly Fire
2
9
6
   
Award
Favorite
Favorited
Unfavorite
Mod, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5
File Size
Posted
Updated
342.690 KB
Sep 13, 2017 @ 12:47am
Apr 29, 2024 @ 2:31am
31 Change Notes ( view )

Subscribe to download
Avoid Friendly Fire

Description
This mod has performance issues with lots of pawns. Unfortunately I don't have time to improve it, but the code is on Github if anyone can help.

Colonists with the option enabled will not take a shot if the projectile's path could hit a friendly or neutral pawn (taking into account miss radius). Drafted colonists will look for a target with a clean shot (or wait if there isn't one), while hunters will reposition themselves.

This should hopefully alleviate some of the micromanagement needed to stop ranged colonists shooting friendlies, without changing the way friendly fire works in the game or reducing its potency.


== Usage ==
Any colonist with an appropriate weapon will show an “Avoid Friendly Fire” toggle button when they are selected (which is On by default; you can toggle it off for individual colonists). With this On their AI will automatically do the right thing.

If you manually try to force a drafted colonist who is set to avoid friendly fire to shoot an enemy with a friendly in the way, you will see a "Cannot hit target" message as you would if LoS was blocked.

Shooters who are being blocked by friendlies (but would otherwise have a target) will have their name on the map and in the Colonist Bar be written in cyan. Likewise, the first friendly blocking any shooter will show up in green.

There is a setting in the Mod Options screen to always enable 'Avoid FF' status on a pawn when it's undrafted. If you tend to disable the 'Avoid FF' setting on pawns during combat, using this option will ensure it is always turned back on again before the next combat. This option is off by default.

== Shield Belts ==
Shooters will not worry about pawns wearing a shield belt with at least 10% power standing in the line of fire, so you can still use shielded infantry to attack while ranged troops continue to fire over them from behind. If the shield drops below 10% power while the pawn is still subject to friendly fire, then the shooters will stop. They will resume shooting after the shield gets above 10%.

This behaviour can be disabled from the mod options if needed.


== Targeting Overlay ==
If you use the game’s manual targeting button (the one with the B hotkey that then shows the weapons range), you will see a red overlay that appears from the shooter to where you point the mouse (see image). This overlay shows the potential “fire cone” from a standard ranged weapon in the game, from the shooter to a target under the mouse (miss radius depends on weapon and shooter skill). Any pawn within the red overlay could potentially be hit. This is purely a visual aid for planning and can be disabled from the Mod Settings menu if you don’t like it. Note that pawns within 4 tiles of the shooter do not receive friendly fire, so the overlay does not mark them red and the mod takes this into account when deciding if a shooter should stop. In the example image the shooter on the top right will not shoot the pirate on the bottom left because the colonist "Flip" could potentially get hit.


== Animals ==
By default the mod will also take into account animals with an assigned master and protect them from friendly fire, so you should be able to use and release trained animals without them getting shot. In the Mod Settings you can expand this to include all tamed colony animals, such as livestock, but this is off by default as it could be annoying and cause performance issues on slower machines.


== Notes ==
This mod can be added to an existing save.

This mod is compatible with the Combat Extended mod, however the more complex fire trajectory in CE may mean this mod may not be 100% effective at very long ranges.

It is an often requested feature to add FF avoidance to turrets. However I want my mods to be pure QoL changes and not affect the balance of the game. The improvised turrets are cheap and friendly fire is an intended weakness of them (as mentioned in their tooltip). I am happy for another mod that adds smarter, more expensive turrets to incorporate my code to provide that functionality.


== Current Limitations ==
* Does not support explosive weapons such as grenades and weapons such as miniguns with a large forced miss radius. They will be used as normal and you will need to micromanage them as before. These might be supported in the future.

* Will protect neutral pawns on your map, but not animals owned by them. E.g., if there are traders around during a raid, your colonists will avoid hitting them but not watch out for their animals. Should be fixed in the future.

* Only affects the AI of your colonists. Does not prevent the computer controlled factions shooting their own troops; that’s a hard problem.

* Only affects the AI of shooters, who will stop shooting when someone gets in the way. Nothing is done to stop undrafted pawns from wandering into the middle of battle; again a harder problem to solve.

Github release for standalone install: https://github.com/Falconne/AvoidFriendlyFire/releases
Ludeon Thread: https://ludeon.com/forums/index.php?topic=35571.0

Translations:
* Japanese by @Proxyer
* Traditional Chinese by @FantasyMusic
Popular Discussions View All (2)
46
Jan 11 @ 10:45am
Bug Reports
falconne
6
Nov 11, 2018 @ 3:41pm
percentage based friendly fire
Jojojay
425 Comments
NewFutureBoy Mar 26 @ 10:42pm 
This is the most underrated mod. My #1 personally and I'm devastated it is dead. I think I will try a new game still but if my colonists start shooting each-other in the back for no reason I will be done... for a while.
Andrei Jan 25 @ 5:01pm 
description says it's compatible with CE, but mod manager says it's not? Which is it?
398610 Jan 11 @ 11:21am 
Targeting Overlay is good。 maybe it should standalone.
falconne  [author] Jul 27, 2024 @ 3:17pm 
I will set this mod as unlisted as new people are subscribing without reading the description. As mentioned I haven't had time to work on this in years. The base game code has changed significantly since then.

Hopefully someone else picks up the development and fixes the the performance issues. It should be fixable as it used to work fine in the early days. There will be some change to the game code since then that needs adapting in this mod.

If someone picks this up, they can either post up their own workshop item, or message me on Github and I'll make them a maintainer for this mod to continue development.
<>*^*<> Jul 24, 2024 @ 3:16am 
Poorly coded - my rimworld becomes CPU limited when I draft 15 colonists with this .... you should only do the friendly fire check when pawns actually try and fire
Santas Helper Jun 15, 2024 @ 2:28pm 
I've noticed the mod lags with increase in ENEMY pawns, but not so much with friendly ones... the mod isn't trying to apply the rules to enemy pawns as well is it? cause that is a LOT of pawns to have to worry about not shooting each other. Just a thought I was having. If the mod is trying to dictate whether or not enemies should shoot, that would explain the massive latency during raids. I tend to use it normally, but if I get raided, I turn it off (love that feature!!!) because the game nearly stands still with 80+ pawns on the map.
MiTHRiL Jun 5, 2024 @ 7:23am 
The first 2 lines in the description literally answer everything.
Do something with your mindfulness.

Asking, demanding, judging and crying on the Internet is the worst thing you can do and practice shows that it doesn’t work and gets on people’s nerves.

Do you want something similar, but without problems and with support?
Gather a group of similar interests and pay the guys who make mods for money.
Narlindir May 26, 2024 @ 4:52pm 
people are talking sht on you on dubs subreddit

"Avoid Friendly Fire - impressively atrocious still. Up to 600 ms spikes. Save yourself the torture."

I dont condone talking smack
but 600ms is 600 times wors then really bad mods
might want to ring up some favors and step up your coding game and improve at your craft!
GiannisAntetogoku May 9, 2024 @ 9:51am 
No errors in error log but pawn UI disappears with this mod.
Vengorin Apr 30, 2024 @ 10:53am 
I have the same issue as below ... suddenly pawn control ui is missing and may be a conflict but issue goes away when i remove this mod.