Friendly Fire Tweaks

MOD Desc
Changes how friendly fire works, allowing you to customize or remove it entirely.

Works for both the player, and the AI.
Includes mod added weapons and turrets.
Safe to add to or remove from games in progress.
You can still target friendly pawns manually.

Features

        

  • Option to make shooting skill affect friendly fire chances, with a customizable percent reduction per skill level..

Settings to disable friendly fire for

        

  • Things in the same faction as the shooter.
        
  • Things in any allies of the shooter’s faction.
        
  • Things in factions neutral to the shooter’s faction.

for

        

  • Pawns
        
  • Animals
        
  • Buildings
        
  • Mountain Stones/Resources

each option can be toggled separately. So if you want to protect just animals of your faction you can do so, or you can just protect the mountain stone/resources, maybe just wild animals? The choice is yours.

Know Incompatibles

        

  • Combat Extended. Use Avoid Friendly Fire instead.
        
  • Cybernetic Warfare and Special Weapons. It’s not a hard incompatibility but weapons from it can still cause friendly fire. It seems to use its own hit detection code and not the base games.

Technical Info It works by using Harmony to prefix patch Projectile.CanHit disabling friendly fire according to the users settings.

Permissions Feel free to take this mod and do whatever you want with it.



  • I’m getting this error rapidly, dunno what it is and why it happened, but it sure does slow the game.Exception ticking Spark2535199 (at (0, 0, 0)): System.NullReferenceException: Object reference not set to an instance of an objectat (wrapper dynamic-method) RimWorld.GenHostility.HostileTo_Patch2 (Verse.Thing,Verse.Thing) at No_Friendly_Fire.Harmony_Patches.Projectile_CanHit.Prefix (Verse.Projectile,bool&,Verse.Thing) at (wrapper dynamic-method) Verse.Projectile.CanHit_Patch2 (object,Verse.Thing) at Verse.Projectile.ImpactSomething () at (wrapper dynamic-method) Verse.Projectile.Tick_Patch0 (object) at (wrapper dynamic-method) Verse.TickList.Tick_Patch2 (object) Verse.Log:Error(String, Boolean)Verse.TickList:Tick_Patch2(Object)Verse.TickManager:DoSingleTick()Verse.TickManager:TickManagerUpdate()Verse.Game:UpdatePlay()Verse.Root_Play:Update()
  • I got this.Exception ticking Spark4422164 (at (100, 0, 38)): System.InvalidCastException: Cannot cast from source type to destination type.at No_Friendly_Fire.Harmony_Patches.Projectile_CanHit.GetHitChance (Verse.Thing) at No_Friendly_Fire.Harmony_Patches.Projectile_CanHit.Prefix (Verse.Projectile,bool&,Verse.Thing) at (wrapper dynamic-method) Verse.Projectile.CanHit_Patch1 (object,Verse.Thing) at Verse.Projectile.ImpactSomething () at Verse.Projectile.Tick () at Verse.TickList.Tick () Verse.Log:Error(String, Boolean)Verse.TickList:Tick()Verse.TickManager:DoSingleTick()Verse.TickManager:TickManagerUpdate()Verse.Game:UpdatePlay()Verse.Root_Play:Update()There are 2 things I did before this happened. Accidentally hit debug button in RunTimeGC and added RimCities and Humanoid Alien Races 2.0. I don’t know if this is going to help you narrow it down for the solution, I hope it will.
  • I have an issue where I ha e a mountain base, inside the base there Is a tiny section which isn’t covered by mountain where i store 4 mortars, when i used this mod the mortars crashed into the wall that surrounded them.My other issue and reason for downloading his is that I have a particularly nasty gun line of auto cannons uranium slug cannons and mini-turrets that have been the reason for at least 4 of my colonist deaths, they don’t even get a chance, one autocannon shot or uranium slug round and they are instagibbed
  • Just released a new version, there may be some bugs or issues please let me know if you run into anything.I removed the 0Harmony.dll from the 1.1 version for compatibility, make sure you subscribe to / install Harmony I’ve changed the mod settings to make customizing friendly fire easier. You now can set exactly what and who you want to protect. The downside of this is that you have to reset the settings to how you had them.Options include for who to protect are- The same faction as the shooter.- Factions the are an ally of the shooter’s faction.- Factions that are neutral to the shooter’s faction.and for what to protect your options are- Pawns- Animals- Buildings- Mountain Stones/ResourcesTell me if you would like something added to this list.In other news the source code should be included from now on, feel free to use it however you want.It should be fixed now.
  • The bugged out overtime might not actually exist, it might just be some kind of inconsistence with colonist’s aiming. I am kind of glad to know that I am not the only one having the same issue though, at least we can target for a mod conflict from both me and Xander mod used, maybe? It didn’t matter the wall types, either rocks or wall I built, as long as it is over 2 block thick (or maybe 3) it will stop the mortar shots. Basically the mortar shots won’t go through anything with a roof, or anything that’s too thick to see the roof type hidden from fog of war(thus I said 3 block thick. I observes these while shooting the mortars with roof view turned on, so I kind of observe them hitting the roof tile. But I might be wrong, after all, the shots are super fast to have a clear view. lol
  • It’s might be a bug, it might be a conflict. I recently noticed that my mortars cannot shoot through any walls that’s 2 block thick. This pretty much turns mortars into a very expensive, immobile, and no short range ability super sniper. I cannot hit anything if there is something blocking the mortar and the target. After I fiddles around with the mod option of ‘friendly fire on stone, the mortar can sometimes shoot through the walls, but most often it still doesn’t go through, so I decided to removed this mod, and everything went normal now. Just letting you know.

Leave a Reply

Your email address will not be published. Required fields are marked *