RimWorld

RimWorld

76 ratings
Turrets Shoot Hunting Predators
   
Award
Favorite
Favorited
Unfavorite
Mod, 1.4, 1.5, 1.6
File Size
Posted
Updated
452.700 KB
13 Apr, 2024 @ 3:04pm
11 Jul @ 10:05am
5 Change Notes ( view )

Subscribe to download
Turrets Shoot Hunting Predators

Description


Something that I feel should always have been vanilla behavior. Turrets now target predators hunting your pawns.

Instead of the traditional approach of constantly scanning everything in the map, we make a cache of pawns (animals in this case) that have the predatorHunt job. If the target for that job is a pawn that belongs to your faction, once they are in range of turrets, these will take notice and fire at the animal.

Note: This is different from manhunting animals. Manhunting animals are automatically shot by turrets in vanilla behavior regardless.

This also patches an exception that becomes more common with this mod. Normally, in vanilla, turrets will sometimes not be counted as instigators for the purpose of manhunter chance calculations. Before those calculations happen, this mod will make sure that the instigator is not null nor the instigator's ideologies are null. If one or the other are null, it will return the default calculation value, if not, the original vanilla code will take over.

Incompatibility List

Animals Logic (Has logic to handle this already, but I felt it didn't work at times, which is why I made this patch.)
Their function to shoot hunting predators can be disabled in their mod options, so you can still use all the logic from it alongside this as long as you disable that.
https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=1098354593

Combat Extended Drastically changes targeting checks. As this hooks into vanilla checks to do what it does, this mod ceases to function.
https://steamhost.cn/steamcommunity_com/workshop/filedetails/?id=2890901044

Any mod that replaces the vanilla turret TryFindNewTarget functions entirely instead of patching them



Credits: Baal Evan from Turret Auto Hunt for idea and code snippet I started developing this on.
22 Comments
Pheace 13 Jul @ 8:34am 
Thanks for trying anyway. Agreed performance is a crucial thing here.
Archie  [author] 13 Jul @ 8:31am 
I tried, but unfortunately I need to hook into a function that hugslib has that is called whenever a map is loaded. That's when the cache of predators that are manhunting gets repopulated. I could simply do away with the cache approach but the performance impact would be heavier, I feel.

And given how turrets already cause a decent performance impact by default if you have too many of them, I'm worried doing this could be a problem.
Pheace 13 Jul @ 8:00am 
Thanks for the update. Any chance hugslib requirement could be removed?
Archie  [author] 11 Jul @ 10:08am 
Update out. Either wait for the official hugslib to be updated or use the community fork that is already updated for 1.6. Happy hunting!
Archie  [author] 4 Jul @ 5:25pm 
When 1.6 comes out. :bfengineer:
thorman123456789 4 Jul @ 12:40pm 
1.6 please?
Archie  [author] 14 Dec, 2024 @ 8:16pm 
Also I do not remember what adds those walls but they were reinforced walls.
Archie  [author] 14 Dec, 2024 @ 8:16pm 
I unfortunately don't think I can. CE has its own patches that replace the TryFindNewTarger function and depends on its own functionality, sorry chief.
Lord Bloodfart 11 Dec, 2024 @ 11:17am 
bröther, could you please make a version that supports CE? If that is possible?
Ravenfire 13 Aug, 2024 @ 2:05pm 
what adds those walls?