isaacscript-common 7.2.0 → 7.3.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/callbacks/itemPickup.d.ts.map +1 -1
- package/dist/callbacks/itemPickup.lua +3 -1
- package/dist/callbacks/postCustomDoorEnter.d.ts.map +1 -1
- package/dist/callbacks/postCustomDoorEnter.lua +14 -11
- package/dist/callbacks/postItemDischarged.d.ts.map +1 -1
- package/dist/callbacks/postItemDischarged.lua +3 -1
- package/dist/callbacks/postPlayerChangeStat.d.ts.map +1 -1
- package/dist/callbacks/postPlayerChangeStat.lua +10 -7
- package/dist/callbacks/postSlotDestroyed.lua +3 -3
- package/dist/core/constants.d.ts +2 -2
- package/dist/core/constants.d.ts.map +1 -1
- package/dist/core/constants.lua +3 -1
- package/dist/core/constantsFirstLast.d.ts +2 -0
- package/dist/core/constantsFirstLast.d.ts.map +1 -1
- package/dist/core/constantsFirstLast.lua +36 -9
- package/dist/enums/SaveDataKey.d.ts +11 -0
- package/dist/enums/SaveDataKey.d.ts.map +1 -0
- package/dist/enums/{private/SaveDataKey.lua → SaveDataKey.lua} +2 -0
- package/dist/enums/index.d.ts +1 -0
- package/dist/enums/index.d.ts.map +1 -1
- package/dist/enums/index.lua +8 -0
- package/dist/features/customGridEntity.d.ts.map +1 -1
- package/dist/features/customGridEntity.lua +3 -1
- package/dist/features/customStage/backdrop.lua +4 -2
- package/dist/features/customStage/customStageGridEntities.d.ts.map +1 -1
- package/dist/features/customStage/customStageGridEntities.lua +3 -1
- package/dist/features/customStage/exports.d.ts.map +1 -1
- package/dist/features/customStage/exports.lua +3 -1
- package/dist/features/customStage/shadows.d.ts.map +1 -1
- package/dist/features/customStage/shadows.lua +2 -1
- package/dist/features/deployJSONRoom.lua +13 -10
- package/dist/features/extraConsoleCommands/listCommands.d.ts.map +1 -1
- package/dist/features/extraConsoleCommands/listCommands.lua +8 -2
- package/dist/features/saveDataManager/exports.d.ts +2 -1
- package/dist/features/saveDataManager/exports.d.ts.map +1 -1
- package/dist/features/saveDataManager/main.d.ts +1 -1
- package/dist/features/saveDataManager/main.d.ts.map +1 -1
- package/dist/features/saveDataManager/main.lua +1 -1
- package/dist/functions/bitSet128.d.ts.map +1 -1
- package/dist/functions/bosses.d.ts.map +1 -1
- package/dist/functions/bosses.lua +3 -1
- package/dist/functions/collectibles.d.ts.map +1 -1
- package/dist/functions/deepCopy.lua +2 -1
- package/dist/functions/doors.d.ts.map +1 -1
- package/dist/functions/doors.lua +3 -1
- package/dist/functions/entities.lua +2 -1
- package/dist/functions/gridEntities.lua +2 -1
- package/dist/functions/gridEntitiesSpecific.d.ts.map +1 -1
- package/dist/functions/gridEntitiesSpecific.lua +5 -3
- package/dist/functions/input.d.ts +1 -1
- package/dist/functions/input.d.ts.map +1 -1
- package/dist/functions/input.lua +1 -1
- package/dist/functions/kColor.d.ts.map +1 -1
- package/dist/functions/levelGrid.d.ts.map +1 -1
- package/dist/functions/levelGrid.lua +3 -1
- package/dist/functions/nextStage.d.ts.map +1 -1
- package/dist/functions/nextStage.lua +7 -5
- package/dist/functions/npcs.d.ts.map +1 -1
- package/dist/functions/npcs.lua +4 -2
- package/dist/functions/pills.d.ts.map +1 -1
- package/dist/functions/pills.lua +9 -3
- package/dist/functions/playerIndex.d.ts.map +1 -1
- package/dist/functions/playerIndex.lua +2 -1
- package/dist/functions/players.d.ts +1 -1
- package/dist/functions/players.d.ts.map +1 -1
- package/dist/functions/players.lua +13 -15
- package/dist/functions/pocketItems.d.ts.map +1 -1
- package/dist/functions/pocketItems.lua +3 -1
- package/dist/functions/rng.d.ts.map +1 -1
- package/dist/functions/rng.lua +3 -0
- package/dist/functions/rooms.d.ts +4 -4
- package/dist/functions/rooms.d.ts.map +1 -1
- package/dist/functions/rooms.lua +17 -16
- package/dist/functions/spawnCollectible.d.ts.map +1 -1
- package/dist/functions/stage.d.ts.map +1 -1
- package/dist/functions/stage.lua +8 -2
- package/dist/functions/trinkets.d.ts.map +1 -1
- package/dist/functions/trinkets.lua +4 -2
- package/dist/functions/types.d.ts +71 -0
- package/dist/functions/types.d.ts.map +1 -1
- package/dist/functions/types.lua +70 -0
- package/dist/functions/vector.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/callbacks/itemPickup.ts +5 -2
- package/src/callbacks/postCustomDoorEnter.ts +18 -11
- package/src/callbacks/postItemDischarged.ts +2 -1
- package/src/callbacks/postPlayerChangeStat.ts +4 -8
- package/src/callbacks/postSlotDestroyed.ts +3 -2
- package/src/callbacks/reorderedCallbacks.ts +2 -2
- package/src/classes/DefaultMap.ts +1 -1
- package/src/core/constants.ts +3 -3
- package/src/core/constantsFirstLast.ts +29 -14
- package/src/enums/SaveDataKey.ts +10 -0
- package/src/enums/index.ts +1 -0
- package/src/enums/indexTypeDoc.ts +1 -0
- package/src/features/customGridEntity.ts +2 -1
- package/src/features/customStage/backdrop.ts +4 -2
- package/src/features/customStage/customStageGridEntities.ts +2 -1
- package/src/features/customStage/exports.ts +5 -4
- package/src/features/customStage/shadows.ts +2 -1
- package/src/features/deployJSONRoom.ts +14 -19
- package/src/features/extraConsoleCommands/listCommands.ts +3 -2
- package/src/features/saveDataManager/exports.ts +4 -4
- package/src/features/saveDataManager/main.ts +1 -1
- package/src/features/saveDataManager/save.ts +1 -1
- package/src/functions/bitSet128.ts +1 -5
- package/src/functions/bosses.ts +2 -1
- package/src/functions/cards.ts +3 -3
- package/src/functions/collectibles.ts +2 -8
- package/src/functions/color.ts +1 -1
- package/src/functions/deepCopy.ts +2 -2
- package/src/functions/dimensions.ts +1 -1
- package/src/functions/doors.ts +2 -2
- package/src/functions/entities.ts +2 -2
- package/src/functions/gridEntities.ts +2 -2
- package/src/functions/gridEntitiesSpecific.ts +4 -3
- package/src/functions/input.ts +2 -2
- package/src/functions/jsonHelpers.ts +1 -1
- package/src/functions/kColor.ts +1 -5
- package/src/functions/levelGrid.ts +3 -2
- package/src/functions/nextStage.ts +6 -5
- package/src/functions/npcs.ts +3 -2
- package/src/functions/pills.ts +11 -9
- package/src/functions/playerIndex.ts +3 -1
- package/src/functions/players.ts +5 -6
- package/src/functions/pocketItems.ts +4 -4
- package/src/functions/rng.ts +8 -5
- package/src/functions/rooms.ts +26 -26
- package/src/functions/spawnCollectible.ts +1 -2
- package/src/functions/stage.ts +3 -2
- package/src/functions/trinkets.ts +6 -5
- package/src/functions/types.ts +111 -0
- package/src/functions/vector.ts +1 -5
- package/dist/enums/private/SaveDataKey.d.ts +0 -7
- package/dist/enums/private/SaveDataKey.d.ts.map +0 -1
- package/src/enums/private/SaveDataKey.ts +0 -6
|
@@ -46,6 +46,8 @@ local getPlayerIndexVanilla = ____playerIndex.getPlayerIndexVanilla
|
|
|
46
46
|
local getPlayers = ____playerIndex.getPlayers
|
|
47
47
|
local ____tears = require("functions.tears")
|
|
48
48
|
local addTearsStat = ____tears.addTearsStat
|
|
49
|
+
local ____types = require("functions.types")
|
|
50
|
+
local isNumber = ____types.isNumber
|
|
49
51
|
local ____utils = require("functions.utils")
|
|
50
52
|
local ____repeat = ____utils["repeat"]
|
|
51
53
|
--- Helper function to get an array containing the characters of all of the current players.
|
|
@@ -295,13 +297,9 @@ end
|
|
|
295
297
|
--- Helper function to get how long Azazel's Brimstone laser should be. You can pass either an
|
|
296
298
|
-- `EntityPlayer` object or a tear height stat.
|
|
297
299
|
--
|
|
298
|
-
-- The formula for calculating it is: 32 - 2.5 *
|
|
300
|
+
-- The formula for calculating it is: 32 - 2.5 * tearHeight
|
|
299
301
|
function ____exports.getAzazelBrimstoneDistance(self, playerOrTearHeight)
|
|
300
|
-
local tearHeight =
|
|
301
|
-
if tearHeight == nil then
|
|
302
|
-
local player = playerOrTearHeight
|
|
303
|
-
tearHeight = player.TearHeight
|
|
304
|
-
end
|
|
302
|
+
local tearHeight = isNumber(nil, playerOrTearHeight) and playerOrTearHeight or playerOrTearHeight.TearHeight
|
|
305
303
|
return 32 - 2.5 * tearHeight
|
|
306
304
|
end
|
|
307
305
|
function ____exports.getClosestPlayer(self, position)
|
|
@@ -743,9 +741,9 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
|
|
|
743
741
|
itemPool:RemoveCollectible(collectibleType)
|
|
744
742
|
end
|
|
745
743
|
repeat
|
|
746
|
-
local
|
|
747
|
-
local
|
|
748
|
-
if
|
|
744
|
+
local ____switch122 = activeSlot
|
|
745
|
+
local ____cond122 = ____switch122 == ActiveSlot.PRIMARY
|
|
746
|
+
if ____cond122 then
|
|
749
747
|
do
|
|
750
748
|
if primaryCollectibleType ~= CollectibleType.NULL then
|
|
751
749
|
player:RemoveCollectible(primaryCollectibleType)
|
|
@@ -754,8 +752,8 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
|
|
|
754
752
|
break
|
|
755
753
|
end
|
|
756
754
|
end
|
|
757
|
-
|
|
758
|
-
if
|
|
755
|
+
____cond122 = ____cond122 or ____switch122 == ActiveSlot.SECONDARY
|
|
756
|
+
if ____cond122 then
|
|
759
757
|
do
|
|
760
758
|
if primaryCollectibleType ~= CollectibleType.NULL then
|
|
761
759
|
player:RemoveCollectible(primaryCollectibleType)
|
|
@@ -770,16 +768,16 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
|
|
|
770
768
|
break
|
|
771
769
|
end
|
|
772
770
|
end
|
|
773
|
-
|
|
774
|
-
if
|
|
771
|
+
____cond122 = ____cond122 or ____switch122 == ActiveSlot.POCKET
|
|
772
|
+
if ____cond122 then
|
|
775
773
|
do
|
|
776
774
|
player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
|
|
777
775
|
player:SetActiveCharge(charge, activeSlot)
|
|
778
776
|
break
|
|
779
777
|
end
|
|
780
778
|
end
|
|
781
|
-
|
|
782
|
-
if
|
|
779
|
+
____cond122 = ____cond122 or ____switch122 == ActiveSlot.POCKET_SINGLE_USE
|
|
780
|
+
if ____cond122 then
|
|
783
781
|
do
|
|
784
782
|
player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
|
|
785
783
|
break
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pocketItems.d.ts","sourceRoot":"","sources":["../../src/functions/pocketItems.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,cAAc,EACf,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;
|
|
1
|
+
{"version":3,"file":"pocketItems.d.ts","sourceRoot":"","sources":["../../src/functions/pocketItems.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,cAAc,EACf,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AAK5E;;;GAGG;AACH,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,YAAY,GACnB,cAAc,GAAG,SAAS,CAS5B;AAED,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,YAAY,GACnB,qBAAqB,GAAG,SAAS,CAOnC;AAED;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,YAAY,GAAG,qBAAqB,EAAE,CA+D5E;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CASnE;AAED;;;GAGG;AACH,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAQzE"}
|
|
@@ -15,6 +15,8 @@ local ____enums = require("functions.enums")
|
|
|
15
15
|
local getEnumValues = ____enums.getEnumValues
|
|
16
16
|
local ____players = require("functions.players")
|
|
17
17
|
local isCharacter = ____players.isCharacter
|
|
18
|
+
local ____types = require("functions.types")
|
|
19
|
+
local asNumber = ____types.asNumber
|
|
18
20
|
--- Use this helper function as a workaround for the `EntityPlayer.GetPocketItem` method not working
|
|
19
21
|
-- correctly.
|
|
20
22
|
--
|
|
@@ -51,7 +53,7 @@ function ____exports.getPocketItems(self, player)
|
|
|
51
53
|
else
|
|
52
54
|
pocketItems[#pocketItems + 1] = {slot = slot, type = PocketItemType.EMPTY, subType = 0}
|
|
53
55
|
end
|
|
54
|
-
if slot + 1 == maxPocketItems then
|
|
56
|
+
if asNumber(nil, slot) + 1 == maxPocketItems then
|
|
55
57
|
break
|
|
56
58
|
end
|
|
57
59
|
end
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rng.d.ts","sourceRoot":"","sources":["../../src/functions/rng.ts"],"names":[],"mappings":";;;AAMA,oBAAY,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG;IACpD,QAAQ,CAAC,oBAAoB,EAAE,MAAM,CAAC;CACvC,CAAC;AAYF,wDAAwD;AACxD,wBAAgB,OAAO,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,CASrC;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,aAAa,GAAG,GAAG,
|
|
1
|
+
{"version":3,"file":"rng.d.ts","sourceRoot":"","sources":["../../src/functions/rng.ts"],"names":[],"mappings":";;;AAMA,oBAAY,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG;IACpD,QAAQ,CAAC,oBAAoB,EAAE,MAAM,CAAC;CACvC,CAAC;AAYF,wDAAwD;AACxD,wBAAgB,OAAO,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,CASrC;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,aAAa,GAAG,GAAG,CAgBtD;AAED;;;;GAIG;AACH,wBAAgB,aAAa,IAAI,IAAI,CAIpC;AAED,6EAA6E;AAC7E,wBAAgB,KAAK,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,IAAI,GAAG,CAEpD;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,IAAI,aAAa,CAMxE;AAED;;;;GAIG;AACH,wBAAgB,MAAM,CAAC,IAAI,OAAkB,GAAG,GAAG,CAIlD;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,GAAG,OAAO,CAEvD;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,GAAG,GAAG,aAAa,CAYpD;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,GAAG,IAAI,CAoBjE;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAK1D;AAED,4FAA4F;AAC5F,wBAAgB,OAAO,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,GAAG,IAAI,CASlD"}
|
package/dist/functions/rng.lua
CHANGED
|
@@ -67,6 +67,9 @@ function ____exports.deserializeRNG(self, rng)
|
|
|
67
67
|
OBJECT_NAME,
|
|
68
68
|
table.unpack(KEYS)
|
|
69
69
|
))
|
|
70
|
+
if seed == nil then
|
|
71
|
+
error(("Failed to deserialize a " .. OBJECT_NAME) .. " object since the provided object did not have a value for: seed")
|
|
72
|
+
end
|
|
70
73
|
return ____exports.newRNG(nil, seed)
|
|
71
74
|
end
|
|
72
75
|
--- Used to determine is the given table is a serialized `RNG` object created by the save data
|
|
@@ -113,14 +113,14 @@ export declare function inBossRoomOf(bossID: BossID): boolean;
|
|
|
113
113
|
*/
|
|
114
114
|
export declare function inCrawlSpace(): boolean;
|
|
115
115
|
/**
|
|
116
|
-
*
|
|
117
|
-
* with the Death Certificate area.
|
|
116
|
+
* Helper function to detect if the current room is one of the room in the Death Certificate area.
|
|
118
117
|
*/
|
|
119
118
|
export declare function inDeathCertificateArea(): boolean;
|
|
120
119
|
/**
|
|
121
120
|
* Helper function to detect if the current room is a Treasure Room created when entering with a
|
|
122
|
-
* Devil's Crown trinket.
|
|
123
|
-
*
|
|
121
|
+
* Devil's Crown trinket.
|
|
122
|
+
*
|
|
123
|
+
* Under the hood, this checks for `RoomDescriptorFlag.DEVIL_TREASURE`.
|
|
124
124
|
*/
|
|
125
125
|
export declare function inDevilsCrownTreasureRoom(): boolean;
|
|
126
126
|
export declare function inDoubleTrouble(): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rooms.d.ts","sourceRoot":"","sources":["../../src/functions/rooms.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,YAAY,EACZ,MAAM,EACN,SAAS,EAKT,YAAY,EACZ,UAAU,EAGV,QAAQ,EAGT,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"rooms.d.ts","sourceRoot":"","sources":["../../src/functions/rooms.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,YAAY,EACZ,MAAM,EACN,SAAS,EAKT,YAAY,EACZ,UAAU,EAGV,QAAQ,EAGT,MAAM,8BAA8B,CAAC;AAkCtC;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,aAAa,EAAE,GAAG,GAAG,IAAI,CAenD;AAED;;;GAGG;AACH,wBAAgB,WAAW,IAAI,GAAG,CAGjC;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,IAAI,KAAK,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC,CAiBlE;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,yBAAyB,CACvC,QAAQ,EAAE,QAAQ,EAClB,WAAW,EAAE,GAAG,EAChB,oBAAoB,UAAO,GAC1B,QAAQ,CAAC,UAAU,CAAC,GAAG,SAAS,CAUlC;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,IAAI,YAAY,CAOlD;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,QAAQ,GAAG,MAAM,CAE1D;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,QAAQ,CACtB,4BAA4B,UAAQ,GACnC,cAAc,EAAE,CAOlB;AAED;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAChC,4BAA4B,UAAQ,GACnC,cAAc,EAAE,CAqBlB;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,SAAS,GAAG,cAAc,EAAE,CAe1E;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,IAAI,cAAc,EAAE,CAWtD;AAED;;;GAGG;AACH,wBAAgB,SAAS,IAAI,OAAO,CAKnC;AAED,wBAAgB,WAAW,IAAI,OAAO,CASrC;AAED,wBAAgB,WAAW,IAAI,OAAO,CASrC;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAWpD;AAED;;;;GAIG;AACH,wBAAgB,YAAY,IAAI,OAAO,CAStC;AAED;;GAEG;AACH,wBAAgB,sBAAsB,IAAI,OAAO,CAShD;AAED;;;;;GAKG;AACH,wBAAgB,yBAAyB,IAAI,OAAO,CAGnD;AAED,wBAAgB,eAAe,IAAI,OAAO,CAMzC;AAED,wBAAgB,aAAa,IAAI,OAAO,CAIvC;AAED,+FAA+F;AAC/F,wBAAgB,OAAO,IAAI,OAAO,CAUjC;AAED,wBAAgB,eAAe,IAAI,OAAO,CAIzC;AAED;;;GAGG;AACH,wBAAgB,WAAW,IAAI,OAAO,CASrC;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,UAAU,GAAG,OAAO,CAWhE;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,IAAI,OAAO,CAItC;AAED;;;;GAIG;AACH,wBAAgB,cAAc,IAAI,OAAO,CAMxC;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,kBAAkB,CAAC,EAAE,QAAQ,EAAE,GAAG,OAAO,CAcxE;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,IAAI,IAAI,CAWrC;AAED,+DAA+D;AAC/D,wBAAgB,WAAW,CAAC,YAAY,EAAE,YAAY,GAAG,IAAI,CAG5D;AAED;;;;GAIG;AACH,wBAAgB,cAAc,IAAI,IAAI,CA8BrC;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,IAAI,IAAI,CAKvC"}
|
package/dist/functions/rooms.lua
CHANGED
|
@@ -28,12 +28,12 @@ local game = ____cachedClasses.game
|
|
|
28
28
|
local sfxManager = ____cachedClasses.sfxManager
|
|
29
29
|
local ____constants = require("core.constants")
|
|
30
30
|
local MAX_LEVEL_GRID_INDEX = ____constants.MAX_LEVEL_GRID_INDEX
|
|
31
|
-
local NUM_DIMENSIONS = ____constants.NUM_DIMENSIONS
|
|
32
31
|
local ____roomTypeNames = require("objects.roomTypeNames")
|
|
33
32
|
local ROOM_TYPE_NAMES = ____roomTypeNames.ROOM_TYPE_NAMES
|
|
34
33
|
local ____mineShaftRoomSubTypesSet = require("sets.mineShaftRoomSubTypesSet")
|
|
35
34
|
local MINE_SHAFT_ROOM_SUB_TYPE_SET = ____mineShaftRoomSubTypesSet.MINE_SHAFT_ROOM_SUB_TYPE_SET
|
|
36
35
|
local ____dimensions = require("functions.dimensions")
|
|
36
|
+
local getAllDimensions = ____dimensions.getAllDimensions
|
|
37
37
|
local inDimension = ____dimensions.inDimension
|
|
38
38
|
local ____doors = require("functions.doors")
|
|
39
39
|
local closeAllDoors = ____doors.closeAllDoors
|
|
@@ -61,8 +61,9 @@ local ____roomTransition = require("functions.roomTransition")
|
|
|
61
61
|
local reloadRoom = ____roomTransition.reloadRoom
|
|
62
62
|
local ____stage = require("functions.stage")
|
|
63
63
|
local getGotoCommand = ____stage.getGotoCommand
|
|
64
|
+
local ____types = require("functions.types")
|
|
65
|
+
local asNumber = ____types.asNumber
|
|
64
66
|
local ____utils = require("functions.utils")
|
|
65
|
-
local erange = ____utils.erange
|
|
66
67
|
local irange = ____utils.irange
|
|
67
68
|
--- Helper function to get a read-only copy of the room descriptor for every room on the level. This
|
|
68
69
|
-- includes off-grid rooms, such as the Devil Room, and extra-dimensional rooms, if they are
|
|
@@ -102,7 +103,7 @@ function ____exports.getRoomsInsideGrid(self, includeExtraDimensionalRooms)
|
|
|
102
103
|
includeExtraDimensionalRooms = false
|
|
103
104
|
end
|
|
104
105
|
local level = game:GetLevel()
|
|
105
|
-
local dimensions = includeExtraDimensionalRooms and
|
|
106
|
+
local dimensions = includeExtraDimensionalRooms and getAllDimensions(nil) or ({Dimension.CURRENT})
|
|
106
107
|
--- We use a map instead of an array because room shapes occupy more than one room grid index.
|
|
107
108
|
local roomDescriptorMap = __TS__New(Map)
|
|
108
109
|
for ____, dimension in ipairs(dimensions) do
|
|
@@ -247,13 +248,13 @@ function ____exports.inAngelShop(self)
|
|
|
247
248
|
local room = game:GetRoom()
|
|
248
249
|
local roomType = room:GetType()
|
|
249
250
|
local roomSubType = getRoomSubType(nil)
|
|
250
|
-
return roomType == RoomType.ANGEL and roomSubType == AngelRoomSubType.SHOP
|
|
251
|
+
return roomType == RoomType.ANGEL and roomSubType == asNumber(nil, AngelRoomSubType.SHOP)
|
|
251
252
|
end
|
|
252
253
|
function ____exports.inBeastRoom(self)
|
|
253
254
|
local room = game:GetRoom()
|
|
254
255
|
local roomType = room:GetType()
|
|
255
256
|
local roomSubType = getRoomSubType(nil)
|
|
256
|
-
return roomType == RoomType.DUNGEON and roomSubType == DungeonSubType.BEAST_ROOM
|
|
257
|
+
return roomType == RoomType.DUNGEON and roomSubType == asNumber(nil, DungeonSubType.BEAST_ROOM)
|
|
257
258
|
end
|
|
258
259
|
--- Helper function to check if the current room is a boss room for a particular boss. This will only
|
|
259
260
|
-- work for bosses that have dedicated boss rooms in the "00.special rooms.stb" file.
|
|
@@ -262,7 +263,7 @@ function ____exports.inBossRoomOf(self, bossID)
|
|
|
262
263
|
local roomType = room:GetType()
|
|
263
264
|
local roomStageID = getRoomStageID(nil)
|
|
264
265
|
local roomSubType = getRoomSubType(nil)
|
|
265
|
-
return roomType == RoomType.BOSS and roomStageID == StageID.SPECIAL_ROOMS and roomSubType == bossID
|
|
266
|
+
return roomType == RoomType.BOSS and roomStageID == StageID.SPECIAL_ROOMS and roomSubType == asNumber(nil, bossID)
|
|
266
267
|
end
|
|
267
268
|
--- Helper function for determining whether the current room is a crawl space. Use this function over
|
|
268
269
|
-- comparing to `RoomType.DUNGEON` or `GridRoom.DUNGEON_IDX` since there is a special case of the
|
|
@@ -271,18 +272,18 @@ function ____exports.inCrawlSpace(self)
|
|
|
271
272
|
local room = game:GetRoom()
|
|
272
273
|
local roomType = room:GetType()
|
|
273
274
|
local roomSubType = getRoomSubType(nil)
|
|
274
|
-
return roomType == RoomType.DUNGEON and roomSubType == DungeonSubType.NORMAL
|
|
275
|
+
return roomType == RoomType.DUNGEON and roomSubType == asNumber(nil, DungeonSubType.NORMAL)
|
|
275
276
|
end
|
|
276
|
-
---
|
|
277
|
-
-- with the Death Certificate area.
|
|
277
|
+
--- Helper function to detect if the current room is one of the room in the Death Certificate area.
|
|
278
278
|
function ____exports.inDeathCertificateArea(self)
|
|
279
279
|
local roomStageID = getRoomStageID(nil)
|
|
280
280
|
local roomSubType = getRoomSubType(nil)
|
|
281
|
-
return roomStageID == StageID.HOME and (roomSubType == HomeRoomSubType.DEATH_CERTIFICATE_ENTRANCE or roomSubType == HomeRoomSubType.DEATH_CERTIFICATE_ITEMS)
|
|
281
|
+
return roomStageID == StageID.HOME and (roomSubType == asNumber(nil, HomeRoomSubType.DEATH_CERTIFICATE_ENTRANCE) or roomSubType == asNumber(nil, HomeRoomSubType.DEATH_CERTIFICATE_ITEMS))
|
|
282
282
|
end
|
|
283
283
|
--- Helper function to detect if the current room is a Treasure Room created when entering with a
|
|
284
|
-
-- Devil's Crown trinket.
|
|
285
|
-
--
|
|
284
|
+
-- Devil's Crown trinket.
|
|
285
|
+
--
|
|
286
|
+
-- Under the hood, this checks for `RoomDescriptorFlag.DEVIL_TREASURE`.
|
|
286
287
|
function ____exports.inDevilsCrownTreasureRoom(self)
|
|
287
288
|
local roomDescriptor = getRoomDescriptorReadOnly(nil)
|
|
288
289
|
return hasFlag(nil, roomDescriptor.Flags, RoomDescriptorFlag.DEVIL_TREASURE)
|
|
@@ -295,7 +296,7 @@ function ____exports.inDoubleTrouble(self)
|
|
|
295
296
|
end
|
|
296
297
|
function ____exports.inGenesisRoom(self)
|
|
297
298
|
local roomGridIndex = getRoomGridIndex(nil)
|
|
298
|
-
return roomGridIndex == GridRoom.GENESIS
|
|
299
|
+
return roomGridIndex == asNumber(nil, GridRoom.GENESIS)
|
|
299
300
|
end
|
|
300
301
|
--- Helper function to determine if the current room shape is one of the four L room shapes.
|
|
301
302
|
function ____exports.inLRoom(self)
|
|
@@ -305,7 +306,7 @@ function ____exports.inLRoom(self)
|
|
|
305
306
|
end
|
|
306
307
|
function ____exports.inMegaSatanRoom(self)
|
|
307
308
|
local roomGridIndex = getRoomGridIndex(nil)
|
|
308
|
-
return roomGridIndex == GridRoom.MEGA_SATAN
|
|
309
|
+
return roomGridIndex == asNumber(nil, GridRoom.MEGA_SATAN)
|
|
309
310
|
end
|
|
310
311
|
--- Helper function to determine if the current room is part of the Repentance "escape sequence" in
|
|
311
312
|
-- the Mines/Ashpit.
|
|
@@ -321,7 +322,7 @@ function ____exports.inMinibossRoomOf(self, minibossID)
|
|
|
321
322
|
local roomType = room:GetType()
|
|
322
323
|
local roomStageID = getRoomStageID(nil)
|
|
323
324
|
local roomSubType = getRoomSubType(nil)
|
|
324
|
-
return roomType == RoomType.MINI_BOSS and roomStageID == StageID.SPECIAL_ROOMS and roomSubType == minibossID
|
|
325
|
+
return roomType == RoomType.MINI_BOSS and roomStageID == StageID.SPECIAL_ROOMS and roomSubType == asNumber(nil, minibossID)
|
|
325
326
|
end
|
|
326
327
|
--- Helper function for checking if the room is a secret shop (from the Member Card collectible).
|
|
327
328
|
--
|
|
@@ -330,7 +331,7 @@ end
|
|
|
330
331
|
-- the only way to detect them is by using the grid index.
|
|
331
332
|
function ____exports.inSecretShop(self)
|
|
332
333
|
local roomGridIndex = getRoomGridIndex(nil)
|
|
333
|
-
return roomGridIndex == GridRoom.SECRET_SHOP
|
|
334
|
+
return roomGridIndex == asNumber(nil, GridRoom.SECRET_SHOP)
|
|
334
335
|
end
|
|
335
336
|
--- Helper function to determine whether or not the current room is the starting room of a floor. It
|
|
336
337
|
-- only returns true for the starting room of the primary dimension (meaning that being in the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spawnCollectible.d.ts","sourceRoot":"","sources":["../../src/functions/spawnCollectible.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,
|
|
1
|
+
{"version":3,"file":"spawnCollectible.d.ts","sourceRoot":"","sources":["../../src/functions/spawnCollectible.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EAGhB,MAAM,8BAA8B,CAAC;AAUtC;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,gBAAgB,CAC9B,eAAe,EAAE,eAAe,EAChC,QAAQ,EAAE,MAAM,EAChB,SAAS,GAAE,IAAI,GAAG,GAAqB,EACvC,OAAO,UAAQ,EACf,aAAa,UAAQ,EACrB,OAAO,CAAC,EAAE,MAAM,GACf,uBAAuB,CAqCzB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,MAAM,EAChB,SAAS,GAAE,IAAI,GAAG,GAAqB,GACtC,YAAY,CAWd"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stage.d.ts","sourceRoot":"","sources":["../../src/functions/stage.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,UAAU,EACV,QAAQ,EACR,SAAS,EACV,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"stage.d.ts","sourceRoot":"","sources":["../../src/functions/stage.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,UAAU,EACV,QAAQ,EACR,SAAS,EACV,MAAM,8BAA8B,CAAC;AAOtC;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,UAAU,GAAG,SAAS,CA6B/D;AAED;;;GAGG;AACH,wBAAgB,4BAA4B,CAAC,KAAK,EAAE,UAAU,GAAG,SAAS,CAmBzE;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,IAAI,GAAG,CASvC;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,GAAG,GAAG,MAAM,CAG3E;AAED,6CAA6C;AAC7C,wBAAgB,QAAQ,IAAI,UAAU,CAIrC;AAED,iDAAiD;AACjD,wBAAgB,YAAY,IAAI,SAAS,CAIxC;AAED,8FAA8F;AAC9F,wBAAgB,SAAS,CAAC,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,GAAG,IAAI,CAIvE;AAED,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAI/D;AAED,wBAAgB,QAAQ,IAAI,OAAO,CAElC;AAED,wBAAgB,WAAW,IAAI,OAAO,CASrC;AAED,wBAAgB,OAAO,IAAI,OAAO,CASjC;AAED,wBAAgB,UAAU,IAAI,OAAO,CAQpC;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,IAAI,OAAO,CAUtC;AAED,wBAAgB,iBAAiB,IAAI,OAAO,CAK3C;AAED,wBAAgB,OAAO,IAAI,OAAO,CAQjC;AAED;;;;;;;;GAQG;AACH,wBAAgB,QAAQ,CACtB,KAAK,EAAE,UAAU,EACjB,SAAS,EAAE,SAAS,EACpB,MAAM,UAAQ,GACb,IAAI,CAUN;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,SAAS,GAAG,MAAM,CAE9D"}
|
package/dist/functions/stage.lua
CHANGED
|
@@ -11,6 +11,9 @@ local ____stageTypeSuffixes = require("objects.stageTypeSuffixes")
|
|
|
11
11
|
local STAGE_TYPE_SUFFIXES = ____stageTypeSuffixes.STAGE_TYPE_SUFFIXES
|
|
12
12
|
local ____stageTypeToLetter = require("objects.stageTypeToLetter")
|
|
13
13
|
local STAGE_TYPE_TO_LETTER = ____stageTypeToLetter.STAGE_TYPE_TO_LETTER
|
|
14
|
+
local ____types = require("functions.types")
|
|
15
|
+
local asLevelStage = ____types.asLevelStage
|
|
16
|
+
local asNumber = ____types.asNumber
|
|
14
17
|
function ____exports.isRepentanceStage(self, stageType)
|
|
15
18
|
return stageType == StageType.REPENTANCE or stageType == StageType.REPENTANCE_B
|
|
16
19
|
end
|
|
@@ -46,7 +49,10 @@ function ____exports.calculateStageTypeRepentance(self, stage)
|
|
|
46
49
|
return StageType.REPENTANCE
|
|
47
50
|
end
|
|
48
51
|
local seeds = game:GetSeeds()
|
|
49
|
-
local adjustedStage =
|
|
52
|
+
local adjustedStage = asLevelStage(
|
|
53
|
+
nil,
|
|
54
|
+
asNumber(nil, stage) + 1
|
|
55
|
+
)
|
|
50
56
|
local stageSeed = seeds:GetStageSeed(adjustedStage)
|
|
51
57
|
local halfStageSeed = math.floor(stageSeed / 2)
|
|
52
58
|
if halfStageSeed % 2 == 0 then
|
|
@@ -61,7 +67,7 @@ function ____exports.getEffectiveStage(self)
|
|
|
61
67
|
local level = game:GetLevel()
|
|
62
68
|
local stage = level:GetStage()
|
|
63
69
|
if ____exports.onRepentanceStage(nil) then
|
|
64
|
-
return stage + 1
|
|
70
|
+
return asNumber(nil, stage) + 1
|
|
65
71
|
end
|
|
66
72
|
return stage
|
|
67
73
|
end
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trinkets.d.ts","sourceRoot":"","sources":["../../src/functions/trinkets.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EAGT,WAAW,EACZ,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"trinkets.d.ts","sourceRoot":"","sources":["../../src/functions/trinkets.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EAGT,WAAW,EACZ,MAAM,8BAA8B,CAAC;AAgCtC;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,WAAW,GAAG,WAAW,CAE1E;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,IAAI,WAAW,EAAE,CAMrD;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,YAAY,GAAG,GAAG,GAAG,SAAS,CAkBxE;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,WAAW,EAAE,WAAW,GAAG,MAAM,CActE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,cAAc,CAAC,WAAW,EAAE,WAAW,GAAG,MAAM,CAc/D;AAED,wEAAwE;AACxE,wBAAgB,eAAe,IAAI,WAAW,EAAE,CAE/C;AAED,kFAAkF;AAClF,wBAAgB,sBAAsB,IAAI,WAAW,EAAE,CAEtD;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAOhE;AAED,wBAAgB,eAAe,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAEjE;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,YAAY,EACrB,OAAO,EAAE,MAAM,GAAG,SAAS,GAC1B,IAAI,CAeN;AAED,wBAAgB,mBAAmB,CACjC,WAAW,EAAE,WAAW,EACxB,SAAS,EAAE,SAAS,GACnB,OAAO,CAOT"}
|
|
@@ -26,6 +26,8 @@ local ____players = require("functions.players")
|
|
|
26
26
|
local isCharacter = ____players.isCharacter
|
|
27
27
|
local ____sprites = require("functions.sprites")
|
|
28
28
|
local clearSprite = ____sprites.clearSprite
|
|
29
|
+
local ____types = require("functions.types")
|
|
30
|
+
local asNumber = ____types.asNumber
|
|
29
31
|
local ____utils = require("functions.utils")
|
|
30
32
|
local irange = ____utils.irange
|
|
31
33
|
--- Add this to a `TrinketType` to get the corresponding golden trinket type.
|
|
@@ -40,7 +42,7 @@ local TRINKET_SPRITE_LAYER = 0
|
|
|
40
42
|
-- For example, passing `TrinketType.SWALLOWED_PENNY` would result in 32769, which is the value that
|
|
41
43
|
-- corresponds to the golden trinket sub-type for Swallowed Penny.
|
|
42
44
|
function ____exports.getGoldenTrinketType(self, trinketType)
|
|
43
|
-
return trinketType + GOLDEN_TRINKET_ADJUSTMENT
|
|
45
|
+
return asNumber(nil, trinketType) + GOLDEN_TRINKET_ADJUSTMENT
|
|
44
46
|
end
|
|
45
47
|
--- Helper function to get an array that represents every modded trinket type.
|
|
46
48
|
--
|
|
@@ -132,7 +134,7 @@ function ____exports.hasOpenTrinketSlot(self, player)
|
|
|
132
134
|
return openTrinketSlot ~= nil
|
|
133
135
|
end
|
|
134
136
|
function ____exports.isGoldenTrinket(self, trinketType)
|
|
135
|
-
return trinketType > GOLDEN_TRINKET_ADJUSTMENT
|
|
137
|
+
return asNumber(nil, trinketType) > GOLDEN_TRINKET_ADJUSTMENT
|
|
136
138
|
end
|
|
137
139
|
--- Helper function to change the sprite of a trinket entity.
|
|
138
140
|
--
|
|
@@ -1,5 +1,76 @@
|
|
|
1
1
|
/// <reference types="typescript-to-lua/language-extensions" />
|
|
2
2
|
/// <reference types="lua-types/5.3" />
|
|
3
|
+
import { Card, CollectibleType, LevelStage, NpcState, PillColor, PillEffect, PlayerType, TrinketType } from "isaac-typescript-definitions";
|
|
4
|
+
/**
|
|
5
|
+
* Helper function to safely cast a `number` to a `Card`. (This is better than using the `as`
|
|
6
|
+
* TypeScript keyword to do a type assertion, since that can obfuscate compiler errors. )
|
|
7
|
+
*
|
|
8
|
+
* This is useful to satisfy the "isaacscript/strict-enums" ESLint rule.
|
|
9
|
+
*/
|
|
10
|
+
export declare function asCard(num: number): Card;
|
|
11
|
+
/**
|
|
12
|
+
* Helper function to safely cast a `number` to a `CollectibleType`. (This is better than using the
|
|
13
|
+
* `as` TypeScript keyword to do a type assertion, since that can obfuscate compiler errors. )
|
|
14
|
+
*
|
|
15
|
+
* This is useful to satisfy the "isaacscript/strict-enums" ESLint rule.
|
|
16
|
+
*/
|
|
17
|
+
export declare function asCollectibleType(num: number): CollectibleType;
|
|
18
|
+
/**
|
|
19
|
+
* Helper function to safely cast a `number` to a `LevelStage`. (This is better than using the `as`
|
|
20
|
+
* TypeScript keyword to do a type assertion, since that can obfuscate compiler errors. )
|
|
21
|
+
*
|
|
22
|
+
* This is useful to satisfy the "isaacscript/strict-enums" ESLint rule.
|
|
23
|
+
*/
|
|
24
|
+
export declare function asLevelStage(num: number): LevelStage;
|
|
25
|
+
/**
|
|
26
|
+
* Helper function to safely cast a `number` to a `NpcState`. (This is better than using the `as`
|
|
27
|
+
* TypeScript keyword to do a type assertion, since that can obfuscate compiler errors. )
|
|
28
|
+
*
|
|
29
|
+
* This is useful to satisfy the "isaacscript/strict-enums" ESLint rule.
|
|
30
|
+
*/
|
|
31
|
+
export declare function asNpcState(num: number): NpcState;
|
|
32
|
+
/**
|
|
33
|
+
* Helper function to safely cast an enum to a `number`. (This is better than using the `as`
|
|
34
|
+
* TypeScript keyword to do a type assertion, since that can obfuscate compiler errors. )
|
|
35
|
+
*
|
|
36
|
+
* This is useful to satisfy the "isaacscript/strict-enums" ESLint rule.
|
|
37
|
+
*/
|
|
38
|
+
export declare function asNumber(num: number): number;
|
|
39
|
+
/**
|
|
40
|
+
* Helper function to safely cast a `number` to a `PillColor`. (This is better than using the `as`
|
|
41
|
+
* TypeScript keyword to do a type assertion, since that can obfuscate compiler errors. )
|
|
42
|
+
*
|
|
43
|
+
* This is useful to satisfy the "isaacscript/strict-enums" ESLint rule.
|
|
44
|
+
*/
|
|
45
|
+
export declare function asPillColor(num: number): PillColor;
|
|
46
|
+
/**
|
|
47
|
+
* Helper function to safely cast a `number` to a `PillEffect`. (This is better than using the `as`
|
|
48
|
+
* TypeScript keyword to do a type assertion, since that can obfuscate compiler errors. )
|
|
49
|
+
*
|
|
50
|
+
* This is useful to satisfy the "isaacscript/strict-enums" ESLint rule.
|
|
51
|
+
*/
|
|
52
|
+
export declare function asPillEffect(num: number): PillEffect;
|
|
53
|
+
/**
|
|
54
|
+
* Helper function to safely cast a `number` to a `PlayerType`. (This is better than using the `as`
|
|
55
|
+
* TypeScript keyword to do a type assertion, since that can obfuscate compiler errors. )
|
|
56
|
+
*
|
|
57
|
+
* This is useful to satisfy the "isaacscript/strict-enums" ESLint rule.
|
|
58
|
+
*/
|
|
59
|
+
export declare function asPlayerType(num: number): PlayerType;
|
|
60
|
+
/**
|
|
61
|
+
* Helper function to safely cast an enum to a `string`. (This is better than using the `as`
|
|
62
|
+
* TypeScript keyword to do a type assertion, since that can obfuscate compiler errors. )
|
|
63
|
+
*
|
|
64
|
+
* This is useful to satisfy the "isaacscript/strict-enums" ESLint rule.
|
|
65
|
+
*/
|
|
66
|
+
export declare function asString(str: string): string;
|
|
67
|
+
/**
|
|
68
|
+
* Helper function to safely cast a `number` to a `TrinketType`. (This is better than using the `as`
|
|
69
|
+
* TypeScript keyword to do a type assertion, since that can obfuscate compiler errors. )
|
|
70
|
+
*
|
|
71
|
+
* This is useful to satisfy the "isaacscript/strict-enums" ESLint rule.
|
|
72
|
+
*/
|
|
73
|
+
export declare function asTrinketType(num: number): TrinketType;
|
|
3
74
|
export declare function isBoolean(variable: unknown): variable is boolean;
|
|
4
75
|
export declare function isFunction(variable: unknown): variable is Function;
|
|
5
76
|
export declare function isNumber(variable: unknown): variable is number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/functions/types.ts"],"names":[],"mappings":";;AAAA,wBAAgB,SAAS,CAAC,QAAQ,EAAE,OAAO,GAAG,QAAQ,IAAI,OAAO,CAEhE;AAGD,wBAAgB,UAAU,CAAC,QAAQ,EAAE,OAAO,GAAG,QAAQ,IAAI,QAAQ,CAElE;AAED,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,OAAO,GAAG,QAAQ,IAAI,MAAM,CAE9D;AAED,+EAA+E;AAC/E,wBAAgB,WAAW,CACzB,QAAQ,EAAE,OAAO,GAChB,QAAQ,IAAI,OAAO,GAAG,MAAM,GAAG,MAAM,CAOvC;AAED,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,OAAO,GAAG,QAAQ,IAAI,MAAM,CAE9D;AAED,wBAAgB,OAAO,CACrB,QAAQ,EAAE,OAAO,GAChB,QAAQ,IAAI,MAAM,CAAC,SAAS,EAAE,OAAO,CAAC,CAExC;AAED,wBAAgB,UAAU,CAAC,QAAQ,EAAE,OAAO,GAAG,QAAQ,IAAI,WAAW,CAErE"}
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/functions/types.ts"],"names":[],"mappings":";;AAAA,OAAO,EACL,IAAI,EACJ,eAAe,EACf,UAAU,EACV,QAAQ,EACR,SAAS,EACT,UAAU,EACV,UAAU,EACV,WAAW,EACZ,MAAM,8BAA8B,CAAC;AAEtC;;;;;GAKG;AACH,wBAAgB,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAExC;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,eAAe,CAE9D;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,CAEpD;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,QAAQ,CAEhD;AAED;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE5C;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAElD;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,CAEpD;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,CAEpD;AAED;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE5C;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,WAAW,CAEtD;AAED,wBAAgB,SAAS,CAAC,QAAQ,EAAE,OAAO,GAAG,QAAQ,IAAI,OAAO,CAEhE;AAGD,wBAAgB,UAAU,CAAC,QAAQ,EAAE,OAAO,GAAG,QAAQ,IAAI,QAAQ,CAElE;AAED,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,OAAO,GAAG,QAAQ,IAAI,MAAM,CAE9D;AAED,+EAA+E;AAC/E,wBAAgB,WAAW,CACzB,QAAQ,EAAE,OAAO,GAChB,QAAQ,IAAI,OAAO,GAAG,MAAM,GAAG,MAAM,CAOvC;AAED,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,OAAO,GAAG,QAAQ,IAAI,MAAM,CAE9D;AAED,wBAAgB,OAAO,CACrB,QAAQ,EAAE,OAAO,GAChB,QAAQ,IAAI,MAAM,CAAC,SAAS,EAAE,OAAO,CAAC,CAExC;AAED,wBAAgB,UAAU,CAAC,QAAQ,EAAE,OAAO,GAAG,QAAQ,IAAI,WAAW,CAErE"}
|
package/dist/functions/types.lua
CHANGED
|
@@ -1,4 +1,74 @@
|
|
|
1
1
|
local ____exports = {}
|
|
2
|
+
--- Helper function to safely cast a `number` to a `Card`. (This is better than using the `as`
|
|
3
|
+
-- TypeScript keyword to do a type assertion, since that can obfuscate compiler errors. )
|
|
4
|
+
--
|
|
5
|
+
-- This is useful to satisfy the "isaacscript/strict-enums" ESLint rule.
|
|
6
|
+
function ____exports.asCard(self, num)
|
|
7
|
+
return num
|
|
8
|
+
end
|
|
9
|
+
--- Helper function to safely cast a `number` to a `CollectibleType`. (This is better than using the
|
|
10
|
+
-- `as` TypeScript keyword to do a type assertion, since that can obfuscate compiler errors. )
|
|
11
|
+
--
|
|
12
|
+
-- This is useful to satisfy the "isaacscript/strict-enums" ESLint rule.
|
|
13
|
+
function ____exports.asCollectibleType(self, num)
|
|
14
|
+
return num
|
|
15
|
+
end
|
|
16
|
+
--- Helper function to safely cast a `number` to a `LevelStage`. (This is better than using the `as`
|
|
17
|
+
-- TypeScript keyword to do a type assertion, since that can obfuscate compiler errors. )
|
|
18
|
+
--
|
|
19
|
+
-- This is useful to satisfy the "isaacscript/strict-enums" ESLint rule.
|
|
20
|
+
function ____exports.asLevelStage(self, num)
|
|
21
|
+
return num
|
|
22
|
+
end
|
|
23
|
+
--- Helper function to safely cast a `number` to a `NpcState`. (This is better than using the `as`
|
|
24
|
+
-- TypeScript keyword to do a type assertion, since that can obfuscate compiler errors. )
|
|
25
|
+
--
|
|
26
|
+
-- This is useful to satisfy the "isaacscript/strict-enums" ESLint rule.
|
|
27
|
+
function ____exports.asNpcState(self, num)
|
|
28
|
+
return num
|
|
29
|
+
end
|
|
30
|
+
--- Helper function to safely cast an enum to a `number`. (This is better than using the `as`
|
|
31
|
+
-- TypeScript keyword to do a type assertion, since that can obfuscate compiler errors. )
|
|
32
|
+
--
|
|
33
|
+
-- This is useful to satisfy the "isaacscript/strict-enums" ESLint rule.
|
|
34
|
+
function ____exports.asNumber(self, num)
|
|
35
|
+
return num
|
|
36
|
+
end
|
|
37
|
+
--- Helper function to safely cast a `number` to a `PillColor`. (This is better than using the `as`
|
|
38
|
+
-- TypeScript keyword to do a type assertion, since that can obfuscate compiler errors. )
|
|
39
|
+
--
|
|
40
|
+
-- This is useful to satisfy the "isaacscript/strict-enums" ESLint rule.
|
|
41
|
+
function ____exports.asPillColor(self, num)
|
|
42
|
+
return num
|
|
43
|
+
end
|
|
44
|
+
--- Helper function to safely cast a `number` to a `PillEffect`. (This is better than using the `as`
|
|
45
|
+
-- TypeScript keyword to do a type assertion, since that can obfuscate compiler errors. )
|
|
46
|
+
--
|
|
47
|
+
-- This is useful to satisfy the "isaacscript/strict-enums" ESLint rule.
|
|
48
|
+
function ____exports.asPillEffect(self, num)
|
|
49
|
+
return num
|
|
50
|
+
end
|
|
51
|
+
--- Helper function to safely cast a `number` to a `PlayerType`. (This is better than using the `as`
|
|
52
|
+
-- TypeScript keyword to do a type assertion, since that can obfuscate compiler errors. )
|
|
53
|
+
--
|
|
54
|
+
-- This is useful to satisfy the "isaacscript/strict-enums" ESLint rule.
|
|
55
|
+
function ____exports.asPlayerType(self, num)
|
|
56
|
+
return num
|
|
57
|
+
end
|
|
58
|
+
--- Helper function to safely cast an enum to a `string`. (This is better than using the `as`
|
|
59
|
+
-- TypeScript keyword to do a type assertion, since that can obfuscate compiler errors. )
|
|
60
|
+
--
|
|
61
|
+
-- This is useful to satisfy the "isaacscript/strict-enums" ESLint rule.
|
|
62
|
+
function ____exports.asString(self, str)
|
|
63
|
+
return str
|
|
64
|
+
end
|
|
65
|
+
--- Helper function to safely cast a `number` to a `TrinketType`. (This is better than using the `as`
|
|
66
|
+
-- TypeScript keyword to do a type assertion, since that can obfuscate compiler errors. )
|
|
67
|
+
--
|
|
68
|
+
-- This is useful to satisfy the "isaacscript/strict-enums" ESLint rule.
|
|
69
|
+
function ____exports.asTrinketType(self, num)
|
|
70
|
+
return num
|
|
71
|
+
end
|
|
2
72
|
function ____exports.isBoolean(self, variable)
|
|
3
73
|
return type(variable) == "boolean"
|
|
4
74
|
end
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vector.d.ts","sourceRoot":"","sources":["../../src/functions/vector.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AASzD,oBAAY,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG;IACvD,QAAQ,CAAC,uBAAuB,EAAE,MAAM,CAAC;CAC1C,CAAC;AAKF,0DAA0D;AAC1D,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAQjD;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,gBAAgB,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"vector.d.ts","sourceRoot":"","sources":["../../src/functions/vector.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AASzD,oBAAY,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG;IACvD,QAAQ,CAAC,uBAAuB,EAAE,MAAM,CAAC;CAC1C,CAAC;AAKF,0DAA0D;AAC1D,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAQjD;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,gBAAgB,GAAG,MAAM,CAqBlE;AAED;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAC7B,SAAS,GAAE,IAAI,GAAG,GAAqB,GACtC,MAAM,CAOR;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,OAAO,GACd,MAAM,IAAI,gBAAgB,CAM5B;AAED,gFAAgF;AAChF,wBAAgB,QAAQ,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,IAAI,MAAM,CAE1D;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,gBAAgB,CAWhE;AAED,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAEtE;AAED,sEAAsE;AACtE,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAG3D;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,UAAQ,GAAG,MAAM,CAIpE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "isaacscript-common",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.3.0",
|
|
4
4
|
"description": "Helper functions and features for IsaacScript mods.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"isaac",
|
|
@@ -22,6 +22,6 @@
|
|
|
22
22
|
"main": "dist/index",
|
|
23
23
|
"types": "dist/index.d.ts",
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"isaac-typescript-definitions": "^3.
|
|
25
|
+
"isaac-typescript-definitions": "^3.5.0"
|
|
26
26
|
}
|
|
27
27
|
}
|
|
@@ -12,6 +12,7 @@ import { ModUpgraded } from "../classes/ModUpgraded";
|
|
|
12
12
|
import { ModCallbackCustom } from "../enums/ModCallbackCustom";
|
|
13
13
|
import { saveDataManager } from "../features/saveDataManager/exports";
|
|
14
14
|
import { defaultMapGetPlayer } from "../functions/playerDataStructures";
|
|
15
|
+
import { asNumber } from "../functions/types";
|
|
15
16
|
import {
|
|
16
17
|
newPickingUpItem,
|
|
17
18
|
PickingUpItem,
|
|
@@ -71,8 +72,10 @@ function postPEffectUpdateReordered(player: EntityPlayer) {
|
|
|
71
72
|
}
|
|
72
73
|
|
|
73
74
|
function queueEmpty(player: EntityPlayer, pickingUpItem: PickingUpItem) {
|
|
74
|
-
|
|
75
|
-
|
|
75
|
+
if (
|
|
76
|
+
pickingUpItem.itemType === ItemType.NULL ||
|
|
77
|
+
asNumber(pickingUpItem.subType) === 0
|
|
78
|
+
) {
|
|
76
79
|
return;
|
|
77
80
|
}
|
|
78
81
|
|
|
@@ -15,11 +15,16 @@ import { directionToVector } from "../functions/direction";
|
|
|
15
15
|
import { doorSlotToDirection } from "../functions/doors";
|
|
16
16
|
import { getEffects, spawnEffect } from "../functions/entitiesSpecific";
|
|
17
17
|
import { getClosestPlayer } from "../functions/players";
|
|
18
|
+
import { asNumber } from "../functions/types";
|
|
18
19
|
import {
|
|
19
20
|
postCustomDoorEnterFire,
|
|
20
21
|
postCustomDoorEnterHasSubscriptions,
|
|
21
22
|
} from "./subscriptions/postCustomDoorEnter";
|
|
22
23
|
|
|
24
|
+
interface EntityEffectCustomDoor extends EntityEffect {
|
|
25
|
+
State: DoorState;
|
|
26
|
+
}
|
|
27
|
+
|
|
23
28
|
interface CustomDoorData {
|
|
24
29
|
slot: DoorSlot;
|
|
25
30
|
state: DoorState;
|
|
@@ -72,41 +77,43 @@ export function initCustomDoorInternal(
|
|
|
72
77
|
|
|
73
78
|
// ModCallback.POST_EFFECT_UPDATE (55)
|
|
74
79
|
function postEffectUpdaterCustomEntity(effect: EntityEffect) {
|
|
80
|
+
const customDoor = effect as EntityEffectCustomDoor;
|
|
81
|
+
|
|
75
82
|
const ptrHash = GetPtrHash(effect);
|
|
76
83
|
const doorData = v.room.customDoors.get(ptrHash);
|
|
77
84
|
if (doorData === undefined) {
|
|
78
85
|
return;
|
|
79
86
|
}
|
|
80
87
|
|
|
81
|
-
if (doorData.state ===
|
|
88
|
+
if (doorData.state === customDoor.State) {
|
|
82
89
|
return;
|
|
83
90
|
}
|
|
84
|
-
doorData.state =
|
|
91
|
+
doorData.state = customDoor.State;
|
|
85
92
|
|
|
86
93
|
doorChangedState(effect);
|
|
87
94
|
}
|
|
88
95
|
|
|
89
|
-
function doorChangedState(
|
|
96
|
+
function doorChangedState(door: EntityEffectCustomDoor) {
|
|
90
97
|
const room = game.GetRoom();
|
|
91
98
|
|
|
92
|
-
const sprite =
|
|
93
|
-
const animation = getAnimationForCustomDoor(
|
|
99
|
+
const sprite = door.GetSprite();
|
|
100
|
+
const animation = getAnimationForCustomDoor(door);
|
|
94
101
|
sprite.Play(animation, true);
|
|
95
102
|
|
|
96
|
-
const gridIndex = room.GetGridIndex(
|
|
103
|
+
const gridIndex = room.GetGridIndex(door.Position);
|
|
97
104
|
const wall = room.GetGridEntity(gridIndex);
|
|
98
105
|
if (wall !== undefined) {
|
|
99
106
|
wall.CollisionClass =
|
|
100
|
-
|
|
107
|
+
door.State === DoorState.OPEN
|
|
101
108
|
? GridCollisionClass.WALL_EXCEPT_PLAYER
|
|
102
109
|
: GridCollisionClass.WALL;
|
|
103
110
|
}
|
|
104
111
|
}
|
|
105
112
|
|
|
106
|
-
function getAnimationForCustomDoor(
|
|
107
|
-
const freshlySpawned =
|
|
113
|
+
function getAnimationForCustomDoor(door: EntityEffectCustomDoor): string {
|
|
114
|
+
const freshlySpawned = door.FrameCount === 0;
|
|
108
115
|
|
|
109
|
-
switch (
|
|
116
|
+
switch (door.State) {
|
|
110
117
|
case DoorState.OPEN: {
|
|
111
118
|
return freshlySpawned ? "Opened" : "Open";
|
|
112
119
|
}
|
|
@@ -220,7 +227,7 @@ export function spawnCustomDoorInternal(
|
|
|
220
227
|
effect.RenderZOffset = -10000;
|
|
221
228
|
effect.PositionOffset = getPositionOffset(doorSlot);
|
|
222
229
|
const sprite = effect.GetSprite();
|
|
223
|
-
sprite.Rotation = (doorSlot
|
|
230
|
+
sprite.Rotation = asNumber(doorSlot) * 90 - 90;
|
|
224
231
|
|
|
225
232
|
// Keep track of metadata about this door.
|
|
226
233
|
const ptrHash = GetPtrHash(effect);
|