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/dist/functions/log.lua
CHANGED
|
@@ -8,6 +8,7 @@ local __TS__ArraySort = ____lualib.__TS__ArraySort
|
|
|
8
8
|
local __TS__TypeOf = ____lualib.__TS__TypeOf
|
|
9
9
|
local __TS__ObjectKeys = ____lualib.__TS__ObjectKeys
|
|
10
10
|
local ____exports = {}
|
|
11
|
+
local getEntityLogLine, getGridEntityLogLine
|
|
11
12
|
local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
|
|
12
13
|
local DamageFlag = ____isaac_2Dtypescript_2Ddefinitions.DamageFlag
|
|
13
14
|
local EffectVariant = ____isaac_2Dtypescript_2Ddefinitions.EffectVariant
|
|
@@ -28,22 +29,23 @@ local ____array = require("functions.array")
|
|
|
28
29
|
local arrayToString = ____array.arrayToString
|
|
29
30
|
local ____collectibles = require("functions.collectibles")
|
|
30
31
|
local getCollectibleName = ____collectibles.getCollectibleName
|
|
31
|
-
local
|
|
32
|
-
local getEntities =
|
|
33
|
-
local getEntityID =
|
|
32
|
+
local ____entities = require("functions.entities")
|
|
33
|
+
local getEntities = ____entities.getEntities
|
|
34
|
+
local getEntityID = ____entities.getEntityID
|
|
34
35
|
local ____enums = require("functions.enums")
|
|
35
36
|
local getEnumEntries = ____enums.getEnumEntries
|
|
36
37
|
local ____flag = require("functions.flag")
|
|
37
38
|
local hasFlag = ____flag.hasFlag
|
|
38
|
-
local
|
|
39
|
-
local getGridEntities =
|
|
39
|
+
local ____gridEntities = require("functions.gridEntities")
|
|
40
|
+
local getGridEntities = ____gridEntities.getGridEntities
|
|
41
|
+
local getGridEntityID = ____gridEntities.getGridEntityID
|
|
40
42
|
local ____isaacAPIClass = require("functions.isaacAPIClass")
|
|
41
43
|
local getIsaacAPIClassName = ____isaacAPIClass.getIsaacAPIClassName
|
|
42
|
-
local ____player = require("functions.player")
|
|
43
|
-
local getEffectsList = ____player.getEffectsList
|
|
44
|
-
local getPlayerName = ____player.getPlayerName
|
|
45
44
|
local ____playerHealth = require("functions.playerHealth")
|
|
46
45
|
local getPlayerHealth = ____playerHealth.getPlayerHealth
|
|
46
|
+
local ____players = require("functions.players")
|
|
47
|
+
local getEffectsList = ____players.getEffectsList
|
|
48
|
+
local getPlayerName = ____players.getPlayerName
|
|
47
49
|
local ____roomData = require("functions.roomData")
|
|
48
50
|
local getRoomData = ____roomData.getRoomData
|
|
49
51
|
local getRoomGridIndex = ____roomData.getRoomGridIndex
|
|
@@ -86,6 +88,70 @@ function ____exports.log(msg)
|
|
|
86
88
|
local debugMsg = ____exports.getDebugPrependString(nil, msg)
|
|
87
89
|
Isaac.DebugString(debugMsg)
|
|
88
90
|
end
|
|
91
|
+
--- Helper function to log information about a specific entity.
|
|
92
|
+
function ____exports.logEntity(entity)
|
|
93
|
+
local msg = getEntityLogLine(nil, entity)
|
|
94
|
+
____exports.log(msg)
|
|
95
|
+
end
|
|
96
|
+
function getEntityLogLine(self, entity, num)
|
|
97
|
+
local msg = num == nil and "" or tostring(num) .. ") "
|
|
98
|
+
msg = msg .. getEntityID(nil, entity)
|
|
99
|
+
local bomb = entity:ToBomb()
|
|
100
|
+
if bomb ~= nil then
|
|
101
|
+
msg = msg .. " (bomb)"
|
|
102
|
+
end
|
|
103
|
+
local effect = entity:ToEffect()
|
|
104
|
+
if effect ~= nil then
|
|
105
|
+
msg = msg .. (" (effect) (State: " .. tostring(effect.State)) .. ")"
|
|
106
|
+
end
|
|
107
|
+
local familiar = entity:ToFamiliar()
|
|
108
|
+
if familiar ~= nil then
|
|
109
|
+
msg = msg .. (" (familiar) (State: " .. tostring(familiar.State)) .. ")"
|
|
110
|
+
end
|
|
111
|
+
local knife = entity:ToKnife()
|
|
112
|
+
if knife ~= nil then
|
|
113
|
+
msg = msg .. " (knife)"
|
|
114
|
+
end
|
|
115
|
+
local laser = entity:ToLaser()
|
|
116
|
+
if laser ~= nil then
|
|
117
|
+
msg = msg .. " (laser)"
|
|
118
|
+
end
|
|
119
|
+
local npc = entity:ToNPC()
|
|
120
|
+
if npc ~= nil then
|
|
121
|
+
msg = msg .. (" (NPC) (State: " .. tostring(npc.State)) .. ")"
|
|
122
|
+
end
|
|
123
|
+
local pickup = entity:ToPickup()
|
|
124
|
+
if pickup ~= nil then
|
|
125
|
+
msg = msg .. (" (pickup) (State: " .. tostring(pickup.State)) .. ")"
|
|
126
|
+
end
|
|
127
|
+
local player = entity:ToPlayer()
|
|
128
|
+
if player ~= nil then
|
|
129
|
+
msg = msg .. " (player)"
|
|
130
|
+
end
|
|
131
|
+
local projectile = entity:ToProjectile()
|
|
132
|
+
if projectile ~= nil then
|
|
133
|
+
msg = msg .. " (projectile)"
|
|
134
|
+
end
|
|
135
|
+
local tear = entity:ToTear()
|
|
136
|
+
if tear ~= nil then
|
|
137
|
+
msg = msg .. " (tear)"
|
|
138
|
+
end
|
|
139
|
+
msg = msg .. "\n"
|
|
140
|
+
msg = msg .. (" - Index: " .. tostring(entity.Index)) .. "\n"
|
|
141
|
+
msg = msg .. (" - InitSeed: " .. tostring(entity.InitSeed)) .. "\n"
|
|
142
|
+
msg = msg .. (" - DropSeed: " .. tostring(entity.DropSeed)) .. "\n"
|
|
143
|
+
msg = msg .. (((" - Position: (" .. tostring(entity.Position.X)) .. ", ") .. tostring(entity.Position.Y)) .. ")\n"
|
|
144
|
+
msg = msg .. (((" - Velocity: (" .. tostring(entity.Velocity.X)) .. ", ") .. tostring(entity.Velocity.Y)) .. ")\n"
|
|
145
|
+
msg = msg .. (((" - HP: " .. tostring(entity.HitPoints)) .. " / ") .. tostring(entity.MaxHitPoints)) .. "\n"
|
|
146
|
+
msg = msg .. (" - Parent: " .. tostring(entity.Parent)) .. "\n"
|
|
147
|
+
msg = msg .. (" - Child: " .. tostring(entity.Child)) .. "\n"
|
|
148
|
+
msg = msg .. (" - SpawnerEntity: " .. tostring(entity.SpawnerEntity)) .. "\n"
|
|
149
|
+
msg = msg .. (((" - SpawnerType / SpawnerVariant: " .. tostring(entity.SpawnerType)) .. ".") .. tostring(entity.SpawnerVariant)) .. "\n"
|
|
150
|
+
if npc ~= nil then
|
|
151
|
+
msg = msg .. (" - CanShutDoors: " .. tostring(npc.CanShutDoors)) .. "\n"
|
|
152
|
+
end
|
|
153
|
+
return msg
|
|
154
|
+
end
|
|
89
155
|
--- Helper function for printing out every flag that is turned on. Useful when debugging.
|
|
90
156
|
function ____exports.logFlags(flags, flagEnum, description)
|
|
91
157
|
if description == nil then
|
|
@@ -108,6 +174,56 @@ function ____exports.logFlags(flags, flagEnum, description)
|
|
|
108
174
|
____exports.log(" n/a (no flags)")
|
|
109
175
|
end
|
|
110
176
|
end
|
|
177
|
+
--- Helper function for log information about a specific grid entity.
|
|
178
|
+
function ____exports.logGridEntity(gridEntity)
|
|
179
|
+
local msg = getGridEntityLogLine(nil, gridEntity)
|
|
180
|
+
____exports.log(msg)
|
|
181
|
+
end
|
|
182
|
+
function getGridEntityLogLine(self, gridEntity, num)
|
|
183
|
+
local gridEntityDesc = gridEntity:GetSaveState()
|
|
184
|
+
local msg = num == nil and "" or tostring(num) .. ") "
|
|
185
|
+
msg = msg .. getGridEntityID(nil, gridEntity)
|
|
186
|
+
local door = gridEntity:ToDoor()
|
|
187
|
+
if door ~= nil then
|
|
188
|
+
msg = msg .. " (door)"
|
|
189
|
+
end
|
|
190
|
+
local pit = gridEntity:ToPit()
|
|
191
|
+
if pit ~= nil then
|
|
192
|
+
msg = msg .. " (pit)"
|
|
193
|
+
end
|
|
194
|
+
local poop = gridEntity:ToPoop()
|
|
195
|
+
if poop ~= nil then
|
|
196
|
+
msg = msg .. " (poop)"
|
|
197
|
+
end
|
|
198
|
+
local pressurePlate = gridEntity:ToPressurePlate()
|
|
199
|
+
if pressurePlate ~= nil then
|
|
200
|
+
msg = msg .. " (pressurePlate)"
|
|
201
|
+
end
|
|
202
|
+
local rock = gridEntity:ToRock()
|
|
203
|
+
if rock ~= nil then
|
|
204
|
+
msg = msg .. " (rock)"
|
|
205
|
+
end
|
|
206
|
+
local spikes = gridEntity:ToSpikes()
|
|
207
|
+
if spikes ~= nil then
|
|
208
|
+
msg = msg .. " (spikes)"
|
|
209
|
+
end
|
|
210
|
+
local tnt = gridEntity:ToTNT()
|
|
211
|
+
if tnt ~= nil then
|
|
212
|
+
msg = msg .. " (TNT)"
|
|
213
|
+
end
|
|
214
|
+
msg = msg .. (" - State: " .. tostring(gridEntity.State)) .. "\n"
|
|
215
|
+
msg = msg .. (" - VarData: " .. tostring(gridEntity.VarData)) .. "\n"
|
|
216
|
+
msg = msg .. (((" - Position: (" .. tostring(gridEntity.Position.X)) .. ", ") .. tostring(gridEntity.Position.Y)) .. ")\n"
|
|
217
|
+
msg = msg .. (" - SpawnSeed: " .. tostring(gridEntityDesc.SpawnSeed)) .. "\n"
|
|
218
|
+
msg = msg .. (" - VariableSeed: " .. tostring(gridEntityDesc.VariableSeed)) .. ")\n"
|
|
219
|
+
if door ~= nil then
|
|
220
|
+
msg = msg .. (" - Slot: " .. tostring(door.Slot)) .. "\n"
|
|
221
|
+
msg = msg .. (" - Direction: " .. tostring(door.Direction)) .. "\n"
|
|
222
|
+
msg = msg .. (" - TargetRoomIndex: " .. tostring(door.TargetRoomIndex)) .. "\n"
|
|
223
|
+
msg = msg .. (" - TargetRoomType: " .. tostring(door.TargetRoomType)) .. "\n"
|
|
224
|
+
end
|
|
225
|
+
return msg
|
|
226
|
+
end
|
|
111
227
|
local IGNORE_EFFECT_VARIANTS = __TS__New(Set, {
|
|
112
228
|
EffectVariant.BLOOD_EXPLOSION,
|
|
113
229
|
EffectVariant.BLOOD_PARTICLE,
|
|
@@ -119,6 +235,71 @@ local IGNORE_EFFECT_VARIANTS = __TS__New(Set, {
|
|
|
119
235
|
EffectVariant.LIGHT,
|
|
120
236
|
EffectVariant.TADPOLE
|
|
121
237
|
})
|
|
238
|
+
--- Helper function for printing out every entity (or filtered entity) in the current room.
|
|
239
|
+
function ____exports.logAllEntities(includeBackgroundEffects, entityTypeFilter)
|
|
240
|
+
local msg = "Entities in the room"
|
|
241
|
+
if entityTypeFilter ~= nil then
|
|
242
|
+
msg = msg .. (" (filtered to entity type " .. tostring(entityTypeFilter)) .. ")"
|
|
243
|
+
elseif not includeBackgroundEffects then
|
|
244
|
+
msg = msg .. " (not including background effects)"
|
|
245
|
+
end
|
|
246
|
+
msg = msg .. ":\n"
|
|
247
|
+
local entities = getEntities(nil)
|
|
248
|
+
local numMatchedEntities = 0
|
|
249
|
+
__TS__ArrayForEach(
|
|
250
|
+
entities,
|
|
251
|
+
function(____, entity, i)
|
|
252
|
+
if entityTypeFilter ~= nil and entity.Type ~= entityTypeFilter then
|
|
253
|
+
return
|
|
254
|
+
end
|
|
255
|
+
local effect = entity:ToEffect()
|
|
256
|
+
if not includeBackgroundEffects and effect ~= nil and IGNORE_EFFECT_VARIANTS:has(effect.Variant) then
|
|
257
|
+
return
|
|
258
|
+
end
|
|
259
|
+
msg = msg .. getEntityLogLine(nil, entity, i + 1)
|
|
260
|
+
numMatchedEntities = numMatchedEntities + 1
|
|
261
|
+
end
|
|
262
|
+
)
|
|
263
|
+
if numMatchedEntities == 0 then
|
|
264
|
+
msg = msg .. "(no entities matched)\n"
|
|
265
|
+
else
|
|
266
|
+
msg = msg .. ((("(" .. tostring(numMatchedEntities)) .. " total ") .. (numMatchedEntities == 1 and "entity" or "entities")) .. ")\n"
|
|
267
|
+
end
|
|
268
|
+
____exports.log(msg)
|
|
269
|
+
end
|
|
270
|
+
--- Helper function for printing out every grid entity (or filtered grid entity) in the current room.
|
|
271
|
+
function ____exports.logAllGridEntities(includeWalls, gridEntityTypeFilter)
|
|
272
|
+
local msg = "Grid entities in the room"
|
|
273
|
+
if gridEntityTypeFilter ~= nil then
|
|
274
|
+
msg = msg .. (" (filtered to grid entity type " .. tostring(gridEntityTypeFilter)) .. ")"
|
|
275
|
+
elseif not includeWalls then
|
|
276
|
+
msg = msg .. " (not including walls)"
|
|
277
|
+
end
|
|
278
|
+
msg = msg .. ":\n"
|
|
279
|
+
local gridEntities = getGridEntities(nil)
|
|
280
|
+
local numMatchedEntities = 0
|
|
281
|
+
__TS__ArrayForEach(
|
|
282
|
+
gridEntities,
|
|
283
|
+
function(____, gridEntity)
|
|
284
|
+
local gridEntityIndex = gridEntity:GetGridIndex()
|
|
285
|
+
local gridEntityType = gridEntity:GetType()
|
|
286
|
+
if gridEntityTypeFilter ~= nil and gridEntityType ~= gridEntityTypeFilter then
|
|
287
|
+
return
|
|
288
|
+
end
|
|
289
|
+
if not includeWalls and gridEntityType == GridEntityType.WALL and gridEntityTypeFilter ~= GridEntityType.WALL then
|
|
290
|
+
return
|
|
291
|
+
end
|
|
292
|
+
msg = msg .. getGridEntityLogLine(nil, gridEntity, gridEntityIndex)
|
|
293
|
+
numMatchedEntities = numMatchedEntities + 1
|
|
294
|
+
end
|
|
295
|
+
)
|
|
296
|
+
if numMatchedEntities == 0 then
|
|
297
|
+
msg = msg .. "(no grid entities matched)\n"
|
|
298
|
+
else
|
|
299
|
+
msg = msg .. ((("(" .. tostring(numMatchedEntities)) .. " total grid ") .. (numMatchedEntities == 1 and "entity" or "entities")) .. ")\n"
|
|
300
|
+
end
|
|
301
|
+
____exports.log(msg)
|
|
302
|
+
end
|
|
122
303
|
function ____exports.logArray(array)
|
|
123
304
|
local arrayString = arrayToString(nil, array)
|
|
124
305
|
____exports.log("Array: " .. arrayString)
|
|
@@ -156,91 +337,11 @@ function ____exports.logEffects(player)
|
|
|
156
337
|
end
|
|
157
338
|
)
|
|
158
339
|
end
|
|
159
|
-
--- Helper function for
|
|
160
|
-
function ____exports.logEntities(
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
msg = msg .. (" (filtered to entity type " .. tostring(entityTypeFilter)) .. ")"
|
|
164
|
-
elseif not includeBackgroundEffects then
|
|
165
|
-
msg = msg .. " (not including background effects)"
|
|
166
|
-
end
|
|
167
|
-
msg = msg .. ":\n"
|
|
168
|
-
local entities = getEntities(nil)
|
|
169
|
-
local numMatchedEntities = 0
|
|
170
|
-
__TS__ArrayForEach(
|
|
171
|
-
entities,
|
|
172
|
-
function(____, entity, i)
|
|
173
|
-
if entityTypeFilter ~= nil and entity.Type ~= entityTypeFilter then
|
|
174
|
-
return
|
|
175
|
-
end
|
|
176
|
-
local effect = entity:ToEffect()
|
|
177
|
-
if not includeBackgroundEffects and effect ~= nil and IGNORE_EFFECT_VARIANTS:has(effect.Variant) then
|
|
178
|
-
return
|
|
179
|
-
end
|
|
180
|
-
local entityID = getEntityID(nil, entity)
|
|
181
|
-
msg = msg .. (tostring(i + 1) .. ") ") .. entityID
|
|
182
|
-
local bomb = entity:ToBomb()
|
|
183
|
-
if bomb ~= nil then
|
|
184
|
-
msg = msg .. " (bomb)"
|
|
185
|
-
end
|
|
186
|
-
if effect ~= nil then
|
|
187
|
-
msg = msg .. (" (effect) (State: " .. tostring(effect.State)) .. ")"
|
|
188
|
-
end
|
|
189
|
-
local familiar = entity:ToFamiliar()
|
|
190
|
-
if familiar ~= nil then
|
|
191
|
-
msg = msg .. (" (familiar) (State: " .. tostring(familiar.State)) .. ")"
|
|
192
|
-
end
|
|
193
|
-
local knife = entity:ToKnife()
|
|
194
|
-
if knife ~= nil then
|
|
195
|
-
msg = msg .. " (knife)"
|
|
196
|
-
end
|
|
197
|
-
local laser = entity:ToLaser()
|
|
198
|
-
if laser ~= nil then
|
|
199
|
-
msg = msg .. " (laser)"
|
|
200
|
-
end
|
|
201
|
-
local npc = entity:ToNPC()
|
|
202
|
-
if npc ~= nil then
|
|
203
|
-
msg = msg .. (" (NPC) (State: " .. tostring(npc.State)) .. ")"
|
|
204
|
-
end
|
|
205
|
-
local pickup = entity:ToPickup()
|
|
206
|
-
if pickup ~= nil then
|
|
207
|
-
msg = msg .. (" (pickup) (State: " .. tostring(pickup.State)) .. ")"
|
|
208
|
-
end
|
|
209
|
-
local player = entity:ToPlayer()
|
|
210
|
-
if player ~= nil then
|
|
211
|
-
msg = msg .. " (player)"
|
|
212
|
-
end
|
|
213
|
-
local projectile = entity:ToProjectile()
|
|
214
|
-
if projectile ~= nil then
|
|
215
|
-
msg = msg .. " (projectile)"
|
|
216
|
-
end
|
|
217
|
-
local tear = entity:ToTear()
|
|
218
|
-
if tear ~= nil then
|
|
219
|
-
msg = msg .. " (tear)"
|
|
220
|
-
end
|
|
221
|
-
msg = msg .. "\n"
|
|
222
|
-
msg = msg .. (" - Index: " .. tostring(entity.Index)) .. "\n"
|
|
223
|
-
msg = msg .. (" - InitSeed: " .. tostring(entity.InitSeed)) .. "\n"
|
|
224
|
-
msg = msg .. (" - DropSeed: " .. tostring(entity.DropSeed)) .. "\n"
|
|
225
|
-
msg = msg .. (((" - Position: (" .. tostring(entity.Position.X)) .. ", ") .. tostring(entity.Position.Y)) .. ")\n"
|
|
226
|
-
msg = msg .. (((" - Velocity: (" .. tostring(entity.Velocity.X)) .. ", ") .. tostring(entity.Velocity.Y)) .. ")\n"
|
|
227
|
-
msg = msg .. (((" - HP: " .. tostring(entity.HitPoints)) .. " / ") .. tostring(entity.MaxHitPoints)) .. "\n"
|
|
228
|
-
msg = msg .. (" - Parent: " .. tostring(entity.Parent)) .. "\n"
|
|
229
|
-
msg = msg .. (" - Child: " .. tostring(entity.Child)) .. "\n"
|
|
230
|
-
msg = msg .. (" - SpawnerEntity: " .. tostring(entity.SpawnerEntity)) .. "\n"
|
|
231
|
-
msg = msg .. (((" - SpawnerType / SpawnerVariant: " .. tostring(entity.SpawnerType)) .. ".") .. tostring(entity.SpawnerVariant)) .. "\n"
|
|
232
|
-
if npc ~= nil then
|
|
233
|
-
msg = msg .. (" - CanShutDoors: " .. tostring(npc.CanShutDoors)) .. "\n"
|
|
234
|
-
end
|
|
235
|
-
numMatchedEntities = numMatchedEntities + 1
|
|
236
|
-
end
|
|
237
|
-
)
|
|
238
|
-
if numMatchedEntities == 0 then
|
|
239
|
-
msg = msg .. "(no entities matched)\n"
|
|
240
|
-
else
|
|
241
|
-
msg = msg .. ((("(" .. tostring(numMatchedEntities)) .. " total ") .. (numMatchedEntities == 1 and "entity" or "entities")) .. ")\n"
|
|
340
|
+
--- Helper function for logging an array of specific entities.
|
|
341
|
+
function ____exports.logEntities(entities)
|
|
342
|
+
for ____, entity in ipairs(entities) do
|
|
343
|
+
____exports.logEntity(entity)
|
|
242
344
|
end
|
|
243
|
-
____exports.log(msg)
|
|
244
345
|
end
|
|
245
346
|
--- Helper function for printing out every entity flag that is turned on. Useful when debugging.
|
|
246
347
|
function ____exports.logEntityFlags(flags)
|
|
@@ -277,78 +378,11 @@ function ____exports.logGameStateFlags()
|
|
|
277
378
|
____exports.log(" n/a (no flags)")
|
|
278
379
|
end
|
|
279
380
|
end
|
|
280
|
-
--- Helper function for
|
|
281
|
-
function ____exports.logGridEntities(
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
msg = msg .. (" (filtered to grid entity type " .. tostring(gridEntityTypeFilter)) .. ")"
|
|
285
|
-
elseif not includeWalls then
|
|
286
|
-
msg = msg .. " (not including walls)"
|
|
381
|
+
--- Helper function for logging an array of specific grid entities.
|
|
382
|
+
function ____exports.logGridEntities(gridEntities)
|
|
383
|
+
for ____, gridEntity in ipairs(gridEntities) do
|
|
384
|
+
____exports.logGridEntity(gridEntity)
|
|
287
385
|
end
|
|
288
|
-
msg = msg .. ":\n"
|
|
289
|
-
local gridEntities = getGridEntities(nil)
|
|
290
|
-
local numMatchedEntities = 0
|
|
291
|
-
__TS__ArrayForEach(
|
|
292
|
-
gridEntities,
|
|
293
|
-
function(____, gridEntity)
|
|
294
|
-
local gridEntityIndex = gridEntity:GetGridIndex()
|
|
295
|
-
local gridEntityType = gridEntity:GetType()
|
|
296
|
-
local gridEntityVariant = gridEntity:GetVariant()
|
|
297
|
-
local gridEntityDesc = gridEntity:GetSaveState()
|
|
298
|
-
if gridEntityTypeFilter ~= nil and gridEntityType ~= gridEntityTypeFilter then
|
|
299
|
-
return
|
|
300
|
-
end
|
|
301
|
-
if not includeWalls and gridEntityType == GridEntityType.WALL and gridEntityTypeFilter ~= GridEntityType.WALL then
|
|
302
|
-
return
|
|
303
|
-
end
|
|
304
|
-
msg = msg .. (((((tostring(gridEntityIndex) .. ") ") .. tostring(gridEntityType)) .. ".") .. tostring(gridEntityVariant)) .. ".") .. tostring(gridEntity.State)
|
|
305
|
-
local door = gridEntity:ToDoor()
|
|
306
|
-
if door ~= nil then
|
|
307
|
-
msg = msg .. " (door)"
|
|
308
|
-
end
|
|
309
|
-
local pit = gridEntity:ToPit()
|
|
310
|
-
if pit ~= nil then
|
|
311
|
-
msg = msg .. " (pit)"
|
|
312
|
-
end
|
|
313
|
-
local poop = gridEntity:ToPoop()
|
|
314
|
-
if poop ~= nil then
|
|
315
|
-
msg = msg .. " (poop)"
|
|
316
|
-
end
|
|
317
|
-
local pressurePlate = gridEntity:ToPressurePlate()
|
|
318
|
-
if pressurePlate ~= nil then
|
|
319
|
-
msg = msg .. " (pressurePlate)"
|
|
320
|
-
end
|
|
321
|
-
local rock = gridEntity:ToRock()
|
|
322
|
-
if rock ~= nil then
|
|
323
|
-
msg = msg .. " (rock)"
|
|
324
|
-
end
|
|
325
|
-
local spikes = gridEntity:ToSpikes()
|
|
326
|
-
if spikes ~= nil then
|
|
327
|
-
msg = msg .. " (spikes)"
|
|
328
|
-
end
|
|
329
|
-
local tnt = gridEntity:ToTNT()
|
|
330
|
-
if tnt ~= nil then
|
|
331
|
-
msg = msg .. " (TNT)"
|
|
332
|
-
end
|
|
333
|
-
msg = msg .. (" - VarData: " .. tostring(gridEntity.VarData)) .. "\n"
|
|
334
|
-
msg = msg .. (((" - Position: (" .. tostring(gridEntity.Position.X)) .. ", ") .. tostring(gridEntity.Position.Y)) .. ")\n"
|
|
335
|
-
msg = msg .. (" - SpawnSeed: " .. tostring(gridEntityDesc.SpawnSeed)) .. "\n"
|
|
336
|
-
msg = msg .. (" - VariableSeed: " .. tostring(gridEntityDesc.VariableSeed)) .. ")\n"
|
|
337
|
-
if door ~= nil then
|
|
338
|
-
msg = msg .. (" - Slot: " .. tostring(door.Slot)) .. "\n"
|
|
339
|
-
msg = msg .. (" - Direction: " .. tostring(door.Direction)) .. "\n"
|
|
340
|
-
msg = msg .. (" - TargetRoomIndex: " .. tostring(door.TargetRoomIndex)) .. "\n"
|
|
341
|
-
msg = msg .. (" - TargetRoomType: " .. tostring(door.TargetRoomType)) .. "\n"
|
|
342
|
-
end
|
|
343
|
-
numMatchedEntities = numMatchedEntities + 1
|
|
344
|
-
end
|
|
345
|
-
)
|
|
346
|
-
if numMatchedEntities == 0 then
|
|
347
|
-
msg = msg .. "(no grid entities matched)\n"
|
|
348
|
-
else
|
|
349
|
-
msg = msg .. ((("(" .. tostring(numMatchedEntities)) .. " total grid ") .. (numMatchedEntities == 1 and "entity" or "entities")) .. ")\n"
|
|
350
|
-
end
|
|
351
|
-
____exports.log(msg)
|
|
352
386
|
end
|
|
353
387
|
function ____exports.logKColor(kColor)
|
|
354
388
|
____exports.log((((((("Color: R" .. tostring(kColor.Red)) .. ", G") .. tostring(kColor.Green)) .. ", B") .. tostring(kColor.Blue)) .. ", A") .. tostring(kColor.Alpha))
|
|
@@ -567,17 +601,21 @@ end
|
|
|
567
601
|
function ____exports.setLogFunctionsGlobal(self)
|
|
568
602
|
local globals = _G
|
|
569
603
|
globals.log = ____exports.log
|
|
604
|
+
globals.logAllEntities = ____exports.logAllEntities
|
|
605
|
+
globals.logAllGridEntities = ____exports.logAllGridEntities
|
|
570
606
|
globals.logArray = ____exports.logArray
|
|
571
607
|
globals.logColor = ____exports.logColor
|
|
572
608
|
globals.logDamageFlags = ____exports.logDamageFlags
|
|
573
609
|
globals.logEffects = ____exports.logEffects
|
|
574
610
|
globals.logEntities = ____exports.logEntities
|
|
611
|
+
globals.logEntity = ____exports.logEntity
|
|
575
612
|
globals.logEntityID = ____exports.logEntityID
|
|
576
613
|
globals.logEntityFlags = ____exports.logEntityFlags
|
|
577
614
|
globals.logError = ____exports.logError
|
|
578
615
|
globals.logFlags = ____exports.logFlags
|
|
579
616
|
globals.logGameStateFlags = ____exports.logGameStateFlags
|
|
580
617
|
globals.logGridEntities = ____exports.logGridEntities
|
|
618
|
+
globals.logGridEntity = ____exports.logGridEntity
|
|
581
619
|
globals.logKColor = ____exports.logKColor
|
|
582
620
|
globals.logLevelStateFlags = ____exports.logLevelStateFlags
|
|
583
621
|
globals.logMap = ____exports.logMap
|
|
@@ -18,8 +18,16 @@ export declare function fireProjectiles(npc: EntityNPC, position: Vector, veloci
|
|
|
18
18
|
*
|
|
19
19
|
* This function will not include NPCs on an internal blacklist, such as Death's scythes or Big Horn
|
|
20
20
|
* holes.
|
|
21
|
+
*
|
|
22
|
+
* @param entityType Optional. If specified, will only get the NPCs that match the type. Default is
|
|
23
|
+
* -1, which matches every type.
|
|
24
|
+
* @param variant Optional. If specified, will only get the NPCs that match the variant. Default is
|
|
25
|
+
* -1, which matches every variant.
|
|
26
|
+
* @param subType Optional. If specified, will only get the NPCs that match the sub-type. Default is
|
|
27
|
+
* -1, which matches every sub-type.
|
|
28
|
+
* @param ignoreFriendly Optional. Default is false.
|
|
21
29
|
*/
|
|
22
|
-
export declare function getAliveNPCs(
|
|
30
|
+
export declare function getAliveNPCs(entityType?: EntityType, variant?: number, subType?: number, ignoreFriendly?: boolean): EntityNPC[];
|
|
23
31
|
/**
|
|
24
32
|
* Checks for specific NPCs that have "CanShutDoors" set to true naturally by the game, but should
|
|
25
33
|
* not actually keep the doors closed (like Death's scythes).
|
|
@@ -38,4 +46,18 @@ export declare function isDyingEggyWithNoSpidersLeft(npc: EntityNPC): boolean;
|
|
|
38
46
|
* enemies.
|
|
39
47
|
*/
|
|
40
48
|
export declare function isRaglingDeathPatch(npc: EntityNPC): boolean;
|
|
41
|
-
|
|
49
|
+
/**
|
|
50
|
+
* The base game `EntityNPC.FireProjectiles` method does not return anything, which is a problem in
|
|
51
|
+
* situations where you need to work with the fired projectiles. This function invokes that method,
|
|
52
|
+
* and then returns the projectiles that were spawned.
|
|
53
|
+
*
|
|
54
|
+
* @param npc The EntityNPC firing projectiles.
|
|
55
|
+
* @param position The starting position of the projectiles.
|
|
56
|
+
* @param velocity The starting velocity of the projectiles.
|
|
57
|
+
* @param projectilesMode A ProjectilesMode enum value defining how to fire the projectiles.
|
|
58
|
+
* @param projectileParams A ProjectileParams object containing various parameters for the
|
|
59
|
+
* projectiles.
|
|
60
|
+
* @returns An array of EntityProjectiles containing all fired projectiles.
|
|
61
|
+
*/
|
|
62
|
+
export declare function npcFireProjectiles(npc: EntityNPC, position: Vector, velocity: Vector, projectilesMode: ProjectilesMode, projectileParams: ProjectileParams): EntityProjectile[];
|
|
63
|
+
//# sourceMappingURL=npcs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"npcs.d.ts","sourceRoot":"","sources":["../../src/functions/npcs.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,UAAU,EAMV,eAAe,EAGhB,MAAM,8BAA8B,CAAC;AAgCtC;;;;;;;;;;;;GAYG;AACH,wBAAgB,eAAe,CAC7B,GAAG,EAAE,SAAS,EACd,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,eAAe,GAAE,eAAgD,EACjE,gBAAgB,GAAE,gBAAqC,GACtD,gBAAgB,EAAE,CAMpB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,YAAY,CAC1B,UAAU,GAAE,UAAe,EAC3B,OAAO,SAAK,EACZ,OAAO,SAAK,EACZ,cAAc,UAAQ,GACrB,SAAS,EAAE,CAGb;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,SAAS,GAAG,OAAO,CAoB3D;AAED;;;;GAIG;AACH,wBAAgB,4BAA4B,CAAC,GAAG,EAAE,SAAS,GAAG,OAAO,CAKpE;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,SAAS,GAAG,OAAO,CAO3D;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,kBAAkB,CAChC,GAAG,EAAE,SAAS,EACd,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,eAAe,EAAE,eAAe,EAChC,gBAAgB,EAAE,gBAAgB,GACjC,gBAAgB,EAAE,CAOpB"}
|
|
@@ -22,11 +22,11 @@ local RaglingVariant = ____isaac_2Dtypescript_2Ddefinitions.RaglingVariant
|
|
|
22
22
|
local VisVariant = ____isaac_2Dtypescript_2Ddefinitions.VisVariant
|
|
23
23
|
local ____constants = require("constants")
|
|
24
24
|
local EGGY_STATE_FRAME_OF_FINAL_SPIDER = ____constants.EGGY_STATE_FRAME_OF_FINAL_SPIDER
|
|
25
|
-
local
|
|
26
|
-
local getFilteredNewEntities =
|
|
27
|
-
local
|
|
28
|
-
local getNPCs =
|
|
29
|
-
local getProjectiles =
|
|
25
|
+
local ____entities = require("functions.entities")
|
|
26
|
+
local getFilteredNewEntities = ____entities.getFilteredNewEntities
|
|
27
|
+
local ____entitiesSpecific = require("functions.entitiesSpecific")
|
|
28
|
+
local getNPCs = ____entitiesSpecific.getNPCs
|
|
29
|
+
local getProjectiles = ____entitiesSpecific.getProjectiles
|
|
30
30
|
--- Checks for specific NPCs that have "CanShutDoors" set to true naturally by the game, but should
|
|
31
31
|
-- not actually keep the doors closed (like Death's scythes).
|
|
32
32
|
function ____exports.isAliveExceptionNPC(self, npc)
|
|
@@ -109,15 +109,32 @@ end
|
|
|
109
109
|
--
|
|
110
110
|
-- This function will not include NPCs on an internal blacklist, such as Death's scythes or Big Horn
|
|
111
111
|
-- holes.
|
|
112
|
-
|
|
112
|
+
--
|
|
113
|
+
-- @param entityType Optional. If specified, will only get the NPCs that match the type. Default is
|
|
114
|
+
-- -1, which matches every type.
|
|
115
|
+
-- @param variant Optional. If specified, will only get the NPCs that match the variant. Default is
|
|
116
|
+
-- -1, which matches every variant.
|
|
117
|
+
-- @param subType Optional. If specified, will only get the NPCs that match the sub-type. Default is
|
|
118
|
+
-- -1, which matches every sub-type.
|
|
119
|
+
-- @param ignoreFriendly Optional. Default is false.
|
|
120
|
+
function ____exports.getAliveNPCs(self, entityType, variant, subType, ignoreFriendly)
|
|
121
|
+
if entityType == nil then
|
|
122
|
+
entityType = -1
|
|
123
|
+
end
|
|
124
|
+
if variant == nil then
|
|
125
|
+
variant = -1
|
|
126
|
+
end
|
|
127
|
+
if subType == nil then
|
|
128
|
+
subType = -1
|
|
129
|
+
end
|
|
113
130
|
if ignoreFriendly == nil then
|
|
114
131
|
ignoreFriendly = false
|
|
115
132
|
end
|
|
116
133
|
local npcs = getNPCs(
|
|
117
134
|
nil,
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
135
|
+
entityType,
|
|
136
|
+
variant,
|
|
137
|
+
subType,
|
|
121
138
|
ignoreFriendly
|
|
122
139
|
)
|
|
123
140
|
return __TS__ArrayFilter(
|
|
@@ -125,4 +142,22 @@ function ____exports.getAliveNPCs(self, matchingEntityType, matchingVariant, mat
|
|
|
125
142
|
function(____, npc) return not npc:IsDead() and not ____exports.isAliveExceptionNPC(nil, npc) end
|
|
126
143
|
)
|
|
127
144
|
end
|
|
145
|
+
--- The base game `EntityNPC.FireProjectiles` method does not return anything, which is a problem in
|
|
146
|
+
-- situations where you need to work with the fired projectiles. This function invokes that method,
|
|
147
|
+
-- and then returns the projectiles that were spawned.
|
|
148
|
+
--
|
|
149
|
+
-- @param npc The EntityNPC firing projectiles.
|
|
150
|
+
-- @param position The starting position of the projectiles.
|
|
151
|
+
-- @param velocity The starting velocity of the projectiles.
|
|
152
|
+
-- @param projectilesMode A ProjectilesMode enum value defining how to fire the projectiles.
|
|
153
|
+
-- @param projectileParams A ProjectileParams object containing various parameters for the
|
|
154
|
+
-- projectiles.
|
|
155
|
+
-- @returns An array of EntityProjectiles containing all fired projectiles.
|
|
156
|
+
function ____exports.npcFireProjectiles(self, npc, position, velocity, projectilesMode, projectileParams)
|
|
157
|
+
local oldEntities = getProjectiles(nil)
|
|
158
|
+
npc:FireProjectiles(position, velocity, projectilesMode, projectileParams)
|
|
159
|
+
local newEntities = getProjectiles(nil)
|
|
160
|
+
local filteredNewEntities = getFilteredNewEntities(nil, oldEntities, newEntities)
|
|
161
|
+
return filteredNewEntities
|
|
162
|
+
end
|
|
128
163
|
return ____exports
|