isaacscript-common 1.2.27 → 1.2.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/callbacks/postNewRoomEarly.lua +3 -0
- package/dist/features/deployJSONRoom.lua +19 -16
- package/dist/functions/gridEntity.d.ts +3 -3
- package/dist/functions/gridEntity.lua +7 -0
- package/dist/functions/npc.lua +4 -1
- package/dist/functions/rooms.d.ts +4 -1
- package/dist/functions/rooms.lua +4 -2
- package/dist/functions/sound.d.ts +1 -0
- package/dist/functions/sound.lua +11 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.lua +8 -0
- package/package.json +3 -3
|
@@ -29,6 +29,9 @@ function checkRoomChanged(self)
|
|
|
29
29
|
local topLeftWall = room:GetGridEntity(topLeftWallGridIndex)
|
|
30
30
|
if topLeftWall == nil then
|
|
31
31
|
topLeftWall = spawnGridEntity(nil, GridEntityType.GRID_WALL, topLeftWallGridIndex)
|
|
32
|
+
if topLeftWall == nil then
|
|
33
|
+
return
|
|
34
|
+
end
|
|
32
35
|
end
|
|
33
36
|
local topLeftWallPtrHash = GetPtrHash(topLeftWall)
|
|
34
37
|
if topLeftWallPtrHash ~= currentRoomTopLeftWallPtrHash then
|
|
@@ -6,7 +6,7 @@ local Map = ____lualib.Map
|
|
|
6
6
|
local __TS__ArrayPush = ____lualib.__TS__ArrayPush
|
|
7
7
|
local __TS__Iterator = ____lualib.__TS__Iterator
|
|
8
8
|
local ____exports = {}
|
|
9
|
-
local postNewRoom, setDecorationsInvisible, respawnPersistentEntities, removeSpecificNPCs, fillRoomWithDecorations, spawnAllEntities,
|
|
9
|
+
local postNewRoom, setDecorationsInvisible, respawnPersistentEntities, removeSpecificNPCs, fillRoomWithDecorations, spawnAllEntities, spawnGridEntityForJSONRoom, spawnNormalEntityForJSONRoom, storePersistentEntity, fixPitGraphics, getPitMap, getPitFrame, FEATURE_NAME, NPC_TYPES_TO_NOT_REMOVE, PERSISTENT_ENTITY_TYPES, initialized, v
|
|
10
10
|
local ____errors = require("errors")
|
|
11
11
|
local getUpgradeErrorMsg = ____errors.getUpgradeErrorMsg
|
|
12
12
|
local ____entity = require("functions.entity")
|
|
@@ -18,6 +18,7 @@ local convertXMLGridEntityType = ____gridEntity.convertXMLGridEntityType
|
|
|
18
18
|
local getGridEntities = ____gridEntity.getGridEntities
|
|
19
19
|
local removeAllGridEntitiesExceptFor = ____gridEntity.removeAllGridEntitiesExceptFor
|
|
20
20
|
local setGridEntityInvisible = ____gridEntity.setGridEntityInvisible
|
|
21
|
+
local spawnGridEntityWithVariant = ____gridEntity.spawnGridEntityWithVariant
|
|
21
22
|
local ____jsonRoom = require("functions.jsonRoom")
|
|
22
23
|
local getRandomJSONRoom = ____jsonRoom.getRandomJSONRoom
|
|
23
24
|
local ____log = require("functions.log")
|
|
@@ -138,7 +139,9 @@ function fillRoomWithDecorations(self)
|
|
|
138
139
|
end
|
|
139
140
|
local position = room:GetGridPosition(gridIndex)
|
|
140
141
|
local decoration = Isaac.GridSpawn(GridEntityType.GRID_DECORATION, 0, position, true)
|
|
141
|
-
|
|
142
|
+
if decoration ~= nil then
|
|
143
|
+
setGridEntityInvisible(nil, decoration)
|
|
144
|
+
end
|
|
142
145
|
__TS__ArrayPush(decorationGridIndexes, gridIndex)
|
|
143
146
|
end
|
|
144
147
|
::__continue34::
|
|
@@ -185,7 +188,7 @@ function spawnAllEntities(self, jsonRoom, seed, verbose)
|
|
|
185
188
|
if verbose then
|
|
186
189
|
log(((((((("Spawning grid entity " .. tostring(entityType)) .. ".") .. tostring(variant)) .. " at: (") .. tostring(x)) .. ", ") .. tostring(y)) .. ")")
|
|
187
190
|
end
|
|
188
|
-
|
|
191
|
+
spawnGridEntityForJSONRoom(
|
|
189
192
|
nil,
|
|
190
193
|
entityType,
|
|
191
194
|
variant,
|
|
@@ -197,7 +200,7 @@ function spawnAllEntities(self, jsonRoom, seed, verbose)
|
|
|
197
200
|
if verbose then
|
|
198
201
|
log(((((((((("Spawning normal entity " .. tostring(entityType)) .. ".") .. tostring(variant)) .. ".") .. tostring(subType)) .. " at: (") .. tostring(x)) .. ", ") .. tostring(y)) .. ")")
|
|
199
202
|
end
|
|
200
|
-
local entity =
|
|
203
|
+
local entity = spawnNormalEntityForJSONRoom(
|
|
201
204
|
nil,
|
|
202
205
|
entityType,
|
|
203
206
|
variant,
|
|
@@ -222,28 +225,28 @@ function spawnAllEntities(self, jsonRoom, seed, verbose)
|
|
|
222
225
|
end
|
|
223
226
|
return seed
|
|
224
227
|
end
|
|
225
|
-
function
|
|
226
|
-
local
|
|
227
|
-
|
|
228
|
+
function spawnGridEntityForJSONRoom(self, xmlEntityType, xmlEntityVariant, x, y)
|
|
229
|
+
local game = Game()
|
|
230
|
+
local room = game:GetRoom()
|
|
231
|
+
local gridEntityTuple = convertXMLGridEntityType(nil, xmlEntityType, xmlEntityVariant)
|
|
232
|
+
if gridEntityTuple == nil then
|
|
228
233
|
return nil
|
|
229
234
|
end
|
|
230
|
-
local
|
|
235
|
+
local gridEntityType, variant = table.unpack(gridEntityTuple)
|
|
231
236
|
local position = gridToPos(nil, x, y)
|
|
232
|
-
local
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
pit:UpdateCollision()
|
|
237
|
-
end
|
|
237
|
+
local gridIndex = room:GetGridIndex(position)
|
|
238
|
+
local gridEntity = spawnGridEntityWithVariant(nil, gridEntityType, variant, gridIndex)
|
|
239
|
+
if gridEntity == nil then
|
|
240
|
+
return gridEntity
|
|
238
241
|
end
|
|
239
|
-
if
|
|
242
|
+
if gridEntityType == GridEntityType.GRID_POOP then
|
|
240
243
|
local sprite = gridEntity:GetSprite()
|
|
241
244
|
sprite:Play("State1", true)
|
|
242
245
|
sprite:SetLastFrame()
|
|
243
246
|
end
|
|
244
247
|
return gridEntity
|
|
245
248
|
end
|
|
246
|
-
function
|
|
249
|
+
function spawnNormalEntityForJSONRoom(self, entityType, variant, subType, x, y, seed)
|
|
247
250
|
local game = Game()
|
|
248
251
|
local room = game:GetRoom()
|
|
249
252
|
local roomType = room:GetType()
|
|
@@ -106,7 +106,7 @@ export declare function spawnGiantPoop(topLeftGridIndex: int): void;
|
|
|
106
106
|
* - removes existing grid entities on the same tile, if any
|
|
107
107
|
* - allows you to specify the grid index instead of the position
|
|
108
108
|
*/
|
|
109
|
-
export declare function spawnGridEntity(gridEntityType: GridEntityType, gridIndex: int): GridEntity;
|
|
109
|
+
export declare function spawnGridEntity(gridEntityType: GridEntityType, gridIndex: int): GridEntity | undefined;
|
|
110
110
|
/**
|
|
111
111
|
* Helper function to spawn a grid entity with a specific variant. Use this instead of the
|
|
112
112
|
* `Isaac.GridSpawn()` method since it:
|
|
@@ -114,9 +114,9 @@ export declare function spawnGridEntity(gridEntityType: GridEntityType, gridInde
|
|
|
114
114
|
* - removes existing grid entities on the same tile, if any
|
|
115
115
|
* - allows you to specify the grid index instead of the position
|
|
116
116
|
*/
|
|
117
|
-
export declare function spawnGridEntityWithVariant(gridEntityType: GridEntityType, variant: int, gridIndex: int): GridEntity;
|
|
117
|
+
export declare function spawnGridEntityWithVariant(gridEntityType: GridEntityType, variant: int, gridIndex: int): GridEntity | undefined;
|
|
118
118
|
/**
|
|
119
119
|
* Helper function to spawn a Void Portal. This is more complicated than simply spawning a trapdoor
|
|
120
120
|
* with the appropriate variant, as the game does not give it the correct sprite automatically.
|
|
121
121
|
*/
|
|
122
|
-
export declare function spawnVoidPortal(gridIndex: int):
|
|
122
|
+
export declare function spawnVoidPortal(gridIndex: int): GridEntity | undefined;
|
|
@@ -48,6 +48,9 @@ function ____exports.spawnGridEntityWithVariant(self, gridEntityType, variant, g
|
|
|
48
48
|
end
|
|
49
49
|
local position = room:GetGridPosition(gridIndex)
|
|
50
50
|
local gridEntity = Isaac.GridSpawn(gridEntityType, variant, position, true)
|
|
51
|
+
if gridEntity == nil then
|
|
52
|
+
return gridEntity
|
|
53
|
+
end
|
|
51
54
|
if gridEntityType == GridEntityType.GRID_PIT then
|
|
52
55
|
local pit = gridEntity:ToPit()
|
|
53
56
|
if pit ~= nil then
|
|
@@ -221,8 +224,12 @@ function ____exports.spawnGridEntity(self, gridEntityType, gridIndex)
|
|
|
221
224
|
end
|
|
222
225
|
function ____exports.spawnVoidPortal(self, gridIndex)
|
|
223
226
|
local voidPortal = ____exports.spawnGridEntityWithVariant(nil, GridEntityType.GRID_TRAPDOOR, 1, gridIndex)
|
|
227
|
+
if voidPortal == nil then
|
|
228
|
+
return voidPortal
|
|
229
|
+
end
|
|
224
230
|
voidPortal.VarData = 1
|
|
225
231
|
local sprite = voidPortal:GetSprite()
|
|
226
232
|
sprite:Load("gfx/grid/voidtrapdoor.anm2", true)
|
|
233
|
+
return voidPortal
|
|
227
234
|
end
|
|
228
235
|
return ____exports
|
package/dist/functions/npc.lua
CHANGED
|
@@ -81,7 +81,10 @@ NON_ALIVE_NPCS_TYPE_VARIANT = __TS__New(
|
|
|
81
81
|
)
|
|
82
82
|
NON_ALIVE_NPCS_TYPE_VARIANT_SUBTYPE = __TS__New(
|
|
83
83
|
Set,
|
|
84
|
-
{
|
|
84
|
+
{
|
|
85
|
+
(((tostring(EntityType.ENTITY_CHARGER) .. ".") .. 0) .. ".") .. 1,
|
|
86
|
+
(((tostring(EntityType.ENTITY_MOTHER) .. ".") .. 0) .. ".") .. 1
|
|
87
|
+
}
|
|
85
88
|
)
|
|
86
89
|
function ____exports.fireProjectiles(self, npc, position, velocity, projectilesMode, projectileParams)
|
|
87
90
|
if projectilesMode == nil then
|
|
@@ -43,8 +43,11 @@ export declare function getRoomDescriptor(roomGridIndex?: int): RoomDescriptor;
|
|
|
43
43
|
* specified room type.
|
|
44
44
|
*
|
|
45
45
|
* This function only searches through rooms in the current dimension.
|
|
46
|
+
*
|
|
47
|
+
* This function is variadic, meaning that you can specify N arguments to get the combined grid
|
|
48
|
+
* indexes for N room types.
|
|
46
49
|
*/
|
|
47
|
-
export declare function getRoomGridIndexesForType(
|
|
50
|
+
export declare function getRoomGridIndexesForType(...roomTypes: RoomType[]): int[];
|
|
48
51
|
/**
|
|
49
52
|
* Helper function to get the item pool type for the current room. For example, this returns
|
|
50
53
|
* `ItemPoolType.ItemPoolType.POOL_ANGEL` if you are in an Angel Room.
|
package/dist/functions/rooms.lua
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
2
|
local ____lualib = require("lualib_bundle")
|
|
3
3
|
local __TS__ArrayMap = ____lualib.__TS__ArrayMap
|
|
4
|
+
local __TS__ArrayIncludes = ____lualib.__TS__ArrayIncludes
|
|
4
5
|
local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
|
|
5
6
|
local __TS__ArrayPush = ____lualib.__TS__ArrayPush
|
|
6
7
|
local Set = ____lualib.Set
|
|
@@ -132,11 +133,12 @@ function ____exports.getRoomDataType(self, roomGridIndex)
|
|
|
132
133
|
local roomData = ____exports.getRoomData(nil, roomGridIndex)
|
|
133
134
|
return roomData == nil and -1 or roomData.Type
|
|
134
135
|
end
|
|
135
|
-
function ____exports.getRoomGridIndexesForType(self,
|
|
136
|
+
function ____exports.getRoomGridIndexesForType(self, ...)
|
|
137
|
+
local roomTypes = {...}
|
|
136
138
|
local rooms = ____exports.getRooms(nil)
|
|
137
139
|
local matchingRooms = __TS__ArrayFilter(
|
|
138
140
|
rooms,
|
|
139
|
-
function(____, roomDescriptor) return roomDescriptor.Data ~= nil and roomDescriptor.Data.Type
|
|
141
|
+
function(____, roomDescriptor) return roomDescriptor.Data ~= nil and __TS__ArrayIncludes(roomTypes, roomDescriptor.Data.Type) end
|
|
140
142
|
)
|
|
141
143
|
return __TS__ArrayMap(
|
|
142
144
|
matchingRooms,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function stopAllSoundEffects(): void;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
|
+
local ____exports = {}
|
|
3
|
+
local ____util = require("functions.util")
|
|
4
|
+
local getEnumValues = ____util.getEnumValues
|
|
5
|
+
function ____exports.stopAllSoundEffects(self)
|
|
6
|
+
local sfxManager = SFXManager()
|
|
7
|
+
for ____, soundEffect in ipairs(getEnumValues(nil, SoundEffect)) do
|
|
8
|
+
sfxManager:Stop(soundEffect)
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
return ____exports
|
package/dist/index.d.ts
CHANGED
|
@@ -45,6 +45,7 @@ export * from "./functions/revive";
|
|
|
45
45
|
export * from "./functions/rooms";
|
|
46
46
|
export * from "./functions/seeds";
|
|
47
47
|
export * from "./functions/set";
|
|
48
|
+
export * from "./functions/sound";
|
|
48
49
|
export * from "./functions/spawnCollectible";
|
|
49
50
|
export * from "./functions/sprite";
|
|
50
51
|
export * from "./functions/stage";
|
package/dist/index.lua
CHANGED
|
@@ -370,6 +370,14 @@ do
|
|
|
370
370
|
end
|
|
371
371
|
end
|
|
372
372
|
end
|
|
373
|
+
do
|
|
374
|
+
local ____export = require("functions.sound")
|
|
375
|
+
for ____exportKey, ____exportValue in pairs(____export) do
|
|
376
|
+
if ____exportKey ~= "default" then
|
|
377
|
+
____exports[____exportKey] = ____exportValue
|
|
378
|
+
end
|
|
379
|
+
end
|
|
380
|
+
end
|
|
373
381
|
do
|
|
374
382
|
local ____export = require("functions.spawnCollectible")
|
|
375
383
|
for ____exportKey, ____exportValue in pairs(____export) do
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "isaacscript-common",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.31",
|
|
4
4
|
"description": "Helper functions for IsaacScript mods",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"isaac",
|
|
@@ -26,10 +26,10 @@
|
|
|
26
26
|
],
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@zamiell/typescript-to-lua": "^1.4.0",
|
|
29
|
-
"isaac-typescript-definitions": "^1.0.
|
|
29
|
+
"isaac-typescript-definitions": "^1.0.343",
|
|
30
30
|
"isaacscript-lint": "^1.0.79",
|
|
31
31
|
"isaacscript-tsconfig": "^1.1.8",
|
|
32
|
-
"typedoc": "^0.22.
|
|
32
|
+
"typedoc": "^0.22.12",
|
|
33
33
|
"typescript": "^4.5.5"
|
|
34
34
|
}
|
|
35
35
|
}
|