isaacscript-common 1.0.315 → 1.0.316

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.
@@ -3,10 +3,13 @@ local ____exports = {}
3
3
  local postGameStartedReordered = require("callbacks.subscriptions.postGameStartedReordered")
4
4
  local postNewLevelReordered = require("callbacks.subscriptions.postNewLevelReordered")
5
5
  local postNewRoomReordered = require("callbacks.subscriptions.postNewRoomReordered")
6
- local currentStage, currentStageType, forceNewLevel, forceNewRoom, hasSubscriptions, postGameStartedVanilla, postNewLevelVanilla, postNewRoomVanilla, recordCurrentStage
6
+ local currentStage, currentStageType, usedGlowingHourGlass, forceNewLevel, forceNewRoom, hasSubscriptions, useItemGlowingHourGlass, postGameStartedVanilla, postNewLevelVanilla, postNewRoomVanilla, recordCurrentStage
7
7
  function hasSubscriptions(self)
8
8
  return (postGameStartedReordered:hasSubscriptions() or postNewLevelReordered:hasSubscriptions()) or postNewRoomReordered:hasSubscriptions()
9
9
  end
10
+ function useItemGlowingHourGlass(self)
11
+ usedGlowingHourGlass = true
12
+ end
10
13
  function postGameStartedVanilla(self, isContinued)
11
14
  if not hasSubscriptions(nil) then
12
15
  return
@@ -39,6 +42,11 @@ function postNewRoomVanilla(self)
39
42
  local level = game:GetLevel()
40
43
  local stage = level:GetStage()
41
44
  local stageType = level:GetStageType()
45
+ if usedGlowingHourGlass and ((currentStage ~= stage) or (currentStageType ~= stageType)) then
46
+ recordCurrentStage(nil)
47
+ postNewLevelReordered:fire()
48
+ postNewRoomReordered:fire()
49
+ end
42
50
  if (((gameFrameCount == 0) or (currentStage ~= stage)) or (currentStageType ~= stageType)) and (not forceNewRoom) then
43
51
  return
44
52
  end
@@ -53,11 +61,13 @@ function recordCurrentStage(self)
53
61
  currentStage = stage
54
62
  currentStageType = stageType
55
63
  end
56
- currentStage = -1
57
- currentStageType = -1
64
+ currentStage = nil
65
+ currentStageType = nil
66
+ usedGlowingHourGlass = false
58
67
  forceNewLevel = false
59
68
  forceNewRoom = false
60
69
  function ____exports.init(self, mod)
70
+ mod:AddCallback(ModCallbacks.MC_USE_ITEM, useItemGlowingHourGlass, CollectibleType.COLLECTIBLE_GLOWING_HOUR_GLASS)
61
71
  mod:AddCallback(ModCallbacks.MC_POST_GAME_STARTED, postGameStartedVanilla)
62
72
  mod:AddCallback(ModCallbacks.MC_POST_NEW_LEVEL, postNewLevelVanilla)
63
73
  mod:AddCallback(ModCallbacks.MC_POST_NEW_ROOM, postNewRoomVanilla)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "1.0.315",
3
+ "version": "1.0.316",
4
4
  "description": "Helper functions for IsaacScript mods",
5
5
  "keywords": [
6
6
  "isaac",