isaacscript-common 1.2.136 → 1.2.139
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/postCustomDoorEnter.d.ts +8 -0
- package/dist/callbacks/postCustomDoorEnter.lua +35 -0
- package/dist/callbacks/postPlayerChangeHealth.lua +4 -64
- package/dist/callbacks/subscriptions/postCustomDoorEnter.d.ts +2 -0
- package/dist/callbacks/subscriptions/postCustomDoorEnter.lua +25 -0
- package/dist/constants.d.ts +7 -0
- package/dist/constants.lua +1 -0
- package/dist/features/deployJSONRoom.lua +11 -22
- package/dist/features/disableInputs.lua +6 -20
- package/dist/features/disableSound.lua +4 -12
- package/dist/features/extraConsoleCommands/commands.d.ts +334 -0
- package/dist/features/extraConsoleCommands/commands.lua +930 -0
- package/dist/features/extraConsoleCommands/init.d.ts +25 -0
- package/dist/features/extraConsoleCommands/init.lua +194 -0
- package/dist/features/extraConsoleCommands/v.d.ts +13 -0
- package/dist/features/extraConsoleCommands/v.lua +11 -0
- package/dist/features/forgottenSwitch.lua +3 -8
- package/dist/features/getCollectibleItemPoolType.lua +4 -9
- package/dist/features/isPonyActive.lua +3 -8
- package/dist/features/preventCollectibleRotate.lua +3 -8
- package/dist/features/runInNFrames.lua +6 -20
- package/dist/features/saveDataManager/constants.d.ts +3 -0
- package/dist/features/saveDataManager/constants.lua +5 -0
- package/dist/features/saveDataManager/exports.lua +9 -18
- package/dist/features/saveDataManager/load.lua +4 -3
- package/dist/features/saveDataManager/main.lua +4 -10
- package/dist/features/saveDataManager/merge.lua +2 -2
- package/dist/features/saveDataManager/save.lua +3 -1
- package/dist/features/sirenHelpers.lua +4 -8
- package/dist/featuresInitialized.d.ts +1 -1
- package/dist/featuresInitialized.lua +5 -0
- package/dist/functions/deepCopy.lua +2 -2
- package/dist/functions/log.d.ts +5 -1
- package/dist/functions/log.lua +175 -2
- package/dist/functions/map.d.ts +16 -0
- package/dist/functions/map.lua +24 -0
- package/dist/functions/player.d.ts +2 -2
- package/dist/functions/playerHealth.d.ts +3 -0
- package/dist/functions/playerHealth.lua +142 -0
- package/dist/functions/rooms.lua +4 -5
- package/dist/functions/run.d.ts +12 -0
- package/dist/functions/run.lua +25 -0
- package/dist/functions/utils.d.ts +0 -6
- package/dist/functions/utils.lua +0 -8
- package/dist/functions/vector.lua +8 -8
- package/dist/index.d.ts +8 -0
- package/dist/index.lua +62 -0
- package/dist/maps/cardMap.d.ts +3 -0
- package/dist/maps/cardMap.lua +202 -0
- package/dist/maps/characterMap.d.ts +3 -0
- package/dist/maps/characterMap.lua +90 -0
- package/dist/maps/pillEffectMap.d.ts +3 -0
- package/dist/maps/pillEffectMap.lua +88 -0
- package/dist/maps/roomTypeMap.d.ts +3 -0
- package/dist/maps/roomTypeMap.lua +43 -0
- package/dist/maps/roomTypeNameMap.d.ts +2 -0
- package/dist/maps/roomTypeNameMap.lua +38 -0
- package/dist/types/CallbackParametersCustom.d.ts +4 -0
- package/dist/types/HealthType.d.ts +4 -2
- package/dist/types/HealthType.lua +3 -1
- package/dist/types/ModCallbacksCustom.d.ts +2 -1
- package/dist/types/ModCallbacksCustom.lua +2 -0
- package/dist/types/ModUpgraded.lua +8 -0
- package/dist/types/PlayerIndex.d.ts +2 -2
- package/dist/upgradeMod.lua +3 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export declare function errorIfFeaturesNotInitialized(featureName: string): void;
|
|
@@ -7,4 +7,9 @@ end
|
|
|
7
7
|
function ____exports.setFeaturesInitialized(self)
|
|
8
8
|
featuresInitialized = true
|
|
9
9
|
end
|
|
10
|
+
function ____exports.errorIfFeaturesNotInitialized(self, featureName)
|
|
11
|
+
if not ____exports.areFeaturesInitialized(nil) then
|
|
12
|
+
error(("The " .. featureName) .. " is not initialized. You must first upgrade your mod object by calling the \"upgradeMod\" function.")
|
|
13
|
+
end
|
|
14
|
+
end
|
|
10
15
|
return ____exports
|
|
@@ -7,8 +7,8 @@ local __TS__InstanceOf = ____lualib.__TS__InstanceOf
|
|
|
7
7
|
local __TS__Iterator = ____lualib.__TS__Iterator
|
|
8
8
|
local ____exports = {}
|
|
9
9
|
local isTSTLClass, copyClass, getNewClassFromMetatable, deepCopyValue, copyVector, checkMetatable, validateValue, TSTL_CLASS_KEYS
|
|
10
|
-
local
|
|
11
|
-
local SAVE_DATA_MANAGER_DEBUG =
|
|
10
|
+
local ____constants = require("features.saveDataManager.constants")
|
|
11
|
+
local SAVE_DATA_MANAGER_DEBUG = ____constants.SAVE_DATA_MANAGER_DEBUG
|
|
12
12
|
local ____DefaultMap = require("types.DefaultMap")
|
|
13
13
|
local DefaultMap = ____DefaultMap.DefaultMap
|
|
14
14
|
local ____SerializationBrand = require("types.private.SerializationBrand")
|
package/dist/functions/log.d.ts
CHANGED
|
@@ -36,11 +36,15 @@ export declare function logAllUseFlags(this: void, _flags: int): void;
|
|
|
36
36
|
export declare function logArray<T>(this: void, array: T[]): void;
|
|
37
37
|
export declare function logColor(this: void, color: Color): void;
|
|
38
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;
|
|
39
41
|
export declare function logKColor(this: void, kColor: KColor): void;
|
|
40
42
|
export declare function logMap(this: void, map: Map<AnyNotNil, unknown>): void;
|
|
41
43
|
export declare function logPlayerHealth(this: void, player: EntityPlayer): void;
|
|
42
|
-
/** Helper function for
|
|
44
|
+
/** Helper function for logging information about the current room. */
|
|
43
45
|
export declare function logRoom(this: void): void;
|
|
46
|
+
/** Helper function for logging every sound effect that is currently playing. */
|
|
47
|
+
export declare function logSounds(this: void): void;
|
|
44
48
|
export declare function logTable(this: void, table: unknown, parentTables?: number): void;
|
|
45
49
|
export declare function logTemporaryEffects(this: void, player: EntityPlayer): void;
|
|
46
50
|
export declare function logSet(this: void, set: Set<AnyNotNil>): void;
|
package/dist/functions/log.lua
CHANGED
|
@@ -1,19 +1,28 @@
|
|
|
1
1
|
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
2
|
local ____lualib = require("lualib_bundle")
|
|
3
|
+
local Set = ____lualib.Set
|
|
4
|
+
local __TS__New = ____lualib.__TS__New
|
|
5
|
+
local __TS__ArrayForEach = ____lualib.__TS__ArrayForEach
|
|
3
6
|
local Map = ____lualib.Map
|
|
4
7
|
local __TS__Spread = ____lualib.__TS__Spread
|
|
5
8
|
local __TS__ArraySort = ____lualib.__TS__ArraySort
|
|
6
|
-
local __TS__ArrayForEach = ____lualib.__TS__ArrayForEach
|
|
7
|
-
local Set = ____lualib.Set
|
|
8
9
|
local ____exports = {}
|
|
9
10
|
local ____cachedClasses = require("cachedClasses")
|
|
10
11
|
local game = ____cachedClasses.game
|
|
12
|
+
local sfxManager = ____cachedClasses.sfxManager
|
|
11
13
|
local ____array = require("functions.array")
|
|
12
14
|
local arrayToString = ____array.arrayToString
|
|
13
15
|
local ____collectibles = require("functions.collectibles")
|
|
14
16
|
local getCollectibleName = ____collectibles.getCollectibleName
|
|
17
|
+
local ____entity = require("functions.entity")
|
|
18
|
+
local getEntities = ____entity.getEntities
|
|
19
|
+
local getEntityID = ____entity.getEntityID
|
|
15
20
|
local ____flag = require("functions.flag")
|
|
16
21
|
local hasFlag = ____flag.hasFlag
|
|
22
|
+
local ____gridEntity = require("functions.gridEntity")
|
|
23
|
+
local getGridEntities = ____gridEntity.getGridEntities
|
|
24
|
+
local ____math = require("functions.math")
|
|
25
|
+
local range = ____math.range
|
|
17
26
|
local ____player = require("functions.player")
|
|
18
27
|
local getEffectsList = ____player.getEffectsList
|
|
19
28
|
local getPlayerName = ____player.getPlayerName
|
|
@@ -65,6 +74,17 @@ function ____exports.logAllFlags(flags, flagEnum, description)
|
|
|
65
74
|
____exports.log(" n/a (no flags)")
|
|
66
75
|
end
|
|
67
76
|
end
|
|
77
|
+
local IGNORE_EFFECT_VARIANTS = __TS__New(Set, {
|
|
78
|
+
EffectVariant.BLOOD_EXPLOSION,
|
|
79
|
+
EffectVariant.BLOOD_PARTICLE,
|
|
80
|
+
EffectVariant.TINY_BUG,
|
|
81
|
+
EffectVariant.TINY_FLY,
|
|
82
|
+
EffectVariant.WATER_DROPLET,
|
|
83
|
+
EffectVariant.WALL_BUG,
|
|
84
|
+
EffectVariant.FALLING_EMBER,
|
|
85
|
+
EffectVariant.LIGHT,
|
|
86
|
+
EffectVariant.TADPOLE
|
|
87
|
+
})
|
|
68
88
|
function ____exports.logAllDamageFlags(flags)
|
|
69
89
|
____exports.logAllFlags(flags, DamageFlag, "damage")
|
|
70
90
|
end
|
|
@@ -120,6 +140,146 @@ end
|
|
|
120
140
|
function ____exports.logEntity(entity)
|
|
121
141
|
____exports.log((((("Entity: " .. tostring(entity.Type)) .. ".") .. tostring(entity.Variant)) .. ".") .. tostring(entity.SubType))
|
|
122
142
|
end
|
|
143
|
+
function ____exports.logEntities(includeBackgroundEffects, entityTypeFilter)
|
|
144
|
+
local headerMsg = "Entities in the room"
|
|
145
|
+
if entityTypeFilter ~= nil then
|
|
146
|
+
headerMsg = headerMsg .. (" (filtered to entity type " .. tostring(entityTypeFilter)) .. ")"
|
|
147
|
+
end
|
|
148
|
+
if not includeBackgroundEffects then
|
|
149
|
+
headerMsg = headerMsg .. " (not excluding background effects)"
|
|
150
|
+
end
|
|
151
|
+
headerMsg = headerMsg .. ":"
|
|
152
|
+
____exports.log(headerMsg)
|
|
153
|
+
local entities = getEntities(nil)
|
|
154
|
+
local numMatchedEntities = 0
|
|
155
|
+
__TS__ArrayForEach(
|
|
156
|
+
entities,
|
|
157
|
+
function(____, entity, i)
|
|
158
|
+
if entityTypeFilter ~= nil and entity.Type ~= entityTypeFilter then
|
|
159
|
+
return
|
|
160
|
+
end
|
|
161
|
+
if not includeBackgroundEffects and entity.Type == EntityType.ENTITY_EFFECT and IGNORE_EFFECT_VARIANTS:has(entity.Variant) then
|
|
162
|
+
return
|
|
163
|
+
end
|
|
164
|
+
local entityID = getEntityID(nil, entity)
|
|
165
|
+
local debugString = (tostring(i + 1) .. " - ") .. entityID
|
|
166
|
+
local bomb = entity:ToBomb()
|
|
167
|
+
if bomb ~= nil then
|
|
168
|
+
debugString = debugString .. " (bomb)"
|
|
169
|
+
end
|
|
170
|
+
local effect = entity:ToEffect()
|
|
171
|
+
if effect ~= nil then
|
|
172
|
+
debugString = debugString .. ("." .. tostring(effect.State)) .. " (effect)"
|
|
173
|
+
end
|
|
174
|
+
local familiar = entity:ToFamiliar()
|
|
175
|
+
if familiar ~= nil then
|
|
176
|
+
debugString = debugString .. ("." .. tostring(familiar.State)) .. " (familiar)"
|
|
177
|
+
end
|
|
178
|
+
local knife = entity:ToKnife()
|
|
179
|
+
if knife ~= nil then
|
|
180
|
+
debugString = debugString .. " (knife)"
|
|
181
|
+
end
|
|
182
|
+
local laser = entity:ToLaser()
|
|
183
|
+
if laser ~= nil then
|
|
184
|
+
debugString = debugString .. " (laser)"
|
|
185
|
+
end
|
|
186
|
+
local npc = entity:ToNPC()
|
|
187
|
+
if npc ~= nil then
|
|
188
|
+
debugString = debugString .. ((("." .. tostring(npc.State)) .. " (NPC) (CanShutDoors: ") .. tostring(npc.CanShutDoors)) .. ")"
|
|
189
|
+
end
|
|
190
|
+
local pickup = entity:ToPickup()
|
|
191
|
+
if pickup ~= nil then
|
|
192
|
+
debugString = debugString .. ("." .. tostring(pickup.State)) .. " (pickup)"
|
|
193
|
+
end
|
|
194
|
+
local player = entity:ToPlayer()
|
|
195
|
+
if player ~= nil then
|
|
196
|
+
debugString = debugString .. " (player)"
|
|
197
|
+
end
|
|
198
|
+
local projectile = entity:ToProjectile()
|
|
199
|
+
if projectile ~= nil then
|
|
200
|
+
debugString = debugString .. " (projectile)"
|
|
201
|
+
end
|
|
202
|
+
local tear = entity:ToTear()
|
|
203
|
+
if tear ~= nil then
|
|
204
|
+
debugString = debugString .. " (tear)"
|
|
205
|
+
end
|
|
206
|
+
debugString = debugString .. (" (InitSeed: " .. tostring(entity.InitSeed)) .. ")"
|
|
207
|
+
debugString = debugString .. (" (DropSeed: " .. tostring(entity.DropSeed)) .. ")"
|
|
208
|
+
debugString = debugString .. (((" (Position: " .. tostring(entity.Position.X)) .. ", ") .. tostring(entity.Position.Y)) .. ")"
|
|
209
|
+
debugString = debugString .. (((" (Velocity: " .. tostring(entity.Velocity.X)) .. ", ") .. tostring(entity.Velocity.Y)) .. ")"
|
|
210
|
+
debugString = debugString .. (((" (HP: " .. tostring(entity.HitPoints)) .. " / ") .. tostring(entity.MaxHitPoints)) .. ")"
|
|
211
|
+
____exports.log(debugString)
|
|
212
|
+
numMatchedEntities = numMatchedEntities + 1
|
|
213
|
+
end
|
|
214
|
+
)
|
|
215
|
+
if numMatchedEntities == 0 then
|
|
216
|
+
____exports.log("(no entities matched)")
|
|
217
|
+
end
|
|
218
|
+
end
|
|
219
|
+
function ____exports.logGridEntities(includeWalls, gridEntityTypeFilter)
|
|
220
|
+
local headerMsg = "Grid entities in the room"
|
|
221
|
+
if gridEntityTypeFilter ~= nil then
|
|
222
|
+
headerMsg = headerMsg .. (" (filtered to grid entity type " .. tostring(gridEntityTypeFilter)) .. ")"
|
|
223
|
+
end
|
|
224
|
+
if not includeWalls then
|
|
225
|
+
headerMsg = headerMsg .. " (not including walls)"
|
|
226
|
+
end
|
|
227
|
+
____exports.log(headerMsg)
|
|
228
|
+
local gridEntities = getGridEntities(nil)
|
|
229
|
+
local numMatchedEntities = 0
|
|
230
|
+
__TS__ArrayForEach(
|
|
231
|
+
gridEntities,
|
|
232
|
+
function(____, gridEntity)
|
|
233
|
+
local gridEntityIndex = gridEntity:GetGridIndex()
|
|
234
|
+
local gridEntityType = gridEntity:GetType()
|
|
235
|
+
local gridEntityVariant = gridEntity:GetVariant()
|
|
236
|
+
local gridEntityDesc = gridEntity:GetSaveState()
|
|
237
|
+
if gridEntityTypeFilter ~= nil and gridEntityType ~= gridEntityTypeFilter then
|
|
238
|
+
return
|
|
239
|
+
end
|
|
240
|
+
if not includeWalls and gridEntityType == GridEntityType.GRID_WALL and gridEntityTypeFilter ~= GridEntityType.GRID_WALL then
|
|
241
|
+
return
|
|
242
|
+
end
|
|
243
|
+
local debugString = (((((tostring(gridEntityIndex) .. " - ") .. tostring(gridEntityType)) .. ".") .. tostring(gridEntityVariant)) .. ".") .. tostring(gridEntity.State)
|
|
244
|
+
local door = gridEntity:ToDoor()
|
|
245
|
+
if door ~= nil then
|
|
246
|
+
debugString = debugString .. (((((((" (door) (Slot: " .. tostring(door.Slot)) .. ", Direction: ") .. tostring(door.Direction)) .. ", TargetRoomIndex: ") .. tostring(door.TargetRoomIndex)) .. ", TargetRoomType: ") .. tostring(door.TargetRoomType)) .. ")"
|
|
247
|
+
end
|
|
248
|
+
local pit = gridEntity:ToPit()
|
|
249
|
+
if pit ~= nil then
|
|
250
|
+
debugString = debugString .. " (pit)"
|
|
251
|
+
end
|
|
252
|
+
local poop = gridEntity:ToPoop()
|
|
253
|
+
if poop ~= nil then
|
|
254
|
+
debugString = debugString .. " (poop)"
|
|
255
|
+
end
|
|
256
|
+
local pressurePlate = gridEntity:ToPressurePlate()
|
|
257
|
+
if pressurePlate ~= nil then
|
|
258
|
+
debugString = debugString .. " (pressurePlate)"
|
|
259
|
+
end
|
|
260
|
+
local rock = gridEntity:ToRock()
|
|
261
|
+
if rock ~= nil then
|
|
262
|
+
debugString = debugString .. " (rock)"
|
|
263
|
+
end
|
|
264
|
+
local spikes = gridEntity:ToSpikes()
|
|
265
|
+
if spikes ~= nil then
|
|
266
|
+
debugString = debugString .. " (spikes)"
|
|
267
|
+
end
|
|
268
|
+
local tnt = gridEntity:ToTNT()
|
|
269
|
+
if tnt ~= nil then
|
|
270
|
+
debugString = debugString .. " (TNT)"
|
|
271
|
+
end
|
|
272
|
+
debugString = debugString .. (" (VarData: " .. tostring(gridEntity.VarData)) .. ")"
|
|
273
|
+
debugString = debugString .. (((" (Position: " .. tostring(gridEntity.Position.X)) .. ", ") .. tostring(gridEntity.Position.Y)) .. ")"
|
|
274
|
+
debugString = debugString .. (((" (SpawnSeed: " .. tostring(gridEntityDesc.SpawnSeed)) .. ", VariableSeed: ") .. tostring(gridEntityDesc.VariableSeed)) .. ")"
|
|
275
|
+
____exports.log(debugString)
|
|
276
|
+
numMatchedEntities = numMatchedEntities + 1
|
|
277
|
+
end
|
|
278
|
+
)
|
|
279
|
+
if numMatchedEntities == 0 then
|
|
280
|
+
____exports.log("(no grid entities matched)")
|
|
281
|
+
end
|
|
282
|
+
end
|
|
123
283
|
function ____exports.logKColor(kColor)
|
|
124
284
|
____exports.log((((((("Color: R" .. tostring(kColor.Red)) .. ", G") .. tostring(kColor.Green)) .. ", B") .. tostring(kColor.Blue)) .. ", A") .. tostring(kColor.Alpha))
|
|
125
285
|
end
|
|
@@ -156,11 +316,20 @@ function ____exports.logRoom()
|
|
|
156
316
|
if roomData == nil then
|
|
157
317
|
____exports.log("Current room data is undefined.")
|
|
158
318
|
else
|
|
319
|
+
____exports.log("Current room stage ID: " .. tostring(roomData.StageID))
|
|
159
320
|
____exports.log((((("Current room type/variant/sub-type: " .. tostring(roomData.Type)) .. ".") .. tostring(roomData.Variant)) .. ".") .. tostring(roomData.Subtype))
|
|
321
|
+
____exports.log("Current room name: " .. roomData.Name)
|
|
160
322
|
end
|
|
161
323
|
____exports.log("Current room grid index: " .. tostring(roomGridIndex))
|
|
162
324
|
____exports.log("Current room list index: " .. tostring(roomListIndex))
|
|
163
325
|
end
|
|
326
|
+
function ____exports.logSounds()
|
|
327
|
+
for ____, soundEffect in ipairs(range(nil, 0, SoundEffect.NUM_SOUND_EFFECTS - 1)) do
|
|
328
|
+
if sfxManager:IsPlaying(soundEffect) then
|
|
329
|
+
____exports.log("Currently playing sound effect: " .. tostring(soundEffect))
|
|
330
|
+
end
|
|
331
|
+
end
|
|
332
|
+
end
|
|
164
333
|
function ____exports.logTable(____table, parentTables)
|
|
165
334
|
if parentTables == nil then
|
|
166
335
|
parentTables = 0
|
|
@@ -233,11 +402,15 @@ function ____exports.setLogFunctionsGlobal(self)
|
|
|
233
402
|
globals.logArray = ____exports.logArray
|
|
234
403
|
globals.logColor = ____exports.logColor
|
|
235
404
|
globals.logEntity = ____exports.logEntity
|
|
405
|
+
globals.logEntities = ____exports.logEntities
|
|
406
|
+
globals.logGridEntities = ____exports.logGridEntities
|
|
236
407
|
globals.logKColor = ____exports.logKColor
|
|
237
408
|
globals.logMap = ____exports.logMap
|
|
409
|
+
globals.logRoom = ____exports.logRoom
|
|
238
410
|
globals.logTable = ____exports.logTable
|
|
239
411
|
globals.logTemporaryEffects = ____exports.logTemporaryEffects
|
|
240
412
|
globals.logSet = ____exports.logSet
|
|
413
|
+
globals.logSounds = ____exports.logSounds
|
|
241
414
|
globals.logVector = ____exports.logVector
|
|
242
415
|
end
|
|
243
416
|
return ____exports
|
package/dist/functions/map.d.ts
CHANGED
|
@@ -7,6 +7,22 @@ export declare function copyMap<K, V>(oldMap: Map<K, V>): Map<K, V>;
|
|
|
7
7
|
* manually getting the current value, incrementing it, and then setting it.
|
|
8
8
|
*/
|
|
9
9
|
export declare function defaultMapGetNextSeed<K, A extends unknown[]>(map: DefaultMap<K, Seed, A>, key: K, ...extraArgs: A): Seed;
|
|
10
|
+
/**
|
|
11
|
+
* Helper function to get the closest value from a map based on partial search text. For the
|
|
12
|
+
* purposes of this function, both search text and map keys are converted to lowercase before
|
|
13
|
+
* attempting to find a match.
|
|
14
|
+
*
|
|
15
|
+
* Example:
|
|
16
|
+
* ```ts
|
|
17
|
+
* const map = new <string, number>Map([
|
|
18
|
+
* ["foo", 123],
|
|
19
|
+
* ["bar", 456],
|
|
20
|
+
* ]);
|
|
21
|
+
* const searchText = "f";
|
|
22
|
+
* const match = getMapPartialMatch(map, searchText); // match is now equal to 123
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export declare function getMapPartialMatch<T>(searchText: string, map: ReadonlyMap<string, T>): T | undefined;
|
|
10
26
|
/**
|
|
11
27
|
* Helper function to make using maps with `Seed` values easier. Use this instead of manually
|
|
12
28
|
* getting the current value, incrementing it, and then setting it.
|
package/dist/functions/map.lua
CHANGED
|
@@ -3,6 +3,11 @@ local ____lualib = require("lualib_bundle")
|
|
|
3
3
|
local Map = ____lualib.Map
|
|
4
4
|
local __TS__New = ____lualib.__TS__New
|
|
5
5
|
local __TS__Iterator = ____lualib.__TS__Iterator
|
|
6
|
+
local __TS__Spread = ____lualib.__TS__Spread
|
|
7
|
+
local __TS__ArraySort = ____lualib.__TS__ArraySort
|
|
8
|
+
local __TS__StringReplaceAll = ____lualib.__TS__StringReplaceAll
|
|
9
|
+
local __TS__StringStartsWith = ____lualib.__TS__StringStartsWith
|
|
10
|
+
local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
|
|
6
11
|
local ____exports = {}
|
|
7
12
|
local ____random = require("functions.random")
|
|
8
13
|
local nextSeed = ____random.nextSeed
|
|
@@ -24,6 +29,25 @@ function ____exports.defaultMapGetNextSeed(self, map, key, ...)
|
|
|
24
29
|
map:set(key, newSeed)
|
|
25
30
|
return newSeed
|
|
26
31
|
end
|
|
32
|
+
function ____exports.getMapPartialMatch(self, searchText, map)
|
|
33
|
+
local keys = {__TS__Spread(map:keys())}
|
|
34
|
+
__TS__ArraySort(keys)
|
|
35
|
+
searchText = string.lower(searchText)
|
|
36
|
+
searchText = __TS__StringReplaceAll(searchText, " ", "")
|
|
37
|
+
local matchingKeys = __TS__ArrayFilter(
|
|
38
|
+
keys,
|
|
39
|
+
function(____, key) return __TS__StringStartsWith(
|
|
40
|
+
string.lower(key),
|
|
41
|
+
searchText
|
|
42
|
+
) end
|
|
43
|
+
)
|
|
44
|
+
__TS__ArraySort(matchingKeys)
|
|
45
|
+
local matchingKey = matchingKeys[1]
|
|
46
|
+
if matchingKey == nil then
|
|
47
|
+
return nil
|
|
48
|
+
end
|
|
49
|
+
return map:get(matchingKey)
|
|
50
|
+
end
|
|
27
51
|
function ____exports.mapGetNextSeed(self, map, key)
|
|
28
52
|
local seed = map:get(key)
|
|
29
53
|
if seed == nil then
|
|
@@ -101,8 +101,8 @@ export declare function getFinalPlayer(): EntityPlayer;
|
|
|
101
101
|
*/
|
|
102
102
|
export declare function getHearts(player: EntityPlayer): int;
|
|
103
103
|
/**
|
|
104
|
-
* Helper function that returns the type of the rightmost heart
|
|
105
|
-
* they
|
|
104
|
+
* Helper function that returns the type of the rightmost heart. This does not including golden
|
|
105
|
+
* hearts or broken hearts, since they cannot be damaged directly.
|
|
106
106
|
*/
|
|
107
107
|
export declare function getLastHeart(player: EntityPlayer): HealthType;
|
|
108
108
|
/**
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
/// <reference types="isaac-typescript-definitions" />
|
|
2
|
+
import { HealthType } from "../types/HealthType";
|
|
2
3
|
import { PlayerHealth } from "../types/PlayerHealth";
|
|
4
|
+
export declare function addPlayerHealthType(player: EntityPlayer, healthType: HealthType, numHearts: int): void;
|
|
3
5
|
/**
|
|
4
6
|
* Helper function to get an inventory of the player's health. Use this in combination with the
|
|
5
7
|
* `setPlayerHealth` function to restore the player's health back to a certain configuration at a
|
|
@@ -8,6 +10,7 @@ import { PlayerHealth } from "../types/PlayerHealth";
|
|
|
8
10
|
* This is based on the `REVEL.StoreHealth` function in the Revelations mod.
|
|
9
11
|
*/
|
|
10
12
|
export declare function getPlayerHealth(player: EntityPlayer): PlayerHealth;
|
|
13
|
+
export declare function getPlayerHealthType(player: EntityPlayer, healthType: HealthType): int;
|
|
11
14
|
/**
|
|
12
15
|
* Helper function to set a player's health to a specific state. You can use this in combination
|
|
13
16
|
* with the `getPlayerHealth` function to restore the player's health back to a certain
|
|
@@ -5,9 +5,14 @@ local __TS__ArrayForEach = ____lualib.__TS__ArrayForEach
|
|
|
5
5
|
local ____exports = {}
|
|
6
6
|
local ____constants = require("constants")
|
|
7
7
|
local MAX_PLAYER_HEART_CONTAINERS = ____constants.MAX_PLAYER_HEART_CONTAINERS
|
|
8
|
+
local ____HealthType = require("types.HealthType")
|
|
9
|
+
local HealthType = ____HealthType.HealthType
|
|
8
10
|
local ____player = require("functions.player")
|
|
11
|
+
local getBlackHearts = ____player.getBlackHearts
|
|
9
12
|
local getHearts = ____player.getHearts
|
|
13
|
+
local getSoulHearts = ____player.getSoulHearts
|
|
10
14
|
local ____utils = require("functions.utils")
|
|
15
|
+
local ensureAllCases = ____utils.ensureAllCases
|
|
11
16
|
local ____repeat = ____utils["repeat"]
|
|
12
17
|
function ____exports.removeAllPlayerHealth(self, player)
|
|
13
18
|
local character = player:GetPlayerType()
|
|
@@ -29,6 +34,79 @@ function ____exports.removeAllPlayerHealth(self, player)
|
|
|
29
34
|
end
|
|
30
35
|
end
|
|
31
36
|
end
|
|
37
|
+
function ____exports.addPlayerHealthType(self, player, healthType, numHearts)
|
|
38
|
+
repeat
|
|
39
|
+
local ____switch3 = healthType
|
|
40
|
+
local ____cond3 = ____switch3 == HealthType.RED
|
|
41
|
+
if ____cond3 then
|
|
42
|
+
do
|
|
43
|
+
player:AddHearts(numHearts)
|
|
44
|
+
return
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
____cond3 = ____cond3 or ____switch3 == HealthType.SOUL
|
|
48
|
+
if ____cond3 then
|
|
49
|
+
do
|
|
50
|
+
player:AddSoulHearts(numHearts)
|
|
51
|
+
return
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
____cond3 = ____cond3 or ____switch3 == HealthType.ETERNAL
|
|
55
|
+
if ____cond3 then
|
|
56
|
+
do
|
|
57
|
+
player:AddEternalHearts(numHearts)
|
|
58
|
+
return
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
____cond3 = ____cond3 or ____switch3 == HealthType.BLACK
|
|
62
|
+
if ____cond3 then
|
|
63
|
+
do
|
|
64
|
+
player:AddBlackHearts(numHearts)
|
|
65
|
+
return
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
____cond3 = ____cond3 or ____switch3 == HealthType.GOLDEN
|
|
69
|
+
if ____cond3 then
|
|
70
|
+
do
|
|
71
|
+
player:AddGoldenHearts(numHearts)
|
|
72
|
+
return
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
____cond3 = ____cond3 or ____switch3 == HealthType.BONE
|
|
76
|
+
if ____cond3 then
|
|
77
|
+
do
|
|
78
|
+
player:AddBoneHearts(numHearts)
|
|
79
|
+
return
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
____cond3 = ____cond3 or ____switch3 == HealthType.ROTTEN
|
|
83
|
+
if ____cond3 then
|
|
84
|
+
do
|
|
85
|
+
player:AddRottenHearts(numHearts)
|
|
86
|
+
return
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
____cond3 = ____cond3 or ____switch3 == HealthType.BROKEN
|
|
90
|
+
if ____cond3 then
|
|
91
|
+
do
|
|
92
|
+
player:AddBrokenHearts(numHearts)
|
|
93
|
+
return
|
|
94
|
+
end
|
|
95
|
+
end
|
|
96
|
+
____cond3 = ____cond3 or ____switch3 == HealthType.MAX_HEARTS
|
|
97
|
+
if ____cond3 then
|
|
98
|
+
do
|
|
99
|
+
player:AddMaxHearts(numHearts, false)
|
|
100
|
+
return
|
|
101
|
+
end
|
|
102
|
+
end
|
|
103
|
+
do
|
|
104
|
+
do
|
|
105
|
+
ensureAllCases(nil, healthType)
|
|
106
|
+
end
|
|
107
|
+
end
|
|
108
|
+
until true
|
|
109
|
+
end
|
|
32
110
|
function ____exports.getPlayerHealth(self, player)
|
|
33
111
|
local character = player:GetPlayerType()
|
|
34
112
|
local soulHeartTypes = {}
|
|
@@ -91,6 +169,70 @@ function ____exports.getPlayerHealth(self, player)
|
|
|
91
169
|
soulHeartTypes = soulHeartTypes
|
|
92
170
|
}
|
|
93
171
|
end
|
|
172
|
+
function ____exports.getPlayerHealthType(self, player, healthType)
|
|
173
|
+
repeat
|
|
174
|
+
local ____switch25 = healthType
|
|
175
|
+
local ____cond25 = ____switch25 == HealthType.RED
|
|
176
|
+
if ____cond25 then
|
|
177
|
+
do
|
|
178
|
+
return getHearts(nil, player)
|
|
179
|
+
end
|
|
180
|
+
end
|
|
181
|
+
____cond25 = ____cond25 or ____switch25 == HealthType.SOUL
|
|
182
|
+
if ____cond25 then
|
|
183
|
+
do
|
|
184
|
+
return getSoulHearts(nil, player)
|
|
185
|
+
end
|
|
186
|
+
end
|
|
187
|
+
____cond25 = ____cond25 or ____switch25 == HealthType.ETERNAL
|
|
188
|
+
if ____cond25 then
|
|
189
|
+
do
|
|
190
|
+
return player:GetEternalHearts()
|
|
191
|
+
end
|
|
192
|
+
end
|
|
193
|
+
____cond25 = ____cond25 or ____switch25 == HealthType.BLACK
|
|
194
|
+
if ____cond25 then
|
|
195
|
+
do
|
|
196
|
+
return getBlackHearts(nil, player)
|
|
197
|
+
end
|
|
198
|
+
end
|
|
199
|
+
____cond25 = ____cond25 or ____switch25 == HealthType.GOLDEN
|
|
200
|
+
if ____cond25 then
|
|
201
|
+
do
|
|
202
|
+
return player:GetGoldenHearts()
|
|
203
|
+
end
|
|
204
|
+
end
|
|
205
|
+
____cond25 = ____cond25 or ____switch25 == HealthType.BONE
|
|
206
|
+
if ____cond25 then
|
|
207
|
+
do
|
|
208
|
+
return player:GetBoneHearts()
|
|
209
|
+
end
|
|
210
|
+
end
|
|
211
|
+
____cond25 = ____cond25 or ____switch25 == HealthType.ROTTEN
|
|
212
|
+
if ____cond25 then
|
|
213
|
+
do
|
|
214
|
+
return player:GetRottenHearts()
|
|
215
|
+
end
|
|
216
|
+
end
|
|
217
|
+
____cond25 = ____cond25 or ____switch25 == HealthType.BROKEN
|
|
218
|
+
if ____cond25 then
|
|
219
|
+
do
|
|
220
|
+
return player:GetBrokenHearts()
|
|
221
|
+
end
|
|
222
|
+
end
|
|
223
|
+
____cond25 = ____cond25 or ____switch25 == HealthType.MAX_HEARTS
|
|
224
|
+
if ____cond25 then
|
|
225
|
+
do
|
|
226
|
+
return player:GetMaxHearts()
|
|
227
|
+
end
|
|
228
|
+
end
|
|
229
|
+
do
|
|
230
|
+
do
|
|
231
|
+
return ensureAllCases(nil, healthType)
|
|
232
|
+
end
|
|
233
|
+
end
|
|
234
|
+
until true
|
|
235
|
+
end
|
|
94
236
|
function ____exports.setPlayerHealth(self, player, playerHealth)
|
|
95
237
|
local character = player:GetPlayerType()
|
|
96
238
|
local subPlayer = player:GetSubPlayer()
|
package/dist/functions/rooms.lua
CHANGED
|
@@ -221,10 +221,8 @@ function ____exports.inLRoom(self)
|
|
|
221
221
|
return roomShape == RoomShape.ROOMSHAPE_LTL or roomShape == RoomShape.ROOMSHAPE_LTR or roomShape == RoomShape.ROOMSHAPE_LBL or roomShape == RoomShape.ROOMSHAPE_LBR
|
|
222
222
|
end
|
|
223
223
|
function ____exports.inGenesisRoom(self)
|
|
224
|
-
local
|
|
225
|
-
|
|
226
|
-
local roomSubType = ____exports.getRoomSubType(nil)
|
|
227
|
-
return roomType == RoomType.ROOM_ISAACS and roomSubType == 99
|
|
224
|
+
local roomGridIndex = ____exports.getRoomGridIndex(nil)
|
|
225
|
+
return roomGridIndex == GridRooms.ROOM_GENESIS_IDX
|
|
228
226
|
end
|
|
229
227
|
function ____exports.inMegaSatanRoom(self)
|
|
230
228
|
local roomGridIndex = ____exports.getRoomGridIndex(nil)
|
|
@@ -238,7 +236,8 @@ function ____exports.inMinibossRoomOf(self, minibossID)
|
|
|
238
236
|
return roomType == RoomType.ROOM_MINIBOSS and roomStageID == 0 and roomSubType == minibossID
|
|
239
237
|
end
|
|
240
238
|
function ____exports.inSecretShop(self)
|
|
241
|
-
|
|
239
|
+
local roomGridIndex = ____exports.getRoomGridIndex(nil)
|
|
240
|
+
return roomGridIndex == GridRooms.ROOM_SECRET_SHOP_IDX
|
|
242
241
|
end
|
|
243
242
|
function ____exports.inStartingRoom(self)
|
|
244
243
|
local level = game:GetLevel()
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="isaac-typescript-definitions" />
|
|
2
|
+
/**
|
|
3
|
+
* Whether or not the player is playing on a set seed (i.e. that they entered in a specific seed by
|
|
4
|
+
* pressing tab on the character selection screen). When the player resets the game on a set seed,
|
|
5
|
+
* the game will not switch to a different seed.
|
|
6
|
+
*/
|
|
7
|
+
export declare function onSetSeed(): boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Helper function to restart the game using the console command of "restart". You can optionally
|
|
10
|
+
* specify a `PlayerType` to restart the game as that character.
|
|
11
|
+
*/
|
|
12
|
+
export declare function restart(character?: PlayerType): void;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
|
+
local ____exports = {}
|
|
3
|
+
local ____cachedClasses = require("cachedClasses")
|
|
4
|
+
local game = ____cachedClasses.game
|
|
5
|
+
local ____log = require("functions.log")
|
|
6
|
+
local log = ____log.log
|
|
7
|
+
function ____exports.onSetSeed(self)
|
|
8
|
+
local seeds = game:GetSeeds()
|
|
9
|
+
local customRun = seeds:IsCustomRun()
|
|
10
|
+
local challenge = Isaac.GetChallenge()
|
|
11
|
+
return challenge == Challenge.CHALLENGE_NULL and customRun
|
|
12
|
+
end
|
|
13
|
+
function ____exports.restart(self, character)
|
|
14
|
+
if character == nil then
|
|
15
|
+
log("Restarting.")
|
|
16
|
+
Isaac.ExecuteCommand("restart")
|
|
17
|
+
return
|
|
18
|
+
end
|
|
19
|
+
if character < 0 or character >= PlayerType.NUM_PLAYER_TYPES then
|
|
20
|
+
error(("Restarting as a character of " .. tostring(character)) .. " would crash the game.")
|
|
21
|
+
end
|
|
22
|
+
log("Restarting as character: " .. tostring(character))
|
|
23
|
+
Isaac.ExecuteCommand("restart " .. tostring(character))
|
|
24
|
+
end
|
|
25
|
+
return ____exports
|
|
@@ -71,12 +71,6 @@ export declare function hexToKColor(hexString: string, alpha: float): KColor;
|
|
|
71
71
|
* is enabled or not.
|
|
72
72
|
*/
|
|
73
73
|
export declare function isLuaDebugEnabled(): boolean;
|
|
74
|
-
/**
|
|
75
|
-
* Whether or not the player is playing on a set seed (i.e. that they entered in a specific seed by
|
|
76
|
-
* pressing tab on the character selection screen). When the player resets the game on a set seed,
|
|
77
|
-
* the game will not switch to a different seed.
|
|
78
|
-
*/
|
|
79
|
-
export declare function onSetSeed(): boolean;
|
|
80
74
|
/**
|
|
81
75
|
* Helper function to print something to the in-game console. Use this instead of invoking the
|
|
82
76
|
* `Isaac.ConsoleOutput` method directly because it will automatically insert a newline at the end
|
package/dist/functions/utils.lua
CHANGED
|
@@ -5,8 +5,6 @@ local __TS__ArraySort = ____lualib.__TS__ArraySort
|
|
|
5
5
|
local __TS__StringReplace = ____lualib.__TS__StringReplace
|
|
6
6
|
local __TS__StringSubstr = ____lualib.__TS__StringSubstr
|
|
7
7
|
local ____exports = {}
|
|
8
|
-
local ____cachedClasses = require("cachedClasses")
|
|
9
|
-
local game = ____cachedClasses.game
|
|
10
8
|
local HEX_STRING_LENGTH = 6
|
|
11
9
|
____exports.ensureAllCases = function(____, obj) return obj end
|
|
12
10
|
function ____exports.getEnumValues(self, transpiledEnum)
|
|
@@ -45,12 +43,6 @@ end
|
|
|
45
43
|
function ____exports.isLuaDebugEnabled(self)
|
|
46
44
|
return package ~= nil
|
|
47
45
|
end
|
|
48
|
-
function ____exports.onSetSeed(self)
|
|
49
|
-
local seeds = game:GetSeeds()
|
|
50
|
-
local customRun = seeds:IsCustomRun()
|
|
51
|
-
local challenge = Isaac.GetChallenge()
|
|
52
|
-
return challenge == Challenge.CHALLENGE_NULL and customRun
|
|
53
|
-
end
|
|
54
46
|
function ____exports.printConsole(self, msg)
|
|
55
47
|
Isaac.ConsoleOutput(msg .. "\n")
|
|
56
48
|
end
|
|
@@ -8,10 +8,10 @@ end
|
|
|
8
8
|
function ____exports.directionToVector(self, direction)
|
|
9
9
|
repeat
|
|
10
10
|
local ____switch4 = direction
|
|
11
|
-
local ____cond4 = ____switch4 == Direction.
|
|
11
|
+
local ____cond4 = ____switch4 == Direction.NO_DIRECTION
|
|
12
12
|
if ____cond4 then
|
|
13
13
|
do
|
|
14
|
-
return Vector
|
|
14
|
+
return Vector.Zero
|
|
15
15
|
end
|
|
16
16
|
end
|
|
17
17
|
____cond4 = ____cond4 or ____switch4 == Direction.LEFT
|
|
@@ -20,22 +20,22 @@ function ____exports.directionToVector(self, direction)
|
|
|
20
20
|
return Vector(-1, 0)
|
|
21
21
|
end
|
|
22
22
|
end
|
|
23
|
-
____cond4 = ____cond4 or ____switch4 == Direction.
|
|
23
|
+
____cond4 = ____cond4 or ____switch4 == Direction.UP
|
|
24
24
|
if ____cond4 then
|
|
25
25
|
do
|
|
26
|
-
return Vector(
|
|
26
|
+
return Vector(0, -1)
|
|
27
27
|
end
|
|
28
28
|
end
|
|
29
|
-
____cond4 = ____cond4 or ____switch4 == Direction.
|
|
29
|
+
____cond4 = ____cond4 or ____switch4 == Direction.RIGHT
|
|
30
30
|
if ____cond4 then
|
|
31
31
|
do
|
|
32
|
-
return Vector(
|
|
32
|
+
return Vector(1, 0)
|
|
33
33
|
end
|
|
34
34
|
end
|
|
35
|
-
____cond4 = ____cond4 or ____switch4 == Direction.
|
|
35
|
+
____cond4 = ____cond4 or ____switch4 == Direction.DOWN
|
|
36
36
|
if ____cond4 then
|
|
37
37
|
do
|
|
38
|
-
return Vector
|
|
38
|
+
return Vector(0, 1)
|
|
39
39
|
end
|
|
40
40
|
end
|
|
41
41
|
do
|