isaacscript-common 87.6.2 → 87.8.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/classes/ModUpgraded.lua +4 -4
- package/dist/classes/callbacks/InputActionFilter.lua +2 -2
- package/dist/classes/callbacks/InputActionPlayer.lua +2 -2
- package/dist/classes/callbacks/PostCollectibleEmpty.lua +2 -2
- package/dist/classes/callbacks/PostCursedTeleport.lua +2 -2
- package/dist/classes/callbacks/PostCustomRevive.lua +2 -2
- package/dist/classes/callbacks/PostDiceRoomActivated.lua +2 -2
- package/dist/classes/callbacks/PostGridEntityCollision.lua +2 -2
- package/dist/classes/callbacks/PostGridEntityCustomCollision.lua +2 -2
- package/dist/classes/callbacks/PostGridEntityCustomRemove.lua +2 -2
- package/dist/classes/callbacks/PostGridEntityRemove.lua +2 -2
- package/dist/classes/callbacks/PostItemDischarge.lua +2 -2
- package/dist/classes/callbacks/PostKeyboardChanged.lua +2 -2
- package/dist/classes/callbacks/PostPickupSelectionFilter.lua +2 -2
- package/dist/classes/callbacks/PostPurchase.lua +2 -2
- package/dist/classes/callbacks/PostRoomClearChanged.lua +2 -2
- package/dist/classes/callbacks/PostTransformation.lua +2 -2
- package/dist/classes/callbacks/PreEntitySpawnFilter.lua +2 -2
- package/dist/classes/callbacks/PreRoomEntitySpawnFilter.lua +2 -2
- package/dist/classes/features/callbackLogic/GridEntityUpdateDetection.lua +2 -2
- package/dist/classes/features/other/DeployJSONRoom.lua +1 -1
- package/dist/classes/features/other/ExtraConsoleCommands.lua +1 -1
- package/dist/classes/features/other/NoSirenSteal.lua +1 -1
- package/dist/classes/features/other/PersistentEntities.lua +1 -1
- package/dist/classes/features/other/extraConsoleCommands/commands.lua +5 -5
- package/dist/functions/array.d.ts +3 -17
- package/dist/functions/array.d.ts.map +1 -1
- package/dist/functions/array.js +13 -31
- package/dist/functions/array.lua +45 -61
- package/dist/functions/bitSet128.lua +10 -6
- package/dist/functions/color.lua +10 -6
- package/dist/functions/debugFunctions.d.ts.map +1 -1
- package/dist/functions/debugFunctions.js +0 -1
- package/dist/functions/doors.lua +1 -1
- package/dist/functions/entities.lua +8 -4
- package/dist/functions/globals.lua +1 -1
- package/dist/functions/gridEntities.lua +1 -1
- package/dist/functions/input.lua +1 -1
- package/dist/functions/kColor.lua +10 -6
- package/dist/functions/logMisc.lua +0 -1
- package/dist/functions/map.d.ts +1 -1
- package/dist/functions/map.d.ts.map +1 -1
- package/dist/functions/map.js +0 -1
- package/dist/functions/rng.lua +10 -6
- package/dist/functions/roomShapeWalls.lua +5 -5
- package/dist/functions/set.d.ts +1 -1
- package/dist/functions/set.d.ts.map +1 -1
- package/dist/functions/set.js +0 -4
- package/dist/functions/sort.d.ts.map +1 -1
- package/dist/functions/sort.js +0 -1
- package/dist/functions/utils.d.ts +11 -1
- package/dist/functions/utils.d.ts.map +1 -1
- package/dist/functions/utils.js +19 -1
- package/dist/functions/utils.lua +17 -1
- package/dist/functions/vector.lua +10 -6
- package/dist/functions/weighted.lua +1 -1
- package/dist/index.rollup.d.ts +17 -21
- package/dist/isaacscript-common.lua +8184 -8126
- package/dist/maps/entityTypeVariantToBossIDMap.lua +1 -1
- package/dist/shouldFire.lua +56 -56
- package/dist/tsdoc-metadata.json +1 -1
- package/package.json +7 -10
- package/src/functions/array.ts +9 -33
- package/src/functions/debugFunctions.ts +0 -1
- package/src/functions/map.ts +1 -2
- package/src/functions/set.ts +6 -5
- package/src/functions/sort.ts +1 -1
- package/src/functions/utils.ts +19 -1
|
@@ -199,7 +199,7 @@ function ModUpgraded.prototype.initFeature(self, feature)
|
|
|
199
199
|
end
|
|
200
200
|
if feature.callbacksUsed ~= nil then
|
|
201
201
|
for ____, callbackTuple in ipairs(feature.callbacksUsed) do
|
|
202
|
-
local modCallback, callbackFunc, optionalArgs = table.unpack(callbackTuple)
|
|
202
|
+
local modCallback, callbackFunc, optionalArgs = table.unpack(callbackTuple, 1, 3)
|
|
203
203
|
self:AddPriorityCallback(
|
|
204
204
|
modCallback,
|
|
205
205
|
CallbackPriority.IMPORTANT,
|
|
@@ -210,7 +210,7 @@ function ModUpgraded.prototype.initFeature(self, feature)
|
|
|
210
210
|
end
|
|
211
211
|
if feature.customCallbacksUsed ~= nil then
|
|
212
212
|
for ____, callbackTuple in ipairs(feature.customCallbacksUsed) do
|
|
213
|
-
local modCallback, callbackFunc, optionalArgs = table.unpack(callbackTuple)
|
|
213
|
+
local modCallback, callbackFunc, optionalArgs = table.unpack(callbackTuple, 1, 3)
|
|
214
214
|
self:AddPriorityCallbackCustom(
|
|
215
215
|
modCallback,
|
|
216
216
|
CallbackPriority.IMPORTANT,
|
|
@@ -248,13 +248,13 @@ function ModUpgraded.prototype.uninitFeature(self, feature)
|
|
|
248
248
|
end
|
|
249
249
|
if feature.callbacksUsed ~= nil then
|
|
250
250
|
for ____, callbackTuple in ipairs(feature.callbacksUsed) do
|
|
251
|
-
local modCallback, callbackFunc = table.unpack(callbackTuple)
|
|
251
|
+
local modCallback, callbackFunc = table.unpack(callbackTuple, 1, 2)
|
|
252
252
|
self:RemoveCallback(modCallback, callbackFunc)
|
|
253
253
|
end
|
|
254
254
|
end
|
|
255
255
|
if feature.customCallbacksUsed ~= nil then
|
|
256
256
|
for ____, callbackTuple in ipairs(feature.customCallbacksUsed) do
|
|
257
|
-
local modCallback, callbackFunc = table.unpack(callbackTuple)
|
|
257
|
+
local modCallback, callbackFunc = table.unpack(callbackTuple, 1, 2)
|
|
258
258
|
self:RemoveCallbackCustom(modCallback, callbackFunc)
|
|
259
259
|
end
|
|
260
260
|
end
|
|
@@ -13,8 +13,8 @@ __TS__ClassExtends(InputActionFilter, CustomCallback)
|
|
|
13
13
|
function InputActionFilter.prototype.____constructor(self)
|
|
14
14
|
CustomCallback.prototype.____constructor(self)
|
|
15
15
|
self.shouldFire = function(____, fireArgs, optionalArgs)
|
|
16
|
-
local _entity, inputHook, buttonAction = table.unpack(fireArgs)
|
|
17
|
-
local callbackInputHook, callbackButtonAction = table.unpack(optionalArgs)
|
|
16
|
+
local _entity, inputHook, buttonAction = table.unpack(fireArgs, 1, 3)
|
|
17
|
+
local callbackInputHook, callbackButtonAction = table.unpack(optionalArgs, 1, 2)
|
|
18
18
|
return (callbackInputHook == nil or callbackInputHook == inputHook) and (callbackButtonAction == nil or callbackButtonAction == buttonAction)
|
|
19
19
|
end
|
|
20
20
|
self.inputAction = function(____, entity, inputHook, buttonAction) return self:fire(entity, inputHook, buttonAction) end
|
|
@@ -13,8 +13,8 @@ __TS__ClassExtends(InputActionPlayer, CustomCallback)
|
|
|
13
13
|
function InputActionPlayer.prototype.____constructor(self)
|
|
14
14
|
CustomCallback.prototype.____constructor(self)
|
|
15
15
|
self.shouldFire = function(____, fireArgs, optionalArgs)
|
|
16
|
-
local player, inputHook, buttonAction = table.unpack(fireArgs)
|
|
17
|
-
local callbackPlayerVariant, callbackCharacter, callbackInputHook, callbackButtonAction = table.unpack(optionalArgs)
|
|
16
|
+
local player, inputHook, buttonAction = table.unpack(fireArgs, 1, 3)
|
|
17
|
+
local callbackPlayerVariant, callbackCharacter, callbackInputHook, callbackButtonAction = table.unpack(optionalArgs, 1, 4)
|
|
18
18
|
local character = player:GetPlayerType()
|
|
19
19
|
return (callbackPlayerVariant == nil or callbackPlayerVariant == player.Variant) and (callbackCharacter == nil or callbackCharacter == character) and (callbackInputHook == nil or callbackInputHook == inputHook) and (callbackButtonAction == nil or callbackButtonAction == buttonAction)
|
|
20
20
|
end
|
|
@@ -19,8 +19,8 @@ function PostCollectibleEmpty.prototype.____constructor(self)
|
|
|
19
19
|
CustomCallback.prototype.____constructor(self)
|
|
20
20
|
self.v = v
|
|
21
21
|
self.shouldFire = function(____, fireArgs, optionalArgs)
|
|
22
|
-
local _collectible, oldCollectibleType = table.unpack(fireArgs)
|
|
23
|
-
local callbackCollectibleType = table.unpack(optionalArgs)
|
|
22
|
+
local _collectible, oldCollectibleType = table.unpack(fireArgs, 1, 2)
|
|
23
|
+
local callbackCollectibleType = table.unpack(optionalArgs, 1, 1)
|
|
24
24
|
return callbackCollectibleType == nil or callbackCollectibleType == oldCollectibleType
|
|
25
25
|
end
|
|
26
26
|
self.postPickupUpdateCollectible = function(____, pickup)
|
|
@@ -49,7 +49,7 @@ function PostCursedTeleport.prototype.____constructor(self)
|
|
|
49
49
|
if trackingArray == nil then
|
|
50
50
|
return
|
|
51
51
|
end
|
|
52
|
-
local lastDamageFrame, callbackActivatedOnThisFrame = table.unpack(trackingArray)
|
|
52
|
+
local lastDamageFrame, callbackActivatedOnThisFrame = table.unpack(trackingArray, 1, 2)
|
|
53
53
|
if not self:playerIsTeleportingFromCursedTeleport(player, lastDamageFrame) then
|
|
54
54
|
return
|
|
55
55
|
end
|
|
@@ -76,7 +76,7 @@ function PostCursedTeleport.prototype.setDamageFrame(self, player, damageFlags)
|
|
|
76
76
|
local gameFrameCount = game:GetFrameCount()
|
|
77
77
|
local trackingArray = mapGetPlayer(nil, v.run.playersDamageFrameMap, player)
|
|
78
78
|
if trackingArray ~= nil then
|
|
79
|
-
local lastDamageFrame, callbackFiredOnThisFrame = table.unpack(trackingArray)
|
|
79
|
+
local lastDamageFrame, callbackFiredOnThisFrame = table.unpack(trackingArray, 1, 2)
|
|
80
80
|
if lastDamageFrame == gameFrameCount and callbackFiredOnThisFrame then
|
|
81
81
|
return
|
|
82
82
|
end
|
|
@@ -13,8 +13,8 @@ __TS__ClassExtends(PostCustomRevive, CustomCallback)
|
|
|
13
13
|
function PostCustomRevive.prototype.____constructor(self)
|
|
14
14
|
CustomCallback.prototype.____constructor(self)
|
|
15
15
|
self.shouldFire = function(____, fireArgs, optionalArgs)
|
|
16
|
-
local _player, revivalType = table.unpack(fireArgs)
|
|
17
|
-
local callbackRevivalType = table.unpack(optionalArgs)
|
|
16
|
+
local _player, revivalType = table.unpack(fireArgs, 1, 2)
|
|
17
|
+
local callbackRevivalType = table.unpack(optionalArgs, 1, 1)
|
|
18
18
|
return callbackRevivalType == nil or revivalType == callbackRevivalType
|
|
19
19
|
end
|
|
20
20
|
self.featuresUsed = {ISCFeature.CUSTOM_REVIVE}
|
|
@@ -20,8 +20,8 @@ function PostDiceRoomActivated.prototype.____constructor(self)
|
|
|
20
20
|
CustomCallback.prototype.____constructor(self)
|
|
21
21
|
self.v = v
|
|
22
22
|
self.shouldFire = function(____, fireArgs, optionalArgs)
|
|
23
|
-
local _player, diceFloorSubType = table.unpack(fireArgs)
|
|
24
|
-
local callbackDiceFloorSubType = table.unpack(optionalArgs)
|
|
23
|
+
local _player, diceFloorSubType = table.unpack(fireArgs, 1, 2)
|
|
24
|
+
local callbackDiceFloorSubType = table.unpack(optionalArgs, 1, 1)
|
|
25
25
|
return callbackDiceFloorSubType == nil or diceFloorSubType == callbackDiceFloorSubType
|
|
26
26
|
end
|
|
27
27
|
self.postEffectUpdateDiceFloor = function(____, effect)
|
|
@@ -13,8 +13,8 @@ __TS__ClassExtends(PostGridEntityCollision, CustomCallback)
|
|
|
13
13
|
function PostGridEntityCollision.prototype.____constructor(self)
|
|
14
14
|
CustomCallback.prototype.____constructor(self)
|
|
15
15
|
self.shouldFire = function(____, fireArgs, optionalArgs)
|
|
16
|
-
local gridEntity, entity = table.unpack(fireArgs)
|
|
17
|
-
local callbackGridEntityType, callbackGridEntityVariant, callbackEntityType, callbackEntityVariant, callbackEntitySubType = table.unpack(optionalArgs)
|
|
16
|
+
local gridEntity, entity = table.unpack(fireArgs, 1, 2)
|
|
17
|
+
local callbackGridEntityType, callbackGridEntityVariant, callbackEntityType, callbackEntityVariant, callbackEntitySubType = table.unpack(optionalArgs, 1, 5)
|
|
18
18
|
local gridEntityType = gridEntity:GetType()
|
|
19
19
|
local gridEntityVariant = gridEntity:GetVariant()
|
|
20
20
|
return (callbackGridEntityType == nil or callbackGridEntityType == gridEntityType) and (callbackGridEntityVariant == nil or callbackGridEntityVariant == gridEntityVariant) and (callbackEntityType == nil or callbackEntityType == entity.Type) and (callbackEntityVariant == nil or callbackEntityVariant == entity.Variant) and (callbackEntitySubType == nil or callbackEntitySubType == entity.SubType)
|
|
@@ -13,8 +13,8 @@ __TS__ClassExtends(PostGridEntityCustomCollision, CustomCallback)
|
|
|
13
13
|
function PostGridEntityCustomCollision.prototype.____constructor(self)
|
|
14
14
|
CustomCallback.prototype.____constructor(self)
|
|
15
15
|
self.shouldFire = function(____, fireArgs, optionalArgs)
|
|
16
|
-
local _gridEntity, gridEntityTypeCustom, entity = table.unpack(fireArgs)
|
|
17
|
-
local callbackGridEntityTypeCustom, callbackEntityType, callbackEntityVariant, callbackEntitySubType = table.unpack(optionalArgs)
|
|
16
|
+
local _gridEntity, gridEntityTypeCustom, entity = table.unpack(fireArgs, 1, 3)
|
|
17
|
+
local callbackGridEntityTypeCustom, callbackEntityType, callbackEntityVariant, callbackEntitySubType = table.unpack(optionalArgs, 1, 4)
|
|
18
18
|
return (callbackGridEntityTypeCustom == nil or callbackGridEntityTypeCustom == gridEntityTypeCustom) and (callbackEntityType == nil or callbackEntityType == entity.Type) and (callbackEntityVariant == nil or callbackEntityVariant == entity.Variant) and (callbackEntitySubType == nil or callbackEntitySubType == entity.SubType)
|
|
19
19
|
end
|
|
20
20
|
self.featuresUsed = {ISCFeature.GRID_ENTITY_COLLISION_DETECTION}
|
|
@@ -13,8 +13,8 @@ __TS__ClassExtends(PostGridEntityCustomRemove, CustomCallback)
|
|
|
13
13
|
function PostGridEntityCustomRemove.prototype.____constructor(self)
|
|
14
14
|
CustomCallback.prototype.____constructor(self)
|
|
15
15
|
self.shouldFire = function(____, fireArgs, optionalArgs)
|
|
16
|
-
local _gridIndex, gridEntityTypeCustom = table.unpack(fireArgs)
|
|
17
|
-
local callbackGridEntityTypeCustom = table.unpack(optionalArgs)
|
|
16
|
+
local _gridIndex, gridEntityTypeCustom = table.unpack(fireArgs, 1, 2)
|
|
17
|
+
local callbackGridEntityTypeCustom = table.unpack(optionalArgs, 1, 1)
|
|
18
18
|
return callbackGridEntityTypeCustom == nil or callbackGridEntityTypeCustom == gridEntityTypeCustom
|
|
19
19
|
end
|
|
20
20
|
self.featuresUsed = {ISCFeature.GRID_ENTITY_UPDATE_DETECTION}
|
|
@@ -13,8 +13,8 @@ __TS__ClassExtends(PostGridEntityRemove, CustomCallback)
|
|
|
13
13
|
function PostGridEntityRemove.prototype.____constructor(self)
|
|
14
14
|
CustomCallback.prototype.____constructor(self)
|
|
15
15
|
self.shouldFire = function(____, fireArgs, optionalArgs)
|
|
16
|
-
local _gridIndex, gridEntityType, variant = table.unpack(fireArgs)
|
|
17
|
-
local callbackGridEntityType, callbackVariant = table.unpack(optionalArgs)
|
|
16
|
+
local _gridIndex, gridEntityType, variant = table.unpack(fireArgs, 1, 3)
|
|
17
|
+
local callbackGridEntityType, callbackVariant = table.unpack(optionalArgs, 1, 2)
|
|
18
18
|
return (callbackGridEntityType == nil or callbackGridEntityType == gridEntityType) and (callbackVariant == nil or callbackVariant == variant)
|
|
19
19
|
end
|
|
20
20
|
self.featuresUsed = {ISCFeature.GRID_ENTITY_UPDATE_DETECTION}
|
|
@@ -45,8 +45,8 @@ function PostItemDischarge.prototype.____constructor(self)
|
|
|
45
45
|
CustomCallback.prototype.____constructor(self)
|
|
46
46
|
self.v = v
|
|
47
47
|
self.shouldFire = function(____, fireArgs, optionalArgs)
|
|
48
|
-
local _player, collectibleType = table.unpack(fireArgs)
|
|
49
|
-
local callbackCollectibleType = table.unpack(optionalArgs)
|
|
48
|
+
local _player, collectibleType = table.unpack(fireArgs, 1, 2)
|
|
49
|
+
local callbackCollectibleType = table.unpack(optionalArgs, 1, 1)
|
|
50
50
|
return callbackCollectibleType == nil or callbackCollectibleType == collectibleType
|
|
51
51
|
end
|
|
52
52
|
self.preNPCCollisionSucker = function(____, npc, collider)
|
|
@@ -22,8 +22,8 @@ function PostKeyboardChanged.prototype.____constructor(self)
|
|
|
22
22
|
CustomCallback.prototype.____constructor(self)
|
|
23
23
|
self.v = v
|
|
24
24
|
self.shouldFire = function(____, fireArgs, optionalArgs)
|
|
25
|
-
local keyboard, pressed = table.unpack(fireArgs)
|
|
26
|
-
local callbackKeyboard, callbackPressed = table.unpack(optionalArgs)
|
|
25
|
+
local keyboard, pressed = table.unpack(fireArgs, 1, 2)
|
|
26
|
+
local callbackKeyboard, callbackPressed = table.unpack(optionalArgs, 1, 2)
|
|
27
27
|
return (callbackKeyboard == nil or callbackKeyboard == keyboard) and (callbackPressed == nil or callbackPressed == pressed)
|
|
28
28
|
end
|
|
29
29
|
self.postRender = function()
|
|
@@ -13,8 +13,8 @@ __TS__ClassExtends(PostPickupSelectionFilter, CustomCallback)
|
|
|
13
13
|
function PostPickupSelectionFilter.prototype.____constructor(self)
|
|
14
14
|
CustomCallback.prototype.____constructor(self)
|
|
15
15
|
self.shouldFire = function(____, fireArgs, optionalArgs)
|
|
16
|
-
local _pickup, pickupVariant, subType = table.unpack(fireArgs)
|
|
17
|
-
local callbackPickupVariant, callbackPickupSubType = table.unpack(optionalArgs)
|
|
16
|
+
local _pickup, pickupVariant, subType = table.unpack(fireArgs, 1, 3)
|
|
17
|
+
local callbackPickupVariant, callbackPickupSubType = table.unpack(optionalArgs, 1, 2)
|
|
18
18
|
return (callbackPickupVariant == nil or callbackPickupVariant == pickupVariant) and (callbackPickupSubType == nil or callbackPickupSubType == subType)
|
|
19
19
|
end
|
|
20
20
|
self.postPickupSelection = function(____, pickup, variant, subType) return self:fire(pickup, variant, subType) end
|
|
@@ -36,8 +36,8 @@ function PostPurchase.prototype.____constructor(self)
|
|
|
36
36
|
CustomCallback.prototype.____constructor(self)
|
|
37
37
|
self.v = v
|
|
38
38
|
self.shouldFire = function(____, fireArgs, optionalArgs)
|
|
39
|
-
local _player, pickup = table.unpack(fireArgs)
|
|
40
|
-
local callbackPickupVariant, callbackPickupSubType = table.unpack(optionalArgs)
|
|
39
|
+
local _player, pickup = table.unpack(fireArgs, 1, 2)
|
|
40
|
+
local callbackPickupVariant, callbackPickupSubType = table.unpack(optionalArgs, 1, 2)
|
|
41
41
|
return (callbackPickupVariant == nil or callbackPickupVariant == pickup.Variant) and (callbackPickupSubType == nil or callbackPickupSubType == pickup.SubType)
|
|
42
42
|
end
|
|
43
43
|
self.postUseItem = function(____, _collectibleType, _rng, player)
|
|
@@ -19,8 +19,8 @@ function PostRoomClearChanged.prototype.____constructor(self)
|
|
|
19
19
|
CustomCallback.prototype.____constructor(self)
|
|
20
20
|
self.v = v
|
|
21
21
|
self.shouldFire = function(____, fireArgs, optionalArgs)
|
|
22
|
-
local roomClear = table.unpack(fireArgs)
|
|
23
|
-
local callbackRoomClear = table.unpack(optionalArgs)
|
|
22
|
+
local roomClear = table.unpack(fireArgs, 1, 1)
|
|
23
|
+
local callbackRoomClear = table.unpack(optionalArgs, 1, 1)
|
|
24
24
|
return callbackRoomClear == nil or callbackRoomClear == roomClear
|
|
25
25
|
end
|
|
26
26
|
self.postUpdate = function()
|
|
@@ -26,8 +26,8 @@ function PostTransformation.prototype.____constructor(self)
|
|
|
26
26
|
CustomCallback.prototype.____constructor(self)
|
|
27
27
|
self.v = v
|
|
28
28
|
self.shouldFire = function(____, fireArgs, optionalArgs)
|
|
29
|
-
local _player, playerForm = table.unpack(fireArgs)
|
|
30
|
-
local callbackPlayerForm = table.unpack(optionalArgs)
|
|
29
|
+
local _player, playerForm = table.unpack(fireArgs, 1, 2)
|
|
30
|
+
local callbackPlayerForm = table.unpack(optionalArgs, 1, 1)
|
|
31
31
|
return callbackPlayerForm == nil or callbackPlayerForm == playerForm
|
|
32
32
|
end
|
|
33
33
|
self.postPEffectUpdateReordered = function(____, player)
|
|
@@ -13,8 +13,8 @@ __TS__ClassExtends(PreEntitySpawnFilter, CustomCallback)
|
|
|
13
13
|
function PreEntitySpawnFilter.prototype.____constructor(self)
|
|
14
14
|
CustomCallback.prototype.____constructor(self)
|
|
15
15
|
self.shouldFire = function(____, fireArgs, optionalArgs)
|
|
16
|
-
local entityType, variant, subType = table.unpack(fireArgs)
|
|
17
|
-
local callbackEntityType, callbackVariant, callbackSubType = table.unpack(optionalArgs)
|
|
16
|
+
local entityType, variant, subType = table.unpack(fireArgs, 1, 3)
|
|
17
|
+
local callbackEntityType, callbackVariant, callbackSubType = table.unpack(optionalArgs, 1, 3)
|
|
18
18
|
return (callbackEntityType == nil or callbackEntityType == entityType) and (callbackVariant == nil or callbackVariant == variant) and (callbackSubType == nil or callbackSubType == subType)
|
|
19
19
|
end
|
|
20
20
|
self.preEntitySpawn = function(____, entityType, variant, subType, position, velocity, spawner, initSeed) return self:fire(
|
|
@@ -13,8 +13,8 @@ __TS__ClassExtends(PreRoomEntitySpawnFilter, CustomCallback)
|
|
|
13
13
|
function PreRoomEntitySpawnFilter.prototype.____constructor(self)
|
|
14
14
|
CustomCallback.prototype.____constructor(self)
|
|
15
15
|
self.shouldFire = function(____, fireArgs, optionalArgs)
|
|
16
|
-
local entityTypeOrGridEntityXMLType, variant, subType = table.unpack(fireArgs)
|
|
17
|
-
local callbackEntityTypeOrGridEntityXMLType, callbackVariant, callbackSubType = table.unpack(optionalArgs)
|
|
16
|
+
local entityTypeOrGridEntityXMLType, variant, subType = table.unpack(fireArgs, 1, 3)
|
|
17
|
+
local callbackEntityTypeOrGridEntityXMLType, callbackVariant, callbackSubType = table.unpack(optionalArgs, 1, 3)
|
|
18
18
|
return (callbackEntityTypeOrGridEntityXMLType == nil or callbackEntityTypeOrGridEntityXMLType == entityTypeOrGridEntityXMLType) and (callbackVariant == nil or callbackVariant == variant) and (callbackSubType == nil or callbackSubType == subType)
|
|
19
19
|
end
|
|
20
20
|
self.preRoomEntitySpawn = function(____, entityTypeOrGridEntityXMLType, variant, subType, gridIndex, initSeed) return self:fire(
|
|
@@ -67,7 +67,7 @@ function GridEntityUpdateDetection.prototype.checkGridEntitiesRemoved(self, grid
|
|
|
67
67
|
for ____, ____value in __TS__Iterator(v.room.initializedGridEntities) do
|
|
68
68
|
local gridIndex = ____value[1]
|
|
69
69
|
local gridEntityTuple = ____value[2]
|
|
70
|
-
local storedGridEntityType, storedGridEntityVariant = table.unpack(gridEntityTuple)
|
|
70
|
+
local storedGridEntityType, storedGridEntityVariant = table.unpack(gridEntityTuple, 1, 2)
|
|
71
71
|
local gridEntity = gridEntitiesMap:get(gridIndex)
|
|
72
72
|
if gridEntity == nil or gridEntity:GetType() ~= storedGridEntityType then
|
|
73
73
|
v.room.initializedGridEntities:delete(gridIndex)
|
|
@@ -85,7 +85,7 @@ function GridEntityUpdateDetection.prototype.checkGridEntityStateChanged(self, g
|
|
|
85
85
|
if gridEntityTuple == nil then
|
|
86
86
|
return
|
|
87
87
|
end
|
|
88
|
-
local _gridEntityType, _gridEntityVariant, oldState = table.unpack(gridEntityTuple)
|
|
88
|
+
local _gridEntityType, _gridEntityVariant, oldState = table.unpack(gridEntityTuple, 1, 3)
|
|
89
89
|
local newState = gridEntity.State
|
|
90
90
|
if oldState ~= newState then
|
|
91
91
|
self:updateTupleInMap(gridEntity)
|
|
@@ -61,7 +61,7 @@ function spawnGridEntityForJSONRoom(self, gridEntityXMLType, gridEntityXMLVarian
|
|
|
61
61
|
if gridEntityTuple == nil then
|
|
62
62
|
return nil
|
|
63
63
|
end
|
|
64
|
-
local gridEntityType, variant = table.unpack(gridEntityTuple)
|
|
64
|
+
local gridEntityType, variant = table.unpack(gridEntityTuple, 1, 2)
|
|
65
65
|
local position = gridCoordinatesToWorldPosition(nil, x, y)
|
|
66
66
|
local gridIndex = room:GetGridIndex(position)
|
|
67
67
|
local gridEntity = spawnGridEntityWithVariant(nil, gridEntityType, variant, gridIndex)
|
|
@@ -118,7 +118,7 @@ function ExtraConsoleCommands.prototype.____constructor(self)
|
|
|
118
118
|
if resultTuple == nil then
|
|
119
119
|
return
|
|
120
120
|
end
|
|
121
|
-
local commandName, commandFunction = table.unpack(resultTuple)
|
|
121
|
+
local commandName, commandFunction = table.unpack(resultTuple, 1, 2)
|
|
122
122
|
print("Command: " .. commandName)
|
|
123
123
|
commandFunction(nil, params)
|
|
124
124
|
end
|
|
@@ -38,7 +38,7 @@ function NoSirenSteal.prototype.checkReturnFamiliarToPlayer(self, npc)
|
|
|
38
38
|
end
|
|
39
39
|
function NoSirenSteal.prototype.blacklistEntryExists(self, incomingFamiliarVariant, incomingFamiliarSubType)
|
|
40
40
|
for ____, familiarTuple in ipairs(v.run.familiarBlacklist) do
|
|
41
|
-
local familiarVariant, familiarSubType = table.unpack(familiarTuple)
|
|
41
|
+
local familiarVariant, familiarSubType = table.unpack(familiarTuple, 1, 2)
|
|
42
42
|
if familiarVariant == incomingFamiliarVariant and familiarSubType == incomingFamiliarSubType then
|
|
43
43
|
return true
|
|
44
44
|
end
|
|
@@ -125,7 +125,7 @@ function PersistentEntities.prototype.removePersistentEntity(self, persistentEnt
|
|
|
125
125
|
local ptrHash = ____value[1]
|
|
126
126
|
local tuple = ____value[2]
|
|
127
127
|
do
|
|
128
|
-
local index, entityPtr = table.unpack(tuple)
|
|
128
|
+
local index, entityPtr = table.unpack(tuple, 1, 2)
|
|
129
129
|
if index ~= persistentEntityIndex then
|
|
130
130
|
goto __continue16
|
|
131
131
|
end
|
|
@@ -382,7 +382,7 @@ function ____exports.spawnTrinketAt(self, params, golden)
|
|
|
382
382
|
print("You must specify the number corresponding to the trinket type and the number corresponding to the grid tile location.")
|
|
383
383
|
return
|
|
384
384
|
end
|
|
385
|
-
local trinketTypeString, gridIndexString = table.unpack(args)
|
|
385
|
+
local trinketTypeString, gridIndexString = table.unpack(args, 1, 2)
|
|
386
386
|
if trinketTypeString == nil or gridIndexString == nil then
|
|
387
387
|
return
|
|
388
388
|
end
|
|
@@ -419,7 +419,7 @@ function ____exports.addCharges(self, params)
|
|
|
419
419
|
print("Invalid amount of arguments: " .. tostring(#args))
|
|
420
420
|
return
|
|
421
421
|
end
|
|
422
|
-
local activeSlotString, numChargeString = table.unpack(args)
|
|
422
|
+
local activeSlotString, numChargeString = table.unpack(args, 1, 2)
|
|
423
423
|
if activeSlotString == nil then
|
|
424
424
|
return
|
|
425
425
|
end
|
|
@@ -1210,7 +1210,7 @@ function ____exports.setCharges(self, params)
|
|
|
1210
1210
|
print("Invalid amount of arguments: " .. tostring(#args))
|
|
1211
1211
|
return
|
|
1212
1212
|
end
|
|
1213
|
-
local activeSlotString, chargeString = table.unpack(args)
|
|
1213
|
+
local activeSlotString, chargeString = table.unpack(args, 1, 2)
|
|
1214
1214
|
if activeSlotString == nil or chargeString == nil then
|
|
1215
1215
|
return
|
|
1216
1216
|
end
|
|
@@ -1245,7 +1245,7 @@ function ____exports.setPosition(self, params)
|
|
|
1245
1245
|
print("You must specify a position. (e.g. \"setPosition 100 50\")")
|
|
1246
1246
|
return
|
|
1247
1247
|
end
|
|
1248
|
-
local xString, yString = table.unpack(args)
|
|
1248
|
+
local xString, yString = table.unpack(args, 1, 2)
|
|
1249
1249
|
if xString == nil or yString == nil then
|
|
1250
1250
|
return
|
|
1251
1251
|
end
|
|
@@ -1324,7 +1324,7 @@ function ____exports.spawnCollectibleAt(self, params)
|
|
|
1324
1324
|
print("You must specify the number corresponding to the collectible type and the number corresponding to the grid tile location.")
|
|
1325
1325
|
return
|
|
1326
1326
|
end
|
|
1327
|
-
local collectibleTypeString, gridIndexString = table.unpack(args)
|
|
1327
|
+
local collectibleTypeString, gridIndexString = table.unpack(args, 1, 2)
|
|
1328
1328
|
if collectibleTypeString == nil or gridIndexString == nil then
|
|
1329
1329
|
return
|
|
1330
1330
|
end
|
|
@@ -9,25 +9,11 @@ export declare function arrayEquals<T>(array1: readonly T[], array2: readonly T[
|
|
|
9
9
|
* array. If the specified element(s) are not found in the array, it will simply return a shallow
|
|
10
10
|
* copy of the array.
|
|
11
11
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* If there is more than one matching element in the array, this function will only remove the first
|
|
15
|
-
* matching element. If you want to remove all of the elements, use the `arrayRemoveAll` function
|
|
16
|
-
* instead.
|
|
17
|
-
*/
|
|
18
|
-
export declare function arrayRemove<T>(originalArray: readonly T[], ...elementsToRemove: readonly T[]): T[];
|
|
19
|
-
/**
|
|
20
|
-
* Shallow copies and removes the specified element(s) from the array. Returns the copied array. If
|
|
21
|
-
* the specified element(s) are not found in the array, it will simply return a shallow copy of the
|
|
22
|
-
* array.
|
|
12
|
+
* If there is more than one matching element in the array, this function will remove all of them.
|
|
23
13
|
*
|
|
24
14
|
* This function is variadic, meaning that you can specify N arguments to remove N elements.
|
|
25
|
-
*
|
|
26
|
-
* If there is more than one matching element in the array, this function will remove every matching
|
|
27
|
-
* element. If you want to only remove the first matching element, use the `arrayRemove` function
|
|
28
|
-
* instead.
|
|
29
15
|
*/
|
|
30
|
-
export declare function
|
|
16
|
+
export declare function arrayRemove<T>(originalArray: readonly T[], ...elementsToRemove: readonly T[]): T[];
|
|
31
17
|
/**
|
|
32
18
|
* Removes all of the specified element(s) from the array. If the specified element(s) are not found
|
|
33
19
|
* in the array, this function will do nothing.
|
|
@@ -101,7 +87,7 @@ export declare function emptyArray(array: unknown[]): void;
|
|
|
101
87
|
* This is named `filterMap` after the Rust function:
|
|
102
88
|
* https://doc.rust-lang.org/std/iter/struct.FilterMap.html
|
|
103
89
|
*/
|
|
104
|
-
export declare function filterMap<OldT, NewT>(array: readonly OldT[], func: (element: OldT) => NewT | undefined): NewT[];
|
|
90
|
+
export declare function filterMap<OldT, NewT>(array: readonly OldT[], func: (element: OldT) => NewT | undefined): readonly NewT[];
|
|
105
91
|
/**
|
|
106
92
|
* Helper function to get all possible combinations of the given array. This includes the
|
|
107
93
|
* combination of an empty array.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"array.d.ts","sourceRoot":"","sources":["../../src/functions/array.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAO1D;;;GAGG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAC3B,MAAM,EAAE,SAAS,CAAC,EAAE,EACpB,MAAM,EAAE,SAAS,CAAC,EAAE,GACnB,OAAO,CAST;AAED
|
|
1
|
+
{"version":3,"file":"array.d.ts","sourceRoot":"","sources":["../../src/functions/array.ts"],"names":[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YAAY,CAAC,CAAC,EAC5B,aAAa,EAAE,SAAS,CAAC,EAAE,EAC3B,SAAS,EAAE,IAAI,GAAG,GAAG,GAAG,SAAS,GAEhC,CAAC,EAAE,CAKL;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,mBAAmB,CAEjC,KAAK,EAAE,OAAO,EAAE,EAChB,SAAS,EAAE,IAAI,GAAG,GAAG,GAAG,SAAS,GAChC,IAAI,CAWN;AAED,+DAA+D;AAC/D,wBAAgB,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CAEzD;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAE/B,KAAK,EAAE,OAAO,EAAE,EAChB,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,GACR,IAAI,CAMN"}
|
package/dist/functions/array.js
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.arrayEquals = arrayEquals;
|
|
4
4
|
exports.arrayRemove = arrayRemove;
|
|
5
|
-
exports.arrayRemoveAll = arrayRemoveAll;
|
|
6
5
|
exports.arrayRemoveAllInPlace = arrayRemoveAllInPlace;
|
|
7
6
|
exports.arrayRemoveInPlace = arrayRemoveInPlace;
|
|
8
7
|
exports.arrayRemoveIndex = arrayRemoveIndex;
|
|
@@ -54,14 +53,13 @@ function arrayEquals(array1, array2) {
|
|
|
54
53
|
* array. If the specified element(s) are not found in the array, it will simply return a shallow
|
|
55
54
|
* copy of the array.
|
|
56
55
|
*
|
|
57
|
-
*
|
|
56
|
+
* If there is more than one matching element in the array, this function will remove all of them.
|
|
58
57
|
*
|
|
59
|
-
*
|
|
60
|
-
* matching element. If you want to remove all of the elements, use the `arrayRemoveAll` function
|
|
61
|
-
* instead.
|
|
58
|
+
* This function is variadic, meaning that you can specify N arguments to remove N elements.
|
|
62
59
|
*/
|
|
60
|
+
function arrayRemove(originalArray, ...elementsToRemove
|
|
63
61
|
// eslint-disable-next-line complete/no-mutable-return
|
|
64
|
-
|
|
62
|
+
) {
|
|
65
63
|
const elementsToRemoveSet = new ReadonlySet_1.ReadonlySet(elementsToRemove);
|
|
66
64
|
const array = [];
|
|
67
65
|
for (const element of originalArray) {
|
|
@@ -71,23 +69,6 @@ function arrayRemove(originalArray, ...elementsToRemove) {
|
|
|
71
69
|
}
|
|
72
70
|
return array;
|
|
73
71
|
}
|
|
74
|
-
/**
|
|
75
|
-
* Shallow copies and removes the specified element(s) from the array. Returns the copied array. If
|
|
76
|
-
* the specified element(s) are not found in the array, it will simply return a shallow copy of the
|
|
77
|
-
* array.
|
|
78
|
-
*
|
|
79
|
-
* This function is variadic, meaning that you can specify N arguments to remove N elements.
|
|
80
|
-
*
|
|
81
|
-
* If there is more than one matching element in the array, this function will remove every matching
|
|
82
|
-
* element. If you want to only remove the first matching element, use the `arrayRemove` function
|
|
83
|
-
* instead.
|
|
84
|
-
*/
|
|
85
|
-
// eslint-disable-next-line complete/no-mutable-return
|
|
86
|
-
function arrayRemoveAll(originalArray, ...elementsToRemove) {
|
|
87
|
-
const array = copyArray(originalArray);
|
|
88
|
-
arrayRemoveAllInPlace(array, ...elementsToRemove);
|
|
89
|
-
return array;
|
|
90
|
-
}
|
|
91
72
|
/**
|
|
92
73
|
* Removes all of the specified element(s) from the array. If the specified element(s) are not found
|
|
93
74
|
* in the array, this function will do nothing.
|
|
@@ -128,10 +109,11 @@ array, ...elementsToRemove) {
|
|
|
128
109
|
*
|
|
129
110
|
* @returns The removed elements. This will be an empty array if no elements were removed.
|
|
130
111
|
*/
|
|
131
|
-
// eslint-disable-next-line complete/no-mutable-return
|
|
132
112
|
function arrayRemoveInPlace(
|
|
133
113
|
// eslint-disable-next-line complete/prefer-readonly-parameter-types
|
|
134
|
-
array, ...elementsToRemove
|
|
114
|
+
array, ...elementsToRemove
|
|
115
|
+
// eslint-disable-next-line complete/no-mutable-return
|
|
116
|
+
) {
|
|
135
117
|
const removedElements = [];
|
|
136
118
|
for (const element of elementsToRemove) {
|
|
137
119
|
const index = array.indexOf(element);
|
|
@@ -149,8 +131,9 @@ array, ...elementsToRemove) {
|
|
|
149
131
|
*
|
|
150
132
|
* This function is variadic, meaning that you can specify N arguments to remove N elements.
|
|
151
133
|
*/
|
|
134
|
+
function arrayRemoveIndex(originalArray, ...indexesToRemove
|
|
152
135
|
// eslint-disable-next-line complete/no-mutable-return
|
|
153
|
-
|
|
136
|
+
) {
|
|
154
137
|
const indexesToRemoveSet = new ReadonlySet_1.ReadonlySet(indexesToRemove);
|
|
155
138
|
const array = [];
|
|
156
139
|
for (const [i, element] of originalArray.entries()) {
|
|
@@ -168,10 +151,11 @@ function arrayRemoveIndex(originalArray, ...indexesToRemove) {
|
|
|
168
151
|
*
|
|
169
152
|
* @returns The removed elements. This will be an empty array if no elements were removed.
|
|
170
153
|
*/
|
|
171
|
-
// eslint-disable-next-line complete/no-mutable-return
|
|
172
154
|
function arrayRemoveIndexInPlace(
|
|
173
155
|
// eslint-disable-next-line complete/prefer-readonly-parameter-types
|
|
174
|
-
array, ...indexesToRemove
|
|
156
|
+
array, ...indexesToRemove
|
|
157
|
+
// eslint-disable-next-line complete/no-mutable-return
|
|
158
|
+
) {
|
|
175
159
|
const legalIndexes = indexesToRemove.filter((i) => i >= 0 && i < array.length);
|
|
176
160
|
if (legalIndexes.length === 0) {
|
|
177
161
|
return [];
|
|
@@ -248,7 +232,6 @@ function emptyArray(array) {
|
|
|
248
232
|
* This is named `filterMap` after the Rust function:
|
|
249
233
|
* https://doc.rust-lang.org/std/iter/struct.FilterMap.html
|
|
250
234
|
*/
|
|
251
|
-
// eslint-disable-next-line complete/no-mutable-return
|
|
252
235
|
function filterMap(array, func) {
|
|
253
236
|
const filteredArray = [];
|
|
254
237
|
for (const element of array) {
|
|
@@ -331,7 +314,7 @@ function getArrayDuplicateElements(array) {
|
|
|
331
314
|
set.add(element);
|
|
332
315
|
}
|
|
333
316
|
const values = [...duplicateElements];
|
|
334
|
-
return values.
|
|
317
|
+
return values.toSorted(sort_1.sortNormal);
|
|
335
318
|
}
|
|
336
319
|
/**
|
|
337
320
|
* Helper function to get an array containing the indexes of an array.
|
|
@@ -538,7 +521,6 @@ function setAllArrayElements(array, value) {
|
|
|
538
521
|
* `RNG.Next` method will be called. If `undefined` is provided, it will default to
|
|
539
522
|
* a random seed.
|
|
540
523
|
*/
|
|
541
|
-
// eslint-disable-next-line complete/no-mutable-return
|
|
542
524
|
function shuffleArray(originalArray, seedOrRNG) {
|
|
543
525
|
const array = copyArray(originalArray);
|
|
544
526
|
shuffleArrayInPlace(array, seedOrRNG);
|