isaacscript-common 9.13.2 → 9.13.5-dev.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/features/customPickup.d.ts +1 -1
- package/dist/features/customPickup.d.ts.map +1 -1
- package/dist/functions/levelGrid.d.ts +3 -1
- package/dist/functions/levelGrid.d.ts.map +1 -1
- package/dist/functions/levelGrid.lua +11 -3
- package/dist/index.d.ts +4 -2
- package/package.json +1 -1
- package/src/features/customPickup.ts +5 -5
- package/src/functions/levelGrid.ts +12 -4
|
@@ -23,5 +23,5 @@ import { PickupVariant } from "isaac-typescript-definitions";
|
|
|
23
23
|
* this function if your pickup should only be able to be collected under
|
|
24
24
|
* certain conditions.
|
|
25
25
|
*/
|
|
26
|
-
export declare function registerCustomPickup(pickupVariantCustom: PickupVariant, subType: int, collectFunc: (player: EntityPlayer) => void, collisionFunc?: (player: EntityPlayer) => boolean): void;
|
|
26
|
+
export declare function registerCustomPickup(pickupVariantCustom: PickupVariant, subType: int, collectFunc: (this: void, player: EntityPlayer) => void, collisionFunc?: (this: void, player: EntityPlayer) => boolean): void;
|
|
27
27
|
//# sourceMappingURL=customPickup.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customPickup.d.ts","sourceRoot":"","sources":["../../src/features/customPickup.ts"],"names":[],"mappings":";AAAA,OAAO,EAIL,aAAa,EACd,MAAM,8BAA8B,CAAC;AA6FtC;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,oBAAoB,CAClC,mBAAmB,EAAE,aAAa,EAClC,OAAO,EAAE,GAAG,EACZ,WAAW,EAAE,CAAC,MAAM,EAAE,YAAY,KAAK,IAAI,
|
|
1
|
+
{"version":3,"file":"customPickup.d.ts","sourceRoot":"","sources":["../../src/features/customPickup.ts"],"names":[],"mappings":";AAAA,OAAO,EAIL,aAAa,EACd,MAAM,8BAA8B,CAAC;AA6FtC;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,oBAAoB,CAClC,mBAAmB,EAAE,aAAa,EAClC,OAAO,EAAE,GAAG,EACZ,WAAW,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,YAAY,KAAK,IAAI,EACvD,aAAa,GAAE,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,YAAY,KAAK,OAAoB,GACxE,IAAI,CAaN"}
|
|
@@ -166,10 +166,12 @@ export declare function isRoomInsideGrid(roomGridIndex?: int): boolean;
|
|
|
166
166
|
* The newly created room will have data corresponding to the game's randomly generated red room. If
|
|
167
167
|
* you want to modify this, use the `setRoomData` helper function.
|
|
168
168
|
*
|
|
169
|
+
* @param seedOrRNG Optional. The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
|
|
170
|
+
* `RNG.Next` method will be called. Default is `Level.GetDungeonPlacementSeed`.
|
|
169
171
|
* @returns The room grid index of the new room or undefined if the floor had no valid dead ends to
|
|
170
172
|
* place a room.
|
|
171
173
|
*/
|
|
172
|
-
export declare function newRoom(): int | undefined;
|
|
174
|
+
export declare function newRoom(seedOrRNG?: Seed | RNG): int | undefined;
|
|
173
175
|
/**
|
|
174
176
|
* Helper function to check if a room exists at the given room grid index. (A room will exist if it
|
|
175
177
|
* has non-undefined data in the room descriptor.)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"levelGrid.d.ts","sourceRoot":"","sources":["../../src/functions/levelGrid.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;AAEH,OAAO,EAEL,QAAQ,EAKR,SAAS,EACT,QAAQ,EACT,MAAM,8BAA8B,CAAC;AA8BtC;;;;;GAKG;AACH,wBAAgB,kCAAkC,CAAC,aAAa,CAAC,EAAE,GAAG,GAAG,GAAG,EAAE,CAK7E;AAED;;;;;;GAMG;AACH,wBAAgB,qCAAqC,CACnD,aAAa,CAAC,EAAE,GAAG,GAClB,GAAG,EAAE,CAKP;AAED;;;;;;;;;;;;;;GAcG;AACH,wBA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Aa,CAAC,EAAE,GAAG,GAAG,OAAO,CAKtD;AAED,wBAAgB,0BAA0B,CACxC,QAAQ,EAAE,QAAQ,EAClB,aAAa,EAAE,GAAG,GACjB,OAAO,CAGT;AAED,wBAAgB,oCAAoC,CAClD,QAAQ,EAAE,QAAQ,EAClB,aAAa,EAAE,GAAG,GACjB,OAAO,CAqBT;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,aAAa,CAAC,EAAE,GAAG,GAAG,OAAO,CAGzD;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,aAAa,CAAC,EAAE,GAAG,GAAG,OAAO,CAM7D;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,OAAO,CAAC,SAAS,CAAC,EAAE,IAAI,GAAG,GAAG,GAAG,GAAG,GAAG,SAAS,CAmD/D;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,aAAa,EAAE,GAAG,GAAG,OAAO,CAGtD;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAAC,aAAa,EAAE,GAAG,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,CAAC,CAKtE"}
|
|
@@ -32,6 +32,8 @@ local hasFlag = ____flag.hasFlag
|
|
|
32
32
|
local removeFlag = ____flag.removeFlag
|
|
33
33
|
local ____rng = require("functions.rng")
|
|
34
34
|
local getRandomSeed = ____rng.getRandomSeed
|
|
35
|
+
local isRNG = ____rng.isRNG
|
|
36
|
+
local newRNG = ____rng.newRNG
|
|
35
37
|
local ____roomData = require("functions.roomData")
|
|
36
38
|
local getRoomAllowedDoors = ____roomData.getRoomAllowedDoors
|
|
37
39
|
local getRoomData = ____roomData.getRoomData
|
|
@@ -348,15 +350,21 @@ end
|
|
|
348
350
|
-- The newly created room will have data corresponding to the game's randomly generated red room. If
|
|
349
351
|
-- you want to modify this, use the `setRoomData` helper function.
|
|
350
352
|
--
|
|
353
|
+
-- @param seedOrRNG Optional. The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
|
|
354
|
+
-- `RNG.Next` method will be called. Default is `Level.GetDungeonPlacementSeed`.
|
|
351
355
|
-- @returns The room grid index of the new room or undefined if the floor had no valid dead ends to
|
|
352
356
|
-- place a room.
|
|
353
|
-
function ____exports.newRoom()
|
|
354
|
-
local
|
|
357
|
+
function ____exports.newRoom(seedOrRNG)
|
|
358
|
+
local level = game:GetLevel()
|
|
359
|
+
if seedOrRNG == nil then
|
|
360
|
+
seedOrRNG = level:GetDungeonPlacementSeed()
|
|
361
|
+
end
|
|
362
|
+
local rng = isRNG(seedOrRNG) and seedOrRNG or newRNG(seedOrRNG)
|
|
363
|
+
local newRoomCandidate = ____exports.getNewRoomCandidate(rng)
|
|
355
364
|
if newRoomCandidate == nil then
|
|
356
365
|
return nil
|
|
357
366
|
end
|
|
358
367
|
local adjacentRoomGridIndex, doorSlot, newRoomGridIndex = table.unpack(newRoomCandidate)
|
|
359
|
-
local level = game:GetLevel()
|
|
360
368
|
level:MakeRedRoomDoor(adjacentRoomGridIndex, doorSlot)
|
|
361
369
|
local roomDescriptor = getRoomDescriptor(newRoomGridIndex)
|
|
362
370
|
roomDescriptor.Flags = removeFlag(roomDescriptor.Flags, RoomDescriptorFlag.RED_ROOM)
|
package/dist/index.d.ts
CHANGED
|
@@ -8365,10 +8365,12 @@ export declare function newRNG(seed?: Seed): RNG;
|
|
|
8365
8365
|
* The newly created room will have data corresponding to the game's randomly generated red room. If
|
|
8366
8366
|
* you want to modify this, use the `setRoomData` helper function.
|
|
8367
8367
|
*
|
|
8368
|
+
* @param seedOrRNG Optional. The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
|
|
8369
|
+
* `RNG.Next` method will be called. Default is `Level.GetDungeonPlacementSeed`.
|
|
8368
8370
|
* @returns The room grid index of the new room or undefined if the floor had no valid dead ends to
|
|
8369
8371
|
* place a room.
|
|
8370
8372
|
*/
|
|
8371
|
-
export declare function newRoom(): int | undefined;
|
|
8373
|
+
export declare function newRoom(seedOrRNG?: Seed | RNG): int | undefined;
|
|
8372
8374
|
|
|
8373
8375
|
/**
|
|
8374
8376
|
* Helper function to generate a new sprite based on a collectible. If the provided collectible type
|
|
@@ -9226,7 +9228,7 @@ export declare function registerCharacterStats(playerType: PlayerType, statMap:
|
|
|
9226
9228
|
* this function if your pickup should only be able to be collected under
|
|
9227
9229
|
* certain conditions.
|
|
9228
9230
|
*/
|
|
9229
|
-
export declare function registerCustomPickup(pickupVariantCustom: PickupVariant, subType: int, collectFunc: (player: EntityPlayer) => void, collisionFunc?: (player: EntityPlayer) => boolean): void;
|
|
9231
|
+
export declare function registerCustomPickup(pickupVariantCustom: PickupVariant, subType: int, collectFunc: (this: void, player: EntityPlayer) => void, collisionFunc?: (this: void, player: EntityPlayer) => boolean): void;
|
|
9230
9232
|
|
|
9231
9233
|
/**
|
|
9232
9234
|
* Helper function to run arbitrary code when you press and release a specific keyboard key.
|
package/package.json
CHANGED
|
@@ -13,10 +13,10 @@ import { spawnEffect } from "../functions/entitiesSpecific";
|
|
|
13
13
|
|
|
14
14
|
const FEATURE_NAME = "customPickup";
|
|
15
15
|
|
|
16
|
-
/**
|
|
16
|
+
/** @noSelf */
|
|
17
17
|
interface CustomPickupFunctions {
|
|
18
|
-
collectFunc: (
|
|
19
|
-
collisionFunc: (
|
|
18
|
+
collectFunc: (player: EntityPlayer) => void;
|
|
19
|
+
collisionFunc: (player: EntityPlayer) => boolean;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
/**
|
|
@@ -122,8 +122,8 @@ function postEffectRenderPickupEffect(effect: EntityEffect) {
|
|
|
122
122
|
export function registerCustomPickup(
|
|
123
123
|
pickupVariantCustom: PickupVariant,
|
|
124
124
|
subType: int,
|
|
125
|
-
collectFunc: (player: EntityPlayer) => void,
|
|
126
|
-
collisionFunc: (player: EntityPlayer) => boolean = () => true,
|
|
125
|
+
collectFunc: (this: void, player: EntityPlayer) => void,
|
|
126
|
+
collisionFunc: (this: void, player: EntityPlayer) => boolean = () => true,
|
|
127
127
|
): void {
|
|
128
128
|
errorIfFeaturesNotInitialized(FEATURE_NAME);
|
|
129
129
|
|
|
@@ -27,7 +27,7 @@ import { ROOM_SHAPE_TO_DOOR_SLOTS_TO_GRID_INDEX_DELTA } from "../objects/roomSha
|
|
|
27
27
|
import { getRandomArrayElement } from "./array";
|
|
28
28
|
import { doorSlotToDoorSlotFlag } from "./doors";
|
|
29
29
|
import { addFlag, hasFlag, removeFlag } from "./flag";
|
|
30
|
-
import { getRandomSeed } from "./rng";
|
|
30
|
+
import { getRandomSeed, isRNG, newRNG } from "./rng";
|
|
31
31
|
import {
|
|
32
32
|
getRoomAllowedDoors,
|
|
33
33
|
getRoomData,
|
|
@@ -460,17 +460,25 @@ export function isRoomInsideGrid(roomGridIndex?: int): boolean {
|
|
|
460
460
|
* The newly created room will have data corresponding to the game's randomly generated red room. If
|
|
461
461
|
* you want to modify this, use the `setRoomData` helper function.
|
|
462
462
|
*
|
|
463
|
+
* @param seedOrRNG Optional. The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
|
|
464
|
+
* `RNG.Next` method will be called. Default is `Level.GetDungeonPlacementSeed`.
|
|
463
465
|
* @returns The room grid index of the new room or undefined if the floor had no valid dead ends to
|
|
464
466
|
* place a room.
|
|
465
467
|
*/
|
|
466
|
-
export function newRoom(): int | undefined {
|
|
467
|
-
const
|
|
468
|
+
export function newRoom(seedOrRNG?: Seed | RNG): int | undefined {
|
|
469
|
+
const level = game.GetLevel();
|
|
470
|
+
|
|
471
|
+
if (seedOrRNG === undefined) {
|
|
472
|
+
seedOrRNG = level.GetDungeonPlacementSeed();
|
|
473
|
+
}
|
|
474
|
+
const rng = isRNG(seedOrRNG) ? seedOrRNG : newRNG(seedOrRNG);
|
|
475
|
+
|
|
476
|
+
const newRoomCandidate = getNewRoomCandidate(rng);
|
|
468
477
|
if (newRoomCandidate === undefined) {
|
|
469
478
|
return undefined;
|
|
470
479
|
}
|
|
471
480
|
const [adjacentRoomGridIndex, doorSlot, newRoomGridIndex] = newRoomCandidate;
|
|
472
481
|
|
|
473
|
-
const level = game.GetLevel();
|
|
474
482
|
level.MakeRedRoomDoor(adjacentRoomGridIndex, doorSlot);
|
|
475
483
|
|
|
476
484
|
// By default, the room will be a "red room" and have a red graphical tint, so we want to make it
|