isaacscript-common 1.2.73 → 1.2.76
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/postFlip.lua +11 -8
- package/dist/callbacks/postGridEntity.lua +57 -24
- package/dist/callbacks/postGridEntityCollision.lua +24 -24
- package/dist/callbacks/subscriptions/postGridEntityBroken.d.ts +2 -0
- package/dist/callbacks/subscriptions/postGridEntityBroken.lua +25 -0
- package/dist/callbacks/subscriptions/postGridEntityStateChange.d.ts +2 -0
- package/dist/callbacks/subscriptions/postGridEntityStateChange.lua +25 -0
- package/dist/features/runInNFrames.lua +5 -6
- package/dist/functions/array.d.ts +8 -2
- package/dist/functions/array.lua +14 -2
- package/dist/functions/familiars.lua +4 -8
- package/dist/functions/globals.d.ts +1 -1
- package/dist/functions/globals.lua +9 -6
- package/dist/functions/gridEntity.d.ts +13 -3
- package/dist/functions/gridEntity.lua +34 -21
- package/dist/functions/log.lua +5 -6
- package/dist/functions/player.d.ts +13 -3
- package/dist/functions/player.lua +63 -57
- package/dist/functions/playerHealth.lua +5 -6
- package/dist/functions/sprite.lua +4 -11
- package/dist/patchErrorFunctions.lua +9 -15
- package/dist/types/CallbackParametersCustom.d.ts +10 -0
- package/dist/types/ModCallbacksCustom.d.ts +4 -2
- package/dist/types/ModCallbacksCustom.lua +6 -2
- package/dist/types/ModUpgraded.lua +16 -0
- package/package.json +2 -2
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
|
+
local ____lualib = require("lualib_bundle")
|
|
3
|
+
local __TS__ArrayFind = ____lualib.__TS__ArrayFind
|
|
2
4
|
local ____exports = {}
|
|
3
5
|
local hasSubscriptions, useItemFlip, getNewLazarus, v
|
|
4
6
|
local ____exports = require("features.saveDataManager.exports")
|
|
5
7
|
local saveDataManager = ____exports.saveDataManager
|
|
6
8
|
local ____player = require("functions.player")
|
|
7
|
-
local
|
|
9
|
+
local getPlayersOfType = ____player.getPlayersOfType
|
|
8
10
|
local isTaintedLazarus = ____player.isTaintedLazarus
|
|
9
11
|
local ____postFirstFlip = require("callbacks.subscriptions.postFirstFlip")
|
|
10
12
|
local postFirstFlipFire = ____postFirstFlip.postFirstFlipFire
|
|
@@ -23,6 +25,9 @@ function useItemFlip(self, _collectibleType, _rng, player, _useFlags, _activeSlo
|
|
|
23
25
|
return
|
|
24
26
|
end
|
|
25
27
|
local newLazarus = getNewLazarus(nil, player)
|
|
28
|
+
if newLazarus == nil then
|
|
29
|
+
return
|
|
30
|
+
end
|
|
26
31
|
if not v.run.usedFlipAtLeastOnce then
|
|
27
32
|
v.run.usedFlipAtLeastOnce = true
|
|
28
33
|
postFirstFlipFire(nil, newLazarus)
|
|
@@ -39,13 +44,11 @@ function getNewLazarus(self, oldLazarus)
|
|
|
39
44
|
else
|
|
40
45
|
error("Failed to determine the character in the postFlip callback.")
|
|
41
46
|
end
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
end
|
|
48
|
-
return error("Failed to find the player entity for the new Lazarus.")
|
|
47
|
+
local playersOfType = getPlayersOfType(nil, newCharacter)
|
|
48
|
+
return __TS__ArrayFind(
|
|
49
|
+
playersOfType,
|
|
50
|
+
function(____, player) return player.FrameCount == oldLazarus.FrameCount end
|
|
51
|
+
)
|
|
49
52
|
end
|
|
50
53
|
v = {run = {usedFlipAtLeastOnce = false}}
|
|
51
54
|
function ____exports.postFlipCallbacksInit(self, mod)
|
|
@@ -4,61 +4,94 @@ local Map = ____lualib.Map
|
|
|
4
4
|
local __TS__New = ____lualib.__TS__New
|
|
5
5
|
local __TS__Iterator = ____lualib.__TS__Iterator
|
|
6
6
|
local ____exports = {}
|
|
7
|
-
local hasSubscriptions, postUpdate, checkNewGridEntity,
|
|
7
|
+
local hasSubscriptions, postUpdate, checkGridEntitiesRemoved, checkGridEntityStateChanged, checkNewGridEntity, updateTupleInMap, postNewRoom, v
|
|
8
8
|
local ____exports = require("features.saveDataManager.exports")
|
|
9
9
|
local saveDataManager = ____exports.saveDataManager
|
|
10
10
|
local ____gridEntity = require("functions.gridEntity")
|
|
11
|
-
local
|
|
11
|
+
local getGridEntitiesMap = ____gridEntity.getGridEntitiesMap
|
|
12
|
+
local isGridEntityBroken = ____gridEntity.isGridEntityBroken
|
|
13
|
+
local ____postGridEntityBroken = require("callbacks.subscriptions.postGridEntityBroken")
|
|
14
|
+
local postGridEntityBrokenFire = ____postGridEntityBroken.postGridEntityBrokenFire
|
|
15
|
+
local postGridEntityBrokenHasSubscriptions = ____postGridEntityBroken.postGridEntityBrokenHasSubscriptions
|
|
12
16
|
local ____postGridEntityInit = require("callbacks.subscriptions.postGridEntityInit")
|
|
13
17
|
local postGridEntityInitFire = ____postGridEntityInit.postGridEntityInitFire
|
|
14
18
|
local postGridEntityInitHasSubscriptions = ____postGridEntityInit.postGridEntityInitHasSubscriptions
|
|
15
19
|
local ____postGridEntityRemove = require("callbacks.subscriptions.postGridEntityRemove")
|
|
16
20
|
local postGridEntityRemoveFire = ____postGridEntityRemove.postGridEntityRemoveFire
|
|
17
21
|
local postGridEntityRemoveHasSubscriptions = ____postGridEntityRemove.postGridEntityRemoveHasSubscriptions
|
|
22
|
+
local ____postGridEntityStateChange = require("callbacks.subscriptions.postGridEntityStateChange")
|
|
23
|
+
local postGridEntityStateChangeFire = ____postGridEntityStateChange.postGridEntityStateChangeFire
|
|
24
|
+
local postGridEntityStateChangeHasSubscriptions = ____postGridEntityStateChange.postGridEntityStateChangeHasSubscriptions
|
|
18
25
|
local ____postGridEntityUpdate = require("callbacks.subscriptions.postGridEntityUpdate")
|
|
19
26
|
local postGridEntityUpdateFire = ____postGridEntityUpdate.postGridEntityUpdateFire
|
|
20
27
|
local postGridEntityUpdateHasSubscriptions = ____postGridEntityUpdate.postGridEntityUpdateHasSubscriptions
|
|
21
28
|
function hasSubscriptions(self)
|
|
22
|
-
return postGridEntityInitHasSubscriptions(nil) or postGridEntityUpdateHasSubscriptions(nil) or postGridEntityRemoveHasSubscriptions(nil)
|
|
29
|
+
return postGridEntityInitHasSubscriptions(nil) or postGridEntityUpdateHasSubscriptions(nil) or postGridEntityRemoveHasSubscriptions(nil) or postGridEntityStateChangeHasSubscriptions(nil) or postGridEntityBrokenHasSubscriptions(nil)
|
|
23
30
|
end
|
|
24
31
|
function postUpdate(self)
|
|
25
32
|
if not hasSubscriptions(nil) then
|
|
26
33
|
return
|
|
27
34
|
end
|
|
28
|
-
|
|
29
|
-
|
|
35
|
+
local gridEntitiesMap = getGridEntitiesMap(nil)
|
|
36
|
+
checkGridEntitiesRemoved(nil, gridEntitiesMap)
|
|
37
|
+
for ____, ____value in __TS__Iterator(gridEntitiesMap:entries()) do
|
|
38
|
+
local gridIndex = ____value[1]
|
|
39
|
+
local gridEntity = ____value[2]
|
|
40
|
+
checkGridEntityStateChanged(nil, gridIndex, gridEntity)
|
|
41
|
+
checkNewGridEntity(nil, gridIndex, gridEntity)
|
|
30
42
|
postGridEntityUpdateFire(nil, gridEntity)
|
|
31
43
|
end
|
|
32
|
-
checkGridEntityRemoved(nil)
|
|
33
|
-
end
|
|
34
|
-
function checkNewGridEntity(self, gridEntity)
|
|
35
|
-
local gridIndex = gridEntity:GetGridIndex()
|
|
36
|
-
local gridEntityType = gridEntity:GetType()
|
|
37
|
-
local storedGridEntityType = v.room.initializedGridEntities:get(gridIndex)
|
|
38
|
-
if storedGridEntityType ~= gridEntityType then
|
|
39
|
-
v.room.initializedGridEntities:set(gridIndex, gridEntityType)
|
|
40
|
-
postGridEntityInitFire(nil, gridEntity)
|
|
41
|
-
end
|
|
42
44
|
end
|
|
43
|
-
function
|
|
44
|
-
local game = Game()
|
|
45
|
-
local room = game:GetRoom()
|
|
45
|
+
function checkGridEntitiesRemoved(self, gridEntitiesMap)
|
|
46
46
|
for ____, ____value in __TS__Iterator(v.room.initializedGridEntities:entries()) do
|
|
47
47
|
local gridIndex = ____value[1]
|
|
48
|
-
local
|
|
49
|
-
local
|
|
50
|
-
|
|
48
|
+
local gridEntityTuple = ____value[2]
|
|
49
|
+
local storedGridEntityType = table.unpack(gridEntityTuple)
|
|
50
|
+
local gridEntity = gridEntitiesMap:get(gridIndex)
|
|
51
|
+
if gridEntity == nil or gridEntity:GetType() ~= storedGridEntityType then
|
|
51
52
|
v.room.initializedGridEntities:delete(gridIndex)
|
|
52
|
-
postGridEntityRemoveFire(nil, gridIndex,
|
|
53
|
+
postGridEntityRemoveFire(nil, gridIndex, storedGridEntityType)
|
|
53
54
|
end
|
|
54
55
|
end
|
|
55
56
|
end
|
|
57
|
+
function checkGridEntityStateChanged(self, gridIndex, gridEntity)
|
|
58
|
+
local gridEntityTuple = v.room.initializedGridEntities:get(gridIndex)
|
|
59
|
+
if gridEntityTuple == nil then
|
|
60
|
+
return
|
|
61
|
+
end
|
|
62
|
+
local ____, oldState = table.unpack(gridEntityTuple)
|
|
63
|
+
local newState = gridEntity.State
|
|
64
|
+
if oldState ~= newState then
|
|
65
|
+
updateTupleInMap(nil, gridEntity)
|
|
66
|
+
postGridEntityStateChangeFire(nil, gridEntity, oldState, newState)
|
|
67
|
+
if isGridEntityBroken(nil, gridEntity) then
|
|
68
|
+
postGridEntityBrokenFire(nil, gridEntity)
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
function checkNewGridEntity(self, gridIndex, gridEntity)
|
|
73
|
+
local gridEntityType = gridEntity:GetType()
|
|
74
|
+
local gridEntityTuple = v.room.initializedGridEntities:get(gridIndex)
|
|
75
|
+
if gridEntityTuple == nil or gridEntityTuple[1] ~= gridEntityType then
|
|
76
|
+
updateTupleInMap(nil, gridEntity)
|
|
77
|
+
postGridEntityInitFire(nil, gridEntity)
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
function updateTupleInMap(self, gridEntity)
|
|
81
|
+
local gridEntityType = gridEntity:GetType()
|
|
82
|
+
local gridIndex = gridEntity:GetGridIndex()
|
|
83
|
+
local newTuple = {gridEntityType, gridEntity.State}
|
|
84
|
+
v.room.initializedGridEntities:set(gridIndex, newTuple)
|
|
85
|
+
end
|
|
56
86
|
function postNewRoom(self)
|
|
57
87
|
if not hasSubscriptions(nil) then
|
|
58
88
|
return
|
|
59
89
|
end
|
|
60
|
-
|
|
61
|
-
|
|
90
|
+
local gridEntitiesMap = getGridEntitiesMap(nil)
|
|
91
|
+
for ____, ____value in __TS__Iterator(gridEntitiesMap:entries()) do
|
|
92
|
+
local gridIndex = ____value[1]
|
|
93
|
+
local gridEntity = ____value[2]
|
|
94
|
+
checkNewGridEntity(nil, gridIndex, gridEntity)
|
|
62
95
|
end
|
|
63
96
|
end
|
|
64
97
|
v = {room = {initializedGridEntities = __TS__New(Map)}}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
local ____lualib = require("lualib_bundle")
|
|
3
3
|
local Set = ____lualib.Set
|
|
4
4
|
local __TS__New = ____lualib.__TS__New
|
|
5
|
+
local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
|
|
5
6
|
local __TS__ArrayMap = ____lualib.__TS__ArrayMap
|
|
6
7
|
local __TS__Iterator = ____lualib.__TS__Iterator
|
|
7
8
|
local ____exports = {}
|
|
@@ -23,33 +24,32 @@ function postUpdate(self)
|
|
|
23
24
|
if not hasSubscriptions(nil) then
|
|
24
25
|
return
|
|
25
26
|
end
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
local gridEntities = getGridEntities(nil)
|
|
28
|
+
local gridEntitiesWithCollision = __TS__ArrayFilter(
|
|
29
|
+
gridEntities,
|
|
30
|
+
function(____, gridEntity) return gridEntity.CollisionClass ~= GridCollisionClass.COLLISION_NONE end
|
|
31
|
+
)
|
|
32
|
+
for ____, gridEntity in ipairs(gridEntitiesWithCollision) do
|
|
33
|
+
local gridEntityPtrHash = GetPtrHash(gridEntity)
|
|
34
|
+
local oldCollidingEntities = v.room.collidingEntitiesMap:getAndSetDefault(gridEntityPtrHash)
|
|
35
|
+
local collidingEntities = getCollidingEntitiesWithGridEntity(nil, gridEntity)
|
|
36
|
+
for ____, entity in ipairs(collidingEntities) do
|
|
37
|
+
local entityPtrHash = GetPtrHash(entity)
|
|
38
|
+
if not oldCollidingEntities:has(entityPtrHash) then
|
|
39
|
+
oldCollidingEntities:add(entityPtrHash)
|
|
40
|
+
postGridEntityCollisionFire(nil, gridEntity, entity)
|
|
30
41
|
end
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
end
|
|
41
|
-
local collidingEntitiesPtrHashes = __TS__ArrayMap(
|
|
42
|
-
collidingEntities,
|
|
43
|
-
function(____, entity) return GetPtrHash(entity) end
|
|
44
|
-
)
|
|
45
|
-
local collidingEntitiesPtrHashSet = __TS__New(Set, collidingEntitiesPtrHashes)
|
|
46
|
-
for ____, oldCollidingEntityPtrHash in __TS__Iterator(oldCollidingEntities:values()) do
|
|
47
|
-
if not collidingEntitiesPtrHashSet:has(oldCollidingEntityPtrHash) then
|
|
48
|
-
oldCollidingEntities:delete(oldCollidingEntityPtrHash)
|
|
49
|
-
end
|
|
42
|
+
end
|
|
43
|
+
local collidingEntitiesPtrHashes = __TS__ArrayMap(
|
|
44
|
+
collidingEntities,
|
|
45
|
+
function(____, entity) return GetPtrHash(entity) end
|
|
46
|
+
)
|
|
47
|
+
local collidingEntitiesPtrHashSet = __TS__New(Set, collidingEntitiesPtrHashes)
|
|
48
|
+
for ____, oldCollidingEntityPtrHash in __TS__Iterator(oldCollidingEntities:values()) do
|
|
49
|
+
if not collidingEntitiesPtrHashSet:has(oldCollidingEntityPtrHash) then
|
|
50
|
+
oldCollidingEntities:delete(oldCollidingEntityPtrHash)
|
|
50
51
|
end
|
|
51
52
|
end
|
|
52
|
-
::__continue7::
|
|
53
53
|
end
|
|
54
54
|
end
|
|
55
55
|
v = {room = {collidingEntitiesMap = __TS__New(
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
|
+
local ____lualib = require("lualib_bundle")
|
|
3
|
+
local __TS__ArrayPush = ____lualib.__TS__ArrayPush
|
|
4
|
+
local ____exports = {}
|
|
5
|
+
local subscriptions = {}
|
|
6
|
+
function ____exports.postGridEntityBrokenHasSubscriptions(self)
|
|
7
|
+
return #subscriptions > 0
|
|
8
|
+
end
|
|
9
|
+
function ____exports.postGridEntityBrokenRegister(self, callback, gridEntityType)
|
|
10
|
+
__TS__ArrayPush(subscriptions, {callback, gridEntityType})
|
|
11
|
+
end
|
|
12
|
+
function ____exports.postGridEntityBrokenFire(self, gridEntity)
|
|
13
|
+
for ____, ____value in ipairs(subscriptions) do
|
|
14
|
+
local callback = ____value[1]
|
|
15
|
+
local gridEntityType = ____value[2]
|
|
16
|
+
do
|
|
17
|
+
if gridEntityType ~= nil and gridEntityType ~= gridEntity:GetType() then
|
|
18
|
+
goto __continue5
|
|
19
|
+
end
|
|
20
|
+
callback(nil, gridEntity)
|
|
21
|
+
end
|
|
22
|
+
::__continue5::
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
return ____exports
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
|
+
local ____lualib = require("lualib_bundle")
|
|
3
|
+
local __TS__ArrayPush = ____lualib.__TS__ArrayPush
|
|
4
|
+
local ____exports = {}
|
|
5
|
+
local subscriptions = {}
|
|
6
|
+
function ____exports.postGridEntityStateChangeHasSubscriptions(self)
|
|
7
|
+
return #subscriptions > 0
|
|
8
|
+
end
|
|
9
|
+
function ____exports.postGridEntityStateChangeRegister(self, callback, gridEntityType)
|
|
10
|
+
__TS__ArrayPush(subscriptions, {callback, gridEntityType})
|
|
11
|
+
end
|
|
12
|
+
function ____exports.postGridEntityStateChangeFire(self, gridEntity, oldState, newState)
|
|
13
|
+
for ____, ____value in ipairs(subscriptions) do
|
|
14
|
+
local callback = ____value[1]
|
|
15
|
+
local gridEntityType = ____value[2]
|
|
16
|
+
do
|
|
17
|
+
if gridEntityType ~= nil and gridEntityType ~= gridEntity:GetType() then
|
|
18
|
+
goto __continue5
|
|
19
|
+
end
|
|
20
|
+
callback(nil, gridEntity, oldState, newState)
|
|
21
|
+
end
|
|
22
|
+
::__continue5::
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
return ____exports
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
2
|
local ____lualib = require("lualib_bundle")
|
|
3
3
|
local __TS__ArrayPush = ____lualib.__TS__ArrayPush
|
|
4
|
+
local __TS__ArrayForEach = ____lualib.__TS__ArrayForEach
|
|
4
5
|
local __TS__ArraySplice = ____lualib.__TS__ArraySplice
|
|
5
6
|
local ____exports = {}
|
|
6
7
|
local postUpdate, postRender, checkExecuteQueuedFunctions, v
|
|
@@ -20,18 +21,16 @@ end
|
|
|
20
21
|
function checkExecuteQueuedFunctions(self, frameCount, functionTuples)
|
|
21
22
|
local functionsToFire = {}
|
|
22
23
|
local indexesToRemove = {}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
local functionTuple = functionTuples[i + 1]
|
|
24
|
+
__TS__ArrayForEach(
|
|
25
|
+
functionTuples,
|
|
26
|
+
function(____, functionTuple, i)
|
|
27
27
|
local frame, func = table.unpack(functionTuple)
|
|
28
28
|
if frameCount >= frame then
|
|
29
29
|
__TS__ArrayPush(functionsToFire, func)
|
|
30
30
|
__TS__ArrayPush(indexesToRemove, i)
|
|
31
31
|
end
|
|
32
|
-
i = i + 1
|
|
33
32
|
end
|
|
34
|
-
|
|
33
|
+
)
|
|
35
34
|
for ____, indexToRemove in ipairs(indexesToRemove) do
|
|
36
35
|
__TS__ArraySplice(functionTuples, indexToRemove, 1)
|
|
37
36
|
end
|
|
@@ -6,8 +6,14 @@
|
|
|
6
6
|
* combine N arrays. Note that this will only perform a shallow copy of the array elements.
|
|
7
7
|
*/
|
|
8
8
|
export declare function combineArray<T>(...arrays: Array<T[] | readonly T[]>): T[];
|
|
9
|
-
/**
|
|
10
|
-
|
|
9
|
+
/**
|
|
10
|
+
* Helper function to perform a shallow copy.
|
|
11
|
+
*
|
|
12
|
+
* @param oldArray The array to copy.
|
|
13
|
+
* @param numElements Optional. If specified, will only copy the first N elements. By default, the
|
|
14
|
+
* entire array will be copied.
|
|
15
|
+
*/
|
|
16
|
+
export declare function copyArray<T>(oldArray: T[] | readonly T[], numElements?: int): T[];
|
|
11
17
|
export declare function emptyArray<T>(array: T[]): void;
|
|
12
18
|
/**
|
|
13
19
|
* Helper function for determining if two arrays contain the exact same elements. Note that this
|
package/dist/functions/array.lua
CHANGED
|
@@ -48,8 +48,20 @@ function ____exports.combineArray(self, ...)
|
|
|
48
48
|
end
|
|
49
49
|
return elements
|
|
50
50
|
end
|
|
51
|
-
function ____exports.copyArray(self,
|
|
52
|
-
|
|
51
|
+
function ____exports.copyArray(self, oldArray, numElements)
|
|
52
|
+
if numElements == nil then
|
|
53
|
+
numElements = #oldArray
|
|
54
|
+
end
|
|
55
|
+
local newArray = {}
|
|
56
|
+
do
|
|
57
|
+
local i = 0
|
|
58
|
+
while i < numElements do
|
|
59
|
+
local oldElement = oldArray[i + 1]
|
|
60
|
+
__TS__ArrayPush(newArray, oldElement)
|
|
61
|
+
i = i + 1
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
return newArray
|
|
53
65
|
end
|
|
54
66
|
function ____exports.emptyArray(self, array)
|
|
55
67
|
__TS__ArraySplice(array, 0, #array)
|
|
@@ -5,6 +5,8 @@ local __TS__ArrayPush = ____lualib.__TS__ArrayPush
|
|
|
5
5
|
local ____exports = {}
|
|
6
6
|
local ____constants = require("constants")
|
|
7
7
|
local FAMILIARS_THAT_SHOOT_PLAYER_TEARS = ____constants.FAMILIARS_THAT_SHOOT_PLAYER_TEARS
|
|
8
|
+
local ____array = require("functions.array")
|
|
9
|
+
local copyArray = ____array.copyArray
|
|
8
10
|
local ____entity = require("functions.entity")
|
|
9
11
|
local getEntities = ____entity.getEntities
|
|
10
12
|
local removeEntities = ____entity.removeEntities
|
|
@@ -41,14 +43,8 @@ function ____exports.checkFamiliar(self, player, collectibleType, numTargetFamil
|
|
|
41
43
|
end
|
|
42
44
|
if #familiarsForThisPlayer > numTargetFamiliars then
|
|
43
45
|
local numFamiliarsToRemove = #familiarsForThisPlayer - numTargetFamiliars
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
while i < numFamiliarsToRemove do
|
|
47
|
-
local familiar = familiarsForThisPlayer[i + 1]
|
|
48
|
-
familiar:Remove()
|
|
49
|
-
i = i + 1
|
|
50
|
-
end
|
|
51
|
-
end
|
|
46
|
+
local familiarsToRemove = copyArray(nil, familiarsForThisPlayer, numFamiliarsToRemove)
|
|
47
|
+
removeEntities(nil, familiarsToRemove)
|
|
52
48
|
return numFamiliarsToRemove * -1
|
|
53
49
|
end
|
|
54
50
|
local numFamiliarsToSpawn = numTargetFamiliars - #familiarsForThisPlayer
|
|
@@ -10,5 +10,5 @@ export declare function getDefaultGlobals(): Set<string>;
|
|
|
10
10
|
* Helper function to get an array of any added global variables in the Isaac Lua environment.
|
|
11
11
|
* Returns an array of key/value tuples.
|
|
12
12
|
*/
|
|
13
|
-
export declare function getNewGlobals(): [AnyNotNil, unknown]
|
|
13
|
+
export declare function getNewGlobals(): Array<[AnyNotNil, unknown]>;
|
|
14
14
|
export declare function logNewGlobals(): void;
|
|
@@ -4,6 +4,7 @@ local Set = ____lualib.Set
|
|
|
4
4
|
local __TS__New = ____lualib.__TS__New
|
|
5
5
|
local __TS__ArrayPush = ____lualib.__TS__ArrayPush
|
|
6
6
|
local __TS__ArraySort = ____lualib.__TS__ArraySort
|
|
7
|
+
local __TS__ArrayForEach = ____lualib.__TS__ArrayForEach
|
|
7
8
|
local ____exports = {}
|
|
8
9
|
local twoDimensionalSort
|
|
9
10
|
local ____log = require("functions.log")
|
|
@@ -214,13 +215,15 @@ function ____exports.logNewGlobals(self)
|
|
|
214
215
|
if #newGlobals == 0 then
|
|
215
216
|
log("- n/a (no extra global variables found)")
|
|
216
217
|
end
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
local
|
|
218
|
+
__TS__ArrayForEach(
|
|
219
|
+
newGlobals,
|
|
220
|
+
function(____, ____bindingPattern0, i)
|
|
221
|
+
local value
|
|
222
|
+
local key
|
|
223
|
+
key = ____bindingPattern0[1]
|
|
224
|
+
value = ____bindingPattern0[2]
|
|
221
225
|
log((((tostring(i + 1) .. ") ") .. tostring(key)) .. " - ") .. tostring(value))
|
|
222
|
-
i = i + 1
|
|
223
226
|
end
|
|
224
|
-
|
|
227
|
+
)
|
|
225
228
|
end
|
|
226
229
|
return ____exports
|
|
@@ -7,8 +7,10 @@
|
|
|
7
7
|
export declare function convertXMLGridEntityType(gridEntityXMLType: int, gridEntityXMLVariant: int): [int, int] | undefined;
|
|
8
8
|
export declare function getCollidingEntitiesWithGridEntity(gridEntity: GridEntity): Entity[];
|
|
9
9
|
/**
|
|
10
|
-
* Helper function to get every grid entity in the current room.
|
|
11
|
-
*
|
|
10
|
+
* Helper function to get every grid entity in the current room.
|
|
11
|
+
*
|
|
12
|
+
* Use this function with no arguments to get every grid entity, or specify a variadic amount of
|
|
13
|
+
* arguments to match specific grid entity types.
|
|
12
14
|
*
|
|
13
15
|
* Example:
|
|
14
16
|
* ```
|
|
@@ -27,6 +29,14 @@ export declare function getCollidingEntitiesWithGridEntity(gridEntity: GridEntit
|
|
|
27
29
|
* ```
|
|
28
30
|
*/
|
|
29
31
|
export declare function getGridEntities(...gridEntityTypes: GridEntityType[]): GridEntity[];
|
|
32
|
+
/**
|
|
33
|
+
* Helper function to get a map of every grid entity in the current room. The indexes of the map are
|
|
34
|
+
* equal to the grid index. The values of the map are equal to the grid entities.
|
|
35
|
+
*
|
|
36
|
+
* Use this function with no arguments to get every grid entity, or specify a variadic amount of
|
|
37
|
+
* arguments to match specific grid entity types.
|
|
38
|
+
*/
|
|
39
|
+
export declare function getGridEntitiesMap(...gridEntityTypes: GridEntityType[]): Map<int, GridEntity>;
|
|
30
40
|
export declare function getTopLeftWall(): GridEntity | undefined;
|
|
31
41
|
/**
|
|
32
42
|
* Helper function to get the grid index of the top left wall.
|
|
@@ -39,7 +49,7 @@ export declare function getSurroundingGridEntities(gridEntity: GridEntity): Grid
|
|
|
39
49
|
* Returns true if there are no pressure plates in the room.
|
|
40
50
|
*/
|
|
41
51
|
export declare function isAllPressurePlatesPushed(): boolean;
|
|
42
|
-
export declare function
|
|
52
|
+
export declare function isGridEntityBreakableByExplosion(gridEntity: GridEntity): boolean;
|
|
43
53
|
/**
|
|
44
54
|
* Helper function to see if the provided gridEntity is in its respective broken state. See the
|
|
45
55
|
* `GRID_ENTITY_TYPE_TO_BROKEN_STATE_MAP` constant for more details.
|
|
@@ -4,8 +4,10 @@ local Set = ____lualib.Set
|
|
|
4
4
|
local __TS__New = ____lualib.__TS__New
|
|
5
5
|
local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
|
|
6
6
|
local __TS__ArrayPush = ____lualib.__TS__ArrayPush
|
|
7
|
+
local Map = ____lualib.Map
|
|
7
8
|
local __TS__ArrayEvery = ____lualib.__TS__ArrayEvery
|
|
8
9
|
local ____exports = {}
|
|
10
|
+
local getAllGridEntities
|
|
9
11
|
local ____constants = require("constants")
|
|
10
12
|
local DISTANCE_OF_GRID_TILE = ____constants.DISTANCE_OF_GRID_TILE
|
|
11
13
|
local ____gridEntityTypeToBrokenStateMap = require("maps.gridEntityTypeToBrokenStateMap")
|
|
@@ -22,6 +24,19 @@ local ____rooms = require("functions.rooms")
|
|
|
22
24
|
local roomUpdateSafe = ____rooms.roomUpdateSafe
|
|
23
25
|
local ____sprite = require("functions.sprite")
|
|
24
26
|
local clearSprite = ____sprite.clearSprite
|
|
27
|
+
function getAllGridEntities(self)
|
|
28
|
+
local game = Game()
|
|
29
|
+
local room = game:GetRoom()
|
|
30
|
+
local gridSize = room:GetGridSize()
|
|
31
|
+
local gridEntities = {}
|
|
32
|
+
for ____, gridIndex in ipairs(range(nil, 0, gridSize - 1)) do
|
|
33
|
+
local gridEntity = room:GetGridEntity(gridIndex)
|
|
34
|
+
if gridEntity ~= nil then
|
|
35
|
+
__TS__ArrayPush(gridEntities, gridEntity)
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
return gridEntities
|
|
39
|
+
end
|
|
25
40
|
function ____exports.getTopLeftWallGridIndex(self)
|
|
26
41
|
local game = Game()
|
|
27
42
|
local room = game:GetRoom()
|
|
@@ -116,29 +131,27 @@ function ____exports.getCollidingEntitiesWithGridEntity(self, gridEntity)
|
|
|
116
131
|
end
|
|
117
132
|
function ____exports.getGridEntities(self, ...)
|
|
118
133
|
local gridEntityTypes = {...}
|
|
119
|
-
local
|
|
120
|
-
|
|
121
|
-
|
|
134
|
+
local gridEntities = getAllGridEntities(nil)
|
|
135
|
+
if #gridEntityTypes == 0 then
|
|
136
|
+
return gridEntities
|
|
137
|
+
end
|
|
122
138
|
local gridEntityTypesSet = __TS__New(Set, gridEntityTypes)
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
local
|
|
127
|
-
|
|
128
|
-
goto __continue10
|
|
129
|
-
end
|
|
130
|
-
if #gridEntityTypes == 0 then
|
|
131
|
-
__TS__ArrayPush(gridEntities, gridEntity)
|
|
132
|
-
else
|
|
133
|
-
local thisGridEntityType = gridEntity:GetType()
|
|
134
|
-
if gridEntityTypesSet:has(thisGridEntityType) then
|
|
135
|
-
__TS__ArrayPush(gridEntities, gridEntity)
|
|
136
|
-
end
|
|
137
|
-
end
|
|
139
|
+
return __TS__ArrayFilter(
|
|
140
|
+
gridEntities,
|
|
141
|
+
function(____, gridEntity)
|
|
142
|
+
local gridEntityType = gridEntity:GetType()
|
|
143
|
+
return gridEntityTypesSet:has(gridEntityType)
|
|
138
144
|
end
|
|
139
|
-
|
|
145
|
+
)
|
|
146
|
+
end
|
|
147
|
+
function ____exports.getGridEntitiesMap(self, ...)
|
|
148
|
+
local gridEntities = ____exports.getGridEntities(nil, ...)
|
|
149
|
+
local gridEntityMap = __TS__New(Map)
|
|
150
|
+
for ____, gridEntity in ipairs(gridEntities) do
|
|
151
|
+
local gridIndex = gridEntity:GetGridIndex()
|
|
152
|
+
gridEntityMap:set(gridIndex, gridEntity)
|
|
140
153
|
end
|
|
141
|
-
return
|
|
154
|
+
return gridEntityMap
|
|
142
155
|
end
|
|
143
156
|
function ____exports.getTopLeftWall(self)
|
|
144
157
|
local game = Game()
|
|
@@ -186,7 +199,7 @@ function ____exports.isAllPressurePlatesPushed(self)
|
|
|
186
199
|
end
|
|
187
200
|
)
|
|
188
201
|
end
|
|
189
|
-
function ____exports.
|
|
202
|
+
function ____exports.isGridEntityBreakableByExplosion(self, gridEntity)
|
|
190
203
|
local gridEntityType = gridEntity:GetType()
|
|
191
204
|
local gridEntityVariant = gridEntity:GetVariant()
|
|
192
205
|
local gridEntityTypeVariant = (tostring(gridEntityType) .. ".") .. tostring(gridEntityVariant)
|
package/dist/functions/log.lua
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
local ____lualib = require("lualib_bundle")
|
|
3
3
|
local Map = ____lualib.Map
|
|
4
4
|
local __TS__Iterator = ____lualib.__TS__Iterator
|
|
5
|
+
local __TS__ArrayForEach = ____lualib.__TS__ArrayForEach
|
|
5
6
|
local Set = ____lualib.Set
|
|
6
7
|
local ____exports = {}
|
|
7
8
|
local ____array = require("functions.array")
|
|
@@ -154,10 +155,9 @@ function ____exports.logTemporaryEffects(player)
|
|
|
154
155
|
____exports.log(" n/a (no temporary effects)")
|
|
155
156
|
return
|
|
156
157
|
end
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
local effect = effects[i + 1]
|
|
158
|
+
__TS__ArrayForEach(
|
|
159
|
+
effects,
|
|
160
|
+
function(____, effect, i)
|
|
161
161
|
if effect.Item:IsCollectible() then
|
|
162
162
|
local collectibleName = getCollectibleName(nil, effect.Item.ID)
|
|
163
163
|
____exports.log(((" " .. tostring(i + 1)) .. ") ") .. collectibleName)
|
|
@@ -169,9 +169,8 @@ function ____exports.logTemporaryEffects(player)
|
|
|
169
169
|
else
|
|
170
170
|
____exports.log(((" " .. tostring(i + 1)) .. ") Unknown type of temporary effect: ") .. tostring(effect.Item.ID))
|
|
171
171
|
end
|
|
172
|
-
i = i + 1
|
|
173
172
|
end
|
|
174
|
-
|
|
173
|
+
)
|
|
175
174
|
end
|
|
176
175
|
function ____exports.logSet(set)
|
|
177
176
|
____exports.log("Printing out a TSTL Set:")
|
|
@@ -45,6 +45,14 @@ export declare function characterCanHaveSoulHearts(character: PlayerType | int):
|
|
|
45
45
|
* Otherwise, returns false.
|
|
46
46
|
*/
|
|
47
47
|
export declare function characterGetsBlackHeartFromEternalHeart(character: PlayerType | int): boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Helper function to get every player with no restrictions, by using `Game.GetNumPlayers` and
|
|
50
|
+
* `Isaac.GetPlayer`.
|
|
51
|
+
*
|
|
52
|
+
* This function is almost never what you want to use. For most intents and purposes, use the
|
|
53
|
+
* `getPlayers()` helper function instead to get a more filtered list of players.
|
|
54
|
+
*/
|
|
55
|
+
export declare function getAllPlayers(): EntityPlayer[];
|
|
48
56
|
/**
|
|
49
57
|
* Helper function to get how long Azazel's Brimstone laser should be. You can pass either an
|
|
50
58
|
* `EntityPlayer` object or a tear height stat.
|
|
@@ -167,10 +175,12 @@ export declare function getPlayerNumHitsRemaining(player: EntityPlayer): int;
|
|
|
167
175
|
* This function always excludes players with a non-undefined parent, since they are not real
|
|
168
176
|
* players. (e.g. the Strawman Keeper)
|
|
169
177
|
*
|
|
170
|
-
*
|
|
171
|
-
*
|
|
178
|
+
* If this is not desired, use the `getAllPlayers` helper function instead.
|
|
179
|
+
*
|
|
180
|
+
* @param performCharacterExclusions Whether or not to exclude characters that are not directly
|
|
181
|
+
* controlled by the player (i.e. Esau & Tainted Soul). False by default.
|
|
172
182
|
*/
|
|
173
|
-
export declare function getPlayers(
|
|
183
|
+
export declare function getPlayers(performCharacterExclusions?: boolean): EntityPlayer[];
|
|
174
184
|
/**
|
|
175
185
|
* Helper function to get all of the players that are a certain character.
|
|
176
186
|
*
|
|
@@ -3,8 +3,8 @@ local ____lualib = require("lualib_bundle")
|
|
|
3
3
|
local Set = ____lualib.Set
|
|
4
4
|
local __TS__New = ____lualib.__TS__New
|
|
5
5
|
local __TS__ArraySome = ____lualib.__TS__ArraySome
|
|
6
|
-
local __TS__ArrayMap = ____lualib.__TS__ArrayMap
|
|
7
6
|
local __TS__ArrayPush = ____lualib.__TS__ArrayPush
|
|
7
|
+
local __TS__ArrayMap = ____lualib.__TS__ArrayMap
|
|
8
8
|
local __TS__ArrayFind = ____lualib.__TS__ArrayFind
|
|
9
9
|
local Map = ____lualib.Map
|
|
10
10
|
local __TS__Iterator = ____lualib.__TS__Iterator
|
|
@@ -35,6 +35,21 @@ local stringContains = ____string.stringContains
|
|
|
35
35
|
local trimPrefix = ____string.trimPrefix
|
|
36
36
|
local ____utils = require("functions.utils")
|
|
37
37
|
local ensureAllCases = ____utils.ensureAllCases
|
|
38
|
+
local ____repeat = ____utils["repeat"]
|
|
39
|
+
function ____exports.getAllPlayers(self)
|
|
40
|
+
local game = Game()
|
|
41
|
+
local numPlayers = game:GetNumPlayers()
|
|
42
|
+
local players = {}
|
|
43
|
+
do
|
|
44
|
+
local i = 0
|
|
45
|
+
while i < numPlayers do
|
|
46
|
+
local player = Isaac.GetPlayer(i)
|
|
47
|
+
__TS__ArrayPush(players, player)
|
|
48
|
+
i = i + 1
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
return players
|
|
52
|
+
end
|
|
38
53
|
function ____exports.getCharacterMaxHeartContainers(self, character)
|
|
39
54
|
if character == PlayerType.PLAYER_KEEPER then
|
|
40
55
|
return 3
|
|
@@ -74,15 +89,15 @@ end
|
|
|
74
89
|
function getPlayerIndexCollectibleType(self, player, differentiateForgottenAndSoul)
|
|
75
90
|
local character = player:GetPlayerType()
|
|
76
91
|
repeat
|
|
77
|
-
local
|
|
78
|
-
local
|
|
79
|
-
if
|
|
92
|
+
local ____switch64 = character
|
|
93
|
+
local ____cond64 = ____switch64 == PlayerType.PLAYER_THESOUL
|
|
94
|
+
if ____cond64 then
|
|
80
95
|
do
|
|
81
96
|
return differentiateForgottenAndSoul and CollectibleType.COLLECTIBLE_SPOON_BENDER or DEFAULT_COLLECTIBLE_TYPE
|
|
82
97
|
end
|
|
83
98
|
end
|
|
84
|
-
|
|
85
|
-
if
|
|
99
|
+
____cond64 = ____cond64 or ____switch64 == PlayerType.PLAYER_LAZARUS2_B
|
|
100
|
+
if ____cond64 then
|
|
86
101
|
do
|
|
87
102
|
return CollectibleType.COLLECTIBLE_INNER_EYE
|
|
88
103
|
end
|
|
@@ -110,39 +125,39 @@ end
|
|
|
110
125
|
function getAdjustedPlayerName(self, player)
|
|
111
126
|
local character = player:GetPlayerType()
|
|
112
127
|
repeat
|
|
113
|
-
local
|
|
114
|
-
local
|
|
115
|
-
if
|
|
128
|
+
local ____switch77 = character
|
|
129
|
+
local ____cond77 = ____switch77 == PlayerType.PLAYER_BLUEBABY or ____switch77 == PlayerType.PLAYER_BLUEBABY_B
|
|
130
|
+
if ____cond77 then
|
|
116
131
|
do
|
|
117
132
|
return "Blue Baby"
|
|
118
133
|
end
|
|
119
134
|
end
|
|
120
|
-
|
|
121
|
-
if
|
|
135
|
+
____cond77 = ____cond77 or ____switch77 == PlayerType.PLAYER_LAZARUS2
|
|
136
|
+
if ____cond77 then
|
|
122
137
|
do
|
|
123
138
|
return "Lazarus II"
|
|
124
139
|
end
|
|
125
140
|
end
|
|
126
|
-
|
|
127
|
-
if
|
|
141
|
+
____cond77 = ____cond77 or ____switch77 == PlayerType.PLAYER_BLACKJUDAS
|
|
142
|
+
if ____cond77 then
|
|
128
143
|
do
|
|
129
144
|
return "Dark Judas"
|
|
130
145
|
end
|
|
131
146
|
end
|
|
132
|
-
|
|
133
|
-
if
|
|
147
|
+
____cond77 = ____cond77 or ____switch77 == PlayerType.PLAYER_JACOB
|
|
148
|
+
if ____cond77 then
|
|
134
149
|
do
|
|
135
150
|
return "Jacob & Esau"
|
|
136
151
|
end
|
|
137
152
|
end
|
|
138
|
-
|
|
139
|
-
if
|
|
153
|
+
____cond77 = ____cond77 or ____switch77 == PlayerType.PLAYER_LAZARUS2_B
|
|
154
|
+
if ____cond77 then
|
|
140
155
|
do
|
|
141
156
|
return "Dead Tainted Lazarus"
|
|
142
157
|
end
|
|
143
158
|
end
|
|
144
|
-
|
|
145
|
-
if
|
|
159
|
+
____cond77 = ____cond77 or ____switch77 == PlayerType.PLAYER_JACOB2_B
|
|
160
|
+
if ____cond77 then
|
|
146
161
|
do
|
|
147
162
|
return "Dead Tainted Jacob"
|
|
148
163
|
end
|
|
@@ -154,32 +169,23 @@ function getAdjustedPlayerName(self, player)
|
|
|
154
169
|
end
|
|
155
170
|
until true
|
|
156
171
|
end
|
|
157
|
-
function ____exports.getPlayers(self,
|
|
158
|
-
if
|
|
159
|
-
|
|
172
|
+
function ____exports.getPlayers(self, performCharacterExclusions)
|
|
173
|
+
if performCharacterExclusions == nil then
|
|
174
|
+
performCharacterExclusions = false
|
|
160
175
|
end
|
|
161
|
-
local
|
|
162
|
-
local
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
end
|
|
172
|
-
local character = player:GetPlayerType()
|
|
173
|
-
if performExclusions and EXCLUDED_CHARACTERS:has(character) then
|
|
174
|
-
goto __continue85
|
|
175
|
-
end
|
|
176
|
-
__TS__ArrayPush(players, player)
|
|
177
|
-
end
|
|
178
|
-
::__continue85::
|
|
179
|
-
i = i + 1
|
|
176
|
+
local players = ____exports.getAllPlayers(nil)
|
|
177
|
+
local nonChildPlayers = __TS__ArrayFilter(
|
|
178
|
+
players,
|
|
179
|
+
function(____, player) return not ____exports.isChildPlayer(nil, player) end
|
|
180
|
+
)
|
|
181
|
+
local nonChildPlayersFiltered = __TS__ArrayFilter(
|
|
182
|
+
nonChildPlayers,
|
|
183
|
+
function(____, player)
|
|
184
|
+
local character = player:GetPlayerType()
|
|
185
|
+
return not EXCLUDED_CHARACTERS:has(character)
|
|
180
186
|
end
|
|
181
|
-
|
|
182
|
-
return
|
|
187
|
+
)
|
|
188
|
+
return performCharacterExclusions and nonChildPlayersFiltered or nonChildPlayers
|
|
183
189
|
end
|
|
184
190
|
function ____exports.getSubPlayerParent(self, subPlayer)
|
|
185
191
|
local subPlayerPtrHash = GetPtrHash(subPlayer)
|
|
@@ -534,13 +540,13 @@ function ____exports.removeCollectibleCostume(self, player, collectibleType)
|
|
|
534
540
|
player:RemoveCostume(itemConfigItem)
|
|
535
541
|
end
|
|
536
542
|
function ____exports.removeDeadEyeMultiplier(self, player)
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
543
|
+
____repeat(
|
|
544
|
+
nil,
|
|
545
|
+
100,
|
|
546
|
+
function()
|
|
540
547
|
player:ClearDeadEyeCharge()
|
|
541
|
-
i = i + 1
|
|
542
548
|
end
|
|
543
|
-
|
|
549
|
+
)
|
|
544
550
|
end
|
|
545
551
|
function ____exports.removeTrinketCostume(self, player, trinketType)
|
|
546
552
|
local itemConfig = Isaac.GetItemConfig()
|
|
@@ -566,9 +572,9 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
|
|
|
566
572
|
itemPool:RemoveCollectible(collectibleType)
|
|
567
573
|
end
|
|
568
574
|
repeat
|
|
569
|
-
local
|
|
570
|
-
local
|
|
571
|
-
if
|
|
575
|
+
local ____switch122 = activeSlot
|
|
576
|
+
local ____cond122 = ____switch122 == ActiveSlot.SLOT_PRIMARY
|
|
577
|
+
if ____cond122 then
|
|
572
578
|
do
|
|
573
579
|
if primaryCollectibleType ~= CollectibleType.COLLECTIBLE_NULL then
|
|
574
580
|
player:RemoveCollectible(primaryCollectibleType)
|
|
@@ -577,8 +583,8 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
|
|
|
577
583
|
break
|
|
578
584
|
end
|
|
579
585
|
end
|
|
580
|
-
|
|
581
|
-
if
|
|
586
|
+
____cond122 = ____cond122 or ____switch122 == ActiveSlot.SLOT_SECONDARY
|
|
587
|
+
if ____cond122 then
|
|
582
588
|
do
|
|
583
589
|
if primaryCollectibleType ~= CollectibleType.COLLECTIBLE_NULL then
|
|
584
590
|
player:RemoveCollectible(primaryCollectibleType)
|
|
@@ -593,16 +599,16 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
|
|
|
593
599
|
break
|
|
594
600
|
end
|
|
595
601
|
end
|
|
596
|
-
|
|
597
|
-
if
|
|
602
|
+
____cond122 = ____cond122 or ____switch122 == ActiveSlot.SLOT_POCKET
|
|
603
|
+
if ____cond122 then
|
|
598
604
|
do
|
|
599
605
|
player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
|
|
600
606
|
player:SetActiveCharge(charge, activeSlot)
|
|
601
607
|
break
|
|
602
608
|
end
|
|
603
609
|
end
|
|
604
|
-
|
|
605
|
-
if
|
|
610
|
+
____cond122 = ____cond122 or ____switch122 == ActiveSlot.SLOT_POCKET2
|
|
611
|
+
if ____cond122 then
|
|
606
612
|
do
|
|
607
613
|
player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
|
|
608
614
|
break
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
2
|
local ____lualib = require("lualib_bundle")
|
|
3
3
|
local __TS__ArrayPush = ____lualib.__TS__ArrayPush
|
|
4
|
+
local __TS__ArrayForEach = ____lualib.__TS__ArrayForEach
|
|
4
5
|
local ____exports = {}
|
|
5
6
|
local ____constants = require("constants")
|
|
6
7
|
local MAX_PLAYER_HEART_CONTAINERS = ____constants.MAX_PLAYER_HEART_CONTAINERS
|
|
@@ -90,10 +91,9 @@ function ____exports.setPlayerHealth(self, player, playerHealth)
|
|
|
90
91
|
end
|
|
91
92
|
player:AddEternalHearts(playerHealth.eternalHearts)
|
|
92
93
|
local soulHeartsRemaining = playerHealth.soulHearts
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
local heartType = playerHealth.soulHeartTypes[i + 1]
|
|
94
|
+
__TS__ArrayForEach(
|
|
95
|
+
playerHealth.soulHeartTypes,
|
|
96
|
+
function(____, heartType, i)
|
|
97
97
|
local isHalf = playerHealth.soulHearts + playerHealth.boneHearts * 2 < (i + 1) * 2
|
|
98
98
|
local addAmount = 2
|
|
99
99
|
if isHalf or heartType == HeartSubType.HEART_BONE or soulHeartsRemaining < 2 then
|
|
@@ -108,9 +108,8 @@ function ____exports.setPlayerHealth(self, player, playerHealth)
|
|
|
108
108
|
elseif heartType == HeartSubType.HEART_BONE then
|
|
109
109
|
player:AddBoneHearts(addAmount)
|
|
110
110
|
end
|
|
111
|
-
i = i + 1
|
|
112
111
|
end
|
|
113
|
-
|
|
112
|
+
)
|
|
114
113
|
player:AddRottenHearts(playerHealth.rottenHearts)
|
|
115
114
|
player:AddHearts(playerHealth.hearts)
|
|
116
115
|
player:AddGoldenHearts(playerHealth.goldenHearts)
|
|
@@ -1,21 +1,14 @@
|
|
|
1
1
|
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
|
-
local ____lualib = require("lualib_bundle")
|
|
3
|
-
local __TS__ArrayPush = ____lualib.__TS__ArrayPush
|
|
4
2
|
local ____exports = {}
|
|
5
3
|
local ____constants = require("constants")
|
|
6
4
|
local EMPTY_PNG_PATH = ____constants.EMPTY_PNG_PATH
|
|
5
|
+
local ____math = require("functions.math")
|
|
6
|
+
local range = ____math.range
|
|
7
7
|
function ____exports.clearSprite(self, sprite, ...)
|
|
8
8
|
local layerIDs = {...}
|
|
9
|
-
local numLayers = sprite:GetLayerCount()
|
|
10
9
|
if #layerIDs == 0 then
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
local i = 0
|
|
14
|
-
while i < numLayers do
|
|
15
|
-
__TS__ArrayPush(layerIDs, i)
|
|
16
|
-
i = i + 1
|
|
17
|
-
end
|
|
18
|
-
end
|
|
10
|
+
local numLayers = sprite:GetLayerCount()
|
|
11
|
+
layerIDs = range(nil, 0, numLayers - 1)
|
|
19
12
|
end
|
|
20
13
|
for ____, layerID in ipairs(layerIDs) do
|
|
21
14
|
sprite:ReplaceSpritesheet(layerID, EMPTY_PNG_PATH)
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
local ____lualib = require("lualib_bundle")
|
|
3
3
|
local __TS__StringSplit = ____lualib.__TS__StringSplit
|
|
4
4
|
local __TS__StringIncludes = ____lualib.__TS__StringIncludes
|
|
5
|
-
local
|
|
5
|
+
local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
|
|
6
6
|
local ____exports = {}
|
|
7
|
-
local errorWithTraceback, slimTracebackOutput,
|
|
7
|
+
local errorWithTraceback, slimTracebackOutput, removeLinesContaining, LINE_SEPARATOR, USELESS_TRACEBACK_MESSAGES, vanillaError
|
|
8
8
|
local ____debug = require("functions.debug")
|
|
9
9
|
local getTraceback = ____debug.getTraceback
|
|
10
10
|
local ____utils = require("functions.utils")
|
|
@@ -24,23 +24,17 @@ function errorWithTraceback(message, level)
|
|
|
24
24
|
end
|
|
25
25
|
function slimTracebackOutput(self, tracebackOutput)
|
|
26
26
|
for ____, msg in ipairs(USELESS_TRACEBACK_MESSAGES) do
|
|
27
|
-
tracebackOutput =
|
|
27
|
+
tracebackOutput = removeLinesContaining(nil, tracebackOutput, msg)
|
|
28
28
|
end
|
|
29
29
|
return tracebackOutput
|
|
30
30
|
end
|
|
31
|
-
function
|
|
31
|
+
function removeLinesContaining(self, msg, containsMsg)
|
|
32
32
|
local lines = __TS__StringSplit(msg, LINE_SEPARATOR)
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
__TS__ArraySplice(lines, i, 1)
|
|
39
|
-
end
|
|
40
|
-
i = i + 1
|
|
41
|
-
end
|
|
42
|
-
end
|
|
43
|
-
return table.concat(lines, LINE_SEPARATOR or ",")
|
|
33
|
+
local linesThatDontContain = __TS__ArrayFilter(
|
|
34
|
+
lines,
|
|
35
|
+
function(____, line) return not __TS__StringIncludes(line, containsMsg) end
|
|
36
|
+
)
|
|
37
|
+
return table.concat(linesThatDontContain, LINE_SEPARATOR or ",")
|
|
44
38
|
end
|
|
45
39
|
LINE_SEPARATOR = "\n"
|
|
46
40
|
USELESS_TRACEBACK_MESSAGES = {"in upvalue 'getTraceback'", "in function 'sandbox.GetTraceback'", "in function 'error'"}
|
|
@@ -10,9 +10,11 @@ import { PostFirstEsauJrCallbackType } from "../callbacks/subscriptions/postFirs
|
|
|
10
10
|
import { PostFirstFlipCallbackType } from "../callbacks/subscriptions/postFirstFlip";
|
|
11
11
|
import { PostFlipCallbackType } from "../callbacks/subscriptions/postFlip";
|
|
12
12
|
import { PostGameStartedReorderedCallbackType } from "../callbacks/subscriptions/postGameStartedReordered";
|
|
13
|
+
import { PostGridEntityBrokenCallbackType } from "../callbacks/subscriptions/postGridEntityBroken";
|
|
13
14
|
import { PostGridEntityCollisionCallbackType } from "../callbacks/subscriptions/postGridEntityCollision";
|
|
14
15
|
import { PostGridEntityInitCallbackType } from "../callbacks/subscriptions/postGridEntityInit";
|
|
15
16
|
import { PostGridEntityRemoveCallbackType } from "../callbacks/subscriptions/postGridEntityRemove";
|
|
17
|
+
import { PostGridEntityStateChangeCallbackType } from "../callbacks/subscriptions/postGridEntityStateChange";
|
|
16
18
|
import { PostGridEntityUpdateCallbackType } from "../callbacks/subscriptions/postGridEntityUpdate";
|
|
17
19
|
import { PostItemPickupCallbackType } from "../callbacks/subscriptions/postItemPickup";
|
|
18
20
|
import { PostKnifeInitLateCallbackType } from "../callbacks/subscriptions/postKnifeInitLate";
|
|
@@ -209,6 +211,14 @@ export interface CallbackParametersCustom {
|
|
|
209
211
|
callback: PostGridEntityRemoveCallbackType,
|
|
210
212
|
gridEntityType?: GridEntityType
|
|
211
213
|
];
|
|
214
|
+
[ModCallbacksCustom.MC_POST_GRID_ENTITY_STATE_CHANGE]: [
|
|
215
|
+
callback: PostGridEntityStateChangeCallbackType,
|
|
216
|
+
gridEntityType?: GridEntityType
|
|
217
|
+
];
|
|
218
|
+
[ModCallbacksCustom.MC_POST_GRID_ENTITY_BROKEN]: [
|
|
219
|
+
callback: PostGridEntityBrokenCallbackType,
|
|
220
|
+
gridEntityType?: GridEntityType
|
|
221
|
+
];
|
|
212
222
|
[ModCallbacksCustom.MC_POST_GRID_ENTITY_COLLISION]: [
|
|
213
223
|
callback: PostGridEntityCollisionCallbackType,
|
|
214
224
|
gridEntityType?: GridEntityType
|
|
@@ -51,6 +51,8 @@ export declare enum ModCallbacksCustom {
|
|
|
51
51
|
MC_POST_GRID_ENTITY_INIT = 42,
|
|
52
52
|
MC_POST_GRID_ENTITY_UPDATE = 43,
|
|
53
53
|
MC_POST_GRID_ENTITY_REMOVE = 44,
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
MC_POST_GRID_ENTITY_STATE_CHANGE = 45,
|
|
55
|
+
MC_POST_GRID_ENTITY_BROKEN = 46,
|
|
56
|
+
MC_POST_GRID_ENTITY_COLLISION = 47,
|
|
57
|
+
MC_POST_BONE_SWING = 48
|
|
56
58
|
}
|
|
@@ -91,8 +91,12 @@ ____exports.ModCallbacksCustom.MC_POST_GRID_ENTITY_UPDATE = 43
|
|
|
91
91
|
____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_POST_GRID_ENTITY_UPDATE] = "MC_POST_GRID_ENTITY_UPDATE"
|
|
92
92
|
____exports.ModCallbacksCustom.MC_POST_GRID_ENTITY_REMOVE = 44
|
|
93
93
|
____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_POST_GRID_ENTITY_REMOVE] = "MC_POST_GRID_ENTITY_REMOVE"
|
|
94
|
-
____exports.ModCallbacksCustom.
|
|
94
|
+
____exports.ModCallbacksCustom.MC_POST_GRID_ENTITY_STATE_CHANGE = 45
|
|
95
|
+
____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_POST_GRID_ENTITY_STATE_CHANGE] = "MC_POST_GRID_ENTITY_STATE_CHANGE"
|
|
96
|
+
____exports.ModCallbacksCustom.MC_POST_GRID_ENTITY_BROKEN = 46
|
|
97
|
+
____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_POST_GRID_ENTITY_BROKEN] = "MC_POST_GRID_ENTITY_BROKEN"
|
|
98
|
+
____exports.ModCallbacksCustom.MC_POST_GRID_ENTITY_COLLISION = 47
|
|
95
99
|
____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_POST_GRID_ENTITY_COLLISION] = "MC_POST_GRID_ENTITY_COLLISION"
|
|
96
|
-
____exports.ModCallbacksCustom.MC_POST_BONE_SWING =
|
|
100
|
+
____exports.ModCallbacksCustom.MC_POST_BONE_SWING = 48
|
|
97
101
|
____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_POST_BONE_SWING] = "MC_POST_BONE_SWING"
|
|
98
102
|
return ____exports
|
|
@@ -27,12 +27,16 @@ local ____postFlip = require("callbacks.subscriptions.postFlip")
|
|
|
27
27
|
local postFlipRegister = ____postFlip.postFlipRegister
|
|
28
28
|
local ____postGameStartedReordered = require("callbacks.subscriptions.postGameStartedReordered")
|
|
29
29
|
local postGameStartedReorderedRegister = ____postGameStartedReordered.postGameStartedReorderedRegister
|
|
30
|
+
local ____postGridEntityBroken = require("callbacks.subscriptions.postGridEntityBroken")
|
|
31
|
+
local postGridEntityBrokenRegister = ____postGridEntityBroken.postGridEntityBrokenRegister
|
|
30
32
|
local ____postGridEntityCollision = require("callbacks.subscriptions.postGridEntityCollision")
|
|
31
33
|
local postGridEntityCollisionRegister = ____postGridEntityCollision.postGridEntityCollisionRegister
|
|
32
34
|
local ____postGridEntityInit = require("callbacks.subscriptions.postGridEntityInit")
|
|
33
35
|
local postGridEntityInitRegister = ____postGridEntityInit.postGridEntityInitRegister
|
|
34
36
|
local ____postGridEntityRemove = require("callbacks.subscriptions.postGridEntityRemove")
|
|
35
37
|
local postGridEntityRemoveRegister = ____postGridEntityRemove.postGridEntityRemoveRegister
|
|
38
|
+
local ____postGridEntityStateChange = require("callbacks.subscriptions.postGridEntityStateChange")
|
|
39
|
+
local postGridEntityStateChangeRegister = ____postGridEntityStateChange.postGridEntityStateChangeRegister
|
|
36
40
|
local ____postGridEntityUpdate = require("callbacks.subscriptions.postGridEntityUpdate")
|
|
37
41
|
local postGridEntityUpdateRegister = ____postGridEntityUpdate.postGridEntityUpdateRegister
|
|
38
42
|
local ____postItemPickup = require("callbacks.subscriptions.postItemPickup")
|
|
@@ -388,6 +392,18 @@ function getCallbackRegisterFunction(self, callbackID)
|
|
|
388
392
|
return postGridEntityRemoveRegister
|
|
389
393
|
end
|
|
390
394
|
end
|
|
395
|
+
____cond19 = ____cond19 or ____switch19 == ModCallbacksCustom.MC_POST_GRID_ENTITY_STATE_CHANGE
|
|
396
|
+
if ____cond19 then
|
|
397
|
+
do
|
|
398
|
+
return postGridEntityStateChangeRegister
|
|
399
|
+
end
|
|
400
|
+
end
|
|
401
|
+
____cond19 = ____cond19 or ____switch19 == ModCallbacksCustom.MC_POST_GRID_ENTITY_BROKEN
|
|
402
|
+
if ____cond19 then
|
|
403
|
+
do
|
|
404
|
+
return postGridEntityBrokenRegister
|
|
405
|
+
end
|
|
406
|
+
end
|
|
391
407
|
____cond19 = ____cond19 or ____switch19 == ModCallbacksCustom.MC_POST_GRID_ENTITY_COLLISION
|
|
392
408
|
if ____cond19 then
|
|
393
409
|
do
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "isaacscript-common",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.76",
|
|
4
4
|
"description": "Helper functions for IsaacScript mods",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"isaac",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
],
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@zamiell/typescript-to-lua": "^1.4.0",
|
|
29
|
-
"isaac-typescript-definitions": "^1.0.
|
|
29
|
+
"isaac-typescript-definitions": "^1.0.354",
|
|
30
30
|
"isaacscript-lint": "^1.0.81",
|
|
31
31
|
"isaacscript-tsconfig": "^1.1.8",
|
|
32
32
|
"typedoc": "^0.22.12",
|