isaacscript-common 7.17.3 → 7.18.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.
@@ -304,7 +304,7 @@ function ____exports.getAzazelBrimstoneDistance(self, playerOrTearHeight)
304
304
  return 32 - 2.5 * tearHeight
305
305
  end
306
306
  function ____exports.getClosestPlayer(self, position)
307
- local closestPlayer = nil
307
+ local closestPlayer
308
308
  local closestDistance = math.huge
309
309
  for ____, player in ipairs(getPlayers(nil)) do
310
310
  local distance = position:Distance(player.Position)
@@ -1,4 +1,9 @@
1
1
  import { PlayerType } from "isaac-typescript-definitions";
2
+ /**
3
+ * Helper function to see if the current run can unlock achievements. For example, if playing on a
4
+ * set seed or in a victory lap, achievements are disabled.
5
+ */
6
+ export declare function canRunUnlockAchievements(): boolean;
2
7
  /**
3
8
  * Whether or not the player is playing on a set seed (i.e. that they entered in a specific seed by
4
9
  * pressing tab on the character selection screen). When the player resets the game on a set seed,
@@ -1 +1 @@
1
- {"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../src/functions/run.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAMrE;;;;GAIG;AACH,wBAAgB,SAAS,IAAI,OAAO,CAMnC;AAED;;;;;;GAMG;AACH,wBAAgB,OAAO,CAAC,SAAS,CAAC,EAAE,UAAU,GAAG,IAAI,CAiBpD;AAED;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,SAAS,CAAC,EAAE,UAAU,GAAG,IAAI,CAInE;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,IAAI,IAAI,CAUlC"}
1
+ {"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../src/functions/run.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,UAAU,EAEX,MAAM,8BAA8B,CAAC;AAQtC;;;GAGG;AACH,wBAAgB,wBAAwB,IAAI,OAAO,CAUlD;AAED;;;;GAIG;AACH,wBAAgB,SAAS,IAAI,OAAO,CAMnC;AAED;;;;;;GAMG;AACH,wBAAgB,OAAO,CAAC,SAAS,CAAC,EAAE,UAAU,GAAG,IAAI,CAiBpD;AAED;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,SAAS,CAAC,EAAE,UAAU,GAAG,IAAI,CAInE;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,IAAI,IAAI,CAUlC"}
@@ -2,14 +2,27 @@ local ____exports = {}
2
2
  local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
3
3
  local Challenge = ____isaac_2Dtypescript_2Ddefinitions.Challenge
4
4
  local PlayerType = ____isaac_2Dtypescript_2Ddefinitions.PlayerType
5
+ local SlotVariant = ____isaac_2Dtypescript_2Ddefinitions.SlotVariant
5
6
  local ____cachedClasses = require("core.cachedClasses")
6
7
  local game = ____cachedClasses.game
8
+ local ____constants = require("core.constants")
9
+ local VectorZero = ____constants.VectorZero
7
10
  local ____constantsFirstLast = require("core.constantsFirstLast")
8
11
  local FIRST_CHARACTER = ____constantsFirstLast.FIRST_CHARACTER
9
12
  local ____runInNFrames = require("features.runInNFrames")
10
13
  local runNextRenderFrame = ____runInNFrames.runNextRenderFrame
14
+ local ____entitiesSpecific = require("functions.entitiesSpecific")
15
+ local spawnSlot = ____entitiesSpecific.spawnSlot
11
16
  local ____log = require("functions.log")
12
17
  local log = ____log.log
18
+ --- Helper function to see if the current run can unlock achievements. For example, if playing on a
19
+ -- set seed or in a victory lap, achievements are disabled.
20
+ function ____exports.canRunUnlockAchievements(self)
21
+ local greedDonationMachine = spawnSlot(nil, SlotVariant.GREED_DONATION_MACHINE, 0, VectorZero)
22
+ local canUnlockAchievements = greedDonationMachine:Exists()
23
+ greedDonationMachine:Remove()
24
+ return canUnlockAchievements
25
+ end
13
26
  --- Whether or not the player is playing on a set seed (i.e. that they entered in a specific seed by
14
27
  -- pressing tab on the character selection screen). When the player resets the game on a set seed,
15
28
  -- the game will not switch to a different seed.