Skip to content

Commit

Permalink
Merge pull request #2910 from CombatExtended-Continued/Grenade_Throwi…
Browse files Browse the repository at this point in the history
…ng_Fix

Incorrect adjacent cells collect
  • Loading branch information
N7Huntsman authored Dec 15, 2023
2 parents 188a269 + bcb122a commit e10cac4
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions Source/CombatExtended/CombatExtended/Projectiles/ProjectileCE.cs
Original file line number Diff line number Diff line change
Expand Up @@ -849,8 +849,18 @@ private bool CheckCellForCollision(IntVec3 cell)

//Find pawns in adjacent cells and append them to main list
var adjList = new List<IntVec3>();
adjList.AddRange(GenAdj.CellsAdjacentCardinal(cell, Rot4.FromAngleFlat(shotRotation), new IntVec2(collisionCheckSize, 0)).ToList());

var rot4 = Rot4.FromAngleFlat(shotRotation);
if (rot4.rotInt > 1)
{
//For some reason south and west returns incorrect adjacent cells collection
rot4 = rot4.Opposite;
}
adjList.AddRange(GenAdj.CellsAdjacentCardinal(cell, rot4, new IntVec2(collisionCheckSize, 0)).ToList());
if (Controller.settings.DebugDrawInterceptChecks)
{
Map.debugDrawer.debugCells.Clear();
Map.debugDrawer.DebugDrawerUpdate();
}
//Iterate through adjacent cells and find all the pawns
foreach (var curCell in adjList)
{
Expand Down

0 comments on commit e10cac4

Please sign in to comment.