isaacscript-common 1.0.447 → 1.0.451
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/constants.d.ts +1 -1
- package/dist/constants.lua +1 -1
- package/dist/functions/collectibleSet.lua +22 -3
- package/dist/functions/collectibles.d.ts +0 -2
- package/dist/functions/collectibles.lua +4 -26
- package/dist/functions/player.lua +2 -2
- package/dist/functions/position.d.ts +9 -0
- package/dist/functions/position.lua +35 -0
- package/dist/functions/revive.lua +3 -3
- package/dist/functions/trinketGive.d.ts +24 -0
- package/dist/functions/trinketGive.lua +54 -0
- package/dist/functions/trinketSet.d.ts +3 -0
- package/dist/functions/trinketSet.lua +28 -0
- package/dist/functions/trinkets.d.ts +1 -25
- package/dist/functions/trinkets.lua +2 -70
- package/dist/functions/util.d.ts +6 -0
- package/dist/functions/util.lua +3 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.lua +32 -0
- package/package.json +3 -3
package/dist/constants.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
export declare const AZAZEL_DEFAULT_BRIMSTONE_DISTANCE = 75.125;
|
|
7
7
|
/** Bombs explode when their frame count is equal to this value. */
|
|
8
|
-
export declare const BOMB_EXPLODE_FRAME =
|
|
8
|
+
export declare const BOMB_EXPLODE_FRAME = 45;
|
|
9
9
|
export declare const CHARACTERS_WITH_NO_RED_HEARTS: Set<PlayerType>;
|
|
10
10
|
/** This is also the distance that a player spawns from the door that they enter a room from. */
|
|
11
11
|
export declare const DISTANCE_OF_GRID_TILE = 40;
|
package/dist/constants.lua
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
require("lualib_bundle");
|
|
3
3
|
local ____exports = {}
|
|
4
4
|
____exports.AZAZEL_DEFAULT_BRIMSTONE_DISTANCE = 75.125
|
|
5
|
-
____exports.BOMB_EXPLODE_FRAME =
|
|
5
|
+
____exports.BOMB_EXPLODE_FRAME = 45
|
|
6
6
|
____exports.CHARACTERS_WITH_NO_RED_HEARTS = __TS__New(Set, {PlayerType.PLAYER_BLUEBABY, PlayerType.PLAYER_BLACKJUDAS, PlayerType.PLAYER_JUDAS_B, PlayerType.PLAYER_BLUEBABY_B, PlayerType.PLAYER_THEFORGOTTEN_B, PlayerType.PLAYER_BETHANY_B})
|
|
7
7
|
____exports.DISTANCE_OF_GRID_TILE = 40
|
|
8
8
|
____exports.DOOR_HITBOX_DISTANCE = 11
|
|
@@ -1,9 +1,28 @@
|
|
|
1
1
|
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
2
|
require("lualib_bundle");
|
|
3
3
|
local ____exports = {}
|
|
4
|
-
local
|
|
5
|
-
local
|
|
4
|
+
local ____collectibles = require("functions.collectibles")
|
|
5
|
+
local getMaxCollectibleID = ____collectibles.getMaxCollectibleID
|
|
6
|
+
local ____util = require("functions.util")
|
|
7
|
+
local copySet = ____util.copySet
|
|
8
|
+
local COLLECTIBLE_SET = __TS__New(Set)
|
|
9
|
+
local function initSet(self)
|
|
10
|
+
local itemConfig = Isaac.GetItemConfig()
|
|
11
|
+
do
|
|
12
|
+
local collectibleType = 1
|
|
13
|
+
while collectibleType <= getMaxCollectibleID(nil) do
|
|
14
|
+
local itemConfigItem = itemConfig:GetCollectible(collectibleType)
|
|
15
|
+
if itemConfigItem ~= nil then
|
|
16
|
+
COLLECTIBLE_SET:add(collectibleType)
|
|
17
|
+
end
|
|
18
|
+
collectibleType = collectibleType + 1
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
6
22
|
function ____exports.getCollectibleSet(self)
|
|
7
|
-
|
|
23
|
+
if COLLECTIBLE_SET.size == 0 then
|
|
24
|
+
initSet(nil)
|
|
25
|
+
end
|
|
26
|
+
return copySet(nil, COLLECTIBLE_SET)
|
|
8
27
|
end
|
|
9
28
|
return ____exports
|
|
@@ -23,8 +23,6 @@ export declare function getCollectibleMaxCharges(collectibleType: CollectibleTyp
|
|
|
23
23
|
* ```
|
|
24
24
|
*/
|
|
25
25
|
export declare function getCollectibleName(collectibleType: CollectibleType | int): string;
|
|
26
|
-
/** Returns a set containing every valid collectible type in the game, including modded items. */
|
|
27
|
-
export declare function getCollectibleSet(): Set<CollectibleType | int>;
|
|
28
26
|
/** Helper function to get all of the collectible entities in the room. */
|
|
29
27
|
export declare function getCollectibles(matchingSubType?: number): EntityPickup[];
|
|
30
28
|
export declare function getMaxCollectibleID(): int;
|
|
@@ -6,12 +6,6 @@ local ____collectibleNameMap = require("collectibleNameMap")
|
|
|
6
6
|
local COLLECTIBLE_NAME_MAP = ____collectibleNameMap.COLLECTIBLE_NAME_MAP
|
|
7
7
|
local ____entity = require("functions.entity")
|
|
8
8
|
local removeAllMatchingEntities = ____entity.removeAllMatchingEntities
|
|
9
|
-
local ____util = require("functions.util")
|
|
10
|
-
local copySet = ____util.copySet
|
|
11
|
-
function ____exports.getMaxCollectibleID(self)
|
|
12
|
-
local itemConfig = Isaac.GetItemConfig()
|
|
13
|
-
return itemConfig:GetCollectibles().Size - 1
|
|
14
|
-
end
|
|
15
9
|
function ____exports.setCollectibleSprite(self, pickup, pngPath)
|
|
16
10
|
if pickup.Variant ~= PickupVariant.PICKUP_COLLECTIBLE then
|
|
17
11
|
error(
|
|
@@ -25,20 +19,6 @@ end
|
|
|
25
19
|
COLLECTIBLE_SPRITE_LAYER = 1
|
|
26
20
|
local BLIND_ITEM_PNG_PATH = "gfx/items/collectibles/questionmark.png"
|
|
27
21
|
local GLITCHED_ITEM_THRESHOLD = 4000000000
|
|
28
|
-
local COLLECTIBLE_SET = __TS__New(Set)
|
|
29
|
-
local function initSet(self)
|
|
30
|
-
local itemConfig = Isaac.GetItemConfig()
|
|
31
|
-
do
|
|
32
|
-
local collectibleType = 1
|
|
33
|
-
while collectibleType <= ____exports.getMaxCollectibleID(nil) do
|
|
34
|
-
local itemConfigItem = itemConfig:GetCollectible(collectibleType)
|
|
35
|
-
if itemConfigItem ~= nil then
|
|
36
|
-
COLLECTIBLE_SET:add(collectibleType)
|
|
37
|
-
end
|
|
38
|
-
collectibleType = collectibleType + 1
|
|
39
|
-
end
|
|
40
|
-
end
|
|
41
|
-
end
|
|
42
22
|
function ____exports.changeCollectibleSubType(self, collectible, newCollectibleType)
|
|
43
23
|
collectible.SubType = newCollectibleType
|
|
44
24
|
local itemConfig = Isaac.GetItemConfig()
|
|
@@ -115,12 +95,6 @@ function ____exports.getCollectibleName(self, collectibleType)
|
|
|
115
95
|
end
|
|
116
96
|
return itemConfigItem.Name
|
|
117
97
|
end
|
|
118
|
-
function ____exports.getCollectibleSet(self)
|
|
119
|
-
if COLLECTIBLE_SET.size == 0 then
|
|
120
|
-
initSet(nil)
|
|
121
|
-
end
|
|
122
|
-
return copySet(nil, COLLECTIBLE_SET)
|
|
123
|
-
end
|
|
124
98
|
function ____exports.getCollectibles(self, matchingSubType)
|
|
125
99
|
if matchingSubType == nil then
|
|
126
100
|
matchingSubType = -1
|
|
@@ -135,6 +109,10 @@ function ____exports.getCollectibles(self, matchingSubType)
|
|
|
135
109
|
end
|
|
136
110
|
return collectibles
|
|
137
111
|
end
|
|
112
|
+
function ____exports.getMaxCollectibleID(self)
|
|
113
|
+
local itemConfig = Isaac.GetItemConfig()
|
|
114
|
+
return itemConfig:GetCollectibles().Size - 1
|
|
115
|
+
end
|
|
138
116
|
function ____exports.isGlitchedCollectible(self, entity)
|
|
139
117
|
return ((entity.Type == EntityType.ENTITY_PICKUP) and (entity.Variant == PickupVariant.PICKUP_COLLECTIBLE)) and (entity.SubType > GLITCHED_ITEM_THRESHOLD)
|
|
140
118
|
end
|
|
@@ -9,8 +9,8 @@ local PocketItemType = ____PocketItemType.PocketItemType
|
|
|
9
9
|
local ____bitwise = require("functions.bitwise")
|
|
10
10
|
local getKBitOfN = ____bitwise.getKBitOfN
|
|
11
11
|
local getNumBitsOfN = ____bitwise.getNumBitsOfN
|
|
12
|
-
local
|
|
13
|
-
local getCollectibleSet =
|
|
12
|
+
local ____collectibleSet = require("functions.collectibleSet")
|
|
13
|
+
local getCollectibleSet = ____collectibleSet.getCollectibleSet
|
|
14
14
|
function ____exports.getPlayers(self, performExclusions)
|
|
15
15
|
if performExclusions == nil then
|
|
16
16
|
performExclusions = false
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="isaac-typescript-definitions" />
|
|
2
|
+
/**
|
|
3
|
+
* Helper function to get a room position that is not overlapping with a grid entity, a heaven door,
|
|
4
|
+
* or a player. The `Room.FindFreePickupSpawnPosition()` function will return locations that overlap
|
|
5
|
+
* with heaven doors and partially overlap with players, if the thing being spawned is bigger than a
|
|
6
|
+
* tile (like a Blood Donation Machine). Use this function instead if you want to account for those
|
|
7
|
+
* specific situations.
|
|
8
|
+
*/
|
|
9
|
+
export declare function findFreePosition(startingPosition: Vector): Vector;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
|
+
local ____exports = {}
|
|
3
|
+
local ____constants = require("constants")
|
|
4
|
+
local DISTANCE_OF_GRID_TILE = ____constants.DISTANCE_OF_GRID_TILE
|
|
5
|
+
local ____entity = require("functions.entity")
|
|
6
|
+
local anyEntityCloserThan = ____entity.anyEntityCloserThan
|
|
7
|
+
local getEffects = ____entity.getEffects
|
|
8
|
+
local ____player = require("functions.player")
|
|
9
|
+
local getPlayerCloserThan = ____player.getPlayerCloserThan
|
|
10
|
+
function ____exports.findFreePosition(self, startingPosition)
|
|
11
|
+
local game = Game()
|
|
12
|
+
local room = game:GetRoom()
|
|
13
|
+
local heavenDoors = getEffects(nil, EffectVariant.HEAVEN_LIGHT_DOOR, 0)
|
|
14
|
+
do
|
|
15
|
+
local i = 0
|
|
16
|
+
while i < 100 do
|
|
17
|
+
do
|
|
18
|
+
local position = room:FindFreePickupSpawnPosition(startingPosition, i)
|
|
19
|
+
local closePlayer = getPlayerCloserThan(nil, position, DISTANCE_OF_GRID_TILE)
|
|
20
|
+
if closePlayer ~= nil then
|
|
21
|
+
goto __continue3
|
|
22
|
+
end
|
|
23
|
+
local isCloseHeavenDoor = anyEntityCloserThan(nil, heavenDoors, position, DISTANCE_OF_GRID_TILE)
|
|
24
|
+
if isCloseHeavenDoor then
|
|
25
|
+
goto __continue3
|
|
26
|
+
end
|
|
27
|
+
return position
|
|
28
|
+
end
|
|
29
|
+
::__continue3::
|
|
30
|
+
i = i + 1
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
return room:FindFreePickupSpawnPosition(startingPosition)
|
|
34
|
+
end
|
|
35
|
+
return ____exports
|
|
@@ -4,9 +4,9 @@ local ____player = require("functions.player")
|
|
|
4
4
|
local getDeathAnimationName = ____player.getDeathAnimationName
|
|
5
5
|
local ____sprite = require("functions.sprite")
|
|
6
6
|
local getFinalFrameOfAnimation = ____sprite.getFinalFrameOfAnimation
|
|
7
|
-
local
|
|
8
|
-
local giveTrinketsBack =
|
|
9
|
-
local temporarilyRemoveTrinkets =
|
|
7
|
+
local ____trinketGive = require("functions.trinketGive")
|
|
8
|
+
local giveTrinketsBack = ____trinketGive.giveTrinketsBack
|
|
9
|
+
local temporarilyRemoveTrinkets = ____trinketGive.temporarilyRemoveTrinkets
|
|
10
10
|
function ____exports.willMysteriousPaperRevive(self, player)
|
|
11
11
|
local game = Game()
|
|
12
12
|
local gameFrameCount = game:GetFrameCount()
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/// <reference types="isaac-typescript-definitions" />
|
|
2
|
+
export interface TrinketSituation {
|
|
3
|
+
trinketTypeRemoved: TrinketType | int;
|
|
4
|
+
trinket1: TrinketType | int;
|
|
5
|
+
trinket2: TrinketType | int;
|
|
6
|
+
numSmeltedTrinkets: int;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Helper function to temporarily remove a trinket from the player. Use this in combination with the
|
|
10
|
+
* `giveTrinketBack` function to take away and give back a trinket on the same frame. This function
|
|
11
|
+
* correctly handles multiple trinket slots and ensures that all copies of the trinket are removed,
|
|
12
|
+
* including smelted trinkets.
|
|
13
|
+
*
|
|
14
|
+
* Note that for simplicity, this function assumes that all smelted trinkets are non-golden.
|
|
15
|
+
*
|
|
16
|
+
* @returns Null if the player does not have the trinket, or TrinketSituation if they do.
|
|
17
|
+
*/
|
|
18
|
+
export declare function temporarilyRemoveTrinkets(player: EntityPlayer, trinketType: TrinketType): TrinketSituation | undefined;
|
|
19
|
+
/**
|
|
20
|
+
* Helper function to restore the player's trinkets back to the way they were before the
|
|
21
|
+
* `temporarilyRemoveTrinket` function was used. It will re-smelt any smelted trinkets that were
|
|
22
|
+
* removed.
|
|
23
|
+
*/
|
|
24
|
+
export declare function giveTrinketsBack(player: EntityPlayer, trinketSituation: TrinketSituation | undefined): void;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
|
+
local ____exports = {}
|
|
3
|
+
local ____constants = require("constants")
|
|
4
|
+
local GOLDEN_TRINKET_SHIFT = ____constants.GOLDEN_TRINKET_SHIFT
|
|
5
|
+
function ____exports.temporarilyRemoveTrinkets(self, player, trinketType)
|
|
6
|
+
if not player:HasTrinket(trinketType) then
|
|
7
|
+
return nil
|
|
8
|
+
end
|
|
9
|
+
local trinket1 = player:GetTrinket(0)
|
|
10
|
+
local trinket2 = player:GetTrinket(1)
|
|
11
|
+
local numTrinkets = 0
|
|
12
|
+
while player:HasTrinket(trinketType) do
|
|
13
|
+
player:TryRemoveTrinket(trinketType)
|
|
14
|
+
numTrinkets = numTrinkets + 1
|
|
15
|
+
end
|
|
16
|
+
local numSmeltedTrinkets = numTrinkets
|
|
17
|
+
local trinketWasInSlot1 = (trinket1 == trinketType) or ((trinket1 + GOLDEN_TRINKET_SHIFT) == trinketType)
|
|
18
|
+
if trinketWasInSlot1 then
|
|
19
|
+
numSmeltedTrinkets = numSmeltedTrinkets - 1
|
|
20
|
+
end
|
|
21
|
+
local trinketWasInSlot2 = (trinket2 == trinketType) or ((trinket2 + GOLDEN_TRINKET_SHIFT) == trinketType)
|
|
22
|
+
if trinketWasInSlot2 then
|
|
23
|
+
numSmeltedTrinkets = numSmeltedTrinkets - 1
|
|
24
|
+
end
|
|
25
|
+
return {trinketTypeRemoved = trinketType, trinket1 = trinket1, trinket2 = trinket2, numSmeltedTrinkets = numSmeltedTrinkets}
|
|
26
|
+
end
|
|
27
|
+
function ____exports.giveTrinketsBack(self, player, trinketSituation)
|
|
28
|
+
if trinketSituation == nil then
|
|
29
|
+
return
|
|
30
|
+
end
|
|
31
|
+
local trinket1 = player:GetTrinket(0)
|
|
32
|
+
local trinket2 = player:GetTrinket(1)
|
|
33
|
+
if trinket1 ~= TrinketType.TRINKET_NULL then
|
|
34
|
+
player:TryRemoveTrinket(trinket1)
|
|
35
|
+
end
|
|
36
|
+
if trinket2 ~= TrinketType.TRINKET_NULL then
|
|
37
|
+
player:TryRemoveTrinket(trinket2)
|
|
38
|
+
end
|
|
39
|
+
do
|
|
40
|
+
local i = 0
|
|
41
|
+
while i < trinketSituation.numSmeltedTrinkets do
|
|
42
|
+
player:AddTrinket(trinketSituation.trinketTypeRemoved, false)
|
|
43
|
+
player:UseActiveItem(CollectibleType.COLLECTIBLE_SMELTER, UseFlag.USE_NOANIM)
|
|
44
|
+
i = i + 1
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
if trinketSituation.trinket1 ~= TrinketType.TRINKET_NULL then
|
|
48
|
+
player:AddTrinket(trinketSituation.trinket1, false)
|
|
49
|
+
end
|
|
50
|
+
if trinketSituation.trinket2 ~= TrinketType.TRINKET_NULL then
|
|
51
|
+
player:AddTrinket(trinketSituation.trinket2, false)
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
return ____exports
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
|
+
require("lualib_bundle");
|
|
3
|
+
local ____exports = {}
|
|
4
|
+
local ____trinkets = require("functions.trinkets")
|
|
5
|
+
local getMaxTrinketID = ____trinkets.getMaxTrinketID
|
|
6
|
+
local ____util = require("functions.util")
|
|
7
|
+
local copySet = ____util.copySet
|
|
8
|
+
local TRINKET_SET = __TS__New(Set)
|
|
9
|
+
local function initSet(self)
|
|
10
|
+
local itemConfig = Isaac.GetItemConfig()
|
|
11
|
+
do
|
|
12
|
+
local trinketType = 1
|
|
13
|
+
while trinketType <= getMaxTrinketID(nil) do
|
|
14
|
+
local itemConfigTrinket = itemConfig:GetTrinket(trinketType)
|
|
15
|
+
if itemConfigTrinket ~= nil then
|
|
16
|
+
TRINKET_SET:add(trinketType)
|
|
17
|
+
end
|
|
18
|
+
trinketType = trinketType + 1
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
function ____exports.getTrinketSet(self)
|
|
23
|
+
if TRINKET_SET.size == 0 then
|
|
24
|
+
initSet(nil)
|
|
25
|
+
end
|
|
26
|
+
return copySet(nil, TRINKET_SET)
|
|
27
|
+
end
|
|
28
|
+
return ____exports
|
|
@@ -1,27 +1,4 @@
|
|
|
1
1
|
/// <reference types="isaac-typescript-definitions" />
|
|
2
|
-
export interface TrinketSituation {
|
|
3
|
-
trinketTypeRemoved: TrinketType | int;
|
|
4
|
-
trinket1: TrinketType | int;
|
|
5
|
-
trinket2: TrinketType | int;
|
|
6
|
-
numSmeltedTrinkets: int;
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* Helper function to temporarily remove a trinket from the player. Use this in combination with the
|
|
10
|
-
* `giveTrinketBack` function to take away and give back a trinket on the same frame. This function
|
|
11
|
-
* correctly handles multiple trinket slots and ensures that all copies of the trinket are removed,
|
|
12
|
-
* including smelted trinkets.
|
|
13
|
-
*
|
|
14
|
-
* Note that for simplicity, this function assumes that all smelted trinkets are non-golden.
|
|
15
|
-
*
|
|
16
|
-
* @returns Null if the player does not have the trinket, or TrinketSituation if they do.
|
|
17
|
-
*/
|
|
18
|
-
export declare function temporarilyRemoveTrinkets(player: EntityPlayer, trinketType: TrinketType): TrinketSituation | undefined;
|
|
19
|
-
/**
|
|
20
|
-
* Helper function to restore the player's trinkets back to the way they were before the
|
|
21
|
-
* `temporarilyRemoveTrinket` function was used. It will re-smelt any smelted trinkets that were
|
|
22
|
-
* removed.
|
|
23
|
-
*/
|
|
24
|
-
export declare function giveTrinketsBack(player: EntityPlayer, trinketSituation: TrinketSituation | undefined): void;
|
|
25
2
|
export declare function getMaxTrinketID(): int;
|
|
26
3
|
/** Helper function to get all of the collectible entities in the room. */
|
|
27
4
|
export declare function getTrinkets(matchingSubType?: number): EntityPickup[];
|
|
@@ -35,5 +12,4 @@ export declare function getTrinkets(matchingSubType?: number): EntityPickup[];
|
|
|
35
12
|
* ```
|
|
36
13
|
*/
|
|
37
14
|
export declare function getTrinketName(trinketType: TrinketType | int): string;
|
|
38
|
-
|
|
39
|
-
export declare function getTrinketSet(): Set<TrinketType | int>;
|
|
15
|
+
export declare function isGoldenTrinket(trinketType: TrinketType | int): boolean;
|
|
@@ -5,57 +5,6 @@ local ____constants = require("constants")
|
|
|
5
5
|
local GOLDEN_TRINKET_SHIFT = ____constants.GOLDEN_TRINKET_SHIFT
|
|
6
6
|
local ____trinketNameMap = require("trinketNameMap")
|
|
7
7
|
local TRINKET_NAME_MAP = ____trinketNameMap.TRINKET_NAME_MAP
|
|
8
|
-
local ____util = require("functions.util")
|
|
9
|
-
local copySet = ____util.copySet
|
|
10
|
-
function ____exports.temporarilyRemoveTrinkets(self, player, trinketType)
|
|
11
|
-
if not player:HasTrinket(trinketType) then
|
|
12
|
-
return nil
|
|
13
|
-
end
|
|
14
|
-
local trinket1 = player:GetTrinket(0)
|
|
15
|
-
local trinket2 = player:GetTrinket(1)
|
|
16
|
-
local numTrinkets = 0
|
|
17
|
-
while player:HasTrinket(trinketType) do
|
|
18
|
-
player:TryRemoveTrinket(trinketType)
|
|
19
|
-
numTrinkets = numTrinkets + 1
|
|
20
|
-
end
|
|
21
|
-
local numSmeltedTrinkets = numTrinkets
|
|
22
|
-
local trinketWasInSlot1 = (trinket1 == trinketType) or ((trinket1 + GOLDEN_TRINKET_SHIFT) == trinketType)
|
|
23
|
-
if trinketWasInSlot1 then
|
|
24
|
-
numSmeltedTrinkets = numSmeltedTrinkets - 1
|
|
25
|
-
end
|
|
26
|
-
local trinketWasInSlot2 = (trinket2 == trinketType) or ((trinket2 + GOLDEN_TRINKET_SHIFT) == trinketType)
|
|
27
|
-
if trinketWasInSlot2 then
|
|
28
|
-
numSmeltedTrinkets = numSmeltedTrinkets - 1
|
|
29
|
-
end
|
|
30
|
-
return {trinketTypeRemoved = trinketType, trinket1 = trinket1, trinket2 = trinket2, numSmeltedTrinkets = numSmeltedTrinkets}
|
|
31
|
-
end
|
|
32
|
-
function ____exports.giveTrinketsBack(self, player, trinketSituation)
|
|
33
|
-
if trinketSituation == nil then
|
|
34
|
-
return
|
|
35
|
-
end
|
|
36
|
-
local trinket1 = player:GetTrinket(0)
|
|
37
|
-
local trinket2 = player:GetTrinket(1)
|
|
38
|
-
if trinket1 ~= TrinketType.TRINKET_NULL then
|
|
39
|
-
player:TryRemoveTrinket(trinket1)
|
|
40
|
-
end
|
|
41
|
-
if trinket2 ~= TrinketType.TRINKET_NULL then
|
|
42
|
-
player:TryRemoveTrinket(trinket2)
|
|
43
|
-
end
|
|
44
|
-
do
|
|
45
|
-
local i = 0
|
|
46
|
-
while i < trinketSituation.numSmeltedTrinkets do
|
|
47
|
-
player:AddTrinket(trinketSituation.trinketTypeRemoved, false)
|
|
48
|
-
player:UseActiveItem(CollectibleType.COLLECTIBLE_SMELTER, UseFlag.USE_NOANIM)
|
|
49
|
-
i = i + 1
|
|
50
|
-
end
|
|
51
|
-
end
|
|
52
|
-
if trinketSituation.trinket1 ~= TrinketType.TRINKET_NULL then
|
|
53
|
-
player:AddTrinket(trinketSituation.trinket1, false)
|
|
54
|
-
end
|
|
55
|
-
if trinketSituation.trinket2 ~= TrinketType.TRINKET_NULL then
|
|
56
|
-
player:AddTrinket(trinketSituation.trinket2, false)
|
|
57
|
-
end
|
|
58
|
-
end
|
|
59
8
|
function ____exports.getMaxTrinketID(self)
|
|
60
9
|
local itemConfig = Isaac.GetItemConfig()
|
|
61
10
|
return itemConfig:GetTrinkets().Size - 1
|
|
@@ -90,24 +39,7 @@ function ____exports.getTrinketName(self, trinketType)
|
|
|
90
39
|
end
|
|
91
40
|
return itemConfigItem.Name
|
|
92
41
|
end
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
local itemConfig = Isaac.GetItemConfig()
|
|
96
|
-
do
|
|
97
|
-
local trinketType = 1
|
|
98
|
-
while trinketType <= ____exports.getMaxTrinketID(nil) do
|
|
99
|
-
local itemConfigTrinket = itemConfig:GetTrinket(trinketType)
|
|
100
|
-
if itemConfigTrinket ~= nil then
|
|
101
|
-
TRINKET_SET:add(trinketType)
|
|
102
|
-
end
|
|
103
|
-
trinketType = trinketType + 1
|
|
104
|
-
end
|
|
105
|
-
end
|
|
106
|
-
end
|
|
107
|
-
function ____exports.getTrinketSet(self)
|
|
108
|
-
if TRINKET_SET.size == 0 then
|
|
109
|
-
initSet(nil)
|
|
110
|
-
end
|
|
111
|
-
return copySet(nil, TRINKET_SET)
|
|
42
|
+
function ____exports.isGoldenTrinket(self, trinketType)
|
|
43
|
+
return trinketType > GOLDEN_TRINKET_SHIFT
|
|
112
44
|
end
|
|
113
45
|
return ____exports
|
package/dist/functions/util.d.ts
CHANGED
|
@@ -63,6 +63,12 @@ export declare function isGreedMode(): boolean;
|
|
|
63
63
|
* the game will not switch to a different seed.
|
|
64
64
|
*/
|
|
65
65
|
export declare function onSetSeed(): boolean;
|
|
66
|
+
/**
|
|
67
|
+
* Helper function to print something to the in-game console. Use this instead of invoking
|
|
68
|
+
* `Isaac.ConsoleOutput()` directly because it will automatically insert a newline at the end of the
|
|
69
|
+
* message (which `Isaac.ConsoleOutput()` does not do by default).
|
|
70
|
+
*/
|
|
71
|
+
export declare function printConsole(msg: string): void;
|
|
66
72
|
/**
|
|
67
73
|
* In a Map, you can use the `clear` method to delete every element. However, in a LuaTable, the
|
|
68
74
|
* `clear` method does not exist. Use this helper function as a drop-in replacement for this.
|
package/dist/functions/util.lua
CHANGED
|
@@ -58,6 +58,9 @@ function ____exports.onSetSeed(self)
|
|
|
58
58
|
local challenge = Isaac.GetChallenge()
|
|
59
59
|
return (challenge == Challenge.CHALLENGE_NULL) and customRun
|
|
60
60
|
end
|
|
61
|
+
function ____exports.printConsole(self, msg)
|
|
62
|
+
Isaac.ConsoleOutput(msg .. "\n")
|
|
63
|
+
end
|
|
61
64
|
function ____exports.tableClear(self, ____table)
|
|
62
65
|
for key in pairs(____table) do
|
|
63
66
|
____table[key] = nil
|
package/dist/index.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ export * from "./functions/bitwise";
|
|
|
12
12
|
export * from "./functions/card";
|
|
13
13
|
export * from "./functions/charge";
|
|
14
14
|
export * from "./functions/collectibles";
|
|
15
|
+
export * from "./functions/collectibleSet";
|
|
15
16
|
export * from "./functions/color";
|
|
16
17
|
export { deepCopy } from "./functions/deepCopy";
|
|
17
18
|
export { deepCopyTests } from "./functions/deepCopyTests";
|
|
@@ -29,6 +30,7 @@ export * from "./functions/pickups";
|
|
|
29
30
|
export * from "./functions/player";
|
|
30
31
|
export * from "./functions/playerHealth";
|
|
31
32
|
export * from "./functions/pocketItems";
|
|
33
|
+
export * from "./functions/position";
|
|
32
34
|
export * from "./functions/random";
|
|
33
35
|
export * from "./functions/revive";
|
|
34
36
|
export * from "./functions/rooms";
|
|
@@ -36,7 +38,9 @@ export * from "./functions/sprite";
|
|
|
36
38
|
export * from "./functions/stage";
|
|
37
39
|
export * from "./functions/tears";
|
|
38
40
|
export * from "./functions/transformations";
|
|
41
|
+
export * from "./functions/trinketGive";
|
|
39
42
|
export * from "./functions/trinkets";
|
|
43
|
+
export * from "./functions/trinketSet";
|
|
40
44
|
export * from "./functions/ui";
|
|
41
45
|
export * from "./functions/util";
|
|
42
46
|
export * from "./functions/vector";
|
package/dist/index.lua
CHANGED
|
@@ -113,6 +113,14 @@ do
|
|
|
113
113
|
end
|
|
114
114
|
end
|
|
115
115
|
end
|
|
116
|
+
do
|
|
117
|
+
local ____export = require("functions.collectibleSet")
|
|
118
|
+
for ____exportKey, ____exportValue in pairs(____export) do
|
|
119
|
+
if ____exportKey ~= "default" then
|
|
120
|
+
____exports[____exportKey] = ____exportValue
|
|
121
|
+
end
|
|
122
|
+
end
|
|
123
|
+
end
|
|
116
124
|
do
|
|
117
125
|
local ____export = require("functions.color")
|
|
118
126
|
for ____exportKey, ____exportValue in pairs(____export) do
|
|
@@ -243,6 +251,14 @@ do
|
|
|
243
251
|
end
|
|
244
252
|
end
|
|
245
253
|
end
|
|
254
|
+
do
|
|
255
|
+
local ____export = require("functions.position")
|
|
256
|
+
for ____exportKey, ____exportValue in pairs(____export) do
|
|
257
|
+
if ____exportKey ~= "default" then
|
|
258
|
+
____exports[____exportKey] = ____exportValue
|
|
259
|
+
end
|
|
260
|
+
end
|
|
261
|
+
end
|
|
246
262
|
do
|
|
247
263
|
local ____export = require("functions.random")
|
|
248
264
|
for ____exportKey, ____exportValue in pairs(____export) do
|
|
@@ -299,6 +315,14 @@ do
|
|
|
299
315
|
end
|
|
300
316
|
end
|
|
301
317
|
end
|
|
318
|
+
do
|
|
319
|
+
local ____export = require("functions.trinketGive")
|
|
320
|
+
for ____exportKey, ____exportValue in pairs(____export) do
|
|
321
|
+
if ____exportKey ~= "default" then
|
|
322
|
+
____exports[____exportKey] = ____exportValue
|
|
323
|
+
end
|
|
324
|
+
end
|
|
325
|
+
end
|
|
302
326
|
do
|
|
303
327
|
local ____export = require("functions.trinkets")
|
|
304
328
|
for ____exportKey, ____exportValue in pairs(____export) do
|
|
@@ -307,6 +331,14 @@ do
|
|
|
307
331
|
end
|
|
308
332
|
end
|
|
309
333
|
end
|
|
334
|
+
do
|
|
335
|
+
local ____export = require("functions.trinketSet")
|
|
336
|
+
for ____exportKey, ____exportValue in pairs(____export) do
|
|
337
|
+
if ____exportKey ~= "default" then
|
|
338
|
+
____exports[____exportKey] = ____exportValue
|
|
339
|
+
end
|
|
340
|
+
end
|
|
341
|
+
end
|
|
310
342
|
do
|
|
311
343
|
local ____export = require("functions.ui")
|
|
312
344
|
for ____exportKey, ____exportValue in pairs(____export) do
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "isaacscript-common",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.451",
|
|
4
4
|
"description": "Helper functions for IsaacScript mods",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"isaac",
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"dist/**/*.d.ts"
|
|
26
26
|
],
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"isaac-typescript-definitions": "^1.0.
|
|
29
|
-
"isaacscript-lint": "^1.0.
|
|
28
|
+
"isaac-typescript-definitions": "^1.0.276",
|
|
29
|
+
"isaacscript-lint": "^1.0.67",
|
|
30
30
|
"typedoc": "^0.22.9",
|
|
31
31
|
"typescript": "4.4.4",
|
|
32
32
|
"typescript-to-lua": "^1.1.1"
|