isaacscript-common 6.14.0 → 6.16.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/postGridEntityCustomCollision.d.ts +2 -0
- package/dist/callbacks/postGridEntityCustomCollision.d.ts.map +1 -0
- package/dist/callbacks/postGridEntityCustomCollision.lua +71 -0
- package/dist/callbacks/postGridEntityCustomRender.lua +0 -7
- package/dist/callbacks/postGridEntityCustomUpdate.lua +0 -7
- package/dist/callbacks/subscriptions/postGridEntityCustomBroken.d.ts +6 -0
- package/dist/callbacks/subscriptions/postGridEntityCustomBroken.d.ts.map +1 -0
- package/dist/callbacks/subscriptions/postGridEntityCustomBroken.lua +24 -0
- package/dist/callbacks/subscriptions/postGridEntityCustomCollision.d.ts +6 -0
- package/dist/callbacks/subscriptions/postGridEntityCustomCollision.d.ts.map +1 -0
- package/dist/callbacks/subscriptions/postGridEntityCustomCollision.lua +29 -0
- package/dist/enums/ModCallbackCustom.d.ts +96 -62
- package/dist/enums/ModCallbackCustom.d.ts.map +1 -1
- package/dist/enums/ModCallbackCustom.lua +64 -60
- package/dist/features/customGridEntity.d.ts +5 -1
- package/dist/features/customGridEntity.d.ts.map +1 -1
- package/dist/features/customGridEntity.lua +65 -5
- package/dist/functions/collectibles.d.ts +6 -2
- package/dist/functions/collectibles.d.ts.map +1 -1
- package/dist/functions/collectibles.lua +4 -2
- package/dist/functions/color.d.ts +11 -15
- package/dist/functions/color.d.ts.map +1 -1
- package/dist/functions/color.lua +55 -74
- package/dist/functions/deepCopy.d.ts.map +1 -1
- package/dist/functions/deepCopy.lua +22 -1
- package/dist/functions/gridEntities.d.ts +0 -16
- package/dist/functions/gridEntities.d.ts.map +1 -1
- package/dist/functions/gridEntities.lua +0 -19
- package/dist/functions/isaacAPIClass.d.ts +1 -1
- package/dist/functions/isaacAPIClass.d.ts.map +1 -1
- package/dist/functions/itemPool.d.ts +10 -0
- package/dist/functions/itemPool.d.ts.map +1 -0
- package/dist/functions/itemPool.lua +116 -0
- package/dist/functions/kColor.d.ts +11 -15
- package/dist/functions/kColor.d.ts.map +1 -1
- package/dist/functions/kColor.lua +42 -61
- package/dist/functions/mergeTests.lua +2 -2
- package/dist/functions/npcs.d.ts +1 -29
- package/dist/functions/npcs.d.ts.map +1 -1
- package/dist/functions/npcs.lua +0 -45
- package/dist/functions/projectiles.d.ts +32 -0
- package/dist/functions/projectiles.d.ts.map +1 -0
- package/dist/functions/projectiles.lua +73 -0
- package/dist/functions/rng.d.ts +11 -15
- package/dist/functions/rng.d.ts.map +1 -1
- package/dist/functions/rng.lua +32 -52
- package/dist/functions/rockAlt.d.ts +26 -6
- package/dist/functions/rockAlt.d.ts.map +1 -1
- package/dist/functions/rockAlt.lua +303 -78
- package/dist/functions/saveFile.d.ts +8 -7
- package/dist/functions/saveFile.d.ts.map +1 -1
- package/dist/functions/saveFile.lua +10 -96
- package/dist/functions/serialization.d.ts +26 -7
- package/dist/functions/serialization.d.ts.map +1 -1
- package/dist/functions/serialization.lua +51 -19
- package/dist/functions/table.d.ts +2 -2
- package/dist/functions/table.lua +2 -2
- package/dist/functions/trinketGive.d.ts +13 -0
- package/dist/functions/trinketGive.d.ts.map +1 -1
- package/dist/functions/trinketGive.lua +16 -0
- package/dist/functions/tstlClass.d.ts +1 -1
- package/dist/functions/tstlClass.d.ts.map +1 -1
- package/dist/functions/vector.d.ts +11 -15
- package/dist/functions/vector.d.ts.map +1 -1
- package/dist/functions/vector.lua +36 -55
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.lua +16 -0
- package/dist/initCustomCallbacks.d.ts.map +1 -1
- package/dist/initCustomCallbacks.lua +3 -0
- package/dist/interfaces/AddCallbackParameterCustom.d.ts +4 -0
- package/dist/interfaces/AddCallbackParameterCustom.d.ts.map +1 -1
- package/dist/objects/callbackRegisterFunctions.d.ts.map +1 -1
- package/dist/objects/callbackRegisterFunctions.lua +6 -0
- package/dist/objects/isaacAPIClassTypeToFunctions.d.ts +12 -0
- package/dist/objects/isaacAPIClassTypeToFunctions.d.ts.map +1 -0
- package/dist/objects/isaacAPIClassTypeToFunctions.lua +25 -0
- package/dist/types/{private/IsaacAPIClass.d.ts → IsaacAPIClass.d.ts} +0 -0
- package/dist/types/IsaacAPIClass.d.ts.map +1 -0
- package/dist/types/{private/IsaacAPIClass.lua → IsaacAPIClass.lua} +0 -0
- package/dist/types/{private/SerializedIsaacAPIClass.d.ts → SerializedIsaacAPIClass.d.ts} +0 -0
- package/dist/types/SerializedIsaacAPIClass.d.ts.map +1 -0
- package/dist/types/{private/SerializedIsaacAPIClass.lua → SerializedIsaacAPIClass.lua} +0 -0
- package/dist/types/{private/TSTLClass.d.ts → TSTLClass.d.ts} +0 -0
- package/dist/types/TSTLClass.d.ts.map +1 -0
- package/dist/types/{private/TSTLClass.lua → TSTLClass.lua} +0 -0
- package/package.json +2 -2
- package/src/callbacks/postGridEntityCustomCollision.ts +74 -0
- package/src/callbacks/postGridEntityCustomRender.ts +1 -17
- package/src/callbacks/postGridEntityCustomUpdate.ts +1 -17
- package/src/callbacks/subscriptions/postGridEntityCustomBroken.ts +36 -0
- package/src/callbacks/subscriptions/postGridEntityCustomCollision.ts +43 -0
- package/src/enums/ModCallbackCustom.ts +38 -2
- package/src/features/customGridEntity.ts +76 -0
- package/src/functions/collectibles.ts +6 -2
- package/src/functions/color.ts +67 -87
- package/src/functions/deepCopy.ts +15 -2
- package/src/functions/gridEntities.ts +0 -23
- package/src/functions/isaacAPIClass.ts +1 -1
- package/src/functions/itemPool.ts +153 -0
- package/src/functions/kColor.ts +65 -84
- package/src/functions/mergeTests.ts +2 -2
- package/src/functions/npcs.ts +1 -58
- package/src/functions/projectiles.ts +78 -0
- package/src/functions/rng.ts +45 -65
- package/src/functions/rockAlt.ts +339 -60
- package/src/functions/saveFile.ts +13 -119
- package/src/functions/serialization.ts +81 -25
- package/src/functions/table.ts +2 -2
- package/src/functions/trinketGive.ts +21 -0
- package/src/functions/tstlClass.ts +1 -1
- package/src/functions/vector.ts +55 -74
- package/src/index.ts +2 -0
- package/src/initCustomCallbacks.ts +2 -0
- package/src/interfaces/AddCallbackParameterCustom.ts +4 -0
- package/src/objects/callbackRegisterFunctions.ts +6 -0
- package/src/objects/isaacAPIClassTypeToFunctions.ts +63 -0
- package/src/types/{private/IsaacAPIClass.ts → IsaacAPIClass.ts} +0 -0
- package/src/types/{private/SerializedIsaacAPIClass.ts → SerializedIsaacAPIClass.ts} +0 -0
- package/src/types/{private/TSTLClass.ts → TSTLClass.ts} +0 -0
- package/dist/objects/isaacAPIClassTypeToCopyFunction.d.ts +0 -6
- package/dist/objects/isaacAPIClassTypeToCopyFunction.d.ts.map +0 -1
- package/dist/objects/isaacAPIClassTypeToCopyFunction.lua +0 -13
- package/dist/objects/serializedIsaacAPIClassTypeToIdentityFunction.d.ts +0 -5
- package/dist/objects/serializedIsaacAPIClassTypeToIdentityFunction.d.ts.map +0 -1
- package/dist/objects/serializedIsaacAPIClassTypeToIdentityFunction.lua +0 -13
- package/dist/types/private/IsaacAPIClass.d.ts.map +0 -1
- package/dist/types/private/SerializedIsaacAPIClass.d.ts.map +0 -1
- package/dist/types/private/TSTLClass.d.ts.map +0 -1
- package/src/objects/isaacAPIClassTypeToCopyFunction.ts +0 -18
- package/src/objects/serializedIsaacAPIClassTypeToIdentityFunction.ts +0 -14
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
local ____exports = {}
|
|
2
|
+
local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
|
|
3
|
+
local EntityFlag = ____isaac_2Dtypescript_2Ddefinitions.EntityFlag
|
|
4
|
+
local EntityType = ____isaac_2Dtypescript_2Ddefinitions.EntityType
|
|
5
|
+
local ProjectilesMode = ____isaac_2Dtypescript_2Ddefinitions.ProjectilesMode
|
|
6
|
+
local ____entities = require("functions.entities")
|
|
7
|
+
local getFilteredNewEntities = ____entities.getFilteredNewEntities
|
|
8
|
+
local ____entitiesSpecific = require("functions.entitiesSpecific")
|
|
9
|
+
local getProjectiles = ____entitiesSpecific.getProjectiles
|
|
10
|
+
local spawnNPC = ____entitiesSpecific.spawnNPC
|
|
11
|
+
--- Helper function to make an NPC fire one or more projectiles. Returns the fired projectile(s).
|
|
12
|
+
--
|
|
13
|
+
-- Use this function instead of the `EntityNPC.FireProjectiles` method if you need to modify or
|
|
14
|
+
-- access the `EntityProjectile` objects after they are fired, since this function returns the
|
|
15
|
+
-- objects in an array.
|
|
16
|
+
--
|
|
17
|
+
-- @param npc The NPC to fire the projectile(s) from. You can also pass undefined if you do not want
|
|
18
|
+
-- the projectile(s) to come from anything in particular.
|
|
19
|
+
-- @param position The staring position of the projectile(s).
|
|
20
|
+
-- @param velocity The starting velocity of the projectile(s).
|
|
21
|
+
-- @param projectilesMode Optional. The mode of the projectile(s). Default is
|
|
22
|
+
-- `ProjectilesMode.ONE_PROJECTILE`.
|
|
23
|
+
-- @param projectileParams Optional. The parameters of the projectile(s). Default is
|
|
24
|
+
-- `ProjectileParams()`.
|
|
25
|
+
-- @returns The fired projectile(s).
|
|
26
|
+
function ____exports.fireProjectiles(self, npc, position, velocity, projectilesMode, projectileParams)
|
|
27
|
+
if projectilesMode == nil then
|
|
28
|
+
projectilesMode = ProjectilesMode.ONE_PROJECTILE
|
|
29
|
+
end
|
|
30
|
+
if projectileParams == nil then
|
|
31
|
+
projectileParams = ProjectileParams()
|
|
32
|
+
end
|
|
33
|
+
local oldProjectiles = getProjectiles(nil, projectileParams.Variant)
|
|
34
|
+
local spawnedFly = false
|
|
35
|
+
if npc == nil then
|
|
36
|
+
spawnedFly = true
|
|
37
|
+
npc = spawnNPC(
|
|
38
|
+
nil,
|
|
39
|
+
EntityType.FLY,
|
|
40
|
+
0,
|
|
41
|
+
0,
|
|
42
|
+
position
|
|
43
|
+
)
|
|
44
|
+
npc.Visible = false
|
|
45
|
+
npc:ClearEntityFlags(EntityFlag.APPEAR)
|
|
46
|
+
end
|
|
47
|
+
npc:FireProjectiles(position, velocity, projectilesMode, projectileParams)
|
|
48
|
+
local newProjectiles = getProjectiles(nil, projectileParams.Variant)
|
|
49
|
+
if spawnedFly then
|
|
50
|
+
npc:Remove()
|
|
51
|
+
end
|
|
52
|
+
return getFilteredNewEntities(nil, oldProjectiles, newProjectiles)
|
|
53
|
+
end
|
|
54
|
+
--- Helper function to spawn projectiles in a circle around a position. Under the hood, this
|
|
55
|
+
-- leverages `ProjectileMode.N_PROJECTILES_IN_CIRCLE`.
|
|
56
|
+
--
|
|
57
|
+
-- @param npc The NPC to fire the projectile(s) from. You can also pass undefined if you do not want
|
|
58
|
+
-- the projectile(s) to come from anything in particular.
|
|
59
|
+
-- @param position The staring position of the projectile(s).
|
|
60
|
+
-- @param speed The speed of the projectile(s).
|
|
61
|
+
-- @param numProjectiles The amount of projectiles to spawn.
|
|
62
|
+
-- @returns The fired projectile(s).
|
|
63
|
+
function ____exports.fireProjectilesInCircle(self, npc, position, speed, numProjectiles)
|
|
64
|
+
local velocity = Vector(speed, numProjectiles)
|
|
65
|
+
return ____exports.fireProjectiles(
|
|
66
|
+
nil,
|
|
67
|
+
npc,
|
|
68
|
+
position,
|
|
69
|
+
velocity,
|
|
70
|
+
ProjectilesMode.N_PROJECTILES_IN_CIRCLE
|
|
71
|
+
)
|
|
72
|
+
end
|
|
73
|
+
return ____exports
|
package/dist/functions/rng.d.ts
CHANGED
|
@@ -1,24 +1,16 @@
|
|
|
1
1
|
/// <reference types="typescript-to-lua/language-extensions" />
|
|
2
2
|
/// <reference types="isaac-typescript-definitions" />
|
|
3
3
|
/// <reference types="isaac-typescript-definitions" />
|
|
4
|
-
|
|
5
|
-
declare type SerializedRNG = LuaMap<string, unknown> & {
|
|
4
|
+
export declare type SerializedRNG = LuaMap<string, unknown> & {
|
|
6
5
|
readonly __serializedRNGBrand: symbol;
|
|
7
6
|
};
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
[SerializationType.SERIALIZE]: SerializedRNG;
|
|
11
|
-
[SerializationType.DESERIALIZE]: RNG;
|
|
12
|
-
}
|
|
7
|
+
/** Helper function to copy an `RNG` Isaac API class. */
|
|
8
|
+
export declare function copyRNG(rng: RNG): RNG;
|
|
13
9
|
/**
|
|
14
|
-
* Helper function to
|
|
15
|
-
*
|
|
16
|
-
* @param rng The RNG object to copy. In the case of deserialization, this will actually be a Lua
|
|
17
|
-
* table instead of an instantiated RNG class.
|
|
18
|
-
* @param serializationType Default is `SerializationType.NONE`.
|
|
10
|
+
* Helper function to convert a `SerializedRNG` object to a normal `RNG` object. (This is used by
|
|
11
|
+
* the save data manager when reading data from the "save#.dat" file.)
|
|
19
12
|
*/
|
|
20
|
-
export declare function
|
|
21
|
-
export declare function copyRNG<R extends RNG | SerializedRNG>(rng: R): CopyRNGReturn[SerializationType.NONE];
|
|
13
|
+
export declare function deserializeRNG(rng: SerializedRNG): RNG;
|
|
22
14
|
/**
|
|
23
15
|
* Helper function to get a random `Seed` value to be used in spawning entities and so on. Use this
|
|
24
16
|
* instead of calling the `Random` function directly since that can return a value of 0 and crash
|
|
@@ -39,6 +31,11 @@ export declare function isSerializedRNG(object: unknown): object is SerializedRN
|
|
|
39
31
|
*/
|
|
40
32
|
export declare function newRNG(seed?: Seed): RNG;
|
|
41
33
|
export declare function rngEquals(rng1: RNG, rng2: RNG): boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Helper function to convert a `RNG` object to a `SerializedRNG` object. (This is used by the save
|
|
36
|
+
* data manager when writing data from the "save#.dat" file.)
|
|
37
|
+
*/
|
|
38
|
+
export declare function serializeRNG(rng: RNG): SerializedRNG;
|
|
42
39
|
/**
|
|
43
40
|
* Helper function to iterate over the provided object and set the seed for all of the values that
|
|
44
41
|
* are RNG objects equal to a particular seed.
|
|
@@ -51,5 +48,4 @@ export declare function setAllRNGToSeed(object: unknown, seed: Seed): void;
|
|
|
51
48
|
export declare function setAllRNGToStartSeed(object: unknown): void;
|
|
52
49
|
/** Helper function to set a seed to an RNG object using Blade's recommended shift index. */
|
|
53
50
|
export declare function setSeed(rng: RNG, seed: Seed): void;
|
|
54
|
-
export {};
|
|
55
51
|
//# sourceMappingURL=rng.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rng.d.ts","sourceRoot":"","sources":["../../src/functions/rng.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"rng.d.ts","sourceRoot":"","sources":["../../src/functions/rng.ts"],"names":[],"mappings":";;;AAMA,oBAAY,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG;IACpD,QAAQ,CAAC,oBAAoB,EAAE,MAAM,CAAC;CACvC,CAAC;AAYF,wDAAwD;AACxD,wBAAgB,OAAO,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,CASrC;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,aAAa,GAAG,GAAG,CAatD;AAED;;;;GAIG;AACH,wBAAgB,aAAa,IAAI,IAAI,CAIpC;AAED,2EAA2E;AAC3E,wBAAgB,KAAK,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,IAAI,GAAG,CAEpD;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,IAAI,aAAa,CAMxE;AAED;;;;GAIG;AACH,wBAAgB,MAAM,CAAC,IAAI,OAAkB,GAAG,GAAG,CAIlD;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,GAAG,OAAO,CAEvD;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,GAAG,GAAG,aAAa,CAYpD;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,GAAG,IAAI,CAoBjE;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAK1D;AAED,4FAA4F;AAC5F,wBAAgB,OAAO,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,GAAG,IAAI,CASlD"}
|
package/dist/functions/rng.lua
CHANGED
|
@@ -6,8 +6,6 @@ local ____cachedClasses = require("cachedClasses")
|
|
|
6
6
|
local game = ____cachedClasses.game
|
|
7
7
|
local ____SerializationBrand = require("enums.private.SerializationBrand")
|
|
8
8
|
local SerializationBrand = ____SerializationBrand.SerializationBrand
|
|
9
|
-
local ____SerializationType = require("enums.SerializationType")
|
|
10
|
-
local SerializationType = ____SerializationType.SerializationType
|
|
11
9
|
local ____isaacAPIClass = require("functions.isaacAPIClass")
|
|
12
10
|
local isaacAPIClassEquals = ____isaacAPIClass.isaacAPIClassEquals
|
|
13
11
|
local isIsaacAPIClassOfType = ____isaacAPIClass.isIsaacAPIClassOfType
|
|
@@ -49,57 +47,27 @@ end
|
|
|
49
47
|
RECOMMENDED_SHIFT_IDX = 35
|
|
50
48
|
local KEYS = {"seed"}
|
|
51
49
|
OBJECT_NAME = "RNG"
|
|
52
|
-
--- Helper function to copy an `RNG`
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
-- @param serializationType Default is `SerializationType.NONE`.
|
|
57
|
-
function ____exports.copyRNG(self, rng, serializationType)
|
|
58
|
-
if serializationType == nil then
|
|
59
|
-
serializationType = SerializationType.NONE
|
|
50
|
+
--- Helper function to copy an `RNG` Isaac API class.
|
|
51
|
+
function ____exports.copyRNG(self, rng)
|
|
52
|
+
if not ____exports.isRNG(nil, rng) then
|
|
53
|
+
error(((("Failed to copy a " .. OBJECT_NAME) .. " object since the provided object was not a userdata ") .. OBJECT_NAME) .. " class.")
|
|
60
54
|
end
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
error(((("Failed to serialize a " .. OBJECT_NAME) .. " object since the provided object was not a userdata ") .. OBJECT_NAME) .. " class.")
|
|
78
|
-
end
|
|
79
|
-
local seed = rng:GetSeed()
|
|
80
|
-
local rngTable = {}
|
|
81
|
-
rngTable.seed = seed
|
|
82
|
-
rngTable[SerializationBrand.RNG] = ""
|
|
83
|
-
return rngTable
|
|
84
|
-
end
|
|
85
|
-
end
|
|
86
|
-
____cond3 = ____cond3 or ____switch3 == SerializationType.DESERIALIZE
|
|
87
|
-
if ____cond3 then
|
|
88
|
-
do
|
|
89
|
-
if not isTable(nil, rng) then
|
|
90
|
-
error(("Failed to deserialize a " .. OBJECT_NAME) .. " object since the provided object was not a Lua table.")
|
|
91
|
-
end
|
|
92
|
-
local seedNumber = table.unpack(getNumbersFromTable(
|
|
93
|
-
nil,
|
|
94
|
-
rng,
|
|
95
|
-
OBJECT_NAME,
|
|
96
|
-
table.unpack(KEYS)
|
|
97
|
-
))
|
|
98
|
-
local seed = seedNumber
|
|
99
|
-
return ____exports.newRNG(nil, seed)
|
|
100
|
-
end
|
|
101
|
-
end
|
|
102
|
-
until true
|
|
55
|
+
local seed = rng:GetSeed()
|
|
56
|
+
return ____exports.newRNG(nil, seed)
|
|
57
|
+
end
|
|
58
|
+
--- Helper function to convert a `SerializedRNG` object to a normal `RNG` object. (This is used by
|
|
59
|
+
-- the save data manager when reading data from the "save#.dat" file.)
|
|
60
|
+
function ____exports.deserializeRNG(self, rng)
|
|
61
|
+
if not isTable(nil, rng) then
|
|
62
|
+
error(("Failed to deserialize a " .. OBJECT_NAME) .. " object since the provided object was not a Lua table.")
|
|
63
|
+
end
|
|
64
|
+
local seed = table.unpack(getNumbersFromTable(
|
|
65
|
+
nil,
|
|
66
|
+
rng,
|
|
67
|
+
OBJECT_NAME,
|
|
68
|
+
table.unpack(KEYS)
|
|
69
|
+
))
|
|
70
|
+
return ____exports.newRNG(nil, seed)
|
|
103
71
|
end
|
|
104
72
|
--- Used to determine is the given table is a serialized `RNG` object created by the save data
|
|
105
73
|
-- manager and/or the `deepCopy` function.
|
|
@@ -116,6 +84,18 @@ end
|
|
|
116
84
|
function ____exports.rngEquals(self, rng1, rng2)
|
|
117
85
|
return isaacAPIClassEquals(nil, rng1, rng2, KEYS)
|
|
118
86
|
end
|
|
87
|
+
--- Helper function to convert a `RNG` object to a `SerializedRNG` object. (This is used by the save
|
|
88
|
+
-- data manager when writing data from the "save#.dat" file.)
|
|
89
|
+
function ____exports.serializeRNG(self, rng)
|
|
90
|
+
if not ____exports.isRNG(nil, rng) then
|
|
91
|
+
error(((("Failed to serialize a " .. OBJECT_NAME) .. " object since the provided object was not a userdata ") .. OBJECT_NAME) .. " class.")
|
|
92
|
+
end
|
|
93
|
+
local seed = rng:GetSeed()
|
|
94
|
+
local rngTable = {}
|
|
95
|
+
rngTable.seed = seed
|
|
96
|
+
rngTable[SerializationBrand.RNG] = ""
|
|
97
|
+
return rngTable
|
|
98
|
+
end
|
|
119
99
|
--- Helper function to iterate over the provided object and set the seed for all of the values that
|
|
120
100
|
-- are RNG objects equal to a particular seed.
|
|
121
101
|
function ____exports.setAllRNGToSeed(self, object, seed)
|
|
@@ -2,16 +2,32 @@
|
|
|
2
2
|
/// <reference types="isaac-typescript-definitions" />
|
|
3
3
|
/// <reference types="isaac-typescript-definitions" />
|
|
4
4
|
import { RockAltType } from "../enums/RockAltType";
|
|
5
|
+
/**
|
|
6
|
+
* Helper function to get the alternate rock type (i.e. urn, mushroom, etc.) that the current room
|
|
7
|
+
* will have.
|
|
8
|
+
*
|
|
9
|
+
* The rock type is based on the backdrop of the room.
|
|
10
|
+
*
|
|
11
|
+
* For example, if you change the backdrop of the starting room of the run to `BackdropType.CAVES`,
|
|
12
|
+
* and then spawn `GridEntityType.ROCK_ALT`, it will be a mushroom instead of an urn. Additionally,
|
|
13
|
+
* if it is destroyed, it will generate mushroom-appropriate rewards.
|
|
14
|
+
*
|
|
15
|
+
* On the other hand, if an urn is spawned first before the backdrop is changed to
|
|
16
|
+
* `BackdropType.CAVES`, the graphic of the urn will not switch to a mushroom. However, when
|
|
17
|
+
* destroyed, the urn will still generate mushroom-appropriate rewards.
|
|
18
|
+
*/
|
|
19
|
+
export declare function getRockAltType(): RockAltType;
|
|
5
20
|
/**
|
|
6
21
|
* Helper function for emulating what happens when a vanilla `GridEntityType.ROCK_ALT` grid entity
|
|
7
22
|
* breaks.
|
|
8
23
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
24
|
+
* Most of the time, this function will do nothing, similar to how most of the time, when an
|
|
25
|
+
* individual urn is destroyed, nothing will spawn.
|
|
11
26
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
27
|
+
* Note that in vanilla, trinkets will not spawn if they have already been removed from the trinket
|
|
28
|
+
* pool. This function cannot replicate that behavior because there is no way to check to see if a
|
|
29
|
+
* trinket is still in the pool. Thus, it will always have a chance to spawn the respective trinket
|
|
30
|
+
* (e.g. Swallowed Penny from urns).
|
|
15
31
|
*
|
|
16
32
|
* The logic in this function is based on the rewards listed on the wiki:
|
|
17
33
|
* https://bindingofisaacrebirth.fandom.com/wiki/Rocks
|
|
@@ -19,10 +35,14 @@ import { RockAltType } from "../enums/RockAltType";
|
|
|
19
35
|
* @param position The place to spawn the reward.
|
|
20
36
|
* @param rockAltType The type of reward to spawn. For example, `RockAltType.URN` will have a chance
|
|
21
37
|
* at spawning coins and spiders.
|
|
38
|
+
* @param variant Optional. The variant of the grid entity to emulate. Default is 0, which
|
|
39
|
+
* corresponds to a "normal" grid entity or an empty bucket. This only matters when
|
|
40
|
+
* spawning the reward for buckets. (Empty buckets have different rewards than full
|
|
41
|
+
* buckets.)
|
|
22
42
|
* @param seedOrRNG Optional. The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
|
|
23
43
|
* `RNG.Next` method will be called. Default is `getRandomSeed()`. Normally, you
|
|
24
44
|
* should pass the `InitSeed` of the grid entity that was broken.
|
|
25
45
|
* @returns Whether or not this function spawned something.
|
|
26
46
|
*/
|
|
27
|
-
export declare function spawnRockAltReward(position: Vector, rockAltType: RockAltType, seedOrRNG?: Seed | RNG): boolean;
|
|
47
|
+
export declare function spawnRockAltReward(position: Vector, rockAltType: RockAltType, variant?: number, seedOrRNG?: Seed | RNG): boolean;
|
|
28
48
|
//# sourceMappingURL=rockAlt.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rockAlt.d.ts","sourceRoot":"","sources":["../../src/functions/rockAlt.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"rockAlt.d.ts","sourceRoot":"","sources":["../../src/functions/rockAlt.ts"],"names":[],"mappings":";;;AAcA,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AA+BnD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,cAAc,IAAI,WAAW,CAK5C;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,WAAW,EACxB,OAAO,SAAI,EACX,SAAS,GAAE,IAAI,GAAG,GAAqB,GACtC,OAAO,CAwBT"}
|