isaacscript-common 1.2.271 → 1.2.272
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/functions/boss.d.ts +17 -0
- package/dist/functions/boss.lua +70 -0
- package/package.json +1 -1
package/dist/functions/boss.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="isaac-typescript-definitions" />
|
|
2
|
+
import { EntityTypeNonNPC } from "../types/EntityTypeNonNPC";
|
|
2
3
|
/**
|
|
3
4
|
* Helper function to get all of the non-dead bosses in the room.
|
|
4
5
|
*
|
|
@@ -37,3 +38,19 @@ export declare function getBosses(matchingEntityType?: EntityType | int, matchin
|
|
|
37
38
|
export declare function getCombinedBossSet(stage: int): Set<string> | undefined;
|
|
38
39
|
/** Helper function to check if the provided NPC is a Sin miniboss, such as Sloth or Lust. */
|
|
39
40
|
export declare function isSin(npc: EntityNPC): boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Helper function to spawn a boss.
|
|
43
|
+
*
|
|
44
|
+
* Use this function instead of `spawnNPC` since it handles automatically spawning multiple segments
|
|
45
|
+
* for multi-segment bosses.
|
|
46
|
+
*
|
|
47
|
+
* By default, this will spawn Chub (and his variants) with 3 segments and other multi-segment
|
|
48
|
+
* bosses with 4 segments. You can customize this via the "numSegments" argument.
|
|
49
|
+
*/
|
|
50
|
+
export declare function spawnBoss<T extends number>(entityType: T extends EntityTypeNonNPC ? never : T, variant: int, subType: int, position: Vector, velocity?: Readonly<Vector>, spawner?: Entity | undefined, seed?: Seed | undefined, numSegments?: int): EntityNPC;
|
|
51
|
+
/**
|
|
52
|
+
* Helper function to spawn a boss with a specific seed.
|
|
53
|
+
*
|
|
54
|
+
* For more information, see the documentation for the `spawnBoss` function.
|
|
55
|
+
*/
|
|
56
|
+
export declare function spawnBossWithSeed(entityType: EntityType | int, variant: int, subType: int, position: Vector, seed: Seed, velocity?: Readonly<Vector>, spawner?: Entity | undefined, numSegments?: int): EntityNPC;
|
package/dist/functions/boss.lua
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
local ____lualib = require("lualib_bundle")
|
|
2
|
+
local Set = ____lualib.Set
|
|
3
|
+
local __TS__New = ____lualib.__TS__New
|
|
2
4
|
local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
|
|
3
5
|
local ____exports = {}
|
|
6
|
+
local ____constants = require("constants")
|
|
7
|
+
local VectorZero = ____constants.VectorZero
|
|
4
8
|
local ____bossSets = require("sets.bossSets")
|
|
5
9
|
local ALL_BOSSES_SET = ____bossSets.ALL_BOSSES_SET
|
|
6
10
|
local STAGE_TO_COMBINED_BOSS_SET_MAP = ____bossSets.STAGE_TO_COMBINED_BOSS_SET_MAP
|
|
@@ -9,10 +13,14 @@ local ____sinEntityTypesSet = require("sets.sinEntityTypesSet")
|
|
|
9
13
|
local SIN_ENTITY_TYPES_SET = ____sinEntityTypesSet.SIN_ENTITY_TYPES_SET
|
|
10
14
|
local ____entitySpecific = require("functions.entitySpecific")
|
|
11
15
|
local getNPCs = ____entitySpecific.getNPCs
|
|
16
|
+
local spawnNPC = ____entitySpecific.spawnNPC
|
|
12
17
|
local ____npc = require("functions.npc")
|
|
13
18
|
local getAliveNPCs = ____npc.getAliveNPCs
|
|
14
19
|
local ____set = require("functions.set")
|
|
15
20
|
local copySet = ____set.copySet
|
|
21
|
+
local ____utils = require("functions.utils")
|
|
22
|
+
local ____repeat = ____utils["repeat"]
|
|
23
|
+
local BOSSES_THAT_REQUIRE_MULTIPLE_SPAWNS = __TS__New(Set, {EntityType.ENTITY_LARRYJR, EntityType.ENTITY_CHUB, EntityType.ENTITY_TURDLET})
|
|
16
24
|
function ____exports.getAliveBosses(self, matchingEntityType, matchingVariant, matchingSubType, ignoreFriendly)
|
|
17
25
|
if ignoreFriendly == nil then
|
|
18
26
|
ignoreFriendly = false
|
|
@@ -69,4 +77,66 @@ end
|
|
|
69
77
|
function ____exports.isSin(self, npc)
|
|
70
78
|
return SIN_ENTITY_TYPES_SET:has(npc.Type)
|
|
71
79
|
end
|
|
80
|
+
function ____exports.spawnBoss(self, entityType, variant, subType, position, velocity, spawner, seed, numSegments)
|
|
81
|
+
if velocity == nil then
|
|
82
|
+
velocity = VectorZero
|
|
83
|
+
end
|
|
84
|
+
if spawner == nil then
|
|
85
|
+
spawner = nil
|
|
86
|
+
end
|
|
87
|
+
if seed == nil then
|
|
88
|
+
seed = nil
|
|
89
|
+
end
|
|
90
|
+
local npc = spawnNPC(
|
|
91
|
+
nil,
|
|
92
|
+
entityType,
|
|
93
|
+
variant,
|
|
94
|
+
subType,
|
|
95
|
+
position,
|
|
96
|
+
velocity,
|
|
97
|
+
spawner,
|
|
98
|
+
seed
|
|
99
|
+
)
|
|
100
|
+
if BOSSES_THAT_REQUIRE_MULTIPLE_SPAWNS:has(entityType) then
|
|
101
|
+
local numSegmentsDefined = numSegments == nil and 4 or numSegments
|
|
102
|
+
local numSegmentsToUse = entityType == EntityType.ENTITY_CHUB and 3 or numSegmentsDefined
|
|
103
|
+
local remainingSegmentsToSpawn = numSegmentsToUse - 1
|
|
104
|
+
____repeat(
|
|
105
|
+
nil,
|
|
106
|
+
remainingSegmentsToSpawn,
|
|
107
|
+
function()
|
|
108
|
+
spawnNPC(
|
|
109
|
+
nil,
|
|
110
|
+
entityType,
|
|
111
|
+
variant,
|
|
112
|
+
subType,
|
|
113
|
+
position,
|
|
114
|
+
velocity,
|
|
115
|
+
spawner,
|
|
116
|
+
seed
|
|
117
|
+
)
|
|
118
|
+
end
|
|
119
|
+
)
|
|
120
|
+
end
|
|
121
|
+
return npc
|
|
122
|
+
end
|
|
123
|
+
function ____exports.spawnBossWithSeed(self, entityType, variant, subType, position, seed, velocity, spawner, numSegments)
|
|
124
|
+
if velocity == nil then
|
|
125
|
+
velocity = VectorZero
|
|
126
|
+
end
|
|
127
|
+
if spawner == nil then
|
|
128
|
+
spawner = nil
|
|
129
|
+
end
|
|
130
|
+
return ____exports.spawnBoss(
|
|
131
|
+
nil,
|
|
132
|
+
entityType,
|
|
133
|
+
variant,
|
|
134
|
+
subType,
|
|
135
|
+
position,
|
|
136
|
+
velocity,
|
|
137
|
+
spawner,
|
|
138
|
+
seed,
|
|
139
|
+
numSegments
|
|
140
|
+
)
|
|
141
|
+
end
|
|
72
142
|
return ____exports
|