isaacscript-common 30.5.4 → 30.6.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.rollup.d.ts +18 -1
- package/dist/isaacscript-common.lua +44 -10
- package/dist/src/classes/features/callbackLogic/GameReorderedCallbacks.d.ts +4 -0
- package/dist/src/classes/features/callbackLogic/GameReorderedCallbacks.d.ts.map +1 -1
- package/dist/src/classes/features/callbackLogic/GameReorderedCallbacks.lua +23 -4
- package/dist/src/classes/features/other/SaveDataManager.d.ts +1 -1
- package/dist/src/classes/features/other/SaveDataManager.d.ts.map +1 -1
- package/dist/src/classes/features/other/SaveDataManager.lua +5 -5
- package/dist/src/enums/ModCallbackCustom.d.ts +4 -0
- package/dist/src/enums/ModCallbackCustom.d.ts.map +1 -1
- package/dist/src/functions/sprites.d.ts +8 -0
- package/dist/src/functions/sprites.d.ts.map +1 -1
- package/dist/src/functions/sprites.lua +18 -0
- package/package.json +2 -2
- package/src/classes/features/callbackLogic/GameReorderedCallbacks.ts +29 -2
- package/src/classes/features/other/SaveDataManager.ts +5 -5
- package/src/enums/ModCallbackCustom.ts +4 -0
- package/src/functions/sprites.ts +24 -0
package/dist/index.rollup.d.ts
CHANGED
|
@@ -4240,6 +4240,8 @@ export declare const GAME_FRAMES_PER_SECOND = 30;
|
|
|
4240
4240
|
* that you may run into with these callbacks.
|
|
4241
4241
|
*/
|
|
4242
4242
|
declare class GameReorderedCallbacks extends Feature {
|
|
4243
|
+
/** Used to detect a player resuming a saved run. */
|
|
4244
|
+
private renderFrameRunStarted;
|
|
4243
4245
|
private currentStage;
|
|
4244
4246
|
private currentStageType;
|
|
4245
4247
|
private usedGlowingHourGlass;
|
|
@@ -4250,7 +4252,9 @@ declare class GameReorderedCallbacks extends Feature {
|
|
|
4250
4252
|
private postNewRoomReordered;
|
|
4251
4253
|
private postGameStartedReorderedLast;
|
|
4252
4254
|
private postUseItemGlowingHourGlass;
|
|
4255
|
+
private postPlayerInit;
|
|
4253
4256
|
private postGameStarted;
|
|
4257
|
+
private preGameExit;
|
|
4254
4258
|
private postNewLevel;
|
|
4255
4259
|
private postNewRoom;
|
|
4256
4260
|
private recordCurrentStage;
|
|
@@ -10393,6 +10397,10 @@ export declare enum ModCallbackCustom {
|
|
|
10393
10397
|
* Additionally, this callback will pass the `LevelStage` as the first callback argument and the
|
|
10394
10398
|
* `StageType` as the second callback argument.
|
|
10395
10399
|
*
|
|
10400
|
+
* Note that similar to the vanilla `POST_NEW_LEVEL` callback, this callback will not fire when a
|
|
10401
|
+
* player resumes a saved run. (In that case, only the `POST_GAME_STARTED_REORDERED` and the
|
|
10402
|
+
* `POST_NEW_ROOM_REORDERED` callbacks will fire, in that order).
|
|
10403
|
+
*
|
|
10396
10404
|
* If some specific cases, mods can change the current level during run initialization (on the 0th
|
|
10397
10405
|
* frame). However, due to how the callback reordering works, the custom
|
|
10398
10406
|
* `POST_NEW_LEVEL_REORDERED` callback will never fire on the 0th frame. To get around this, call
|
|
@@ -12875,6 +12883,15 @@ export declare function newRNG(seed?: Seed): RNG;
|
|
|
12875
12883
|
*/
|
|
12876
12884
|
export declare function newRoom(seedOrRNG?: Seed | RNG): int | undefined;
|
|
12877
12885
|
|
|
12886
|
+
/**
|
|
12887
|
+
* Helper function to load a new sprite and play its default animation.
|
|
12888
|
+
*
|
|
12889
|
+
* @param anm2Path The path to the "anm2" file that should be loaded.
|
|
12890
|
+
* @param pngPath Optional. The path to a custom PNG file that should be loaded on layer 0 of the
|
|
12891
|
+
* sprite.
|
|
12892
|
+
*/
|
|
12893
|
+
export declare function newSprite(anm2Path: string, pngPath?: string): Sprite;
|
|
12894
|
+
|
|
12878
12895
|
/**
|
|
12879
12896
|
* Helper function to generate a new sprite based on a collectible. If the provided collectible type
|
|
12880
12897
|
* is invalid, a sprite with a Curse of the Blind question mark will be returned.
|
|
@@ -14850,7 +14867,7 @@ declare class SaveDataManager extends Feature {
|
|
|
14850
14867
|
* contained in nested maps, sets, and arrays.
|
|
14851
14868
|
*/
|
|
14852
14869
|
private classConstructors;
|
|
14853
|
-
private
|
|
14870
|
+
private inARun;
|
|
14854
14871
|
private restoreGlowingHourGlassDataOnNextRoom;
|
|
14855
14872
|
private postUseItemGlowingHourGlass;
|
|
14856
14873
|
private postPlayerInit;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
--[[
|
|
2
2
|
|
|
3
|
-
isaacscript-common 30.
|
|
3
|
+
isaacscript-common 30.6.0
|
|
4
4
|
|
|
5
5
|
This is the "isaacscript-common" library, which was created with the IsaacScript tool.
|
|
6
6
|
|
|
@@ -13780,6 +13780,8 @@ local ____exports = {}
|
|
|
13780
13780
|
____exports.GridEntityXMLType = {}
|
|
13781
13781
|
____exports.GridEntityXMLType.DECORATION = 0
|
|
13782
13782
|
____exports.GridEntityXMLType[____exports.GridEntityXMLType.DECORATION] = "DECORATION"
|
|
13783
|
+
____exports.GridEntityXMLType.EFFECT = 999
|
|
13784
|
+
____exports.GridEntityXMLType[____exports.GridEntityXMLType.EFFECT] = "EFFECT"
|
|
13783
13785
|
____exports.GridEntityXMLType.ROCK = 1000
|
|
13784
13786
|
____exports.GridEntityXMLType[____exports.GridEntityXMLType.ROCK] = "ROCK"
|
|
13785
13787
|
____exports.GridEntityXMLType.ROCK_BOMB = 1001
|
|
@@ -20712,6 +20714,19 @@ function ____exports.getLastFrameOfAnimation(self, sprite, animation)
|
|
|
20712
20714
|
sprite:SetFrame(currentFrame)
|
|
20713
20715
|
return finalFrame
|
|
20714
20716
|
end
|
|
20717
|
+
function ____exports.newSprite(self, anm2Path, pngPath)
|
|
20718
|
+
local sprite = Sprite()
|
|
20719
|
+
if pngPath == nil then
|
|
20720
|
+
sprite:Load(anm2Path, true)
|
|
20721
|
+
else
|
|
20722
|
+
sprite:Load(anm2Path, false)
|
|
20723
|
+
sprite:ReplaceSpritesheet(0, pngPath)
|
|
20724
|
+
sprite:LoadGraphics()
|
|
20725
|
+
end
|
|
20726
|
+
local defaultAnimation = sprite:GetDefaultAnimation()
|
|
20727
|
+
sprite:Play(defaultAnimation, true)
|
|
20728
|
+
return sprite
|
|
20729
|
+
end
|
|
20715
20730
|
function ____exports.setSpriteOpacity(self, sprite, alpha)
|
|
20716
20731
|
local fadedColor = copyColor(nil, sprite.Color)
|
|
20717
20732
|
fadedColor.A = alpha
|
|
@@ -34550,6 +34565,7 @@ GameReorderedCallbacks.name = "GameReorderedCallbacks"
|
|
|
34550
34565
|
__TS__ClassExtends(GameReorderedCallbacks, Feature)
|
|
34551
34566
|
function GameReorderedCallbacks.prototype.____constructor(self, postGameStartedReordered, postNewLevelReordered, postNewRoomReordered, postGameStartedReorderedLast)
|
|
34552
34567
|
Feature.prototype.____constructor(self)
|
|
34568
|
+
self.renderFrameRunStarted = nil
|
|
34553
34569
|
self.currentStage = nil
|
|
34554
34570
|
self.currentStageType = nil
|
|
34555
34571
|
self.usedGlowingHourGlass = false
|
|
@@ -34559,6 +34575,11 @@ function GameReorderedCallbacks.prototype.____constructor(self, postGameStartedR
|
|
|
34559
34575
|
self.usedGlowingHourGlass = true
|
|
34560
34576
|
return nil
|
|
34561
34577
|
end
|
|
34578
|
+
self.postPlayerInit = function(____, _player)
|
|
34579
|
+
if self.renderFrameRunStarted == nil then
|
|
34580
|
+
self.renderFrameRunStarted = Isaac.GetFrameCount()
|
|
34581
|
+
end
|
|
34582
|
+
end
|
|
34562
34583
|
self.postGameStarted = function(____, isContinued)
|
|
34563
34584
|
local level = game:GetLevel()
|
|
34564
34585
|
local stage = level:GetStage()
|
|
@@ -34567,9 +34588,14 @@ function GameReorderedCallbacks.prototype.____constructor(self, postGameStartedR
|
|
|
34567
34588
|
local roomType = room:GetType()
|
|
34568
34589
|
self:recordCurrentStage()
|
|
34569
34590
|
self.postGameStartedReordered:fire(isContinued)
|
|
34570
|
-
self.postNewLevelReordered:fire(stage, stageType)
|
|
34571
|
-
self.postNewRoomReordered:fire(roomType)
|
|
34572
34591
|
self.postGameStartedReorderedLast:fire(isContinued)
|
|
34592
|
+
if not isContinued then
|
|
34593
|
+
self.postNewLevelReordered:fire(stage, stageType)
|
|
34594
|
+
end
|
|
34595
|
+
self.postNewRoomReordered:fire(roomType)
|
|
34596
|
+
end
|
|
34597
|
+
self.preGameExit = function()
|
|
34598
|
+
self.renderFrameRunStarted = nil
|
|
34573
34599
|
end
|
|
34574
34600
|
self.postNewLevel = function()
|
|
34575
34601
|
local gameFrameCount = game:GetFrameCount()
|
|
@@ -34593,6 +34619,7 @@ function GameReorderedCallbacks.prototype.____constructor(self, postGameStartedR
|
|
|
34593
34619
|
local stageType = level:GetStageType()
|
|
34594
34620
|
local room = game:GetRoom()
|
|
34595
34621
|
local roomType = room:GetType()
|
|
34622
|
+
local renderFrameCount = Isaac.GetFrameCount()
|
|
34596
34623
|
if self.usedGlowingHourGlass then
|
|
34597
34624
|
self.usedGlowingHourGlass = false
|
|
34598
34625
|
if self.currentStage ~= stage or self.currentStageType ~= stageType then
|
|
@@ -34602,13 +34629,20 @@ function GameReorderedCallbacks.prototype.____constructor(self, postGameStartedR
|
|
|
34602
34629
|
return
|
|
34603
34630
|
end
|
|
34604
34631
|
end
|
|
34605
|
-
if (gameFrameCount == 0 or self.currentStage ~= stage or self.currentStageType ~= stageType) and not self.forceNewRoom then
|
|
34632
|
+
if (gameFrameCount == 0 or renderFrameCount == self.renderFrameRunStarted or self.currentStage ~= stage or self.currentStageType ~= stageType) and not self.forceNewRoom then
|
|
34606
34633
|
return
|
|
34607
34634
|
end
|
|
34608
34635
|
self.forceNewRoom = false
|
|
34609
34636
|
self.postNewRoomReordered:fire(roomType)
|
|
34610
34637
|
end
|
|
34611
|
-
self.callbacksUsed = {
|
|
34638
|
+
self.callbacksUsed = {
|
|
34639
|
+
{ModCallback.POST_USE_ITEM, self.postUseItemGlowingHourGlass, {CollectibleType.GLOWING_HOUR_GLASS}},
|
|
34640
|
+
{ModCallback.POST_PLAYER_INIT, self.postPlayerInit},
|
|
34641
|
+
{ModCallback.POST_GAME_STARTED, self.postGameStarted},
|
|
34642
|
+
{ModCallback.PRE_GAME_EXIT, self.preGameExit},
|
|
34643
|
+
{ModCallback.POST_NEW_LEVEL, self.postNewLevel},
|
|
34644
|
+
{ModCallback.POST_NEW_ROOM, self.postNewRoom}
|
|
34645
|
+
}
|
|
34612
34646
|
self.postGameStartedReordered = postGameStartedReordered
|
|
34613
34647
|
self.postNewLevelReordered = postNewLevelReordered
|
|
34614
34648
|
self.postNewRoomReordered = postNewRoomReordered
|
|
@@ -36631,17 +36665,17 @@ function SaveDataManager.prototype.____constructor(self, mod)
|
|
|
36631
36665
|
self.saveDataConditionalFuncMap = {}
|
|
36632
36666
|
self.saveDataGlowingHourGlassMap = {}
|
|
36633
36667
|
self.classConstructors = {}
|
|
36634
|
-
self.
|
|
36668
|
+
self.inARun = false
|
|
36635
36669
|
self.restoreGlowingHourGlassDataOnNextRoom = false
|
|
36636
36670
|
self.postUseItemGlowingHourGlass = function(____, _collectibleType, _rng, _player, _useFlags, _activeSlot, _customVarData)
|
|
36637
36671
|
self.restoreGlowingHourGlassDataOnNextRoom = true
|
|
36638
36672
|
return nil
|
|
36639
36673
|
end
|
|
36640
36674
|
self.postPlayerInit = function(____, _player)
|
|
36641
|
-
if self.
|
|
36675
|
+
if self.inARun then
|
|
36642
36676
|
return
|
|
36643
36677
|
end
|
|
36644
|
-
self.
|
|
36678
|
+
self.inARun = true
|
|
36645
36679
|
self.restoreGlowingHourGlassDataOnNextRoom = false
|
|
36646
36680
|
loadFromDisk(nil, self.mod, self.saveDataMap, self.classConstructors)
|
|
36647
36681
|
local gameFrameCount = game:GetFrameCount()
|
|
@@ -36652,7 +36686,7 @@ function SaveDataManager.prototype.____constructor(self, mod)
|
|
|
36652
36686
|
end
|
|
36653
36687
|
self.preGameExit = function()
|
|
36654
36688
|
saveToDisk(nil, self.mod, self.saveDataMap, self.saveDataConditionalFuncMap)
|
|
36655
|
-
self.
|
|
36689
|
+
self.inARun = false
|
|
36656
36690
|
end
|
|
36657
36691
|
self.postNewLevel = function()
|
|
36658
36692
|
restoreDefaultsForAllFeaturesKey(nil, self.saveDataMap, self.saveDataDefaultsMap, SaveDataKey.LEVEL)
|
|
@@ -36767,7 +36801,7 @@ function SaveDataManager.prototype.saveDataManagerReset(self, key, childObjectKe
|
|
|
36767
36801
|
)
|
|
36768
36802
|
end
|
|
36769
36803
|
function SaveDataManager.prototype.saveDataManagerInMenu(self)
|
|
36770
|
-
return not self.
|
|
36804
|
+
return not self.inARun
|
|
36771
36805
|
end
|
|
36772
36806
|
function SaveDataManager.prototype.saveDataManagerLogSubscribers(self)
|
|
36773
36807
|
log("List of save data manager subscribers:")
|
|
@@ -16,6 +16,8 @@ import { Feature } from "../../private/Feature";
|
|
|
16
16
|
* that you may run into with these callbacks.
|
|
17
17
|
*/
|
|
18
18
|
export declare class GameReorderedCallbacks extends Feature {
|
|
19
|
+
/** Used to detect a player resuming a saved run. */
|
|
20
|
+
private renderFrameRunStarted;
|
|
19
21
|
private currentStage;
|
|
20
22
|
private currentStageType;
|
|
21
23
|
private usedGlowingHourGlass;
|
|
@@ -26,7 +28,9 @@ export declare class GameReorderedCallbacks extends Feature {
|
|
|
26
28
|
private postNewRoomReordered;
|
|
27
29
|
private postGameStartedReorderedLast;
|
|
28
30
|
private postUseItemGlowingHourGlass;
|
|
31
|
+
private postPlayerInit;
|
|
29
32
|
private postGameStarted;
|
|
33
|
+
private preGameExit;
|
|
30
34
|
private postNewLevel;
|
|
31
35
|
private postNewRoom;
|
|
32
36
|
private recordCurrentStage;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GameReorderedCallbacks.d.ts","sourceRoot":"","sources":["../../../../../src/classes/features/callbackLogic/GameReorderedCallbacks.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,UAAU,EAEV,SAAS,EACV,MAAM,8BAA8B,CAAC;AAOtC,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAEhD;;;;;;;;;;;;;;GAcG;AACH,qBAAa,sBAAuB,SAAQ,OAAO;IACjD,OAAO,CAAC,YAAY,CAAoB;IACxC,OAAO,CAAC,gBAAgB,CAAoB;IAC5C,OAAO,CAAC,oBAAoB,CAAS;IACrC,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,YAAY,CAAS;IAE7B,OAAO,CAAC,wBAAwB,CAA2B;IAC3D,OAAO,CAAC,qBAAqB,CAAwB;IACrD,OAAO,CAAC,oBAAoB,CAAuB;IACnD,OAAO,CAAC,4BAA4B,CAA+B;
|
|
1
|
+
{"version":3,"file":"GameReorderedCallbacks.d.ts","sourceRoot":"","sources":["../../../../../src/classes/features/callbackLogic/GameReorderedCallbacks.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,UAAU,EAEV,SAAS,EACV,MAAM,8BAA8B,CAAC;AAOtC,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAEhD;;;;;;;;;;;;;;GAcG;AACH,qBAAa,sBAAuB,SAAQ,OAAO;IACjD,oDAAoD;IACpD,OAAO,CAAC,qBAAqB,CAAoB;IAEjD,OAAO,CAAC,YAAY,CAAoB;IACxC,OAAO,CAAC,gBAAgB,CAAoB;IAC5C,OAAO,CAAC,oBAAoB,CAAS;IACrC,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,YAAY,CAAS;IAE7B,OAAO,CAAC,wBAAwB,CAA2B;IAC3D,OAAO,CAAC,qBAAqB,CAAwB;IACrD,OAAO,CAAC,oBAAoB,CAAuB;IACnD,OAAO,CAAC,4BAA4B,CAA+B;IA8CnE,OAAO,CAAC,2BAA2B,CAMjC;IAGF,OAAO,CAAC,cAAc,CAIpB;IAGF,OAAO,CAAC,eAAe,CAgBrB;IAGF,OAAO,CAAC,WAAW,CAEjB;IAGF,OAAO,CAAC,YAAY,CAiBlB;IAGF,OAAO,CAAC,WAAW,CAmCjB;IAEF,OAAO,CAAC,kBAAkB;IAS1B;;;;;;;;;;;;OAYG;IAEI,qBAAqB,IAAI,IAAI;IAIpC;;;;;;;;;;;;OAYG;IAEI,oBAAoB,IAAI,IAAI;IAInC;;;;;;;;;OASG;IAEI,0BAA0B,CAC/B,KAAK,EAAE,UAAU,EACjB,SAAS,EAAE,SAAS,GACnB,IAAI;CAIR"}
|
|
@@ -31,6 +31,7 @@ GameReorderedCallbacks.name = "GameReorderedCallbacks"
|
|
|
31
31
|
__TS__ClassExtends(GameReorderedCallbacks, Feature)
|
|
32
32
|
function GameReorderedCallbacks.prototype.____constructor(self, postGameStartedReordered, postNewLevelReordered, postNewRoomReordered, postGameStartedReorderedLast)
|
|
33
33
|
Feature.prototype.____constructor(self)
|
|
34
|
+
self.renderFrameRunStarted = nil
|
|
34
35
|
self.currentStage = nil
|
|
35
36
|
self.currentStageType = nil
|
|
36
37
|
self.usedGlowingHourGlass = false
|
|
@@ -40,6 +41,11 @@ function GameReorderedCallbacks.prototype.____constructor(self, postGameStartedR
|
|
|
40
41
|
self.usedGlowingHourGlass = true
|
|
41
42
|
return nil
|
|
42
43
|
end
|
|
44
|
+
self.postPlayerInit = function(____, _player)
|
|
45
|
+
if self.renderFrameRunStarted == nil then
|
|
46
|
+
self.renderFrameRunStarted = Isaac.GetFrameCount()
|
|
47
|
+
end
|
|
48
|
+
end
|
|
43
49
|
self.postGameStarted = function(____, isContinued)
|
|
44
50
|
local level = game:GetLevel()
|
|
45
51
|
local stage = level:GetStage()
|
|
@@ -48,9 +54,14 @@ function GameReorderedCallbacks.prototype.____constructor(self, postGameStartedR
|
|
|
48
54
|
local roomType = room:GetType()
|
|
49
55
|
self:recordCurrentStage()
|
|
50
56
|
self.postGameStartedReordered:fire(isContinued)
|
|
51
|
-
self.postNewLevelReordered:fire(stage, stageType)
|
|
52
|
-
self.postNewRoomReordered:fire(roomType)
|
|
53
57
|
self.postGameStartedReorderedLast:fire(isContinued)
|
|
58
|
+
if not isContinued then
|
|
59
|
+
self.postNewLevelReordered:fire(stage, stageType)
|
|
60
|
+
end
|
|
61
|
+
self.postNewRoomReordered:fire(roomType)
|
|
62
|
+
end
|
|
63
|
+
self.preGameExit = function()
|
|
64
|
+
self.renderFrameRunStarted = nil
|
|
54
65
|
end
|
|
55
66
|
self.postNewLevel = function()
|
|
56
67
|
local gameFrameCount = game:GetFrameCount()
|
|
@@ -74,6 +85,7 @@ function GameReorderedCallbacks.prototype.____constructor(self, postGameStartedR
|
|
|
74
85
|
local stageType = level:GetStageType()
|
|
75
86
|
local room = game:GetRoom()
|
|
76
87
|
local roomType = room:GetType()
|
|
88
|
+
local renderFrameCount = Isaac.GetFrameCount()
|
|
77
89
|
if self.usedGlowingHourGlass then
|
|
78
90
|
self.usedGlowingHourGlass = false
|
|
79
91
|
if self.currentStage ~= stage or self.currentStageType ~= stageType then
|
|
@@ -83,13 +95,20 @@ function GameReorderedCallbacks.prototype.____constructor(self, postGameStartedR
|
|
|
83
95
|
return
|
|
84
96
|
end
|
|
85
97
|
end
|
|
86
|
-
if (gameFrameCount == 0 or self.currentStage ~= stage or self.currentStageType ~= stageType) and not self.forceNewRoom then
|
|
98
|
+
if (gameFrameCount == 0 or renderFrameCount == self.renderFrameRunStarted or self.currentStage ~= stage or self.currentStageType ~= stageType) and not self.forceNewRoom then
|
|
87
99
|
return
|
|
88
100
|
end
|
|
89
101
|
self.forceNewRoom = false
|
|
90
102
|
self.postNewRoomReordered:fire(roomType)
|
|
91
103
|
end
|
|
92
|
-
self.callbacksUsed = {
|
|
104
|
+
self.callbacksUsed = {
|
|
105
|
+
{ModCallback.POST_USE_ITEM, self.postUseItemGlowingHourGlass, {CollectibleType.GLOWING_HOUR_GLASS}},
|
|
106
|
+
{ModCallback.POST_PLAYER_INIT, self.postPlayerInit},
|
|
107
|
+
{ModCallback.POST_GAME_STARTED, self.postGameStarted},
|
|
108
|
+
{ModCallback.PRE_GAME_EXIT, self.preGameExit},
|
|
109
|
+
{ModCallback.POST_NEW_LEVEL, self.postNewLevel},
|
|
110
|
+
{ModCallback.POST_NEW_ROOM, self.postNewRoom}
|
|
111
|
+
}
|
|
93
112
|
self.postGameStartedReordered = postGameStartedReordered
|
|
94
113
|
self.postNewLevelReordered = postNewLevelReordered
|
|
95
114
|
self.postNewRoomReordered = postNewRoomReordered
|
|
@@ -37,7 +37,7 @@ export declare class SaveDataManager extends Feature {
|
|
|
37
37
|
* contained in nested maps, sets, and arrays.
|
|
38
38
|
*/
|
|
39
39
|
private classConstructors;
|
|
40
|
-
private
|
|
40
|
+
private inARun;
|
|
41
41
|
private restoreGlowingHourGlassDataOnNextRoom;
|
|
42
42
|
private postUseItemGlowingHourGlass;
|
|
43
43
|
private postPlayerInit;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SaveDataManager.d.ts","sourceRoot":"","sources":["../../../../../src/classes/features/other/SaveDataManager.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAOzD,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAEnD,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAsBhD,qBAAa,eAAgB,SAAQ,OAAO;IAC1C;;;OAGG;IACH,OAAO,CAAC,GAAG,CAAM;IAEjB;;;;OAIG;IACH,OAAO,CAAC,WAAW,CAAkC;IAErD;;;OAGG;IACH,OAAO,CAAC,mBAAmB,CAAkC;IAE7D;;;OAGG;IACH,OAAO,CAAC,0BAA0B,CAAuC;IAEzE;;;;;;OAMG;IACH,OAAO,CAAC,2BAA2B,CAAkC;IAErE;;;OAGG;IACH,OAAO,CAAC,iBAAiB,CAAkC;IAG3D,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"SaveDataManager.d.ts","sourceRoot":"","sources":["../../../../../src/classes/features/other/SaveDataManager.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAOzD,OAAO,EAAE,QAAQ,EAAE,MAAM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,IAAI,IAAI;IAIlC;;;;;;;OAOG;IAEI,wBAAwB,IAAI,IAAI;IAIvC;;;;;;;;;;;OAWG;IAEI,4BAA4B,CAAC,GAAG,WAAW,EAAE,QAAQ,EAAE,GAAG,IAAI;IAcrE;;;;;OAKG;IAEI,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAoB/C;;;;;;;;;;;;;;;;;;;;;OAqBG;IAEI,oBAAoB,CAAC,GAAG,EAAE,MAAM,EAAE,cAAc,EAAE,WAAW,GAAG,IAAI;IAsB3E;;;;;;;;;;;;OAYG;IAEI,qBAAqB,IAAI,OAAO;IAKhC,6BAA6B,IAAI,IAAI;CAQ7C"}
|
|
@@ -59,17 +59,17 @@ function SaveDataManager.prototype.____constructor(self, mod)
|
|
|
59
59
|
self.saveDataConditionalFuncMap = {}
|
|
60
60
|
self.saveDataGlowingHourGlassMap = {}
|
|
61
61
|
self.classConstructors = {}
|
|
62
|
-
self.
|
|
62
|
+
self.inARun = false
|
|
63
63
|
self.restoreGlowingHourGlassDataOnNextRoom = false
|
|
64
64
|
self.postUseItemGlowingHourGlass = function(____, _collectibleType, _rng, _player, _useFlags, _activeSlot, _customVarData)
|
|
65
65
|
self.restoreGlowingHourGlassDataOnNextRoom = true
|
|
66
66
|
return nil
|
|
67
67
|
end
|
|
68
68
|
self.postPlayerInit = function(____, _player)
|
|
69
|
-
if self.
|
|
69
|
+
if self.inARun then
|
|
70
70
|
return
|
|
71
71
|
end
|
|
72
|
-
self.
|
|
72
|
+
self.inARun = true
|
|
73
73
|
self.restoreGlowingHourGlassDataOnNextRoom = false
|
|
74
74
|
loadFromDisk(nil, self.mod, self.saveDataMap, self.classConstructors)
|
|
75
75
|
local gameFrameCount = game:GetFrameCount()
|
|
@@ -80,7 +80,7 @@ function SaveDataManager.prototype.____constructor(self, mod)
|
|
|
80
80
|
end
|
|
81
81
|
self.preGameExit = function()
|
|
82
82
|
saveToDisk(nil, self.mod, self.saveDataMap, self.saveDataConditionalFuncMap)
|
|
83
|
-
self.
|
|
83
|
+
self.inARun = false
|
|
84
84
|
end
|
|
85
85
|
self.postNewLevel = function()
|
|
86
86
|
restoreDefaultsForAllFeaturesKey(nil, self.saveDataMap, self.saveDataDefaultsMap, SaveDataKey.LEVEL)
|
|
@@ -195,7 +195,7 @@ function SaveDataManager.prototype.saveDataManagerReset(self, key, childObjectKe
|
|
|
195
195
|
)
|
|
196
196
|
end
|
|
197
197
|
function SaveDataManager.prototype.saveDataManagerInMenu(self)
|
|
198
|
-
return not self.
|
|
198
|
+
return not self.inARun
|
|
199
199
|
end
|
|
200
200
|
function SaveDataManager.prototype.saveDataManagerLogSubscribers(self)
|
|
201
201
|
log("List of save data manager subscribers:")
|
|
@@ -1073,6 +1073,10 @@ export declare enum ModCallbackCustom {
|
|
|
1073
1073
|
* Additionally, this callback will pass the `LevelStage` as the first callback argument and the
|
|
1074
1074
|
* `StageType` as the second callback argument.
|
|
1075
1075
|
*
|
|
1076
|
+
* Note that similar to the vanilla `POST_NEW_LEVEL` callback, this callback will not fire when a
|
|
1077
|
+
* player resumes a saved run. (In that case, only the `POST_GAME_STARTED_REORDERED` and the
|
|
1078
|
+
* `POST_NEW_ROOM_REORDERED` callbacks will fire, in that order).
|
|
1079
|
+
*
|
|
1076
1080
|
* If some specific cases, mods can change the current level during run initialization (on the 0th
|
|
1077
1081
|
* frame). However, due to how the callback reordering works, the custom
|
|
1078
1082
|
* `POST_NEW_LEVEL_REORDERED` callback will never fire on the 0th frame. To get around this, call
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModCallbackCustom.d.ts","sourceRoot":"","sources":["../../../src/enums/ModCallbackCustom.ts"],"names":[],"mappings":"AAYA;;;;;;;GAOG;AACH,oBAAY,iBAAiB;IAC3B;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,sBAAsB,IAAA;IAEtB;;;;;;;;;;;;;;;;;;;OAmBG;IACH,sBAAsB,IAAA;IAEtB;;;;;;;;;;;;;;;;;O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;;;;;;OAmBG;IACH,wBAAwB,MAAA;IAExB;;;;;;;;;;;;;;;OAeG;IACH,qBAAqB,MAAA;IAErB;;;;;;;;;;;;;;;;;OAiBG;IACH,+BAA+B,MAAA;IAE/B;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,4BAA4B,MAAA;IAE5B;;;;;;;;;;;;;;;;;OAiBG;IACH,yBAAyB,MAAA;CAC1B"}
|
|
@@ -32,6 +32,14 @@ export declare function clearSprite(sprite: Sprite, ...layerIDs: int[]): void;
|
|
|
32
32
|
* player animations.
|
|
33
33
|
*/
|
|
34
34
|
export declare function getLastFrameOfAnimation(sprite: Sprite, animation?: string): int;
|
|
35
|
+
/**
|
|
36
|
+
* Helper function to load a new sprite and play its default animation.
|
|
37
|
+
*
|
|
38
|
+
* @param anm2Path The path to the "anm2" file that should be loaded.
|
|
39
|
+
* @param pngPath Optional. The path to a custom PNG file that should be loaded on layer 0 of the
|
|
40
|
+
* sprite.
|
|
41
|
+
*/
|
|
42
|
+
export declare function newSprite(anm2Path: string, pngPath?: string): Sprite;
|
|
35
43
|
/**
|
|
36
44
|
* Helper function to keep a sprite's color the same values as it already is but set the opacity to
|
|
37
45
|
* a specific value.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sprites.d.ts","sourceRoot":"","sources":["../../../src/functions/sprites.ts"],"names":[],"mappings":";;;AAKA;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,QAAQ,EAAE,GAAG,EAAE,GAAG,IAAI,CAWpE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,MAAM,EACd,SAAS,CAAC,EAAE,MAAM,GACjB,GAAG,CAmBL;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,GAAG,IAAI,CAInE;AAED;;;;;;GAMG;AACH,wBAAgB,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B,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,GAAG,GACX,OAAO,CAIT"}
|
|
@@ -64,6 +64,24 @@ function ____exports.getLastFrameOfAnimation(self, sprite, animation)
|
|
|
64
64
|
sprite:SetFrame(currentFrame)
|
|
65
65
|
return finalFrame
|
|
66
66
|
end
|
|
67
|
+
--- Helper function to load a new sprite and play its default animation.
|
|
68
|
+
--
|
|
69
|
+
-- @param anm2Path The path to the "anm2" file that should be loaded.
|
|
70
|
+
-- @param pngPath Optional. The path to a custom PNG file that should be loaded on layer 0 of the
|
|
71
|
+
-- sprite.
|
|
72
|
+
function ____exports.newSprite(self, anm2Path, pngPath)
|
|
73
|
+
local sprite = Sprite()
|
|
74
|
+
if pngPath == nil then
|
|
75
|
+
sprite:Load(anm2Path, true)
|
|
76
|
+
else
|
|
77
|
+
sprite:Load(anm2Path, false)
|
|
78
|
+
sprite:ReplaceSpritesheet(0, pngPath)
|
|
79
|
+
sprite:LoadGraphics()
|
|
80
|
+
end
|
|
81
|
+
local defaultAnimation = sprite:GetDefaultAnimation()
|
|
82
|
+
sprite:Play(defaultAnimation, true)
|
|
83
|
+
return sprite
|
|
84
|
+
end
|
|
67
85
|
--- Helper function to keep a sprite's color the same values as it already is but set the opacity to
|
|
68
86
|
-- a specific value.
|
|
69
87
|
--
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "isaacscript-common",
|
|
3
|
-
"version": "30.
|
|
3
|
+
"version": "30.6.0",
|
|
4
4
|
"description": "Helper functions and features for IsaacScript mods.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"isaac",
|
|
@@ -25,6 +25,6 @@
|
|
|
25
25
|
"main": "dist/src/index",
|
|
26
26
|
"types": "dist/index.rollup.d.ts",
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"isaac-typescript-definitions": "^13.0.
|
|
28
|
+
"isaac-typescript-definitions": "^13.0.9"
|
|
29
29
|
}
|
|
30
30
|
}
|
|
@@ -28,6 +28,9 @@ import { Feature } from "../../private/Feature";
|
|
|
28
28
|
* that you may run into with these callbacks.
|
|
29
29
|
*/
|
|
30
30
|
export class GameReorderedCallbacks extends Feature {
|
|
31
|
+
/** Used to detect a player resuming a saved run. */
|
|
32
|
+
private renderFrameRunStarted: int | null = null;
|
|
33
|
+
|
|
31
34
|
private currentStage: int | null = null;
|
|
32
35
|
private currentStageType: int | null = null;
|
|
33
36
|
private usedGlowingHourGlass = false;
|
|
@@ -56,10 +59,16 @@ export class GameReorderedCallbacks extends Feature {
|
|
|
56
59
|
[CollectibleType.GLOWING_HOUR_GLASS],
|
|
57
60
|
],
|
|
58
61
|
|
|
62
|
+
// 9
|
|
63
|
+
[ModCallback.POST_PLAYER_INIT, this.postPlayerInit],
|
|
64
|
+
|
|
59
65
|
// 15
|
|
60
66
|
// eslint-disable-next-line deprecation/deprecation
|
|
61
67
|
[ModCallback.POST_GAME_STARTED, this.postGameStarted],
|
|
62
68
|
|
|
69
|
+
// 17
|
|
70
|
+
[ModCallback.PRE_GAME_EXIT, this.preGameExit],
|
|
71
|
+
|
|
63
72
|
// 18
|
|
64
73
|
// eslint-disable-next-line deprecation/deprecation
|
|
65
74
|
[ModCallback.POST_NEW_LEVEL, this.postNewLevel],
|
|
@@ -85,6 +94,13 @@ export class GameReorderedCallbacks extends Feature {
|
|
|
85
94
|
return undefined;
|
|
86
95
|
};
|
|
87
96
|
|
|
97
|
+
// ModCallback.POST_PLAYER_INIT (9)
|
|
98
|
+
private postPlayerInit = (_player: EntityPlayer): void => {
|
|
99
|
+
if (this.renderFrameRunStarted === null) {
|
|
100
|
+
this.renderFrameRunStarted = Isaac.GetFrameCount();
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
|
|
88
104
|
// ModCallback.POST_GAME_STARTED (15)
|
|
89
105
|
private postGameStarted = (isContinued: boolean): void => {
|
|
90
106
|
const level = game.GetLevel();
|
|
@@ -95,9 +111,18 @@ export class GameReorderedCallbacks extends Feature {
|
|
|
95
111
|
|
|
96
112
|
this.recordCurrentStage();
|
|
97
113
|
this.postGameStartedReordered.fire(isContinued);
|
|
98
|
-
this.postNewLevelReordered.fire(stage, stageType);
|
|
99
|
-
this.postNewRoomReordered.fire(roomType);
|
|
100
114
|
this.postGameStartedReorderedLast.fire(isContinued);
|
|
115
|
+
if (!isContinued) {
|
|
116
|
+
// The vanilla `POST_NEW_LEVEL` callback only fires on non-continued runs, which makes sense,
|
|
117
|
+
// because we do not want to blow away level variables in this case.
|
|
118
|
+
this.postNewLevelReordered.fire(stage, stageType);
|
|
119
|
+
}
|
|
120
|
+
this.postNewRoomReordered.fire(roomType);
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
// ModCallback.PRE_GAME_EXIT (17)
|
|
124
|
+
private preGameExit = (): void => {
|
|
125
|
+
this.renderFrameRunStarted = null;
|
|
101
126
|
};
|
|
102
127
|
|
|
103
128
|
// ModCallback.POST_NEW_LEVEL (18)
|
|
@@ -128,6 +153,7 @@ export class GameReorderedCallbacks extends Feature {
|
|
|
128
153
|
const stageType = level.GetStageType();
|
|
129
154
|
const room = game.GetRoom();
|
|
130
155
|
const roomType = room.GetType();
|
|
156
|
+
const renderFrameCount = Isaac.GetFrameCount();
|
|
131
157
|
|
|
132
158
|
if (this.usedGlowingHourGlass) {
|
|
133
159
|
this.usedGlowingHourGlass = false;
|
|
@@ -145,6 +171,7 @@ export class GameReorderedCallbacks extends Feature {
|
|
|
145
171
|
|
|
146
172
|
if (
|
|
147
173
|
(gameFrameCount === 0 ||
|
|
174
|
+
renderFrameCount === this.renderFrameRunStarted ||
|
|
148
175
|
this.currentStage !== stage ||
|
|
149
176
|
this.currentStageType !== stageType) &&
|
|
150
177
|
!this.forceNewRoom
|
|
@@ -81,7 +81,7 @@ export class SaveDataManager extends Feature {
|
|
|
81
81
|
private classConstructors = new LuaMap<string, AnyClass>();
|
|
82
82
|
|
|
83
83
|
// Other variables
|
|
84
|
-
private
|
|
84
|
+
private inARun = false;
|
|
85
85
|
private restoreGlowingHourGlassDataOnNextRoom = false;
|
|
86
86
|
|
|
87
87
|
/** @internal */
|
|
@@ -133,10 +133,10 @@ export class SaveDataManager extends Feature {
|
|
|
133
133
|
private postPlayerInit = (_player: EntityPlayer): void => {
|
|
134
134
|
// We want to only load data once per run to handle the case of a player using Genesis, a second
|
|
135
135
|
// player joining the run, and so on.
|
|
136
|
-
if (this.
|
|
136
|
+
if (this.inARun) {
|
|
137
137
|
return;
|
|
138
138
|
}
|
|
139
|
-
this.
|
|
139
|
+
this.inARun = true;
|
|
140
140
|
|
|
141
141
|
// Handle the race-condition of using the Glowing Hourglass and then resetting the run.
|
|
142
142
|
this.restoreGlowingHourGlassDataOnNextRoom = false;
|
|
@@ -166,7 +166,7 @@ export class SaveDataManager extends Feature {
|
|
|
166
166
|
|
|
167
167
|
// Mark that we are going to the menu. (Technically, the `POST_ENTITY_REMOVE` callback may fire
|
|
168
168
|
// before actually going to the menu, but that must be explicitly handled.)
|
|
169
|
-
this.
|
|
169
|
+
this.inARun = false;
|
|
170
170
|
|
|
171
171
|
// At this point, we could blow away the existing save data or restore defaults, but it is not
|
|
172
172
|
// necessary since we will have to do it again in the `POST_PLAYER_INIT` callback. Furthermore,
|
|
@@ -560,7 +560,7 @@ export class SaveDataManager extends Feature {
|
|
|
560
560
|
*/
|
|
561
561
|
@Exported
|
|
562
562
|
public saveDataManagerInMenu(): boolean {
|
|
563
|
-
return !this.
|
|
563
|
+
return !this.inARun;
|
|
564
564
|
}
|
|
565
565
|
|
|
566
566
|
@Exported
|
|
@@ -1148,6 +1148,10 @@ export enum ModCallbackCustom {
|
|
|
1148
1148
|
* Additionally, this callback will pass the `LevelStage` as the first callback argument and the
|
|
1149
1149
|
* `StageType` as the second callback argument.
|
|
1150
1150
|
*
|
|
1151
|
+
* Note that similar to the vanilla `POST_NEW_LEVEL` callback, this callback will not fire when a
|
|
1152
|
+
* player resumes a saved run. (In that case, only the `POST_GAME_STARTED_REORDERED` and the
|
|
1153
|
+
* `POST_NEW_ROOM_REORDERED` callbacks will fire, in that order).
|
|
1154
|
+
*
|
|
1151
1155
|
* If some specific cases, mods can change the current level during run initialization (on the 0th
|
|
1152
1156
|
* frame). However, due to how the callback reordering works, the custom
|
|
1153
1157
|
* `POST_NEW_LEVEL_REORDERED` callback will never fire on the 0th frame. To get around this, call
|
package/src/functions/sprites.ts
CHANGED
|
@@ -69,6 +69,30 @@ export function getLastFrameOfAnimation(
|
|
|
69
69
|
return finalFrame;
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
+
/**
|
|
73
|
+
* Helper function to load a new sprite and play its default animation.
|
|
74
|
+
*
|
|
75
|
+
* @param anm2Path The path to the "anm2" file that should be loaded.
|
|
76
|
+
* @param pngPath Optional. The path to a custom PNG file that should be loaded on layer 0 of the
|
|
77
|
+
* sprite.
|
|
78
|
+
*/
|
|
79
|
+
export function newSprite(anm2Path: string, pngPath?: string): Sprite {
|
|
80
|
+
const sprite = Sprite();
|
|
81
|
+
|
|
82
|
+
if (pngPath === undefined) {
|
|
83
|
+
sprite.Load(anm2Path, true);
|
|
84
|
+
} else {
|
|
85
|
+
sprite.Load(anm2Path, false);
|
|
86
|
+
sprite.ReplaceSpritesheet(0, pngPath);
|
|
87
|
+
sprite.LoadGraphics();
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const defaultAnimation = sprite.GetDefaultAnimation();
|
|
91
|
+
sprite.Play(defaultAnimation, true);
|
|
92
|
+
|
|
93
|
+
return sprite;
|
|
94
|
+
}
|
|
95
|
+
|
|
72
96
|
/**
|
|
73
97
|
* Helper function to keep a sprite's color the same values as it already is but set the opacity to
|
|
74
98
|
* a specific value.
|