isaacscript-common 1.2.121 → 1.2.124
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/itemPickup.lua +3 -4
- package/dist/callbacks/postCursedTeleport.lua +12 -10
- package/dist/constants.d.ts +28 -1
- package/dist/constants.lua +4 -1
- package/dist/features/deployJSONRoom.d.ts +2 -2
- package/dist/functions/array.d.ts +5 -5
- package/dist/functions/cards.d.ts +3 -3
- package/dist/functions/jsonRoom.d.ts +1 -1
- package/dist/functions/map.d.ts +18 -0
- package/dist/functions/map.lua +14 -0
- package/dist/functions/player.d.ts +5 -0
- package/dist/functions/player.lua +13 -9
- package/dist/functions/random.d.ts +5 -5
- package/dist/functions/set.d.ts +2 -1
- package/dist/functions/spawnCollectible.d.ts +2 -2
- package/dist/functions/trinketGive.lua +3 -3
- package/dist/functions/trinkets.lua +2 -2
- package/package.json +2 -2
|
@@ -5,8 +5,8 @@ local ____exports = {}
|
|
|
5
5
|
local hasSubscriptions, postPEffectUpdateReordered, queueEmpty, queueNotEmpty, v
|
|
6
6
|
local ____exports = require("features.saveDataManager.exports")
|
|
7
7
|
local saveDataManager = ____exports.saveDataManager
|
|
8
|
-
local
|
|
9
|
-
local
|
|
8
|
+
local ____map = require("functions.map")
|
|
9
|
+
local getDefaultMapPlayer = ____map.getDefaultMapPlayer
|
|
10
10
|
local ____DefaultMap = require("types.DefaultMap")
|
|
11
11
|
local DefaultMap = ____DefaultMap.DefaultMap
|
|
12
12
|
local ____ModCallbacksCustom = require("types.ModCallbacksCustom")
|
|
@@ -27,8 +27,7 @@ function postPEffectUpdateReordered(self, player)
|
|
|
27
27
|
if not hasSubscriptions(nil) then
|
|
28
28
|
return
|
|
29
29
|
end
|
|
30
|
-
local
|
|
31
|
-
local pickingUpItem = v.run.playerPickingUpItemMap:getAndSetDefault(playerIndex)
|
|
30
|
+
local pickingUpItem = getDefaultMapPlayer(nil, v.run.playerPickingUpItemMap, player)
|
|
32
31
|
if player:IsItemQueueEmpty() then
|
|
33
32
|
queueEmpty(nil, player, pickingUpItem)
|
|
34
33
|
else
|
|
@@ -8,8 +8,10 @@ local ____exports = require("features.saveDataManager.exports")
|
|
|
8
8
|
local saveDataManager = ____exports.saveDataManager
|
|
9
9
|
local ____flag = require("functions.flag")
|
|
10
10
|
local hasFlag = ____flag.hasFlag
|
|
11
|
+
local ____map = require("functions.map")
|
|
12
|
+
local getMapPlayer = ____map.getMapPlayer
|
|
13
|
+
local setMapPlayer = ____map.setMapPlayer
|
|
11
14
|
local ____player = require("functions.player")
|
|
12
|
-
local getPlayerIndex = ____player.getPlayerIndex
|
|
13
15
|
local getPlayerNumHitsRemaining = ____player.getPlayerNumHitsRemaining
|
|
14
16
|
local ____postCursedTeleport = require("callbacks.subscriptions.postCursedTeleport")
|
|
15
17
|
local postCursedTeleportFire = ____postCursedTeleport.postCursedTeleportFire
|
|
@@ -31,8 +33,7 @@ function setDamageFrame(self, tookDamage, damageFlags)
|
|
|
31
33
|
if player == nil then
|
|
32
34
|
return
|
|
33
35
|
end
|
|
34
|
-
local
|
|
35
|
-
local trackingArray = v.run.damageFrameMap:get(playerIndex)
|
|
36
|
+
local trackingArray = getMapPlayer(nil, v.run.playersDamageFrameMap, player)
|
|
36
37
|
if trackingArray ~= nil then
|
|
37
38
|
local lastDamageFrame, callbackFiredOnThisFrame = table.unpack(trackingArray)
|
|
38
39
|
if lastDamageFrame == gameFrameCount and callbackFiredOnThisFrame then
|
|
@@ -42,7 +43,8 @@ function setDamageFrame(self, tookDamage, damageFlags)
|
|
|
42
43
|
if isPotentialNaturalTeleportFromSacrificeRoom(nil, damageFlags) then
|
|
43
44
|
return
|
|
44
45
|
end
|
|
45
|
-
|
|
46
|
+
local newTrackingArray = {gameFrameCount, false}
|
|
47
|
+
setMapPlayer(nil, v.run.playersDamageFrameMap, player, newTrackingArray)
|
|
46
48
|
end
|
|
47
49
|
function isPotentialNaturalTeleportFromSacrificeRoom(self, damageFlags)
|
|
48
50
|
local game = Game()
|
|
@@ -65,10 +67,7 @@ function postPlayerRenderPlayer(self, player)
|
|
|
65
67
|
if not hasSubscriptions(nil) then
|
|
66
68
|
return
|
|
67
69
|
end
|
|
68
|
-
local
|
|
69
|
-
local gameFrameCount = game:GetFrameCount()
|
|
70
|
-
local playerIndex = getPlayerIndex(nil, player)
|
|
71
|
-
local trackingArray = v.run.damageFrameMap:get(playerIndex)
|
|
70
|
+
local trackingArray = getMapPlayer(nil, v.run.playersDamageFrameMap, player)
|
|
72
71
|
if trackingArray == nil then
|
|
73
72
|
return
|
|
74
73
|
end
|
|
@@ -79,7 +78,10 @@ function postPlayerRenderPlayer(self, player)
|
|
|
79
78
|
if callbackActivatedOnThisFrame then
|
|
80
79
|
return
|
|
81
80
|
end
|
|
82
|
-
|
|
81
|
+
local game = Game()
|
|
82
|
+
local gameFrameCount = game:GetFrameCount()
|
|
83
|
+
local newTrackingArray = {gameFrameCount, true}
|
|
84
|
+
setMapPlayer(nil, v.run.playersDamageFrameMap, player, newTrackingArray)
|
|
83
85
|
postCursedTeleportFire(nil, player)
|
|
84
86
|
end
|
|
85
87
|
function playerIsTeleportingFromCursedTeleport(self, player, lastDamageFrame)
|
|
@@ -102,7 +104,7 @@ function playerIsTeleportingFromCursedTeleport(self, player, lastDamageFrame)
|
|
|
102
104
|
return false
|
|
103
105
|
end
|
|
104
106
|
v = {
|
|
105
|
-
run = {
|
|
107
|
+
run = {playersDamageFrameMap = __TS__New(Map)},
|
|
106
108
|
level = {numSacrifices = 0}
|
|
107
109
|
}
|
|
108
110
|
function ____exports.postCursedTeleportCallbackInit(self, mod)
|
package/dist/constants.d.ts
CHANGED
|
@@ -63,7 +63,6 @@ export declare const FINAL_STAGE: number;
|
|
|
63
63
|
* second TMTRAINER item subtracts one from that, and so on.
|
|
64
64
|
*/
|
|
65
65
|
export declare const FIRST_GLITCHED_COLLECTIBLE_TYPE: number;
|
|
66
|
-
export declare const GOLDEN_TRINKET_SHIFT: number;
|
|
67
66
|
export declare const GRID_INDEX_CENTER_OF_1X1_ROOM = 67;
|
|
68
67
|
export declare const GAME_FRAMES_PER_SECOND = 30;
|
|
69
68
|
export declare const ISAAC_FRAMES_PER_SECOND = 60;
|
|
@@ -105,8 +104,36 @@ export declare const NUM_DIMENSIONS = 3;
|
|
|
105
104
|
export declare const SECOND_IN_MILLISECONDS = 1000;
|
|
106
105
|
export declare const MINUTE_IN_MILLISECONDS: number;
|
|
107
106
|
export declare const ONE_BY_ONE_ROOM_GRID_SIZE = 135;
|
|
107
|
+
/**
|
|
108
|
+
* In vanilla, this is part of the `PillColor` enum, but we implement it as a constant in
|
|
109
|
+
* IsaacScript since it is not a real pill color.
|
|
110
|
+
*
|
|
111
|
+
* 1 << 11
|
|
112
|
+
*/
|
|
113
|
+
export declare const PILL_GIANT_FLAG = 2048;
|
|
114
|
+
/**
|
|
115
|
+
* In vanilla, this is part of the `PillColor` enum, but we implement it as a constant in
|
|
116
|
+
* IsaacScript since it is not a real pill color.
|
|
117
|
+
*
|
|
118
|
+
* (1 << 11) - 1
|
|
119
|
+
*/
|
|
120
|
+
export declare const PILL_COLOR_MASK = 2047;
|
|
108
121
|
export declare const SINGLE_USE_ACTIVE_COLLECTIBLE_TYPES: ReadonlySet<CollectibleType>;
|
|
109
122
|
export declare const STORY_BOSSES: ReadonlySet<EntityType>;
|
|
123
|
+
/**
|
|
124
|
+
* In vanilla, this is part of the `TrinketType` enum, but we implement it as a constant in
|
|
125
|
+
* IsaacScript since it is not a real trinket type.
|
|
126
|
+
*
|
|
127
|
+
* 1 << 15
|
|
128
|
+
*/
|
|
129
|
+
export declare const TRINKET_GOLDEN_FLAG = 32768;
|
|
130
|
+
/**
|
|
131
|
+
* In vanilla, this is part of the `TrinketType` enum, but we implement it as a constant in
|
|
132
|
+
* IsaacScript since it is not a real trinket type.
|
|
133
|
+
*
|
|
134
|
+
* (1 << 15) - 1
|
|
135
|
+
*/
|
|
136
|
+
export declare const TRINKET_ID_MASK = 32767;
|
|
110
137
|
/**
|
|
111
138
|
* This is the number of draw coordinates that each heart spans on the UI in the upper left hand
|
|
112
139
|
* corner.
|
package/dist/constants.lua
CHANGED
|
@@ -79,7 +79,6 @@ ____exports.FAMILIARS_THAT_SHOOT_PLAYER_TEARS = __TS__New(Set, {
|
|
|
79
79
|
})
|
|
80
80
|
____exports.FINAL_STAGE = LevelStage.NUM_STAGES - 1
|
|
81
81
|
____exports.FIRST_GLITCHED_COLLECTIBLE_TYPE = (1 << 32) - 1
|
|
82
|
-
____exports.GOLDEN_TRINKET_SHIFT = 1 << 15
|
|
83
82
|
____exports.GRID_INDEX_CENTER_OF_1X1_ROOM = 67
|
|
84
83
|
____exports.GAME_FRAMES_PER_SECOND = 30
|
|
85
84
|
____exports.ISAAC_FRAMES_PER_SECOND = 60
|
|
@@ -104,6 +103,8 @@ ____exports.NUM_DIMENSIONS = 3
|
|
|
104
103
|
____exports.SECOND_IN_MILLISECONDS = 1000
|
|
105
104
|
____exports.MINUTE_IN_MILLISECONDS = 60 * ____exports.SECOND_IN_MILLISECONDS
|
|
106
105
|
____exports.ONE_BY_ONE_ROOM_GRID_SIZE = 135
|
|
106
|
+
____exports.PILL_GIANT_FLAG = 2048
|
|
107
|
+
____exports.PILL_COLOR_MASK = 2047
|
|
107
108
|
____exports.SINGLE_USE_ACTIVE_COLLECTIBLE_TYPES = __TS__New(Set, {
|
|
108
109
|
CollectibleType.COLLECTIBLE_FORGET_ME_NOW,
|
|
109
110
|
CollectibleType.COLLECTIBLE_EDENS_SOUL,
|
|
@@ -129,5 +130,7 @@ ____exports.STORY_BOSSES = __TS__New(Set, {
|
|
|
129
130
|
EntityType.ENTITY_DOGMA,
|
|
130
131
|
EntityType.ENTITY_BEAST
|
|
131
132
|
})
|
|
133
|
+
____exports.TRINKET_GOLDEN_FLAG = 32768
|
|
134
|
+
____exports.TRINKET_ID_MASK = 32767
|
|
132
135
|
____exports.UI_HEART_WIDTH = 12
|
|
133
136
|
return ____exports
|
|
@@ -22,7 +22,7 @@ import { JSONRoom } from "../types/JSONRoom";
|
|
|
22
22
|
* function returns the final iterated seed after spawning everything, which can be used in
|
|
23
23
|
* subsequent room deployments.
|
|
24
24
|
*/
|
|
25
|
-
export declare function deployJSONRoom(jsonRoom: JSONRoom, seed?:
|
|
25
|
+
export declare function deployJSONRoom(jsonRoom: JSONRoom, seed?: Seed, verbose?: boolean): Seed;
|
|
26
26
|
/**
|
|
27
27
|
* Helper function to deconstruct a vanilla room and set up a custom room in its place.
|
|
28
28
|
* Specifically, this will clear the current room of all entities and grid entities, and then spawn
|
|
@@ -50,7 +50,7 @@ export declare function deployJSONRoom(jsonRoom: JSONRoom, seed?: number, verbos
|
|
|
50
50
|
* function returns the final iterated seed after spawning everything, which can be used in
|
|
51
51
|
* subsequent room deployments.
|
|
52
52
|
*/
|
|
53
|
-
export declare function deployRandomJSONRoom(jsonRooms: JSONRoom[], seed?:
|
|
53
|
+
export declare function deployRandomJSONRoom(jsonRooms: JSONRoom[], seed?: Seed, verbose?: boolean): Seed;
|
|
54
54
|
/**
|
|
55
55
|
* Helper function to remove all naturally spawning entities and grid entities from a room. Notably,
|
|
56
56
|
* this will not remove players (1), tears (2), familiars (3), lasers (7), knives (8),
|
|
@@ -38,13 +38,13 @@ export declare function isArrayInArray<T>(arrayToMatch: T[] | readonly T[], pare
|
|
|
38
38
|
*
|
|
39
39
|
* From: https://stackoverflow.com/questions/2450954/how-to-randomize-shuffle-a-javascript-array
|
|
40
40
|
*/
|
|
41
|
-
export declare function shuffleArray<T>(originalArray: T[] | readonly T[], seed?:
|
|
41
|
+
export declare function shuffleArray<T>(originalArray: T[] | readonly T[], seed?: Seed): T[];
|
|
42
42
|
/**
|
|
43
43
|
* Shuffles the provided array in-place using the Fisher-Yates algorithm.
|
|
44
44
|
*
|
|
45
45
|
* From: https://stackoverflow.com/questions/2450954/how-to-randomize-shuffle-a-javascript-array
|
|
46
46
|
*/
|
|
47
|
-
export declare function shuffleArrayInPlace<T>(array: T[], seed?:
|
|
47
|
+
export declare function shuffleArrayInPlace<T>(array: T[], seed?: Seed): void;
|
|
48
48
|
export declare function sumArray(array: number[] | readonly number[]): number;
|
|
49
49
|
export declare function arrayToString<T>(array: T[]): string;
|
|
50
50
|
/**
|
|
@@ -69,7 +69,7 @@ export declare function arrayRemoveInPlace<T>(array: T[], ...elementsToRemove: T
|
|
|
69
69
|
* @param seed Optional. The seed used to select the random element. Default is `Random()`.
|
|
70
70
|
* @param exceptions Optional. An array of elements to skip over if selected.
|
|
71
71
|
*/
|
|
72
|
-
export declare function getRandomArrayElement<T>(array: T[] | readonly T[], seed?:
|
|
72
|
+
export declare function getRandomArrayElement<T>(array: T[] | readonly T[], seed?: Seed, exceptions?: T[] | readonly T[]): T;
|
|
73
73
|
/**
|
|
74
74
|
* Helper function to get a random element from the provided array. Once the random element is
|
|
75
75
|
* decided, it is then removed from the array (in-place).
|
|
@@ -78,8 +78,8 @@ export declare function getRandomArrayElement<T>(array: T[] | readonly T[], seed
|
|
|
78
78
|
* @param seed Optional. The seed used to select the random element. Default is `Random()`.
|
|
79
79
|
* @param exceptions Optional. An array of elements to skip over if selected.
|
|
80
80
|
*/
|
|
81
|
-
export declare function getRandomArrayElementAndRemove<T>(array: T[], seed?:
|
|
82
|
-
export declare function getRandomArrayIndex<T>(array: T[] | readonly T[], seed?:
|
|
81
|
+
export declare function getRandomArrayElementAndRemove<T>(array: T[], seed?: Seed, exceptions?: T[] | readonly T[]): T;
|
|
82
|
+
export declare function getRandomArrayIndex<T>(array: T[] | readonly T[], seed?: Seed): int;
|
|
83
83
|
/**
|
|
84
84
|
* Since Lua uses tables for every non-primitive data structure, it is non-trivial to determine if a
|
|
85
85
|
* particular table is being used as an array. isArray returns true if:
|
|
@@ -40,13 +40,13 @@ export declare function getMaxCards(): int;
|
|
|
40
40
|
* @param seed Optional. The seed with which to select the random card. Default is `Random()`.
|
|
41
41
|
* @param exceptions Optional. An array of cards to not select.
|
|
42
42
|
*/
|
|
43
|
-
export declare function getRandomCard(seed?:
|
|
43
|
+
export declare function getRandomCard(seed?: Seed, exceptions?: Card[]): Card;
|
|
44
44
|
/**
|
|
45
45
|
* @param cardType The card type that represents the pool of cards to select from.
|
|
46
46
|
* @param seed Optional. The seed with which to select the random card. Default is `Random()`.
|
|
47
47
|
* @param exceptions Optional. An array of cards to not select.
|
|
48
48
|
*/
|
|
49
|
-
export declare function getRandomCardOfType(cardType: CardType, seed?:
|
|
49
|
+
export declare function getRandomCardOfType(cardType: CardType, seed?: Seed, exceptions?: Card[]): Card;
|
|
50
50
|
/**
|
|
51
51
|
* Has an equal chance of returning any rune (e.g. Rune of Hagalaz, Blank Rune, Black Rune, Soul of
|
|
52
52
|
* Isaac, etc.). This will never return a Rune Shard.
|
|
@@ -54,7 +54,7 @@ export declare function getRandomCardOfType(cardType: CardType, seed?: number, e
|
|
|
54
54
|
* @param seed Optional. The seed with which to select the random rune. Default is `Random()`.
|
|
55
55
|
* @param exceptions Optional. An array of runes to not select.
|
|
56
56
|
*/
|
|
57
|
-
export declare function getRandomRune(seed?:
|
|
57
|
+
export declare function getRandomRune(seed?: Seed, exceptions?: Card[]): Card;
|
|
58
58
|
/**
|
|
59
59
|
* Returns true for cards that have the following card type:
|
|
60
60
|
* - CardType.TAROT
|
|
@@ -9,4 +9,4 @@ export declare function getJSONRoomsOfSubType(jsonRooms: JSONRoom[], subType: in
|
|
|
9
9
|
* properly account for each room weight using the algorithm from:
|
|
10
10
|
* https://stackoverflow.com/questions/1761626/weighted-random-numbers
|
|
11
11
|
*/
|
|
12
|
-
export declare function getRandomJSONRoom(jsonRooms: JSONRoom[], seed?:
|
|
12
|
+
export declare function getRandomJSONRoom(jsonRooms: JSONRoom[], seed?: Seed, verbose?: boolean): JSONRoom;
|
package/dist/functions/map.d.ts
CHANGED
|
@@ -1,2 +1,20 @@
|
|
|
1
|
+
/// <reference types="isaac-typescript-definitions" />
|
|
2
|
+
import { DefaultMap } from "../types/DefaultMap";
|
|
3
|
+
import { PlayerIndex } from "../types/PlayerIndex";
|
|
1
4
|
/** Helper function to copy a map. (You can also use a Map constructor to accomplish this task.) */
|
|
2
5
|
export declare function copyMap<K, V>(oldMap: Map<K, V>): Map<K, V>;
|
|
6
|
+
/**
|
|
7
|
+
* Helper function to make using default maps with an index of `PlayerIndex` easier. Use this
|
|
8
|
+
* instead of the `DefaultMap.getAndSetDefault` method if you have a default map of this type.
|
|
9
|
+
*/
|
|
10
|
+
export declare function getDefaultMapPlayer<V>(map: DefaultMap<PlayerIndex, V>, player: EntityPlayer): V;
|
|
11
|
+
/**
|
|
12
|
+
* Helper function to make using maps with an index of `PlayerIndex` easier. Use this instead of the
|
|
13
|
+
* `Map.get` method if you have a map of this type.
|
|
14
|
+
*/
|
|
15
|
+
export declare function getMapPlayer<V>(map: Map<PlayerIndex, V>, player: EntityPlayer): V | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* Helper function to make using maps with an index of `PlayerIndex` easier. Use this instead of the
|
|
18
|
+
* `Map.set` method if you have a map of this type.
|
|
19
|
+
*/
|
|
20
|
+
export declare function setMapPlayer<V>(map: Map<PlayerIndex, V>, player: EntityPlayer, value: V): void;
|
package/dist/functions/map.lua
CHANGED
|
@@ -4,6 +4,8 @@ local Map = ____lualib.Map
|
|
|
4
4
|
local __TS__New = ____lualib.__TS__New
|
|
5
5
|
local __TS__Iterator = ____lualib.__TS__Iterator
|
|
6
6
|
local ____exports = {}
|
|
7
|
+
local ____player = require("functions.player")
|
|
8
|
+
local getPlayerIndex = ____player.getPlayerIndex
|
|
7
9
|
function ____exports.copyMap(self, oldMap)
|
|
8
10
|
local newMap = __TS__New(Map)
|
|
9
11
|
for ____, ____value in __TS__Iterator(oldMap:entries()) do
|
|
@@ -13,4 +15,16 @@ function ____exports.copyMap(self, oldMap)
|
|
|
13
15
|
end
|
|
14
16
|
return newMap
|
|
15
17
|
end
|
|
18
|
+
function ____exports.getDefaultMapPlayer(self, map, player)
|
|
19
|
+
local playerIndex = getPlayerIndex(nil, player)
|
|
20
|
+
return map:getAndSetDefault(playerIndex)
|
|
21
|
+
end
|
|
22
|
+
function ____exports.getMapPlayer(self, map, player)
|
|
23
|
+
local playerIndex = getPlayerIndex(nil, player)
|
|
24
|
+
return map:get(playerIndex)
|
|
25
|
+
end
|
|
26
|
+
function ____exports.setMapPlayer(self, map, player, value)
|
|
27
|
+
local playerIndex = getPlayerIndex(nil, player)
|
|
28
|
+
map:set(playerIndex, value)
|
|
29
|
+
end
|
|
16
30
|
return ____exports
|
|
@@ -250,6 +250,11 @@ export declare function isBethany(player: EntityPlayer): boolean;
|
|
|
250
250
|
* (For example, the Strawman Keeper.)
|
|
251
251
|
*/
|
|
252
252
|
export declare function isChildPlayer(player: EntityPlayer): boolean;
|
|
253
|
+
/**
|
|
254
|
+
* Helper function for detecting when a player is Eden or Tainted Eden. Useful for situations where
|
|
255
|
+
* you want to know if the starting stats were randomized, for example.
|
|
256
|
+
*/
|
|
257
|
+
export declare function isEden(player: EntityPlayer): boolean;
|
|
253
258
|
export declare function isFirstPlayer(player: EntityPlayer): boolean;
|
|
254
259
|
/**
|
|
255
260
|
* Helper function for detecting when a player is Jacob or Esau. This will only match the
|
|
@@ -543,6 +543,10 @@ function ____exports.isBethany(self, player)
|
|
|
543
543
|
local character = player:GetPlayerType()
|
|
544
544
|
return character == PlayerType.PLAYER_BETHANY or character == PlayerType.PLAYER_BETHANY_B
|
|
545
545
|
end
|
|
546
|
+
function ____exports.isEden(self, player)
|
|
547
|
+
local character = player:GetPlayerType()
|
|
548
|
+
return character == PlayerType.PLAYER_EDEN or character == PlayerType.PLAYER_EDEN_B
|
|
549
|
+
end
|
|
546
550
|
function ____exports.isFirstPlayer(self, player)
|
|
547
551
|
return ____exports.getPlayerIndexVanilla(nil, player) == 0
|
|
548
552
|
end
|
|
@@ -603,9 +607,9 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
|
|
|
603
607
|
itemPool:RemoveCollectible(collectibleType)
|
|
604
608
|
end
|
|
605
609
|
repeat
|
|
606
|
-
local
|
|
607
|
-
local
|
|
608
|
-
if
|
|
610
|
+
local ____switch129 = activeSlot
|
|
611
|
+
local ____cond129 = ____switch129 == ActiveSlot.SLOT_PRIMARY
|
|
612
|
+
if ____cond129 then
|
|
609
613
|
do
|
|
610
614
|
if primaryCollectibleType ~= CollectibleType.COLLECTIBLE_NULL then
|
|
611
615
|
player:RemoveCollectible(primaryCollectibleType)
|
|
@@ -614,8 +618,8 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
|
|
|
614
618
|
break
|
|
615
619
|
end
|
|
616
620
|
end
|
|
617
|
-
|
|
618
|
-
if
|
|
621
|
+
____cond129 = ____cond129 or ____switch129 == ActiveSlot.SLOT_SECONDARY
|
|
622
|
+
if ____cond129 then
|
|
619
623
|
do
|
|
620
624
|
if primaryCollectibleType ~= CollectibleType.COLLECTIBLE_NULL then
|
|
621
625
|
player:RemoveCollectible(primaryCollectibleType)
|
|
@@ -630,16 +634,16 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
|
|
|
630
634
|
break
|
|
631
635
|
end
|
|
632
636
|
end
|
|
633
|
-
|
|
634
|
-
if
|
|
637
|
+
____cond129 = ____cond129 or ____switch129 == ActiveSlot.SLOT_POCKET
|
|
638
|
+
if ____cond129 then
|
|
635
639
|
do
|
|
636
640
|
player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
|
|
637
641
|
player:SetActiveCharge(charge, activeSlot)
|
|
638
642
|
break
|
|
639
643
|
end
|
|
640
644
|
end
|
|
641
|
-
|
|
642
|
-
if
|
|
645
|
+
____cond129 = ____cond129 or ____switch129 == ActiveSlot.SLOT_POCKET2
|
|
646
|
+
if ____cond129 then
|
|
643
647
|
do
|
|
644
648
|
player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
|
|
645
649
|
break
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* the high end. (This is because `RNG.RandomFloat()` can return a value of 0.999, but it will never
|
|
5
5
|
* return a value of exactly 1.)
|
|
6
6
|
*/
|
|
7
|
-
export declare function getRandom(seed?:
|
|
7
|
+
export declare function getRandom(seed?: Seed): float;
|
|
8
8
|
/**
|
|
9
9
|
* This returns a random float between min and max. It is inclusive on the low end, but exclusive on
|
|
10
10
|
* the high end. (This is because `RNG.RandomFloat()` can return a value of 0.999, but it will never
|
|
@@ -15,7 +15,7 @@ export declare function getRandom(seed?: number): float;
|
|
|
15
15
|
* const realNumberBetweenOneAndThree = getRandomFloat(1, 3, seed);
|
|
16
16
|
* ```
|
|
17
17
|
*/
|
|
18
|
-
export declare function getRandomFloat(min: int, max: int, seed?:
|
|
18
|
+
export declare function getRandomFloat(min: int, max: int, seed?: Seed): float;
|
|
19
19
|
/**
|
|
20
20
|
* This returns a random integer between min and max, inclusive.
|
|
21
21
|
*
|
|
@@ -24,14 +24,14 @@ export declare function getRandomFloat(min: int, max: int, seed?: number): float
|
|
|
24
24
|
* const oneTwoOrThree = getRandomInt(1, 3, seed);
|
|
25
25
|
* ```
|
|
26
26
|
*/
|
|
27
|
-
export declare function getRandomInt(min: int, max: int, seed?:
|
|
27
|
+
export declare function getRandomInt(min: int, max: int, seed?: Seed): int;
|
|
28
28
|
/**
|
|
29
29
|
* Helper function to get the next seed value.
|
|
30
30
|
*
|
|
31
31
|
* This function is useful because it is standard practice to work with seed values directly over
|
|
32
32
|
* RNG objects, since the latter are not serializable.
|
|
33
33
|
*/
|
|
34
|
-
export declare function nextSeed(seed:
|
|
34
|
+
export declare function nextSeed(seed: Seed): Seed;
|
|
35
35
|
/**
|
|
36
36
|
* Helper function to initialize an RNG object.
|
|
37
37
|
*
|
|
@@ -46,4 +46,4 @@ export declare function nextSeed(seed: int): int;
|
|
|
46
46
|
* (If you aren't initializing it with a seed, then don't use this function and instead simply call
|
|
47
47
|
* the `RNG()` constructor.)
|
|
48
48
|
*/
|
|
49
|
-
export declare function initRNG(seed?:
|
|
49
|
+
export declare function initRNG(seed?: Seed): RNG;
|
package/dist/functions/set.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="isaac-typescript-definitions" />
|
|
1
2
|
/**
|
|
2
3
|
* Helper function to add all of the values in one set to another set. The first set passed will be
|
|
3
4
|
* modified in place.
|
|
@@ -27,7 +28,7 @@ export declare function deleteSetsFromSet<T>(mainSet: Set<T>, ...setsToRemove: A
|
|
|
27
28
|
* @param seed Optional. The seed used to select the random element. Default is `Random()`.
|
|
28
29
|
* @param exceptions Optional. An array of elements to skip over if selected.
|
|
29
30
|
*/
|
|
30
|
-
export declare function getRandomSetElement<T>(set: Set<T> | ReadonlySet<T>, seed?:
|
|
31
|
+
export declare function getRandomSetElement<T>(set: Set<T> | ReadonlySet<T>, seed?: Seed, exceptions?: T[] | readonly T[]): T;
|
|
31
32
|
/**
|
|
32
33
|
* Helper function to get a sorted array based on the contents of a set.
|
|
33
34
|
*
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* @param forceFreeItem Optional. Set to true to disable the logic that gives the item a price for
|
|
13
13
|
* Tainted Keeper. Default is false.
|
|
14
14
|
*/
|
|
15
|
-
export declare function spawnCollectible(collectibleType: CollectibleType | int, position: Vector, seed?:
|
|
15
|
+
export declare function spawnCollectible(collectibleType: CollectibleType | int, position: Vector, seed?: Seed, options?: boolean, forceFreeItem?: boolean): EntityPickup;
|
|
16
16
|
/**
|
|
17
17
|
* Helper function to spawn an empty collectible. Doing this is tricky since spawning a collectible
|
|
18
18
|
* with `CollectibleType.COLLECTIBLE_NULL` will result in spawning a collectible with a random type
|
|
@@ -21,4 +21,4 @@ export declare function spawnCollectible(collectibleType: CollectibleType | int,
|
|
|
21
21
|
* Instead, this function arbitrarily spawns a collectible with
|
|
22
22
|
* `CollectibleType.COLLECTIBLE_SAD_ONION`, and then converts it to an empty pedestal afterward.
|
|
23
23
|
*/
|
|
24
|
-
export declare function spawnEmptyCollectible(position: Vector, seed?:
|
|
24
|
+
export declare function spawnEmptyCollectible(position: Vector, seed?: Seed): EntityPickup;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
2
|
local ____exports = {}
|
|
3
3
|
local ____constants = require("constants")
|
|
4
|
-
local
|
|
4
|
+
local TRINKET_GOLDEN_FLAG = ____constants.TRINKET_GOLDEN_FLAG
|
|
5
5
|
local ____player = require("functions.player")
|
|
6
6
|
local useActiveItemTemp = ____player.useActiveItemTemp
|
|
7
7
|
local ____utils = require("functions.utils")
|
|
@@ -18,11 +18,11 @@ function ____exports.temporarilyRemoveTrinket(self, player, trinketType)
|
|
|
18
18
|
numTrinkets = numTrinkets + 1
|
|
19
19
|
end
|
|
20
20
|
local numSmeltedTrinkets = numTrinkets
|
|
21
|
-
local trinketWasInSlot1 = trinket1 == trinketType or trinket1 +
|
|
21
|
+
local trinketWasInSlot1 = trinket1 == trinketType or trinket1 + TRINKET_GOLDEN_FLAG == trinketType
|
|
22
22
|
if trinketWasInSlot1 then
|
|
23
23
|
numSmeltedTrinkets = numSmeltedTrinkets - 1
|
|
24
24
|
end
|
|
25
|
-
local trinketWasInSlot2 = trinket2 == trinketType or trinket2 +
|
|
25
|
+
local trinketWasInSlot2 = trinket2 == trinketType or trinket2 + TRINKET_GOLDEN_FLAG == trinketType
|
|
26
26
|
if trinketWasInSlot2 then
|
|
27
27
|
numSmeltedTrinkets = numSmeltedTrinkets - 1
|
|
28
28
|
end
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
2
|
local ____exports = {}
|
|
3
3
|
local ____constants = require("constants")
|
|
4
|
-
local
|
|
4
|
+
local TRINKET_GOLDEN_FLAG = ____constants.TRINKET_GOLDEN_FLAG
|
|
5
5
|
local ____trinketDescriptionMap = require("maps.trinketDescriptionMap")
|
|
6
6
|
local TRINKET_DESCRIPTION_MAP = ____trinketDescriptionMap.TRINKET_DESCRIPTION_MAP
|
|
7
7
|
local ____trinketNameMap = require("maps.trinketNameMap")
|
|
@@ -83,7 +83,7 @@ function ____exports.hasOpenTrinketSlot(self, player)
|
|
|
83
83
|
return openTrinketSlot ~= nil
|
|
84
84
|
end
|
|
85
85
|
function ____exports.isGoldenTrinket(self, trinketType)
|
|
86
|
-
return trinketType >
|
|
86
|
+
return trinketType > TRINKET_GOLDEN_FLAG
|
|
87
87
|
end
|
|
88
88
|
function ____exports.smeltTrinket(self, player, trinketType, numTrinkets)
|
|
89
89
|
if numTrinkets == nil then
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "isaacscript-common",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.124",
|
|
4
4
|
"description": "Helper functions for IsaacScript mods",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"isaac",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
],
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@zamiell/typescript-to-lua": "^1.4.2",
|
|
29
|
-
"isaac-typescript-definitions": "^1.0.
|
|
29
|
+
"isaac-typescript-definitions": "^1.0.361",
|
|
30
30
|
"isaacscript-lint": "^1.0.84",
|
|
31
31
|
"isaacscript-tsconfig": "^1.1.8",
|
|
32
32
|
"typedoc": "^0.22.13",
|