isaacscript-common 1.2.172 → 1.2.175
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/postNewRoomEarly.lua +2 -2
- package/dist/classes/null.d.ts +6 -7
- package/dist/classes/null.lua +5 -5
- package/dist/constants.d.ts +10 -10
- package/dist/constants.lua +3 -3
- package/dist/features/collectiblesSeen.d.ts +6 -0
- package/dist/features/collectiblesSeen.lua +43 -0
- package/dist/features/deployJSONRoom.lua +2 -1
- package/dist/features/extraConsoleCommands/commands.d.ts +11 -11
- package/dist/features/extraConsoleCommands/commands.lua +23 -22
- package/dist/features/extraConsoleCommands/init.lua +6 -6
- package/dist/features/playerInventory.d.ts +10 -2
- package/dist/features/playerInventory.lua +60 -21
- package/dist/features/saveDataManager/constants.d.ts +1 -1
- package/dist/features/saveDataManager/constants.lua +1 -1
- package/dist/features/saveDataManager/exports.d.ts +6 -6
- package/dist/features/saveDataManager/exports.lua +4 -4
- package/dist/features/saveDataManager/merge.lua +9 -8
- package/dist/featuresInitialized.d.ts +1 -1
- package/dist/featuresInitialized.lua +3 -3
- package/dist/functions/array.d.ts +39 -39
- package/dist/functions/array.lua +79 -79
- package/dist/functions/cards.d.ts +3 -3
- package/dist/functions/cards.lua +7 -7
- package/dist/functions/charge.d.ts +11 -11
- package/dist/functions/charge.lua +13 -13
- package/dist/functions/collectibles.d.ts +53 -15
- package/dist/functions/collectibles.lua +44 -21
- package/dist/functions/color.d.ts +2 -2
- package/dist/functions/color.lua +6 -6
- package/dist/functions/deepCopy.d.ts +0 -3
- package/dist/functions/deepCopy.lua +5 -22
- package/dist/functions/doors.d.ts +8 -8
- package/dist/functions/doors.lua +16 -16
- package/dist/functions/entity.d.ts +13 -14
- package/dist/functions/entity.lua +27 -34
- package/dist/functions/gridEntity.d.ts +8 -1
- package/dist/functions/gridEntity.lua +7 -11
- package/dist/functions/jsonHelpers.d.ts +7 -7
- package/dist/functions/jsonHelpers.lua +10 -11
- package/dist/functions/log.d.ts +21 -21
- package/dist/functions/log.lua +75 -74
- package/dist/functions/math.d.ts +1 -1
- package/dist/functions/math.lua +3 -3
- package/dist/functions/mergeTests.lua +56 -1
- package/dist/functions/player.d.ts +8 -10
- package/dist/functions/player.lua +22 -29
- package/dist/functions/playerHealth.d.ts +1 -1
- package/dist/functions/playerHealth.lua +20 -20
- package/dist/functions/positionVelocity.d.ts +3 -0
- package/dist/functions/positionVelocity.lua +19 -5
- package/dist/functions/random.d.ts +7 -7
- package/dist/functions/revive.d.ts +5 -5
- package/dist/functions/revive.lua +8 -8
- package/dist/functions/roomData.d.ts +96 -0
- package/dist/functions/roomData.lua +57 -0
- package/dist/functions/rooms.d.ts +1 -96
- package/dist/functions/rooms.lua +30 -75
- package/dist/functions/set.d.ts +2 -2
- package/dist/functions/set.lua +7 -7
- package/dist/functions/trinketCacheFlag.d.ts +4 -4
- package/dist/functions/trinketCacheFlag.lua +3 -2
- package/dist/functions/trinketGive.d.ts +7 -7
- package/dist/functions/trinketGive.lua +27 -27
- package/dist/functions/trinkets.d.ts +2 -2
- package/dist/functions/trinkets.lua +6 -6
- package/dist/functions/ui.d.ts +13 -13
- package/dist/functions/ui.lua +28 -28
- package/dist/functions/utils.d.ts +6 -0
- package/dist/functions/utils.lua +7 -0
- package/dist/functions/vector.d.ts +2 -0
- package/dist/functions/vector.lua +13 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.lua +8 -0
- package/dist/maps/roomShapeToTopLeftWallGridIndexMap.d.ts +1 -1
- package/dist/maps/roomShapeToTopLeftWallGridIndexMap.lua +1 -1
- package/dist/types/CollectibleIndex.d.ts +15 -0
- package/dist/types/CollectibleIndex.lua +3 -0
- package/dist/upgradeMod.lua +3 -0
- package/package.json +2 -2
|
@@ -112,13 +112,9 @@ function ____exports.getCollidingEntitiesWithGridEntity(self, gridEntity)
|
|
|
112
112
|
local gridEntityCollisionTopLeft = Vector(gridEntity.Position.X - DISTANCE_OF_GRID_TILE / 2, gridEntity.Position.Y - DISTANCE_OF_GRID_TILE / 2)
|
|
113
113
|
local gridEntityCollisionBottomRight = Vector(gridEntity.Position.X + DISTANCE_OF_GRID_TILE / 2, gridEntity.Position.Y + DISTANCE_OF_GRID_TILE / 2)
|
|
114
114
|
local closeEntities = Isaac.FindInRadius(gridEntity.Position, DISTANCE_OF_GRID_TILE * 2)
|
|
115
|
-
local closeEntitiesThatCollideWithGrid = __TS__ArrayFilter(
|
|
116
|
-
closeEntities,
|
|
117
|
-
function(____, entity) return entity:CollidesWithGrid() end
|
|
118
|
-
)
|
|
119
115
|
return __TS__ArrayFilter(
|
|
120
|
-
|
|
121
|
-
function(____, entity) return isCircleIntersectingRectangle(
|
|
116
|
+
closeEntities,
|
|
117
|
+
function(____, entity) return entity:CollidesWithGrid() and isCircleIntersectingRectangle(
|
|
122
118
|
nil,
|
|
123
119
|
entity.Position,
|
|
124
120
|
entity.Size + 0.1,
|
|
@@ -151,11 +147,6 @@ function ____exports.getGridEntitiesMap(self, ...)
|
|
|
151
147
|
end
|
|
152
148
|
return gridEntityMap
|
|
153
149
|
end
|
|
154
|
-
function ____exports.getTopLeftWall(self)
|
|
155
|
-
local room = game:GetRoom()
|
|
156
|
-
local topLeftWallGridIndex = ____exports.getTopLeftWallGridIndex(nil)
|
|
157
|
-
return room:GetGridEntity(topLeftWallGridIndex)
|
|
158
|
-
end
|
|
159
150
|
function ____exports.getSurroundingGridEntities(self, gridEntity)
|
|
160
151
|
local room = game:GetRoom()
|
|
161
152
|
local gridWidth = room:GetGridWidth()
|
|
@@ -179,6 +170,11 @@ function ____exports.getSurroundingGridEntities(self, gridEntity)
|
|
|
179
170
|
end
|
|
180
171
|
return surroundingGridEntities
|
|
181
172
|
end
|
|
173
|
+
function ____exports.getTopLeftWall(self)
|
|
174
|
+
local room = game:GetRoom()
|
|
175
|
+
local topLeftWallGridIndex = ____exports.getTopLeftWallGridIndex(nil)
|
|
176
|
+
return room:GetGridEntity(topLeftWallGridIndex)
|
|
177
|
+
end
|
|
182
178
|
function ____exports.isAllPressurePlatesPushed(self)
|
|
183
179
|
local room = game:GetRoom()
|
|
184
180
|
local hasPressurePlates = room:HasTriggerPressurePlates()
|
|
@@ -1,11 +1,4 @@
|
|
|
1
1
|
/// <reference types="typescript-to-lua/language-extensions" />
|
|
2
|
-
/**
|
|
3
|
-
* Converts a Lua table to a JSON string.
|
|
4
|
-
* In most cases, this function will be used for writing data to a "save#.dat" file.
|
|
5
|
-
* If encoding fails, it will throw an error to prevent writing a blank string or corrupted data to
|
|
6
|
-
* a user's "save#.dat" file.
|
|
7
|
-
*/
|
|
8
|
-
export declare function jsonEncode(table: unknown): string;
|
|
9
2
|
/**
|
|
10
3
|
* Converts a JSON string to a Lua table.
|
|
11
4
|
* In most cases, this function will be used for reading data from a "save#.dat" file.
|
|
@@ -14,3 +7,10 @@ export declare function jsonEncode(table: unknown): string;
|
|
|
14
7
|
* manually removed their existing save data.)
|
|
15
8
|
*/
|
|
16
9
|
export declare function jsonDecode(jsonString: string): LuaTable;
|
|
10
|
+
/**
|
|
11
|
+
* Converts a Lua table to a JSON string.
|
|
12
|
+
* In most cases, this function will be used for writing data to a "save#.dat" file.
|
|
13
|
+
* If encoding fails, it will throw an error to prevent writing a blank string or corrupted data to
|
|
14
|
+
* a user's "save#.dat" file.
|
|
15
|
+
*/
|
|
16
|
+
export declare function jsonEncode(table: unknown): string;
|
|
@@ -1,21 +1,13 @@
|
|
|
1
1
|
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
2
|
local ____exports = {}
|
|
3
|
-
local tryEncode, tryDecode
|
|
4
3
|
local json = require("@NoResolution:json")
|
|
5
4
|
local ____log = require("functions.log")
|
|
6
5
|
local log = ____log.log
|
|
7
|
-
function
|
|
8
|
-
return json.encode(____table)
|
|
9
|
-
end
|
|
10
|
-
function tryDecode(jsonString)
|
|
6
|
+
local function tryDecode(jsonString)
|
|
11
7
|
return json.decode(jsonString)
|
|
12
8
|
end
|
|
13
|
-
function
|
|
14
|
-
|
|
15
|
-
if not ok then
|
|
16
|
-
error("Failed to convert the Lua table to JSON: " .. jsonStringOrErrMsg)
|
|
17
|
-
end
|
|
18
|
-
return jsonStringOrErrMsg
|
|
9
|
+
local function tryEncode(____table)
|
|
10
|
+
return json.encode(____table)
|
|
19
11
|
end
|
|
20
12
|
function ____exports.jsonDecode(self, jsonString)
|
|
21
13
|
local ok, luaTableOrErrMsg = pcall(tryDecode, jsonString)
|
|
@@ -25,4 +17,11 @@ function ____exports.jsonDecode(self, jsonString)
|
|
|
25
17
|
end
|
|
26
18
|
return luaTableOrErrMsg
|
|
27
19
|
end
|
|
20
|
+
function ____exports.jsonEncode(self, ____table)
|
|
21
|
+
local ok, jsonStringOrErrMsg = pcall(tryEncode, ____table)
|
|
22
|
+
if not ok then
|
|
23
|
+
error("Failed to convert the Lua table to JSON: " .. jsonStringOrErrMsg)
|
|
24
|
+
end
|
|
25
|
+
return jsonStringOrErrMsg
|
|
26
|
+
end
|
|
28
27
|
return ____exports
|
package/dist/functions/log.d.ts
CHANGED
|
@@ -10,44 +10,44 @@ export declare function getDebugPrependString(msg: string, numParentFunctions?:
|
|
|
10
10
|
* and the line number before the string.
|
|
11
11
|
*/
|
|
12
12
|
export declare function log(this: void, msg: string): void;
|
|
13
|
+
export declare function logArray<T>(this: void, array: T[]): void;
|
|
14
|
+
export declare function logColor(this: void, color: Color): void;
|
|
13
15
|
/** Helper function for printing out every damage flag that is turned on. Useful when debugging. */
|
|
14
|
-
export declare function
|
|
16
|
+
export declare function logDamageFlags(this: void, flags: int): void;
|
|
17
|
+
export declare function logEntities(this: void, includeBackgroundEffects: boolean, entityTypeFilter?: EntityType | int): void;
|
|
18
|
+
export declare function logEntity(this: void, entity: Entity): void;
|
|
15
19
|
/** Helper function for printing out every entity flag that is turned on. Useful when debugging. */
|
|
16
|
-
export declare function
|
|
20
|
+
export declare function logEntityFlags(this: void, flags: int): void;
|
|
17
21
|
/** Helper function for printing out every flag that is turned on. Useful when debugging. */
|
|
18
|
-
export declare function
|
|
22
|
+
export declare function logFlags(this: void, flags: int, flagEnum?: LuaTable, description?: string): void;
|
|
19
23
|
/**
|
|
20
24
|
* Helper function for printing out every game state flag that is turned on. Useful when debugging.
|
|
21
25
|
*/
|
|
22
|
-
export declare function
|
|
26
|
+
export declare function logGameStateFlags(this: void): void;
|
|
27
|
+
export declare function logGridEntities(this: void, includeWalls: boolean, gridEntityTypeFilter?: GridEntityType | int): void;
|
|
28
|
+
export declare function logKColor(this: void, kColor: KColor): void;
|
|
29
|
+
export declare function logMap(this: void, map: Map<AnyNotNil, unknown>): void;
|
|
30
|
+
export declare function logPlayerHealth(this: void, player: EntityPlayer): void;
|
|
23
31
|
/**
|
|
24
32
|
* Helper function for printing out every projectile flag that is turned on. Useful when debugging.
|
|
25
33
|
*/
|
|
26
|
-
export declare function
|
|
34
|
+
export declare function logProjectileFlags(this: void, flags: int): void;
|
|
35
|
+
/** Helper function for logging information about the current room. */
|
|
36
|
+
export declare function logRoom(this: void): void;
|
|
27
37
|
/**
|
|
28
38
|
* Helper function for printing out every seed effect (i.e. Easter Egg) that is turned on for the
|
|
29
39
|
* particular run.
|
|
30
40
|
*/
|
|
31
|
-
export declare function
|
|
32
|
-
|
|
33
|
-
export declare function logAllTearFlags(this: void, flags: int): void;
|
|
34
|
-
/** Helper function for printing out every use flag that is turned on. Useful when debugging. */
|
|
35
|
-
export declare function logAllUseFlags(this: void, _flags: int): void;
|
|
36
|
-
export declare function logArray<T>(this: void, array: T[]): void;
|
|
37
|
-
export declare function logColor(this: void, color: Color): void;
|
|
38
|
-
export declare function logEntity(this: void, entity: Entity): void;
|
|
39
|
-
export declare function logEntities(this: void, includeBackgroundEffects: boolean, entityTypeFilter?: EntityType | int): void;
|
|
40
|
-
export declare function logGridEntities(this: void, includeWalls: boolean, gridEntityTypeFilter?: GridEntityType | int): void;
|
|
41
|
-
export declare function logKColor(this: void, kColor: KColor): void;
|
|
42
|
-
export declare function logMap(this: void, map: Map<AnyNotNil, unknown>): void;
|
|
43
|
-
export declare function logPlayerHealth(this: void, player: EntityPlayer): void;
|
|
44
|
-
/** Helper function for logging information about the current room. */
|
|
45
|
-
export declare function logRoom(this: void): void;
|
|
41
|
+
export declare function logSeedEffects(this: void): void;
|
|
42
|
+
export declare function logSet(this: void, set: Set<AnyNotNil>): void;
|
|
46
43
|
/** Helper function for logging every sound effect that is currently playing. */
|
|
47
44
|
export declare function logSounds(this: void): void;
|
|
48
45
|
export declare function logTable(this: void, table: unknown, parentTables?: number): void;
|
|
46
|
+
/** Helper function for printing out every tear flag that is turned on. Useful when debugging. */
|
|
47
|
+
export declare function logTearFlags(this: void, flags: int): void;
|
|
49
48
|
export declare function logTemporaryEffects(this: void, player: EntityPlayer): void;
|
|
50
|
-
|
|
49
|
+
/** Helper function for printing out every use flag that is turned on. Useful when debugging. */
|
|
50
|
+
export declare function logUseFlags(this: void, _flags: int): void;
|
|
51
51
|
export declare function logVector(this: void, vector: Vector): void;
|
|
52
52
|
/**
|
|
53
53
|
* Converts every `isaacscript-common` function that begins with "log" to a global function.
|
package/dist/functions/log.lua
CHANGED
|
@@ -28,10 +28,10 @@ local getEffectsList = ____player.getEffectsList
|
|
|
28
28
|
local getPlayerName = ____player.getPlayerName
|
|
29
29
|
local ____playerHealth = require("functions.playerHealth")
|
|
30
30
|
local getPlayerHealth = ____playerHealth.getPlayerHealth
|
|
31
|
-
local
|
|
32
|
-
local getRoomData =
|
|
33
|
-
local getRoomGridIndex =
|
|
34
|
-
local getRoomListIndex =
|
|
31
|
+
local ____roomData = require("functions.roomData")
|
|
32
|
+
local getRoomData = ____roomData.getRoomData
|
|
33
|
+
local getRoomGridIndex = ____roomData.getRoomGridIndex
|
|
34
|
+
local getRoomListIndex = ____roomData.getRoomListIndex
|
|
35
35
|
local ____set = require("functions.set")
|
|
36
36
|
local getSortedSetValues = ____set.getSortedSetValues
|
|
37
37
|
local ____trinkets = require("functions.trinkets")
|
|
@@ -55,7 +55,7 @@ function ____exports.log(msg)
|
|
|
55
55
|
local debugMsg = ____exports.getDebugPrependString(nil, msg)
|
|
56
56
|
Isaac.DebugString(debugMsg)
|
|
57
57
|
end
|
|
58
|
-
function ____exports.
|
|
58
|
+
function ____exports.logFlags(flags, flagEnum, description)
|
|
59
59
|
if description == nil then
|
|
60
60
|
description = ""
|
|
61
61
|
end
|
|
@@ -72,19 +72,19 @@ function ____exports.logAllFlags(flags, flagEnum, description)
|
|
|
72
72
|
end
|
|
73
73
|
end
|
|
74
74
|
end
|
|
75
|
-
____exports.log(((("Logging
|
|
75
|
+
____exports.log(((("Logging " .. description) .. "flags for value ") .. tostring(flags)) .. ":")
|
|
76
76
|
local hasNoFlags = true
|
|
77
77
|
for key, value in pairs(flagEnum) do
|
|
78
78
|
do
|
|
79
79
|
if type(value) ~= "number" then
|
|
80
|
-
goto
|
|
80
|
+
goto __continue34
|
|
81
81
|
end
|
|
82
82
|
if hasFlag(nil, flags, value) then
|
|
83
83
|
____exports.log((((" Has flag: " .. tostring(key)) .. " (") .. tostring(value)) .. ")")
|
|
84
84
|
hasNoFlags = false
|
|
85
85
|
end
|
|
86
86
|
end
|
|
87
|
-
::
|
|
87
|
+
::__continue34::
|
|
88
88
|
end
|
|
89
89
|
if hasNoFlags then
|
|
90
90
|
____exports.log(" n/a (no flags)")
|
|
@@ -101,51 +101,6 @@ local IGNORE_EFFECT_VARIANTS = __TS__New(Set, {
|
|
|
101
101
|
EffectVariant.LIGHT,
|
|
102
102
|
EffectVariant.TADPOLE
|
|
103
103
|
})
|
|
104
|
-
function ____exports.logAllDamageFlags(flags)
|
|
105
|
-
____exports.logAllFlags(flags, DamageFlag, "damage")
|
|
106
|
-
end
|
|
107
|
-
function ____exports.logAllEntityFlags(flags)
|
|
108
|
-
____exports.logAllFlags(flags, EntityFlag, "entity")
|
|
109
|
-
end
|
|
110
|
-
function ____exports.logAllGameStateFlags()
|
|
111
|
-
____exports.log("Logging all game state flags:")
|
|
112
|
-
local hasNoFlags = true
|
|
113
|
-
for key, value in pairs(GameStateFlag) do
|
|
114
|
-
local gameStateFlag = value
|
|
115
|
-
local flagValue = game:GetStateFlag(gameStateFlag)
|
|
116
|
-
if flagValue then
|
|
117
|
-
____exports.log((((" Has flag: " .. key) .. " (") .. tostring(value)) .. ")")
|
|
118
|
-
hasNoFlags = false
|
|
119
|
-
end
|
|
120
|
-
end
|
|
121
|
-
if hasNoFlags then
|
|
122
|
-
____exports.log(" n/a (no flags)")
|
|
123
|
-
end
|
|
124
|
-
end
|
|
125
|
-
function ____exports.logAllProjectileFlags(flags)
|
|
126
|
-
____exports.logAllFlags(flags, ProjectileFlags, "projectile")
|
|
127
|
-
end
|
|
128
|
-
function ____exports.logAllSeedEffects()
|
|
129
|
-
local seeds = game:GetSeeds()
|
|
130
|
-
____exports.log("Logging all seed effects:")
|
|
131
|
-
local hasNoSeedEffects = true
|
|
132
|
-
for key, value in pairs(SeedEffect) do
|
|
133
|
-
local seedEffect = value
|
|
134
|
-
if seeds:HasSeedEffect(seedEffect) then
|
|
135
|
-
____exports.log((((" " .. key) .. " (") .. tostring(value)) .. ")")
|
|
136
|
-
hasNoSeedEffects = false
|
|
137
|
-
end
|
|
138
|
-
end
|
|
139
|
-
if hasNoSeedEffects then
|
|
140
|
-
____exports.log(" n/a (no seed effects)")
|
|
141
|
-
end
|
|
142
|
-
end
|
|
143
|
-
function ____exports.logAllTearFlags(flags)
|
|
144
|
-
____exports.logAllFlags(flags, TearFlags, "tear")
|
|
145
|
-
end
|
|
146
|
-
function ____exports.logAllUseFlags(_flags)
|
|
147
|
-
____exports.log("The \"logAllUseFlags\" helper function is temporarily disabled while the UseFlag enum remains unpatched in vanilla.")
|
|
148
|
-
end
|
|
149
104
|
function ____exports.logArray(array)
|
|
150
105
|
local arrayString = arrayToString(nil, array)
|
|
151
106
|
____exports.log("Array: " .. arrayString)
|
|
@@ -153,8 +108,8 @@ end
|
|
|
153
108
|
function ____exports.logColor(color)
|
|
154
109
|
____exports.log((((((((((((("Color: R" .. tostring(color.R)) .. ", G") .. tostring(color.G)) .. ", B") .. tostring(color.B)) .. ", A") .. tostring(color.A)) .. ", RO") .. tostring(color.RO)) .. ", BO") .. tostring(color.BO)) .. ", GO") .. tostring(color.GO))
|
|
155
110
|
end
|
|
156
|
-
function ____exports.
|
|
157
|
-
____exports.
|
|
111
|
+
function ____exports.logDamageFlags(flags)
|
|
112
|
+
____exports.logFlags(flags, DamageFlag, "damage")
|
|
158
113
|
end
|
|
159
114
|
function ____exports.logEntities(includeBackgroundEffects, entityTypeFilter)
|
|
160
115
|
local headerMsg = "Entities in the room"
|
|
@@ -234,6 +189,27 @@ function ____exports.logEntities(includeBackgroundEffects, entityTypeFilter)
|
|
|
234
189
|
____exports.log(("(" .. tostring(numMatchedEntities)) .. " total entities)")
|
|
235
190
|
end
|
|
236
191
|
end
|
|
192
|
+
function ____exports.logEntity(entity)
|
|
193
|
+
____exports.log((((("Entity: " .. tostring(entity.Type)) .. ".") .. tostring(entity.Variant)) .. ".") .. tostring(entity.SubType))
|
|
194
|
+
end
|
|
195
|
+
function ____exports.logEntityFlags(flags)
|
|
196
|
+
____exports.logFlags(flags, EntityFlag, "entity")
|
|
197
|
+
end
|
|
198
|
+
function ____exports.logGameStateFlags()
|
|
199
|
+
____exports.log("Logging game state flags:")
|
|
200
|
+
local hasNoFlags = true
|
|
201
|
+
for key, value in pairs(GameStateFlag) do
|
|
202
|
+
local gameStateFlag = value
|
|
203
|
+
local flagValue = game:GetStateFlag(gameStateFlag)
|
|
204
|
+
if flagValue then
|
|
205
|
+
____exports.log((((" Has flag: " .. key) .. " (") .. tostring(value)) .. ")")
|
|
206
|
+
hasNoFlags = false
|
|
207
|
+
end
|
|
208
|
+
end
|
|
209
|
+
if hasNoFlags then
|
|
210
|
+
____exports.log(" n/a (no flags)")
|
|
211
|
+
end
|
|
212
|
+
end
|
|
237
213
|
function ____exports.logGridEntities(includeWalls, gridEntityTypeFilter)
|
|
238
214
|
local headerMsg = "Grid entities in the room"
|
|
239
215
|
if gridEntityTypeFilter ~= nil then
|
|
@@ -329,6 +305,9 @@ function ____exports.logPlayerHealth(player)
|
|
|
329
305
|
____exports.log(" Blood charges: " .. tostring(playerHealth.bloodCharges))
|
|
330
306
|
____exports.log((" Soul heart types: [" .. table.concat(playerHealth.soulHeartTypes, "," or ",")) .. "]")
|
|
331
307
|
end
|
|
308
|
+
function ____exports.logProjectileFlags(flags)
|
|
309
|
+
____exports.logFlags(flags, ProjectileFlags, "projectile")
|
|
310
|
+
end
|
|
332
311
|
function ____exports.logRoom()
|
|
333
312
|
local roomGridIndex = getRoomGridIndex(nil)
|
|
334
313
|
local roomListIndex = getRoomListIndex(nil)
|
|
@@ -343,6 +322,29 @@ function ____exports.logRoom()
|
|
|
343
322
|
____exports.log("Current room grid index: " .. tostring(roomGridIndex))
|
|
344
323
|
____exports.log("Current room list index: " .. tostring(roomListIndex))
|
|
345
324
|
end
|
|
325
|
+
function ____exports.logSeedEffects()
|
|
326
|
+
local seeds = game:GetSeeds()
|
|
327
|
+
____exports.log("Logging seed effects:")
|
|
328
|
+
local hasNoSeedEffects = true
|
|
329
|
+
for key, value in pairs(SeedEffect) do
|
|
330
|
+
local seedEffect = value
|
|
331
|
+
if seeds:HasSeedEffect(seedEffect) then
|
|
332
|
+
____exports.log((((" " .. key) .. " (") .. tostring(value)) .. ")")
|
|
333
|
+
hasNoSeedEffects = false
|
|
334
|
+
end
|
|
335
|
+
end
|
|
336
|
+
if hasNoSeedEffects then
|
|
337
|
+
____exports.log(" n/a (no seed effects)")
|
|
338
|
+
end
|
|
339
|
+
end
|
|
340
|
+
function ____exports.logSet(set)
|
|
341
|
+
____exports.log("Printing out a TSTL Set:")
|
|
342
|
+
local setValues = getSortedSetValues(nil, set)
|
|
343
|
+
for ____, value in ipairs(setValues) do
|
|
344
|
+
____exports.log(" Value: " .. tostring(value))
|
|
345
|
+
end
|
|
346
|
+
____exports.log("The size of the set was: " .. tostring(set.size))
|
|
347
|
+
end
|
|
346
348
|
function ____exports.logSounds()
|
|
347
349
|
for ____, soundEffect in ipairs(range(nil, 0, SoundEffect.NUM_SOUND_EFFECTS - 1)) do
|
|
348
350
|
if sfxManager:IsPlaying(soundEffect) then
|
|
@@ -377,9 +379,12 @@ function ____exports.logTable(____table, parentTables)
|
|
|
377
379
|
end
|
|
378
380
|
____exports.log("The size of the table was: " .. tostring(numKeys))
|
|
379
381
|
end
|
|
382
|
+
function ____exports.logTearFlags(flags)
|
|
383
|
+
____exports.logFlags(flags, TearFlags, "tear")
|
|
384
|
+
end
|
|
380
385
|
function ____exports.logTemporaryEffects(player)
|
|
381
386
|
local effects = getEffectsList(nil, player)
|
|
382
|
-
____exports.log("Logging
|
|
387
|
+
____exports.log("Logging player temporary effects:")
|
|
383
388
|
if #effects == 0 then
|
|
384
389
|
____exports.log(" n/a (no temporary effects)")
|
|
385
390
|
return
|
|
@@ -401,13 +406,8 @@ function ____exports.logTemporaryEffects(player)
|
|
|
401
406
|
end
|
|
402
407
|
)
|
|
403
408
|
end
|
|
404
|
-
function ____exports.
|
|
405
|
-
____exports.log("
|
|
406
|
-
local setValues = getSortedSetValues(nil, set)
|
|
407
|
-
for ____, value in ipairs(setValues) do
|
|
408
|
-
____exports.log(" Value: " .. tostring(value))
|
|
409
|
-
end
|
|
410
|
-
____exports.log("The size of the set was: " .. tostring(set.size))
|
|
409
|
+
function ____exports.logUseFlags(_flags)
|
|
410
|
+
____exports.log("The \"logUseFlags\" helper function is temporarily disabled while the UseFlag enum remains unpatched in vanilla.")
|
|
411
411
|
end
|
|
412
412
|
function ____exports.logVector(vector)
|
|
413
413
|
____exports.log(((("Vector: (" .. tostring(vector.X)) .. ", ") .. tostring(vector.Y)) .. ")")
|
|
@@ -415,26 +415,27 @@ end
|
|
|
415
415
|
function ____exports.setLogFunctionsGlobal(self)
|
|
416
416
|
local globals = _G
|
|
417
417
|
globals.log = ____exports.log
|
|
418
|
-
globals.logAllDamageFlags = ____exports.logAllDamageFlags
|
|
419
|
-
globals.logAllEntityFlags = ____exports.logAllEntityFlags
|
|
420
|
-
globals.logAllFlags = ____exports.logAllFlags
|
|
421
|
-
globals.logAllGameStateFlags = ____exports.logAllGameStateFlags
|
|
422
|
-
globals.logAllProjectileFlags = ____exports.logAllProjectileFlags
|
|
423
|
-
globals.logAllSeedEffects = ____exports.logAllSeedEffects
|
|
424
|
-
globals.logAllTearFlags = ____exports.logAllTearFlags
|
|
425
|
-
globals.logAllUseFlags = ____exports.logAllUseFlags
|
|
426
418
|
globals.logArray = ____exports.logArray
|
|
427
419
|
globals.logColor = ____exports.logColor
|
|
428
|
-
globals.
|
|
420
|
+
globals.logDamageFlags = ____exports.logDamageFlags
|
|
429
421
|
globals.logEntities = ____exports.logEntities
|
|
422
|
+
globals.logEntity = ____exports.logEntity
|
|
423
|
+
globals.logEntityFlags = ____exports.logEntityFlags
|
|
424
|
+
globals.logFlags = ____exports.logFlags
|
|
425
|
+
globals.logGameStateFlags = ____exports.logGameStateFlags
|
|
430
426
|
globals.logGridEntities = ____exports.logGridEntities
|
|
431
427
|
globals.logKColor = ____exports.logKColor
|
|
432
428
|
globals.logMap = ____exports.logMap
|
|
429
|
+
globals.logPlayerHealth = ____exports.logPlayerHealth
|
|
430
|
+
globals.logProjectileFlags = ____exports.logProjectileFlags
|
|
433
431
|
globals.logRoom = ____exports.logRoom
|
|
434
|
-
globals.
|
|
435
|
-
globals.logTemporaryEffects = ____exports.logTemporaryEffects
|
|
432
|
+
globals.logSeedEffects = ____exports.logSeedEffects
|
|
436
433
|
globals.logSet = ____exports.logSet
|
|
437
434
|
globals.logSounds = ____exports.logSounds
|
|
435
|
+
globals.logTable = ____exports.logTable
|
|
436
|
+
globals.logTearFlags = ____exports.logTearFlags
|
|
437
|
+
globals.logTemporaryEffects = ____exports.logTemporaryEffects
|
|
438
|
+
globals.logUseFlags = ____exports.logUseFlags
|
|
438
439
|
globals.logVector = ____exports.logVector
|
|
439
440
|
end
|
|
440
441
|
return ____exports
|
package/dist/functions/math.d.ts
CHANGED
|
@@ -36,8 +36,8 @@ export declare function range(start: int, end: int): int[];
|
|
|
36
36
|
* @param numDecimalPlaces Default is 0.
|
|
37
37
|
*/
|
|
38
38
|
export declare function round(num: float, numDecimalPlaces?: number): float;
|
|
39
|
-
export declare function tanh(x: number): number;
|
|
40
39
|
/**
|
|
41
40
|
* @returns 1 if n is positive, -1 if n is negative, or 0 if n is 0.
|
|
42
41
|
*/
|
|
43
42
|
export declare function sign(n: number): int;
|
|
43
|
+
export declare function tanh(x: number): number;
|
package/dist/functions/math.lua
CHANGED
|
@@ -83,9 +83,6 @@ function ____exports.round(self, num, numDecimalPlaces)
|
|
|
83
83
|
))
|
|
84
84
|
return roundedNum == nil and 0 or roundedNum
|
|
85
85
|
end
|
|
86
|
-
function ____exports.tanh(self, x)
|
|
87
|
-
return (math.exp(x) - math.exp(-x)) / (math.exp(x) + math.exp(-x))
|
|
88
|
-
end
|
|
89
86
|
function ____exports.sign(self, n)
|
|
90
87
|
if n > 0 then
|
|
91
88
|
return 1
|
|
@@ -95,4 +92,7 @@ function ____exports.sign(self, n)
|
|
|
95
92
|
end
|
|
96
93
|
return 0
|
|
97
94
|
end
|
|
95
|
+
function ____exports.tanh(self, x)
|
|
96
|
+
return (math.exp(x) - math.exp(-x)) / (math.exp(x) + math.exp(-x))
|
|
97
|
+
end
|
|
98
98
|
return ____exports
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
2
|
local ____exports = {}
|
|
3
|
-
local oldTableHasUpdatedValue, newTableHasSameValue, oldTableHasUpdatedValueFromNull, oldTableHasFilledInterface
|
|
3
|
+
local oldTableHasUpdatedValue, newTableHasSameValue, oldTableHasUpdatedValueFromNull, oldTableHasFilledInterface, oldTableHasVector, oldTableHasVectorSerialized
|
|
4
|
+
local ____SerializationType = require("enums.SerializationType")
|
|
5
|
+
local SerializationType = ____SerializationType.SerializationType
|
|
4
6
|
local ____merge = require("features.saveDataManager.merge")
|
|
5
7
|
local merge = ____merge.merge
|
|
8
|
+
local ____deepCopy = require("functions.deepCopy")
|
|
9
|
+
local deepCopy = ____deepCopy.deepCopy
|
|
6
10
|
local ____log = require("functions.log")
|
|
7
11
|
local log = ____log.log
|
|
12
|
+
local ____vector = require("functions.vector")
|
|
13
|
+
local isVector = ____vector.isVector
|
|
8
14
|
function oldTableHasUpdatedValue(self)
|
|
9
15
|
local key = "foo"
|
|
10
16
|
local oldValue = "bar"
|
|
@@ -55,11 +61,60 @@ function oldTableHasFilledInterface(self)
|
|
|
55
61
|
error("The old table's key of \"bar\" was not filled.")
|
|
56
62
|
end
|
|
57
63
|
end
|
|
64
|
+
function oldTableHasVector(self)
|
|
65
|
+
local key = "foo"
|
|
66
|
+
local x = 50
|
|
67
|
+
local y = 60
|
|
68
|
+
local newValue = Vector(x, y)
|
|
69
|
+
local oldTable = {foo = nil}
|
|
70
|
+
local foo = {bar = newValue}
|
|
71
|
+
local newTable = {foo = foo}
|
|
72
|
+
merge(nil, oldTable, newTable, "oldTableHasVector")
|
|
73
|
+
local oldTableValue = oldTable[key]
|
|
74
|
+
if oldTableValue == nil then
|
|
75
|
+
error(("The old table's key of \"" .. key) .. "\" was not filled.")
|
|
76
|
+
end
|
|
77
|
+
if oldTableValue.bar.X ~= x then
|
|
78
|
+
error("The old table's value for \"x\" does not match: " .. tostring(x))
|
|
79
|
+
end
|
|
80
|
+
if oldTableValue.bar.Y ~= y then
|
|
81
|
+
error("The old table's value for \"y\" does not match: " .. tostring(y))
|
|
82
|
+
end
|
|
83
|
+
if not isVector(nil, oldTableValue.bar) then
|
|
84
|
+
error("The old table's value is not a Vector object.")
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
function oldTableHasVectorSerialized(self)
|
|
88
|
+
local key = "foo"
|
|
89
|
+
local x = 50
|
|
90
|
+
local y = 60
|
|
91
|
+
local newValue = Vector(x, y)
|
|
92
|
+
local oldTable = {foo = nil}
|
|
93
|
+
local foo = {bar = newValue}
|
|
94
|
+
local newTable = {foo = foo}
|
|
95
|
+
local newTableSerialized = deepCopy(nil, newTable, SerializationType.SERIALIZE)
|
|
96
|
+
merge(nil, oldTable, newTableSerialized, "oldTableHasVectorSerialized")
|
|
97
|
+
local oldTableValue = oldTable[key]
|
|
98
|
+
if oldTableValue == nil then
|
|
99
|
+
error(("The old table's key of \"" .. key) .. "\" was not filled.")
|
|
100
|
+
end
|
|
101
|
+
if oldTableValue.bar.X ~= x then
|
|
102
|
+
error("The old table's value for \"x\" does not match: " .. tostring(x))
|
|
103
|
+
end
|
|
104
|
+
if oldTableValue.bar.Y ~= y then
|
|
105
|
+
error("The old table's value for \"y\" does not match: " .. tostring(y))
|
|
106
|
+
end
|
|
107
|
+
if not isVector(nil, oldTableValue.bar) then
|
|
108
|
+
error("The old table's value is not a Vector object.")
|
|
109
|
+
end
|
|
110
|
+
end
|
|
58
111
|
function ____exports.mergeTests(self)
|
|
59
112
|
oldTableHasUpdatedValue(nil)
|
|
60
113
|
newTableHasSameValue(nil)
|
|
61
114
|
oldTableHasUpdatedValueFromNull(nil)
|
|
62
115
|
oldTableHasFilledInterface(nil)
|
|
116
|
+
oldTableHasVector(nil)
|
|
117
|
+
oldTableHasVectorSerialized(nil)
|
|
63
118
|
log("All merge tests passed!")
|
|
64
119
|
end
|
|
65
120
|
return ____exports
|
|
@@ -3,8 +3,6 @@ import { HealthType } from "../enums/HealthType";
|
|
|
3
3
|
import { PlayerIndex } from "../types/PlayerIndex";
|
|
4
4
|
export declare function addCollectibleCostume(player: EntityPlayer, collectibleType: CollectibleType | int): void;
|
|
5
5
|
export declare function addTrinketCostume(player: EntityPlayer, trinketType: TrinketType | int): void;
|
|
6
|
-
/** Iterates over all players and checks if any player is close enough to the specified position. */
|
|
7
|
-
export declare function anyPlayerCloserThan(position: Vector, distance: float): boolean;
|
|
8
6
|
export declare function anyPlayerHasCollectible(collectibleType: CollectibleType | int): boolean;
|
|
9
7
|
export declare function anyPlayerHasTrinket(trinketType: TrinketType | int): boolean;
|
|
10
8
|
/**
|
|
@@ -24,6 +22,11 @@ export declare function anyPlayerIs(...matchingCharacters: Array<PlayerType | in
|
|
|
24
22
|
* - the player has Stompy (transformation 13)
|
|
25
23
|
*/
|
|
26
24
|
export declare function canPlayerCrushRocks(player: EntityPlayer): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Helper function for detecting when a player is one of the characters that can take free Devil
|
|
27
|
+
* Deals. (e.g. The Lost, Tainted Lost, etc.)
|
|
28
|
+
*/
|
|
29
|
+
export declare function canTakeFreeDevilDeals(player: EntityPlayer): boolean;
|
|
27
30
|
/**
|
|
28
31
|
* Helper function to determine if the provided character can have red heart containers. Returns
|
|
29
32
|
* true for characters like Isaac, Magdalene, or Cain. Returns true for Keeper and Tainted Keeper,
|
|
@@ -47,8 +50,8 @@ export declare function characterGetsBlackHeartFromEternalHeart(character: Playe
|
|
|
47
50
|
* Helper function to get every player with no restrictions, by using `Game.GetNumPlayers` and
|
|
48
51
|
* `Isaac.GetPlayer`.
|
|
49
52
|
*
|
|
50
|
-
* This function is almost never what you want to use. For most
|
|
51
|
-
*
|
|
53
|
+
* This function is almost never what you want to use. For most purposes, use the `getPlayers`
|
|
54
|
+
* helper function instead to get a filtered list of players.
|
|
52
55
|
*/
|
|
53
56
|
export declare function getAllPlayers(): EntityPlayer[];
|
|
54
57
|
/**
|
|
@@ -284,16 +287,11 @@ export declare function isJacobOrEsau(player: EntityPlayer): boolean;
|
|
|
284
287
|
export declare function isKeeper(player: EntityPlayer): boolean;
|
|
285
288
|
/** Helper function for detecting when a player is The Lost or Tainted Lost. */
|
|
286
289
|
export declare function isLost(player: EntityPlayer): boolean;
|
|
287
|
-
|
|
288
|
-
* Helper function for detecting when a player is one of the characters that can take free Devil
|
|
289
|
-
* Deals. (e.g. The Lost, Tainted Lost, etc.)
|
|
290
|
-
*/
|
|
291
|
-
export declare function canTakeFreeDevilDeals(player: EntityPlayer): boolean;
|
|
290
|
+
export declare function isModdedCharacter(player: EntityPlayer): boolean;
|
|
292
291
|
/** Helper function for detecting if a player is one of the Tainted characters. */
|
|
293
292
|
export declare function isTainted(player: EntityPlayer): boolean;
|
|
294
293
|
/** Helper function for detecting when a player is Tainted Lazarus or Dead Tainted Lazarus. */
|
|
295
294
|
export declare function isTaintedLazarus(player: EntityPlayer): boolean;
|
|
296
|
-
export declare function isModdedCharacter(player: EntityPlayer): boolean;
|
|
297
295
|
export declare function isVanillaCharacter(player: EntityPlayer): boolean;
|
|
298
296
|
/**
|
|
299
297
|
* Helper function to remove a collectible costume from a player. Use this helper function to avoid
|