isaacscript-common 1.2.236 → 1.2.239
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/customRevive.lua +2 -2
- package/dist/callbacks/postCustomDoorEnter.lua +2 -13
- package/dist/callbacks/postPurchase.lua +2 -2
- package/dist/features/deployJSONRoom.lua +18 -22
- package/dist/features/extraConsoleCommands/commands.lua +9 -27
- package/dist/functions/collectibles.d.ts +0 -11
- package/dist/functions/collectibles.lua +0 -12
- package/dist/functions/entity.d.ts +2 -2
- package/dist/functions/entity.lua +3 -2
- package/dist/functions/entitySpecific.d.ts +107 -20
- package/dist/functions/entitySpecific.lua +451 -0
- package/dist/functions/familiars.d.ts +0 -21
- package/dist/functions/familiars.lua +9 -37
- package/dist/functions/gridEntity.d.ts +2 -2
- package/dist/functions/npc.d.ts +0 -9
- package/dist/functions/npc.lua +3 -29
- package/dist/functions/pickups.d.ts +119 -18
- package/dist/functions/pickups.lua +309 -22
- package/dist/functions/spawnCollectible.lua +6 -13
- package/dist/functions/trinkets.d.ts +0 -2
- package/dist/functions/trinkets.lua +0 -8
- package/package.json +1 -1
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
local ____lualib = require("lualib_bundle")
|
|
2
2
|
local __TS__ArrayPush = ____lualib.__TS__ArrayPush
|
|
3
3
|
local ____exports = {}
|
|
4
|
+
local ____constants = require("constants")
|
|
5
|
+
local VectorZero = ____constants.VectorZero
|
|
4
6
|
local ____entity = require("functions.entity")
|
|
5
7
|
local getEntities = ____entity.getEntities
|
|
6
8
|
local removeEntities = ____entity.removeEntities
|
|
9
|
+
local spawn = ____entity.spawn
|
|
7
10
|
function ____exports.getBombs(self, matchingVariant, matchingSubType)
|
|
8
11
|
if matchingVariant == nil then
|
|
9
12
|
matchingVariant = -1
|
|
@@ -38,6 +41,23 @@ function ____exports.getEffects(self, matchingVariant, matchingSubType)
|
|
|
38
41
|
end
|
|
39
42
|
return effects
|
|
40
43
|
end
|
|
44
|
+
function ____exports.getFamiliars(self, matchingVariant, matchingSubType)
|
|
45
|
+
if matchingVariant == nil then
|
|
46
|
+
matchingVariant = -1
|
|
47
|
+
end
|
|
48
|
+
if matchingSubType == nil then
|
|
49
|
+
matchingSubType = -1
|
|
50
|
+
end
|
|
51
|
+
local entities = getEntities(nil, EntityType.ENTITY_FAMILIAR, matchingVariant, matchingSubType)
|
|
52
|
+
local familiars = {}
|
|
53
|
+
for ____, entity in ipairs(entities) do
|
|
54
|
+
local familiar = entity:ToFamiliar()
|
|
55
|
+
if familiar ~= nil then
|
|
56
|
+
__TS__ArrayPush(familiars, familiar)
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
return familiars
|
|
60
|
+
end
|
|
41
61
|
function ____exports.getKnives(self, matchingVariant, matchingSubType)
|
|
42
62
|
if matchingVariant == nil then
|
|
43
63
|
matchingVariant = -1
|
|
@@ -72,6 +92,43 @@ function ____exports.getLasers(self, matchingVariant, matchingSubType)
|
|
|
72
92
|
end
|
|
73
93
|
return lasers
|
|
74
94
|
end
|
|
95
|
+
function ____exports.getNPCs(self, matchingEntityType, matchingVariant, matchingSubType, ignoreFriendly)
|
|
96
|
+
if ignoreFriendly == nil then
|
|
97
|
+
ignoreFriendly = false
|
|
98
|
+
end
|
|
99
|
+
local entities = getEntities(
|
|
100
|
+
nil,
|
|
101
|
+
matchingEntityType,
|
|
102
|
+
matchingVariant,
|
|
103
|
+
matchingSubType,
|
|
104
|
+
ignoreFriendly
|
|
105
|
+
)
|
|
106
|
+
local npcs = {}
|
|
107
|
+
for ____, entity in ipairs(entities) do
|
|
108
|
+
local npc = entity:ToNPC()
|
|
109
|
+
if npc ~= nil then
|
|
110
|
+
__TS__ArrayPush(npcs, npc)
|
|
111
|
+
end
|
|
112
|
+
end
|
|
113
|
+
return npcs
|
|
114
|
+
end
|
|
115
|
+
function ____exports.getPickups(self, matchingVariant, matchingSubType)
|
|
116
|
+
if matchingVariant == nil then
|
|
117
|
+
matchingVariant = -1
|
|
118
|
+
end
|
|
119
|
+
if matchingSubType == nil then
|
|
120
|
+
matchingSubType = -1
|
|
121
|
+
end
|
|
122
|
+
local entities = getEntities(nil, EntityType.ENTITY_PICKUP, matchingVariant, matchingSubType)
|
|
123
|
+
local pickups = {}
|
|
124
|
+
for ____, entity in ipairs(entities) do
|
|
125
|
+
local pickup = entity:ToPickup()
|
|
126
|
+
if pickup ~= nil then
|
|
127
|
+
__TS__ArrayPush(pickups, pickup)
|
|
128
|
+
end
|
|
129
|
+
end
|
|
130
|
+
return pickups
|
|
131
|
+
end
|
|
75
132
|
function ____exports.getProjectiles(self, matchingVariant, matchingSubType)
|
|
76
133
|
if matchingVariant == nil then
|
|
77
134
|
matchingVariant = -1
|
|
@@ -124,6 +181,10 @@ function ____exports.removeAllEffects(self, variant, subType, cap)
|
|
|
124
181
|
local effects = ____exports.getEffects(nil, variant, subType)
|
|
125
182
|
return removeEntities(nil, effects, cap)
|
|
126
183
|
end
|
|
184
|
+
function ____exports.removeAllFamiliars(self, variant, subType, cap)
|
|
185
|
+
local familiars = ____exports.getFamiliars(nil, variant, subType)
|
|
186
|
+
return removeEntities(nil, familiars, cap)
|
|
187
|
+
end
|
|
127
188
|
function ____exports.removeAllKnives(self, variant, subType, cap)
|
|
128
189
|
local knives = ____exports.getKnives(nil, variant, subType)
|
|
129
190
|
return removeEntities(nil, knives, cap)
|
|
@@ -132,6 +193,14 @@ function ____exports.removeAllLasers(self, variant, subType, cap)
|
|
|
132
193
|
local lasers = ____exports.getLasers(nil, variant, subType)
|
|
133
194
|
return removeEntities(nil, lasers, cap)
|
|
134
195
|
end
|
|
196
|
+
function ____exports.removeAllNPCs(self, cap)
|
|
197
|
+
local npcs = ____exports.getNPCs(nil)
|
|
198
|
+
return removeEntities(nil, npcs, cap)
|
|
199
|
+
end
|
|
200
|
+
function ____exports.removeAllPickups(self, variant, subType, cap)
|
|
201
|
+
local pickups = ____exports.getPickups(nil, variant, subType)
|
|
202
|
+
return removeEntities(nil, pickups, cap)
|
|
203
|
+
end
|
|
135
204
|
function ____exports.removeAllProjectiles(self, variant, subType, cap)
|
|
136
205
|
local projectiles = ____exports.getProjectiles(nil, variant, subType)
|
|
137
206
|
return removeEntities(nil, projectiles, cap)
|
|
@@ -144,4 +213,386 @@ function ____exports.removeAllTears(self, variant, subType, cap)
|
|
|
144
213
|
local tears = ____exports.getTears(nil, variant, subType)
|
|
145
214
|
return removeEntities(nil, tears, cap)
|
|
146
215
|
end
|
|
216
|
+
function ____exports.spawnBomb(self, variant, subType, position, velocity, spawner, seed)
|
|
217
|
+
if velocity == nil then
|
|
218
|
+
velocity = VectorZero
|
|
219
|
+
end
|
|
220
|
+
if spawner == nil then
|
|
221
|
+
spawner = nil
|
|
222
|
+
end
|
|
223
|
+
if seed == nil then
|
|
224
|
+
seed = nil
|
|
225
|
+
end
|
|
226
|
+
local entity = spawn(
|
|
227
|
+
nil,
|
|
228
|
+
EntityType.ENTITY_BOMB,
|
|
229
|
+
variant,
|
|
230
|
+
subType,
|
|
231
|
+
position,
|
|
232
|
+
velocity,
|
|
233
|
+
spawner,
|
|
234
|
+
seed
|
|
235
|
+
)
|
|
236
|
+
local bomb = entity:ToBomb()
|
|
237
|
+
if bomb == nil then
|
|
238
|
+
error("Failed to spawn a bomb.")
|
|
239
|
+
end
|
|
240
|
+
return bomb
|
|
241
|
+
end
|
|
242
|
+
function ____exports.spawnBombWithSeed(self, variant, subType, position, seed, velocity, spawner)
|
|
243
|
+
if velocity == nil then
|
|
244
|
+
velocity = VectorZero
|
|
245
|
+
end
|
|
246
|
+
if spawner == nil then
|
|
247
|
+
spawner = nil
|
|
248
|
+
end
|
|
249
|
+
return ____exports.spawnBomb(
|
|
250
|
+
nil,
|
|
251
|
+
variant,
|
|
252
|
+
subType,
|
|
253
|
+
position,
|
|
254
|
+
velocity,
|
|
255
|
+
spawner,
|
|
256
|
+
seed
|
|
257
|
+
)
|
|
258
|
+
end
|
|
259
|
+
function ____exports.spawnEffect(self, variant, subType, position, velocity, spawner, seed)
|
|
260
|
+
if velocity == nil then
|
|
261
|
+
velocity = VectorZero
|
|
262
|
+
end
|
|
263
|
+
if spawner == nil then
|
|
264
|
+
spawner = nil
|
|
265
|
+
end
|
|
266
|
+
if seed == nil then
|
|
267
|
+
seed = nil
|
|
268
|
+
end
|
|
269
|
+
local entity = spawn(
|
|
270
|
+
nil,
|
|
271
|
+
EntityType.ENTITY_EFFECT,
|
|
272
|
+
variant,
|
|
273
|
+
subType,
|
|
274
|
+
position,
|
|
275
|
+
velocity,
|
|
276
|
+
spawner,
|
|
277
|
+
seed
|
|
278
|
+
)
|
|
279
|
+
local effect = entity:ToEffect()
|
|
280
|
+
if effect == nil then
|
|
281
|
+
error("Failed to spawn an effect.")
|
|
282
|
+
end
|
|
283
|
+
return effect
|
|
284
|
+
end
|
|
285
|
+
function ____exports.spawnEffectWithSeed(self, variant, subType, position, seed, velocity, spawner)
|
|
286
|
+
if velocity == nil then
|
|
287
|
+
velocity = VectorZero
|
|
288
|
+
end
|
|
289
|
+
if spawner == nil then
|
|
290
|
+
spawner = nil
|
|
291
|
+
end
|
|
292
|
+
return ____exports.spawnEffect(
|
|
293
|
+
nil,
|
|
294
|
+
variant,
|
|
295
|
+
subType,
|
|
296
|
+
position,
|
|
297
|
+
velocity,
|
|
298
|
+
spawner,
|
|
299
|
+
seed
|
|
300
|
+
)
|
|
301
|
+
end
|
|
302
|
+
function ____exports.spawnFamiliar(self, variant, subType, position, velocity, spawner, seed)
|
|
303
|
+
if velocity == nil then
|
|
304
|
+
velocity = VectorZero
|
|
305
|
+
end
|
|
306
|
+
if spawner == nil then
|
|
307
|
+
spawner = nil
|
|
308
|
+
end
|
|
309
|
+
if seed == nil then
|
|
310
|
+
seed = nil
|
|
311
|
+
end
|
|
312
|
+
local entity = spawn(
|
|
313
|
+
nil,
|
|
314
|
+
EntityType.ENTITY_FAMILIAR,
|
|
315
|
+
variant,
|
|
316
|
+
subType,
|
|
317
|
+
position,
|
|
318
|
+
velocity,
|
|
319
|
+
spawner,
|
|
320
|
+
seed
|
|
321
|
+
)
|
|
322
|
+
local familiar = entity:ToFamiliar()
|
|
323
|
+
if familiar == nil then
|
|
324
|
+
error("Failed to spawn a familiar.")
|
|
325
|
+
end
|
|
326
|
+
return familiar
|
|
327
|
+
end
|
|
328
|
+
function ____exports.spawnFamiliarWithSeed(self, variant, subType, position, seed, velocity, spawner)
|
|
329
|
+
if velocity == nil then
|
|
330
|
+
velocity = VectorZero
|
|
331
|
+
end
|
|
332
|
+
if spawner == nil then
|
|
333
|
+
spawner = nil
|
|
334
|
+
end
|
|
335
|
+
return ____exports.spawnFamiliar(
|
|
336
|
+
nil,
|
|
337
|
+
variant,
|
|
338
|
+
subType,
|
|
339
|
+
position,
|
|
340
|
+
velocity,
|
|
341
|
+
spawner,
|
|
342
|
+
seed
|
|
343
|
+
)
|
|
344
|
+
end
|
|
345
|
+
function ____exports.spawnKnife(self, variant, subType, position, velocity, spawner, seed)
|
|
346
|
+
if velocity == nil then
|
|
347
|
+
velocity = VectorZero
|
|
348
|
+
end
|
|
349
|
+
if spawner == nil then
|
|
350
|
+
spawner = nil
|
|
351
|
+
end
|
|
352
|
+
if seed == nil then
|
|
353
|
+
seed = nil
|
|
354
|
+
end
|
|
355
|
+
local entity = spawn(
|
|
356
|
+
nil,
|
|
357
|
+
EntityType.ENTITY_KNIFE,
|
|
358
|
+
variant,
|
|
359
|
+
subType,
|
|
360
|
+
position,
|
|
361
|
+
velocity,
|
|
362
|
+
spawner,
|
|
363
|
+
seed
|
|
364
|
+
)
|
|
365
|
+
local knife = entity:ToKnife()
|
|
366
|
+
if knife == nil then
|
|
367
|
+
error("Failed to spawn a knife.")
|
|
368
|
+
end
|
|
369
|
+
return knife
|
|
370
|
+
end
|
|
371
|
+
function ____exports.spawnKnifeWithSeed(self, variant, subType, position, seed, velocity, spawner)
|
|
372
|
+
if velocity == nil then
|
|
373
|
+
velocity = VectorZero
|
|
374
|
+
end
|
|
375
|
+
if spawner == nil then
|
|
376
|
+
spawner = nil
|
|
377
|
+
end
|
|
378
|
+
return ____exports.spawnKnife(
|
|
379
|
+
nil,
|
|
380
|
+
variant,
|
|
381
|
+
subType,
|
|
382
|
+
position,
|
|
383
|
+
velocity,
|
|
384
|
+
spawner,
|
|
385
|
+
seed
|
|
386
|
+
)
|
|
387
|
+
end
|
|
388
|
+
function ____exports.spawnLaser(self, variant, subType, position, velocity, spawner, seed)
|
|
389
|
+
if velocity == nil then
|
|
390
|
+
velocity = VectorZero
|
|
391
|
+
end
|
|
392
|
+
if spawner == nil then
|
|
393
|
+
spawner = nil
|
|
394
|
+
end
|
|
395
|
+
if seed == nil then
|
|
396
|
+
seed = nil
|
|
397
|
+
end
|
|
398
|
+
local entity = spawn(
|
|
399
|
+
nil,
|
|
400
|
+
EntityType.ENTITY_LASER,
|
|
401
|
+
variant,
|
|
402
|
+
subType,
|
|
403
|
+
position,
|
|
404
|
+
velocity,
|
|
405
|
+
spawner,
|
|
406
|
+
seed
|
|
407
|
+
)
|
|
408
|
+
local laser = entity:ToLaser()
|
|
409
|
+
if laser == nil then
|
|
410
|
+
error("Failed to spawn a laser.")
|
|
411
|
+
end
|
|
412
|
+
return laser
|
|
413
|
+
end
|
|
414
|
+
function ____exports.spawnLaserWithSeed(self, variant, subType, position, seed, velocity, spawner)
|
|
415
|
+
if velocity == nil then
|
|
416
|
+
velocity = VectorZero
|
|
417
|
+
end
|
|
418
|
+
if spawner == nil then
|
|
419
|
+
spawner = nil
|
|
420
|
+
end
|
|
421
|
+
return ____exports.spawnLaser(
|
|
422
|
+
nil,
|
|
423
|
+
variant,
|
|
424
|
+
subType,
|
|
425
|
+
position,
|
|
426
|
+
velocity,
|
|
427
|
+
spawner,
|
|
428
|
+
seed
|
|
429
|
+
)
|
|
430
|
+
end
|
|
431
|
+
function ____exports.spawnPickup(self, variant, subType, position, velocity, spawner, seed)
|
|
432
|
+
if velocity == nil then
|
|
433
|
+
velocity = VectorZero
|
|
434
|
+
end
|
|
435
|
+
if spawner == nil then
|
|
436
|
+
spawner = nil
|
|
437
|
+
end
|
|
438
|
+
if seed == nil then
|
|
439
|
+
seed = nil
|
|
440
|
+
end
|
|
441
|
+
local entity = spawn(
|
|
442
|
+
nil,
|
|
443
|
+
EntityType.ENTITY_PICKUP,
|
|
444
|
+
variant,
|
|
445
|
+
subType,
|
|
446
|
+
position,
|
|
447
|
+
velocity,
|
|
448
|
+
spawner,
|
|
449
|
+
seed
|
|
450
|
+
)
|
|
451
|
+
local pickup = entity:ToPickup()
|
|
452
|
+
if pickup == nil then
|
|
453
|
+
error("Failed to spawn a pickup.")
|
|
454
|
+
end
|
|
455
|
+
return pickup
|
|
456
|
+
end
|
|
457
|
+
function ____exports.spawnPickupWithSeed(self, variant, subType, position, seed, velocity, spawner)
|
|
458
|
+
if velocity == nil then
|
|
459
|
+
velocity = VectorZero
|
|
460
|
+
end
|
|
461
|
+
if spawner == nil then
|
|
462
|
+
spawner = nil
|
|
463
|
+
end
|
|
464
|
+
return ____exports.spawnPickup(
|
|
465
|
+
nil,
|
|
466
|
+
variant,
|
|
467
|
+
subType,
|
|
468
|
+
position,
|
|
469
|
+
velocity,
|
|
470
|
+
spawner,
|
|
471
|
+
seed
|
|
472
|
+
)
|
|
473
|
+
end
|
|
474
|
+
function ____exports.spawnProjectile(self, variant, subType, position, velocity, spawner, seed)
|
|
475
|
+
if velocity == nil then
|
|
476
|
+
velocity = VectorZero
|
|
477
|
+
end
|
|
478
|
+
if spawner == nil then
|
|
479
|
+
spawner = nil
|
|
480
|
+
end
|
|
481
|
+
if seed == nil then
|
|
482
|
+
seed = nil
|
|
483
|
+
end
|
|
484
|
+
local entity = spawn(
|
|
485
|
+
nil,
|
|
486
|
+
EntityType.ENTITY_PROJECTILE,
|
|
487
|
+
variant,
|
|
488
|
+
subType,
|
|
489
|
+
position,
|
|
490
|
+
velocity,
|
|
491
|
+
spawner,
|
|
492
|
+
seed
|
|
493
|
+
)
|
|
494
|
+
local projectile = entity:ToProjectile()
|
|
495
|
+
if projectile == nil then
|
|
496
|
+
error("Failed to spawn a projectile.")
|
|
497
|
+
end
|
|
498
|
+
return projectile
|
|
499
|
+
end
|
|
500
|
+
function ____exports.spawnProjectileWithSeed(self, variant, subType, position, seed, velocity, spawner)
|
|
501
|
+
if velocity == nil then
|
|
502
|
+
velocity = VectorZero
|
|
503
|
+
end
|
|
504
|
+
if spawner == nil then
|
|
505
|
+
spawner = nil
|
|
506
|
+
end
|
|
507
|
+
return ____exports.spawnProjectile(
|
|
508
|
+
nil,
|
|
509
|
+
variant,
|
|
510
|
+
subType,
|
|
511
|
+
position,
|
|
512
|
+
velocity,
|
|
513
|
+
spawner,
|
|
514
|
+
seed
|
|
515
|
+
)
|
|
516
|
+
end
|
|
517
|
+
function ____exports.spawnSlot(self, variant, subType, position, velocity, spawner, seed)
|
|
518
|
+
if velocity == nil then
|
|
519
|
+
velocity = VectorZero
|
|
520
|
+
end
|
|
521
|
+
if spawner == nil then
|
|
522
|
+
spawner = nil
|
|
523
|
+
end
|
|
524
|
+
if seed == nil then
|
|
525
|
+
seed = nil
|
|
526
|
+
end
|
|
527
|
+
return spawn(
|
|
528
|
+
nil,
|
|
529
|
+
EntityType.ENTITY_SLOT,
|
|
530
|
+
variant,
|
|
531
|
+
subType,
|
|
532
|
+
position,
|
|
533
|
+
velocity,
|
|
534
|
+
spawner,
|
|
535
|
+
seed
|
|
536
|
+
)
|
|
537
|
+
end
|
|
538
|
+
function ____exports.spawnSlotWithSeed(self, variant, subType, position, seed, velocity, spawner)
|
|
539
|
+
if velocity == nil then
|
|
540
|
+
velocity = VectorZero
|
|
541
|
+
end
|
|
542
|
+
if spawner == nil then
|
|
543
|
+
spawner = nil
|
|
544
|
+
end
|
|
545
|
+
return ____exports.spawnSlot(
|
|
546
|
+
nil,
|
|
547
|
+
variant,
|
|
548
|
+
subType,
|
|
549
|
+
position,
|
|
550
|
+
velocity,
|
|
551
|
+
spawner,
|
|
552
|
+
seed
|
|
553
|
+
)
|
|
554
|
+
end
|
|
555
|
+
function ____exports.spawnTear(self, variant, subType, position, velocity, spawner, seed)
|
|
556
|
+
if velocity == nil then
|
|
557
|
+
velocity = VectorZero
|
|
558
|
+
end
|
|
559
|
+
if spawner == nil then
|
|
560
|
+
spawner = nil
|
|
561
|
+
end
|
|
562
|
+
if seed == nil then
|
|
563
|
+
seed = nil
|
|
564
|
+
end
|
|
565
|
+
local entity = spawn(
|
|
566
|
+
nil,
|
|
567
|
+
EntityType.ENTITY_TEAR,
|
|
568
|
+
variant,
|
|
569
|
+
subType,
|
|
570
|
+
position,
|
|
571
|
+
velocity,
|
|
572
|
+
spawner,
|
|
573
|
+
seed
|
|
574
|
+
)
|
|
575
|
+
local tear = entity:ToTear()
|
|
576
|
+
if tear == nil then
|
|
577
|
+
error("Failed to spawn a tear.")
|
|
578
|
+
end
|
|
579
|
+
return tear
|
|
580
|
+
end
|
|
581
|
+
function ____exports.spawnTearWithSeed(self, variant, subType, position, seed, velocity, spawner)
|
|
582
|
+
if velocity == nil then
|
|
583
|
+
velocity = VectorZero
|
|
584
|
+
end
|
|
585
|
+
if spawner == nil then
|
|
586
|
+
spawner = nil
|
|
587
|
+
end
|
|
588
|
+
return ____exports.spawnTear(
|
|
589
|
+
nil,
|
|
590
|
+
variant,
|
|
591
|
+
subType,
|
|
592
|
+
position,
|
|
593
|
+
velocity,
|
|
594
|
+
spawner,
|
|
595
|
+
seed
|
|
596
|
+
)
|
|
597
|
+
end
|
|
147
598
|
return ____exports
|
|
@@ -48,25 +48,4 @@ export declare function checkFamiliar(player: EntityPlayer, collectibleType: int
|
|
|
48
48
|
* -2.
|
|
49
49
|
*/
|
|
50
50
|
export declare function checkFamiliarFromCollectibles(player: EntityPlayer, collectibleType: int, familiarVariant: int, familiarSubType?: int): int;
|
|
51
|
-
/**
|
|
52
|
-
* Helper function to get all of the familiars in the room.
|
|
53
|
-
*
|
|
54
|
-
* Example:
|
|
55
|
-
* ```ts
|
|
56
|
-
* // Make all of the familiars in the room invisible
|
|
57
|
-
* for (const familiar of getFamiliars()) {
|
|
58
|
-
* familiar.Visible = false;
|
|
59
|
-
* }
|
|
60
|
-
* ```
|
|
61
|
-
*/
|
|
62
|
-
export declare function getFamiliars(matchingVariant?: FamiliarVariant | int, matchingSubType?: number): EntityFamiliar[];
|
|
63
51
|
export declare function isFamiliarThatShootsPlayerTears(familiar: EntityFamiliar): boolean;
|
|
64
|
-
/**
|
|
65
|
-
* Helper function to remove all of the familiars in the room.
|
|
66
|
-
*
|
|
67
|
-
* @param variant Optional. If specified, will only remove familiars that match this variant.
|
|
68
|
-
* @param subType Optional. If specified, will only remove familiars that match this sub-type.
|
|
69
|
-
* @param cap Optional. If specified, will only remove the given amount of familiars.
|
|
70
|
-
* @returns True if one or more familiars was removed, false otherwise.
|
|
71
|
-
*/
|
|
72
|
-
export declare function removeAllFamiliars(variant?: FamiliarVariant | int, subType?: int, cap?: int): boolean;
|
|
@@ -1,41 +1,21 @@
|
|
|
1
1
|
local ____lualib = require("lualib_bundle")
|
|
2
2
|
local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
|
|
3
|
-
local __TS__ArrayPush = ____lualib.__TS__ArrayPush
|
|
4
3
|
local ____exports = {}
|
|
5
|
-
local ____cachedClasses = require("cachedClasses")
|
|
6
|
-
local game = ____cachedClasses.game
|
|
7
|
-
local ____constants = require("constants")
|
|
8
|
-
local VectorZero = ____constants.VectorZero
|
|
9
4
|
local ____familiarsThatShootPlayerTearsSet = require("sets.familiarsThatShootPlayerTearsSet")
|
|
10
5
|
local FAMILIARS_THAT_SHOOT_PLAYER_TEARS_SET = ____familiarsThatShootPlayerTearsSet.FAMILIARS_THAT_SHOOT_PLAYER_TEARS_SET
|
|
11
6
|
local ____array = require("functions.array")
|
|
12
7
|
local copyArray = ____array.copyArray
|
|
13
8
|
local ____entity = require("functions.entity")
|
|
14
|
-
local getEntities = ____entity.getEntities
|
|
15
9
|
local removeEntities = ____entity.removeEntities
|
|
10
|
+
local ____entitySpecific = require("functions.entitySpecific")
|
|
11
|
+
local getFamiliars = ____entitySpecific.getFamiliars
|
|
12
|
+
local spawnFamiliarWithSeed = ____entitySpecific.spawnFamiliarWithSeed
|
|
16
13
|
local ____utils = require("functions.utils")
|
|
17
14
|
local ____repeat = ____utils["repeat"]
|
|
18
|
-
function ____exports.getFamiliars(self, matchingVariant, matchingSubType)
|
|
19
|
-
if matchingVariant == nil then
|
|
20
|
-
matchingVariant = -1
|
|
21
|
-
end
|
|
22
|
-
if matchingSubType == nil then
|
|
23
|
-
matchingSubType = -1
|
|
24
|
-
end
|
|
25
|
-
local entities = getEntities(nil, EntityType.ENTITY_FAMILIAR, matchingVariant, matchingSubType)
|
|
26
|
-
local familiars = {}
|
|
27
|
-
for ____, entity in ipairs(entities) do
|
|
28
|
-
local familiar = entity:ToFamiliar()
|
|
29
|
-
if familiar ~= nil then
|
|
30
|
-
__TS__ArrayPush(familiars, familiar)
|
|
31
|
-
end
|
|
32
|
-
end
|
|
33
|
-
return familiars
|
|
34
|
-
end
|
|
35
15
|
function ____exports.checkFamiliar(self, player, collectibleType, numTargetFamiliars, familiarVariant, familiarSubType)
|
|
36
16
|
local familiarSubTypeToSearchFor = familiarSubType == nil and -1 or familiarSubType
|
|
37
17
|
local playerPtrHash = GetPtrHash(player)
|
|
38
|
-
local familiars =
|
|
18
|
+
local familiars = getFamiliars(nil, familiarVariant, familiarSubTypeToSearchFor)
|
|
39
19
|
local familiarsForThisPlayer = __TS__ArrayFilter(
|
|
40
20
|
familiars,
|
|
41
21
|
function(____, familiar) return GetPtrHash(familiar.Player) == playerPtrHash end
|
|
@@ -57,18 +37,14 @@ function ____exports.checkFamiliar(self, player, collectibleType, numTargetFamil
|
|
|
57
37
|
numFamiliarsToSpawn,
|
|
58
38
|
function()
|
|
59
39
|
local seed = collectibleRNG:Next()
|
|
60
|
-
local familiar =
|
|
61
|
-
|
|
40
|
+
local familiar = spawnFamiliarWithSeed(
|
|
41
|
+
nil,
|
|
62
42
|
familiarVariant,
|
|
63
|
-
player.Position,
|
|
64
|
-
VectorZero,
|
|
65
|
-
player,
|
|
66
43
|
familiarSubTypeToUse,
|
|
44
|
+
player.Position,
|
|
67
45
|
seed
|
|
68
|
-
)
|
|
69
|
-
|
|
70
|
-
familiar.Player = player
|
|
71
|
-
end
|
|
46
|
+
)
|
|
47
|
+
familiar.Player = player
|
|
72
48
|
end
|
|
73
49
|
)
|
|
74
50
|
return numFamiliarsToSpawn
|
|
@@ -90,8 +66,4 @@ end
|
|
|
90
66
|
function ____exports.isFamiliarThatShootsPlayerTears(self, familiar)
|
|
91
67
|
return FAMILIARS_THAT_SHOOT_PLAYER_TEARS_SET:has(familiar.Type)
|
|
92
68
|
end
|
|
93
|
-
function ____exports.removeAllFamiliars(self, variant, subType, cap)
|
|
94
|
-
local familiars = ____exports.getFamiliars(nil, variant, subType)
|
|
95
|
-
return removeEntities(nil, familiars, cap)
|
|
96
|
-
end
|
|
97
69
|
return ____exports
|
|
@@ -83,7 +83,7 @@ export declare function isPostBossVoidPortal(gridEntity: GridEntity): boolean;
|
|
|
83
83
|
* );
|
|
84
84
|
* ```
|
|
85
85
|
*
|
|
86
|
-
* @returns True if one or more grid entities
|
|
86
|
+
* @returns True if one or more grid entities were removed, false otherwise.
|
|
87
87
|
*/
|
|
88
88
|
export declare function removeAllGridEntitiesExceptFor(...gridEntityTypes: GridEntityType[]): boolean;
|
|
89
89
|
/**
|
|
@@ -99,7 +99,7 @@ export declare function removeAllGridEntitiesExceptFor(...gridEntityTypes: GridE
|
|
|
99
99
|
* );
|
|
100
100
|
* ```
|
|
101
101
|
*
|
|
102
|
-
* @returns True if one or more grid entities
|
|
102
|
+
* @returns True if one or more grid entities were removed, false otherwise.
|
|
103
103
|
*/
|
|
104
104
|
export declare function removeAllMatchingGridEntities(...gridEntityType: GridEntityType[]): boolean;
|
|
105
105
|
/**
|
package/dist/functions/npc.d.ts
CHANGED
|
@@ -29,8 +29,6 @@ export declare function getAliveBosses(matchingEntityType?: EntityType | int, ma
|
|
|
29
29
|
export declare function getAliveNPCs(matchingEntityType?: EntityType | int, matchingVariant?: int, matchingSubType?: int, ignoreFriendly?: boolean): EntityNPC[];
|
|
30
30
|
/** Helper function to get all of the bosses in the room. */
|
|
31
31
|
export declare function getBosses(matchingEntityType?: EntityType | int, matchingVariant?: int, matchingSubType?: int, ignoreFriendly?: boolean): EntityNPC[];
|
|
32
|
-
/** The same thing as the `getEntities` function, but returns only NPCs. */
|
|
33
|
-
export declare function getNPCs(matchingEntityType?: EntityType | int, matchingVariant?: int, matchingSubType?: int, ignoreFriendly?: boolean): EntityNPC[];
|
|
34
32
|
/**
|
|
35
33
|
* Checks for specific NPCs that have "CanShutDoors" set to true naturally by the game, but should
|
|
36
34
|
* not actually keep the doors closed (like Death's scythes).
|
|
@@ -51,10 +49,3 @@ export declare function isDyingEggyWithNoSpidersLeft(npc: EntityNPC): boolean;
|
|
|
51
49
|
export declare function isRaglingDeathPatch(npc: EntityNPC): boolean;
|
|
52
50
|
/** Helper function to check if the provided NPC is a Sin miniboss, such as Sloth or Lust. */
|
|
53
51
|
export declare function isSin(npc: EntityNPC): boolean;
|
|
54
|
-
/**
|
|
55
|
-
* Helper function to remove all NPCs in the room.
|
|
56
|
-
*
|
|
57
|
-
* @param cap Optional. If specified, will only remove the given amount of NPCs.
|
|
58
|
-
* @returns True if one or more NPCs was removed, false otherwise.
|
|
59
|
-
*/
|
|
60
|
-
export declare function removeAllNPCs(cap?: int): boolean;
|
package/dist/functions/npc.lua
CHANGED
|
@@ -2,7 +2,6 @@ local ____lualib = require("lualib_bundle")
|
|
|
2
2
|
local Set = ____lualib.Set
|
|
3
3
|
local __TS__New = ____lualib.__TS__New
|
|
4
4
|
local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
|
|
5
|
-
local __TS__ArrayPush = ____lualib.__TS__ArrayPush
|
|
6
5
|
local ____exports = {}
|
|
7
6
|
local NON_ALIVE_NPCS_TYPE_VARIANT, NON_ALIVE_NPCS_TYPE_VARIANT_SUBTYPE
|
|
8
7
|
local ____constants = require("constants")
|
|
@@ -10,16 +9,15 @@ local EGGY_STATE_FRAME_OF_FINAL_SPIDER = ____constants.EGGY_STATE_FRAME_OF_FINAL
|
|
|
10
9
|
local ____sinEntityTypesSet = require("sets.sinEntityTypesSet")
|
|
11
10
|
local SIN_ENTITY_TYPES_SET = ____sinEntityTypesSet.SIN_ENTITY_TYPES_SET
|
|
12
11
|
local ____entity = require("functions.entity")
|
|
13
|
-
local getEntities = ____entity.getEntities
|
|
14
12
|
local getFilteredNewEntities = ____entity.getFilteredNewEntities
|
|
15
|
-
local removeEntities = ____entity.removeEntities
|
|
16
13
|
local ____entitySpecific = require("functions.entitySpecific")
|
|
14
|
+
local getNPCs = ____entitySpecific.getNPCs
|
|
17
15
|
local getProjectiles = ____entitySpecific.getProjectiles
|
|
18
16
|
function ____exports.getAliveNPCs(self, matchingEntityType, matchingVariant, matchingSubType, ignoreFriendly)
|
|
19
17
|
if ignoreFriendly == nil then
|
|
20
18
|
ignoreFriendly = false
|
|
21
19
|
end
|
|
22
|
-
local npcs =
|
|
20
|
+
local npcs = getNPCs(
|
|
23
21
|
nil,
|
|
24
22
|
matchingEntityType,
|
|
25
23
|
matchingVariant,
|
|
@@ -31,26 +29,6 @@ function ____exports.getAliveNPCs(self, matchingEntityType, matchingVariant, mat
|
|
|
31
29
|
function(____, npc) return not npc:IsDead() and not ____exports.isAliveExceptionNPC(nil, npc) end
|
|
32
30
|
)
|
|
33
31
|
end
|
|
34
|
-
function ____exports.getNPCs(self, matchingEntityType, matchingVariant, matchingSubType, ignoreFriendly)
|
|
35
|
-
if ignoreFriendly == nil then
|
|
36
|
-
ignoreFriendly = false
|
|
37
|
-
end
|
|
38
|
-
local entities = getEntities(
|
|
39
|
-
nil,
|
|
40
|
-
matchingEntityType,
|
|
41
|
-
matchingVariant,
|
|
42
|
-
matchingSubType,
|
|
43
|
-
ignoreFriendly
|
|
44
|
-
)
|
|
45
|
-
local npcs = {}
|
|
46
|
-
for ____, entity in ipairs(entities) do
|
|
47
|
-
local npc = entity:ToNPC()
|
|
48
|
-
if npc ~= nil then
|
|
49
|
-
__TS__ArrayPush(npcs, npc)
|
|
50
|
-
end
|
|
51
|
-
end
|
|
52
|
-
return npcs
|
|
53
|
-
end
|
|
54
32
|
function ____exports.isAliveExceptionNPC(self, npc)
|
|
55
33
|
local entityTypeVariant = (tostring(npc.Type) .. ".") .. tostring(npc.Variant)
|
|
56
34
|
if NON_ALIVE_NPCS_TYPE_VARIANT:has(entityTypeVariant) then
|
|
@@ -129,7 +107,7 @@ function ____exports.getBosses(self, matchingEntityType, matchingVariant, matchi
|
|
|
129
107
|
if ignoreFriendly == nil then
|
|
130
108
|
ignoreFriendly = false
|
|
131
109
|
end
|
|
132
|
-
local npcs =
|
|
110
|
+
local npcs = getNPCs(
|
|
133
111
|
nil,
|
|
134
112
|
matchingEntityType,
|
|
135
113
|
matchingVariant,
|
|
@@ -144,8 +122,4 @@ end
|
|
|
144
122
|
function ____exports.isSin(self, npc)
|
|
145
123
|
return SIN_ENTITY_TYPES_SET:has(npc.Type)
|
|
146
124
|
end
|
|
147
|
-
function ____exports.removeAllNPCs(self, cap)
|
|
148
|
-
local npcs = ____exports.getNPCs(nil)
|
|
149
|
-
return removeEntities(nil, npcs, cap)
|
|
150
|
-
end
|
|
151
125
|
return ____exports
|