isaacscript-common 9.19.3 → 9.20.0

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.
package/dist/index.d.ts CHANGED
@@ -2158,7 +2158,7 @@ export declare function find<T>(array: T[], func: (value: T, index: number, arra
2158
2158
  * with anything, then it will be returned.
2159
2159
  * @param avoidActiveEntities Optional. Default is false.
2160
2160
  */
2161
- export declare function findFreePosition(startingPosition: Vector, avoidActiveEntities?: boolean): Vector;
2161
+ export declare function findFreePosition(startingPosition: Vector, avoidActiveEntities?: boolean, minimumDistance?: float): Vector;
2162
2162
 
2163
2163
  /**
2164
2164
  * Helper function to make an NPC fire one or more projectiles. Returns the fired projectile(s).
@@ -1,6 +1,6 @@
1
1
  --[[
2
2
 
3
- isaacscript-common 9.19.3
3
+ isaacscript-common 9.20.0
4
4
 
5
5
  This is the "isaacscript-common" library, which was created with the IsaacScript tool.
6
6
 
@@ -26728,7 +26728,7 @@ end
26728
26728
  -- @param startingPosition The position to start searching from. If this position is not overlapping
26729
26729
  -- with anything, then it will be returned.
26730
26730
  -- @param avoidActiveEntities Optional. Default is false.
26731
- function ____exports.findFreePosition(self, startingPosition, avoidActiveEntities)
26731
+ function ____exports.findFreePosition(self, startingPosition, avoidActiveEntities, minimumDistance)
26732
26732
  if avoidActiveEntities == nil then
26733
26733
  avoidActiveEntities = false
26734
26734
  end
@@ -26747,6 +26747,12 @@ function ____exports.findFreePosition(self, startingPosition, avoidActiveEntitie
26747
26747
  if isCloseHeavenDoor then
26748
26748
  goto __continue7
26749
26749
  end
26750
+ if minimumDistance ~= nil then
26751
+ local distance = startingPosition:Distance(position)
26752
+ if distance < minimumDistance then
26753
+ goto __continue7
26754
+ end
26755
+ end
26750
26756
  return position
26751
26757
  end
26752
26758
  ::__continue7::
@@ -46818,7 +46824,7 @@ return ____exports
46818
46824
  ["package"] = function(...)
46819
46825
  return {
46820
46826
  name = "isaacscript-common",
46821
- version = "9.19.3",
46827
+ version = "9.20.0",
46822
46828
  description = "Helper functions and features for IsaacScript mods.",
46823
46829
  keywords = {"isaac", "rebirth", "afterbirth", "repentance"},
46824
46830
  homepage = "https://isaacscript.github.io/",
package/dist/package.lua CHANGED
@@ -1,6 +1,6 @@
1
1
  return {
2
2
  name = "isaacscript-common",
3
- version = "9.19.3",
3
+ version = "9.20.0",
4
4
  description = "Helper functions and features for IsaacScript mods.",
5
5
  keywords = {"isaac", "rebirth", "afterbirth", "repentance"},
6
6
  homepage = "https://isaacscript.github.io/",
@@ -21,7 +21,7 @@ export declare function anyPlayerCloserThan(position: Vector, distance: float):
21
21
  * with anything, then it will be returned.
22
22
  * @param avoidActiveEntities Optional. Default is false.
23
23
  */
24
- export declare function findFreePosition(startingPosition: Vector, avoidActiveEntities?: boolean): Vector;
24
+ export declare function findFreePosition(startingPosition: Vector, avoidActiveEntities?: boolean, minimumDistance?: float): Vector;
25
25
  /**
26
26
  * Helper function to get a map containing the positions of every entity in the current room.
27
27
  *
@@ -1 +1 @@
1
- {"version":3,"file":"positionVelocity.d.ts","sourceRoot":"","sources":["../../../src/functions/positionVelocity.ts"],"names":[],"mappings":";;;;AAaA,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,MAAM,EAAE,EAClB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,GAAG,GACZ,OAAO,CAIT;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,KAAK,GACd,OAAO,CAKT;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAC9B,gBAAgB,EAAE,MAAM,EACxB,mBAAmB,UAAQ,GAC1B,MAAM,CAiCR;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,GAAG,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC,CAY5E;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,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EAAE,GAClB,IAAI,CAYN;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,mBAAmB,CACjC,gBAAgB,EAAE,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC,EACtC,QAAQ,CAAC,EAAE,MAAM,EAAE,GAClB,IAAI,CAYN"}
@@ -45,7 +45,7 @@ end
45
45
  -- @param startingPosition The position to start searching from. If this position is not overlapping
46
46
  -- with anything, then it will be returned.
47
47
  -- @param avoidActiveEntities Optional. Default is false.
48
- function ____exports.findFreePosition(self, startingPosition, avoidActiveEntities)
48
+ function ____exports.findFreePosition(self, startingPosition, avoidActiveEntities, minimumDistance)
49
49
  if avoidActiveEntities == nil then
50
50
  avoidActiveEntities = false
51
51
  end
@@ -64,6 +64,12 @@ function ____exports.findFreePosition(self, startingPosition, avoidActiveEntitie
64
64
  if isCloseHeavenDoor then
65
65
  goto __continue7
66
66
  end
67
+ if minimumDistance ~= nil then
68
+ local distance = startingPosition:Distance(position)
69
+ if distance < minimumDistance then
70
+ goto __continue7
71
+ end
72
+ end
67
73
  return position
68
74
  end
69
75
  ::__continue7::
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "9.19.3",
3
+ "version": "9.20.0",
4
4
  "description": "Helper functions and features for IsaacScript mods.",
5
5
  "keywords": [
6
6
  "isaac",
@@ -51,6 +51,7 @@ export function anyPlayerCloserThan(
51
51
  export function findFreePosition(
52
52
  startingPosition: Vector,
53
53
  avoidActiveEntities = false,
54
+ minimumDistance?: float,
54
55
  ): Vector {
55
56
  const room = game.GetRoom();
56
57
  const heavenDoors = getEffects(
@@ -79,6 +80,13 @@ export function findFreePosition(
79
80
  continue;
80
81
  }
81
82
 
83
+ if (minimumDistance !== undefined) {
84
+ const distance = startingPosition.Distance(position);
85
+ if (distance < minimumDistance) {
86
+ continue;
87
+ }
88
+ }
89
+
82
90
  return position;
83
91
  }
84
92