isaacscript-common 26.0.0 → 26.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.rollup.d.ts +9 -4
- package/dist/isaacscript-common.lua +148 -133
- package/dist/src/enums/ModCallbackCustom.d.ts +2 -4
- package/dist/src/enums/ModCallbackCustom.d.ts.map +1 -1
- package/dist/src/functions/utils.d.ts +6 -0
- package/dist/src/functions/utils.d.ts.map +1 -1
- package/dist/src/functions/utils.lua +18 -0
- package/package.json +1 -1
- package/src/enums/ModCallbackCustom.ts +2 -4
- package/src/functions/utils.ts +14 -0
package/dist/index.rollup.d.ts
CHANGED
|
@@ -7947,6 +7947,13 @@ export declare function isMoveActionTriggered(controllerIndex: ControllerIndex):
|
|
|
7947
7947
|
|
|
7948
7948
|
export declare function isMoveActionTriggeredOnAnyInput(): boolean;
|
|
7949
7949
|
|
|
7950
|
+
/**
|
|
7951
|
+
* Helper function to detect if there is two or more players currently playing.
|
|
7952
|
+
*
|
|
7953
|
+
* Specifically, this function looks for unique `ControllerIndex` values across all players.
|
|
7954
|
+
*/
|
|
7955
|
+
export declare function isMultiplayer(): boolean;
|
|
7956
|
+
|
|
7950
7957
|
export declare function isNarrowRoom(roomShape: RoomShape): boolean;
|
|
7951
7958
|
|
|
7952
7959
|
/** Helper function to detect if a variable is of type `EntityNPC`. */
|
|
@@ -9376,8 +9383,7 @@ export declare enum ModCallbackCustom {
|
|
|
9376
9383
|
*
|
|
9377
9384
|
* `POST_GAME_STARTED_REORDERED` --> `POST_NEW_LEVEL_REORDERED` --> `POST_NEW_ROOM_REORDERED`
|
|
9378
9385
|
*
|
|
9379
|
-
* - You must provide a third argument
|
|
9380
|
-
* continued:
|
|
9386
|
+
* - You must provide a third argument:
|
|
9381
9387
|
* - Pass true if you want the callback to only fire if the run is continued.
|
|
9382
9388
|
* - Pass false if you want the callback to only fire when the run is not continued.
|
|
9383
9389
|
* - Pass undefined if you want the callback to fire in both situations.
|
|
@@ -9396,8 +9402,7 @@ export declare enum ModCallbackCustom {
|
|
|
9396
9402
|
* new run has started (or continued), but you can be sure that all new-run-related initialization
|
|
9397
9403
|
* has been completed.
|
|
9398
9404
|
*
|
|
9399
|
-
* - You must provide a third argument
|
|
9400
|
-
* continued:
|
|
9405
|
+
* - You must provide a third argument:
|
|
9401
9406
|
* - Pass true if you want the callback to only fire if the run is continued.
|
|
9402
9407
|
* - Pass false if you want the callback to only fire when the run is not continued.
|
|
9403
9408
|
* - Pass undefined if you want the callback to fire in both situations.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
--[[
|
|
2
2
|
|
|
3
|
-
isaacscript-common 26.
|
|
3
|
+
isaacscript-common 26.1.0
|
|
4
4
|
|
|
5
5
|
This is the "isaacscript-common" library, which was created with the IsaacScript tool.
|
|
6
6
|
|
|
@@ -16244,14 +16244,152 @@ function ____exports.getRandomInt(self, min, max, seedOrRNG, exceptions)
|
|
|
16244
16244
|
until not exceptionsSet:has(randomInt)
|
|
16245
16245
|
return randomInt
|
|
16246
16246
|
end
|
|
16247
|
+
return ____exports
|
|
16248
|
+
end,
|
|
16249
|
+
["src.types.PlayerIndex"] = function(...)
|
|
16250
|
+
local ____exports = {}
|
|
16251
|
+
return ____exports
|
|
16252
|
+
end,
|
|
16253
|
+
["src.functions.playerIndex"] = function(...)
|
|
16254
|
+
local ____lualib = require("lualib_bundle")
|
|
16255
|
+
local __TS__New = ____lualib.__TS__New
|
|
16256
|
+
local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
|
|
16257
|
+
local __TS__ArrayFind = ____lualib.__TS__ArrayFind
|
|
16258
|
+
local ____exports = {}
|
|
16259
|
+
local getPlayerIndexCollectibleType, DEFAULT_COLLECTIBLE_TYPE, EXCLUDED_CHARACTERS
|
|
16260
|
+
local ____isaac_2Dtypescript_2Ddefinitions = require("lua_modules.isaac-typescript-definitions.dist.src.index")
|
|
16261
|
+
local BabySubType = ____isaac_2Dtypescript_2Ddefinitions.BabySubType
|
|
16262
|
+
local CollectibleType = ____isaac_2Dtypescript_2Ddefinitions.CollectibleType
|
|
16263
|
+
local PlayerType = ____isaac_2Dtypescript_2Ddefinitions.PlayerType
|
|
16264
|
+
local PlayerVariant = ____isaac_2Dtypescript_2Ddefinitions.PlayerVariant
|
|
16265
|
+
local ____cachedClasses = require("src.core.cachedClasses")
|
|
16266
|
+
local game = ____cachedClasses.game
|
|
16267
|
+
local ____ReadonlySet = require("src.types.ReadonlySet")
|
|
16268
|
+
local ReadonlySet = ____ReadonlySet.ReadonlySet
|
|
16269
|
+
function ____exports.getAllPlayers(self)
|
|
16270
|
+
local numPlayers = game:GetNumPlayers()
|
|
16271
|
+
local players = {}
|
|
16272
|
+
do
|
|
16273
|
+
local i = 0
|
|
16274
|
+
while i < numPlayers do
|
|
16275
|
+
local player = Isaac.GetPlayer(i)
|
|
16276
|
+
players[#players + 1] = player
|
|
16277
|
+
i = i + 1
|
|
16278
|
+
end
|
|
16279
|
+
end
|
|
16280
|
+
return players
|
|
16281
|
+
end
|
|
16282
|
+
function ____exports.getPlayerIndex(self, player, differentiateForgottenAndSoul)
|
|
16283
|
+
if differentiateForgottenAndSoul == nil then
|
|
16284
|
+
differentiateForgottenAndSoul = false
|
|
16285
|
+
end
|
|
16286
|
+
local playerToUse = player
|
|
16287
|
+
local isSubPlayer = player:IsSubPlayer()
|
|
16288
|
+
if isSubPlayer then
|
|
16289
|
+
local subPlayer = player
|
|
16290
|
+
local playerParent = ____exports.getSubPlayerParent(nil, subPlayer)
|
|
16291
|
+
if playerParent ~= nil then
|
|
16292
|
+
playerToUse = playerParent
|
|
16293
|
+
end
|
|
16294
|
+
end
|
|
16295
|
+
local collectibleType = getPlayerIndexCollectibleType(nil, player, differentiateForgottenAndSoul)
|
|
16296
|
+
local collectibleRNG = playerToUse:GetCollectibleRNG(collectibleType)
|
|
16297
|
+
local seed = collectibleRNG:GetSeed()
|
|
16298
|
+
return seed
|
|
16299
|
+
end
|
|
16300
|
+
function getPlayerIndexCollectibleType(self, player, differentiateForgottenAndSoul)
|
|
16301
|
+
local character = player:GetPlayerType()
|
|
16302
|
+
if character == PlayerType.SOUL then
|
|
16303
|
+
return differentiateForgottenAndSoul and CollectibleType.INNER_EYE or DEFAULT_COLLECTIBLE_TYPE
|
|
16304
|
+
end
|
|
16305
|
+
return DEFAULT_COLLECTIBLE_TYPE
|
|
16306
|
+
end
|
|
16307
|
+
function ____exports.getPlayers(self, performCharacterExclusions)
|
|
16308
|
+
if performCharacterExclusions == nil then
|
|
16309
|
+
performCharacterExclusions = false
|
|
16310
|
+
end
|
|
16311
|
+
local players = ____exports.getAllPlayers(nil)
|
|
16312
|
+
local nonChildPlayers = __TS__ArrayFilter(
|
|
16313
|
+
players,
|
|
16314
|
+
function(____, player) return not ____exports.isChildPlayer(nil, player) end
|
|
16315
|
+
)
|
|
16316
|
+
local nonChildPlayersFiltered = __TS__ArrayFilter(
|
|
16317
|
+
nonChildPlayers,
|
|
16318
|
+
function(____, player)
|
|
16319
|
+
local character = player:GetPlayerType()
|
|
16320
|
+
return not EXCLUDED_CHARACTERS:has(character)
|
|
16321
|
+
end
|
|
16322
|
+
)
|
|
16323
|
+
return performCharacterExclusions and nonChildPlayersFiltered or nonChildPlayers
|
|
16324
|
+
end
|
|
16325
|
+
function ____exports.getSubPlayerParent(self, subPlayer)
|
|
16326
|
+
local subPlayerPtrHash = GetPtrHash(subPlayer)
|
|
16327
|
+
local players = ____exports.getPlayers(nil)
|
|
16328
|
+
return __TS__ArrayFind(
|
|
16329
|
+
players,
|
|
16330
|
+
function(____, player)
|
|
16331
|
+
local thisPlayerSubPlayer = player:GetSubPlayer()
|
|
16332
|
+
if thisPlayerSubPlayer == nil then
|
|
16333
|
+
return false
|
|
16334
|
+
end
|
|
16335
|
+
local thisPlayerSubPlayerPtrHash = GetPtrHash(thisPlayerSubPlayer)
|
|
16336
|
+
return thisPlayerSubPlayerPtrHash == subPlayerPtrHash
|
|
16337
|
+
end
|
|
16338
|
+
)
|
|
16339
|
+
end
|
|
16340
|
+
function ____exports.isChildPlayer(self, player)
|
|
16341
|
+
return player.Parent ~= nil
|
|
16342
|
+
end
|
|
16343
|
+
DEFAULT_COLLECTIBLE_TYPE = CollectibleType.SAD_ONION
|
|
16344
|
+
EXCLUDED_CHARACTERS = __TS__New(ReadonlySet, {PlayerType.ESAU, PlayerType.SOUL_B})
|
|
16345
|
+
function ____exports.getOtherPlayers(self, player)
|
|
16346
|
+
local playerPtrHash = GetPtrHash(player)
|
|
16347
|
+
local players = ____exports.getAllPlayers(nil)
|
|
16348
|
+
return __TS__ArrayFilter(
|
|
16349
|
+
players,
|
|
16350
|
+
function(____, otherPlayer) return GetPtrHash(otherPlayer) ~= playerPtrHash end
|
|
16351
|
+
)
|
|
16352
|
+
end
|
|
16353
|
+
function ____exports.getPlayerFromIndex(self, playerIndex)
|
|
16354
|
+
local players = ____exports.getAllPlayers(nil)
|
|
16355
|
+
return __TS__ArrayFind(
|
|
16356
|
+
players,
|
|
16357
|
+
function(____, player) return ____exports.getPlayerIndex(nil, player) == playerIndex end
|
|
16358
|
+
)
|
|
16359
|
+
end
|
|
16360
|
+
function ____exports.getPlayerIndexVanilla(self, playerToFind)
|
|
16361
|
+
local numPlayers = game:GetNumPlayers()
|
|
16362
|
+
local playerToFindHash = GetPtrHash(playerToFind)
|
|
16363
|
+
do
|
|
16364
|
+
local i = 0
|
|
16365
|
+
while i < numPlayers do
|
|
16366
|
+
local player = Isaac.GetPlayer(i)
|
|
16367
|
+
local playerHash = GetPtrHash(player)
|
|
16368
|
+
if playerHash == playerToFindHash then
|
|
16369
|
+
return i
|
|
16370
|
+
end
|
|
16371
|
+
i = i + 1
|
|
16372
|
+
end
|
|
16373
|
+
end
|
|
16374
|
+
return nil
|
|
16375
|
+
end
|
|
16376
|
+
function ____exports.isFoundSoul(self, player)
|
|
16377
|
+
return ____exports.isChildPlayer(nil, player) and player.Variant == PlayerVariant.COOP_BABY and player.SubType == BabySubType.FOUND_SOUL
|
|
16378
|
+
end
|
|
16247
16379
|
return ____exports
|
|
16248
16380
|
end,
|
|
16249
16381
|
["src.functions.utils"] = function(...)
|
|
16382
|
+
local ____lualib = require("lualib_bundle")
|
|
16383
|
+
local __TS__ArrayMap = ____lualib.__TS__ArrayMap
|
|
16384
|
+
local Set = ____lualib.Set
|
|
16385
|
+
local __TS__New = ____lualib.__TS__New
|
|
16250
16386
|
local ____exports = {}
|
|
16251
16387
|
local ____isaac_2Dtypescript_2Ddefinitions = require("lua_modules.isaac-typescript-definitions.dist.src.index")
|
|
16252
16388
|
local RenderMode = ____isaac_2Dtypescript_2Ddefinitions.RenderMode
|
|
16253
16389
|
local ____cachedClasses = require("src.core.cachedClasses")
|
|
16254
16390
|
local game = ____cachedClasses.game
|
|
16391
|
+
local ____playerIndex = require("src.functions.playerIndex")
|
|
16392
|
+
local getAllPlayers = ____playerIndex.getAllPlayers
|
|
16255
16393
|
local ____types = require("src.functions.types")
|
|
16256
16394
|
local isFunction = ____types.isFunction
|
|
16257
16395
|
function ____exports.eRange(self, start, ____end, increment)
|
|
@@ -16291,6 +16429,15 @@ end
|
|
|
16291
16429
|
function ____exports.inRange(self, num, start, ____end)
|
|
16292
16430
|
return num >= start and num <= ____end
|
|
16293
16431
|
end
|
|
16432
|
+
function ____exports.isMultiplayer(self)
|
|
16433
|
+
local players = getAllPlayers(nil)
|
|
16434
|
+
local controllerIndexes = __TS__ArrayMap(
|
|
16435
|
+
players,
|
|
16436
|
+
function(____, player) return player.ControllerIndex end
|
|
16437
|
+
)
|
|
16438
|
+
local controllerIndexesSet = __TS__New(Set, controllerIndexes)
|
|
16439
|
+
return controllerIndexesSet.size > 1
|
|
16440
|
+
end
|
|
16294
16441
|
function ____exports.isReflectionRender(self)
|
|
16295
16442
|
local room = game:GetRoom()
|
|
16296
16443
|
local renderMode = room:GetRenderMode()
|
|
@@ -21523,138 +21670,6 @@ function PostCollectibleInitFirst.prototype.____constructor(self)
|
|
|
21523
21670
|
end
|
|
21524
21671
|
self.callbacksUsed = {{ModCallback.POST_PICKUP_INIT, self.postPickupInitCollectible, {PickupVariant.COLLECTIBLE}}}
|
|
21525
21672
|
end
|
|
21526
|
-
return ____exports
|
|
21527
|
-
end,
|
|
21528
|
-
["src.types.PlayerIndex"] = function(...)
|
|
21529
|
-
local ____exports = {}
|
|
21530
|
-
return ____exports
|
|
21531
|
-
end,
|
|
21532
|
-
["src.functions.playerIndex"] = function(...)
|
|
21533
|
-
local ____lualib = require("lualib_bundle")
|
|
21534
|
-
local __TS__New = ____lualib.__TS__New
|
|
21535
|
-
local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
|
|
21536
|
-
local __TS__ArrayFind = ____lualib.__TS__ArrayFind
|
|
21537
|
-
local ____exports = {}
|
|
21538
|
-
local getPlayerIndexCollectibleType, DEFAULT_COLLECTIBLE_TYPE, EXCLUDED_CHARACTERS
|
|
21539
|
-
local ____isaac_2Dtypescript_2Ddefinitions = require("lua_modules.isaac-typescript-definitions.dist.src.index")
|
|
21540
|
-
local BabySubType = ____isaac_2Dtypescript_2Ddefinitions.BabySubType
|
|
21541
|
-
local CollectibleType = ____isaac_2Dtypescript_2Ddefinitions.CollectibleType
|
|
21542
|
-
local PlayerType = ____isaac_2Dtypescript_2Ddefinitions.PlayerType
|
|
21543
|
-
local PlayerVariant = ____isaac_2Dtypescript_2Ddefinitions.PlayerVariant
|
|
21544
|
-
local ____cachedClasses = require("src.core.cachedClasses")
|
|
21545
|
-
local game = ____cachedClasses.game
|
|
21546
|
-
local ____ReadonlySet = require("src.types.ReadonlySet")
|
|
21547
|
-
local ReadonlySet = ____ReadonlySet.ReadonlySet
|
|
21548
|
-
function ____exports.getAllPlayers(self)
|
|
21549
|
-
local numPlayers = game:GetNumPlayers()
|
|
21550
|
-
local players = {}
|
|
21551
|
-
do
|
|
21552
|
-
local i = 0
|
|
21553
|
-
while i < numPlayers do
|
|
21554
|
-
local player = Isaac.GetPlayer(i)
|
|
21555
|
-
players[#players + 1] = player
|
|
21556
|
-
i = i + 1
|
|
21557
|
-
end
|
|
21558
|
-
end
|
|
21559
|
-
return players
|
|
21560
|
-
end
|
|
21561
|
-
function ____exports.getPlayerIndex(self, player, differentiateForgottenAndSoul)
|
|
21562
|
-
if differentiateForgottenAndSoul == nil then
|
|
21563
|
-
differentiateForgottenAndSoul = false
|
|
21564
|
-
end
|
|
21565
|
-
local playerToUse = player
|
|
21566
|
-
local isSubPlayer = player:IsSubPlayer()
|
|
21567
|
-
if isSubPlayer then
|
|
21568
|
-
local subPlayer = player
|
|
21569
|
-
local playerParent = ____exports.getSubPlayerParent(nil, subPlayer)
|
|
21570
|
-
if playerParent ~= nil then
|
|
21571
|
-
playerToUse = playerParent
|
|
21572
|
-
end
|
|
21573
|
-
end
|
|
21574
|
-
local collectibleType = getPlayerIndexCollectibleType(nil, player, differentiateForgottenAndSoul)
|
|
21575
|
-
local collectibleRNG = playerToUse:GetCollectibleRNG(collectibleType)
|
|
21576
|
-
local seed = collectibleRNG:GetSeed()
|
|
21577
|
-
return seed
|
|
21578
|
-
end
|
|
21579
|
-
function getPlayerIndexCollectibleType(self, player, differentiateForgottenAndSoul)
|
|
21580
|
-
local character = player:GetPlayerType()
|
|
21581
|
-
if character == PlayerType.SOUL then
|
|
21582
|
-
return differentiateForgottenAndSoul and CollectibleType.INNER_EYE or DEFAULT_COLLECTIBLE_TYPE
|
|
21583
|
-
end
|
|
21584
|
-
return DEFAULT_COLLECTIBLE_TYPE
|
|
21585
|
-
end
|
|
21586
|
-
function ____exports.getPlayers(self, performCharacterExclusions)
|
|
21587
|
-
if performCharacterExclusions == nil then
|
|
21588
|
-
performCharacterExclusions = false
|
|
21589
|
-
end
|
|
21590
|
-
local players = ____exports.getAllPlayers(nil)
|
|
21591
|
-
local nonChildPlayers = __TS__ArrayFilter(
|
|
21592
|
-
players,
|
|
21593
|
-
function(____, player) return not ____exports.isChildPlayer(nil, player) end
|
|
21594
|
-
)
|
|
21595
|
-
local nonChildPlayersFiltered = __TS__ArrayFilter(
|
|
21596
|
-
nonChildPlayers,
|
|
21597
|
-
function(____, player)
|
|
21598
|
-
local character = player:GetPlayerType()
|
|
21599
|
-
return not EXCLUDED_CHARACTERS:has(character)
|
|
21600
|
-
end
|
|
21601
|
-
)
|
|
21602
|
-
return performCharacterExclusions and nonChildPlayersFiltered or nonChildPlayers
|
|
21603
|
-
end
|
|
21604
|
-
function ____exports.getSubPlayerParent(self, subPlayer)
|
|
21605
|
-
local subPlayerPtrHash = GetPtrHash(subPlayer)
|
|
21606
|
-
local players = ____exports.getPlayers(nil)
|
|
21607
|
-
return __TS__ArrayFind(
|
|
21608
|
-
players,
|
|
21609
|
-
function(____, player)
|
|
21610
|
-
local thisPlayerSubPlayer = player:GetSubPlayer()
|
|
21611
|
-
if thisPlayerSubPlayer == nil then
|
|
21612
|
-
return false
|
|
21613
|
-
end
|
|
21614
|
-
local thisPlayerSubPlayerPtrHash = GetPtrHash(thisPlayerSubPlayer)
|
|
21615
|
-
return thisPlayerSubPlayerPtrHash == subPlayerPtrHash
|
|
21616
|
-
end
|
|
21617
|
-
)
|
|
21618
|
-
end
|
|
21619
|
-
function ____exports.isChildPlayer(self, player)
|
|
21620
|
-
return player.Parent ~= nil
|
|
21621
|
-
end
|
|
21622
|
-
DEFAULT_COLLECTIBLE_TYPE = CollectibleType.SAD_ONION
|
|
21623
|
-
EXCLUDED_CHARACTERS = __TS__New(ReadonlySet, {PlayerType.ESAU, PlayerType.SOUL_B})
|
|
21624
|
-
function ____exports.getOtherPlayers(self, player)
|
|
21625
|
-
local playerPtrHash = GetPtrHash(player)
|
|
21626
|
-
local players = ____exports.getAllPlayers(nil)
|
|
21627
|
-
return __TS__ArrayFilter(
|
|
21628
|
-
players,
|
|
21629
|
-
function(____, otherPlayer) return GetPtrHash(otherPlayer) ~= playerPtrHash end
|
|
21630
|
-
)
|
|
21631
|
-
end
|
|
21632
|
-
function ____exports.getPlayerFromIndex(self, playerIndex)
|
|
21633
|
-
local players = ____exports.getAllPlayers(nil)
|
|
21634
|
-
return __TS__ArrayFind(
|
|
21635
|
-
players,
|
|
21636
|
-
function(____, player) return ____exports.getPlayerIndex(nil, player) == playerIndex end
|
|
21637
|
-
)
|
|
21638
|
-
end
|
|
21639
|
-
function ____exports.getPlayerIndexVanilla(self, playerToFind)
|
|
21640
|
-
local numPlayers = game:GetNumPlayers()
|
|
21641
|
-
local playerToFindHash = GetPtrHash(playerToFind)
|
|
21642
|
-
do
|
|
21643
|
-
local i = 0
|
|
21644
|
-
while i < numPlayers do
|
|
21645
|
-
local player = Isaac.GetPlayer(i)
|
|
21646
|
-
local playerHash = GetPtrHash(player)
|
|
21647
|
-
if playerHash == playerToFindHash then
|
|
21648
|
-
return i
|
|
21649
|
-
end
|
|
21650
|
-
i = i + 1
|
|
21651
|
-
end
|
|
21652
|
-
end
|
|
21653
|
-
return nil
|
|
21654
|
-
end
|
|
21655
|
-
function ____exports.isFoundSoul(self, player)
|
|
21656
|
-
return ____exports.isChildPlayer(nil, player) and player.Variant == PlayerVariant.COOP_BABY and player.SubType == BabySubType.FOUND_SOUL
|
|
21657
|
-
end
|
|
21658
21673
|
return ____exports
|
|
21659
21674
|
end,
|
|
21660
21675
|
["src.functions.playerDataStructures"] = function(...)
|
|
@@ -392,8 +392,7 @@ export declare enum ModCallbackCustom {
|
|
|
392
392
|
*
|
|
393
393
|
* `POST_GAME_STARTED_REORDERED` --> `POST_NEW_LEVEL_REORDERED` --> `POST_NEW_ROOM_REORDERED`
|
|
394
394
|
*
|
|
395
|
-
* - You must provide a third argument
|
|
396
|
-
* continued:
|
|
395
|
+
* - You must provide a third argument:
|
|
397
396
|
* - Pass true if you want the callback to only fire if the run is continued.
|
|
398
397
|
* - Pass false if you want the callback to only fire when the run is not continued.
|
|
399
398
|
* - Pass undefined if you want the callback to fire in both situations.
|
|
@@ -412,8 +411,7 @@ export declare enum ModCallbackCustom {
|
|
|
412
411
|
* new run has started (or continued), but you can be sure that all new-run-related initialization
|
|
413
412
|
* has been completed.
|
|
414
413
|
*
|
|
415
|
-
* - You must provide a third argument
|
|
416
|
-
* continued:
|
|
414
|
+
* - You must provide a third argument:
|
|
417
415
|
* - Pass true if you want the callback to only fire if the run is continued.
|
|
418
416
|
* - Pass false if you want the callback to only fire when the run is not continued.
|
|
419
417
|
* - Pass undefined if you want the callback to fire in both situations.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModCallbackCustom.d.ts","sourceRoot":"","sources":["../../../src/enums/ModCallbackCustom.ts"],"names":[],"mappings":"AAYA;;;;;;;GAOG;AACH,oBAAY,iBAAiB;IAC3B;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,sBAAsB,IAAA;IAEtB;;;;;;;;;;;;;;;;;;;OAmBG;IACH,sBAAsB,IAAA;IAEtB;;;;;;;;;;;;;;;;;OAiBG;IACH,mBAAmB,IAAA;IAEnB;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,mBAAmB,IAAA;IAEnB;;;;;;;;;;;OAWG;IACH,oBAAoB,IAAA;IAEpB;;;;;;;;;;;OAWG;IACH,mBAAmB,IAAA;IAEnB;;;;;;;;;;;;OAYG;IACH,kBAAkB,IAAA;IAElB;;;;;;;;;;;;;;;OAeG;IACH,mBAAmB,IAAA;IAEnB;;;;;;OAMG;IACH,eAAe,IAAA;IAEf;;;;;;;;;;;;;;OAcG;IACH,sBAAsB,IAAA;IAEtB;;;;;;;;;;;;;;;;OAgBG;IACH,2BAA2B,KAAA;IAE3B;;;;;;;;;;;;;;OAcG;IACH,oBAAoB,KAAA;IAEpB;;;;;;;;;;;;;;;;OAgBG;IACH,kBAAkB,KAAA;IAElB;;;;;;;;;;;;;;OAcG;IACH,wBAAwB,KAAA;IAExB;;;;;;;;;;OAUG;IACH,gBAAgB,KAAA;IAEhB;;;;;;;;;;OAUG;IACH,gBAAgB,KAAA;IAEhB;;;;;;;;;;;;;;;OAeG;IACH,qBAAqB,KAAA;IAErB;;;;;;;;;;;;;;;;;OAiBG;IACH,yBAAyB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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAwCG;IACH,mBAAmB,KAAA;IAEnB;;;;;;;;;;;;;;;;;OAiBG;IACH,cAAc,KAAA;IAEd;;;;;;;;;;;;OAYG;IACH,gBAAgB,KAAA;IAEhB;;;;;;;;;;;;OAYG;IACH,gBAAgB,KAAA;IAEhB;;;;;;;;;;OAUG;IACH,kBAAkB,KAAA;IAElB;;;;;;;;;;OAUG;IACH,kBAAkB,KAAA;IAElB;;;;;;;;;;;;;;;;OAgBG;IACH,mBAAmB,KAAA;IAEnB;;;;;;;;;;;;;;;OAeG;IACH,wBAAwB,KAAA;IAExB;;;;;;;;;;OAUG;IACH,eAAe,KAAA;IAEf;;;;;;;;;;OAUG;IACH,eAAe,KAAA;IAEf;;;;;;;;;;;;;;;;;OAiBG;IACH,mBAAmB,MAAA;IAEnB;;;;;;;;;;;;;OAaG;IACH,kBAAkB,MAAA;IAElB;;;;;;;;;;;;;;OAcG;IACH,iBAAiB,MAAA;IAEjB;;;;;;;;;;;;;;;;;OAiBG;IACH,iBAAiB,MAAA;IAEjB;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,uBAAuB,MAAA;IAEvB;;;;;;;;;;;;;;;;;;OAkBG;IACH,gBAAgB,MAAA;IAEhB;;;;;;;;;;;;;;;;;;OAkBG;IACH,eAAe,MAAA;IAEf;;;;;;;;;;;;OAYG;IACH,aAAa,MAAA;IAEb;;;;;;;;;;;;;;;;;;;OAmBG;IACH,wBAAwB,MAAA;IAExB;;;;;;;;;;;;;;;OAeG;IACH,qBAAqB,MAAA;IAErB;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,4BAA4B,MAAA;CAC7B"}
|
|
@@ -41,6 +41,12 @@ export declare function iRange(start: int, end?: int, increment?: number): int[]
|
|
|
41
41
|
* @param end The end of the range to check.
|
|
42
42
|
*/
|
|
43
43
|
export declare function inRange(num: int, start: int, end: int): boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Helper function to detect if there is two or more players currently playing.
|
|
46
|
+
*
|
|
47
|
+
* Specifically, this function looks for unique `ControllerIndex` values across all players.
|
|
48
|
+
*/
|
|
49
|
+
export declare function isMultiplayer(): boolean;
|
|
44
50
|
/**
|
|
45
51
|
* Helper function to see if the current render callback is rendering a water reflection.
|
|
46
52
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/functions/utils.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/functions/utils.ts"],"names":[],"mappings":";AAKA;;;;;;;;;;;GAWG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,SAAS,SAAI,GAAG,GAAG,EAAE,CAWlE;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CACrC,GAAG,EAAE,OAAO,EACZ,oBAAoB,EAAE,MAAM,GAC3B,MAAM,CAQR;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,SAAS,SAAI,GAAG,GAAG,EAAE,CAOlE;AAED;;;;;;;;;GASG;AACH,wBAAgB,OAAO,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,GAAG,OAAO,CAE/D;AAED;;;;GAIG;AACH,wBAAgB,aAAa,IAAI,OAAO,CAMvC;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,IAAI,OAAO,CAI5C;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,IAAI,OAAO,CAetC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,MAAM,CAAC,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,GAAG,KAAK,IAAI,GAAG,IAAI,CAI3D;AAED;;;;;;;;;;;;GAYG;AAEH,wBAAgB,IAAI,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAG"}
|
|
@@ -1,8 +1,14 @@
|
|
|
1
|
+
local ____lualib = require("lualib_bundle")
|
|
2
|
+
local __TS__ArrayMap = ____lualib.__TS__ArrayMap
|
|
3
|
+
local Set = ____lualib.Set
|
|
4
|
+
local __TS__New = ____lualib.__TS__New
|
|
1
5
|
local ____exports = {}
|
|
2
6
|
local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
|
|
3
7
|
local RenderMode = ____isaac_2Dtypescript_2Ddefinitions.RenderMode
|
|
4
8
|
local ____cachedClasses = require("src.core.cachedClasses")
|
|
5
9
|
local game = ____cachedClasses.game
|
|
10
|
+
local ____playerIndex = require("src.functions.playerIndex")
|
|
11
|
+
local getAllPlayers = ____playerIndex.getAllPlayers
|
|
6
12
|
local ____types = require("src.functions.types")
|
|
7
13
|
local isFunction = ____types.isFunction
|
|
8
14
|
--- Helper function to return an array of integers with the specified range, inclusive on the lower
|
|
@@ -72,6 +78,18 @@ end
|
|
|
72
78
|
function ____exports.inRange(self, num, start, ____end)
|
|
73
79
|
return num >= start and num <= ____end
|
|
74
80
|
end
|
|
81
|
+
--- Helper function to detect if there is two or more players currently playing.
|
|
82
|
+
--
|
|
83
|
+
-- Specifically, this function looks for unique `ControllerIndex` values across all players.
|
|
84
|
+
function ____exports.isMultiplayer(self)
|
|
85
|
+
local players = getAllPlayers(nil)
|
|
86
|
+
local controllerIndexes = __TS__ArrayMap(
|
|
87
|
+
players,
|
|
88
|
+
function(____, player) return player.ControllerIndex end
|
|
89
|
+
)
|
|
90
|
+
local controllerIndexesSet = __TS__New(Set, controllerIndexes)
|
|
91
|
+
return controllerIndexesSet.size > 1
|
|
92
|
+
end
|
|
75
93
|
--- Helper function to see if the current render callback is rendering a water reflection.
|
|
76
94
|
--
|
|
77
95
|
-- When the player is in a room with water, things will be rendered twice: once for the normal
|
package/package.json
CHANGED
|
@@ -428,8 +428,7 @@ export enum ModCallbackCustom {
|
|
|
428
428
|
*
|
|
429
429
|
* `POST_GAME_STARTED_REORDERED` --> `POST_NEW_LEVEL_REORDERED` --> `POST_NEW_ROOM_REORDERED`
|
|
430
430
|
*
|
|
431
|
-
* - You must provide a third argument
|
|
432
|
-
* continued:
|
|
431
|
+
* - You must provide a third argument:
|
|
433
432
|
* - Pass true if you want the callback to only fire if the run is continued.
|
|
434
433
|
* - Pass false if you want the callback to only fire when the run is not continued.
|
|
435
434
|
* - Pass undefined if you want the callback to fire in both situations.
|
|
@@ -449,8 +448,7 @@ export enum ModCallbackCustom {
|
|
|
449
448
|
* new run has started (or continued), but you can be sure that all new-run-related initialization
|
|
450
449
|
* has been completed.
|
|
451
450
|
*
|
|
452
|
-
* - You must provide a third argument
|
|
453
|
-
* continued:
|
|
451
|
+
* - You must provide a third argument:
|
|
454
452
|
* - Pass true if you want the callback to only fire if the run is continued.
|
|
455
453
|
* - Pass false if you want the callback to only fire when the run is not continued.
|
|
456
454
|
* - Pass undefined if you want the callback to fire in both situations.
|
package/src/functions/utils.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { RenderMode } from "isaac-typescript-definitions";
|
|
2
2
|
import { game } from "../core/cachedClasses";
|
|
3
|
+
import { getAllPlayers } from "./playerIndex";
|
|
3
4
|
import { isFunction } from "./types";
|
|
4
5
|
|
|
5
6
|
/**
|
|
@@ -79,6 +80,19 @@ export function inRange(num: int, start: int, end: int): boolean {
|
|
|
79
80
|
return num >= start && num <= end;
|
|
80
81
|
}
|
|
81
82
|
|
|
83
|
+
/**
|
|
84
|
+
* Helper function to detect if there is two or more players currently playing.
|
|
85
|
+
*
|
|
86
|
+
* Specifically, this function looks for unique `ControllerIndex` values across all players.
|
|
87
|
+
*/
|
|
88
|
+
export function isMultiplayer(): boolean {
|
|
89
|
+
const players = getAllPlayers();
|
|
90
|
+
const controllerIndexes = players.map((player) => player.ControllerIndex);
|
|
91
|
+
const controllerIndexesSet = new Set(controllerIndexes);
|
|
92
|
+
|
|
93
|
+
return controllerIndexesSet.size > 1;
|
|
94
|
+
}
|
|
95
|
+
|
|
82
96
|
/**
|
|
83
97
|
* Helper function to see if the current render callback is rendering a water reflection.
|
|
84
98
|
*
|