isaacscript-common 6.6.5 → 6.8.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/callbacks/customRevive.lua +4 -4
- package/dist/callbacks/postCursedTeleport.lua +2 -2
- package/dist/callbacks/postCustomDoorEnter.lua +5 -5
- package/dist/callbacks/postDiceRoomActivated.lua +2 -2
- package/dist/callbacks/postFlip.lua +3 -3
- package/dist/callbacks/postGridEntity.lua +3 -3
- package/dist/callbacks/postGridEntityCollision.lua +3 -3
- package/dist/callbacks/postGridEntityRender.lua +2 -2
- package/dist/callbacks/postNewRoomEarly.lua +5 -5
- package/dist/callbacks/postPickupCollect.lua +2 -2
- package/dist/callbacks/postPitRender.lua +2 -2
- package/dist/callbacks/postPitUpdate.lua +2 -2
- package/dist/callbacks/postPlayerCollectible.lua +2 -2
- package/dist/callbacks/postPoopRender.lua +2 -2
- package/dist/callbacks/postPoopUpdate.lua +2 -2
- package/dist/callbacks/postPressurePlateRender.lua +2 -2
- package/dist/callbacks/postPressurePlateUpdate.lua +2 -2
- package/dist/callbacks/postPurchase.lua +2 -2
- package/dist/callbacks/postRockRender.lua +2 -2
- package/dist/callbacks/postRockUpdate.lua +2 -2
- package/dist/callbacks/postSlotInitUpdate.lua +2 -2
- package/dist/callbacks/postSlotRender.lua +2 -2
- package/dist/callbacks/postSpikesRender.lua +2 -2
- package/dist/callbacks/postSpikesUpdate.lua +2 -2
- package/dist/callbacks/postTNTRender.lua +2 -2
- package/dist/callbacks/postTNTUpdate.lua +2 -2
- package/dist/callbacks/preBerserkDeath.lua +2 -2
- package/dist/callbacks/preNewLevel.lua +2 -2
- package/dist/callbacks/subscriptions/postDoorRender.d.ts +2 -3
- package/dist/callbacks/subscriptions/postDoorRender.d.ts.map +1 -1
- package/dist/callbacks/subscriptions/postDoorRender.lua +3 -3
- package/dist/callbacks/subscriptions/postDoorUpdate.d.ts +2 -3
- package/dist/callbacks/subscriptions/postDoorUpdate.d.ts.map +1 -1
- package/dist/callbacks/subscriptions/postDoorUpdate.lua +3 -3
- package/dist/callbacks/subscriptions/postPitRender.d.ts +2 -3
- package/dist/callbacks/subscriptions/postPitRender.d.ts.map +1 -1
- package/dist/callbacks/subscriptions/postPitRender.lua +3 -3
- package/dist/callbacks/subscriptions/postPitUpdate.d.ts +2 -3
- package/dist/callbacks/subscriptions/postPitUpdate.d.ts.map +1 -1
- package/dist/callbacks/subscriptions/postPitUpdate.lua +3 -3
- package/dist/callbacks/subscriptions/postPoopRender.d.ts +2 -3
- package/dist/callbacks/subscriptions/postPoopRender.d.ts.map +1 -1
- package/dist/callbacks/subscriptions/postPoopRender.lua +3 -3
- package/dist/callbacks/subscriptions/postPoopUpdate.d.ts +2 -3
- package/dist/callbacks/subscriptions/postPoopUpdate.d.ts.map +1 -1
- package/dist/callbacks/subscriptions/postPoopUpdate.lua +3 -3
- package/dist/callbacks/subscriptions/postPressurePlateRender.d.ts +2 -3
- package/dist/callbacks/subscriptions/postPressurePlateRender.d.ts.map +1 -1
- package/dist/callbacks/subscriptions/postPressurePlateRender.lua +3 -3
- package/dist/callbacks/subscriptions/postPressurePlateUpdate.d.ts +2 -3
- package/dist/callbacks/subscriptions/postPressurePlateUpdate.d.ts.map +1 -1
- package/dist/callbacks/subscriptions/postPressurePlateUpdate.lua +3 -3
- package/dist/features/characterStats.lua +2 -2
- package/dist/features/collectibleItemPoolType.lua +2 -2
- package/dist/features/customGridEntity.d.ts.map +1 -1
- package/dist/features/customGridEntity.lua +5 -5
- package/dist/features/customStage/backdrop.lua +2 -2
- package/dist/features/customStage/{gridEntities.d.ts → customStageGridEntities.d.ts} +1 -1
- package/dist/features/customStage/customStageGridEntities.d.ts.map +1 -0
- package/dist/features/customStage/{gridEntities.lua → customStageGridEntities.lua} +8 -8
- package/dist/features/customStage/{util.d.ts → customStageUtils.d.ts} +1 -1
- package/dist/features/customStage/customStageUtils.d.ts.map +1 -0
- package/dist/features/customStage/{util.lua → customStageUtils.lua} +0 -0
- package/dist/features/customStage/exports.lua +4 -4
- package/dist/features/customStage/init.lua +6 -6
- package/dist/features/customStage/shadows.lua +2 -2
- package/dist/features/customStage/versusScreen.lua +4 -4
- package/dist/features/debugDisplay/v.lua +4 -4
- package/dist/features/deployJSONRoom.lua +20 -20
- package/dist/features/extraConsoleCommands/commandsSubroutines.lua +7 -7
- package/dist/features/extraConsoleCommands/listCommands.d.ts.map +1 -1
- package/dist/features/extraConsoleCommands/listCommands.lua +14 -14
- package/dist/features/pause.lua +2 -2
- package/dist/features/persistentEntities.lua +2 -2
- package/dist/features/preventCollectibleRotation.lua +2 -2
- package/dist/features/saveDataManager/exports.d.ts.map +1 -1
- package/dist/features/sirenHelpers.lua +2 -2
- package/dist/functions/ambush.lua +5 -5
- package/dist/functions/{boss.d.ts → bosses.d.ts} +22 -4
- package/dist/functions/bosses.d.ts.map +1 -0
- package/dist/functions/{boss.lua → bosses.lua} +38 -13
- package/dist/functions/collectibleTag.lua +2 -2
- package/dist/functions/collectibles.lua +5 -5
- package/dist/functions/{entity.d.ts → entities.d.ts} +21 -19
- package/dist/functions/entities.d.ts.map +1 -0
- package/dist/functions/{entity.lua → entities.lua} +25 -20
- package/dist/functions/{entitySpecific.d.ts → entitiesSpecific.d.ts} +145 -68
- package/dist/functions/entitiesSpecific.d.ts.map +1 -0
- package/dist/functions/{entitySpecific.lua → entitiesSpecific.lua} +203 -65
- package/dist/functions/familiars.lua +2 -2
- package/dist/functions/{gridEntity.d.ts → gridEntities.d.ts} +48 -17
- package/dist/functions/gridEntities.d.ts.map +1 -0
- package/dist/functions/{gridEntity.lua → gridEntities.lua} +140 -90
- package/dist/functions/gridEntitiesSpecific.d.ts +141 -0
- package/dist/functions/gridEntitiesSpecific.d.ts.map +1 -0
- package/dist/functions/gridEntitiesSpecific.lua +366 -0
- package/dist/functions/log.d.ts +14 -6
- package/dist/functions/log.d.ts.map +1 -1
- package/dist/functions/log.lua +201 -163
- package/dist/functions/{npc.d.ts → npcs.d.ts} +24 -2
- package/dist/functions/npcs.d.ts.map +1 -0
- package/dist/functions/{npc.lua → npcs.lua} +44 -9
- package/dist/functions/pickups.d.ts +4 -119
- package/dist/functions/pickups.d.ts.map +1 -1
- package/dist/functions/pickups.lua +10 -439
- package/dist/functions/pickupsSpecific.d.ts +229 -0
- package/dist/functions/pickupsSpecific.d.ts.map +1 -0
- package/dist/functions/pickupsSpecific.lua +560 -0
- package/dist/functions/playerHealth.lua +6 -6
- package/dist/functions/{player.d.ts → players.d.ts} +1 -1
- package/dist/functions/players.d.ts.map +1 -0
- package/dist/functions/{player.lua → players.lua} +0 -0
- package/dist/functions/pocketItems.lua +2 -2
- package/dist/functions/positionVelocity.lua +6 -6
- package/dist/functions/pressurePlate.d.ts +10 -0
- package/dist/functions/pressurePlate.d.ts.map +1 -0
- package/dist/functions/pressurePlate.lua +29 -0
- package/dist/functions/revive.lua +7 -7
- package/dist/functions/rooms.lua +2 -2
- package/dist/functions/saveFile.lua +3 -3
- package/dist/functions/spawnCollectible.lua +4 -4
- package/dist/functions/{sprite.d.ts → sprites.d.ts} +1 -1
- package/dist/functions/sprites.d.ts.map +1 -0
- package/dist/functions/{sprite.lua → sprites.lua} +0 -0
- package/dist/functions/transformations.lua +2 -2
- package/dist/functions/trinketGive.lua +2 -2
- package/dist/functions/trinkets.lua +6 -6
- package/dist/functions/utils.d.ts +7 -0
- package/dist/functions/utils.d.ts.map +1 -1
- package/dist/functions/utils.lua +35 -22
- package/dist/index.d.ts +10 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.lua +26 -10
- package/dist/types/AnyGridEntity.d.ts +10 -0
- package/dist/types/AnyGridEntity.d.ts.map +1 -0
- package/dist/types/AnyGridEntity.lua +2 -0
- package/package.json +2 -2
- package/src/callbacks/customRevive.ts +2 -2
- package/src/callbacks/postCursedTeleport.ts +1 -1
- package/src/callbacks/postCustomDoorEnter.ts +2 -2
- package/src/callbacks/postDiceRoomActivated.ts +1 -1
- package/src/callbacks/postFlip.ts +1 -1
- package/src/callbacks/postGridEntity.ts +1 -1
- package/src/callbacks/postGridEntityCollision.ts +1 -1
- package/src/callbacks/postGridEntityRender.ts +1 -1
- package/src/callbacks/postNewRoomEarly.ts +9 -3
- package/src/callbacks/postPickupCollect.ts +1 -1
- package/src/callbacks/postPitRender.ts +1 -1
- package/src/callbacks/postPitUpdate.ts +1 -1
- package/src/callbacks/postPlayerCollectible.ts +1 -1
- package/src/callbacks/postPoopRender.ts +1 -1
- package/src/callbacks/postPoopUpdate.ts +1 -1
- package/src/callbacks/postPressurePlateRender.ts +1 -1
- package/src/callbacks/postPressurePlateUpdate.ts +1 -1
- package/src/callbacks/postPurchase.ts +1 -1
- package/src/callbacks/postRockRender.ts +1 -1
- package/src/callbacks/postRockUpdate.ts +1 -1
- package/src/callbacks/postSlotInitUpdate.ts +1 -1
- package/src/callbacks/postSlotRender.ts +1 -1
- package/src/callbacks/postSpikesRender.ts +1 -1
- package/src/callbacks/postSpikesUpdate.ts +1 -1
- package/src/callbacks/postTNTRender.ts +1 -1
- package/src/callbacks/postTNTUpdate.ts +1 -1
- package/src/callbacks/preBerserkDeath.ts +1 -1
- package/src/callbacks/preNewLevel.ts +1 -1
- package/src/callbacks/subscriptions/postDoorRender.ts +7 -5
- package/src/callbacks/subscriptions/postDoorUpdate.ts +7 -5
- package/src/callbacks/subscriptions/postPitRender.ts +6 -7
- package/src/callbacks/subscriptions/postPitUpdate.ts +6 -7
- package/src/callbacks/subscriptions/postPoopRender.ts +7 -5
- package/src/callbacks/subscriptions/postPoopUpdate.ts +7 -5
- package/src/callbacks/subscriptions/postPressurePlateRender.ts +7 -5
- package/src/callbacks/subscriptions/postPressurePlateUpdate.ts +7 -5
- package/src/features/characterStats.ts +1 -1
- package/src/features/collectibleItemPoolType.ts +1 -1
- package/src/features/customGridEntity.ts +6 -3
- package/src/features/customStage/backdrop.ts +1 -1
- package/src/features/customStage/{gridEntities.ts → customStageGridEntities.ts} +3 -3
- package/src/features/customStage/{util.ts → customStageUtils.ts} +0 -0
- package/src/features/customStage/exports.ts +2 -2
- package/src/features/customStage/init.ts +1 -1
- package/src/features/customStage/shadows.ts +1 -1
- package/src/features/customStage/versusScreen.ts +2 -2
- package/src/features/debugDisplay/v.ts +2 -2
- package/src/features/deployJSONRoom.ts +11 -7
- package/src/features/extraConsoleCommands/commandsSubroutines.ts +5 -5
- package/src/features/extraConsoleCommands/listCommands.ts +10 -6
- package/src/features/pause.ts +1 -1
- package/src/features/persistentEntities.ts +1 -1
- package/src/features/preventCollectibleRotation.ts +1 -1
- package/src/features/saveDataManager/exports.ts +7 -4
- package/src/features/sirenHelpers.ts +1 -1
- package/src/functions/ambush.ts +2 -2
- package/src/functions/{boss.ts → bosses.ts} +29 -21
- package/src/functions/collectibleTag.ts +1 -1
- package/src/functions/collectibles.ts +2 -2
- package/src/functions/{entity.ts → entities.ts} +23 -21
- package/src/functions/{entitySpecific.ts → entitiesSpecific.ts} +170 -99
- package/src/functions/familiars.ts +1 -1
- package/src/functions/{gridEntity.ts → gridEntities.ts} +110 -34
- package/src/functions/gridEntitiesSpecific.ts +490 -0
- package/src/functions/log.ts +227 -181
- package/src/functions/{npc.ts → npcs.ts} +42 -11
- package/src/functions/pickups.ts +8 -475
- package/src/functions/pickupsSpecific.ts +613 -0
- package/src/functions/playerHealth.ts +1 -1
- package/src/functions/{player.ts → players.ts} +0 -0
- package/src/functions/pocketItems.ts +1 -1
- package/src/functions/positionVelocity.ts +3 -3
- package/src/functions/pressurePlate.ts +29 -0
- package/src/functions/revive.ts +2 -2
- package/src/functions/rooms.ts +1 -1
- package/src/functions/saveFile.ts +1 -1
- package/src/functions/spawnCollectible.ts +2 -2
- package/src/functions/{sprite.ts → sprites.ts} +0 -0
- package/src/functions/transformations.ts +1 -1
- package/src/functions/trinketGive.ts +1 -1
- package/src/functions/trinkets.ts +3 -3
- package/src/functions/utils.ts +32 -13
- package/src/index.ts +10 -8
- package/src/types/AnyGridEntity.ts +9 -0
- package/dist/features/customStage/gridEntities.d.ts.map +0 -1
- package/dist/features/customStage/util.d.ts.map +0 -1
- package/dist/functions/boss.d.ts.map +0 -1
- package/dist/functions/entity.d.ts.map +0 -1
- package/dist/functions/entitySpecific.d.ts.map +0 -1
- package/dist/functions/gridEntity.d.ts.map +0 -1
- package/dist/functions/gridEntitySpecific.d.ts +0 -29
- package/dist/functions/gridEntitySpecific.d.ts.map +0 -1
- package/dist/functions/gridEntitySpecific.lua +0 -114
- package/dist/functions/npc.d.ts.map +0 -1
- package/dist/functions/player.d.ts.map +0 -1
- package/dist/functions/sprite.d.ts.map +0 -1
- package/src/functions/gridEntitySpecific.ts +0 -143
package/src/functions/log.ts
CHANGED
|
@@ -16,13 +16,13 @@ import {
|
|
|
16
16
|
import { game, sfxManager } from "../cachedClasses";
|
|
17
17
|
import { arrayToString } from "./array";
|
|
18
18
|
import { getCollectibleName } from "./collectibles";
|
|
19
|
-
import { getEntities, getEntityID } from "./
|
|
19
|
+
import { getEntities, getEntityID } from "./entities";
|
|
20
20
|
import { getEnumEntries } from "./enums";
|
|
21
21
|
import { hasFlag } from "./flag";
|
|
22
|
-
import { getGridEntities } from "./
|
|
22
|
+
import { getGridEntities, getGridEntityID } from "./gridEntities";
|
|
23
23
|
import { getIsaacAPIClassName } from "./isaacAPIClass";
|
|
24
|
-
import { getEffectsList, getPlayerName } from "./player";
|
|
25
24
|
import { getPlayerHealth } from "./playerHealth";
|
|
25
|
+
import { getEffectsList, getPlayerName } from "./players";
|
|
26
26
|
import { getRoomData, getRoomGridIndex, getRoomListIndex } from "./roomData";
|
|
27
27
|
import { combineSets, getSortedSetValues } from "./set";
|
|
28
28
|
import { iterateTableInOrder } from "./table";
|
|
@@ -83,6 +83,106 @@ export function log(this: void, msg: string): void {
|
|
|
83
83
|
Isaac.DebugString(debugMsg);
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
+
/** Helper function for printing out every entity (or filtered entity) in the current room. */
|
|
87
|
+
export function logAllEntities(
|
|
88
|
+
this: void,
|
|
89
|
+
includeBackgroundEffects: boolean,
|
|
90
|
+
entityTypeFilter?: EntityType,
|
|
91
|
+
): void {
|
|
92
|
+
let msg = "Entities in the room";
|
|
93
|
+
if (entityTypeFilter !== undefined) {
|
|
94
|
+
msg += ` (filtered to entity type ${entityTypeFilter})`;
|
|
95
|
+
} else if (!includeBackgroundEffects) {
|
|
96
|
+
msg += " (not including background effects)";
|
|
97
|
+
}
|
|
98
|
+
msg += ":\n";
|
|
99
|
+
|
|
100
|
+
const entities = getEntities();
|
|
101
|
+
let numMatchedEntities = 0;
|
|
102
|
+
entities.forEach((entity, i) => {
|
|
103
|
+
// If a filter was specified, exclude all entities outside of the filter.
|
|
104
|
+
if (entityTypeFilter !== undefined && entity.Type !== entityTypeFilter) {
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
const effect = entity.ToEffect();
|
|
109
|
+
if (
|
|
110
|
+
!includeBackgroundEffects &&
|
|
111
|
+
effect !== undefined &&
|
|
112
|
+
IGNORE_EFFECT_VARIANTS.has(effect.Variant)
|
|
113
|
+
) {
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
msg += getEntityLogLine(entity, i + 1);
|
|
118
|
+
numMatchedEntities++;
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
if (numMatchedEntities === 0) {
|
|
122
|
+
msg += "(no entities matched)\n";
|
|
123
|
+
} else {
|
|
124
|
+
msg += `(${numMatchedEntities} total ${
|
|
125
|
+
numMatchedEntities === 1 ? "entity" : "entities"
|
|
126
|
+
})\n`;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
log(msg);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Helper function for printing out every grid entity (or filtered grid entity) in the current room.
|
|
134
|
+
*/
|
|
135
|
+
export function logAllGridEntities(
|
|
136
|
+
this: void,
|
|
137
|
+
includeWalls: boolean,
|
|
138
|
+
gridEntityTypeFilter?: GridEntityType,
|
|
139
|
+
): void {
|
|
140
|
+
let msg = "Grid entities in the room";
|
|
141
|
+
if (gridEntityTypeFilter !== undefined) {
|
|
142
|
+
msg += ` (filtered to grid entity type ${gridEntityTypeFilter})`;
|
|
143
|
+
} else if (!includeWalls) {
|
|
144
|
+
msg += " (not including walls)";
|
|
145
|
+
}
|
|
146
|
+
msg += ":\n";
|
|
147
|
+
|
|
148
|
+
const gridEntities = getGridEntities();
|
|
149
|
+
let numMatchedEntities = 0;
|
|
150
|
+
gridEntities.forEach((gridEntity) => {
|
|
151
|
+
const gridEntityIndex = gridEntity.GetGridIndex();
|
|
152
|
+
const gridEntityType = gridEntity.GetType();
|
|
153
|
+
|
|
154
|
+
// If a filter was specified, exclude all entities outside of the filter.
|
|
155
|
+
if (
|
|
156
|
+
gridEntityTypeFilter !== undefined &&
|
|
157
|
+
gridEntityType !== gridEntityTypeFilter
|
|
158
|
+
) {
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
if (
|
|
163
|
+
!includeWalls &&
|
|
164
|
+
gridEntityType === GridEntityType.WALL &&
|
|
165
|
+
gridEntityTypeFilter !== GridEntityType.WALL
|
|
166
|
+
) {
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
msg += getGridEntityLogLine(gridEntity, gridEntityIndex);
|
|
171
|
+
|
|
172
|
+
numMatchedEntities++;
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
if (numMatchedEntities === 0) {
|
|
176
|
+
msg += "(no grid entities matched)\n";
|
|
177
|
+
} else {
|
|
178
|
+
msg += `(${numMatchedEntities} total grid ${
|
|
179
|
+
numMatchedEntities === 1 ? "entity" : "entities"
|
|
180
|
+
})\n`;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
log(msg);
|
|
184
|
+
}
|
|
185
|
+
|
|
86
186
|
export function logArray<T>(this: void, array: T[] | readonly T[]): void {
|
|
87
187
|
const arrayString = arrayToString(array);
|
|
88
188
|
log(`Array: ${arrayString}`);
|
|
@@ -130,116 +230,90 @@ export function logEffects(this: void, player: EntityPlayer): void {
|
|
|
130
230
|
});
|
|
131
231
|
}
|
|
132
232
|
|
|
133
|
-
/** Helper function for
|
|
134
|
-
export function logEntities(
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
entityTypeFilter?: EntityType,
|
|
138
|
-
): void {
|
|
139
|
-
let msg = "Entities in the room";
|
|
140
|
-
if (entityTypeFilter !== undefined) {
|
|
141
|
-
msg += ` (filtered to entity type ${entityTypeFilter})`;
|
|
142
|
-
} else if (!includeBackgroundEffects) {
|
|
143
|
-
msg += " (not including background effects)";
|
|
233
|
+
/** Helper function for logging an array of specific entities. */
|
|
234
|
+
export function logEntities(this: void, entities: Entity[]): void {
|
|
235
|
+
for (const entity of entities) {
|
|
236
|
+
logEntity(entity);
|
|
144
237
|
}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
const entities = getEntities();
|
|
148
|
-
let numMatchedEntities = 0;
|
|
149
|
-
entities.forEach((entity, i) => {
|
|
150
|
-
// If a filter was specified, exclude all entities outside of the filter.
|
|
151
|
-
if (entityTypeFilter !== undefined && entity.Type !== entityTypeFilter) {
|
|
152
|
-
return;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
const effect = entity.ToEffect();
|
|
156
|
-
if (
|
|
157
|
-
!includeBackgroundEffects &&
|
|
158
|
-
effect !== undefined &&
|
|
159
|
-
IGNORE_EFFECT_VARIANTS.has(effect.Variant)
|
|
160
|
-
) {
|
|
161
|
-
return;
|
|
162
|
-
}
|
|
238
|
+
}
|
|
163
239
|
|
|
164
|
-
|
|
165
|
-
|
|
240
|
+
/** Helper function to log information about a specific entity. */
|
|
241
|
+
export function logEntity(this: void, entity: Entity): void {
|
|
242
|
+
const msg = getEntityLogLine(entity);
|
|
243
|
+
log(msg);
|
|
244
|
+
}
|
|
166
245
|
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
msg += " (bomb)";
|
|
170
|
-
}
|
|
246
|
+
function getEntityLogLine(entity: Entity, num?: int): string {
|
|
247
|
+
let msg = num === undefined ? "" : `${num}) `;
|
|
171
248
|
|
|
172
|
-
|
|
173
|
-
msg += ` (effect) (State: ${effect.State})`;
|
|
174
|
-
}
|
|
249
|
+
msg += getEntityID(entity);
|
|
175
250
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
251
|
+
const bomb = entity.ToBomb();
|
|
252
|
+
if (bomb !== undefined) {
|
|
253
|
+
msg += " (bomb)";
|
|
254
|
+
}
|
|
180
255
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
256
|
+
const effect = entity.ToEffect();
|
|
257
|
+
if (effect !== undefined) {
|
|
258
|
+
msg += ` (effect) (State: ${effect.State})`;
|
|
259
|
+
}
|
|
185
260
|
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
261
|
+
const familiar = entity.ToFamiliar();
|
|
262
|
+
if (familiar !== undefined) {
|
|
263
|
+
msg += ` (familiar) (State: ${familiar.State})`;
|
|
264
|
+
}
|
|
190
265
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
266
|
+
const knife = entity.ToKnife();
|
|
267
|
+
if (knife !== undefined) {
|
|
268
|
+
msg += " (knife)";
|
|
269
|
+
}
|
|
195
270
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
271
|
+
const laser = entity.ToLaser();
|
|
272
|
+
if (laser !== undefined) {
|
|
273
|
+
msg += " (laser)";
|
|
274
|
+
}
|
|
200
275
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
276
|
+
const npc = entity.ToNPC();
|
|
277
|
+
if (npc !== undefined) {
|
|
278
|
+
msg += ` (NPC) (State: ${npc.State})`;
|
|
279
|
+
}
|
|
205
280
|
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
281
|
+
const pickup = entity.ToPickup();
|
|
282
|
+
if (pickup !== undefined) {
|
|
283
|
+
msg += ` (pickup) (State: ${pickup.State})`;
|
|
284
|
+
}
|
|
210
285
|
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
286
|
+
const player = entity.ToPlayer();
|
|
287
|
+
if (player !== undefined) {
|
|
288
|
+
msg += " (player)";
|
|
289
|
+
}
|
|
215
290
|
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
msg +=
|
|
219
|
-
|
|
220
|
-
msg += ` - Position: (${entity.Position.X}, ${entity.Position.Y})\n`;
|
|
221
|
-
msg += ` - Velocity: (${entity.Velocity.X}, ${entity.Velocity.Y})\n`;
|
|
222
|
-
msg += ` - HP: ${entity.HitPoints} / ${entity.MaxHitPoints}\n`;
|
|
223
|
-
msg += ` - Parent: ${entity.Parent}\n`;
|
|
224
|
-
msg += ` - Child: ${entity.Child}\n`;
|
|
225
|
-
msg += ` - SpawnerEntity: ${entity.SpawnerEntity}\n`;
|
|
226
|
-
msg += ` - SpawnerType / SpawnerVariant: ${entity.SpawnerType}.${entity.SpawnerVariant}\n`;
|
|
227
|
-
if (npc !== undefined) {
|
|
228
|
-
msg += ` - CanShutDoors: ${npc.CanShutDoors}\n`;
|
|
229
|
-
}
|
|
291
|
+
const projectile = entity.ToProjectile();
|
|
292
|
+
if (projectile !== undefined) {
|
|
293
|
+
msg += " (projectile)";
|
|
294
|
+
}
|
|
230
295
|
|
|
231
|
-
|
|
232
|
-
|
|
296
|
+
const tear = entity.ToTear();
|
|
297
|
+
if (tear !== undefined) {
|
|
298
|
+
msg += " (tear)";
|
|
299
|
+
}
|
|
233
300
|
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
301
|
+
msg += "\n";
|
|
302
|
+
msg += ` - Index: ${entity.Index}\n`;
|
|
303
|
+
msg += ` - InitSeed: ${entity.InitSeed}\n`;
|
|
304
|
+
msg += ` - DropSeed: ${entity.DropSeed}\n`;
|
|
305
|
+
msg += ` - Position: (${entity.Position.X}, ${entity.Position.Y})\n`;
|
|
306
|
+
msg += ` - Velocity: (${entity.Velocity.X}, ${entity.Velocity.Y})\n`;
|
|
307
|
+
msg += ` - HP: ${entity.HitPoints} / ${entity.MaxHitPoints}\n`;
|
|
308
|
+
msg += ` - Parent: ${entity.Parent}\n`;
|
|
309
|
+
msg += ` - Child: ${entity.Child}\n`;
|
|
310
|
+
msg += ` - SpawnerEntity: ${entity.SpawnerEntity}\n`;
|
|
311
|
+
msg += ` - SpawnerType / SpawnerVariant: ${entity.SpawnerType}.${entity.SpawnerVariant}\n`;
|
|
312
|
+
if (npc !== undefined) {
|
|
313
|
+
msg += ` - CanShutDoors: ${npc.CanShutDoors}\n`;
|
|
240
314
|
}
|
|
241
315
|
|
|
242
|
-
|
|
316
|
+
return msg;
|
|
243
317
|
}
|
|
244
318
|
|
|
245
319
|
/** Helper function for printing out every entity flag that is turned on. Useful when debugging. */
|
|
@@ -316,106 +390,74 @@ export function logGameStateFlags(this: void): void {
|
|
|
316
390
|
}
|
|
317
391
|
}
|
|
318
392
|
|
|
319
|
-
/**
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
this: void,
|
|
324
|
-
includeWalls: boolean,
|
|
325
|
-
gridEntityTypeFilter?: GridEntityType,
|
|
326
|
-
): void {
|
|
327
|
-
let msg = "Grid entities in the room";
|
|
328
|
-
if (gridEntityTypeFilter !== undefined) {
|
|
329
|
-
msg += ` (filtered to grid entity type ${gridEntityTypeFilter})`;
|
|
330
|
-
} else if (!includeWalls) {
|
|
331
|
-
msg += " (not including walls)";
|
|
393
|
+
/** Helper function for logging an array of specific grid entities. */
|
|
394
|
+
export function logGridEntities(this: void, gridEntities: GridEntity[]): void {
|
|
395
|
+
for (const gridEntity of gridEntities) {
|
|
396
|
+
logGridEntity(gridEntity);
|
|
332
397
|
}
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
const gridEntities = getGridEntities();
|
|
336
|
-
let numMatchedEntities = 0;
|
|
337
|
-
gridEntities.forEach((gridEntity) => {
|
|
338
|
-
const gridEntityIndex = gridEntity.GetGridIndex();
|
|
339
|
-
const gridEntityType = gridEntity.GetType();
|
|
340
|
-
const gridEntityVariant = gridEntity.GetVariant();
|
|
341
|
-
const gridEntityDesc = gridEntity.GetSaveState();
|
|
342
|
-
|
|
343
|
-
// If a filter was specified, exclude all entities outside of the filter.
|
|
344
|
-
if (
|
|
345
|
-
gridEntityTypeFilter !== undefined &&
|
|
346
|
-
gridEntityType !== gridEntityTypeFilter
|
|
347
|
-
) {
|
|
348
|
-
return;
|
|
349
|
-
}
|
|
398
|
+
}
|
|
350
399
|
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
return;
|
|
357
|
-
}
|
|
400
|
+
/** Helper function for log information about a specific grid entity. */
|
|
401
|
+
export function logGridEntity(this: void, gridEntity: GridEntity): void {
|
|
402
|
+
const msg = getGridEntityLogLine(gridEntity);
|
|
403
|
+
log(msg);
|
|
404
|
+
}
|
|
358
405
|
|
|
359
|
-
|
|
406
|
+
function getGridEntityLogLine(gridEntity: GridEntity, num?: int): string {
|
|
407
|
+
const gridEntityDesc = gridEntity.GetSaveState();
|
|
360
408
|
|
|
361
|
-
|
|
362
|
-
if (door !== undefined) {
|
|
363
|
-
msg += " (door)";
|
|
364
|
-
}
|
|
409
|
+
let msg = num === undefined ? "" : `${num}) `;
|
|
365
410
|
|
|
366
|
-
|
|
367
|
-
if (pit !== undefined) {
|
|
368
|
-
msg += " (pit)";
|
|
369
|
-
}
|
|
411
|
+
msg += getGridEntityID(gridEntity);
|
|
370
412
|
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
413
|
+
const door = gridEntity.ToDoor();
|
|
414
|
+
if (door !== undefined) {
|
|
415
|
+
msg += " (door)";
|
|
416
|
+
}
|
|
375
417
|
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
418
|
+
const pit = gridEntity.ToPit();
|
|
419
|
+
if (pit !== undefined) {
|
|
420
|
+
msg += " (pit)";
|
|
421
|
+
}
|
|
380
422
|
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
423
|
+
const poop = gridEntity.ToPoop();
|
|
424
|
+
if (poop !== undefined) {
|
|
425
|
+
msg += " (poop)";
|
|
426
|
+
}
|
|
385
427
|
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
428
|
+
const pressurePlate = gridEntity.ToPressurePlate();
|
|
429
|
+
if (pressurePlate !== undefined) {
|
|
430
|
+
msg += " (pressurePlate)";
|
|
431
|
+
}
|
|
390
432
|
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
433
|
+
const rock = gridEntity.ToRock();
|
|
434
|
+
if (rock !== undefined) {
|
|
435
|
+
msg += " (rock)";
|
|
436
|
+
}
|
|
395
437
|
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
msg +=
|
|
399
|
-
|
|
400
|
-
if (door !== undefined) {
|
|
401
|
-
msg += ` - Slot: ${door.Slot}\n`;
|
|
402
|
-
msg += ` - Direction: ${door.Direction}\n`;
|
|
403
|
-
msg += ` - TargetRoomIndex: ${door.TargetRoomIndex}\n`;
|
|
404
|
-
msg += ` - TargetRoomType: ${door.TargetRoomType}\n`;
|
|
405
|
-
}
|
|
438
|
+
const spikes = gridEntity.ToSpikes();
|
|
439
|
+
if (spikes !== undefined) {
|
|
440
|
+
msg += " (spikes)";
|
|
441
|
+
}
|
|
406
442
|
|
|
407
|
-
|
|
408
|
-
|
|
443
|
+
const tnt = gridEntity.ToTNT();
|
|
444
|
+
if (tnt !== undefined) {
|
|
445
|
+
msg += " (TNT)";
|
|
446
|
+
}
|
|
409
447
|
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
448
|
+
msg += ` - State: ${gridEntity.State}\n`;
|
|
449
|
+
msg += ` - VarData: ${gridEntity.VarData}\n`;
|
|
450
|
+
msg += ` - Position: (${gridEntity.Position.X}, ${gridEntity.Position.Y})\n`;
|
|
451
|
+
msg += ` - SpawnSeed: ${gridEntityDesc.SpawnSeed}\n`;
|
|
452
|
+
msg += ` - VariableSeed: ${gridEntityDesc.VariableSeed})\n`;
|
|
453
|
+
if (door !== undefined) {
|
|
454
|
+
msg += ` - Slot: ${door.Slot}\n`;
|
|
455
|
+
msg += ` - Direction: ${door.Direction}\n`;
|
|
456
|
+
msg += ` - TargetRoomIndex: ${door.TargetRoomIndex}\n`;
|
|
457
|
+
msg += ` - TargetRoomType: ${door.TargetRoomType}\n`;
|
|
416
458
|
}
|
|
417
459
|
|
|
418
|
-
|
|
460
|
+
return msg;
|
|
419
461
|
}
|
|
420
462
|
|
|
421
463
|
export function logKColor(this: void, kColor: KColor): void {
|
|
@@ -714,17 +756,21 @@ export function setLogFunctionsGlobal(): void {
|
|
|
714
756
|
const globals = _G as Record<string, unknown>;
|
|
715
757
|
|
|
716
758
|
globals["log"] = log;
|
|
759
|
+
globals["logAllEntities"] = logAllEntities;
|
|
760
|
+
globals["logAllGridEntities"] = logAllGridEntities;
|
|
717
761
|
globals["logArray"] = logArray;
|
|
718
762
|
globals["logColor"] = logColor;
|
|
719
763
|
globals["logDamageFlags"] = logDamageFlags;
|
|
720
764
|
globals["logEffects"] = logEffects;
|
|
721
765
|
globals["logEntities"] = logEntities;
|
|
766
|
+
globals["logEntity"] = logEntity;
|
|
722
767
|
globals["logEntityID"] = logEntityID;
|
|
723
768
|
globals["logEntityFlags"] = logEntityFlags;
|
|
724
769
|
globals["logError"] = logError;
|
|
725
770
|
globals["logFlags"] = logFlags;
|
|
726
771
|
globals["logGameStateFlags"] = logGameStateFlags;
|
|
727
772
|
globals["logGridEntities"] = logGridEntities;
|
|
773
|
+
globals["logGridEntity"] = logGridEntity;
|
|
728
774
|
globals["logKColor"] = logKColor;
|
|
729
775
|
globals["logLevelStateFlags"] = logLevelStateFlags;
|
|
730
776
|
globals["logMap"] = logMap;
|
|
@@ -16,8 +16,8 @@ import {
|
|
|
16
16
|
VisVariant,
|
|
17
17
|
} from "isaac-typescript-definitions";
|
|
18
18
|
import { EGGY_STATE_FRAME_OF_FINAL_SPIDER } from "../constants";
|
|
19
|
-
import { getFilteredNewEntities } from "./
|
|
20
|
-
import { getNPCs, getProjectiles } from "./
|
|
19
|
+
import { getFilteredNewEntities } from "./entities";
|
|
20
|
+
import { getNPCs, getProjectiles } from "./entitiesSpecific";
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
23
|
* Used to filter out certain NPCs when determining of an NPC is "alive" and/or should keep the
|
|
@@ -78,19 +78,22 @@ export function fireProjectiles(
|
|
|
78
78
|
*
|
|
79
79
|
* This function will not include NPCs on an internal blacklist, such as Death's scythes or Big Horn
|
|
80
80
|
* holes.
|
|
81
|
+
*
|
|
82
|
+
* @param entityType Optional. If specified, will only get the NPCs that match the type. Default is
|
|
83
|
+
* -1, which matches every type.
|
|
84
|
+
* @param variant Optional. If specified, will only get the NPCs that match the variant. Default is
|
|
85
|
+
* -1, which matches every variant.
|
|
86
|
+
* @param subType Optional. If specified, will only get the NPCs that match the sub-type. Default is
|
|
87
|
+
* -1, which matches every sub-type.
|
|
88
|
+
* @param ignoreFriendly Optional. Default is false.
|
|
81
89
|
*/
|
|
82
90
|
export function getAliveNPCs(
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
91
|
+
entityType: EntityType = -1,
|
|
92
|
+
variant = -1,
|
|
93
|
+
subType = -1,
|
|
86
94
|
ignoreFriendly = false,
|
|
87
95
|
): EntityNPC[] {
|
|
88
|
-
const npcs = getNPCs(
|
|
89
|
-
matchingEntityType,
|
|
90
|
-
matchingVariant,
|
|
91
|
-
matchingSubType,
|
|
92
|
-
ignoreFriendly,
|
|
93
|
-
);
|
|
96
|
+
const npcs = getNPCs(entityType, variant, subType, ignoreFriendly);
|
|
94
97
|
return npcs.filter((npc) => !npc.IsDead() && !isAliveExceptionNPC(npc));
|
|
95
98
|
}
|
|
96
99
|
|
|
@@ -146,3 +149,31 @@ export function isRaglingDeathPatch(npc: EntityNPC): boolean {
|
|
|
146
149
|
npc.State === NpcState.SPECIAL
|
|
147
150
|
);
|
|
148
151
|
}
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* The base game `EntityNPC.FireProjectiles` method does not return anything, which is a problem in
|
|
155
|
+
* situations where you need to work with the fired projectiles. This function invokes that method,
|
|
156
|
+
* and then returns the projectiles that were spawned.
|
|
157
|
+
*
|
|
158
|
+
* @param npc The EntityNPC firing projectiles.
|
|
159
|
+
* @param position The starting position of the projectiles.
|
|
160
|
+
* @param velocity The starting velocity of the projectiles.
|
|
161
|
+
* @param projectilesMode A ProjectilesMode enum value defining how to fire the projectiles.
|
|
162
|
+
* @param projectileParams A ProjectileParams object containing various parameters for the
|
|
163
|
+
* projectiles.
|
|
164
|
+
* @returns An array of EntityProjectiles containing all fired projectiles.
|
|
165
|
+
*/
|
|
166
|
+
export function npcFireProjectiles(
|
|
167
|
+
npc: EntityNPC,
|
|
168
|
+
position: Vector,
|
|
169
|
+
velocity: Vector,
|
|
170
|
+
projectilesMode: ProjectilesMode,
|
|
171
|
+
projectileParams: ProjectileParams,
|
|
172
|
+
): EntityProjectile[] {
|
|
173
|
+
const oldEntities = getProjectiles();
|
|
174
|
+
npc.FireProjectiles(position, velocity, projectilesMode, projectileParams);
|
|
175
|
+
const newEntities = getProjectiles();
|
|
176
|
+
const filteredNewEntities = getFilteredNewEntities(oldEntities, newEntities);
|
|
177
|
+
|
|
178
|
+
return filteredNewEntities;
|
|
179
|
+
}
|