isaacscript-common 6.6.4 → 6.7.1
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.d.ts +1 -1
- package/dist/callbacks/postCustomDoorEnter.lua +6 -6
- 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/enums/private/SerializationBrand.d.ts +0 -4
- package/dist/enums/private/SerializationBrand.d.ts.map +1 -1
- 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 +3 -3
- 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/deepCopy.d.ts +8 -5
- package/dist/functions/deepCopy.d.ts.map +1 -1
- package/dist/functions/deepCopy.lua +142 -38
- 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 +1 -1
- package/dist/functions/log.lua +9 -9
- 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/table.d.ts +1 -1
- package/dist/functions/table.lua +1 -1
- 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 +2 -2
- package/src/callbacks/postCustomDoorEnter.ts +3 -3
- 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 +2 -2
- 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/postSacrifice.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/enums/private/SerializationBrand.ts +0 -4
- 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 +2 -2
- package/src/features/extraConsoleCommands/listCommands.ts +13 -9
- package/src/features/pause.ts +1 -1
- package/src/features/persistentEntities.ts +2 -2
- 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/array.ts +1 -1
- package/src/functions/bitwise.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/deepCopy.ts +98 -19
- package/src/functions/deepCopyTests.ts +6 -4
- 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 +6 -6
- 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/table.ts +1 -1
- package/src/functions/transformations.ts +1 -1
- package/src/functions/trinketGive.ts +4 -4
- package/src/functions/trinkets.ts +3 -3
- package/src/functions/tstlClass.ts +1 -1
- package/src/functions/ui.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
|
@@ -0,0 +1,366 @@
|
|
|
1
|
+
local ____exports = {}
|
|
2
|
+
local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
|
|
3
|
+
local DoorVariant = ____isaac_2Dtypescript_2Ddefinitions.DoorVariant
|
|
4
|
+
local GridEntityType = ____isaac_2Dtypescript_2Ddefinitions.GridEntityType
|
|
5
|
+
local PitVariant = ____isaac_2Dtypescript_2Ddefinitions.PitVariant
|
|
6
|
+
local PoopGridEntityVariant = ____isaac_2Dtypescript_2Ddefinitions.PoopGridEntityVariant
|
|
7
|
+
local PressurePlateVariant = ____isaac_2Dtypescript_2Ddefinitions.PressurePlateVariant
|
|
8
|
+
local RockVariant = ____isaac_2Dtypescript_2Ddefinitions.RockVariant
|
|
9
|
+
local ____gridEntities = require("functions.gridEntities")
|
|
10
|
+
local getGridEntities = ____gridEntities.getGridEntities
|
|
11
|
+
local removeGridEntities = ____gridEntities.removeGridEntities
|
|
12
|
+
local spawnGridEntityWithVariant = ____gridEntities.spawnGridEntityWithVariant
|
|
13
|
+
--- Helper function to spawn a `GridEntityType.DOOR` (16) with a specific variant.
|
|
14
|
+
function ____exports.spawnDoorWithVariant(self, doorVariant, gridIndexOrPosition)
|
|
15
|
+
local gridEntity = spawnGridEntityWithVariant(nil, GridEntityType.DOOR, doorVariant, gridIndexOrPosition)
|
|
16
|
+
if gridEntity == nil then
|
|
17
|
+
return gridEntity
|
|
18
|
+
end
|
|
19
|
+
local door = gridEntity:ToDoor()
|
|
20
|
+
if door == nil then
|
|
21
|
+
error("Failed to spawn a door.")
|
|
22
|
+
end
|
|
23
|
+
return door
|
|
24
|
+
end
|
|
25
|
+
--- Helper function to spawn a `GridEntityType.PIT` (7) with a specific variant.
|
|
26
|
+
function ____exports.spawnPitWithVariant(self, pitVariant, gridIndexOrPosition)
|
|
27
|
+
local gridEntity = spawnGridEntityWithVariant(nil, GridEntityType.PIT, pitVariant, gridIndexOrPosition)
|
|
28
|
+
if gridEntity == nil then
|
|
29
|
+
return gridEntity
|
|
30
|
+
end
|
|
31
|
+
local pit = gridEntity:ToPit()
|
|
32
|
+
if pit == nil then
|
|
33
|
+
error("Failed to spawn a pit.")
|
|
34
|
+
end
|
|
35
|
+
return pit
|
|
36
|
+
end
|
|
37
|
+
--- Helper function to spawn a `GridEntityType.POOP` (14) with a specific variant.
|
|
38
|
+
function ____exports.spawnPoopWithVariant(self, poopVariant, gridIndexOrPosition)
|
|
39
|
+
local gridEntity = spawnGridEntityWithVariant(nil, GridEntityType.POOP, poopVariant, gridIndexOrPosition)
|
|
40
|
+
if gridEntity == nil then
|
|
41
|
+
return gridEntity
|
|
42
|
+
end
|
|
43
|
+
local poop = gridEntity:ToPoop()
|
|
44
|
+
if poop == nil then
|
|
45
|
+
error("Failed to spawn a poop.")
|
|
46
|
+
end
|
|
47
|
+
return poop
|
|
48
|
+
end
|
|
49
|
+
--- Helper function to spawn a `GridEntityType.PRESSURE_PLATE` (20) with a specific variant.
|
|
50
|
+
function ____exports.spawnPressurePlateWithVariant(self, pressurePlateVariant, gridIndexOrPosition)
|
|
51
|
+
local gridEntity = spawnGridEntityWithVariant(nil, GridEntityType.PRESSURE_PLATE, pressurePlateVariant, gridIndexOrPosition)
|
|
52
|
+
if gridEntity == nil then
|
|
53
|
+
return gridEntity
|
|
54
|
+
end
|
|
55
|
+
local pressurePlate = gridEntity:ToPressurePlate()
|
|
56
|
+
if pressurePlate == nil then
|
|
57
|
+
error("Failed to spawn a pressure plate.")
|
|
58
|
+
end
|
|
59
|
+
return pressurePlate
|
|
60
|
+
end
|
|
61
|
+
--- Helper function to spawn a `GridEntityType.ROCK` (2) with a specific variant.
|
|
62
|
+
function ____exports.spawnRockWithVariant(self, rockVariant, gridIndexOrPosition)
|
|
63
|
+
local gridEntity = spawnGridEntityWithVariant(nil, GridEntityType.ROCK, rockVariant, gridIndexOrPosition)
|
|
64
|
+
if gridEntity == nil then
|
|
65
|
+
return gridEntity
|
|
66
|
+
end
|
|
67
|
+
local rock = gridEntity:ToRock()
|
|
68
|
+
if rock == nil then
|
|
69
|
+
error("Failed to spawn a rock.")
|
|
70
|
+
end
|
|
71
|
+
return rock
|
|
72
|
+
end
|
|
73
|
+
--- Helper function to spawn a `GridEntityType.SPIKES` (8) with a specific variant.
|
|
74
|
+
function ____exports.spawnSpikesWithVariant(self, variant, gridIndexOrPosition)
|
|
75
|
+
local gridEntity = spawnGridEntityWithVariant(nil, GridEntityType.SPIKES, variant, gridIndexOrPosition)
|
|
76
|
+
if gridEntity == nil then
|
|
77
|
+
return gridEntity
|
|
78
|
+
end
|
|
79
|
+
local spikes = gridEntity:ToSpikes()
|
|
80
|
+
if spikes == nil then
|
|
81
|
+
error("Failed to spawn spikes.")
|
|
82
|
+
end
|
|
83
|
+
return spikes
|
|
84
|
+
end
|
|
85
|
+
--- Helper function to spawn a `GridEntityType.TNT` (12) with a specific variant.
|
|
86
|
+
function ____exports.spawnTNTWithVariant(self, variant, gridIndexOrPosition)
|
|
87
|
+
local gridEntity = spawnGridEntityWithVariant(nil, GridEntityType.TNT, variant, gridIndexOrPosition)
|
|
88
|
+
if gridEntity == nil then
|
|
89
|
+
return gridEntity
|
|
90
|
+
end
|
|
91
|
+
local tnt = gridEntity:ToTNT()
|
|
92
|
+
if tnt == nil then
|
|
93
|
+
error("Failed to spawn TNT.")
|
|
94
|
+
end
|
|
95
|
+
return tnt
|
|
96
|
+
end
|
|
97
|
+
--- Helper function to get all of the `GridEntityPit` in the room.
|
|
98
|
+
--
|
|
99
|
+
-- @param pitVariant Optional. If specified, will only get the pits that match the variant. Default
|
|
100
|
+
-- is -1, which matches every variant.
|
|
101
|
+
function ____exports.getPits(self, pitVariant)
|
|
102
|
+
if pitVariant == nil then
|
|
103
|
+
pitVariant = -1
|
|
104
|
+
end
|
|
105
|
+
local gridEntities = getGridEntities(nil)
|
|
106
|
+
local pits = {}
|
|
107
|
+
for ____, gridEntity in ipairs(gridEntities) do
|
|
108
|
+
local pit = gridEntity:ToPit()
|
|
109
|
+
if pit ~= nil then
|
|
110
|
+
local gridEntityVariant = pit:GetVariant()
|
|
111
|
+
if pitVariant == -1 or pitVariant == gridEntityVariant then
|
|
112
|
+
pits[#pits + 1] = pit
|
|
113
|
+
end
|
|
114
|
+
end
|
|
115
|
+
end
|
|
116
|
+
return pits
|
|
117
|
+
end
|
|
118
|
+
--- Helper function to get all of the `GridEntityPoop` in the room.
|
|
119
|
+
--
|
|
120
|
+
-- @param poopVariant Optional. If specified, will only get the poops that match the variant.
|
|
121
|
+
-- Default is -1, which matches every variant.
|
|
122
|
+
function ____exports.getPoops(self, poopVariant)
|
|
123
|
+
if poopVariant == nil then
|
|
124
|
+
poopVariant = -1
|
|
125
|
+
end
|
|
126
|
+
local gridEntities = getGridEntities(nil)
|
|
127
|
+
local poops = {}
|
|
128
|
+
for ____, gridEntity in ipairs(gridEntities) do
|
|
129
|
+
local poop = gridEntity:ToPoop()
|
|
130
|
+
if poop ~= nil then
|
|
131
|
+
local gridEntityVariant = poop:GetVariant()
|
|
132
|
+
if poopVariant == -1 or poopVariant == gridEntityVariant then
|
|
133
|
+
poops[#poops + 1] = poop
|
|
134
|
+
end
|
|
135
|
+
end
|
|
136
|
+
end
|
|
137
|
+
return poops
|
|
138
|
+
end
|
|
139
|
+
--- Helper function to get all of the `GridEntityPressurePlate` in the room.
|
|
140
|
+
--
|
|
141
|
+
-- @param pressurePlateVariant Optional. If specified, will only get the pressure plates that match
|
|
142
|
+
-- the variant. Default is -1, which matches every variant.
|
|
143
|
+
function ____exports.getPressurePlates(self, pressurePlateVariant)
|
|
144
|
+
if pressurePlateVariant == nil then
|
|
145
|
+
pressurePlateVariant = -1
|
|
146
|
+
end
|
|
147
|
+
local gridEntities = getGridEntities(nil)
|
|
148
|
+
local pressurePlates = {}
|
|
149
|
+
for ____, gridEntity in ipairs(gridEntities) do
|
|
150
|
+
local pressurePlate = gridEntity:ToPressurePlate()
|
|
151
|
+
if pressurePlate ~= nil then
|
|
152
|
+
local gridEntityVariant = pressurePlate:GetVariant()
|
|
153
|
+
if pressurePlateVariant == -1 or pressurePlateVariant == gridEntityVariant then
|
|
154
|
+
pressurePlates[#pressurePlates + 1] = pressurePlate
|
|
155
|
+
end
|
|
156
|
+
end
|
|
157
|
+
end
|
|
158
|
+
return pressurePlates
|
|
159
|
+
end
|
|
160
|
+
--- Helper function to get all of the `GridEntityRock` in the room.
|
|
161
|
+
--
|
|
162
|
+
-- @param variant Optional. If specified, will only get the rocks that match the variant. Default is
|
|
163
|
+
-- -1, which matches every variant. Note that this is not the same thing as the
|
|
164
|
+
-- `RockVariant` enum, since that only applies to `GridEntityType.ROCK`, and other
|
|
165
|
+
-- types of grid entities can be the `GridEntityRock` class.
|
|
166
|
+
function ____exports.getRocks(self, variant)
|
|
167
|
+
if variant == nil then
|
|
168
|
+
variant = -1
|
|
169
|
+
end
|
|
170
|
+
local gridEntities = getGridEntities(nil)
|
|
171
|
+
local rocks = {}
|
|
172
|
+
for ____, gridEntity in ipairs(gridEntities) do
|
|
173
|
+
local rock = gridEntity:ToRock()
|
|
174
|
+
if rock ~= nil then
|
|
175
|
+
local gridEntityVariant = rock:GetVariant()
|
|
176
|
+
if variant == -1 or variant == gridEntityVariant then
|
|
177
|
+
rocks[#rocks + 1] = rock
|
|
178
|
+
end
|
|
179
|
+
end
|
|
180
|
+
end
|
|
181
|
+
return rocks
|
|
182
|
+
end
|
|
183
|
+
--- Helper function to get all of the `GridEntitySpikes` in the room.
|
|
184
|
+
function ____exports.getSpikes(self, variant)
|
|
185
|
+
if variant == nil then
|
|
186
|
+
variant = -1
|
|
187
|
+
end
|
|
188
|
+
local gridEntities = getGridEntities(nil)
|
|
189
|
+
local spikes = {}
|
|
190
|
+
for ____, gridEntity in ipairs(gridEntities) do
|
|
191
|
+
local spike = gridEntity:ToSpikes()
|
|
192
|
+
if spike ~= nil then
|
|
193
|
+
local gridEntityVariant = spike:GetVariant()
|
|
194
|
+
if variant == -1 or variant == gridEntityVariant then
|
|
195
|
+
spikes[#spikes + 1] = spike
|
|
196
|
+
end
|
|
197
|
+
end
|
|
198
|
+
end
|
|
199
|
+
return spikes
|
|
200
|
+
end
|
|
201
|
+
--- Helper function to get all of the `GridEntityTNT` in the room.
|
|
202
|
+
function ____exports.getTNT(self, variant)
|
|
203
|
+
if variant == nil then
|
|
204
|
+
variant = -1
|
|
205
|
+
end
|
|
206
|
+
local gridEntities = getGridEntities(nil)
|
|
207
|
+
local tntArray = {}
|
|
208
|
+
for ____, gridEntity in ipairs(gridEntities) do
|
|
209
|
+
local tnt = gridEntity:ToTNT()
|
|
210
|
+
if tnt ~= nil then
|
|
211
|
+
local gridEntityVariant = tnt:GetVariant()
|
|
212
|
+
if variant == -1 or variant == gridEntityVariant then
|
|
213
|
+
tntArray[#tntArray + 1] = tnt
|
|
214
|
+
end
|
|
215
|
+
end
|
|
216
|
+
end
|
|
217
|
+
return tntArray
|
|
218
|
+
end
|
|
219
|
+
--- Helper function to remove all of the `GridEntityPit` in the room.
|
|
220
|
+
--
|
|
221
|
+
-- @param pitVariant Optional. If specified, will only remove the pits that match this variant.
|
|
222
|
+
-- Default is -1, which matches every variant.
|
|
223
|
+
-- @param updateRoom Optional. Whether or not to update the room after the pits are removed. Default
|
|
224
|
+
-- is false. For more information, see the description of the `removeGridEntities`
|
|
225
|
+
-- helper function.
|
|
226
|
+
-- @param cap Optional. If specified, will only remove the given amount of pits.
|
|
227
|
+
-- @returns The pits that were removed.
|
|
228
|
+
function ____exports.removeAllPits(self, pitVariant, updateRoom, cap)
|
|
229
|
+
if pitVariant == nil then
|
|
230
|
+
pitVariant = -1
|
|
231
|
+
end
|
|
232
|
+
if updateRoom == nil then
|
|
233
|
+
updateRoom = false
|
|
234
|
+
end
|
|
235
|
+
local pits = ____exports.getPits(nil, pitVariant)
|
|
236
|
+
return removeGridEntities(nil, pits, updateRoom, cap)
|
|
237
|
+
end
|
|
238
|
+
--- Helper function to remove all of the `GridEntityPoop` in the room.
|
|
239
|
+
--
|
|
240
|
+
-- Note that poops can either be an entity or a grid entity, depending on the situation. This
|
|
241
|
+
-- function will only remove the grid entity poops.
|
|
242
|
+
--
|
|
243
|
+
-- @param poopVariant Optional. If specified, will only remove the poops that match this variant.
|
|
244
|
+
-- Default is -1, which matches every variant.
|
|
245
|
+
-- @param updateRoom Optional. Whether or not to update the room after the poops are removed.
|
|
246
|
+
-- Default is false. For more information, see the description of the
|
|
247
|
+
-- `removeGridEntities` helper function.
|
|
248
|
+
-- @param cap Optional. If specified, will only remove the given amount of poops.
|
|
249
|
+
-- @returns The poops that were removed.
|
|
250
|
+
function ____exports.removeAllPoops(self, poopVariant, updateRoom, cap)
|
|
251
|
+
if poopVariant == nil then
|
|
252
|
+
poopVariant = -1
|
|
253
|
+
end
|
|
254
|
+
if updateRoom == nil then
|
|
255
|
+
updateRoom = false
|
|
256
|
+
end
|
|
257
|
+
local poops = ____exports.getPoops(nil, poopVariant)
|
|
258
|
+
return removeGridEntities(nil, poops, updateRoom, cap)
|
|
259
|
+
end
|
|
260
|
+
--- Helper function to remove all of the `GridEntityPressurePlate` in the room.
|
|
261
|
+
--
|
|
262
|
+
-- @param pressurePlateVariant Optional. If specified, will only remove the pressure plates that
|
|
263
|
+
-- match this variant. Default is -1, which matches every variant.
|
|
264
|
+
-- @param updateRoom Optional. Whether or not to update the room after the pressure plates are
|
|
265
|
+
-- removed. Default is false. For more information, see the description of the
|
|
266
|
+
-- `removeGridEntities` helper function.
|
|
267
|
+
-- @param cap Optional. If specified, will only remove the given amount of pressure plates.
|
|
268
|
+
-- @returns The pressure plates that were removed.
|
|
269
|
+
function ____exports.removeAllPressurePlates(self, pressurePlateVariant, updateRoom, cap)
|
|
270
|
+
if pressurePlateVariant == nil then
|
|
271
|
+
pressurePlateVariant = -1
|
|
272
|
+
end
|
|
273
|
+
if updateRoom == nil then
|
|
274
|
+
updateRoom = false
|
|
275
|
+
end
|
|
276
|
+
local pressurePlates = ____exports.getPressurePlates(nil, pressurePlateVariant)
|
|
277
|
+
return removeGridEntities(nil, pressurePlates, updateRoom, cap)
|
|
278
|
+
end
|
|
279
|
+
--- Helper function to remove all of the `GridEntityRock` in the room.
|
|
280
|
+
--
|
|
281
|
+
-- @param variant Optional. If specified, will only remove the rocks that match this variant.
|
|
282
|
+
-- Default is -1, which matches every variant. Note that this is not the same thing
|
|
283
|
+
-- as the `RockVariant` enum, since that only applies to `GridEntityType.ROCK`, and
|
|
284
|
+
-- other types of grid entities can be the `GridEntityRock` class.
|
|
285
|
+
-- @param updateRoom Optional. Whether or not to update the room after the rocks are removed.
|
|
286
|
+
-- Default is false. For more information, see the description of the
|
|
287
|
+
-- `removeGridEntities` helper function.
|
|
288
|
+
-- @param cap Optional. If specified, will only remove the given amount of rocks.
|
|
289
|
+
-- @returns The rocks that were removed.
|
|
290
|
+
function ____exports.removeAllRocks(self, variant, updateRoom, cap)
|
|
291
|
+
if variant == nil then
|
|
292
|
+
variant = -1
|
|
293
|
+
end
|
|
294
|
+
if updateRoom == nil then
|
|
295
|
+
updateRoom = false
|
|
296
|
+
end
|
|
297
|
+
local rocks = ____exports.getRocks(nil, variant)
|
|
298
|
+
return removeGridEntities(nil, rocks, updateRoom, cap)
|
|
299
|
+
end
|
|
300
|
+
--- Helper function to remove all of the `GridEntitySpikes` in the room.
|
|
301
|
+
--
|
|
302
|
+
-- @param variant Optional. If specified, will only remove the spikes that match this variant.
|
|
303
|
+
-- Default is -1, which matches every variant.
|
|
304
|
+
-- @param updateRoom Optional. Whether or not to update the room after the spikes are removed.
|
|
305
|
+
-- Default is false. For more information, see the description of the
|
|
306
|
+
-- `removeGridEntities` helper function.
|
|
307
|
+
-- @param cap Optional. If specified, will only remove the given amount of spikes.
|
|
308
|
+
-- @returns The spikes that were removed.
|
|
309
|
+
function ____exports.removeAllSpikes(self, variant, updateRoom, cap)
|
|
310
|
+
if variant == nil then
|
|
311
|
+
variant = -1
|
|
312
|
+
end
|
|
313
|
+
if updateRoom == nil then
|
|
314
|
+
updateRoom = false
|
|
315
|
+
end
|
|
316
|
+
local spikes = ____exports.getSpikes(nil, variant)
|
|
317
|
+
return removeGridEntities(nil, spikes, updateRoom, cap)
|
|
318
|
+
end
|
|
319
|
+
--- Helper function to remove all of the `GridEntityTNT` in the room.
|
|
320
|
+
--
|
|
321
|
+
-- @param variant Optional. If specified, will only remove the TNTs that match this variant. Default
|
|
322
|
+
-- is -1, which matches every variant.
|
|
323
|
+
-- @param updateRoom Optional. Whether or not to update the room after the TNTs are removed. Default
|
|
324
|
+
-- is false. For more information, see the description of the `removeGridEntities`
|
|
325
|
+
-- helper function.
|
|
326
|
+
-- @param cap Optional. If specified, will only remove the given amount of TNTs.
|
|
327
|
+
-- @returns The TNTs that were removed.
|
|
328
|
+
function ____exports.removeAllTNT(self, variant, updateRoom, cap)
|
|
329
|
+
if variant == nil then
|
|
330
|
+
variant = -1
|
|
331
|
+
end
|
|
332
|
+
if updateRoom == nil then
|
|
333
|
+
updateRoom = false
|
|
334
|
+
end
|
|
335
|
+
local tnt = ____exports.getTNT(nil, variant)
|
|
336
|
+
return removeGridEntities(nil, tnt, updateRoom, cap)
|
|
337
|
+
end
|
|
338
|
+
--- Helper function to spawn a `GridEntityType.DOOR` (16).
|
|
339
|
+
function ____exports.spawnDoor(self, gridIndexOrPosition)
|
|
340
|
+
return ____exports.spawnDoorWithVariant(nil, DoorVariant.UNSPECIFIED, gridIndexOrPosition)
|
|
341
|
+
end
|
|
342
|
+
--- Helper function to spawn a `GridEntityType.PIT` (7).
|
|
343
|
+
function ____exports.spawnPit(self, gridIndexOrPosition)
|
|
344
|
+
return ____exports.spawnPitWithVariant(nil, PitVariant.NORMAL, gridIndexOrPosition)
|
|
345
|
+
end
|
|
346
|
+
--- Helper function to spawn a `GridEntityType.POOP` (14).
|
|
347
|
+
function ____exports.spawnPoop(self, gridIndexOrPosition)
|
|
348
|
+
return ____exports.spawnPoopWithVariant(nil, PoopGridEntityVariant.NORMAL, gridIndexOrPosition)
|
|
349
|
+
end
|
|
350
|
+
--- Helper function to spawn a `GridEntityType.PRESSURE_PLATE` (20).
|
|
351
|
+
function ____exports.spawnPressurePlate(self, gridIndexOrPosition)
|
|
352
|
+
return ____exports.spawnPressurePlateWithVariant(nil, PressurePlateVariant.PRESSURE_PLATE, gridIndexOrPosition)
|
|
353
|
+
end
|
|
354
|
+
--- Helper function to spawn a `GridEntityType.ROCK` (2).
|
|
355
|
+
function ____exports.spawnRock(self, gridIndexOrPosition)
|
|
356
|
+
return ____exports.spawnRockWithVariant(nil, RockVariant.NORMAL, gridIndexOrPosition)
|
|
357
|
+
end
|
|
358
|
+
--- Helper function to spawn a `GridEntityType.SPIKES` (8).
|
|
359
|
+
function ____exports.spawnSpikes(self, gridIndexOrPosition)
|
|
360
|
+
return ____exports.spawnSpikesWithVariant(nil, 0, gridIndexOrPosition)
|
|
361
|
+
end
|
|
362
|
+
--- Helper function to spawn a `GridEntityType.TNT` (12).
|
|
363
|
+
function ____exports.spawnTNT(self, gridIndexOrPosition)
|
|
364
|
+
return ____exports.spawnTNTWithVariant(nil, 0, gridIndexOrPosition)
|
|
365
|
+
end
|
|
366
|
+
return ____exports
|
package/dist/functions/log.d.ts
CHANGED
|
@@ -64,7 +64,7 @@ export declare function logSounds(this: void): void;
|
|
|
64
64
|
* recursively call itself if it counters a table within a table.
|
|
65
65
|
*
|
|
66
66
|
* This function will only work on tables that have string keys (because it logs the keys in order,
|
|
67
|
-
* instead of randomly). It will throw a
|
|
67
|
+
* instead of randomly). It will throw a run-time error if it encounters a non-string key.
|
|
68
68
|
*/
|
|
69
69
|
export declare function logTable(this: void, luaTable: unknown, parentTables?: number): void;
|
|
70
70
|
/**
|
package/dist/functions/log.lua
CHANGED
|
@@ -28,22 +28,22 @@ local ____array = require("functions.array")
|
|
|
28
28
|
local arrayToString = ____array.arrayToString
|
|
29
29
|
local ____collectibles = require("functions.collectibles")
|
|
30
30
|
local getCollectibleName = ____collectibles.getCollectibleName
|
|
31
|
-
local
|
|
32
|
-
local getEntities =
|
|
33
|
-
local getEntityID =
|
|
31
|
+
local ____entities = require("functions.entities")
|
|
32
|
+
local getEntities = ____entities.getEntities
|
|
33
|
+
local getEntityID = ____entities.getEntityID
|
|
34
34
|
local ____enums = require("functions.enums")
|
|
35
35
|
local getEnumEntries = ____enums.getEnumEntries
|
|
36
36
|
local ____flag = require("functions.flag")
|
|
37
37
|
local hasFlag = ____flag.hasFlag
|
|
38
|
-
local
|
|
39
|
-
local getGridEntities =
|
|
38
|
+
local ____gridEntities = require("functions.gridEntities")
|
|
39
|
+
local getGridEntities = ____gridEntities.getGridEntities
|
|
40
40
|
local ____isaacAPIClass = require("functions.isaacAPIClass")
|
|
41
41
|
local getIsaacAPIClassName = ____isaacAPIClass.getIsaacAPIClassName
|
|
42
|
-
local ____player = require("functions.player")
|
|
43
|
-
local getEffectsList = ____player.getEffectsList
|
|
44
|
-
local getPlayerName = ____player.getPlayerName
|
|
45
42
|
local ____playerHealth = require("functions.playerHealth")
|
|
46
43
|
local getPlayerHealth = ____playerHealth.getPlayerHealth
|
|
44
|
+
local ____players = require("functions.players")
|
|
45
|
+
local getEffectsList = ____players.getEffectsList
|
|
46
|
+
local getPlayerName = ____players.getPlayerName
|
|
47
47
|
local ____roomData = require("functions.roomData")
|
|
48
48
|
local getRoomData = ____roomData.getRoomData
|
|
49
49
|
local getRoomGridIndex = ____roomData.getRoomGridIndex
|
|
@@ -464,7 +464,7 @@ end
|
|
|
464
464
|
-- recursively call itself if it counters a table within a table.
|
|
465
465
|
--
|
|
466
466
|
-- This function will only work on tables that have string keys (because it logs the keys in order,
|
|
467
|
-
-- instead of randomly). It will throw a
|
|
467
|
+
-- instead of randomly). It will throw a run-time error if it encounters a non-string key.
|
|
468
468
|
function ____exports.logTable(luaTable, parentTables)
|
|
469
469
|
if parentTables == nil then
|
|
470
470
|
parentTables = 0
|
|
@@ -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
|