边缘世界 RimWorld

边缘世界 RimWorld

70 个评价
Better Grenade Handling
2
2
   
奖励
收藏
已收藏
取消收藏
Mod, 1.6
文件大小
发表于
更新日期
668.743 KB
10 月 24 日 上午 12:02
11 月 14 日 上午 5:10
5 项改动说明 ( 查看 )

订阅以下载
Better Grenade Handling

描述
This mod is for people who want their colonists to behave professionally while wielding explosives. Avoiding friendly fire is the core feature.

Better Grenade Handling v1.1.3

If you encounter any bugs - let me know. I'll try to fix them as soon as I can.

Showcase
Never target enemies if friendly fire is possible



Automatically target non-stunned mechs



Pawns are more careful with explosives around



Partial mortar support


Full list of features
  • Pawns will avoid launching an explosive if there is at least 1 ally in blast radius + forced miss radius, including friendly factions/caravans too.

  • Pawns will, however, launch incendiary projectiles, such as molotov, if overall heat armor of an ally is >90% or flammability is less than 10% (impids, phoenix armor)

  • Pawns will launch toxic projectiles if allies in affected area have sufficient protection, like gasmask.
    Toxic raiders launch toxic projectiles no matter what.

  • Pawns avoid traversing over area where explosive is about to impact or is already present. Only works for friendly factions. Mortars are supported

  • If pawn is forced to launch an explosive(bypasses friendly fire checks) then any ally that happens to be in the blast area will flee out of it. Mortars are supported

  • Pawns equpped with EMP won't target already EMP-stunned mechs - eliminates the dumb behavior when they target the same mech over and over again. Also they automatically target enemies wearing shield-belts - a capability the vanilla game clearly lacks.

  • Pawns try to cause as much damage with explosives as possible by choosing much more tightly packed groups of enemies through the in-game target score system. Increases the DPS.

  • You can customize some parts of the mod to your liking. Supported languages: English and Russian.

  • All of the above applies to enemy raiders too. Now they will value their own lives more and won't shoot rockets at you if it involves any friendly fire.
Source code/No-Steam version
[github.com]

Donate
I accept donations on https://boosty.to/royalspudi/donate
[boosty.to]

Technical debrief
This mod was particularly challenging to optimize. Since you have to check for pawns in a specific radius - you always have +1 loop to deal with. Achieving considerable performance was roughly ~80% of total effort. This mod is still probably going to add 0.1-0.2 ms overhead that scales linearly depending on how many grenadiers and targets you have on the map. But it barely matters, we’re bringing an entire weapon category back to life after the devs abandoned it. And outside of any combat it is barely visible in profiler.

How it works:
Firstly, we check for friendlies initially when a pawn enters combat(drafted or whatever). Not always the case though.

Then we check for friendlies every time any Thing in game changes its position(Thing.Position set method patch). It is built on 2 assumptions:
1) Initially, we assume that moved thing is an ally that we don't want to hit. It's a cheap O(1) check - just compare distance from target to ally. Add target we're aiming at to blacklist if conditions are met.
2) After that we assume that moved thing may be an enemy that is moving towards our ally. This time it's O(n) since we need to search for any possible ally in blast radius around our target. Add target to blacklist if at least 1 ally has been found.

I tried to be brief though, there is a lot more little details under the hood.

There is also trajectory prediction system that I've been working on, but abandoned shortly after. Check it out on github if you ever want to finish it.
热门讨论 查看全部(1)
13
11 月 17 日 上午 9:52
置顶: Bug report
UracosVereches
36 条留言
UracosVereches  [作者] 12 月 4 日 下午 10:47 
damn, they might actually be doing that. i completely slept on the smoke launcher while making this mod, lol
Mumei 12 月 4 日 下午 7:26 
Seem like they dodge smoke launcher even though it doesn't deal damage?
Margatroid 11 月 21 日 下午 4:16 
Красная ошибка с нововышедшим модом Vanilla Gravship Expanded при использовании Gauses gun
https://gist.github.com/HugsLibRecordKeeper/f1b23227b1ea6a50bd3e79ca80a41cc9
Kuya Cola Original 11 月 21 日 上午 7:26 
works fine with ce:steamhappy:
MajorityOfTheInternet 11 月 5 日 上午 4:19 
https://pastebin.com/raw/4ztt6yTG
Seems to pop literally every second with this mod? At least it says its this mod but what is with this legodude?
Killer29687 11 月 5 日 上午 2:22 
imagine if rimworlds code was actually good... why would they code it that way? hell its friendly fire galore, ♥♥♥♥ that 1 dude whose charging at us while theres 50 pawns behind them and us.... oh? that rocket launcher looks nice.... shame its absolutely useless in mass fights despite them more or less suppose to be for it....
UracosVereches  [作者] 11 月 4 日 下午 11:52 
bro i swear, it's almost like pawns are designed to explode each other to pieces and i ♥♥♥♥ you ♥♥♥♥♥♥♥ not - the way target searching works is that pawns prioritize targets that are the closest to them. and enemies charging at you in melee just happen to be the highest priority targets for anyone with ranged weapons. explosives are literally designed for you to fail in this game, i'm glad i finally fixed that. personally, grenades quickly went from beyond useless to overly helpful combat tool.
Killer29687 11 月 4 日 下午 1:46 
thanks for the mod, after doing a mod quest and seeing TEN ALLY PAWNS ALL GET HIT BY FRIENDLY FIRE ROCKET... and then another 5 by grenades? i just couldnt take it anymore
UracosVereches  [作者] 11 月 4 日 上午 10:39 
well, you tell me, cus i never played with combat extended before. never heard any reports about CE compatibility.
Ranger Dimitri 11 月 3 日 上午 12:36 
So does this mod work with Combat Extended? I don't use it much myself but is interesting to know since it has a different system regarding ranged combat.