isaacscript-common 1.2.149 → 1.2.150

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.
@@ -1,6 +1,6 @@
1
1
  --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
2
  local ____exports = {}
3
- local hasSubscriptions, postRender, postPEffectUpdateReordered, checkWaitingForItemAnimation, postPlayerFatalDamage, preBerserkDeath, playerIsAboutToDie, CustomReviveState, v
3
+ local hasSubscriptions, postRender, postNewRoom, postPEffectUpdateReordered, checkWaitingForItemAnimation, postPlayerFatalDamage, preBerserkDeath, playerIsAboutToDie, logStateChanged, DEBUG, CustomReviveState, v
4
4
  local ____cachedClasses = require("cachedClasses")
5
5
  local sfxManager = ____cachedClasses.sfxManager
6
6
  local ____runInNFrames = require("features.runInNFrames")
@@ -11,6 +11,8 @@ local ____collectibles = require("functions.collectibles")
11
11
  local removeCollectibleFromItemTracker = ____collectibles.removeCollectibleFromItemTracker
12
12
  local ____familiars = require("functions.familiars")
13
13
  local removeAllFamiliars = ____familiars.removeAllFamiliars
14
+ local ____log = require("functions.log")
15
+ local log = ____log.log
14
16
  local ____player = require("functions.player")
15
17
  local getPlayerFromIndex = ____player.getPlayerFromIndex
16
18
  local getPlayerIndex = ____player.getPlayerIndex
@@ -31,6 +33,13 @@ function postRender(self)
31
33
  end
32
34
  sfxManager:Stop(SoundEffect.SOUND_1UP)
33
35
  end
36
+ function postNewRoom(self)
37
+ if v.run.state ~= CustomReviveState.WAITING_FOR_ROOM_TRANSITION then
38
+ return
39
+ end
40
+ v.run.state = CustomReviveState.WAITING_FOR_ITEM_ANIMATION
41
+ logStateChanged(nil)
42
+ end
34
43
  function postPEffectUpdateReordered(self, player)
35
44
  checkWaitingForItemAnimation(nil, player)
36
45
  end
@@ -62,6 +71,7 @@ function checkWaitingForItemAnimation(self, player)
62
71
  v.run.state = CustomReviveState.DISABLED
63
72
  v.run.revivalType = nil
64
73
  v.run.dyingPlayerIndex = nil
74
+ logStateChanged(nil)
65
75
  end
66
76
  function postPlayerFatalDamage(self, player)
67
77
  if not hasSubscriptions(nil) then
@@ -80,9 +90,10 @@ function playerIsAboutToDie(self, player)
80
90
  if revivalType == nil then
81
91
  return
82
92
  end
83
- v.run.state = CustomReviveState.WAITING_FOR_ITEM_ANIMATION
93
+ v.run.state = CustomReviveState.WAITING_FOR_ROOM_TRANSITION
84
94
  v.run.revivalType = revivalType
85
95
  v.run.dyingPlayerIndex = getPlayerIndex(nil, player)
96
+ logStateChanged(nil)
86
97
  player:AddCollectible(CollectibleType.COLLECTIBLE_1UP, 0, false)
87
98
  removeAllFamiliars(nil, FamiliarVariant.ONE_UP)
88
99
  removeCollectibleFromItemTracker(nil, CollectibleType.COLLECTIBLE_1UP)
@@ -108,15 +119,24 @@ function playerIsAboutToDie(self, player)
108
119
  end
109
120
  )
110
121
  end
122
+ function logStateChanged(self)
123
+ if DEBUG then
124
+ log(((("Custom revive state changed: " .. CustomReviveState[v.run.state]) .. " (") .. tostring(v.run.state)) .. ")")
125
+ end
126
+ end
127
+ DEBUG = false
111
128
  CustomReviveState = CustomReviveState or ({})
112
129
  CustomReviveState.DISABLED = 0
113
130
  CustomReviveState[CustomReviveState.DISABLED] = "DISABLED"
114
- CustomReviveState.WAITING_FOR_ITEM_ANIMATION = 1
131
+ CustomReviveState.WAITING_FOR_ROOM_TRANSITION = 1
132
+ CustomReviveState[CustomReviveState.WAITING_FOR_ROOM_TRANSITION] = "WAITING_FOR_ROOM_TRANSITION"
133
+ CustomReviveState.WAITING_FOR_ITEM_ANIMATION = 2
115
134
  CustomReviveState[CustomReviveState.WAITING_FOR_ITEM_ANIMATION] = "WAITING_FOR_ITEM_ANIMATION"
116
135
  v = {run = {state = CustomReviveState.DISABLED, revivalType = nil, dyingPlayerIndex = nil}}
117
136
  function ____exports.customReviveCallbacksInit(self, mod)
118
137
  saveDataManager(nil, "customRevive", v, hasSubscriptions)
119
138
  mod:AddCallback(ModCallbacks.MC_POST_RENDER, postRender)
139
+ mod:AddCallback(ModCallbacks.MC_POST_NEW_ROOM, postNewRoom)
120
140
  mod:AddCallbackCustom(ModCallbacksCustom.MC_POST_PEFFECT_UPDATE_REORDERED, postPEffectUpdateReordered)
121
141
  mod:AddCallbackCustom(ModCallbacksCustom.MC_POST_PLAYER_FATAL_DAMAGE, postPlayerFatalDamage)
122
142
  mod:AddCallbackCustom(ModCallbacksCustom.MC_PRE_BERSERK_DEATH, preBerserkDeath)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "1.2.149",
3
+ "version": "1.2.150",
4
4
  "description": "Helper functions for IsaacScript mods",
5
5
  "keywords": [
6
6
  "isaac",
@@ -27,7 +27,7 @@
27
27
  "devDependencies": {
28
28
  "@zamiell/typescript-to-lua": "^1.4.2",
29
29
  "isaac-typescript-definitions": "^1.0.364",
30
- "isaacscript-lint": "^1.0.88",
30
+ "isaacscript-lint": "^1.0.89",
31
31
  "isaacscript-tsconfig": "^1.1.8",
32
32
  "typedoc": "^0.22.13",
33
33
  "typescript": "4.5.5"