isaacscript-common 1.2.99 → 1.2.102
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/postPlayerChangeHealth.lua +6 -14
- package/dist/callbacks/postPurchase.lua +2 -2
- package/dist/features/deployJSONRoom.lua +2 -1
- package/dist/features/isPonyActive.lua +3 -1
- package/dist/functions/collectibles.lua +3 -3
- package/dist/functions/entity.d.ts +0 -21
- package/dist/functions/entity.lua +0 -21
- package/dist/functions/familiars.d.ts +4 -3
- package/dist/functions/familiars.lua +2 -2
- package/dist/functions/log.d.ts +1 -0
- package/dist/functions/log.lua +17 -0
- package/dist/functions/pickups.d.ts +21 -0
- package/dist/functions/pickups.lua +26 -0
- package/dist/functions/rooms.d.ts +17 -16
- package/dist/functions/rooms.lua +16 -10
- package/dist/functions/trinkets.lua +2 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.lua +8 -0
- package/dist/upgradeMod.lua +3 -0
- package/package.json +2 -2
|
@@ -6,10 +6,11 @@ local ____exports = {}
|
|
|
6
6
|
local hasSubscriptions, postPEffectUpdateReordered, getCurrentHealthValue, v
|
|
7
7
|
local ____exports = require("features.saveDataManager.exports")
|
|
8
8
|
local saveDataManager = ____exports.saveDataManager
|
|
9
|
-
local ____bitwise = require("functions.bitwise")
|
|
10
|
-
local countSetBits = ____bitwise.countSetBits
|
|
11
9
|
local ____player = require("functions.player")
|
|
10
|
+
local getBlackHearts = ____player.getBlackHearts
|
|
11
|
+
local getHearts = ____player.getHearts
|
|
12
12
|
local getPlayerIndex = ____player.getPlayerIndex
|
|
13
|
+
local getSoulHearts = ____player.getSoulHearts
|
|
13
14
|
local ____utils = require("functions.utils")
|
|
14
15
|
local ensureAllCases = ____utils.ensureAllCases
|
|
15
16
|
local getEnumValues = ____utils.getEnumValues
|
|
@@ -47,19 +48,13 @@ function getCurrentHealthValue(self, player, healthType)
|
|
|
47
48
|
local ____cond11 = ____switch11 == HealthType.RED
|
|
48
49
|
if ____cond11 then
|
|
49
50
|
do
|
|
50
|
-
|
|
51
|
-
local hearts = player:GetHearts()
|
|
52
|
-
return hearts - rottenHearts * 2
|
|
51
|
+
return getHearts(nil, player)
|
|
53
52
|
end
|
|
54
53
|
end
|
|
55
54
|
____cond11 = ____cond11 or ____switch11 == HealthType.SOUL
|
|
56
55
|
if ____cond11 then
|
|
57
56
|
do
|
|
58
|
-
|
|
59
|
-
local blackHeartsBitmask = player:GetBlackHearts()
|
|
60
|
-
local blackHeartsBits = countSetBits(nil, blackHeartsBitmask)
|
|
61
|
-
local blackHearts = blackHeartsBits * 2
|
|
62
|
-
return soulHearts - blackHearts
|
|
57
|
+
return getSoulHearts(nil, player)
|
|
63
58
|
end
|
|
64
59
|
end
|
|
65
60
|
____cond11 = ____cond11 or ____switch11 == HealthType.ETERNAL
|
|
@@ -71,10 +66,7 @@ function getCurrentHealthValue(self, player, healthType)
|
|
|
71
66
|
____cond11 = ____cond11 or ____switch11 == HealthType.BLACK
|
|
72
67
|
if ____cond11 then
|
|
73
68
|
do
|
|
74
|
-
|
|
75
|
-
local blackHeartsBits = countSetBits(nil, blackHeartsBitmask)
|
|
76
|
-
local blackHearts = blackHeartsBits * 2
|
|
77
|
-
return blackHearts
|
|
69
|
+
return getBlackHearts(nil, player)
|
|
78
70
|
end
|
|
79
71
|
end
|
|
80
72
|
____cond11 = ____cond11 or ____switch11 == HealthType.GOLDEN
|
|
@@ -9,8 +9,8 @@ local ____exports = {}
|
|
|
9
9
|
local hasSubscriptions, postUpdate, checkPickupsPurchased, getPlayerThatIsNoLongerHoldingAnItem, storePickupsInMap, storePlayersInMap, pickupAtIndexStillExists, v
|
|
10
10
|
local ____exports = require("features.saveDataManager.exports")
|
|
11
11
|
local saveDataManager = ____exports.saveDataManager
|
|
12
|
-
local
|
|
13
|
-
local getPickups =
|
|
12
|
+
local ____pickups = require("functions.pickups")
|
|
13
|
+
local getPickups = ____pickups.getPickups
|
|
14
14
|
local ____player = require("functions.player")
|
|
15
15
|
local getPlayerIndex = ____player.getPlayerIndex
|
|
16
16
|
local getPlayers = ____player.getPlayers
|
|
@@ -11,7 +11,6 @@ local ____errors = require("errors")
|
|
|
11
11
|
local getUpgradeErrorMsg = ____errors.getUpgradeErrorMsg
|
|
12
12
|
local ____entity = require("functions.entity")
|
|
13
13
|
local removeAllMatchingEntities = ____entity.removeAllMatchingEntities
|
|
14
|
-
local removeAllPickups = ____entity.removeAllPickups
|
|
15
14
|
local ____entitySpecific = require("functions.entitySpecific")
|
|
16
15
|
local removeAllBombs = ____entitySpecific.removeAllBombs
|
|
17
16
|
local ____gridEntity = require("functions.gridEntity")
|
|
@@ -28,6 +27,8 @@ local ____math = require("functions.math")
|
|
|
28
27
|
local range = ____math.range
|
|
29
28
|
local ____npc = require("functions.npc")
|
|
30
29
|
local getNPCs = ____npc.getNPCs
|
|
30
|
+
local ____pickups = require("functions.pickups")
|
|
31
|
+
local removeAllPickups = ____pickups.removeAllPickups
|
|
31
32
|
local ____random = require("functions.random")
|
|
32
33
|
local nextSeed = ____random.nextSeed
|
|
33
34
|
local ____rooms = require("functions.rooms")
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
|
-
require("lualib_bundle")
|
|
2
|
+
local ____lualib = require("lualib_bundle")
|
|
3
|
+
local Set = ____lualib.Set
|
|
4
|
+
local __TS__New = ____lualib.__TS__New
|
|
3
5
|
local ____exports = {}
|
|
4
6
|
local postPEffectUpdate, FLAGS_WHEN_PONY_IS_ACTIVE, v
|
|
5
7
|
local ____errors = require("errors")
|
|
@@ -8,11 +8,11 @@ local ____collectibleDescriptionMap = require("maps.collectibleDescriptionMap")
|
|
|
8
8
|
local COLLECTIBLE_DESCRIPTION_MAP = ____collectibleDescriptionMap.COLLECTIBLE_DESCRIPTION_MAP
|
|
9
9
|
local ____collectibleNameMap = require("maps.collectibleNameMap")
|
|
10
10
|
local COLLECTIBLE_NAME_MAP = ____collectibleNameMap.COLLECTIBLE_NAME_MAP
|
|
11
|
-
local ____entity = require("functions.entity")
|
|
12
|
-
local getPickups = ____entity.getPickups
|
|
13
|
-
local removeAllPickups = ____entity.removeAllPickups
|
|
14
11
|
local ____flag = require("functions.flag")
|
|
15
12
|
local hasFlag = ____flag.hasFlag
|
|
13
|
+
local ____pickups = require("functions.pickups")
|
|
14
|
+
local getPickups = ____pickups.getPickups
|
|
15
|
+
local removeAllPickups = ____pickups.removeAllPickups
|
|
16
16
|
local ____sprite = require("functions.sprite")
|
|
17
17
|
local clearSprite = ____sprite.clearSprite
|
|
18
18
|
function ____exports.setCollectibleSprite(self, collectible, pngPath)
|
|
@@ -42,18 +42,6 @@ export declare function getFilteredNewEntities<T extends AnyEntity>(oldEntities:
|
|
|
42
42
|
* returned. False by default. Will only be taken into account if `matchingEntityType` is specified.
|
|
43
43
|
*/
|
|
44
44
|
export declare function getEntities(matchingEntityType?: EntityType | int, matchingVariant?: number, matchingSubType?: number, ignoreFriendly?: boolean): Entity[];
|
|
45
|
-
/**
|
|
46
|
-
* Helper function to get all of the pickups in the room.
|
|
47
|
-
*
|
|
48
|
-
* Example:
|
|
49
|
-
* ```
|
|
50
|
-
* // Make all of the pickups in the room invisible
|
|
51
|
-
* for (const pickup of getPickups()) {
|
|
52
|
-
* pickup.Visible = false;
|
|
53
|
-
* }
|
|
54
|
-
* ```
|
|
55
|
-
*/
|
|
56
|
-
export declare function getPickups(matchingVariant?: PickupVariant | int, matchingSubType?: number): EntityPickup[];
|
|
57
45
|
/**
|
|
58
46
|
* Helper function to measure an entity's velocity to see if it is moving.
|
|
59
47
|
*
|
|
@@ -87,15 +75,6 @@ export declare function removeEntities(entities: Entity[], cap?: int): boolean;
|
|
|
87
75
|
* @returns True if one or more entities was removed, false otherwise.
|
|
88
76
|
*/
|
|
89
77
|
export declare function removeAllMatchingEntities(entityType: int, entityVariant?: number, entitySubType?: number, cap?: int | undefined): boolean;
|
|
90
|
-
/**
|
|
91
|
-
* Helper function to remove all of the pickups in the room.
|
|
92
|
-
*
|
|
93
|
-
* @param variant Optional. If specified, will only remove pickups that match this variant.
|
|
94
|
-
* @param subType Optional. If specified, will only remove pickups that match this sub-type.
|
|
95
|
-
* @param cap Optional. If specified, will only remove the given amount of pickups.
|
|
96
|
-
* @returns True if one or more pickups was removed, false otherwise.
|
|
97
|
-
*/
|
|
98
|
-
export declare function removeAllPickups(variant?: PickupVariant | int, subType?: int, cap?: int): boolean;
|
|
99
78
|
/**
|
|
100
79
|
* Helper function to reroll an enemy. Use this instead of the vanilla "Game.RerollEnemy" function
|
|
101
80
|
* if you want the rerolled enemy to be returned.
|
|
@@ -63,23 +63,6 @@ function ____exports.getEntities(self, matchingEntityType, matchingVariant, matc
|
|
|
63
63
|
end
|
|
64
64
|
return Isaac.FindByType(matchingEntityType, matchingVariant, matchingSubType, ignoreFriendly)
|
|
65
65
|
end
|
|
66
|
-
function ____exports.getPickups(self, matchingVariant, matchingSubType)
|
|
67
|
-
if matchingVariant == nil then
|
|
68
|
-
matchingVariant = -1
|
|
69
|
-
end
|
|
70
|
-
if matchingSubType == nil then
|
|
71
|
-
matchingSubType = -1
|
|
72
|
-
end
|
|
73
|
-
local entities = ____exports.getEntities(nil, EntityType.ENTITY_PICKUP, matchingVariant, matchingSubType)
|
|
74
|
-
local pickups = {}
|
|
75
|
-
for ____, entity in ipairs(entities) do
|
|
76
|
-
local pickup = entity:ToPickup()
|
|
77
|
-
if pickup ~= nil then
|
|
78
|
-
__TS__ArrayPush(pickups, pickup)
|
|
79
|
-
end
|
|
80
|
-
end
|
|
81
|
-
return pickups
|
|
82
|
-
end
|
|
83
66
|
function ____exports.isEntityMoving(self, entity, threshold)
|
|
84
67
|
if threshold == nil then
|
|
85
68
|
threshold = 0.01
|
|
@@ -116,10 +99,6 @@ function ____exports.removeAllMatchingEntities(self, entityType, entityVariant,
|
|
|
116
99
|
local entities = ____exports.getEntities(nil, entityType, entityVariant, entitySubType)
|
|
117
100
|
return ____exports.removeEntities(nil, entities, cap)
|
|
118
101
|
end
|
|
119
|
-
function ____exports.removeAllPickups(self, variant, subType, cap)
|
|
120
|
-
local pickups = ____exports.getPickups(nil, variant, subType)
|
|
121
|
-
return ____exports.removeEntities(nil, pickups, cap)
|
|
122
|
-
end
|
|
123
102
|
function ____exports.rerollEnemy(self, entity)
|
|
124
103
|
local game = Game()
|
|
125
104
|
local oldEntities = ____exports.getEntities(nil)
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Helper function to add and remove familiars based on a target amount that you specify. Use this
|
|
4
4
|
* instead of the `EntityPlayer.CheckFamiliar` method so that the InitSeed of the spawned familiar
|
|
5
5
|
* will be set properly. Note that when using this function, you need to manually account for Box of
|
|
6
|
-
* Friends (by looking at the number of collectible effects
|
|
6
|
+
* Friends and Monster Manual (by looking at the number of collectible effects for the familiar).
|
|
7
7
|
*
|
|
8
8
|
* This function is meant to be called in the EvaluateCache callback (when the cache flag is equal
|
|
9
9
|
* to `CacheFlag.CACHE_FAMILIARS`).
|
|
@@ -33,8 +33,9 @@ export declare function checkFamiliar(player: EntityPlayer, collectibleType: int
|
|
|
33
33
|
* to `CacheFlag.CACHE_FAMILIARS`).
|
|
34
34
|
*
|
|
35
35
|
* Use this function when the amount of familiars should be equal to the amount of associated
|
|
36
|
-
* collectibles that the player has (plus any extras from having used Box of Friends
|
|
37
|
-
* instead need to have a custom amount of familiars, use the `checkFamiliars`
|
|
36
|
+
* collectibles that the player has (plus any extras from having used Box of Friends or Monster
|
|
37
|
+
* Manual). If you instead need to have a custom amount of familiars, use the `checkFamiliars`
|
|
38
|
+
* function instead.
|
|
38
39
|
*
|
|
39
40
|
* @param player The player that owns the familiars and collectibles.
|
|
40
41
|
* @param collectibleType The collectible type of the collectible associated with this familiar.
|
|
@@ -74,8 +74,8 @@ end
|
|
|
74
74
|
function ____exports.checkFamiliarFromCollectibles(self, player, collectibleType, familiarVariant, familiarSubType)
|
|
75
75
|
local numCollectibles = player:GetCollectibleNum(collectibleType)
|
|
76
76
|
local effects = player:GetEffects()
|
|
77
|
-
local
|
|
78
|
-
local numTargetFamiliars = numCollectibles
|
|
77
|
+
local numCollectibleEffects = effects:GetCollectibleEffectNum(collectibleType)
|
|
78
|
+
local numTargetFamiliars = numCollectibles + numCollectibleEffects
|
|
79
79
|
return ____exports.checkFamiliar(
|
|
80
80
|
nil,
|
|
81
81
|
player,
|
package/dist/functions/log.d.ts
CHANGED
|
@@ -39,6 +39,7 @@ export declare function logEntity(this: void, entity: Entity): void;
|
|
|
39
39
|
export declare function logKColor(this: void, kColor: KColor): void;
|
|
40
40
|
export declare function logMap(this: void, map: Map<AnyNotNil, unknown>): void;
|
|
41
41
|
/** Helper function for printing out information about the current room. */
|
|
42
|
+
export declare function logRoom(this: void): void;
|
|
42
43
|
export declare function logTable(this: void, table: unknown, parentTables?: number): void;
|
|
43
44
|
export declare function logTemporaryEffects(this: void, player: EntityPlayer): void;
|
|
44
45
|
export declare function logSet(this: void, set: Set<AnyNotNil>): void;
|
package/dist/functions/log.lua
CHANGED
|
@@ -14,6 +14,11 @@ local ____flag = require("functions.flag")
|
|
|
14
14
|
local hasFlag = ____flag.hasFlag
|
|
15
15
|
local ____player = require("functions.player")
|
|
16
16
|
local getEffectsList = ____player.getEffectsList
|
|
17
|
+
local ____rooms = require("functions.rooms")
|
|
18
|
+
local getRoomGridIndex = ____rooms.getRoomGridIndex
|
|
19
|
+
local getRoomListIndex = ____rooms.getRoomListIndex
|
|
20
|
+
local getRoomSubType = ____rooms.getRoomSubType
|
|
21
|
+
local getRoomVariant = ____rooms.getRoomVariant
|
|
17
22
|
local ____trinkets = require("functions.trinkets")
|
|
18
23
|
local getTrinketName = ____trinkets.getTrinketName
|
|
19
24
|
function ____exports.getDebugPrependString(self, msg, numParentFunctions)
|
|
@@ -124,6 +129,18 @@ function ____exports.logMap(map)
|
|
|
124
129
|
end
|
|
125
130
|
____exports.log("The size of the map was: " .. tostring(map.size))
|
|
126
131
|
end
|
|
132
|
+
function ____exports.logRoom()
|
|
133
|
+
local game = Game()
|
|
134
|
+
local room = game:GetRoom()
|
|
135
|
+
local roomType = room:GetType()
|
|
136
|
+
local roomVariant = getRoomVariant(nil)
|
|
137
|
+
local roomSubType = getRoomSubType(nil)
|
|
138
|
+
local roomGridIndex = getRoomGridIndex(nil)
|
|
139
|
+
local roomListIndex = getRoomListIndex(nil)
|
|
140
|
+
____exports.log((((("Current room type/variant/sub-type: " .. tostring(roomType)) .. ".") .. tostring(roomVariant)) .. ".") .. tostring(roomSubType))
|
|
141
|
+
____exports.log("Current room grid index: " .. tostring(roomGridIndex))
|
|
142
|
+
____exports.log("Current room list index: " .. tostring(roomListIndex))
|
|
143
|
+
end
|
|
127
144
|
function ____exports.logTable(____table, parentTables)
|
|
128
145
|
if parentTables == nil then
|
|
129
146
|
parentTables = 0
|
|
@@ -1,4 +1,16 @@
|
|
|
1
1
|
/// <reference types="isaac-typescript-definitions" />
|
|
2
|
+
/**
|
|
3
|
+
* Helper function to get all of the pickups in the room.
|
|
4
|
+
*
|
|
5
|
+
* Example:
|
|
6
|
+
* ```
|
|
7
|
+
* // Make all of the pickups in the room invisible
|
|
8
|
+
* for (const pickup of getPickups()) {
|
|
9
|
+
* pickup.Visible = false;
|
|
10
|
+
* }
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
13
|
+
export declare function getPickups(matchingVariant?: PickupVariant | int, matchingSubType?: number): EntityPickup[];
|
|
2
14
|
/**
|
|
3
15
|
* Has as an equal chance of returning any value in the `HeartSubType` enum. Useful for spawning a random type of heart.
|
|
4
16
|
*
|
|
@@ -7,3 +19,12 @@
|
|
|
7
19
|
*/
|
|
8
20
|
export declare function getRandomHeartSubType(seed?: number, exceptions?: HeartSubType[]): HeartSubType;
|
|
9
21
|
export declare function isChest(pickup: EntityPickup): boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Helper function to remove all of the pickups in the room.
|
|
24
|
+
*
|
|
25
|
+
* @param variant Optional. If specified, will only remove pickups that match this variant.
|
|
26
|
+
* @param subType Optional. If specified, will only remove pickups that match this sub-type.
|
|
27
|
+
* @param cap Optional. If specified, will only remove the given amount of pickups.
|
|
28
|
+
* @returns True if one or more pickups was removed, false otherwise.
|
|
29
|
+
*/
|
|
30
|
+
export declare function removeAllPickups(variant?: PickupVariant | int, subType?: int, cap?: int): boolean;
|
|
@@ -1,11 +1,33 @@
|
|
|
1
1
|
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
|
+
local ____lualib = require("lualib_bundle")
|
|
3
|
+
local __TS__ArrayPush = ____lualib.__TS__ArrayPush
|
|
2
4
|
local ____exports = {}
|
|
3
5
|
local ____constants = require("constants")
|
|
4
6
|
local CHEST_PICKUP_VARIANTS = ____constants.CHEST_PICKUP_VARIANTS
|
|
5
7
|
local ____array = require("functions.array")
|
|
6
8
|
local getRandomArrayElement = ____array.getRandomArrayElement
|
|
9
|
+
local ____entity = require("functions.entity")
|
|
10
|
+
local getEntities = ____entity.getEntities
|
|
11
|
+
local removeEntities = ____entity.removeEntities
|
|
7
12
|
local ____utils = require("functions.utils")
|
|
8
13
|
local getEnumValues = ____utils.getEnumValues
|
|
14
|
+
function ____exports.getPickups(self, matchingVariant, matchingSubType)
|
|
15
|
+
if matchingVariant == nil then
|
|
16
|
+
matchingVariant = -1
|
|
17
|
+
end
|
|
18
|
+
if matchingSubType == nil then
|
|
19
|
+
matchingSubType = -1
|
|
20
|
+
end
|
|
21
|
+
local entities = getEntities(nil, EntityType.ENTITY_PICKUP, matchingVariant, matchingSubType)
|
|
22
|
+
local pickups = {}
|
|
23
|
+
for ____, entity in ipairs(entities) do
|
|
24
|
+
local pickup = entity:ToPickup()
|
|
25
|
+
if pickup ~= nil then
|
|
26
|
+
__TS__ArrayPush(pickups, pickup)
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
return pickups
|
|
30
|
+
end
|
|
9
31
|
function ____exports.getRandomHeartSubType(self, seed, exceptions)
|
|
10
32
|
if seed == nil then
|
|
11
33
|
seed = Random()
|
|
@@ -19,4 +41,8 @@ end
|
|
|
19
41
|
function ____exports.isChest(self, pickup)
|
|
20
42
|
return CHEST_PICKUP_VARIANTS:has(pickup.Variant)
|
|
21
43
|
end
|
|
44
|
+
function ____exports.removeAllPickups(self, variant, subType, cap)
|
|
45
|
+
local pickups = ____exports.getPickups(nil, variant, subType)
|
|
46
|
+
return removeEntities(nil, pickups, cap)
|
|
47
|
+
end
|
|
22
48
|
return ____exports
|
|
@@ -34,6 +34,23 @@ export declare function getRoomType(roomGridIndex: int): RoomType;
|
|
|
34
34
|
* @param roomGridIndex Optional. Equal to the current room index by default.
|
|
35
35
|
*/
|
|
36
36
|
export declare function getRoomDescriptor(roomGridIndex?: int): RoomDescriptor;
|
|
37
|
+
/**
|
|
38
|
+
* Helper function to get the grid index of the current room.
|
|
39
|
+
*
|
|
40
|
+
* - If the current room is inside of the grid, this function will return the `SafeGridIndex` from
|
|
41
|
+
* the room descriptor. (The safe grid index is defined as the top-left 1x1 section that the room
|
|
42
|
+
* overlaps with, or the top-right 1x1 section of a `RoomType.ROOMSHAPE_LTL` room.)
|
|
43
|
+
* - If the current room is outside of the grid, it will return the index from the
|
|
44
|
+
* `Level.GetCurrentRoomIndex` method (since `SafeGridIndex` is bugged for these cases).
|
|
45
|
+
*
|
|
46
|
+
* Use this function instead of the `Level.GetCurrentRoomIndex` method directly because the latter
|
|
47
|
+
* will return the specific 1x1 quadrant that the player entered the room at. For most situations,
|
|
48
|
+
* using the safe grid index is more reliable than this.
|
|
49
|
+
*
|
|
50
|
+
* Data structures that store data per room should use the room's `ListIndex` instead of
|
|
51
|
+
* `SafeGridIndex`, since the former is unique across different dimensions.
|
|
52
|
+
*/
|
|
53
|
+
export declare function getRoomGridIndex(): int;
|
|
37
54
|
/**
|
|
38
55
|
* Helper function to get an array of all of the safe grid indexes for rooms that match the
|
|
39
56
|
* specified room type.
|
|
@@ -67,22 +84,6 @@ export declare function getRoomListIndex(roomGridIndex?: int): int;
|
|
|
67
84
|
* @returns The room name. Returns "Unknown" if the type was not found.
|
|
68
85
|
*/
|
|
69
86
|
export declare function getRoomName(roomGridIndex?: int): string;
|
|
70
|
-
/**
|
|
71
|
-
* Helper function to get the safe grid index of the provided room. The safe grid index is defined as
|
|
72
|
-
* the top-left 1x1 section that the room overlaps with (or the top-right 1x1 section of a
|
|
73
|
-
* `RoomType.ROOMSHAPE_LTL` room).
|
|
74
|
-
*
|
|
75
|
-
* In most situations, using the safe grid index is more reliable than using the `GridIndex` or the
|
|
76
|
-
* `Level.GetCurrentRoomIndex()` method directly. `GridIndex` can return quadrants that are not on
|
|
77
|
-
* the map, and `Level.GetCurrentRoomIndex()` returns the specific 1x1 quadrant that the player
|
|
78
|
-
* entered the room at.
|
|
79
|
-
*
|
|
80
|
-
* Data structures that store data per room should use the room's `ListIndex` instead of
|
|
81
|
-
* `SafeGridIndex`, since the former is unique across different dimensions.
|
|
82
|
-
*
|
|
83
|
-
* @param roomGridIndex Optional. Equal to the current room index by default.
|
|
84
|
-
*/
|
|
85
|
-
export declare function getRoomSafeGridIndex(roomGridIndex?: int): int;
|
|
86
87
|
/**
|
|
87
88
|
* Helper function to get the stage ID for a room from the XML/STB data. The room stage ID will
|
|
88
89
|
* correspond to the first number in the filename of the XML/STB file. For example, a Depths room
|
package/dist/functions/rooms.lua
CHANGED
|
@@ -133,6 +133,16 @@ function ____exports.getRoomType(self, roomGridIndex)
|
|
|
133
133
|
local roomData = ____exports.getRoomData(nil, roomGridIndex)
|
|
134
134
|
return roomData == nil and -1 or roomData.Type
|
|
135
135
|
end
|
|
136
|
+
function ____exports.getRoomGridIndex(self)
|
|
137
|
+
local game = Game()
|
|
138
|
+
local level = game:GetLevel()
|
|
139
|
+
local currentRoomIndex = level:GetCurrentRoomIndex()
|
|
140
|
+
if currentRoomIndex < 0 then
|
|
141
|
+
return currentRoomIndex
|
|
142
|
+
end
|
|
143
|
+
local roomDescriptor = ____exports.getCurrentRoomDescriptorReadOnly(nil)
|
|
144
|
+
return roomDescriptor.SafeGridIndex
|
|
145
|
+
end
|
|
136
146
|
function ____exports.getRoomGridIndexesForType(self, ...)
|
|
137
147
|
local roomTypes = {...}
|
|
138
148
|
local rooms = ____exports.getRooms(nil)
|
|
@@ -161,10 +171,6 @@ function ____exports.getRoomName(self, roomGridIndex)
|
|
|
161
171
|
local roomData = ____exports.getRoomData(nil, roomGridIndex)
|
|
162
172
|
return roomData == nil and "Unknown" or roomData.Name
|
|
163
173
|
end
|
|
164
|
-
function ____exports.getRoomSafeGridIndex(self, roomGridIndex)
|
|
165
|
-
local roomDescriptor = roomGridIndex == nil and ____exports.getCurrentRoomDescriptorReadOnly(nil) or ____exports.getRoomDescriptor(nil, roomGridIndex)
|
|
166
|
-
return roomDescriptor.SafeGridIndex
|
|
167
|
-
end
|
|
168
174
|
function ____exports.getRoomVariant(self, roomGridIndex)
|
|
169
175
|
local roomData = ____exports.getRoomData(nil, roomGridIndex)
|
|
170
176
|
return roomData == nil and -1 or roomData.Variant
|
|
@@ -246,14 +252,14 @@ function ____exports.inMinibossRoomOf(self, minibossID)
|
|
|
246
252
|
return roomType == RoomType.ROOM_MINIBOSS and roomStageID == 0 and roomSubType == minibossID
|
|
247
253
|
end
|
|
248
254
|
function ____exports.inSecretShop(self)
|
|
249
|
-
return ____exports.
|
|
255
|
+
return ____exports.getRoomGridIndex(nil) == GridRooms.ROOM_SECRET_SHOP_IDX
|
|
250
256
|
end
|
|
251
257
|
function ____exports.inStartingRoom(self)
|
|
252
258
|
local game = Game()
|
|
253
259
|
local level = game:GetLevel()
|
|
254
260
|
local startingRoomGridIndex = level:GetStartingRoomIndex()
|
|
255
|
-
local
|
|
256
|
-
return
|
|
261
|
+
local roomGridIndex = ____exports.getRoomGridIndex(nil)
|
|
262
|
+
return roomGridIndex == startingRoomGridIndex and ____exports.inDimension(nil, 0)
|
|
257
263
|
end
|
|
258
264
|
function ____exports.isAllRoomsClear(self, onlyCheckRoomTypes)
|
|
259
265
|
local ____temp_0
|
|
@@ -279,7 +285,7 @@ function ____exports.isRedKeyRoom(self, roomGridIndex)
|
|
|
279
285
|
end
|
|
280
286
|
function ____exports.isRoomInsideMap(self, roomGridIndex)
|
|
281
287
|
if roomGridIndex == nil then
|
|
282
|
-
roomGridIndex = ____exports.
|
|
288
|
+
roomGridIndex = ____exports.getRoomGridIndex(nil)
|
|
283
289
|
end
|
|
284
290
|
return roomGridIndex >= 0
|
|
285
291
|
end
|
|
@@ -305,12 +311,12 @@ function ____exports.setRoomCleared(self)
|
|
|
305
311
|
for ____, door in ipairs(getDoors(nil)) do
|
|
306
312
|
do
|
|
307
313
|
if isHiddenSecretRoomDoor(nil, door) then
|
|
308
|
-
goto
|
|
314
|
+
goto __continue58
|
|
309
315
|
end
|
|
310
316
|
openDoorFast(nil, door)
|
|
311
317
|
door.ExtraVisible = false
|
|
312
318
|
end
|
|
313
|
-
::
|
|
319
|
+
::__continue58::
|
|
314
320
|
end
|
|
315
321
|
sfx:Stop(SoundEffect.SOUND_DOOR_HEAVY_OPEN)
|
|
316
322
|
game:ShakeScreen(0)
|
|
@@ -6,10 +6,10 @@ local ____trinketDescriptionMap = require("maps.trinketDescriptionMap")
|
|
|
6
6
|
local TRINKET_DESCRIPTION_MAP = ____trinketDescriptionMap.TRINKET_DESCRIPTION_MAP
|
|
7
7
|
local ____trinketNameMap = require("maps.trinketNameMap")
|
|
8
8
|
local TRINKET_NAME_MAP = ____trinketNameMap.TRINKET_NAME_MAP
|
|
9
|
-
local ____entity = require("functions.entity")
|
|
10
|
-
local getPickups = ____entity.getPickups
|
|
11
9
|
local ____flag = require("functions.flag")
|
|
12
10
|
local hasFlag = ____flag.hasFlag
|
|
11
|
+
local ____pickups = require("functions.pickups")
|
|
12
|
+
local getPickups = ____pickups.getPickups
|
|
13
13
|
local ____player = require("functions.player")
|
|
14
14
|
local useActiveItemTemp = ____player.useActiveItemTemp
|
|
15
15
|
local ____trinketGive = require("functions.trinketGive")
|
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export { deployJSONRoom, deployRandomJSONRoom, emptyRoom, } from "./features/dep
|
|
|
4
4
|
export { disableAllInputs, disableAllInputsExceptFor, disableMovementInputs, disableShootingInputs, enableAllInputs, enableAllInputsExceptFor, } from "./features/disableInputs";
|
|
5
5
|
export { forgottenSwitch } from "./features/forgottenSwitch";
|
|
6
6
|
export { getCollectibleItemPoolType } from "./features/getCollectibleItemPoolType";
|
|
7
|
+
export * from "./features/isPonyActive";
|
|
7
8
|
export { preventCollectibleRotate } from "./features/preventCollectibleRotate";
|
|
8
9
|
export { runInNGameFrames, runInNRenderFrames, runNextGameFrame, runNextRenderFrame, } from "./features/runInNFrames";
|
|
9
10
|
export * from "./features/saveDataManager/exports";
|
package/dist/index.lua
CHANGED
|
@@ -49,6 +49,14 @@ do
|
|
|
49
49
|
local getCollectibleItemPoolType = ____getCollectibleItemPoolType.getCollectibleItemPoolType
|
|
50
50
|
____exports.getCollectibleItemPoolType = getCollectibleItemPoolType
|
|
51
51
|
end
|
|
52
|
+
do
|
|
53
|
+
local ____export = require("features.isPonyActive")
|
|
54
|
+
for ____exportKey, ____exportValue in pairs(____export) do
|
|
55
|
+
if ____exportKey ~= "default" then
|
|
56
|
+
____exports[____exportKey] = ____exportValue
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
|
52
60
|
do
|
|
53
61
|
local ____preventCollectibleRotate = require("features.preventCollectibleRotate")
|
|
54
62
|
local preventCollectibleRotate = ____preventCollectibleRotate.preventCollectibleRotate
|
package/dist/upgradeMod.lua
CHANGED
|
@@ -79,6 +79,8 @@ local ____forgottenSwitch = require("features.forgottenSwitch")
|
|
|
79
79
|
local forgottenSwitchInit = ____forgottenSwitch.forgottenSwitchInit
|
|
80
80
|
local ____getCollectibleItemPoolType = require("features.getCollectibleItemPoolType")
|
|
81
81
|
local getCollectibleItemPoolTypeInit = ____getCollectibleItemPoolType.getCollectibleItemPoolTypeInit
|
|
82
|
+
local ____isPonyActive = require("features.isPonyActive")
|
|
83
|
+
local isPonyActiveInit = ____isPonyActive.isPonyActiveInit
|
|
82
84
|
local ____preventCollectibleRotate = require("features.preventCollectibleRotate")
|
|
83
85
|
local preventCollectibleRotateInit = ____preventCollectibleRotate.preventCollectibleRotateInit
|
|
84
86
|
local ____runInNFrames = require("features.runInNFrames")
|
|
@@ -137,6 +139,7 @@ function initFeatures(self, mod)
|
|
|
137
139
|
preventCollectibleRotateInit(nil, mod)
|
|
138
140
|
runInNFramesInit(nil, mod)
|
|
139
141
|
sirenHelpersInit(nil, mod)
|
|
142
|
+
isPonyActiveInit(nil, mod)
|
|
140
143
|
end
|
|
141
144
|
function ____exports.upgradeMod(self, modVanilla, verbose)
|
|
142
145
|
if verbose == nil then
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "isaacscript-common",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.102",
|
|
4
4
|
"description": "Helper functions for IsaacScript mods",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"isaac",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"dist/**/*.d.ts"
|
|
26
26
|
],
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@zamiell/typescript-to-lua": "^1.4.
|
|
28
|
+
"@zamiell/typescript-to-lua": "^1.4.2",
|
|
29
29
|
"isaac-typescript-definitions": "^1.0.355",
|
|
30
30
|
"isaacscript-lint": "^1.0.84",
|
|
31
31
|
"isaacscript-tsconfig": "^1.1.8",
|