CombatExtended-Continued / CombatExtended

Combat Extended mod for RimWorld
377 stars 254 forks source link

[Bug]: CE breaks smart raid turret avoid grid generation #2396

Open pogoman opened 1 year ago

pogoman commented 1 year ago

Rimworld version: Latest Combat Extended version: Latest Combat Extended source (Steam, GitHub, etc.): Any Your operating system: Windows 11 Your mod list: CE

Easy to check. Go into dev mode and enable show avoid grid. There is none painted for turrets while CE is loaded. Makes the AI considerably dumber and non difference between regular and smart raids.

I have a patch in my mod to fix this issue: https://github.com/pogoman/All-Raids-Can-Breach/blob/master/Source/Pogoman/Patches/CE/AvoidGrid.cs

Complete the following checklist I hereby verify that I have done the following:

AluminumAlman commented 1 year ago

IIRC removing the avoid grid was done with the intent to stop sappers from being funneled by turrets into turret-less, walled-in killboxes. If need be, CE's change can be removed most likely by removing https://github.com/CombatExtended-Continued/CombatExtended/blob/Development/Source/CombatExtended/Harmony/Harmony_AvoidGrid.cs

pogoman commented 1 year ago

I tried removing that transpile patch it had no effect. The reason it doesnt gen the avoid grid is allBuildingsColonist[i].def.building.ai_combatDangerous returns a list of Building_TurretGunCE, not Building_TurretGun which the vanilla code is looking for when generating the grid

pogoman commented 1 year ago

In any case, if you want better sapper AI, not to be that guy but check out the changes in my mod https://steamcommunity.com/sharedfiles/filedetails/?id=2945497357

The number one reason raiders enter killboxes is because of JobGiver_AIGotoNearestHostile and JobGiver_AITrashBuildingsDistant. The standard rimworld player setup is to make the killbox, open the door to the colony, the AI sees theres a path and goes there immediately. If you disable these jobs then make a few changes to the sapper AI (using findpath with avoid grid checking), you will get AI that saps intelligently when there is no safe path into the colony. All of this can literally be achieved with the small changes i make to JobGiver_AISapper and disabling the other two jobs, but it requires the avoid grid to exist