isaacscript-common 43.0.1 → 43.1.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/index.rollup.d.ts +6 -0
- package/dist/isaacscript-common.lua +12 -2
- package/dist/src/classes/features/other/extraConsoleCommands/commands.lua +1 -1
- package/dist/src/functions/trinkets.d.ts +5 -0
- package/dist/src/functions/trinkets.d.ts.map +1 -1
- package/dist/src/functions/trinkets.lua +12 -0
- package/package.json +1 -1
- package/src/classes/features/other/extraConsoleCommands/commands.ts +1 -1
- package/src/functions/trinkets.ts +17 -0
package/dist/index.rollup.d.ts
CHANGED
|
@@ -6393,6 +6393,12 @@ export declare function getPlayersWithTrinket(...trinketTypes: TrinketType[]): E
|
|
|
6393
6393
|
/** Returns a set of the player's current transformations. */
|
|
6394
6394
|
export declare function getPlayerTransformations(player: EntityPlayer): Set<PlayerForm>;
|
|
6395
6395
|
|
|
6396
|
+
/**
|
|
6397
|
+
* Helper function to get all of the trinkets that the player is currently holding. This will not
|
|
6398
|
+
* include any smelted trinkets.
|
|
6399
|
+
*/
|
|
6400
|
+
export declare function getPlayerTrinkets(player: EntityPlayer): TrinketType[];
|
|
6401
|
+
|
|
6396
6402
|
/**
|
|
6397
6403
|
* Use this helper function as a workaround for the `EntityPlayer.GetPocketItem` method not working
|
|
6398
6404
|
* correctly.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
--[[
|
|
2
2
|
|
|
3
|
-
isaacscript-common 43.0
|
|
3
|
+
isaacscript-common 43.1.0
|
|
4
4
|
|
|
5
5
|
This is the "isaacscript-common" library, which was created with the IsaacScript tool.
|
|
6
6
|
|
|
@@ -29680,6 +29680,16 @@ function ____exports.getOpenTrinketSlot(self, player)
|
|
|
29680
29680
|
end
|
|
29681
29681
|
error("The player has an unknown number of trinket slots: " .. tostring(maxTrinkets))
|
|
29682
29682
|
end
|
|
29683
|
+
function ____exports.getPlayerTrinkets(self, player)
|
|
29684
|
+
local trinketTypes = {}
|
|
29685
|
+
for ____, trinketSlot in ipairs(TRINKET_SLOT_VALUES) do
|
|
29686
|
+
local trinketType = player:GetTrinket(trinketSlot)
|
|
29687
|
+
if trinketType ~= TrinketType.NULL then
|
|
29688
|
+
trinketTypes[#trinketTypes + 1] = trinketType
|
|
29689
|
+
end
|
|
29690
|
+
end
|
|
29691
|
+
return trinketTypes
|
|
29692
|
+
end
|
|
29683
29693
|
function ____exports.getTrinketDescription(self, trinketType)
|
|
29684
29694
|
local trinketDescription = TRINKET_DESCRIPTION_MAP:get(trinketType)
|
|
29685
29695
|
if trinketDescription ~= nil then
|
|
@@ -50133,7 +50143,7 @@ function ____exports.character(self, params)
|
|
|
50133
50143
|
playerType = match[2]
|
|
50134
50144
|
else
|
|
50135
50145
|
if num < FIRST_CHARACTER or num > LAST_VANILLA_CHARACTER then
|
|
50136
|
-
print("Invalid
|
|
50146
|
+
print("Invalid character number: " .. tostring(num))
|
|
50137
50147
|
return
|
|
50138
50148
|
end
|
|
50139
50149
|
playerType = num
|
|
@@ -550,7 +550,7 @@ function ____exports.character(self, params)
|
|
|
550
550
|
playerType = match[2]
|
|
551
551
|
else
|
|
552
552
|
if num < FIRST_CHARACTER or num > LAST_VANILLA_CHARACTER then
|
|
553
|
-
print("Invalid
|
|
553
|
+
print("Invalid character number: " .. tostring(num))
|
|
554
554
|
return
|
|
555
555
|
end
|
|
556
556
|
playerType = num
|
|
@@ -44,6 +44,11 @@ export declare function getMysteriousPaperEffectForFrame(player: EntityPlayer, f
|
|
|
44
44
|
* ```
|
|
45
45
|
*/
|
|
46
46
|
export declare function getOpenTrinketSlot(player: EntityPlayer): int | undefined;
|
|
47
|
+
/**
|
|
48
|
+
* Helper function to get all of the trinkets that the player is currently holding. This will not
|
|
49
|
+
* include any smelted trinkets.
|
|
50
|
+
*/
|
|
51
|
+
export declare function getPlayerTrinkets(player: EntityPlayer): TrinketType[];
|
|
47
52
|
/**
|
|
48
53
|
* Helper function to get the in-game description for a trinket. Returns "Unknown" if the provided
|
|
49
54
|
* trinket type was not valid.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trinkets.d.ts","sourceRoot":"","sources":["../../../src/functions/trinkets.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAGL,WAAW,EACZ,MAAM,8BAA8B,CAAC;AAKtC,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AA+BvE;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,WAAW,GAAG,WAAW,CAE1E;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,gCAAgC,CAC9C,MAAM,EAAE,YAAY,EACpB,UAAU,CAAC,EAAE,GAAG,GACf,qBAAqB,GAAG,SAAS,CAUnC;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,YAAY,GAAG,GAAG,GAAG,SAAS,CAkBxE;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,WAAW,EAAE,WAAW,GAAG,MAAM,CActE;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,WAAW,EAAE,WAAW,GAAG,MAAM,CAOtE;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,WAAW,EAAE,WAAW,GAAG,MAAM,CAc/D;AAED,qFAAqF;AACrF,wBAAgB,aAAa,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAO3D;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAOhE;AAED,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAErE;AAED,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAErE;AAED,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAEt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ACrF,wBAAgB,aAAa,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAO3D;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAOhE;AAED,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAErE;AAED,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAErE;AAED,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAEtE;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,WAAW,GAAG,MAAM,CAYjE;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,YAAY,EACrB,OAAO,EAAE,MAAM,GAAG,SAAS,GAC1B,IAAI,CAiBN;AAED,6FAA6F;AAC7F,wBAAgB,mBAAmB,CACjC,WAAW,EAAE,WAAW,EACxB,SAAS,EAAE,SAAS,GACnB,OAAO,CAOT"}
|
|
@@ -109,6 +109,18 @@ function ____exports.getOpenTrinketSlot(self, player)
|
|
|
109
109
|
end
|
|
110
110
|
error("The player has an unknown number of trinket slots: " .. tostring(maxTrinkets))
|
|
111
111
|
end
|
|
112
|
+
--- Helper function to get all of the trinkets that the player is currently holding. This will not
|
|
113
|
+
-- include any smelted trinkets.
|
|
114
|
+
function ____exports.getPlayerTrinkets(self, player)
|
|
115
|
+
local trinketTypes = {}
|
|
116
|
+
for ____, trinketSlot in ipairs(TRINKET_SLOT_VALUES) do
|
|
117
|
+
local trinketType = player:GetTrinket(trinketSlot)
|
|
118
|
+
if trinketType ~= TrinketType.NULL then
|
|
119
|
+
trinketTypes[#trinketTypes + 1] = trinketType
|
|
120
|
+
end
|
|
121
|
+
end
|
|
122
|
+
return trinketTypes
|
|
123
|
+
end
|
|
112
124
|
--- Helper function to get the in-game description for a trinket. Returns "Unknown" if the provided
|
|
113
125
|
-- trinket type was not valid.
|
|
114
126
|
--
|
package/package.json
CHANGED
|
@@ -446,7 +446,7 @@ export function character(params: string): void {
|
|
|
446
446
|
playerType = match[1];
|
|
447
447
|
} else {
|
|
448
448
|
if (num < FIRST_CHARACTER || num > LAST_VANILLA_CHARACTER) {
|
|
449
|
-
print(`Invalid
|
|
449
|
+
print(`Invalid character number: ${num}`);
|
|
450
450
|
return;
|
|
451
451
|
}
|
|
452
452
|
|
|
@@ -118,6 +118,23 @@ export function getOpenTrinketSlot(player: EntityPlayer): int | undefined {
|
|
|
118
118
|
error(`The player has an unknown number of trinket slots: ${maxTrinkets}`);
|
|
119
119
|
}
|
|
120
120
|
|
|
121
|
+
/**
|
|
122
|
+
* Helper function to get all of the trinkets that the player is currently holding. This will not
|
|
123
|
+
* include any smelted trinkets.
|
|
124
|
+
*/
|
|
125
|
+
export function getPlayerTrinkets(player: EntityPlayer): TrinketType[] {
|
|
126
|
+
const trinketTypes: TrinketType[] = [];
|
|
127
|
+
|
|
128
|
+
for (const trinketSlot of TRINKET_SLOT_VALUES) {
|
|
129
|
+
const trinketType = player.GetTrinket(trinketSlot);
|
|
130
|
+
if (trinketType !== TrinketType.NULL) {
|
|
131
|
+
trinketTypes.push(trinketType);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
return trinketTypes;
|
|
136
|
+
}
|
|
137
|
+
|
|
121
138
|
/**
|
|
122
139
|
* Helper function to get the in-game description for a trinket. Returns "Unknown" if the provided
|
|
123
140
|
* trinket type was not valid.
|