public static void LeanShootingSourcesFromTo(IntVec3 shooterLoc, IntVec3 targetPos, Map map, List <IntVec3> listToFill) { listToFill.Clear(); float angleFlat = (targetPos - shooterLoc).AngleFlat; bool flag = angleFlat > 270f || angleFlat < 90f; bool flag2 = angleFlat > 90f && angleFlat < 270f; bool flag3 = angleFlat > 180f; bool flag4 = angleFlat < 180f; bool[] workingBlockedArray = ShootLeanUtility.GetWorkingBlockedArray(); for (int i = 0; i < 8; i++) { workingBlockedArray[i] = !(shooterLoc + GenAdj.AdjacentCells[i]).CanBeSeenOver(map); } if (!workingBlockedArray[1] && ((workingBlockedArray[0] && !workingBlockedArray[5] && flag) || (workingBlockedArray[2] && !workingBlockedArray[4] && flag2))) { listToFill.Add(shooterLoc + new IntVec3(1, 0, 0)); } if (!workingBlockedArray[3] && ((workingBlockedArray[0] && !workingBlockedArray[6] && flag) || (workingBlockedArray[2] && !workingBlockedArray[7] && flag2))) { listToFill.Add(shooterLoc + new IntVec3(-1, 0, 0)); } if (!workingBlockedArray[2] && ((workingBlockedArray[3] && !workingBlockedArray[7] && flag3) || (workingBlockedArray[1] && !workingBlockedArray[4] && flag4))) { listToFill.Add(shooterLoc + new IntVec3(0, 0, -1)); } if (!workingBlockedArray[0] && ((workingBlockedArray[3] && !workingBlockedArray[6] && flag3) || (workingBlockedArray[1] && !workingBlockedArray[5] && flag4))) { listToFill.Add(shooterLoc + new IntVec3(0, 0, 1)); } for (int j = 0; j < 4; j++) { if (!workingBlockedArray[j]) { if (j != 0 || flag) { if (j != 1 || flag4) { if (j != 2 || flag2) { if (j != 3 || flag3) { if ((shooterLoc + GenAdj.AdjacentCells[j]).GetCover(map) != null) { listToFill.Add(shooterLoc + GenAdj.AdjacentCells[j]); } } } } } } } ShootLeanUtility.ReturnWorkingBlockedArray(workingBlockedArray); }
public static void LeanShootingSourcesFromTo(IntVec3 shooterLoc, IntVec3 targetPos, Map map, List <IntVec3> listToFill) { listToFill.Clear(); float angleFlat = (targetPos - shooterLoc).AngleFlat; bool flag = angleFlat > 270.0 || angleFlat < 90.0; bool flag2 = angleFlat > 90.0 && angleFlat < 270.0; bool flag3 = angleFlat > 180.0; bool flag4 = angleFlat < 180.0; bool[] workingBlockedArray = ShootLeanUtility.GetWorkingBlockedArray(); for (int i = 0; i < 8; i++) { workingBlockedArray[i] = !(shooterLoc + GenAdj.AdjacentCells[i]).CanBeSeenOver(map); } if (!workingBlockedArray[1]) { if (workingBlockedArray[0] && !workingBlockedArray[5] && flag) { goto IL_00d3; } if (workingBlockedArray[2] && !workingBlockedArray[4] && flag2) { goto IL_00d3; } } goto IL_00e7; IL_0134: if (!workingBlockedArray[2]) { if (workingBlockedArray[3] && !workingBlockedArray[7] && flag3) { goto IL_016f; } if (workingBlockedArray[1] && !workingBlockedArray[4] && flag4) { goto IL_016f; } } goto IL_0183; IL_016f: listToFill.Add(shooterLoc + new IntVec3(0, 0, -1)); goto IL_0183; IL_0120: listToFill.Add(shooterLoc + new IntVec3(-1, 0, 0)); goto IL_0134; IL_01be: listToFill.Add(shooterLoc + new IntVec3(0, 0, 1)); goto IL_01d2; IL_0183: if (!workingBlockedArray[0]) { if (workingBlockedArray[3] && !workingBlockedArray[6] && flag3) { goto IL_01be; } if (workingBlockedArray[1] && !workingBlockedArray[5] && flag4) { goto IL_01be; } } goto IL_01d2; IL_01d2: for (int j = 0; j < 4; j++) { if (!workingBlockedArray[j] && (j != 0 || flag) && (j != 1 || flag4) && (j != 2 || flag2) && (j != 3 || flag3) && (shooterLoc + GenAdj.AdjacentCells[j]).GetCover(map) != null) { listToFill.Add(shooterLoc + GenAdj.AdjacentCells[j]); } } ShootLeanUtility.ReturnWorkingBlockedArray(workingBlockedArray); return; IL_00d3: listToFill.Add(shooterLoc + new IntVec3(1, 0, 0)); goto IL_00e7; IL_00e7: if (!workingBlockedArray[3]) { if (workingBlockedArray[0] && !workingBlockedArray[6] && flag) { goto IL_0120; } if (workingBlockedArray[2] && !workingBlockedArray[7] && flag2) { goto IL_0120; } } goto IL_0134; }