isaacscript-common 75.2.0 → 76.0.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/classes/features/other/DeployJSONRoom.d.ts +0 -1
- package/dist/classes/features/other/DeployJSONRoom.d.ts.map +1 -1
- package/dist/classes/features/other/DeployJSONRoom.lua +6 -4
- package/dist/classes/features/other/SpawnRockAltRewards.lua +14 -14
- package/dist/classes/features/other/extraConsoleCommands/commands.lua +3 -3
- package/dist/enums/ISCFeature.d.ts +12 -14
- package/dist/enums/ISCFeature.d.ts.map +1 -1
- package/dist/enums/ISCFeature.lua +12 -16
- package/dist/features.d.ts +12 -18
- package/dist/features.d.ts.map +1 -1
- package/dist/features.lua +1 -9
- package/dist/functions/collectibles.d.ts +8 -0
- package/dist/functions/collectibles.d.ts.map +1 -1
- package/dist/functions/collectibles.lua +19 -0
- package/dist/functions/spawnCollectible.d.ts +28 -6
- package/dist/functions/spawnCollectible.d.ts.map +1 -1
- package/dist/functions/spawnCollectible.lua +50 -7
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.lua +8 -0
- package/dist/index.rollup.d.ts +73 -104
- package/dist/indexLua.d.ts +1 -0
- package/dist/indexLua.d.ts.map +1 -1
- package/dist/indexLua.lua +8 -0
- package/dist/isaacscript-common.lua +213 -329
- package/package.json +1 -1
- package/src/classes/features/other/DeployJSONRoom.ts +4 -12
- package/src/classes/features/other/SpawnRockAltRewards.ts +14 -14
- package/src/classes/features/other/extraConsoleCommands/commands.ts +3 -3
- package/src/enums/ISCFeature.ts +0 -2
- package/src/features.ts +1 -15
- package/src/functions/collectibles.ts +25 -0
- package/src/functions/spawnCollectible.ts +58 -8
- package/src/index.ts +1 -0
- package/dist/classes/features/other/PreventCollectibleRotation.d.ts +0 -28
- package/dist/classes/features/other/PreventCollectibleRotation.d.ts.map +0 -1
- package/dist/classes/features/other/PreventCollectibleRotation.lua +0 -112
- package/dist/classes/features/other/SpawnCollectible.d.ts +0 -58
- package/dist/classes/features/other/SpawnCollectible.d.ts.map +0 -1
- package/dist/classes/features/other/SpawnCollectible.lua +0 -68
- package/src/classes/features/other/PreventCollectibleRotation.ts +0 -205
- package/src/classes/features/other/SpawnCollectible.ts +0 -124
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
local ____lualib = require("lualib_bundle")
|
|
2
|
-
local __TS__Class = ____lualib.__TS__Class
|
|
3
|
-
local __TS__ClassExtends = ____lualib.__TS__ClassExtends
|
|
4
|
-
local __TS__DecorateLegacy = ____lualib.__TS__DecorateLegacy
|
|
5
|
-
local ____exports = {}
|
|
6
|
-
local ____cachedClasses = require("core.cachedClasses")
|
|
7
|
-
local game = ____cachedClasses.game
|
|
8
|
-
local ____decorators = require("decorators")
|
|
9
|
-
local Exported = ____decorators.Exported
|
|
10
|
-
local ____ISCFeature = require("enums.ISCFeature")
|
|
11
|
-
local ISCFeature = ____ISCFeature.ISCFeature
|
|
12
|
-
local ____collectibleTag = require("functions.collectibleTag")
|
|
13
|
-
local isQuestCollectible = ____collectibleTag.isQuestCollectible
|
|
14
|
-
local ____spawnCollectible = require("functions.spawnCollectible")
|
|
15
|
-
local spawnCollectibleUnsafe = ____spawnCollectible.spawnCollectibleUnsafe
|
|
16
|
-
local ____Feature = require("classes.private.Feature")
|
|
17
|
-
local Feature = ____Feature.Feature
|
|
18
|
-
____exports.SpawnCollectible = __TS__Class()
|
|
19
|
-
local SpawnCollectible = ____exports.SpawnCollectible
|
|
20
|
-
SpawnCollectible.name = "SpawnCollectible"
|
|
21
|
-
__TS__ClassExtends(SpawnCollectible, Feature)
|
|
22
|
-
function SpawnCollectible.prototype.____constructor(self, preventCollectibleRotation)
|
|
23
|
-
Feature.prototype.____constructor(self)
|
|
24
|
-
self.featuresUsed = {ISCFeature.PREVENT_COLLECTIBLE_ROTATION}
|
|
25
|
-
self.preventCollectibleRotation = preventCollectibleRotation
|
|
26
|
-
end
|
|
27
|
-
function SpawnCollectible.prototype.spawnCollectible(self, collectibleType, positionOrGridIndex, seedOrRNG, options, forceFreeItem, spawner)
|
|
28
|
-
if options == nil then
|
|
29
|
-
options = false
|
|
30
|
-
end
|
|
31
|
-
if forceFreeItem == nil then
|
|
32
|
-
forceFreeItem = false
|
|
33
|
-
end
|
|
34
|
-
local collectible = spawnCollectibleUnsafe(
|
|
35
|
-
nil,
|
|
36
|
-
collectibleType,
|
|
37
|
-
positionOrGridIndex,
|
|
38
|
-
seedOrRNG,
|
|
39
|
-
options,
|
|
40
|
-
forceFreeItem,
|
|
41
|
-
spawner
|
|
42
|
-
)
|
|
43
|
-
if isQuestCollectible(nil, collectibleType) then
|
|
44
|
-
self.preventCollectibleRotation:preventCollectibleRotation(collectible, collectibleType)
|
|
45
|
-
end
|
|
46
|
-
return collectible
|
|
47
|
-
end
|
|
48
|
-
__TS__DecorateLegacy({Exported}, SpawnCollectible.prototype, "spawnCollectible", true)
|
|
49
|
-
function SpawnCollectible.prototype.spawnCollectibleFromPool(self, itemPoolType, positionOrGridIndex, seedOrRNG, options, forceFreeItem, spawner)
|
|
50
|
-
if options == nil then
|
|
51
|
-
options = false
|
|
52
|
-
end
|
|
53
|
-
if forceFreeItem == nil then
|
|
54
|
-
forceFreeItem = false
|
|
55
|
-
end
|
|
56
|
-
local itemPool = game:GetItemPool()
|
|
57
|
-
local collectibleType = itemPool:GetCollectible(itemPoolType)
|
|
58
|
-
return self:spawnCollectible(
|
|
59
|
-
collectibleType,
|
|
60
|
-
positionOrGridIndex,
|
|
61
|
-
seedOrRNG,
|
|
62
|
-
options,
|
|
63
|
-
forceFreeItem,
|
|
64
|
-
spawner
|
|
65
|
-
)
|
|
66
|
-
end
|
|
67
|
-
__TS__DecorateLegacy({Exported}, SpawnCollectible.prototype, "spawnCollectibleFromPool", true)
|
|
68
|
-
return ____exports
|
|
@@ -1,205 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
CardType,
|
|
3
|
-
CollectibleType,
|
|
4
|
-
DiceFloorSubType,
|
|
5
|
-
ModCallback,
|
|
6
|
-
PickupVariant,
|
|
7
|
-
} from "isaac-typescript-definitions";
|
|
8
|
-
import { game } from "../../../core/cachedClasses";
|
|
9
|
-
import { Exported } from "../../../decorators";
|
|
10
|
-
import { ISCFeature } from "../../../enums/ISCFeature";
|
|
11
|
-
import { ModCallbackCustom } from "../../../enums/ModCallbackCustom";
|
|
12
|
-
import { setCollectibleSubType } from "../../../functions/collectibles";
|
|
13
|
-
import { getEntityID } from "../../../functions/entities";
|
|
14
|
-
import { onGameFrame } from "../../../functions/frames";
|
|
15
|
-
import { isCollectible } from "../../../functions/pickupVariants";
|
|
16
|
-
import { getCollectibles } from "../../../functions/pickupsSpecific";
|
|
17
|
-
import { asCollectibleType } from "../../../functions/types";
|
|
18
|
-
import type { PickupIndex } from "../../../types/PickupIndex";
|
|
19
|
-
import { ReadonlySet } from "../../../types/ReadonlySet";
|
|
20
|
-
import { Feature } from "../../private/Feature";
|
|
21
|
-
import type { PickupIndexCreation } from "./PickupIndexCreation";
|
|
22
|
-
import type { RunInNFrames } from "./RunInNFrames";
|
|
23
|
-
|
|
24
|
-
const ROLL_COLLECTIBLE_TYPES = new ReadonlySet([
|
|
25
|
-
// The `PRE_USE_ITEM` D6 callback is fired for D6, D100, Dice Shard, 4-pip Dice Room, and 6-pip
|
|
26
|
-
// Dice Room.
|
|
27
|
-
CollectibleType.D6, // 105
|
|
28
|
-
CollectibleType.ETERNAL_D6, // 609
|
|
29
|
-
CollectibleType.SPINDOWN_DICE, // 723
|
|
30
|
-
]);
|
|
31
|
-
|
|
32
|
-
const ROLL_FLOOR_DICE_FLOOR_SUB_TYPES = new ReadonlySet([
|
|
33
|
-
DiceFloorSubType.FOUR_PIP,
|
|
34
|
-
DiceFloorSubType.SIX_PIP,
|
|
35
|
-
]);
|
|
36
|
-
|
|
37
|
-
const v = {
|
|
38
|
-
run: {
|
|
39
|
-
trackedCollectibles: new Map<PickupIndex, CollectibleType>(),
|
|
40
|
-
rollGameFrame: null as int | null,
|
|
41
|
-
},
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
export class PreventCollectibleRotation extends Feature {
|
|
45
|
-
/** @internal */
|
|
46
|
-
public override v = v;
|
|
47
|
-
|
|
48
|
-
private readonly pickupIndexCreation: PickupIndexCreation;
|
|
49
|
-
private readonly runInNFrames: RunInNFrames;
|
|
50
|
-
|
|
51
|
-
/** @internal */
|
|
52
|
-
constructor(
|
|
53
|
-
pickupIndexCreation: PickupIndexCreation,
|
|
54
|
-
runInNFrames: RunInNFrames,
|
|
55
|
-
) {
|
|
56
|
-
super();
|
|
57
|
-
|
|
58
|
-
this.featuresUsed = [
|
|
59
|
-
ISCFeature.PICKUP_INDEX_CREATION,
|
|
60
|
-
ISCFeature.RUN_IN_N_FRAMES,
|
|
61
|
-
];
|
|
62
|
-
|
|
63
|
-
this.callbacksUsed = [
|
|
64
|
-
// 5
|
|
65
|
-
[
|
|
66
|
-
ModCallback.POST_USE_CARD,
|
|
67
|
-
this.postUseCardSoulOfIsaac,
|
|
68
|
-
[CardType.SOUL_OF_ISAAC],
|
|
69
|
-
],
|
|
70
|
-
|
|
71
|
-
// 23, 105
|
|
72
|
-
[ModCallback.PRE_USE_ITEM, this.preUseItem],
|
|
73
|
-
];
|
|
74
|
-
|
|
75
|
-
this.customCallbacksUsed = [
|
|
76
|
-
[ModCallbackCustom.POST_DICE_ROOM_ACTIVATED, this.postDiceRoomActivated],
|
|
77
|
-
[ModCallbackCustom.POST_PICKUP_CHANGED, this.postPickupChanged],
|
|
78
|
-
];
|
|
79
|
-
|
|
80
|
-
this.pickupIndexCreation = pickupIndexCreation;
|
|
81
|
-
this.runInNFrames = runInNFrames;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
private readonly preUseItem = (
|
|
85
|
-
collectibleType: CollectibleType,
|
|
86
|
-
): boolean | undefined => {
|
|
87
|
-
if (ROLL_COLLECTIBLE_TYPES.has(collectibleType)) {
|
|
88
|
-
v.run.rollGameFrame = game.GetFrameCount();
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
return undefined;
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* Soul of Isaac causes items to flip. We assume that the player deliberately wants to roll a
|
|
96
|
-
* quest item, so we delete all tracked items in the current room.
|
|
97
|
-
*/
|
|
98
|
-
// ModCallback.POST_USE_CARD (5)
|
|
99
|
-
// Card.SOUL_ISAAC (81)
|
|
100
|
-
private readonly postUseCardSoulOfIsaac = () => {
|
|
101
|
-
const collectibles = getCollectibles();
|
|
102
|
-
for (const collectible of collectibles) {
|
|
103
|
-
const pickupIndex = this.pickupIndexCreation.getPickupIndex(collectible);
|
|
104
|
-
v.run.trackedCollectibles.delete(pickupIndex);
|
|
105
|
-
}
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
// ModCallbackCustom.POST_DICE_ROOM_ACTIVATED
|
|
109
|
-
private readonly postDiceRoomActivated = (
|
|
110
|
-
_player: EntityPlayer,
|
|
111
|
-
diceFloorSubType: DiceFloorSubType,
|
|
112
|
-
) => {
|
|
113
|
-
if (ROLL_FLOOR_DICE_FLOOR_SUB_TYPES.has(diceFloorSubType)) {
|
|
114
|
-
v.run.trackedCollectibles.clear();
|
|
115
|
-
}
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
// ModCallbackCustom.POST_PICKUP_CHANGED
|
|
119
|
-
private readonly postPickupChanged = (
|
|
120
|
-
pickup: EntityPickup,
|
|
121
|
-
oldVariant: PickupVariant,
|
|
122
|
-
_oldSubType: int,
|
|
123
|
-
newVariant: PickupVariant,
|
|
124
|
-
newSubType: int,
|
|
125
|
-
) => {
|
|
126
|
-
// We only care about collectibles rotating.
|
|
127
|
-
if (
|
|
128
|
-
oldVariant !== PickupVariant.COLLECTIBLE ||
|
|
129
|
-
newVariant !== PickupVariant.COLLECTIBLE
|
|
130
|
-
) {
|
|
131
|
-
return;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
// Ignore empty pedestals (i.e. collectibles that have already been taken by the player).
|
|
135
|
-
if (asCollectibleType(newSubType) === CollectibleType.NULL) {
|
|
136
|
-
return;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
const pickupIndex = this.pickupIndexCreation.getPickupIndex(pickup);
|
|
140
|
-
const trackedCollectibleType = v.run.trackedCollectibles.get(pickupIndex);
|
|
141
|
-
if (trackedCollectibleType === undefined) {
|
|
142
|
-
return;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
// It can take a frame after the activation of the D6 for the sub-type to change.
|
|
146
|
-
if (
|
|
147
|
-
v.run.rollGameFrame !== null &&
|
|
148
|
-
(onGameFrame(v.run.rollGameFrame) || onGameFrame(v.run.rollGameFrame + 1))
|
|
149
|
-
) {
|
|
150
|
-
v.run.trackedCollectibles.delete(pickupIndex);
|
|
151
|
-
return;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
if (trackedCollectibleType !== asCollectibleType(newSubType)) {
|
|
155
|
-
// This collectible has rotated, so restore it back to the way it was.
|
|
156
|
-
setCollectibleSubType(pickup, trackedCollectibleType);
|
|
157
|
-
}
|
|
158
|
-
};
|
|
159
|
-
|
|
160
|
-
/**
|
|
161
|
-
* Helper function to prevent a collectible from being affected by Tainted Isaac's rotation
|
|
162
|
-
* mechanic. (This mechanic also happens from Glitched Crown and Binge Eater.) This is useful
|
|
163
|
-
* because quest items that are manually spawned by mods will be automatically be affected by this
|
|
164
|
-
* mechanic.
|
|
165
|
-
*
|
|
166
|
-
* It is required to pass the intended collectible type to this function since it is possible for
|
|
167
|
-
* collectibles to rotate on the first frame that they are spawned.
|
|
168
|
-
*
|
|
169
|
-
* In order to use this function, you must upgrade your mod with
|
|
170
|
-
* `ISCFeature.PREVENT_COLLECTIBLE_ROTATION`.
|
|
171
|
-
*/
|
|
172
|
-
@Exported
|
|
173
|
-
public preventCollectibleRotation(
|
|
174
|
-
collectible: EntityPickup,
|
|
175
|
-
collectibleType: CollectibleType,
|
|
176
|
-
): void {
|
|
177
|
-
if (!isCollectible(collectible)) {
|
|
178
|
-
const entityID = getEntityID(collectible);
|
|
179
|
-
error(
|
|
180
|
-
`The "preventCollectibleRotation" function was given a non-collectible: ${entityID}`,
|
|
181
|
-
);
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
const pickupIndex = this.pickupIndexCreation.getPickupIndex(collectible);
|
|
185
|
-
v.run.trackedCollectibles.set(pickupIndex, collectibleType);
|
|
186
|
-
|
|
187
|
-
// The item might have already shifted on the first frame that it spawns, so change it back if
|
|
188
|
-
// necessary.
|
|
189
|
-
if (collectible.SubType !== collectibleType) {
|
|
190
|
-
setCollectibleSubType(collectible, collectibleType);
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
// It takes a frame for the `setCollectibleSubType` function to apply. There is a race condition
|
|
194
|
-
// whereby if the next frame is a collectible rotation (which occurs on frame 30, 60, 90, and so
|
|
195
|
-
// on), the collectible rotation will overwrite the `setCollectibleSubType` function. Thus, we
|
|
196
|
-
// must check again on the next frame. However, we cannot use an `EntityPtr`, because the
|
|
197
|
-
// reference is destroyed when the rotation occurs. Thus, we resort to using the `Exists` method
|
|
198
|
-
// and hope that no crashes occur.
|
|
199
|
-
this.runInNFrames.runNextGameFrame(() => {
|
|
200
|
-
if (collectible.Exists() && collectible.SubType !== collectibleType) {
|
|
201
|
-
setCollectibleSubType(collectible, collectibleType);
|
|
202
|
-
}
|
|
203
|
-
});
|
|
204
|
-
}
|
|
205
|
-
}
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
CollectibleType,
|
|
3
|
-
ItemPoolType,
|
|
4
|
-
} from "isaac-typescript-definitions";
|
|
5
|
-
import { game } from "../../../core/cachedClasses";
|
|
6
|
-
import { Exported } from "../../../decorators";
|
|
7
|
-
import { ISCFeature } from "../../../enums/ISCFeature";
|
|
8
|
-
import { isQuestCollectible } from "../../../functions/collectibleTag";
|
|
9
|
-
import { spawnCollectibleUnsafe } from "../../../functions/spawnCollectible";
|
|
10
|
-
import { Feature } from "../../private/Feature";
|
|
11
|
-
import type { PreventCollectibleRotation } from "./PreventCollectibleRotation";
|
|
12
|
-
|
|
13
|
-
export class SpawnCollectible extends Feature {
|
|
14
|
-
private readonly preventCollectibleRotation: PreventCollectibleRotation;
|
|
15
|
-
|
|
16
|
-
/** @internal */
|
|
17
|
-
constructor(preventCollectibleRotation: PreventCollectibleRotation) {
|
|
18
|
-
super();
|
|
19
|
-
|
|
20
|
-
this.featuresUsed = [ISCFeature.PREVENT_COLLECTIBLE_ROTATION];
|
|
21
|
-
|
|
22
|
-
this.preventCollectibleRotation = preventCollectibleRotation;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Helper function to spawn a collectible.
|
|
27
|
-
*
|
|
28
|
-
* Use this instead of the `Game.Spawn` method because it handles the cases of Tainted Keeper
|
|
29
|
-
* collectibles costing coins and preventing quest items from being rotated by Tainted Isaac's
|
|
30
|
-
* rotation mechanic.
|
|
31
|
-
*
|
|
32
|
-
* If you do not need to handle quest items being rotated (i.e. the collectible is guaranteed not
|
|
33
|
-
* to be a quest item), then you can use the `spawnCollectibleUnsafe` helper function instead
|
|
34
|
-
* (which does not require an upgraded mod).
|
|
35
|
-
*
|
|
36
|
-
* If you want to spawn an unseeded collectible, you must explicitly pass `undefined` to the
|
|
37
|
-
* `seedOrRNG` parameter.
|
|
38
|
-
*
|
|
39
|
-
* In order to use this function, you must upgrade your mod with `ISCFeature.SPAWN_COLLECTIBLE`.
|
|
40
|
-
*
|
|
41
|
-
* @param collectibleType The collectible type to spawn.
|
|
42
|
-
* @param positionOrGridIndex The position or grid index to spawn the collectible at.
|
|
43
|
-
* @param seedOrRNG The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
|
|
44
|
-
* `RNG.Next` method will be called. If `undefined` is provided, it will default
|
|
45
|
-
* to a random seed.
|
|
46
|
-
* @param options Optional. Set to true to make the collectible a "There's Options" style
|
|
47
|
-
* collectible. Default is false.
|
|
48
|
-
* @param forceFreeItem Optional. Set to true to disable the logic that gives the item a price for
|
|
49
|
-
* Tainted Keeper. Default is false.
|
|
50
|
-
* @param spawner Optional.
|
|
51
|
-
*/
|
|
52
|
-
@Exported
|
|
53
|
-
public spawnCollectible(
|
|
54
|
-
collectibleType: CollectibleType,
|
|
55
|
-
positionOrGridIndex: Vector | int,
|
|
56
|
-
seedOrRNG: Seed | RNG | undefined,
|
|
57
|
-
options = false,
|
|
58
|
-
forceFreeItem = false,
|
|
59
|
-
spawner?: Entity,
|
|
60
|
-
): EntityPickupCollectible {
|
|
61
|
-
const collectible = spawnCollectibleUnsafe(
|
|
62
|
-
collectibleType,
|
|
63
|
-
positionOrGridIndex,
|
|
64
|
-
seedOrRNG,
|
|
65
|
-
options,
|
|
66
|
-
forceFreeItem,
|
|
67
|
-
spawner,
|
|
68
|
-
);
|
|
69
|
-
|
|
70
|
-
if (isQuestCollectible(collectibleType)) {
|
|
71
|
-
this.preventCollectibleRotation.preventCollectibleRotation(
|
|
72
|
-
collectible,
|
|
73
|
-
collectibleType,
|
|
74
|
-
);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
return collectible;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* Helper function to spawn a collectible from a specific item pool.
|
|
82
|
-
*
|
|
83
|
-
* Use this instead of the `Game.Spawn` method because it handles the cases of Tainted Keeper
|
|
84
|
-
* collectibles costing coins and preventing quest items from being rotated by Tainted Isaac's
|
|
85
|
-
* rotation mechanic.
|
|
86
|
-
*
|
|
87
|
-
* If you want to spawn an unseeded collectible, you must explicitly pass `undefined` to the
|
|
88
|
-
* `seedOrRNG` parameter.
|
|
89
|
-
*
|
|
90
|
-
* In order to use this function, you must upgrade your mod with `ISCFeature.SPAWN_COLLECTIBLE`.
|
|
91
|
-
*
|
|
92
|
-
* @param itemPoolType The item pool to draw the collectible type from.
|
|
93
|
-
* @param positionOrGridIndex The position or grid index to spawn the collectible at.
|
|
94
|
-
* @param seedOrRNG The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
|
|
95
|
-
* `RNG.Next` method will be called. If `undefined` is provided, it will default
|
|
96
|
-
* to a random seed.
|
|
97
|
-
* @param options Optional. Set to true to make the collectible a "There's Options" style
|
|
98
|
-
* collectible. Default is false.
|
|
99
|
-
* @param forceFreeItem Optional. Set to true to disable the logic that gives the item a price for
|
|
100
|
-
* Tainted Keeper. Default is false.
|
|
101
|
-
* @param spawner Optional.
|
|
102
|
-
*/
|
|
103
|
-
@Exported
|
|
104
|
-
public spawnCollectibleFromPool(
|
|
105
|
-
itemPoolType: ItemPoolType,
|
|
106
|
-
positionOrGridIndex: Vector | int,
|
|
107
|
-
seedOrRNG: Seed | RNG | undefined,
|
|
108
|
-
options = false,
|
|
109
|
-
forceFreeItem = false,
|
|
110
|
-
spawner?: Entity,
|
|
111
|
-
): EntityPickupCollectible {
|
|
112
|
-
const itemPool = game.GetItemPool();
|
|
113
|
-
const collectibleType = itemPool.GetCollectible(itemPoolType);
|
|
114
|
-
|
|
115
|
-
return this.spawnCollectible(
|
|
116
|
-
collectibleType,
|
|
117
|
-
positionOrGridIndex,
|
|
118
|
-
seedOrRNG,
|
|
119
|
-
options,
|
|
120
|
-
forceFreeItem,
|
|
121
|
-
spawner,
|
|
122
|
-
);
|
|
123
|
-
}
|
|
124
|
-
}
|