isaacscript-common 1.2.76 → 1.2.79
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/postPurchase.lua +2 -2
- package/dist/callbacks/postSlotInitUpdate.lua +2 -2
- package/dist/callbacks/postSlotRenderBroken.lua +2 -2
- package/dist/constants.d.ts +1 -0
- package/dist/constants.lua +14 -0
- package/dist/features/deployJSONRoom.d.ts +2 -0
- package/dist/features/deployJSONRoom.lua +4 -2
- package/dist/functions/array.d.ts +7 -5
- package/dist/functions/array.lua +16 -14
- package/dist/functions/collectibles.lua +3 -3
- package/dist/functions/entity.d.ts +12 -206
- package/dist/functions/entity.lua +20 -224
- package/dist/functions/entitySpecific.d.ts +148 -0
- package/dist/functions/entitySpecific.lua +148 -0
- package/dist/functions/npc.lua +2 -1
- package/dist/functions/pickups.d.ts +21 -0
- package/dist/functions/pickups.lua +27 -16
- package/dist/functions/player.lua +2 -1
- package/dist/functions/positionVelocity.d.ts +59 -0
- package/dist/functions/positionVelocity.lua +90 -0
- package/dist/functions/rooms.lua +5 -4
- package/dist/functions/trinkets.lua +2 -2
- package/dist/index.d.ts +2 -1
- package/dist/index.lua +9 -1
- package/package.json +1 -1
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
2
|
local ____lualib = require("lualib_bundle")
|
|
3
3
|
local __TS__ArraySome = ____lualib.__TS__ArraySome
|
|
4
|
-
local __TS__ArrayPush = ____lualib.__TS__ArrayPush
|
|
5
4
|
local Set = ____lualib.Set
|
|
6
5
|
local __TS__New = ____lualib.__TS__New
|
|
7
6
|
local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
|
|
8
|
-
local
|
|
7
|
+
local __TS__ArrayPush = ____lualib.__TS__ArrayPush
|
|
9
8
|
local ____exports = {}
|
|
10
9
|
local ____constants = require("constants")
|
|
11
10
|
local STORY_BOSSES = ____constants.STORY_BOSSES
|
|
@@ -14,20 +13,19 @@ local getRandom = ____random.getRandom
|
|
|
14
13
|
local nextSeed = ____random.nextSeed
|
|
15
14
|
local ____utils = require("functions.utils")
|
|
16
15
|
local ____repeat = ____utils["repeat"]
|
|
17
|
-
function ____exports.
|
|
18
|
-
if
|
|
19
|
-
|
|
20
|
-
end
|
|
21
|
-
if matchingSubType == nil then
|
|
22
|
-
matchingSubType = -1
|
|
23
|
-
end
|
|
24
|
-
if ignoreFriendly == nil then
|
|
25
|
-
ignoreFriendly = false
|
|
16
|
+
function ____exports.removeEntities(self, entities, cap)
|
|
17
|
+
if #entities == 0 then
|
|
18
|
+
return false
|
|
26
19
|
end
|
|
27
|
-
|
|
28
|
-
|
|
20
|
+
local numEntitiesRemoved = 0
|
|
21
|
+
for ____, entity in ipairs(entities) do
|
|
22
|
+
entity:Remove()
|
|
23
|
+
numEntitiesRemoved = numEntitiesRemoved + 1
|
|
24
|
+
if cap ~= nil and numEntitiesRemoved >= cap then
|
|
25
|
+
return true
|
|
26
|
+
end
|
|
29
27
|
end
|
|
30
|
-
return
|
|
28
|
+
return true
|
|
31
29
|
end
|
|
32
30
|
function ____exports.anyEntityCloserThan(self, entities, position, distance)
|
|
33
31
|
return __TS__ArraySome(
|
|
@@ -35,23 +33,6 @@ function ____exports.anyEntityCloserThan(self, entities, position, distance)
|
|
|
35
33
|
function(____, entity) return position:Distance(entity.Position) <= distance end
|
|
36
34
|
)
|
|
37
35
|
end
|
|
38
|
-
function ____exports.getBombs(self, matchingVariant, matchingSubType)
|
|
39
|
-
if matchingVariant == nil then
|
|
40
|
-
matchingVariant = -1
|
|
41
|
-
end
|
|
42
|
-
if matchingSubType == nil then
|
|
43
|
-
matchingSubType = -1
|
|
44
|
-
end
|
|
45
|
-
local entities = ____exports.getEntities(nil, EntityType.ENTITY_BOMB, matchingVariant, matchingSubType)
|
|
46
|
-
local bombs = {}
|
|
47
|
-
for ____, entity in ipairs(entities) do
|
|
48
|
-
local bomb = entity:ToBomb()
|
|
49
|
-
if bomb ~= nil then
|
|
50
|
-
__TS__ArrayPush(bombs, bomb)
|
|
51
|
-
end
|
|
52
|
-
end
|
|
53
|
-
return bombs
|
|
54
|
-
end
|
|
55
36
|
function ____exports.getClosestEntityTo(self, referenceEntity, entities)
|
|
56
37
|
local closestEntity = nil
|
|
57
38
|
local closestDistance = math.huge
|
|
@@ -81,139 +62,20 @@ function ____exports.getFilteredNewEntities(self, oldEntities, newEntities)
|
|
|
81
62
|
end
|
|
82
63
|
)
|
|
83
64
|
end
|
|
84
|
-
function ____exports.
|
|
85
|
-
if matchingVariant == nil then
|
|
86
|
-
matchingVariant = -1
|
|
87
|
-
end
|
|
88
|
-
if matchingSubType == nil then
|
|
89
|
-
matchingSubType = -1
|
|
90
|
-
end
|
|
91
|
-
local entities = ____exports.getEntities(nil, EntityType.ENTITY_EFFECT, matchingVariant, matchingSubType)
|
|
92
|
-
local effects = {}
|
|
93
|
-
for ____, entity in ipairs(entities) do
|
|
94
|
-
local effect = entity:ToEffect()
|
|
95
|
-
if effect ~= nil then
|
|
96
|
-
__TS__ArrayPush(effects, effect)
|
|
97
|
-
end
|
|
98
|
-
end
|
|
99
|
-
return effects
|
|
100
|
-
end
|
|
101
|
-
function ____exports.getEntityPositions(self, entities)
|
|
102
|
-
if entities == nil then
|
|
103
|
-
entities = ____exports.getEntities(nil)
|
|
104
|
-
end
|
|
105
|
-
local entityPositions = __TS__New(Map)
|
|
106
|
-
for ____, entity in ipairs(entities) do
|
|
107
|
-
local ptrHash = GetPtrHash(entity)
|
|
108
|
-
entityPositions:set(ptrHash, entity.Position)
|
|
109
|
-
end
|
|
110
|
-
return entityPositions
|
|
111
|
-
end
|
|
112
|
-
function ____exports.getEntityVelocities(self, entities)
|
|
113
|
-
if entities == nil then
|
|
114
|
-
entities = ____exports.getEntities(nil)
|
|
115
|
-
end
|
|
116
|
-
local entityVelocities = __TS__New(Map)
|
|
117
|
-
for ____, entity in ipairs(entities) do
|
|
118
|
-
local ptrHash = GetPtrHash(entity)
|
|
119
|
-
entityVelocities:set(ptrHash, entity.Velocity)
|
|
120
|
-
end
|
|
121
|
-
return entityVelocities
|
|
122
|
-
end
|
|
123
|
-
function ____exports.getKnives(self, matchingVariant, matchingSubType)
|
|
124
|
-
if matchingVariant == nil then
|
|
125
|
-
matchingVariant = -1
|
|
126
|
-
end
|
|
127
|
-
if matchingSubType == nil then
|
|
128
|
-
matchingSubType = -1
|
|
129
|
-
end
|
|
130
|
-
local entities = ____exports.getEntities(nil, EntityType.ENTITY_KNIFE, matchingVariant, matchingSubType)
|
|
131
|
-
local knives = {}
|
|
132
|
-
for ____, entity in ipairs(entities) do
|
|
133
|
-
local knife = entity:ToKnife()
|
|
134
|
-
if knife ~= nil then
|
|
135
|
-
__TS__ArrayPush(knives, knife)
|
|
136
|
-
end
|
|
137
|
-
end
|
|
138
|
-
return knives
|
|
139
|
-
end
|
|
140
|
-
function ____exports.getLasers(self, matchingVariant, matchingSubType)
|
|
141
|
-
if matchingVariant == nil then
|
|
142
|
-
matchingVariant = -1
|
|
143
|
-
end
|
|
144
|
-
if matchingSubType == nil then
|
|
145
|
-
matchingSubType = -1
|
|
146
|
-
end
|
|
147
|
-
local entities = ____exports.getEntities(nil, EntityType.ENTITY_LASER, matchingVariant, matchingSubType)
|
|
148
|
-
local lasers = {}
|
|
149
|
-
for ____, entity in ipairs(entities) do
|
|
150
|
-
local laser = entity:ToLaser()
|
|
151
|
-
if laser ~= nil then
|
|
152
|
-
__TS__ArrayPush(lasers, laser)
|
|
153
|
-
end
|
|
154
|
-
end
|
|
155
|
-
return lasers
|
|
156
|
-
end
|
|
157
|
-
function ____exports.getPickups(self, matchingVariant, matchingSubType)
|
|
158
|
-
if matchingVariant == nil then
|
|
159
|
-
matchingVariant = -1
|
|
160
|
-
end
|
|
161
|
-
if matchingSubType == nil then
|
|
162
|
-
matchingSubType = -1
|
|
163
|
-
end
|
|
164
|
-
local entities = ____exports.getEntities(nil, EntityType.ENTITY_PICKUP, matchingVariant, matchingSubType)
|
|
165
|
-
local pickups = {}
|
|
166
|
-
for ____, entity in ipairs(entities) do
|
|
167
|
-
local pickup = entity:ToPickup()
|
|
168
|
-
if pickup ~= nil then
|
|
169
|
-
__TS__ArrayPush(pickups, pickup)
|
|
170
|
-
end
|
|
171
|
-
end
|
|
172
|
-
return pickups
|
|
173
|
-
end
|
|
174
|
-
function ____exports.getProjectiles(self, matchingVariant, matchingSubType)
|
|
175
|
-
if matchingVariant == nil then
|
|
176
|
-
matchingVariant = -1
|
|
177
|
-
end
|
|
178
|
-
if matchingSubType == nil then
|
|
179
|
-
matchingSubType = -1
|
|
180
|
-
end
|
|
181
|
-
local entities = ____exports.getEntities(nil, EntityType.ENTITY_PROJECTILE, matchingVariant, matchingSubType)
|
|
182
|
-
local projectiles = {}
|
|
183
|
-
for ____, entity in ipairs(entities) do
|
|
184
|
-
local projectile = entity:ToProjectile()
|
|
185
|
-
if projectile ~= nil then
|
|
186
|
-
__TS__ArrayPush(projectiles, projectile)
|
|
187
|
-
end
|
|
188
|
-
end
|
|
189
|
-
return projectiles
|
|
190
|
-
end
|
|
191
|
-
function ____exports.getSlots(self, matchingVariant, matchingSubType)
|
|
65
|
+
function ____exports.getEntities(self, matchingEntityType, matchingVariant, matchingSubType, ignoreFriendly)
|
|
192
66
|
if matchingVariant == nil then
|
|
193
67
|
matchingVariant = -1
|
|
194
68
|
end
|
|
195
69
|
if matchingSubType == nil then
|
|
196
70
|
matchingSubType = -1
|
|
197
71
|
end
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
end
|
|
201
|
-
function ____exports.getTears(self, matchingVariant, matchingSubType)
|
|
202
|
-
if matchingVariant == nil then
|
|
203
|
-
matchingVariant = -1
|
|
204
|
-
end
|
|
205
|
-
if matchingSubType == nil then
|
|
206
|
-
matchingSubType = -1
|
|
72
|
+
if ignoreFriendly == nil then
|
|
73
|
+
ignoreFriendly = false
|
|
207
74
|
end
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
for ____, entity in ipairs(entities) do
|
|
211
|
-
local tear = entity:ToTear()
|
|
212
|
-
if tear ~= nil then
|
|
213
|
-
__TS__ArrayPush(tears, tear)
|
|
214
|
-
end
|
|
75
|
+
if matchingEntityType == nil then
|
|
76
|
+
return Isaac.GetRoomEntities()
|
|
215
77
|
end
|
|
216
|
-
return
|
|
78
|
+
return Isaac.FindByType(matchingEntityType, matchingVariant, matchingSubType, ignoreFriendly)
|
|
217
79
|
end
|
|
218
80
|
function ____exports.isEntityMoving(self, entity, threshold)
|
|
219
81
|
if threshold == nil then
|
|
@@ -224,36 +86,6 @@ end
|
|
|
224
86
|
function ____exports.isStoryBoss(self, entity)
|
|
225
87
|
return STORY_BOSSES:has(entity.Type)
|
|
226
88
|
end
|
|
227
|
-
function ____exports.removeEntities(self, entities, cap)
|
|
228
|
-
if #entities == 0 then
|
|
229
|
-
return false
|
|
230
|
-
end
|
|
231
|
-
local numEntitiesRemoved = 0
|
|
232
|
-
for ____, entity in ipairs(entities) do
|
|
233
|
-
entity:Remove()
|
|
234
|
-
numEntitiesRemoved = numEntitiesRemoved + 1
|
|
235
|
-
if cap ~= nil and numEntitiesRemoved >= cap then
|
|
236
|
-
return true
|
|
237
|
-
end
|
|
238
|
-
end
|
|
239
|
-
return true
|
|
240
|
-
end
|
|
241
|
-
function ____exports.removeAllBombs(self, variant, subType, cap)
|
|
242
|
-
local bombs = ____exports.getBombs(nil, variant, subType)
|
|
243
|
-
return ____exports.removeEntities(nil, bombs, cap)
|
|
244
|
-
end
|
|
245
|
-
function ____exports.removeAllEffects(self, variant, subType, cap)
|
|
246
|
-
local effects = ____exports.getEffects(nil, variant, subType)
|
|
247
|
-
return ____exports.removeEntities(nil, effects, cap)
|
|
248
|
-
end
|
|
249
|
-
function ____exports.removeAllKnives(self, variant, subType, cap)
|
|
250
|
-
local knives = ____exports.getKnives(nil, variant, subType)
|
|
251
|
-
return ____exports.removeEntities(nil, knives, cap)
|
|
252
|
-
end
|
|
253
|
-
function ____exports.removeAllLasers(self, variant, subType, cap)
|
|
254
|
-
local lasers = ____exports.getLasers(nil, variant, subType)
|
|
255
|
-
return ____exports.removeEntities(nil, lasers, cap)
|
|
256
|
-
end
|
|
257
89
|
function ____exports.removeAllMatchingEntities(self, entityType, entityVariant, entitySubType, cap)
|
|
258
90
|
if entityVariant == nil then
|
|
259
91
|
entityVariant = -1
|
|
@@ -267,44 +99,20 @@ function ____exports.removeAllMatchingEntities(self, entityType, entityVariant,
|
|
|
267
99
|
local entities = ____exports.getEntities(nil, entityType, entityVariant, entitySubType)
|
|
268
100
|
return ____exports.removeEntities(nil, entities, cap)
|
|
269
101
|
end
|
|
270
|
-
function ____exports.removeAllPickups(self, variant, subType, cap)
|
|
271
|
-
local pickups = ____exports.getPickups(nil, variant, subType)
|
|
272
|
-
return ____exports.removeEntities(nil, pickups, cap)
|
|
273
|
-
end
|
|
274
|
-
function ____exports.removeAllProjectiles(self, variant, subType, cap)
|
|
275
|
-
local projectiles = ____exports.getProjectiles(nil, variant, subType)
|
|
276
|
-
return ____exports.removeEntities(nil, projectiles, cap)
|
|
277
|
-
end
|
|
278
|
-
function ____exports.removeAllTears(self, variant, subType, cap)
|
|
279
|
-
local tears = ____exports.getTears(nil, variant, subType)
|
|
280
|
-
return ____exports.removeEntities(nil, tears, cap)
|
|
281
|
-
end
|
|
282
102
|
function ____exports.rerollEnemy(self, entity)
|
|
283
103
|
local game = Game()
|
|
284
104
|
local oldEntities = ____exports.getEntities(nil)
|
|
285
105
|
local wasRerolled = game:RerollEnemy(entity)
|
|
286
106
|
if not wasRerolled then
|
|
287
|
-
return
|
|
107
|
+
return nil
|
|
288
108
|
end
|
|
289
109
|
local newEntities = ____exports.getEntities(nil)
|
|
290
110
|
local filteredNewEntities = ____exports.getFilteredNewEntities(nil, oldEntities, newEntities)
|
|
291
|
-
if #filteredNewEntities
|
|
111
|
+
if #filteredNewEntities == 0 then
|
|
292
112
|
error("Failed to find the new entity generated by the \"RerollEnemy\" method.")
|
|
293
113
|
end
|
|
294
114
|
return filteredNewEntities[1]
|
|
295
115
|
end
|
|
296
|
-
function ____exports.setEntityPositions(self, entityPositions, entities)
|
|
297
|
-
if entities == nil then
|
|
298
|
-
entities = ____exports.getEntities(nil)
|
|
299
|
-
end
|
|
300
|
-
for ____, entity in ipairs(entities) do
|
|
301
|
-
local ptrHash = GetPtrHash(entity)
|
|
302
|
-
local entityPosition = entityPositions:get(ptrHash)
|
|
303
|
-
if entityPosition ~= nil then
|
|
304
|
-
entity.Position = entityPosition
|
|
305
|
-
end
|
|
306
|
-
end
|
|
307
|
-
end
|
|
308
116
|
function ____exports.setEntityRandomColor(self, entity)
|
|
309
117
|
local colorValues = {}
|
|
310
118
|
local seed = entity.InitSeed
|
|
@@ -326,16 +134,4 @@ function ____exports.setEntityRandomColor(self, entity)
|
|
|
326
134
|
false
|
|
327
135
|
)
|
|
328
136
|
end
|
|
329
|
-
function ____exports.setEntityVelocities(self, entityVelocities, entities)
|
|
330
|
-
if entities == nil then
|
|
331
|
-
entities = ____exports.getEntities(nil)
|
|
332
|
-
end
|
|
333
|
-
for ____, entity in ipairs(entities) do
|
|
334
|
-
local ptrHash = GetPtrHash(entity)
|
|
335
|
-
local entityVelocity = entityVelocities:get(ptrHash)
|
|
336
|
-
if entityVelocity ~= nil then
|
|
337
|
-
entity.Velocity = entityVelocity
|
|
338
|
-
end
|
|
339
|
-
end
|
|
340
|
-
end
|
|
341
137
|
return ____exports
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
/// <reference types="isaac-typescript-definitions" />
|
|
2
|
+
/**
|
|
3
|
+
* Helper function to get all of the bombs in the room.
|
|
4
|
+
*
|
|
5
|
+
* Example:
|
|
6
|
+
* ```
|
|
7
|
+
* // Make all of the bombs in the room invisible
|
|
8
|
+
* for (const bomb of getBombs()) {
|
|
9
|
+
* bomb.Visible = false;
|
|
10
|
+
* }
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
13
|
+
export declare function getBombs(matchingVariant?: BombVariant | int, matchingSubType?: number): EntityBomb[];
|
|
14
|
+
/**
|
|
15
|
+
* Helper function to get all of the effects in the room.
|
|
16
|
+
*
|
|
17
|
+
* Example:
|
|
18
|
+
* ```
|
|
19
|
+
* // Make all of the effects in the room invisible
|
|
20
|
+
* for (const effect of getEffects()) {
|
|
21
|
+
* effect.Visible = false;
|
|
22
|
+
* }
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export declare function getEffects(matchingVariant?: EffectVariant | int, matchingSubType?: number): EntityEffect[];
|
|
26
|
+
/**
|
|
27
|
+
* Helper function to get all of the knives in the room.
|
|
28
|
+
*
|
|
29
|
+
* Example:
|
|
30
|
+
* ```
|
|
31
|
+
* // Make all of the knives in the room invisible
|
|
32
|
+
* for (const knife of getKnives()) {
|
|
33
|
+
* knife.Visible = false;
|
|
34
|
+
* }
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
export declare function getKnives(matchingVariant?: KnifeVariant | int, matchingSubType?: number): EntityKnife[];
|
|
38
|
+
/**
|
|
39
|
+
* Helper function to get all of the lasers in the room.
|
|
40
|
+
*
|
|
41
|
+
* Example:
|
|
42
|
+
* ```
|
|
43
|
+
* // Make all of the lasers in the room invisible
|
|
44
|
+
* for (const laser of getLasers()) {
|
|
45
|
+
* laser.Visible = false;
|
|
46
|
+
* }
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
export declare function getLasers(matchingVariant?: LaserVariant | int, matchingSubType?: number): EntityLaser[];
|
|
50
|
+
/**
|
|
51
|
+
* Helper function to get all of the projectiles in the room.
|
|
52
|
+
*
|
|
53
|
+
* Example:
|
|
54
|
+
* ```
|
|
55
|
+
* // Make all of the projectiles in the room invisible
|
|
56
|
+
* for (const projectile of getProjectiles()) {
|
|
57
|
+
* projectile.Visible = false;
|
|
58
|
+
* }
|
|
59
|
+
* ```
|
|
60
|
+
*/
|
|
61
|
+
export declare function getProjectiles(matchingVariant?: ProjectileVariant | int, matchingSubType?: number): EntityProjectile[];
|
|
62
|
+
/**
|
|
63
|
+
* Helper function to get all of the slots in the room.
|
|
64
|
+
*
|
|
65
|
+
* Example:
|
|
66
|
+
* ```
|
|
67
|
+
* // Make all of the slots in the room invisible
|
|
68
|
+
* for (const slot of getSlots()) {
|
|
69
|
+
* slot.Visible = false;
|
|
70
|
+
* }
|
|
71
|
+
* ```
|
|
72
|
+
*/
|
|
73
|
+
export declare function getSlots(matchingVariant?: SlotVariant | int, matchingSubType?: number): Entity[];
|
|
74
|
+
/**
|
|
75
|
+
* Helper function to get all of the tears in the room.
|
|
76
|
+
*
|
|
77
|
+
* Example:
|
|
78
|
+
* ```
|
|
79
|
+
* // Make all of the tears in the room invisible
|
|
80
|
+
* for (const tear of getTears()) {
|
|
81
|
+
* tear.Visible = false;
|
|
82
|
+
* }
|
|
83
|
+
* ```
|
|
84
|
+
*/
|
|
85
|
+
export declare function getTears(matchingVariant?: TearVariant | int, matchingSubType?: number): EntityTear[];
|
|
86
|
+
/**
|
|
87
|
+
* Helper function to remove all of the bombs in the room.
|
|
88
|
+
*
|
|
89
|
+
* @param variant Optional. If specified, will only remove bombs that match this variant.
|
|
90
|
+
* @param subType Optional. If specified, will only remove bombs that match this sub-type.
|
|
91
|
+
* @param cap Optional. If specified, will only remove the given amount of bombs.
|
|
92
|
+
* @returns True if one or more bombs was removed, false otherwise.
|
|
93
|
+
*/
|
|
94
|
+
export declare function removeAllBombs(variant?: BombVariant | int, subType?: int, cap?: int): boolean;
|
|
95
|
+
/**
|
|
96
|
+
* Helper function to remove all of the effects in the room.
|
|
97
|
+
*
|
|
98
|
+
* @param variant Optional. If specified, will only remove effects that match this variant.
|
|
99
|
+
* @param subType Optional. If specified, will only remove effects that match this sub-type.
|
|
100
|
+
* @param cap Optional. If specified, will only remove the given amount of effects.
|
|
101
|
+
* @returns True if one or more effects was removed, false otherwise.
|
|
102
|
+
*/
|
|
103
|
+
export declare function removeAllEffects(variant?: EffectVariant | int, subType?: int, cap?: int): boolean;
|
|
104
|
+
/**
|
|
105
|
+
* Helper function to remove all of the knives in the room.
|
|
106
|
+
*
|
|
107
|
+
* @param variant Optional. If specified, will only remove knives that match this variant.
|
|
108
|
+
* @param subType Optional. If specified, will only remove knives that match this sub-type.
|
|
109
|
+
* @param cap Optional. If specified, will only remove the given amount of knives.
|
|
110
|
+
* @returns True if one or more knives was removed, false otherwise.
|
|
111
|
+
*/
|
|
112
|
+
export declare function removeAllKnives(variant?: KnifeVariant | int, subType?: int, cap?: int): boolean;
|
|
113
|
+
/**
|
|
114
|
+
* Helper function to remove all of the lasers in the room.
|
|
115
|
+
*
|
|
116
|
+
* @param variant Optional. If specified, will only remove lasers that match this variant.
|
|
117
|
+
* @param subType Optional. If specified, will only remove lasers that match this sub-type.
|
|
118
|
+
* @param cap Optional. If specified, will only remove the given amount of lasers.
|
|
119
|
+
* @returns True if one or more lasers was removed, false otherwise.
|
|
120
|
+
*/
|
|
121
|
+
export declare function removeAllLasers(variant?: LaserVariant | int, subType?: int, cap?: int): boolean;
|
|
122
|
+
/**
|
|
123
|
+
* Helper function to remove all of the projectiles in the room.
|
|
124
|
+
*
|
|
125
|
+
* @param variant Optional. If specified, will only remove projectiles that match this variant.
|
|
126
|
+
* @param subType Optional. If specified, will only remove projectiles that match this sub-type.
|
|
127
|
+
* @param cap Optional. If specified, will only remove the given amount of projectiles.
|
|
128
|
+
* @returns True if one or more projectiles was removed, false otherwise.
|
|
129
|
+
*/
|
|
130
|
+
export declare function removeAllProjectiles(variant?: ProjectileVariant | int, subType?: int, cap?: int): boolean;
|
|
131
|
+
/**
|
|
132
|
+
* Helper function to remove all of the slots in the room.
|
|
133
|
+
*
|
|
134
|
+
* @param variant Optional. If specified, will only remove slots that match this variant.
|
|
135
|
+
* @param subType Optional. If specified, will only remove slots that match this sub-type.
|
|
136
|
+
* @param cap Optional. If specified, will only remove the given amount of slots.
|
|
137
|
+
* @returns True if one or more slots was removed, false otherwise.
|
|
138
|
+
*/
|
|
139
|
+
export declare function removeAllSlots(variant?: SlotVariant | int, subType?: int, cap?: int): boolean;
|
|
140
|
+
/**
|
|
141
|
+
* Helper function to remove all of the tears in the room.
|
|
142
|
+
*
|
|
143
|
+
* @param variant Optional. If specified, will only remove tears that match this variant.
|
|
144
|
+
* @param subType Optional. If specified, will only remove tears that match this sub-type.
|
|
145
|
+
* @param cap Optional. If specified, will only remove the given amount of tears.
|
|
146
|
+
* @returns True if one or more tears was removed, false otherwise.
|
|
147
|
+
*/
|
|
148
|
+
export declare function removeAllTears(variant?: TearVariant | int, subType?: int, cap?: int): boolean;
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
|
+
local ____lualib = require("lualib_bundle")
|
|
3
|
+
local __TS__ArrayPush = ____lualib.__TS__ArrayPush
|
|
4
|
+
local ____exports = {}
|
|
5
|
+
local ____entity = require("functions.entity")
|
|
6
|
+
local getEntities = ____entity.getEntities
|
|
7
|
+
local removeEntities = ____entity.removeEntities
|
|
8
|
+
function ____exports.getBombs(self, matchingVariant, matchingSubType)
|
|
9
|
+
if matchingVariant == nil then
|
|
10
|
+
matchingVariant = -1
|
|
11
|
+
end
|
|
12
|
+
if matchingSubType == nil then
|
|
13
|
+
matchingSubType = -1
|
|
14
|
+
end
|
|
15
|
+
local entities = getEntities(nil, EntityType.ENTITY_BOMB, matchingVariant, matchingSubType)
|
|
16
|
+
local bombs = {}
|
|
17
|
+
for ____, entity in ipairs(entities) do
|
|
18
|
+
local bomb = entity:ToBomb()
|
|
19
|
+
if bomb ~= nil then
|
|
20
|
+
__TS__ArrayPush(bombs, bomb)
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
return bombs
|
|
24
|
+
end
|
|
25
|
+
function ____exports.getEffects(self, matchingVariant, matchingSubType)
|
|
26
|
+
if matchingVariant == nil then
|
|
27
|
+
matchingVariant = -1
|
|
28
|
+
end
|
|
29
|
+
if matchingSubType == nil then
|
|
30
|
+
matchingSubType = -1
|
|
31
|
+
end
|
|
32
|
+
local entities = getEntities(nil, EntityType.ENTITY_EFFECT, matchingVariant, matchingSubType)
|
|
33
|
+
local effects = {}
|
|
34
|
+
for ____, entity in ipairs(entities) do
|
|
35
|
+
local effect = entity:ToEffect()
|
|
36
|
+
if effect ~= nil then
|
|
37
|
+
__TS__ArrayPush(effects, effect)
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
return effects
|
|
41
|
+
end
|
|
42
|
+
function ____exports.getKnives(self, matchingVariant, matchingSubType)
|
|
43
|
+
if matchingVariant == nil then
|
|
44
|
+
matchingVariant = -1
|
|
45
|
+
end
|
|
46
|
+
if matchingSubType == nil then
|
|
47
|
+
matchingSubType = -1
|
|
48
|
+
end
|
|
49
|
+
local entities = getEntities(nil, EntityType.ENTITY_KNIFE, matchingVariant, matchingSubType)
|
|
50
|
+
local knives = {}
|
|
51
|
+
for ____, entity in ipairs(entities) do
|
|
52
|
+
local knife = entity:ToKnife()
|
|
53
|
+
if knife ~= nil then
|
|
54
|
+
__TS__ArrayPush(knives, knife)
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
return knives
|
|
58
|
+
end
|
|
59
|
+
function ____exports.getLasers(self, matchingVariant, matchingSubType)
|
|
60
|
+
if matchingVariant == nil then
|
|
61
|
+
matchingVariant = -1
|
|
62
|
+
end
|
|
63
|
+
if matchingSubType == nil then
|
|
64
|
+
matchingSubType = -1
|
|
65
|
+
end
|
|
66
|
+
local entities = getEntities(nil, EntityType.ENTITY_LASER, matchingVariant, matchingSubType)
|
|
67
|
+
local lasers = {}
|
|
68
|
+
for ____, entity in ipairs(entities) do
|
|
69
|
+
local laser = entity:ToLaser()
|
|
70
|
+
if laser ~= nil then
|
|
71
|
+
__TS__ArrayPush(lasers, laser)
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
return lasers
|
|
75
|
+
end
|
|
76
|
+
function ____exports.getProjectiles(self, matchingVariant, matchingSubType)
|
|
77
|
+
if matchingVariant == nil then
|
|
78
|
+
matchingVariant = -1
|
|
79
|
+
end
|
|
80
|
+
if matchingSubType == nil then
|
|
81
|
+
matchingSubType = -1
|
|
82
|
+
end
|
|
83
|
+
local entities = getEntities(nil, EntityType.ENTITY_PROJECTILE, matchingVariant, matchingSubType)
|
|
84
|
+
local projectiles = {}
|
|
85
|
+
for ____, entity in ipairs(entities) do
|
|
86
|
+
local projectile = entity:ToProjectile()
|
|
87
|
+
if projectile ~= nil then
|
|
88
|
+
__TS__ArrayPush(projectiles, projectile)
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
return projectiles
|
|
92
|
+
end
|
|
93
|
+
function ____exports.getSlots(self, matchingVariant, matchingSubType)
|
|
94
|
+
if matchingVariant == nil then
|
|
95
|
+
matchingVariant = -1
|
|
96
|
+
end
|
|
97
|
+
if matchingSubType == nil then
|
|
98
|
+
matchingSubType = -1
|
|
99
|
+
end
|
|
100
|
+
local slots = getEntities(nil, EntityType.ENTITY_SLOT, matchingVariant, matchingSubType)
|
|
101
|
+
return slots
|
|
102
|
+
end
|
|
103
|
+
function ____exports.getTears(self, matchingVariant, matchingSubType)
|
|
104
|
+
if matchingVariant == nil then
|
|
105
|
+
matchingVariant = -1
|
|
106
|
+
end
|
|
107
|
+
if matchingSubType == nil then
|
|
108
|
+
matchingSubType = -1
|
|
109
|
+
end
|
|
110
|
+
local entities = getEntities(nil, EntityType.ENTITY_TEAR, matchingVariant, matchingSubType)
|
|
111
|
+
local tears = {}
|
|
112
|
+
for ____, entity in ipairs(entities) do
|
|
113
|
+
local tear = entity:ToTear()
|
|
114
|
+
if tear ~= nil then
|
|
115
|
+
__TS__ArrayPush(tears, tear)
|
|
116
|
+
end
|
|
117
|
+
end
|
|
118
|
+
return tears
|
|
119
|
+
end
|
|
120
|
+
function ____exports.removeAllBombs(self, variant, subType, cap)
|
|
121
|
+
local bombs = ____exports.getBombs(nil, variant, subType)
|
|
122
|
+
return removeEntities(nil, bombs, cap)
|
|
123
|
+
end
|
|
124
|
+
function ____exports.removeAllEffects(self, variant, subType, cap)
|
|
125
|
+
local effects = ____exports.getEffects(nil, variant, subType)
|
|
126
|
+
return removeEntities(nil, effects, cap)
|
|
127
|
+
end
|
|
128
|
+
function ____exports.removeAllKnives(self, variant, subType, cap)
|
|
129
|
+
local knives = ____exports.getKnives(nil, variant, subType)
|
|
130
|
+
return removeEntities(nil, knives, cap)
|
|
131
|
+
end
|
|
132
|
+
function ____exports.removeAllLasers(self, variant, subType, cap)
|
|
133
|
+
local lasers = ____exports.getLasers(nil, variant, subType)
|
|
134
|
+
return removeEntities(nil, lasers, cap)
|
|
135
|
+
end
|
|
136
|
+
function ____exports.removeAllProjectiles(self, variant, subType, cap)
|
|
137
|
+
local projectiles = ____exports.getProjectiles(nil, variant, subType)
|
|
138
|
+
return removeEntities(nil, projectiles, cap)
|
|
139
|
+
end
|
|
140
|
+
function ____exports.removeAllSlots(self, variant, subType, cap)
|
|
141
|
+
local slots = ____exports.getSlots(nil, variant, subType)
|
|
142
|
+
return removeEntities(nil, slots, cap)
|
|
143
|
+
end
|
|
144
|
+
function ____exports.removeAllTears(self, variant, subType, cap)
|
|
145
|
+
local tears = ____exports.getTears(nil, variant, subType)
|
|
146
|
+
return removeEntities(nil, tears, cap)
|
|
147
|
+
end
|
|
148
|
+
return ____exports
|
package/dist/functions/npc.lua
CHANGED
|
@@ -11,8 +11,9 @@ local EGGY_STATE_FRAME_OF_FINAL_SPIDER = ____constants.EGGY_STATE_FRAME_OF_FINAL
|
|
|
11
11
|
local ____entity = require("functions.entity")
|
|
12
12
|
local getEntities = ____entity.getEntities
|
|
13
13
|
local getFilteredNewEntities = ____entity.getFilteredNewEntities
|
|
14
|
-
local getProjectiles = ____entity.getProjectiles
|
|
15
14
|
local removeEntities = ____entity.removeEntities
|
|
15
|
+
local ____entitySpecific = require("functions.entitySpecific")
|
|
16
|
+
local getProjectiles = ____entitySpecific.getProjectiles
|
|
16
17
|
function ____exports.getAliveNPCs(self)
|
|
17
18
|
local npcs = ____exports.getNPCs(nil)
|
|
18
19
|
return __TS__ArrayFilter(
|
|
@@ -1,4 +1,16 @@
|
|
|
1
1
|
/// <reference types="isaac-typescript-definitions" />
|
|
2
|
+
/**
|
|
3
|
+
* Helper function to get all of the pickups in the room.
|
|
4
|
+
*
|
|
5
|
+
* Example:
|
|
6
|
+
* ```
|
|
7
|
+
* // Make all of the pickups in the room invisible
|
|
8
|
+
* for (const pickup of getPickups()) {
|
|
9
|
+
* pickup.Visible = false;
|
|
10
|
+
* }
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
13
|
+
export declare function getPickups(matchingVariant?: PickupVariant | int, matchingSubType?: number): EntityPickup[];
|
|
2
14
|
/**
|
|
3
15
|
* Has as an equal chance of returning any value in the `HeartSubType` enum. Useful for spawning a random type of heart.
|
|
4
16
|
*
|
|
@@ -7,3 +19,12 @@
|
|
|
7
19
|
*/
|
|
8
20
|
export declare function getRandomHeartSubType(seed?: number, exceptions?: HeartSubType[]): HeartSubType;
|
|
9
21
|
export declare function isChest(pickup: EntityPickup): boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Helper function to remove all of the pickups in the room.
|
|
24
|
+
*
|
|
25
|
+
* @param variant Optional. If specified, will only remove pickups that match this variant.
|
|
26
|
+
* @param subType Optional. If specified, will only remove pickups that match this sub-type.
|
|
27
|
+
* @param cap Optional. If specified, will only remove the given amount of pickups.
|
|
28
|
+
* @returns True if one or more pickups was removed, false otherwise.
|
|
29
|
+
*/
|
|
30
|
+
export declare function removeAllPickups(variant?: PickupVariant | int, subType?: int, cap?: int): boolean;
|