isaacscript-common 1.2.30 → 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.
|
@@ -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/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
|
}
|