isaacscript-common 1.2.92 → 1.2.93

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -13,6 +13,7 @@ export declare function getAngleDifference(angle1: float, angle2: float): float;
13
13
  * this can be optionally changed by specifying this argument.
14
14
  */
15
15
  export declare function getCircleDiscretizedPoints(centerPos: Vector, radius: float, numPoints: int, xMultiplier?: number, yMultiplier?: number, initialDirection?: Direction): Vector[];
16
+ export declare function getSetBits(n: int): int;
16
17
  /**
17
18
  * Helper function to check if a given position is within a given rectangle. This is an inclusive
18
19
  * check, meaning that it will return true if the position is on the border of the rectangle.
@@ -74,6 +74,14 @@ function ____exports.getCircleDiscretizedPoints(self, centerPos, radius, numPoin
74
74
  end
75
75
  return positions
76
76
  end
77
+ function ____exports.getSetBits(self, n)
78
+ local count = 0
79
+ while n > 0 do
80
+ n = n & n - 1
81
+ count = count + 1
82
+ end
83
+ return count
84
+ end
77
85
  function ____exports.inRectangle(self, position, topLeft, bottomRight)
78
86
  return position.X >= topLeft.X and position.X <= bottomRight.X and position.Y <= topLeft.Y and position.Y >= bottomRight.Y
79
87
  end
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "1.2.92",
3
+ "version": "1.2.93",
4
4
  "description": "Helper functions for IsaacScript mods",
5
5
  "keywords": [
6
6
  "isaac",