isaacscript-common 13.0.0 → 13.1.0
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/index.d.ts +105 -26
- package/dist/isaacscript-common.lua +615 -168
- package/dist/src/features/customStage/backdrop.lua +4 -4
- package/dist/src/features/customStage/versusScreen.lua +2 -2
- package/dist/src/features/deployJSONRoom.d.ts +0 -11
- package/dist/src/features/deployJSONRoom.d.ts.map +1 -1
- package/dist/src/features/deployJSONRoom.lua +10 -74
- package/dist/src/features/extraConsoleCommands/listCommands.lua +2 -2
- package/dist/src/features/firstLast.lua +8 -8
- package/dist/src/features/setHotkey.d.ts +27 -8
- package/dist/src/features/setHotkey.d.ts.map +1 -1
- package/dist/src/features/setHotkey.lua +41 -30
- package/dist/src/functions/array.lua +2 -2
- package/dist/src/functions/cards.lua +2 -2
- package/dist/src/functions/collectibles.lua +2 -2
- package/dist/src/functions/dimensions.lua +2 -2
- package/dist/src/functions/emptyRoom.d.ts +8 -0
- package/dist/src/functions/emptyRoom.d.ts.map +1 -0
- package/dist/src/functions/emptyRoom.lua +74 -0
- package/dist/src/functions/enums.d.ts.map +1 -1
- package/dist/src/functions/enums.lua +3 -3
- package/dist/src/functions/gridEntities.lua +2 -2
- package/dist/src/functions/gridIndex.d.ts +10 -0
- package/dist/src/functions/gridIndex.d.ts.map +1 -0
- package/dist/src/functions/gridIndex.lua +32 -0
- package/dist/src/functions/log.d.ts.map +1 -1
- package/dist/src/functions/log.lua +9 -8
- package/dist/src/functions/logEntities.d.ts.map +1 -1
- package/dist/src/functions/logEntities.lua +17 -9
- package/dist/src/functions/pills.lua +4 -4
- package/dist/src/functions/roomShape.d.ts +6 -1
- package/dist/src/functions/roomShape.d.ts.map +1 -1
- package/dist/src/functions/roomShape.lua +3 -0
- package/dist/src/functions/roomShapeWalls.d.ts +20 -0
- package/dist/src/functions/roomShapeWalls.d.ts.map +1 -0
- package/dist/src/functions/roomShapeWalls.lua +285 -0
- package/dist/src/functions/rooms.d.ts +7 -0
- package/dist/src/functions/rooms.d.ts.map +1 -1
- package/dist/src/functions/rooms.lua +16 -5
- package/dist/src/functions/set.d.ts +7 -0
- package/dist/src/functions/set.d.ts.map +1 -1
- package/dist/src/functions/set.lua +10 -0
- package/dist/src/functions/sprites.lua +2 -2
- package/dist/src/functions/trinkets.lua +2 -2
- package/dist/src/functions/utils.d.ts +18 -12
- package/dist/src/functions/utils.d.ts.map +1 -1
- package/dist/src/functions/utils.lua +26 -14
- package/dist/src/index.d.ts +3 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.lua +24 -0
- package/dist/src/interfaces/Corner.d.ts +8 -0
- package/dist/src/interfaces/Corner.d.ts.map +1 -1
- package/dist/src/objects/roomShapeCorners.d.ts +6 -1
- package/dist/src/objects/roomShapeCorners.d.ts.map +1 -1
- package/dist/src/objects/roomShapeCorners.lua +71 -14
- package/package.json +2 -2
- package/src/features/customStage/backdrop.ts +3 -3
- package/src/features/customStage/versusScreen.ts +2 -2
- package/src/features/deployJSONRoom.ts +8 -98
- package/src/features/extraConsoleCommands/listCommands.ts +2 -2
- package/src/features/firstLast.ts +8 -8
- package/src/features/setHotkey.ts +60 -40
- package/src/functions/array.ts +2 -2
- package/src/functions/cards.ts +2 -2
- package/src/functions/collectibles.ts +2 -2
- package/src/functions/dimensions.ts +2 -2
- package/src/functions/emptyRoom.ts +85 -0
- package/src/functions/enums.ts +4 -3
- package/src/functions/gridEntities.ts +2 -2
- package/src/functions/gridIndex.ts +40 -0
- package/src/functions/log.ts +9 -10
- package/src/functions/logEntities.ts +25 -9
- package/src/functions/pills.ts +4 -4
- package/src/functions/roomShape.ts +6 -1
- package/src/functions/roomShapeWalls.ts +359 -0
- package/src/functions/rooms.ts +22 -3
- package/src/functions/set.ts +12 -0
- package/src/functions/sprites.ts +2 -2
- package/src/functions/trinkets.ts +2 -2
- package/src/functions/utils.ts +20 -14
- package/src/index.ts +3 -0
- package/src/interfaces/Corner.ts +9 -0
- package/src/objects/roomShapeCorners.ts +74 -16
|
@@ -3,256 +3,313 @@ local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitio
|
|
|
3
3
|
local RoomShape = ____isaac_2Dtypescript_2Ddefinitions.RoomShape
|
|
4
4
|
local ____CornerType = require("src.enums.CornerType")
|
|
5
5
|
local CornerType = ____CornerType.CornerType
|
|
6
|
-
local TWO_BY_TWO_CENTER_X = 580
|
|
7
|
-
local TWO_BY_TWO_CENTER_Y = 420
|
|
8
6
|
--- The locations of the corners for each room shape.
|
|
7
|
+
--
|
|
8
|
+
-- Note that these corner locations are not accurate for the Mother Boss Room and the Home closet
|
|
9
|
+
-- rooms. (Those rooms have custom shapes.)
|
|
9
10
|
____exports.ROOM_SHAPE_CORNERS = {
|
|
10
11
|
[RoomShape.SHAPE_1x1] = {
|
|
11
12
|
{
|
|
12
13
|
type = CornerType.TOP_LEFT,
|
|
14
|
+
gridIndex = 0,
|
|
13
15
|
position = Vector(60, 140)
|
|
14
16
|
},
|
|
15
17
|
{
|
|
16
18
|
type = CornerType.TOP_RIGHT,
|
|
19
|
+
gridIndex = 14,
|
|
17
20
|
position = Vector(580, 140)
|
|
18
21
|
},
|
|
19
22
|
{
|
|
20
23
|
type = CornerType.BOTTOM_LEFT,
|
|
24
|
+
gridIndex = 120,
|
|
21
25
|
position = Vector(60, 420)
|
|
22
26
|
},
|
|
23
27
|
{
|
|
24
28
|
type = CornerType.BOTTOM_RIGHT,
|
|
29
|
+
gridIndex = 134,
|
|
25
30
|
position = Vector(580, 420)
|
|
26
31
|
}
|
|
27
32
|
},
|
|
28
33
|
[RoomShape.IH] = {
|
|
29
34
|
{
|
|
30
35
|
type = CornerType.TOP_LEFT,
|
|
36
|
+
gridIndex = 30,
|
|
31
37
|
position = Vector(60, 220)
|
|
32
38
|
},
|
|
33
39
|
{
|
|
34
40
|
type = CornerType.TOP_RIGHT,
|
|
41
|
+
gridIndex = 44,
|
|
35
42
|
position = Vector(580, 220)
|
|
36
43
|
},
|
|
37
44
|
{
|
|
38
45
|
type = CornerType.BOTTOM_LEFT,
|
|
46
|
+
gridIndex = 90,
|
|
39
47
|
position = Vector(60, 340)
|
|
40
48
|
},
|
|
41
49
|
{
|
|
42
50
|
type = CornerType.BOTTOM_RIGHT,
|
|
51
|
+
gridIndex = 104,
|
|
43
52
|
position = Vector(580, 340)
|
|
44
53
|
}
|
|
45
54
|
},
|
|
46
55
|
[RoomShape.IV] = {
|
|
47
56
|
{
|
|
48
57
|
type = CornerType.TOP_LEFT,
|
|
58
|
+
gridIndex = 4,
|
|
49
59
|
position = Vector(220, 140)
|
|
50
60
|
},
|
|
51
61
|
{
|
|
52
62
|
type = CornerType.TOP_RIGHT,
|
|
63
|
+
gridIndex = 10,
|
|
53
64
|
position = Vector(420, 140)
|
|
54
65
|
},
|
|
55
66
|
{
|
|
56
67
|
type = CornerType.BOTTOM_LEFT,
|
|
68
|
+
gridIndex = 124,
|
|
57
69
|
position = Vector(220, 420)
|
|
58
70
|
},
|
|
59
71
|
{
|
|
60
72
|
type = CornerType.BOTTOM_RIGHT,
|
|
73
|
+
gridIndex = 130,
|
|
61
74
|
position = Vector(420, 420)
|
|
62
75
|
}
|
|
63
76
|
},
|
|
64
77
|
[RoomShape.SHAPE_1x2] = {
|
|
65
78
|
{
|
|
66
79
|
type = CornerType.TOP_LEFT,
|
|
80
|
+
gridIndex = 0,
|
|
67
81
|
position = Vector(60, 140)
|
|
68
82
|
},
|
|
69
83
|
{
|
|
70
84
|
type = CornerType.TOP_RIGHT,
|
|
85
|
+
gridIndex = 14,
|
|
71
86
|
position = Vector(580, 140)
|
|
72
87
|
},
|
|
73
88
|
{
|
|
74
89
|
type = CornerType.BOTTOM_LEFT,
|
|
90
|
+
gridIndex = 225,
|
|
75
91
|
position = Vector(60, 700)
|
|
76
92
|
},
|
|
77
93
|
{
|
|
78
94
|
type = CornerType.BOTTOM_RIGHT,
|
|
95
|
+
gridIndex = 239,
|
|
79
96
|
position = Vector(580, 700)
|
|
80
97
|
}
|
|
81
98
|
},
|
|
82
99
|
[RoomShape.IIV] = {
|
|
83
100
|
{
|
|
84
101
|
type = CornerType.TOP_LEFT,
|
|
102
|
+
gridIndex = 4,
|
|
85
103
|
position = Vector(220, 140)
|
|
86
104
|
},
|
|
87
105
|
{
|
|
88
106
|
type = CornerType.TOP_RIGHT,
|
|
107
|
+
gridIndex = 10,
|
|
89
108
|
position = Vector(420, 140)
|
|
90
109
|
},
|
|
91
110
|
{
|
|
92
111
|
type = CornerType.BOTTOM_LEFT,
|
|
112
|
+
gridIndex = 229,
|
|
93
113
|
position = Vector(220, 700)
|
|
94
114
|
},
|
|
95
115
|
{
|
|
96
116
|
type = CornerType.BOTTOM_RIGHT,
|
|
117
|
+
gridIndex = 235,
|
|
97
118
|
position = Vector(420, 700)
|
|
98
119
|
}
|
|
99
120
|
},
|
|
100
121
|
[RoomShape.SHAPE_2x1] = {
|
|
101
122
|
{
|
|
102
123
|
type = CornerType.TOP_LEFT,
|
|
124
|
+
gridIndex = 0,
|
|
103
125
|
position = Vector(60, 140)
|
|
104
126
|
},
|
|
105
127
|
{
|
|
106
128
|
type = CornerType.TOP_RIGHT,
|
|
129
|
+
gridIndex = 27,
|
|
107
130
|
position = Vector(1100, 140)
|
|
108
131
|
},
|
|
109
132
|
{
|
|
110
133
|
type = CornerType.BOTTOM_LEFT,
|
|
134
|
+
gridIndex = 224,
|
|
111
135
|
position = Vector(60, 420)
|
|
112
136
|
},
|
|
113
137
|
{
|
|
114
138
|
type = CornerType.BOTTOM_RIGHT,
|
|
139
|
+
gridIndex = 251,
|
|
115
140
|
position = Vector(1100, 420)
|
|
116
141
|
}
|
|
117
142
|
},
|
|
118
143
|
[RoomShape.IIH] = {
|
|
119
144
|
{
|
|
120
145
|
type = CornerType.TOP_LEFT,
|
|
146
|
+
gridIndex = 56,
|
|
121
147
|
position = Vector(60, 220)
|
|
122
148
|
},
|
|
123
149
|
{
|
|
124
150
|
type = CornerType.TOP_RIGHT,
|
|
151
|
+
gridIndex = 83,
|
|
125
152
|
position = Vector(1100, 220)
|
|
126
153
|
},
|
|
127
154
|
{
|
|
128
155
|
type = CornerType.BOTTOM_LEFT,
|
|
156
|
+
gridIndex = 168,
|
|
129
157
|
position = Vector(60, 340)
|
|
130
158
|
},
|
|
131
159
|
{
|
|
132
160
|
type = CornerType.BOTTOM_RIGHT,
|
|
161
|
+
gridIndex = 195,
|
|
133
162
|
position = Vector(1100, 340)
|
|
134
163
|
}
|
|
135
164
|
},
|
|
136
165
|
[RoomShape.SHAPE_2x2] = {
|
|
137
166
|
{
|
|
138
167
|
type = CornerType.TOP_LEFT,
|
|
168
|
+
gridIndex = 0,
|
|
139
169
|
position = Vector(60, 140)
|
|
140
170
|
},
|
|
141
171
|
{
|
|
142
172
|
type = CornerType.TOP_RIGHT,
|
|
173
|
+
gridIndex = 27,
|
|
143
174
|
position = Vector(1100, 140)
|
|
144
175
|
},
|
|
145
176
|
{
|
|
146
177
|
type = CornerType.BOTTOM_LEFT,
|
|
178
|
+
gridIndex = 420,
|
|
147
179
|
position = Vector(60, 700)
|
|
148
180
|
},
|
|
149
181
|
{
|
|
150
182
|
type = CornerType.BOTTOM_RIGHT,
|
|
183
|
+
gridIndex = 447,
|
|
151
184
|
position = Vector(1100, 700)
|
|
152
185
|
}
|
|
153
186
|
},
|
|
154
187
|
[RoomShape.LTL] = {
|
|
155
188
|
{
|
|
156
189
|
type = CornerType.TOP_LEFT,
|
|
157
|
-
|
|
190
|
+
gridIndex = 13,
|
|
191
|
+
position = Vector(580, 140)
|
|
158
192
|
},
|
|
159
193
|
{
|
|
160
194
|
type = CornerType.TOP_RIGHT,
|
|
195
|
+
gridIndex = 27,
|
|
161
196
|
position = Vector(1100, 140)
|
|
162
197
|
},
|
|
163
198
|
{
|
|
164
199
|
type = CornerType.TOP_LEFT,
|
|
165
|
-
|
|
200
|
+
gridIndex = 196,
|
|
201
|
+
position = Vector(60, 420)
|
|
166
202
|
},
|
|
167
203
|
{
|
|
168
204
|
type = CornerType.BOTTOM_RIGHT,
|
|
169
|
-
|
|
205
|
+
gridIndex = 209,
|
|
206
|
+
position = Vector(580, 420)
|
|
170
207
|
},
|
|
171
208
|
{
|
|
172
209
|
type = CornerType.BOTTOM_LEFT,
|
|
210
|
+
gridIndex = 420,
|
|
173
211
|
position = Vector(60, 700)
|
|
174
212
|
},
|
|
175
213
|
{
|
|
176
214
|
type = CornerType.BOTTOM_RIGHT,
|
|
215
|
+
gridIndex = 447,
|
|
177
216
|
position = Vector(1100, 700)
|
|
178
217
|
}
|
|
179
218
|
},
|
|
180
219
|
[RoomShape.LTR] = {
|
|
181
220
|
{
|
|
182
221
|
type = CornerType.TOP_LEFT,
|
|
222
|
+
gridIndex = 0,
|
|
183
223
|
position = Vector(60, 140)
|
|
184
224
|
},
|
|
185
225
|
{
|
|
186
226
|
type = CornerType.TOP_RIGHT,
|
|
187
|
-
|
|
227
|
+
gridIndex = 14,
|
|
228
|
+
position = Vector(580, 140)
|
|
188
229
|
},
|
|
189
230
|
{
|
|
190
231
|
type = CornerType.BOTTOM_LEFT,
|
|
191
|
-
|
|
232
|
+
gridIndex = 210,
|
|
233
|
+
position = Vector(580, 420)
|
|
192
234
|
},
|
|
193
235
|
{
|
|
194
236
|
type = CornerType.TOP_RIGHT,
|
|
195
|
-
|
|
237
|
+
gridIndex = 223,
|
|
238
|
+
position = Vector(1100, 420)
|
|
196
239
|
},
|
|
197
240
|
{
|
|
198
241
|
type = CornerType.BOTTOM_LEFT,
|
|
242
|
+
gridIndex = 420,
|
|
199
243
|
position = Vector(60, 700)
|
|
200
244
|
},
|
|
201
245
|
{
|
|
202
246
|
type = CornerType.BOTTOM_RIGHT,
|
|
247
|
+
gridIndex = 447,
|
|
203
248
|
position = Vector(1100, 700)
|
|
204
249
|
}
|
|
205
250
|
},
|
|
206
251
|
[RoomShape.LBL] = {
|
|
207
252
|
{
|
|
208
253
|
type = CornerType.TOP_LEFT,
|
|
254
|
+
gridIndex = 0,
|
|
209
255
|
position = Vector(60, 140)
|
|
210
256
|
},
|
|
211
257
|
{
|
|
212
258
|
type = CornerType.TOP_RIGHT,
|
|
259
|
+
gridIndex = 27,
|
|
213
260
|
position = Vector(1100, 140)
|
|
214
261
|
},
|
|
215
262
|
{
|
|
216
263
|
type = CornerType.BOTTOM_LEFT,
|
|
217
|
-
|
|
264
|
+
gridIndex = 224,
|
|
265
|
+
position = Vector(580, 140)
|
|
218
266
|
},
|
|
219
267
|
{
|
|
220
268
|
type = CornerType.TOP_RIGHT,
|
|
221
|
-
|
|
269
|
+
gridIndex = 237,
|
|
270
|
+
position = Vector(580, 420)
|
|
222
271
|
},
|
|
223
272
|
{
|
|
224
273
|
type = CornerType.BOTTOM_LEFT,
|
|
225
|
-
|
|
274
|
+
gridIndex = 433,
|
|
275
|
+
position = Vector(580, 700)
|
|
226
276
|
},
|
|
227
277
|
{
|
|
228
278
|
type = CornerType.BOTTOM_RIGHT,
|
|
279
|
+
gridIndex = 447,
|
|
229
280
|
position = Vector(1100, 700)
|
|
230
281
|
}
|
|
231
282
|
},
|
|
232
283
|
[RoomShape.LBR] = {
|
|
233
284
|
{
|
|
234
285
|
type = CornerType.TOP_LEFT,
|
|
286
|
+
gridIndex = 0,
|
|
235
287
|
position = Vector(60, 140)
|
|
236
288
|
},
|
|
237
289
|
{
|
|
238
290
|
type = CornerType.TOP_RIGHT,
|
|
291
|
+
gridIndex = 27,
|
|
239
292
|
position = Vector(1100, 140)
|
|
240
293
|
},
|
|
241
294
|
{
|
|
242
295
|
type = CornerType.TOP_LEFT,
|
|
243
|
-
|
|
296
|
+
gridIndex = 238,
|
|
297
|
+
position = Vector(580, 420)
|
|
244
298
|
},
|
|
245
299
|
{
|
|
246
300
|
type = CornerType.BOTTOM_RIGHT,
|
|
247
|
-
|
|
301
|
+
gridIndex = 251,
|
|
302
|
+
position = Vector(1100, 420)
|
|
248
303
|
},
|
|
249
304
|
{
|
|
250
305
|
type = CornerType.BOTTOM_LEFT,
|
|
306
|
+
gridIndex = 420,
|
|
251
307
|
position = Vector(60, 700)
|
|
252
308
|
},
|
|
253
309
|
{
|
|
254
310
|
type = CornerType.BOTTOM_RIGHT,
|
|
255
|
-
|
|
311
|
+
gridIndex = 434,
|
|
312
|
+
position = Vector(580, 700)
|
|
256
313
|
}
|
|
257
314
|
}
|
|
258
315
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "isaacscript-common",
|
|
3
|
-
"version": "13.
|
|
3
|
+
"version": "13.1.0",
|
|
4
4
|
"description": "Helper functions and features for IsaacScript mods.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"isaac",
|
|
@@ -22,6 +22,6 @@
|
|
|
22
22
|
"main": "dist/src/index",
|
|
23
23
|
"types": "dist/src/index.d.ts",
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"isaac-typescript-definitions": "^7.2.
|
|
25
|
+
"isaac-typescript-definitions": "^7.2.7"
|
|
26
26
|
}
|
|
27
27
|
}
|
|
@@ -15,7 +15,7 @@ import { spawnEffectWithSeed } from "../../functions/entitiesSpecific";
|
|
|
15
15
|
import { newRNG } from "../../functions/rng";
|
|
16
16
|
import { isLRoom, isNarrowRoom } from "../../functions/roomShape";
|
|
17
17
|
import { removeCharactersBefore, trimPrefix } from "../../functions/string";
|
|
18
|
-
import {
|
|
18
|
+
import { eRange, iRange } from "../../functions/utils";
|
|
19
19
|
import { CustomStage } from "../../interfaces/private/CustomStage";
|
|
20
20
|
import { ISAACSCRIPT_CUSTOM_STAGE_GFX_PATH } from "./constants";
|
|
21
21
|
|
|
@@ -163,7 +163,7 @@ function spawnWallEntity(
|
|
|
163
163
|
sprite.ReplaceSpritesheet(0, cornerPNGPath);
|
|
164
164
|
}
|
|
165
165
|
|
|
166
|
-
for (const layerID of
|
|
166
|
+
for (const layerID of iRange(1, numWallLayers)) {
|
|
167
167
|
const wallPNGPath = getBackdropPNGPath(customStage, BackdropKind.WALL, rng);
|
|
168
168
|
sprite.ReplaceSpritesheet(layerID, wallPNGPath);
|
|
169
169
|
}
|
|
@@ -214,7 +214,7 @@ function spawnFloorEntity(customStage: CustomStage, rng: RNG) {
|
|
|
214
214
|
|
|
215
215
|
const numFloorLayers = getNumFloorLayers(roomShape);
|
|
216
216
|
if (numFloorLayers !== undefined) {
|
|
217
|
-
for (const layerID of
|
|
217
|
+
for (const layerID of eRange(0, numFloorLayers)) {
|
|
218
218
|
// The wall spritesheet is used for the "normal" floors.
|
|
219
219
|
const wallPNGPath = getBackdropPNGPath(
|
|
220
220
|
customStage,
|
|
@@ -10,7 +10,7 @@ import { arrayRemove } from "../../functions/array";
|
|
|
10
10
|
import { getBosses } from "../../functions/bosses";
|
|
11
11
|
import { getRoomSubType } from "../../functions/roomData";
|
|
12
12
|
import { removeCharactersBefore } from "../../functions/string";
|
|
13
|
-
import {
|
|
13
|
+
import { eRange } from "../../functions/utils";
|
|
14
14
|
import { CustomStage } from "../../interfaces/private/CustomStage";
|
|
15
15
|
import { BOSS_NAME_PNG_FILE_NAMES } from "../../objects/bossNamePNGFileNames";
|
|
16
16
|
import { BOSS_PORTRAIT_PNG_FILE_NAMES } from "../../objects/bossPortraitPNGFileNames";
|
|
@@ -58,7 +58,7 @@ const PLAYER_PORTRAIT_ALT_ANM2_LAYER = 12;
|
|
|
58
58
|
|
|
59
59
|
/** These are the non-special layers that we will render last. */
|
|
60
60
|
const OTHER_ANM2_LAYERS: readonly int[] = arrayRemove(
|
|
61
|
-
|
|
61
|
+
eRange(NUM_VERSUS_SCREEN_ANM2_LAYERS),
|
|
62
62
|
BACKGROUND_ANM2_LAYER,
|
|
63
63
|
BOSS_DIRT_SPOT_ANM2_LAYER,
|
|
64
64
|
PLAYER_DIRT_SPOT_ANM2_LAYER,
|
|
@@ -7,7 +7,6 @@ import {
|
|
|
7
7
|
ActiveSlot,
|
|
8
8
|
CollectibleType,
|
|
9
9
|
EntityCollisionClass,
|
|
10
|
-
EntityFlag,
|
|
11
10
|
EntityGridCollisionClass,
|
|
12
11
|
EntityType,
|
|
13
12
|
GridEntityType,
|
|
@@ -24,8 +23,8 @@ import { game } from "../core/cachedClasses";
|
|
|
24
23
|
import { ModCallbackCustom } from "../enums/ModCallbackCustom";
|
|
25
24
|
import { errorIfFeaturesNotInitialized } from "../featuresInitialized";
|
|
26
25
|
import { emptyArray } from "../functions/array";
|
|
26
|
+
import { emptyRoom } from "../functions/emptyRoom";
|
|
27
27
|
import {
|
|
28
|
-
getEntities,
|
|
29
28
|
getEntityIDFromConstituents,
|
|
30
29
|
spawn,
|
|
31
30
|
spawnWithSeed,
|
|
@@ -44,11 +43,7 @@ import { log } from "../functions/log";
|
|
|
44
43
|
import { getRandomSeed, isRNG, newRNG } from "../functions/rng";
|
|
45
44
|
import { getRoomListIndex } from "../functions/roomData";
|
|
46
45
|
import { gridCoordinatesToWorldPosition } from "../functions/roomGrid";
|
|
47
|
-
import {
|
|
48
|
-
roomUpdateSafe,
|
|
49
|
-
setRoomCleared,
|
|
50
|
-
setRoomUncleared,
|
|
51
|
-
} from "../functions/rooms";
|
|
46
|
+
import { setRoomCleared, setRoomUncleared } from "../functions/rooms";
|
|
52
47
|
import { spawnCollectible } from "../functions/spawnCollectible";
|
|
53
48
|
import { asCollectibleType, asNumber } from "../functions/types";
|
|
54
49
|
import { JSONRoom } from "../interfaces/JSONRoomsFile";
|
|
@@ -73,22 +68,6 @@ const GRID_ENTITY_XML_TYPE_SET: ReadonlySet<number> = new Set(
|
|
|
73
68
|
gridEntityXMLTypes,
|
|
74
69
|
);
|
|
75
70
|
|
|
76
|
-
const EMPTY_ROOM_BLACKLIST_ENTITY_SET: ReadonlySet<EntityType> = new Set([
|
|
77
|
-
EntityType.PLAYER, // 1
|
|
78
|
-
EntityType.TEAR, // 2
|
|
79
|
-
EntityType.FAMILIAR, // 3
|
|
80
|
-
EntityType.LASER, // 7
|
|
81
|
-
EntityType.KNIFE, // 8
|
|
82
|
-
EntityType.PROJECTILE, // 9
|
|
83
|
-
EntityType.DARK_ESAU, // 866
|
|
84
|
-
]);
|
|
85
|
-
|
|
86
|
-
const EMPTY_ROOM_BLACKLIST_GRID_ENTITY_SET: ReadonlySet<GridEntityType> =
|
|
87
|
-
new Set([
|
|
88
|
-
GridEntityType.WALL, // 15
|
|
89
|
-
GridEntityType.DOOR, // 16
|
|
90
|
-
]);
|
|
91
|
-
|
|
92
71
|
const v = {
|
|
93
72
|
level: {
|
|
94
73
|
deployedRoomListIndexes: new Set<int>(),
|
|
@@ -272,14 +251,19 @@ export function deployJSONRoom(
|
|
|
272
251
|
|
|
273
252
|
const rng = isRNG(seedOrRNG) ? seedOrRNG : newRNG(seedOrRNG);
|
|
274
253
|
|
|
254
|
+
const roomListIndex = getRoomListIndex();
|
|
255
|
+
v.level.deployedRoomListIndexes.add(roomListIndex);
|
|
256
|
+
|
|
275
257
|
if (verbose) {
|
|
276
258
|
log("Starting to empty the room of entities and grid entities.");
|
|
277
259
|
}
|
|
278
|
-
emptyRoom(
|
|
260
|
+
emptyRoom();
|
|
279
261
|
if (verbose) {
|
|
280
262
|
log("Finished emptying the room of entities and grid entities.");
|
|
281
263
|
}
|
|
282
264
|
|
|
265
|
+
setRoomCleared();
|
|
266
|
+
|
|
283
267
|
if (verbose) {
|
|
284
268
|
log("Starting to spawn all of the new entities and grid entities.");
|
|
285
269
|
}
|
|
@@ -343,80 +327,6 @@ export function deployRandomJSONRoom(
|
|
|
343
327
|
return deployJSONRoom(randomJSONRoom, rng, verbose);
|
|
344
328
|
}
|
|
345
329
|
|
|
346
|
-
/**
|
|
347
|
-
* Helper function to remove all naturally spawning entities and grid entities from a room. Notably,
|
|
348
|
-
* this will not remove players (1), tears (2), familiars (3), lasers (7), knives (8), projectiles
|
|
349
|
-
* (9), blacklisted NPCs such as Dark Esau, charmed NPCs, friendly NPCs, persistent NPCs, most
|
|
350
|
-
* effects (1000), doors, and walls.
|
|
351
|
-
*
|
|
352
|
-
* @param fillWithDecorations Optional. Set to true to fill every grid tile with an invisible
|
|
353
|
-
* decoration, which prevents vanilla entities in the room from
|
|
354
|
-
* respawning the next time that the player enters. Default is false.
|
|
355
|
-
*/
|
|
356
|
-
export function emptyRoom(fillWithDecorations: boolean): void {
|
|
357
|
-
errorIfFeaturesNotInitialized(FEATURE_NAME);
|
|
358
|
-
|
|
359
|
-
const roomListIndex = getRoomListIndex();
|
|
360
|
-
v.level.deployedRoomListIndexes.add(roomListIndex);
|
|
361
|
-
|
|
362
|
-
emptyRoomEntities();
|
|
363
|
-
emptyRoomGridEntities();
|
|
364
|
-
setRoomCleared();
|
|
365
|
-
|
|
366
|
-
if (fillWithDecorations) {
|
|
367
|
-
fillRoomWithDecorations();
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
/**
|
|
372
|
-
* We remove entities in the `POST_NEW_ROOM` callback instead of in the `PRE_ROOM_ENTITY_SPAWN`
|
|
373
|
-
* callback so that they will not re-appear when we re-enter the room.
|
|
374
|
-
*/
|
|
375
|
-
function emptyRoomEntities() {
|
|
376
|
-
const room = game.GetRoom();
|
|
377
|
-
|
|
378
|
-
for (const entity of getEntities()) {
|
|
379
|
-
if (EMPTY_ROOM_BLACKLIST_ENTITY_SET.has(entity.Type)) {
|
|
380
|
-
continue;
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
if (
|
|
384
|
-
entity.HasEntityFlags(EntityFlag.CHARM) ||
|
|
385
|
-
entity.HasEntityFlags(EntityFlag.FRIENDLY) ||
|
|
386
|
-
entity.HasEntityFlags(EntityFlag.PERSISTENT)
|
|
387
|
-
) {
|
|
388
|
-
continue;
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
entity.ClearEntityFlags(EntityFlag.APPEAR);
|
|
392
|
-
entity.Remove();
|
|
393
|
-
|
|
394
|
-
// When fire places are removed, they will leave behind a "path" that will prevent future grid
|
|
395
|
-
// entities from being spawned on the same tile. Thus, reset the path for this tile if this is a
|
|
396
|
-
// fire place.
|
|
397
|
-
if (entity.Type === EntityType.FIREPLACE) {
|
|
398
|
-
const gridIndex = room.GetGridIndex(entity.Position);
|
|
399
|
-
room.SetGridPath(gridIndex, 0);
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
function emptyRoomGridEntities() {
|
|
405
|
-
let removedOneOrMoreGridEntities = false;
|
|
406
|
-
for (const gridEntity of getGridEntities()) {
|
|
407
|
-
const gridEntityType = gridEntity.GetType();
|
|
408
|
-
if (EMPTY_ROOM_BLACKLIST_GRID_ENTITY_SET.has(gridEntityType)) {
|
|
409
|
-
continue;
|
|
410
|
-
}
|
|
411
|
-
|
|
412
|
-
removeGridEntity(gridEntity, false);
|
|
413
|
-
removedOneOrMoreGridEntities = true;
|
|
414
|
-
}
|
|
415
|
-
if (removedOneOrMoreGridEntities) {
|
|
416
|
-
roomUpdateSafe();
|
|
417
|
-
}
|
|
418
|
-
}
|
|
419
|
-
|
|
420
330
|
/**
|
|
421
331
|
* We removed most normal entities, which should prevent them from respawning when the player
|
|
422
332
|
* re-enters the room. However, this is not the case for grid entities; even if they are removed,
|
|
@@ -116,7 +116,7 @@ import {
|
|
|
116
116
|
asCollectibleType,
|
|
117
117
|
asTrinketType,
|
|
118
118
|
} from "../../functions/types";
|
|
119
|
-
import {
|
|
119
|
+
import { iRange, printConsole, printEnabled } from "../../functions/utils";
|
|
120
120
|
import { CARD_NAME_TO_TYPE_MAP } from "../../maps/cardNameToTypeMap";
|
|
121
121
|
import { CHARACTER_NAME_TO_TYPE_MAP } from "../../maps/characterNameToTypeMap";
|
|
122
122
|
import { COLLECTIBLE_NAME_TO_TYPE_MAP } from "../../maps/collectibleNameToTypeMap";
|
|
@@ -941,7 +941,7 @@ export function map(): void {
|
|
|
941
941
|
DisplayFlag.SHOW_ICON, // 1 << 2
|
|
942
942
|
);
|
|
943
943
|
|
|
944
|
-
for (const roomGridIndex of
|
|
944
|
+
for (const roomGridIndex of iRange(MAX_LEVEL_GRID_INDEX)) {
|
|
945
945
|
const roomDesc = level.GetRoomByIdx(roomGridIndex);
|
|
946
946
|
roomDesc.DisplayFlags = displayFlags;
|
|
947
947
|
}
|
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
asPillEffect,
|
|
29
29
|
asTrinketType,
|
|
30
30
|
} from "../functions/types";
|
|
31
|
-
import {
|
|
31
|
+
import { iRange } from "../functions/utils";
|
|
32
32
|
|
|
33
33
|
const FEATURE_NAME = "firstLast";
|
|
34
34
|
|
|
@@ -117,7 +117,7 @@ export function getModdedCollectibleTypes(): CollectibleType[] {
|
|
|
117
117
|
}
|
|
118
118
|
|
|
119
119
|
const lastCollectibleType = getLastCollectibleType();
|
|
120
|
-
return
|
|
120
|
+
return iRange(firstModdedCollectibleType, lastCollectibleType);
|
|
121
121
|
}
|
|
122
122
|
|
|
123
123
|
/**
|
|
@@ -202,7 +202,7 @@ export function getModdedTrinketTypes(): TrinketType[] {
|
|
|
202
202
|
}
|
|
203
203
|
|
|
204
204
|
const lastTrinketType = getLastTrinketType();
|
|
205
|
-
return
|
|
205
|
+
return iRange(firstModdedTrinketType, lastTrinketType);
|
|
206
206
|
}
|
|
207
207
|
|
|
208
208
|
/**
|
|
@@ -241,7 +241,7 @@ export function getNumModdedTrinketTypes(): int {
|
|
|
241
241
|
*/
|
|
242
242
|
export function getTrinketTypes(): TrinketType[] {
|
|
243
243
|
const lastTrinketType = getLastTrinketType();
|
|
244
|
-
return
|
|
244
|
+
return iRange(FIRST_TRINKET_TYPE, lastTrinketType);
|
|
245
245
|
}
|
|
246
246
|
|
|
247
247
|
// -----
|
|
@@ -256,7 +256,7 @@ export function getTrinketTypes(): TrinketType[] {
|
|
|
256
256
|
*/
|
|
257
257
|
export function getAllCardTypes(): CardType[] {
|
|
258
258
|
const lastCardType = getLastCardType();
|
|
259
|
-
return
|
|
259
|
+
return iRange(FIRST_CARD_TYPE, lastCardType);
|
|
260
260
|
}
|
|
261
261
|
|
|
262
262
|
/**
|
|
@@ -306,7 +306,7 @@ export function getModdedCardTypes(): CardType[] {
|
|
|
306
306
|
}
|
|
307
307
|
|
|
308
308
|
const lastCardType = getLastCardType();
|
|
309
|
-
return
|
|
309
|
+
return iRange(firstModdedCardType, lastCardType);
|
|
310
310
|
}
|
|
311
311
|
|
|
312
312
|
/**
|
|
@@ -348,7 +348,7 @@ export function getNumModdedCardTypes(): int {
|
|
|
348
348
|
*/
|
|
349
349
|
export function getAllPillEffects(): PillEffect[] {
|
|
350
350
|
const lastPillEffect = getLastPillEffect();
|
|
351
|
-
return
|
|
351
|
+
return iRange(FIRST_PILL_EFFECT, lastPillEffect);
|
|
352
352
|
}
|
|
353
353
|
|
|
354
354
|
/**
|
|
@@ -400,7 +400,7 @@ export function getModdedPillEffects(): PillEffect[] {
|
|
|
400
400
|
}
|
|
401
401
|
|
|
402
402
|
const lastPillEffect = getLastPillEffect();
|
|
403
|
-
return
|
|
403
|
+
return iRange(firstModdedPillEffect, lastPillEffect);
|
|
404
404
|
}
|
|
405
405
|
|
|
406
406
|
/**
|