isaacscript-common 1.2.174 → 1.2.177
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.lua +0 -1
- package/dist/callbacks/postBombInitLate.lua +0 -1
- package/dist/callbacks/postBoneSwing.lua +0 -1
- package/dist/callbacks/postCursedTeleport.lua +0 -1
- package/dist/callbacks/postCustomDoorEnter.lua +0 -1
- package/dist/callbacks/postEffectInitLate.lua +0 -1
- package/dist/callbacks/postEsauJr.lua +0 -1
- package/dist/callbacks/postFamiliarInitLate.lua +0 -1
- package/dist/callbacks/postFlip.lua +0 -1
- package/dist/callbacks/postGridEntity.lua +0 -1
- package/dist/callbacks/postGridEntityCollision.lua +0 -1
- package/dist/callbacks/postKnifeInitLate.lua +0 -1
- package/dist/callbacks/postLaserInitLate.lua +0 -1
- package/dist/callbacks/postNPCInitLate.lua +0 -1
- package/dist/callbacks/postPickupCollect.lua +0 -1
- package/dist/callbacks/postPickupInitLate.lua +0 -1
- package/dist/callbacks/postPlayerChangeHealth.lua +0 -1
- package/dist/callbacks/postPlayerChangeType.lua +0 -1
- package/dist/callbacks/postPlayerFatalDamage.lua +0 -1
- package/dist/callbacks/postPlayerInitLate.lua +0 -1
- package/dist/callbacks/postPlayerReordered.lua +0 -1
- package/dist/callbacks/postProjectileInitLate.lua +0 -1
- package/dist/callbacks/postPurchase.lua +0 -1
- package/dist/callbacks/postSlotInitUpdate.lua +0 -1
- package/dist/callbacks/postSlotRender.lua +0 -1
- package/dist/callbacks/postTearInitLate.lua +0 -1
- package/dist/callbacks/postTearInitVeryLate.lua +0 -1
- package/dist/callbacks/postTransformation.lua +0 -1
- package/dist/callbacks/postTrinketBreak.lua +0 -1
- package/dist/callbacks/preNewLevel.lua +0 -1
- package/dist/callbacks/subscriptions/postBombInitLate.lua +0 -1
- package/dist/callbacks/subscriptions/postBoneSwing.lua +0 -1
- package/dist/callbacks/subscriptions/postCursedTeleport.lua +0 -1
- package/dist/callbacks/subscriptions/postCustomDoorEnter.lua +0 -1
- package/dist/callbacks/subscriptions/postCustomRevive.lua +0 -1
- package/dist/callbacks/subscriptions/postEffectInitLate.lua +0 -1
- package/dist/callbacks/subscriptions/postEsauJr.lua +0 -1
- package/dist/callbacks/subscriptions/postFamiliarInitLate.lua +0 -1
- package/dist/callbacks/subscriptions/postFirstEsauJr.lua +0 -1
- package/dist/callbacks/subscriptions/postFirstFlip.lua +0 -1
- package/dist/callbacks/subscriptions/postFlip.lua +0 -1
- package/dist/callbacks/subscriptions/postGameStartedReordered.lua +0 -1
- package/dist/callbacks/subscriptions/postGridEntityBroken.lua +0 -1
- package/dist/callbacks/subscriptions/postGridEntityCollision.lua +0 -1
- package/dist/callbacks/subscriptions/postGridEntityInit.lua +0 -1
- package/dist/callbacks/subscriptions/postGridEntityRemove.lua +0 -1
- package/dist/callbacks/subscriptions/postGridEntityStateChange.lua +0 -1
- package/dist/callbacks/subscriptions/postGridEntityUpdate.lua +0 -1
- package/dist/callbacks/subscriptions/postItemPickup.lua +0 -1
- package/dist/callbacks/subscriptions/postKnifeInitLate.lua +0 -1
- package/dist/callbacks/subscriptions/postLaserInitLate.lua +0 -1
- package/dist/callbacks/subscriptions/postNPCInitLate.lua +0 -1
- package/dist/callbacks/subscriptions/postNewLevelReordered.lua +0 -1
- package/dist/callbacks/subscriptions/postNewRoomEarly.lua +0 -1
- package/dist/callbacks/subscriptions/postNewRoomReordered.lua +0 -1
- package/dist/callbacks/subscriptions/postPEffectUpdateReordered.lua +0 -1
- package/dist/callbacks/subscriptions/postPickupCollect.lua +0 -1
- package/dist/callbacks/subscriptions/postPickupInitLate.lua +0 -1
- package/dist/callbacks/subscriptions/postPlayerChangeHealth.lua +0 -1
- package/dist/callbacks/subscriptions/postPlayerChangeType.lua +0 -1
- package/dist/callbacks/subscriptions/postPlayerFatalDamage.lua +0 -1
- package/dist/callbacks/subscriptions/postPlayerInitLate.lua +0 -1
- package/dist/callbacks/subscriptions/postPlayerInitReordered.lua +0 -1
- package/dist/callbacks/subscriptions/postPlayerRenderReordered.lua +0 -1
- package/dist/callbacks/subscriptions/postPlayerUpdateReordered.lua +0 -1
- package/dist/callbacks/subscriptions/postProjectileInitLate.lua +0 -1
- package/dist/callbacks/subscriptions/postPurchase.lua +0 -1
- package/dist/callbacks/subscriptions/postSacrifice.lua +0 -1
- package/dist/callbacks/subscriptions/postSlotAnimationChanged.lua +0 -1
- package/dist/callbacks/subscriptions/postSlotDestroyed.lua +0 -1
- package/dist/callbacks/subscriptions/postSlotInit.lua +0 -1
- package/dist/callbacks/subscriptions/postSlotRender.lua +0 -1
- package/dist/callbacks/subscriptions/postSlotUpdate.lua +0 -1
- package/dist/callbacks/subscriptions/postTearInitLate.lua +0 -1
- package/dist/callbacks/subscriptions/postTearInitVeryLate.lua +0 -1
- package/dist/callbacks/subscriptions/postTransformation.lua +0 -1
- package/dist/callbacks/subscriptions/postTrinketBreak.lua +0 -1
- package/dist/callbacks/subscriptions/preBerserkDeath.lua +0 -1
- package/dist/callbacks/subscriptions/preCustomRevive.lua +0 -1
- package/dist/callbacks/subscriptions/preItemPickup.lua +0 -1
- package/dist/callbacks/subscriptions/preNewLevel.lua +0 -1
- package/dist/callbacks/subscriptions/roomClearChange.lua +0 -1
- package/dist/classes/DefaultMap.lua +0 -1
- package/dist/classes/ModUpgraded.lua +0 -1
- package/dist/classes/null.d.ts +6 -7
- package/dist/classes/null.lua +5 -6
- package/dist/constants.d.ts +10 -10
- package/dist/constants.lua +3 -4
- package/dist/enums/private/SerializationBrand.lua +0 -1
- package/dist/features/collectiblesSeen.d.ts +6 -0
- package/dist/features/collectiblesSeen.lua +42 -0
- package/dist/features/deployJSONRoom.lua +2 -2
- package/dist/features/disableInputs.lua +0 -1
- package/dist/features/disableSound.lua +0 -1
- package/dist/features/extraConsoleCommands/commands.d.ts +11 -11
- package/dist/features/extraConsoleCommands/commands.lua +23 -23
- package/dist/features/extraConsoleCommands/init.lua +6 -7
- package/dist/features/getCollectibleItemPoolType.lua +0 -1
- package/dist/features/isPonyActive.lua +0 -1
- package/dist/features/playerInventory.d.ts +10 -2
- package/dist/features/playerInventory.lua +51 -16
- package/dist/features/preventCollectibleRotate.lua +0 -1
- package/dist/features/runInNFrames.lua +0 -1
- package/dist/features/saveDataManager/constants.d.ts +1 -1
- package/dist/features/saveDataManager/constants.lua +1 -1
- package/dist/features/saveDataManager/exports.d.ts +6 -6
- package/dist/features/saveDataManager/exports.lua +4 -5
- package/dist/features/saveDataManager/load.lua +0 -1
- package/dist/features/saveDataManager/main.lua +0 -1
- package/dist/features/saveDataManager/maps.lua +0 -1
- package/dist/features/saveDataManager/merge.lua +5 -4
- package/dist/features/saveDataManager/save.lua +0 -1
- package/dist/features/sirenHelpers.lua +0 -1
- package/dist/features/taintedLazarusPlayers.lua +0 -1
- package/dist/featuresInitialized.d.ts +1 -1
- package/dist/featuresInitialized.lua +3 -3
- package/dist/functions/array.d.ts +39 -39
- package/dist/functions/array.lua +79 -80
- package/dist/functions/cards.d.ts +3 -3
- package/dist/functions/cards.lua +7 -8
- package/dist/functions/charge.d.ts +11 -11
- package/dist/functions/charge.lua +13 -13
- package/dist/functions/collectibleCacheFlag.lua +0 -1
- package/dist/functions/collectibleSet.lua +0 -1
- package/dist/functions/collectibles.d.ts +53 -15
- package/dist/functions/collectibles.lua +44 -21
- package/dist/functions/color.d.ts +2 -2
- package/dist/functions/color.lua +6 -6
- package/dist/functions/deepCopy.d.ts +0 -3
- package/dist/functions/deepCopy.lua +5 -23
- package/dist/functions/deepCopyTests.lua +0 -1
- package/dist/functions/doors.d.ts +8 -8
- package/dist/functions/doors.lua +16 -17
- package/dist/functions/entity.d.ts +13 -14
- package/dist/functions/entity.lua +27 -35
- package/dist/functions/entitySpecific.lua +0 -1
- package/dist/functions/familiars.lua +0 -1
- package/dist/functions/flying.lua +1 -2
- package/dist/functions/globals.lua +0 -1
- package/dist/functions/gridEntity.d.ts +1 -1
- package/dist/functions/gridEntity.lua +5 -6
- package/dist/functions/input.lua +0 -1
- package/dist/functions/jsonHelpers.d.ts +7 -7
- package/dist/functions/jsonHelpers.lua +10 -11
- package/dist/functions/jsonRoom.lua +0 -1
- package/dist/functions/log.d.ts +21 -21
- package/dist/functions/log.lua +75 -75
- package/dist/functions/map.lua +0 -1
- package/dist/functions/math.d.ts +1 -1
- package/dist/functions/math.lua +3 -4
- package/dist/functions/npc.lua +0 -1
- package/dist/functions/pickups.lua +0 -1
- package/dist/functions/player.d.ts +6 -8
- package/dist/functions/player.lua +22 -30
- package/dist/functions/playerDataStructures.lua +0 -1
- package/dist/functions/playerHealth.d.ts +1 -1
- package/dist/functions/playerHealth.lua +20 -21
- package/dist/functions/pocketItems.lua +0 -1
- package/dist/functions/positionVelocity.d.ts +3 -0
- package/dist/functions/positionVelocity.lua +19 -6
- package/dist/functions/random.d.ts +7 -7
- package/dist/functions/revive.d.ts +5 -5
- package/dist/functions/revive.lua +8 -8
- package/dist/functions/roomData.d.ts +96 -0
- package/dist/functions/roomData.lua +57 -0
- package/dist/functions/rooms.d.ts +1 -96
- package/dist/functions/rooms.lua +30 -76
- package/dist/functions/set.d.ts +2 -2
- package/dist/functions/set.lua +7 -8
- package/dist/functions/string.lua +0 -1
- package/dist/functions/transformations.lua +0 -1
- package/dist/functions/trinketCacheFlag.d.ts +4 -4
- package/dist/functions/trinketCacheFlag.lua +3 -3
- package/dist/functions/trinketGive.d.ts +7 -7
- package/dist/functions/trinketGive.lua +27 -27
- package/dist/functions/trinketSet.lua +0 -1
- package/dist/functions/trinkets.d.ts +2 -2
- package/dist/functions/trinkets.lua +6 -6
- package/dist/functions/ui.d.ts +13 -13
- package/dist/functions/ui.lua +28 -28
- package/dist/functions/utils.d.ts +6 -0
- package/dist/functions/utils.lua +7 -1
- package/dist/functions/vector.d.ts +2 -0
- package/dist/functions/vector.lua +13 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.lua +13 -0
- package/dist/lualib_bundle.lua +83 -49
- package/dist/maps/cardMap.lua +0 -1
- package/dist/maps/characterMap.lua +0 -1
- package/dist/maps/collectibleDescriptionMap.lua +0 -1
- package/dist/maps/collectibleNameMap.lua +0 -1
- package/dist/maps/gridEntityTypeToBrokenStateMap.lua +0 -1
- package/dist/maps/gridEntityXMLMap.lua +0 -1
- package/dist/maps/pillEffectMap.lua +0 -1
- package/dist/maps/roomShapeToTopLeftWallGridIndexMap.d.ts +1 -1
- package/dist/maps/roomShapeToTopLeftWallGridIndexMap.lua +1 -2
- package/dist/maps/roomTypeMap.lua +0 -1
- package/dist/maps/trinketDescriptionMap.lua +0 -1
- package/dist/maps/trinketNameMap.lua +0 -1
- package/dist/patchErrorFunctions.lua +0 -1
- package/dist/types/CollectibleIndex.d.ts +15 -0
- package/dist/types/CollectibleIndex.lua +3 -0
- package/dist/upgradeMod.lua +3 -1
- package/package.json +3 -3
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/// <reference types="isaac-typescript-definitions" />
|
|
2
2
|
import { CollectiblePedestalType } from "../enums/CollectiblePedestalType";
|
|
3
|
-
|
|
3
|
+
import { CollectibleIndex } from "../types/CollectibleIndex";
|
|
4
4
|
export declare function clearCollectibleSprite(collectible: EntityPickup): void;
|
|
5
5
|
export declare function collectibleHasCacheFlag(collectibleType: CollectibleType | int, cacheFlag: CacheFlag): boolean;
|
|
6
|
+
export declare function collectibleHasTag(collectibleType: CollectibleType | int, tag: ItemConfigTag): boolean;
|
|
6
7
|
/**
|
|
7
8
|
* Helper function to get the in-game description for a collectible. Returns "Unknown" if the
|
|
8
9
|
* provided collectible type was not valid.
|
|
@@ -18,16 +19,42 @@ export declare function getCollectibleDevilHeartPrice(collectibleType: Collectib
|
|
|
18
19
|
* "gfx/items/collectibles/questionmark.png" if the provided collectible type was not valid.
|
|
19
20
|
*/
|
|
20
21
|
export declare function getCollectibleGfxFilename(collectibleType: CollectibleType | int): string;
|
|
22
|
+
/**
|
|
23
|
+
* Mods often have to track variables relating to a collectible. Finding an index for these kinds of
|
|
24
|
+
* data structures is difficult, since collectibles are respawned every time a player re-enters a
|
|
25
|
+
* room, so the `PtrHash` will change. Instead, we use a 3-tuple of the room list index, the grid
|
|
26
|
+
* index of the collectible in the room, and the collectible's InitSeed.
|
|
27
|
+
*
|
|
28
|
+
* When collectibles are rolled (e.g. with a D6), their InitSeed changes. If you want to track
|
|
29
|
+
* collectibles independently of any rerolls, then use the `PtrHash` as an index instead. (The
|
|
30
|
+
* `PtrHash` will not persist between rooms, however.)
|
|
31
|
+
*
|
|
32
|
+
* Note that:
|
|
33
|
+
* - The grid index is a necessary part of the collectible index because Diplopia and Crooked Penny
|
|
34
|
+
* can cause two or more collectibles with the same sub-type and InitSeed to exist in the same room.
|
|
35
|
+
* - This index will fail in the case where the player uses Diplopia or a successful Crooked Penny
|
|
36
|
+
* seven or more times in the same room, since that will cause two or more collectibles with the
|
|
37
|
+
* same grid index and InitSeed to exist.
|
|
38
|
+
* - Using a collectible's position as part of the index is problematic, since players can push a
|
|
39
|
+
* pedestal. (Even using the grid index does not solve this problem, since it is possible in certain
|
|
40
|
+
* cases for collectibles to be spawned at a position that is not aligned with the grid, and the
|
|
41
|
+
* pedestal pushed to an adjacent tile, but this case should be extremely rare.)
|
|
42
|
+
* - Mega Chests spawn two collectibles on the exact same position. However, both of them will have
|
|
43
|
+
* different InitSeeds, so this is not a problem for this indexing scheme.
|
|
44
|
+
* - The indexing scheme used is different for collectibles that are inside of a Treasure Room, in
|
|
45
|
+
* order to handle the case of the player seeing the same collectible again in a post-Ascent
|
|
46
|
+
* Treasure Room. An 4-tuple of stage, stage type, grid index, and InitSeed is used in this case.
|
|
47
|
+
* (Using the room list index or the room grid index is not suitable for this purpose, since both
|
|
48
|
+
* of these values can change in the post-Ascent Treasure Room.) Even though there can be two
|
|
49
|
+
* Treasure Rooms on an XL floor, both Treasure Rooms should not have collectibles with the same
|
|
50
|
+
* InitSeed.
|
|
51
|
+
*/
|
|
52
|
+
export declare function getCollectibleIndex(collectible: EntityPickup): CollectibleIndex;
|
|
21
53
|
/**
|
|
22
54
|
* Helper function to get the initial amount of charges that a collectible has. Returns 0 if the
|
|
23
55
|
* provided collectible type was not valid.
|
|
24
56
|
*/
|
|
25
|
-
export declare function
|
|
26
|
-
/**
|
|
27
|
-
* Helper function to get the path to a collectible's quality. Returns 0 if the provided collectible
|
|
28
|
-
* type was not valid.
|
|
29
|
-
*/
|
|
30
|
-
export declare function getCollectibleQuality(collectibleType: CollectibleType | int): int;
|
|
57
|
+
export declare function getCollectibleInitCharge(collectibleType: CollectibleType | int): int;
|
|
31
58
|
/**
|
|
32
59
|
* Helper function to get the `ItemType` of a collectible. Returns `ItemType.ITEM_NULL` if the
|
|
33
60
|
* provided collectible type was not valid.
|
|
@@ -50,6 +77,11 @@ export declare function getCollectibleMaxCharges(collectibleType: CollectibleTyp
|
|
|
50
77
|
*/
|
|
51
78
|
export declare function getCollectibleName(collectibleType: CollectibleType | int): string;
|
|
52
79
|
export declare function getCollectiblePedestalType(collectible: EntityPickup): CollectiblePedestalType;
|
|
80
|
+
/**
|
|
81
|
+
* Helper function to get the path to a collectible's quality. Returns 0 if the provided collectible
|
|
82
|
+
* type was not valid.
|
|
83
|
+
*/
|
|
84
|
+
export declare function getCollectibleQuality(collectibleType: CollectibleType | int): int;
|
|
53
85
|
/** Helper function to get all of the collectible entities in the room. */
|
|
54
86
|
export declare function getCollectibles(matchingSubType?: number): EntityPickup[];
|
|
55
87
|
/**
|
|
@@ -59,6 +91,8 @@ export declare function getCollectibles(matchingSubType?: number): EntityPickup[
|
|
|
59
91
|
* collectibles.
|
|
60
92
|
*/
|
|
61
93
|
export declare function getMaxCollectibleType(): int;
|
|
94
|
+
/** Returns true if the item type in the item config is equal to `ItemType.ITEM_ACTIVE`. */
|
|
95
|
+
export declare function isActiveCollectible(collectibleType: CollectibleType | int): boolean;
|
|
62
96
|
/**
|
|
63
97
|
* Returns whether or not the given collectible is a "glitched" item. All items are replaced by
|
|
64
98
|
* glitched items once a player has TMTRAINER. However, glitched items can also "naturally" appear
|
|
@@ -86,11 +120,6 @@ export declare function isSingleUseCollectible(collectibleType: CollectibleType
|
|
|
86
120
|
* @returns True if one or more collectibles was removed, false otherwise.
|
|
87
121
|
*/
|
|
88
122
|
export declare function removeAllCollectibles(collectibleType?: CollectibleType | int, cap?: int): boolean;
|
|
89
|
-
/**
|
|
90
|
-
* Helper function to remove all pickup delay on a collectible. By default, collectibles have a 20
|
|
91
|
-
* frame delay before they can be picked up by a player.
|
|
92
|
-
*/
|
|
93
|
-
export declare function removeCollectiblePickupDelay(collectible: EntityPickup): void;
|
|
94
123
|
/**
|
|
95
124
|
* Helper function to put a message in the log.txt file to let the Rebirth Item Tracker know that it
|
|
96
125
|
* should remove an item.
|
|
@@ -100,10 +129,14 @@ export declare function removeCollectiblePickupDelay(collectible: EntityPickup):
|
|
|
100
129
|
*/
|
|
101
130
|
export declare function removeCollectibleFromItemTracker(collectibleType: CollectibleType | int): void;
|
|
102
131
|
/**
|
|
103
|
-
* Helper function to
|
|
104
|
-
*
|
|
132
|
+
* Helper function to remove all pickup delay on a collectible. By default, collectibles have a 20
|
|
133
|
+
* frame delay before they can be picked up by a player.
|
|
134
|
+
*/
|
|
135
|
+
export declare function removeCollectiblePickupDelay(collectible: EntityPickup): void;
|
|
136
|
+
/**
|
|
137
|
+
* Helper function to set a collectible sprite to a question mark (i.e. how collectibles look when
|
|
138
|
+
* the player has Curse of the Blind).
|
|
105
139
|
*/
|
|
106
|
-
export declare function setCollectiblesRerolledForItemTracker(): void;
|
|
107
140
|
export declare function setCollectibleBlind(collectible: EntityPickup): void;
|
|
108
141
|
/**
|
|
109
142
|
* Helper function to remove the collectible from a collectible pedestal and make it appear as if a
|
|
@@ -130,3 +163,8 @@ export declare function setCollectibleSprite(collectible: EntityPickup, pngPath:
|
|
|
130
163
|
* not sufficient because the sprite will not change.
|
|
131
164
|
*/
|
|
132
165
|
export declare function setCollectibleSubType(collectible: EntityPickup, newCollectibleType: CollectibleType | int): void;
|
|
166
|
+
/**
|
|
167
|
+
* Helper function to put a message in the log.txt file to let the Rebirth Item Tracker know that
|
|
168
|
+
* the build has been rerolled.
|
|
169
|
+
*/
|
|
170
|
+
export declare function setCollectiblesRerolledForItemTracker(): void;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
local ____exports = {}
|
|
3
3
|
local COLLECTIBLE_SPRITE_LAYER, COLLECTIBLE_SHADOW_LAYER
|
|
4
4
|
local ____cachedClasses = require("cachedClasses")
|
|
5
|
+
local game = ____cachedClasses.game
|
|
5
6
|
local itemConfig = ____cachedClasses.itemConfig
|
|
6
7
|
local ____constants = require("constants")
|
|
7
8
|
local BLIND_ITEM_PNG_PATH = ____constants.BLIND_ITEM_PNG_PATH
|
|
@@ -17,6 +18,8 @@ local hasFlag = ____flag.hasFlag
|
|
|
17
18
|
local ____pickups = require("functions.pickups")
|
|
18
19
|
local getPickups = ____pickups.getPickups
|
|
19
20
|
local removeAllPickups = ____pickups.removeAllPickups
|
|
21
|
+
local ____roomData = require("functions.roomData")
|
|
22
|
+
local getRoomListIndex = ____roomData.getRoomListIndex
|
|
20
23
|
local ____sprite = require("functions.sprite")
|
|
21
24
|
local clearSprite = ____sprite.clearSprite
|
|
22
25
|
function ____exports.setCollectibleSprite(self, collectible, pngPath)
|
|
@@ -34,13 +37,6 @@ end
|
|
|
34
37
|
COLLECTIBLE_SPRITE_LAYER = 1
|
|
35
38
|
COLLECTIBLE_SHADOW_LAYER = 4
|
|
36
39
|
local GLITCHED_ITEM_THRESHOLD = 4000000000
|
|
37
|
-
function ____exports.collectibleHasTag(self, collectibleType, tag)
|
|
38
|
-
local itemConfigItem = itemConfig:GetCollectible(collectibleType)
|
|
39
|
-
if itemConfigItem == nil then
|
|
40
|
-
return false
|
|
41
|
-
end
|
|
42
|
-
return itemConfigItem:HasTags(tag)
|
|
43
|
-
end
|
|
44
40
|
function ____exports.clearCollectibleSprite(self, collectible)
|
|
45
41
|
____exports.setCollectibleSprite(nil, collectible, nil)
|
|
46
42
|
end
|
|
@@ -51,6 +47,13 @@ function ____exports.collectibleHasCacheFlag(self, collectibleType, cacheFlag)
|
|
|
51
47
|
end
|
|
52
48
|
return hasFlag(nil, itemConfigItem.CacheFlags, cacheFlag)
|
|
53
49
|
end
|
|
50
|
+
function ____exports.collectibleHasTag(self, collectibleType, tag)
|
|
51
|
+
local itemConfigItem = itemConfig:GetCollectible(collectibleType)
|
|
52
|
+
if itemConfigItem == nil then
|
|
53
|
+
return false
|
|
54
|
+
end
|
|
55
|
+
return itemConfigItem:HasTags(tag)
|
|
56
|
+
end
|
|
54
57
|
function ____exports.getCollectibleDescription(self, collectibleType)
|
|
55
58
|
local collectibleDescription = COLLECTIBLE_DESCRIPTION_MAP:get(collectibleType)
|
|
56
59
|
if collectibleDescription ~= nil then
|
|
@@ -85,19 +88,28 @@ function ____exports.getCollectibleGfxFilename(self, collectibleType)
|
|
|
85
88
|
end
|
|
86
89
|
return itemConfigItem.GfxFileName
|
|
87
90
|
end
|
|
88
|
-
function ____exports.
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
return 0
|
|
91
|
+
function ____exports.getCollectibleIndex(self, collectible)
|
|
92
|
+
if collectible.Variant ~= PickupVariant.PICKUP_COLLECTIBLE then
|
|
93
|
+
error("You cannot get a collectible index for pickups of variant: " .. tostring(collectible.Variant))
|
|
92
94
|
end
|
|
93
|
-
|
|
95
|
+
local level = game:GetLevel()
|
|
96
|
+
local stage = level:GetStage()
|
|
97
|
+
local stageType = level:GetStageType()
|
|
98
|
+
local room = game:GetRoom()
|
|
99
|
+
local roomType = room:GetType()
|
|
100
|
+
local gridIndex = room:GetGridIndex(collectible.Position)
|
|
101
|
+
local roomListIndex = getRoomListIndex(nil)
|
|
102
|
+
if roomType == RoomType.ROOM_TREASURE then
|
|
103
|
+
return (((((tostring(stage) .. ",") .. tostring(stageType)) .. ",") .. tostring(gridIndex)) .. ",") .. tostring(collectible.InitSeed)
|
|
104
|
+
end
|
|
105
|
+
return (((tostring(roomListIndex) .. ",") .. tostring(gridIndex)) .. ",") .. tostring(collectible.InitSeed)
|
|
94
106
|
end
|
|
95
|
-
function ____exports.
|
|
107
|
+
function ____exports.getCollectibleInitCharge(self, collectibleType)
|
|
96
108
|
local itemConfigItem = itemConfig:GetCollectible(collectibleType)
|
|
97
109
|
if itemConfigItem == nil then
|
|
98
110
|
return 0
|
|
99
111
|
end
|
|
100
|
-
return itemConfigItem.
|
|
112
|
+
return itemConfigItem.InitCharge
|
|
101
113
|
end
|
|
102
114
|
function ____exports.getCollectibleItemType(self, collectibleType)
|
|
103
115
|
local itemConfigItem = itemConfig:GetCollectible(collectibleType)
|
|
@@ -131,6 +143,13 @@ function ____exports.getCollectiblePedestalType(self, collectible)
|
|
|
131
143
|
local sprite = collectible:GetSprite()
|
|
132
144
|
return sprite:GetOverlayFrame()
|
|
133
145
|
end
|
|
146
|
+
function ____exports.getCollectibleQuality(self, collectibleType)
|
|
147
|
+
local itemConfigItem = itemConfig:GetCollectible(collectibleType)
|
|
148
|
+
if itemConfigItem == nil then
|
|
149
|
+
return 0
|
|
150
|
+
end
|
|
151
|
+
return itemConfigItem.Quality
|
|
152
|
+
end
|
|
134
153
|
function ____exports.getCollectibles(self, matchingSubType)
|
|
135
154
|
if matchingSubType == nil then
|
|
136
155
|
matchingSubType = -1
|
|
@@ -140,6 +159,10 @@ end
|
|
|
140
159
|
function ____exports.getMaxCollectibleType(self)
|
|
141
160
|
return itemConfig:GetCollectibles().Size - 1
|
|
142
161
|
end
|
|
162
|
+
function ____exports.isActiveCollectible(self, collectibleType)
|
|
163
|
+
local itemType = ____exports.getCollectibleItemType(nil, collectibleType)
|
|
164
|
+
return itemType == ItemType.ITEM_ACTIVE
|
|
165
|
+
end
|
|
143
166
|
function ____exports.isGlitchedCollectible(self, pickup)
|
|
144
167
|
return pickup.Variant == PickupVariant.PICKUP_COLLECTIBLE and pickup.SubType > GLITCHED_ITEM_THRESHOLD
|
|
145
168
|
end
|
|
@@ -156,19 +179,16 @@ end
|
|
|
156
179
|
function ____exports.removeAllCollectibles(self, collectibleType, cap)
|
|
157
180
|
return removeAllPickups(nil, PickupVariant.PICKUP_COLLECTIBLE, collectibleType, cap)
|
|
158
181
|
end
|
|
182
|
+
function ____exports.removeCollectibleFromItemTracker(self, collectibleType)
|
|
183
|
+
local collectibleName = ____exports.getCollectibleName(nil, collectibleType)
|
|
184
|
+
Isaac.DebugString(((("Removing collectible " .. tostring(collectibleType)) .. " (") .. collectibleName) .. ") on player 0 (Player)")
|
|
185
|
+
end
|
|
159
186
|
function ____exports.removeCollectiblePickupDelay(self, collectible)
|
|
160
187
|
if collectible.Variant ~= PickupVariant.PICKUP_COLLECTIBLE then
|
|
161
188
|
error("You cannot remove pickup delay for pickups of variant: " .. tostring(collectible.Variant))
|
|
162
189
|
end
|
|
163
190
|
collectible.Wait = 0
|
|
164
191
|
end
|
|
165
|
-
function ____exports.removeCollectibleFromItemTracker(self, collectibleType)
|
|
166
|
-
local collectibleName = ____exports.getCollectibleName(nil, collectibleType)
|
|
167
|
-
Isaac.DebugString(((("Removing collectible " .. tostring(collectibleType)) .. " (") .. collectibleName) .. ") on player 0 (Player)")
|
|
168
|
-
end
|
|
169
|
-
function ____exports.setCollectiblesRerolledForItemTracker(self)
|
|
170
|
-
Isaac.DebugString("Added 3 Collectibles")
|
|
171
|
-
end
|
|
172
192
|
function ____exports.setCollectibleBlind(self, collectible)
|
|
173
193
|
if collectible.Variant ~= PickupVariant.PICKUP_COLLECTIBLE then
|
|
174
194
|
error("You cannot set a collectible to be blind for pickups of variant: " .. tostring(collectible.Variant))
|
|
@@ -199,4 +219,7 @@ function ____exports.setCollectibleSubType(self, collectible, newCollectibleType
|
|
|
199
219
|
true
|
|
200
220
|
)
|
|
201
221
|
end
|
|
222
|
+
function ____exports.setCollectiblesRerolledForItemTracker(self)
|
|
223
|
+
Isaac.DebugString("Added 3 Collectibles")
|
|
224
|
+
end
|
|
202
225
|
return ____exports
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="isaac-typescript-definitions" />
|
|
2
|
-
export declare function getDefaultColor(): Color;
|
|
3
|
-
export declare function getDefaultKColor(): KColor;
|
|
4
2
|
export declare function copyColor(color: Color): Color;
|
|
5
3
|
export declare function copyKColor(kColor: KColor): KColor;
|
|
4
|
+
export declare function getDefaultColor(): Color;
|
|
5
|
+
export declare function getDefaultKColor(): KColor;
|
package/dist/functions/color.lua
CHANGED
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
2
|
local ____exports = {}
|
|
3
|
-
function ____exports.getDefaultColor(self)
|
|
4
|
-
return Color(1, 1, 1)
|
|
5
|
-
end
|
|
6
|
-
function ____exports.getDefaultKColor(self)
|
|
7
|
-
return KColor(1, 1, 1, 1)
|
|
8
|
-
end
|
|
9
3
|
function ____exports.copyColor(self, color)
|
|
10
4
|
return Color(
|
|
11
5
|
color.R,
|
|
@@ -20,4 +14,10 @@ end
|
|
|
20
14
|
function ____exports.copyKColor(self, kColor)
|
|
21
15
|
return KColor(kColor.Red, kColor.Green, kColor.Blue, kColor.Alpha)
|
|
22
16
|
end
|
|
17
|
+
function ____exports.getDefaultColor(self)
|
|
18
|
+
return Color(1, 1, 1)
|
|
19
|
+
end
|
|
20
|
+
function ____exports.getDefaultKColor(self)
|
|
21
|
+
return KColor(1, 1, 1, 1)
|
|
22
|
+
end
|
|
23
23
|
return ____exports
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/// <reference types="typescript-to-lua/language-extensions" />
|
|
2
|
-
/// <reference types="isaac-typescript-definitions" />
|
|
3
2
|
import { SerializationType } from "../enums/SerializationType";
|
|
4
3
|
/**
|
|
5
4
|
* deepCopy is a semi-generic deep cloner. It will recursively copy all of the values so that none
|
|
@@ -21,8 +20,6 @@ import { SerializationType } from "../enums/SerializationType";
|
|
|
21
20
|
* @param traversalDescription Used to track the current key that we are operating on.
|
|
22
21
|
*/
|
|
23
22
|
export declare function deepCopy(oldObject: LuaTable | Map<AnyNotNil, unknown> | Set<AnyNotNil>, serializationType?: SerializationType, traversalDescription?: string): LuaTable | Map<AnyNotNil, unknown> | Set<AnyNotNil>;
|
|
24
|
-
export declare function deserializeVector(vectorTable: LuaTable): Vector;
|
|
25
|
-
export declare function addTraversalDescription(key: AnyNotNil, traversalDescription: string): string;
|
|
26
23
|
/**
|
|
27
24
|
* Used to determine is the given table is a serialized Vector created by the save data manager
|
|
28
25
|
* and/or the `deepCopy` function.
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
1
|
local ____lualib = require("lualib_bundle")
|
|
3
2
|
local Set = ____lualib.Set
|
|
4
3
|
local __TS__New = ____lualib.__TS__New
|
|
@@ -18,7 +17,10 @@ local ____constants = require("features.saveDataManager.constants")
|
|
|
18
17
|
local SAVE_DATA_MANAGER_DEBUG = ____constants.SAVE_DATA_MANAGER_DEBUG
|
|
19
18
|
local ____log = require("functions.log")
|
|
20
19
|
local log = ____log.log
|
|
20
|
+
local ____utils = require("functions.utils")
|
|
21
|
+
local getTraversalDescription = ____utils.getTraversalDescription
|
|
21
22
|
local ____vector = require("functions.vector")
|
|
23
|
+
local deserializeVector = ____vector.deserializeVector
|
|
22
24
|
local isVector = ____vector.isVector
|
|
23
25
|
function ____exports.deepCopy(self, oldObject, serializationType, traversalDescription)
|
|
24
26
|
if serializationType == nil then
|
|
@@ -205,10 +207,10 @@ function deepCopyValue(self, oldObject, newObject, key, value, traversalDescript
|
|
|
205
207
|
newValue = copyVector(nil, vector, serializationType)
|
|
206
208
|
elseif ____exports.isSerializedVector(nil, value) and serializationType == SerializationType.DESERIALIZE then
|
|
207
209
|
local serializedVector = value
|
|
208
|
-
newValue =
|
|
210
|
+
newValue = deserializeVector(nil, serializedVector)
|
|
209
211
|
elseif valueType == "table" then
|
|
210
212
|
local ____table = value
|
|
211
|
-
traversalDescription =
|
|
213
|
+
traversalDescription = getTraversalDescription(nil, key, traversalDescription)
|
|
212
214
|
newValue = ____exports.deepCopy(nil, ____table, serializationType, traversalDescription)
|
|
213
215
|
else
|
|
214
216
|
newValue = value
|
|
@@ -233,19 +235,6 @@ function copyVector(self, vector, serializationType)
|
|
|
233
235
|
local newVector = Vector(vector.X, vector.Y)
|
|
234
236
|
return newVector
|
|
235
237
|
end
|
|
236
|
-
function ____exports.deserializeVector(self, vectorTable)
|
|
237
|
-
local xString = vectorTable.X
|
|
238
|
-
local x = tonumber(xString)
|
|
239
|
-
if x == nil then
|
|
240
|
-
error("Failed to read the X value of a serialized vector.")
|
|
241
|
-
end
|
|
242
|
-
local yString = vectorTable.Y
|
|
243
|
-
local y = tonumber(yString)
|
|
244
|
-
if y == nil then
|
|
245
|
-
error("Failed to read the Y value of a serialized vector.")
|
|
246
|
-
end
|
|
247
|
-
return Vector(x, y)
|
|
248
|
-
end
|
|
249
238
|
function checkMetatable(self, ____table, traversalDescription)
|
|
250
239
|
local metatable = getmetatable(____table)
|
|
251
240
|
if metatable == nil then
|
|
@@ -262,13 +251,6 @@ function validateValue(self, value, valueType, traversalDescription)
|
|
|
262
251
|
error(((("The deepCopy function detected that \"" .. traversalDescription) .. "\" is type ") .. valueType) .. ", which is not supported.")
|
|
263
252
|
end
|
|
264
253
|
end
|
|
265
|
-
function ____exports.addTraversalDescription(self, key, traversalDescription)
|
|
266
|
-
if traversalDescription ~= "" then
|
|
267
|
-
traversalDescription = traversalDescription .. " --> "
|
|
268
|
-
end
|
|
269
|
-
traversalDescription = traversalDescription .. tostring(key)
|
|
270
|
-
return traversalDescription
|
|
271
|
-
end
|
|
272
254
|
function ____exports.isSerializedVector(self, object)
|
|
273
255
|
local objectType = type(object)
|
|
274
256
|
if objectType ~= "table" then
|
|
@@ -6,6 +6,13 @@ export declare function closeAllDoors(): void;
|
|
|
6
6
|
*/
|
|
7
7
|
export declare function closeDoorFast(door: GridEntityDoor): void;
|
|
8
8
|
export declare function doorSlotToDirection(doorSlot: DoorSlot): Direction;
|
|
9
|
+
export declare function getAngelRoomDoor(): GridEntityDoor | undefined;
|
|
10
|
+
export declare function getDevilRoomDoor(): GridEntityDoor | undefined;
|
|
11
|
+
/**
|
|
12
|
+
* If there is both a Devil Room and an Angel Room door, this function will return door with the
|
|
13
|
+
* lowest slot number.
|
|
14
|
+
*/
|
|
15
|
+
export declare function getDevilRoomOrAngelRoomDoor(): GridEntityDoor | undefined;
|
|
9
16
|
/**
|
|
10
17
|
* Helper function to get all of the doors in the room. By default, it will return every door. You
|
|
11
18
|
* can optionally specify one or more room types to return only the doors that match the specified
|
|
@@ -19,17 +26,9 @@ export declare function getDoors(...roomTypes: RoomType[]): GridEntityDoor[];
|
|
|
19
26
|
* that match any of the N room grid indexes.
|
|
20
27
|
*/
|
|
21
28
|
export declare function getDoorsToRoomIndex(...roomGridIndex: int[]): GridEntityDoor[];
|
|
22
|
-
export declare function getAngelRoomDoor(): GridEntityDoor | undefined;
|
|
23
|
-
export declare function getDevilRoomDoor(): GridEntityDoor | undefined;
|
|
24
|
-
/**
|
|
25
|
-
* If there is both a Devil Room and an Angel Room door, this function will return door with the
|
|
26
|
-
* lowest slot number.
|
|
27
|
-
*/
|
|
28
|
-
export declare function getDevilRoomOrAngelRoomDoor(): GridEntityDoor | undefined;
|
|
29
29
|
export declare function getRepentanceDoor(): GridEntityDoor | undefined;
|
|
30
30
|
export declare function isAngelRoomDoor(door: GridEntityDoor): boolean;
|
|
31
31
|
export declare function isDevilRoomDoor(door: GridEntityDoor): boolean;
|
|
32
|
-
export declare function isHiddenSecretRoomDoor(door: GridEntityDoor): boolean;
|
|
33
32
|
/**
|
|
34
33
|
* This refers to the Repentance door that spawns in a boss room after defeating the boss.
|
|
35
34
|
* You have to spend one key to open it.
|
|
@@ -60,6 +59,7 @@ export declare function isDoorToMines(door: GridEntityDoor): boolean;
|
|
|
60
59
|
* It has a sprite filename of "gfx/grid/Door_MomsHeart.anm2".
|
|
61
60
|
*/
|
|
62
61
|
export declare function isDoorToMomsHeart(door: GridEntityDoor): boolean;
|
|
62
|
+
export declare function isHiddenSecretRoomDoor(door: GridEntityDoor): boolean;
|
|
63
63
|
export declare function isRepentanceDoor(door: GridEntityDoor): boolean;
|
|
64
64
|
export declare function isSecretRoomDoor(door: GridEntityDoor): boolean;
|
|
65
65
|
/**
|
package/dist/functions/doors.lua
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
1
|
local ____lualib = require("lualib_bundle")
|
|
3
2
|
local Set = ____lualib.Set
|
|
4
3
|
local __TS__New = ____lualib.__TS__New
|
|
@@ -23,13 +22,13 @@ function ____exports.getDoors(self, ...)
|
|
|
23
22
|
do
|
|
24
23
|
local door = room:GetDoor(i)
|
|
25
24
|
if door == nil then
|
|
26
|
-
goto
|
|
25
|
+
goto __continue11
|
|
27
26
|
end
|
|
28
27
|
if #roomTypes == 0 or roomTypesSet:has(door.TargetRoomType) then
|
|
29
28
|
__TS__ArrayPush(doors, door)
|
|
30
29
|
end
|
|
31
30
|
end
|
|
32
|
-
::
|
|
31
|
+
::__continue11::
|
|
33
32
|
i = i + 1
|
|
34
33
|
end
|
|
35
34
|
end
|
|
@@ -66,15 +65,6 @@ end
|
|
|
66
65
|
function ____exports.doorSlotToDirection(self, doorSlot)
|
|
67
66
|
return DOOR_SLOT_TO_DIRECTION[doorSlot]
|
|
68
67
|
end
|
|
69
|
-
function ____exports.getDoorsToRoomIndex(self, ...)
|
|
70
|
-
local roomGridIndex = {...}
|
|
71
|
-
local roomGridIndexesSet = __TS__New(Set, roomGridIndex)
|
|
72
|
-
local doors = ____exports.getDoors(nil)
|
|
73
|
-
return __TS__ArrayFilter(
|
|
74
|
-
doors,
|
|
75
|
-
function(____, door) return roomGridIndexesSet:has(door.TargetRoomIndex) end
|
|
76
|
-
)
|
|
77
|
-
end
|
|
78
68
|
function ____exports.getAngelRoomDoor(self)
|
|
79
69
|
local angelRoomDoors = ____exports.getDoors(nil, RoomType.ROOM_ANGEL)
|
|
80
70
|
local ____temp_0
|
|
@@ -105,6 +95,15 @@ function ____exports.getDevilRoomOrAngelRoomDoor(self)
|
|
|
105
95
|
end
|
|
106
96
|
return ____temp_2
|
|
107
97
|
end
|
|
98
|
+
function ____exports.getDoorsToRoomIndex(self, ...)
|
|
99
|
+
local roomGridIndex = {...}
|
|
100
|
+
local roomGridIndexesSet = __TS__New(Set, roomGridIndex)
|
|
101
|
+
local doors = ____exports.getDoors(nil)
|
|
102
|
+
return __TS__ArrayFilter(
|
|
103
|
+
doors,
|
|
104
|
+
function(____, door) return roomGridIndexesSet:has(door.TargetRoomIndex) end
|
|
105
|
+
)
|
|
106
|
+
end
|
|
108
107
|
function ____exports.getRepentanceDoor(self)
|
|
109
108
|
local doors = ____exports.getDoors(nil)
|
|
110
109
|
return __TS__ArrayFind(
|
|
@@ -118,11 +117,6 @@ end
|
|
|
118
117
|
function ____exports.isDevilRoomDoor(self, door)
|
|
119
118
|
return door.TargetRoomType == RoomType.ROOM_DEVIL
|
|
120
119
|
end
|
|
121
|
-
function ____exports.isHiddenSecretRoomDoor(self, door)
|
|
122
|
-
local sprite = door:GetSprite()
|
|
123
|
-
local animation = sprite:GetAnimation()
|
|
124
|
-
return ____exports.isSecretRoomDoor(nil, door) and animation == "Hidden"
|
|
125
|
-
end
|
|
126
120
|
function ____exports.isDoorToDownpour(self, door)
|
|
127
121
|
if not ____exports.isRepentanceDoor(nil, door) then
|
|
128
122
|
return false
|
|
@@ -163,6 +157,11 @@ function ____exports.isDoorToMomsHeart(self, door)
|
|
|
163
157
|
local filename = sprite:GetFilename()
|
|
164
158
|
return filename == "gfx/grid/Door_MomsHeart.anm2"
|
|
165
159
|
end
|
|
160
|
+
function ____exports.isHiddenSecretRoomDoor(self, door)
|
|
161
|
+
local sprite = door:GetSprite()
|
|
162
|
+
local animation = sprite:GetAnimation()
|
|
163
|
+
return ____exports.isSecretRoomDoor(nil, door) and animation == "Hidden"
|
|
164
|
+
end
|
|
166
165
|
function ____exports.lockDoor(self, door)
|
|
167
166
|
local level = game:GetLevel()
|
|
168
167
|
local roomDescriptor = level:GetRoomByIdx(door.TargetRoomIndex)
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/// <reference types="isaac-typescript-definitions" />
|
|
2
2
|
import { AnyEntity } from "../types/AnyEntity";
|
|
3
|
-
export declare function anyEntityCloserThan(entities: Entity[], position: Vector, distance: int): boolean;
|
|
4
3
|
/**
|
|
5
4
|
* Helper function to count the number of entities in room. Use this over the vanilla
|
|
6
5
|
* `Isaac.CountEntities` method to avoid having to specify a spawner and to handle ignoring charmed
|
|
@@ -24,11 +23,6 @@ export declare function countEntities(entityType?: EntityType | int, variant?: n
|
|
|
24
23
|
* ```
|
|
25
24
|
*/
|
|
26
25
|
export declare function getClosestEntityTo<T extends AnyEntity>(referenceEntity: Entity, entities: T[]): T;
|
|
27
|
-
/**
|
|
28
|
-
* Helper function to compare two different arrays of entities. Returns the entities that are in the
|
|
29
|
-
* second array but not in the first array.
|
|
30
|
-
*/
|
|
31
|
-
export declare function getFilteredNewEntities<T extends AnyEntity>(oldEntities: T[], newEntities: T[]): T[];
|
|
32
26
|
/**
|
|
33
27
|
* Helper function to get all of the entities in the room or all of the entities that match a
|
|
34
28
|
* specific entity type / variant / sub-type.
|
|
@@ -55,6 +49,11 @@ export declare function getFilteredNewEntities<T extends AnyEntity>(oldEntities:
|
|
|
55
49
|
export declare function getEntities(matchingEntityType?: EntityType | int, matchingVariant?: number, matchingSubType?: number, ignoreFriendly?: boolean): Entity[];
|
|
56
50
|
/** Helper function to return a string containing an entity's type, variant, and sub-type. */
|
|
57
51
|
export declare function getEntityID(entity: Entity): string;
|
|
52
|
+
/**
|
|
53
|
+
* Helper function to compare two different arrays of entities. Returns the entities that are in the
|
|
54
|
+
* second array but not in the first array.
|
|
55
|
+
*/
|
|
56
|
+
export declare function getFilteredNewEntities<T extends AnyEntity>(oldEntities: T[], newEntities: T[]): T[];
|
|
58
57
|
/**
|
|
59
58
|
* Helper function to measure an entity's velocity to see if it is moving.
|
|
60
59
|
*
|
|
@@ -68,14 +67,6 @@ export declare function isEntityMoving(entity: Entity, threshold?: number): bool
|
|
|
68
67
|
* to non-story bosses, like Vanishing Twin. Also see the `STORY_BOSSES` constant.
|
|
69
68
|
*/
|
|
70
69
|
export declare function isStoryBoss(entity: Entity): boolean;
|
|
71
|
-
/**
|
|
72
|
-
* Helper function to remove all of the entities in the supplied array.
|
|
73
|
-
*
|
|
74
|
-
* @param entities The array of entities to remove.
|
|
75
|
-
* @param cap Optional. If specified, will only remove the given amount of entities.
|
|
76
|
-
* @returns True if one or more entities was removed, false otherwise.
|
|
77
|
-
*/
|
|
78
|
-
export declare function removeEntities(entities: Entity[], cap?: int): boolean;
|
|
79
70
|
/**
|
|
80
71
|
* Helper function to remove all of the matching entities in the room.
|
|
81
72
|
*
|
|
@@ -88,6 +79,14 @@ export declare function removeEntities(entities: Entity[], cap?: int): boolean;
|
|
|
88
79
|
* @returns True if one or more entities was removed, false otherwise.
|
|
89
80
|
*/
|
|
90
81
|
export declare function removeAllMatchingEntities(entityType: int, entityVariant?: number, entitySubType?: number, cap?: int | undefined): boolean;
|
|
82
|
+
/**
|
|
83
|
+
* Helper function to remove all of the entities in the supplied array.
|
|
84
|
+
*
|
|
85
|
+
* @param entities The array of entities to remove.
|
|
86
|
+
* @param cap Optional. If specified, will only remove the given amount of entities.
|
|
87
|
+
* @returns True if one or more entities was removed, false otherwise.
|
|
88
|
+
*/
|
|
89
|
+
export declare function removeEntities(entities: Entity[], cap?: int): boolean;
|
|
91
90
|
/**
|
|
92
91
|
* Helper function to reroll an enemy. Use this instead of the vanilla "Game.RerollEnemy" function
|
|
93
92
|
* if you want the rerolled enemy to be returned.
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
1
|
local ____lualib = require("lualib_bundle")
|
|
3
|
-
local __TS__ArraySome = ____lualib.__TS__ArraySome
|
|
4
2
|
local Set = ____lualib.Set
|
|
5
3
|
local __TS__New = ____lualib.__TS__New
|
|
6
4
|
local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
|
|
@@ -15,11 +13,19 @@ local getRandom = ____random.getRandom
|
|
|
15
13
|
local nextSeed = ____random.nextSeed
|
|
16
14
|
local ____utils = require("functions.utils")
|
|
17
15
|
local ____repeat = ____utils["repeat"]
|
|
18
|
-
function ____exports.
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
16
|
+
function ____exports.removeEntities(self, entities, cap)
|
|
17
|
+
if #entities == 0 then
|
|
18
|
+
return false
|
|
19
|
+
end
|
|
20
|
+
local numEntitiesRemoved = 0
|
|
21
|
+
for ____, entity in ipairs(entities) do
|
|
22
|
+
entity:Remove()
|
|
23
|
+
numEntitiesRemoved = numEntitiesRemoved + 1
|
|
24
|
+
if cap ~= nil and numEntitiesRemoved >= cap then
|
|
25
|
+
return true
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
return true
|
|
23
29
|
end
|
|
24
30
|
function ____exports.countEntities(self, entityType, variant, subType, ignoreFriendly)
|
|
25
31
|
if entityType == nil then
|
|
@@ -61,20 +67,6 @@ function ____exports.getClosestEntityTo(self, referenceEntity, entities)
|
|
|
61
67
|
end
|
|
62
68
|
return closestEntity
|
|
63
69
|
end
|
|
64
|
-
function ____exports.getFilteredNewEntities(self, oldEntities, newEntities)
|
|
65
|
-
local oldEntitiesSet = __TS__New(Set)
|
|
66
|
-
for ____, entity in ipairs(oldEntities) do
|
|
67
|
-
local ptrHash = GetPtrHash(entity)
|
|
68
|
-
oldEntitiesSet:add(ptrHash)
|
|
69
|
-
end
|
|
70
|
-
return __TS__ArrayFilter(
|
|
71
|
-
newEntities,
|
|
72
|
-
function(____, entity)
|
|
73
|
-
local ptrHash = GetPtrHash(entity)
|
|
74
|
-
return not oldEntitiesSet:has(ptrHash)
|
|
75
|
-
end
|
|
76
|
-
)
|
|
77
|
-
end
|
|
78
70
|
function ____exports.getEntities(self, matchingEntityType, matchingVariant, matchingSubType, ignoreFriendly)
|
|
79
71
|
if matchingVariant == nil then
|
|
80
72
|
matchingVariant = -1
|
|
@@ -93,6 +85,20 @@ end
|
|
|
93
85
|
function ____exports.getEntityID(self, entity)
|
|
94
86
|
return (((tostring(entity.Type) .. ".") .. tostring(entity.Variant)) .. ".") .. tostring(entity.SubType)
|
|
95
87
|
end
|
|
88
|
+
function ____exports.getFilteredNewEntities(self, oldEntities, newEntities)
|
|
89
|
+
local oldEntitiesSet = __TS__New(Set)
|
|
90
|
+
for ____, entity in ipairs(oldEntities) do
|
|
91
|
+
local ptrHash = GetPtrHash(entity)
|
|
92
|
+
oldEntitiesSet:add(ptrHash)
|
|
93
|
+
end
|
|
94
|
+
return __TS__ArrayFilter(
|
|
95
|
+
newEntities,
|
|
96
|
+
function(____, entity)
|
|
97
|
+
local ptrHash = GetPtrHash(entity)
|
|
98
|
+
return not oldEntitiesSet:has(ptrHash)
|
|
99
|
+
end
|
|
100
|
+
)
|
|
101
|
+
end
|
|
96
102
|
function ____exports.isEntityMoving(self, entity, threshold)
|
|
97
103
|
if threshold == nil then
|
|
98
104
|
threshold = 0.01
|
|
@@ -102,20 +108,6 @@ end
|
|
|
102
108
|
function ____exports.isStoryBoss(self, entity)
|
|
103
109
|
return STORY_BOSSES:has(entity.Type)
|
|
104
110
|
end
|
|
105
|
-
function ____exports.removeEntities(self, entities, cap)
|
|
106
|
-
if #entities == 0 then
|
|
107
|
-
return false
|
|
108
|
-
end
|
|
109
|
-
local numEntitiesRemoved = 0
|
|
110
|
-
for ____, entity in ipairs(entities) do
|
|
111
|
-
entity:Remove()
|
|
112
|
-
numEntitiesRemoved = numEntitiesRemoved + 1
|
|
113
|
-
if cap ~= nil and numEntitiesRemoved >= cap then
|
|
114
|
-
return true
|
|
115
|
-
end
|
|
116
|
-
end
|
|
117
|
-
return true
|
|
118
|
-
end
|
|
119
111
|
function ____exports.removeAllMatchingEntities(self, entityType, entityVariant, entitySubType, cap)
|
|
120
112
|
if entityVariant == nil then
|
|
121
113
|
entityVariant = -1
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
1
|
local ____lualib = require("lualib_bundle")
|
|
3
2
|
local Set = ____lualib.Set
|
|
4
3
|
local __TS__New = ____lualib.__TS__New
|
|
@@ -18,7 +17,7 @@ local FLYING_CHARACTERS = __TS__New(Set, {
|
|
|
18
17
|
PlayerType.PLAYER_THESOUL_B
|
|
19
18
|
})
|
|
20
19
|
local FLYING_TRINKETS = __TS__New(Set, {TrinketType.TRINKET_BAT_WING, TrinketType.TRINKET_AZAZELS_STUMP})
|
|
21
|
-
local FLYING_NULL_ITEMS = {NullItemID.ID_REVERSE_SUN, NullItemID.ID_SPIRIT_SHACKLES_SOUL}
|
|
20
|
+
local FLYING_NULL_ITEMS = {NullItemID.ID_REVERSE_SUN, NullItemID.ID_SPIRIT_SHACKLES_SOUL, NullItemID.ID_LOST_CURSE}
|
|
22
21
|
function ____exports.getFlyingCollectibles(self, pruneConditionalItems)
|
|
23
22
|
local collectiblesWithFlyingCacheFlag = getCollectiblesForCacheFlag(nil, CacheFlag.CACHE_FLYING)
|
|
24
23
|
local collectiblesWithAllCacheFlag = getCollectiblesForCacheFlag(nil, CacheFlag.CACHE_ALL)
|