isaacscript-common 9.17.0 → 9.18.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/subscriptions/postPurchase.d.ts.map +1 -1
- package/dist/callbacks/subscriptions/postPurchase.lua +12 -1
- package/dist/functions/charge.d.ts +2 -0
- package/dist/functions/charge.d.ts.map +1 -1
- package/dist/functions/charge.lua +12 -0
- package/dist/functions/collectibles.d.ts +6 -1
- package/dist/functions/collectibles.d.ts.map +1 -1
- package/dist/functions/collectibles.lua +16 -7
- package/dist/index.d.ts +9 -0
- package/package.json +2 -2
- package/src/callbacks/subscriptions/postPurchase.ts +21 -1
- package/src/functions/charge.ts +19 -1
- package/src/functions/collectibles.ts +27 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"postPurchase.d.ts","sourceRoot":"","sources":["../../../src/callbacks/subscriptions/postPurchase.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAE7D,oBAAY,8BAA8B,GAAG;IAC3C,QAAQ,EAAE,CAAC,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,YAAY,KAAK,IAAI;IAC9D,aAAa,CAAC,EAAE,aAAa;IAC7B,aAAa,CAAC,EAAE,GAAG;CACpB,CAAC;AAIF,wBAAgB,4BAA4B,IAAI,OAAO,CAEtD;AAED,wBAAgB,oBAAoB,CAClC,GAAG,IAAI,EAAE,8BAA8B,GACtC,IAAI,CAEN;AAED,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,YAAY,EACpB,MAAM,EAAE,YAAY,GACnB,IAAI,
|
|
1
|
+
{"version":3,"file":"postPurchase.d.ts","sourceRoot":"","sources":["../../../src/callbacks/subscriptions/postPurchase.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAE7D,oBAAY,8BAA8B,GAAG;IAC3C,QAAQ,EAAE,CAAC,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,YAAY,KAAK,IAAI;IAC9D,aAAa,CAAC,EAAE,aAAa;IAC7B,aAAa,CAAC,EAAE,GAAG;CACpB,CAAC;AAIF,wBAAgB,4BAA4B,IAAI,OAAO,CAEtD;AAED,wBAAgB,oBAAoB,CAClC,GAAG,IAAI,EAAE,8BAA8B,GACtC,IAAI,CAEN;AAED,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,YAAY,EACpB,MAAM,EAAE,YAAY,GACnB,IAAI,CAwBN"}
|
|
@@ -10,7 +10,18 @@ end
|
|
|
10
10
|
function ____exports.postPurchaseFire(self, player, pickup)
|
|
11
11
|
for ____, ____value in ipairs(subscriptions) do
|
|
12
12
|
local callback = ____value[1]
|
|
13
|
-
|
|
13
|
+
local callbackPickupVariant = ____value[2]
|
|
14
|
+
local callbackPickupSubType = ____value[3]
|
|
15
|
+
do
|
|
16
|
+
if callbackPickupVariant ~= nil and callbackPickupVariant ~= pickup.Variant then
|
|
17
|
+
goto __continue5
|
|
18
|
+
end
|
|
19
|
+
if callbackPickupSubType ~= nil and callbackPickupSubType ~= pickup.SubType then
|
|
20
|
+
goto __continue5
|
|
21
|
+
end
|
|
22
|
+
callback(nil, player, pickup)
|
|
23
|
+
end
|
|
24
|
+
::__continue5::
|
|
14
25
|
end
|
|
15
26
|
end
|
|
16
27
|
return ____exports
|
|
@@ -27,6 +27,7 @@ export declare function addCharge(player: EntityPlayer, activeSlot: ActiveSlot,
|
|
|
27
27
|
* - 2x2 rooms and L rooms granting a double charge
|
|
28
28
|
* - The Battery
|
|
29
29
|
* - AAA Battery
|
|
30
|
+
* - Not charging active items with `chargetype="special"`
|
|
30
31
|
*
|
|
31
32
|
* @param player The player to grant the charges to.
|
|
32
33
|
* @param bigRoomDoubleCharge Optional. If set to false, it will treat the current room as a 1x1
|
|
@@ -43,6 +44,7 @@ export declare function addRoomClearCharge(player: EntityPlayer, bigRoomDoubleCh
|
|
|
43
44
|
* - L rooms and 2x2 rooms granting a double charge
|
|
44
45
|
* - The Battery
|
|
45
46
|
* - AAA Battery
|
|
47
|
+
* - Not charging active items with `chargetype="special"`
|
|
46
48
|
*
|
|
47
49
|
* @param player The player to grant the charges to.
|
|
48
50
|
* @param activeSlot The active item slot to grant the charges to.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"charge.d.ts","sourceRoot":"","sources":["../../src/functions/charge.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,
|
|
1
|
+
{"version":3,"file":"charge.d.ts","sourceRoot":"","sources":["../../src/functions/charge.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EAKX,MAAM,8BAA8B,CAAC;AAStC;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,SAAS,CACvB,MAAM,EAAE,YAAY,EACpB,UAAU,EAAE,UAAU,EACtB,UAAU,SAAI,EACd,eAAe,UAAO,GACrB,GAAG,CA2BL;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,YAAY,EACpB,mBAAmB,UAAO,EAC1B,eAAe,UAAO,GACrB,IAAI,CAaN;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,YAAY,EACpB,UAAU,EAAE,UAAU,EACtB,mBAAmB,UAAO,EAC1B,eAAe,UAAO,GACrB,IAAI,CAkBN;AAuED;;;;;;;;;;;;GAYG;AACH,wBAAgB,mBAAmB,CAAC,mBAAmB,UAAO,GAAG,IAAI,CAIpE;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,YAAY,EACpB,UAAU,EAAE,UAAU,GACrB,GAAG,CAKL;AAED,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,YAAY,EACpB,UAAU,EAAE,UAAU,GACrB,OAAO,CAMT;AAED,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,YAAY,EACpB,UAAU,EAAE,UAAU,GACrB,IAAI,CAYN"}
|
|
@@ -3,12 +3,14 @@ local getClampedChargesToAdd, getChargesToAddWithAAAModifier, shouldPlayFullRech
|
|
|
3
3
|
local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
|
|
4
4
|
local ActiveSlot = ____isaac_2Dtypescript_2Ddefinitions.ActiveSlot
|
|
5
5
|
local CollectibleType = ____isaac_2Dtypescript_2Ddefinitions.CollectibleType
|
|
6
|
+
local ItemConfigChargeType = ____isaac_2Dtypescript_2Ddefinitions.ItemConfigChargeType
|
|
6
7
|
local SoundEffect = ____isaac_2Dtypescript_2Ddefinitions.SoundEffect
|
|
7
8
|
local TrinketType = ____isaac_2Dtypescript_2Ddefinitions.TrinketType
|
|
8
9
|
local ____cachedClasses = require("core.cachedClasses")
|
|
9
10
|
local game = ____cachedClasses.game
|
|
10
11
|
local sfxManager = ____cachedClasses.sfxManager
|
|
11
12
|
local ____collectibles = require("functions.collectibles")
|
|
13
|
+
local getCollectibleChargeType = ____collectibles.getCollectibleChargeType
|
|
12
14
|
local getCollectibleMaxCharges = ____collectibles.getCollectibleMaxCharges
|
|
13
15
|
local ____playerIndex = require("functions.playerIndex")
|
|
14
16
|
local getPlayers = ____playerIndex.getPlayers
|
|
@@ -60,6 +62,7 @@ end
|
|
|
60
62
|
-- - L rooms and 2x2 rooms granting a double charge
|
|
61
63
|
-- - The Battery
|
|
62
64
|
-- - AAA Battery
|
|
65
|
+
-- - Not charging active items with `chargetype="special"`
|
|
63
66
|
--
|
|
64
67
|
-- @param player The player to grant the charges to.
|
|
65
68
|
-- @param activeSlot The active item slot to grant the charges to.
|
|
@@ -74,6 +77,14 @@ function ____exports.addRoomClearChargeToSlot(self, player, activeSlot, bigRoomD
|
|
|
74
77
|
if playSoundEffect == nil then
|
|
75
78
|
playSoundEffect = true
|
|
76
79
|
end
|
|
80
|
+
local activeItem = player:GetActiveItem(activeSlot)
|
|
81
|
+
if activeItem == CollectibleType.NULL then
|
|
82
|
+
return
|
|
83
|
+
end
|
|
84
|
+
local chargeType = getCollectibleChargeType(nil, activeItem)
|
|
85
|
+
if chargeType == ItemConfigChargeType.SPECIAL then
|
|
86
|
+
return
|
|
87
|
+
end
|
|
77
88
|
local room = game:GetRoom()
|
|
78
89
|
local roomShape = room:GetRoomShape()
|
|
79
90
|
local numCharges = bigRoomDoubleCharge and getRoomShapeCharges(nil, roomShape) or 1
|
|
@@ -156,6 +167,7 @@ end
|
|
|
156
167
|
-- - 2x2 rooms and L rooms granting a double charge
|
|
157
168
|
-- - The Battery
|
|
158
169
|
-- - AAA Battery
|
|
170
|
+
-- - Not charging active items with `chargetype="special"`
|
|
159
171
|
--
|
|
160
172
|
-- @param player The player to grant the charges to.
|
|
161
173
|
-- @param bigRoomDoubleCharge Optional. If set to false, it will treat the current room as a 1x1
|
|
@@ -1,8 +1,13 @@
|
|
|
1
|
-
import { CollectiblePedestalType, CollectibleType, ItemConfigTag, ItemType, PickupPrice } from "isaac-typescript-definitions";
|
|
1
|
+
import { CollectiblePedestalType, CollectibleType, ItemConfigChargeType, ItemConfigTag, ItemType, PickupPrice } from "isaac-typescript-definitions";
|
|
2
2
|
import { CollectibleIndex } from "../types/CollectibleIndex";
|
|
3
3
|
export declare function clearCollectibleSprite(collectible: EntityPickup): void;
|
|
4
4
|
/** Helper function to check if two collectible sprites have the same sprite sheet loaded. */
|
|
5
5
|
export declare function collectibleSpriteEquals(sprite1: Sprite, sprite2: Sprite): boolean;
|
|
6
|
+
/**
|
|
7
|
+
* Helper function to get the charge type that a collectible has. Returns
|
|
8
|
+
* `ItemConfigChargeType.NORMAL` if the provided collectible type was not valid.
|
|
9
|
+
*/
|
|
10
|
+
export declare function getCollectibleChargeType(collectibleType: CollectibleType): ItemConfigChargeType;
|
|
6
11
|
/**
|
|
7
12
|
* Helper function to get the in-game description for a collectible. Returns "Unknown" if the
|
|
8
13
|
* provided collectible type was not valid.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collectibles.d.ts","sourceRoot":"","sources":["../../src/functions/collectibles.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,
|
|
1
|
+
{"version":3,"file":"collectibles.d.ts","sourceRoot":"","sources":["../../src/functions/collectibles.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
local ____exports = {}
|
|
2
|
-
local initQuestionMarkSprite
|
|
2
|
+
local initQuestionMarkSprite
|
|
3
3
|
local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
|
|
4
|
+
local CollectibleSpriteLayer = ____isaac_2Dtypescript_2Ddefinitions.CollectibleSpriteLayer
|
|
4
5
|
local CollectibleType = ____isaac_2Dtypescript_2Ddefinitions.CollectibleType
|
|
5
6
|
local EntityType = ____isaac_2Dtypescript_2Ddefinitions.EntityType
|
|
7
|
+
local ItemConfigChargeType = ____isaac_2Dtypescript_2Ddefinitions.ItemConfigChargeType
|
|
6
8
|
local ItemConfigTagZero = ____isaac_2Dtypescript_2Ddefinitions.ItemConfigTagZero
|
|
7
9
|
local ItemType = ____isaac_2Dtypescript_2Ddefinitions.ItemType
|
|
8
10
|
local PickupPrice = ____isaac_2Dtypescript_2Ddefinitions.PickupPrice
|
|
@@ -79,9 +81,9 @@ function ____exports.setCollectibleSprite(self, collectible, pngPath)
|
|
|
79
81
|
end
|
|
80
82
|
local sprite = collectible:GetSprite()
|
|
81
83
|
if pngPath == nil then
|
|
82
|
-
clearSprite(nil, sprite,
|
|
84
|
+
clearSprite(nil, sprite, CollectibleSpriteLayer.HEAD, CollectibleSpriteLayer.ITEM_SHADOW)
|
|
83
85
|
else
|
|
84
|
-
sprite:ReplaceSpritesheet(
|
|
86
|
+
sprite:ReplaceSpritesheet(CollectibleSpriteLayer.HEAD, pngPath)
|
|
85
87
|
sprite:LoadGraphics()
|
|
86
88
|
end
|
|
87
89
|
end
|
|
@@ -106,8 +108,6 @@ function ____exports.setCollectibleSubType(self, collectible, newCollectibleType
|
|
|
106
108
|
)
|
|
107
109
|
end
|
|
108
110
|
local COLLECTIBLE_ANM2_PATH = "gfx/005.100_collectible.anm2"
|
|
109
|
-
COLLECTIBLE_SPRITE_LAYER = 1
|
|
110
|
-
COLLECTIBLE_SHADOW_LAYER = 4
|
|
111
111
|
local GLITCHED_ITEM_THRESHOLD = 4000000000
|
|
112
112
|
local questionMarkSprite = initQuestionMarkSprite(nil)
|
|
113
113
|
--- Helper function to check if two collectible sprites have the same sprite sheet loaded.
|
|
@@ -122,7 +122,7 @@ function ____exports.collectibleSpriteEquals(self, sprite1, sprite2)
|
|
|
122
122
|
nil,
|
|
123
123
|
sprite1,
|
|
124
124
|
sprite2,
|
|
125
|
-
|
|
125
|
+
CollectibleSpriteLayer.HEAD,
|
|
126
126
|
xStart,
|
|
127
127
|
xFinish,
|
|
128
128
|
xIncrement,
|
|
@@ -131,6 +131,15 @@ function ____exports.collectibleSpriteEquals(self, sprite1, sprite2)
|
|
|
131
131
|
yIncrement
|
|
132
132
|
)
|
|
133
133
|
end
|
|
134
|
+
--- Helper function to get the charge type that a collectible has. Returns
|
|
135
|
+
-- `ItemConfigChargeType.NORMAL` if the provided collectible type was not valid.
|
|
136
|
+
function ____exports.getCollectibleChargeType(self, collectibleType)
|
|
137
|
+
local itemConfigItem = itemConfig:GetCollectible(collectibleType)
|
|
138
|
+
if itemConfigItem == nil then
|
|
139
|
+
return ItemConfigChargeType.NORMAL
|
|
140
|
+
end
|
|
141
|
+
return itemConfigItem.ChargeType
|
|
142
|
+
end
|
|
134
143
|
--- Helper function to get the in-game description for a collectible. Returns "Unknown" if the
|
|
135
144
|
-- provided collectible type was not valid.
|
|
136
145
|
function ____exports.getCollectibleDescription(self, collectibleType)
|
|
@@ -393,7 +402,7 @@ function ____exports.newCollectibleSprite(self, collectibleType)
|
|
|
393
402
|
sprite:Load(COLLECTIBLE_ANM2_PATH, false)
|
|
394
403
|
clearSprite(nil, sprite)
|
|
395
404
|
local gfxFileName = ____exports.getCollectibleGfxFilename(nil, collectibleType)
|
|
396
|
-
sprite:ReplaceSpritesheet(
|
|
405
|
+
sprite:ReplaceSpritesheet(CollectibleSpriteLayer.HEAD, gfxFileName)
|
|
397
406
|
sprite:LoadGraphics()
|
|
398
407
|
return sprite
|
|
399
408
|
end
|
package/dist/index.d.ts
CHANGED
|
@@ -35,6 +35,7 @@ import { GridEntityType } from 'isaac-typescript-definitions';
|
|
|
35
35
|
import { GridEntityXMLType } from 'isaac-typescript-definitions';
|
|
36
36
|
import { HeartSubType } from 'isaac-typescript-definitions';
|
|
37
37
|
import { ItemConfigCardType } from 'isaac-typescript-definitions';
|
|
38
|
+
import { ItemConfigChargeType } from 'isaac-typescript-definitions';
|
|
38
39
|
import { ItemConfigPillEffectClass } from 'isaac-typescript-definitions';
|
|
39
40
|
import { ItemConfigPillEffectType } from 'isaac-typescript-definitions';
|
|
40
41
|
import { ItemConfigTag } from 'isaac-typescript-definitions';
|
|
@@ -245,6 +246,7 @@ export declare function addPlayerHealthType(player: EntityPlayer, healthType: He
|
|
|
245
246
|
* - 2x2 rooms and L rooms granting a double charge
|
|
246
247
|
* - The Battery
|
|
247
248
|
* - AAA Battery
|
|
249
|
+
* - Not charging active items with `chargetype="special"`
|
|
248
250
|
*
|
|
249
251
|
* @param player The player to grant the charges to.
|
|
250
252
|
* @param bigRoomDoubleCharge Optional. If set to false, it will treat the current room as a 1x1
|
|
@@ -277,6 +279,7 @@ export declare function addRoomClearCharges(bigRoomDoubleCharge?: boolean): void
|
|
|
277
279
|
* - L rooms and 2x2 rooms granting a double charge
|
|
278
280
|
* - The Battery
|
|
279
281
|
* - AAA Battery
|
|
282
|
+
* - Not charging active items with `chargetype="special"`
|
|
280
283
|
*
|
|
281
284
|
* @param player The player to grant the charges to.
|
|
282
285
|
* @param activeSlot The active item slot to grant the charges to.
|
|
@@ -2622,6 +2625,12 @@ export declare function getCoinValue(coinSubType: CoinSubType): int;
|
|
|
2622
2625
|
*/
|
|
2623
2626
|
export declare function getCollectibleArray(): readonly CollectibleType[];
|
|
2624
2627
|
|
|
2628
|
+
/**
|
|
2629
|
+
* Helper function to get the charge type that a collectible has. Returns
|
|
2630
|
+
* `ItemConfigChargeType.NORMAL` if the provided collectible type was not valid.
|
|
2631
|
+
*/
|
|
2632
|
+
export declare function getCollectibleChargeType(collectibleType: CollectibleType): ItemConfigChargeType;
|
|
2633
|
+
|
|
2625
2634
|
/**
|
|
2626
2635
|
* Helper function to get the in-game description for a collectible. Returns "Unknown" if the
|
|
2627
2636
|
* provided collectible type was not valid.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "isaacscript-common",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.18.1",
|
|
4
4
|
"description": "Helper functions and features for IsaacScript mods.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"isaac",
|
|
@@ -22,6 +22,6 @@
|
|
|
22
22
|
"main": "dist/index",
|
|
23
23
|
"types": "dist/index.d.ts",
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"isaac-typescript-definitions": "^4.
|
|
25
|
+
"isaac-typescript-definitions": "^4.1.1"
|
|
26
26
|
}
|
|
27
27
|
}
|
|
@@ -22,7 +22,27 @@ export function postPurchaseFire(
|
|
|
22
22
|
player: EntityPlayer,
|
|
23
23
|
pickup: EntityPickup,
|
|
24
24
|
): void {
|
|
25
|
-
for (const [
|
|
25
|
+
for (const [
|
|
26
|
+
callback,
|
|
27
|
+
callbackPickupVariant,
|
|
28
|
+
callbackPickupSubType,
|
|
29
|
+
] of subscriptions) {
|
|
30
|
+
// Handle the optional 2nd callback argument.
|
|
31
|
+
if (
|
|
32
|
+
callbackPickupVariant !== undefined &&
|
|
33
|
+
callbackPickupVariant !== pickup.Variant
|
|
34
|
+
) {
|
|
35
|
+
continue;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// Handle the optional 3rd callback argument.
|
|
39
|
+
if (
|
|
40
|
+
callbackPickupSubType !== undefined &&
|
|
41
|
+
callbackPickupSubType !== pickup.SubType
|
|
42
|
+
) {
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
|
|
26
46
|
callback(player, pickup);
|
|
27
47
|
}
|
|
28
48
|
}
|
package/src/functions/charge.ts
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ActiveSlot,
|
|
3
3
|
CollectibleType,
|
|
4
|
+
ItemConfigChargeType,
|
|
4
5
|
SoundEffect,
|
|
5
6
|
TrinketType,
|
|
6
7
|
} from "isaac-typescript-definitions";
|
|
7
8
|
import { game, sfxManager } from "../core/cachedClasses";
|
|
8
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
getCollectibleChargeType,
|
|
11
|
+
getCollectibleMaxCharges,
|
|
12
|
+
} from "./collectibles";
|
|
9
13
|
import { getPlayers } from "./playerIndex";
|
|
10
14
|
import { getRoomShapeCharges } from "./roomShape";
|
|
11
15
|
|
|
@@ -70,6 +74,7 @@ export function addCharge(
|
|
|
70
74
|
* - 2x2 rooms and L rooms granting a double charge
|
|
71
75
|
* - The Battery
|
|
72
76
|
* - AAA Battery
|
|
77
|
+
* - Not charging active items with `chargetype="special"`
|
|
73
78
|
*
|
|
74
79
|
* @param player The player to grant the charges to.
|
|
75
80
|
* @param bigRoomDoubleCharge Optional. If set to false, it will treat the current room as a 1x1
|
|
@@ -104,6 +109,7 @@ export function addRoomClearCharge(
|
|
|
104
109
|
* - L rooms and 2x2 rooms granting a double charge
|
|
105
110
|
* - The Battery
|
|
106
111
|
* - AAA Battery
|
|
112
|
+
* - Not charging active items with `chargetype="special"`
|
|
107
113
|
*
|
|
108
114
|
* @param player The player to grant the charges to.
|
|
109
115
|
* @param activeSlot The active item slot to grant the charges to.
|
|
@@ -118,6 +124,18 @@ export function addRoomClearChargeToSlot(
|
|
|
118
124
|
bigRoomDoubleCharge = true,
|
|
119
125
|
playSoundEffect = true,
|
|
120
126
|
): void {
|
|
127
|
+
const activeItem = player.GetActiveItem(activeSlot);
|
|
128
|
+
if (activeItem === CollectibleType.NULL) {
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// Certain collectibles have special charge mechanisms and are not charged upon a room being
|
|
133
|
+
// cleared.
|
|
134
|
+
const chargeType = getCollectibleChargeType(activeItem);
|
|
135
|
+
if (chargeType === ItemConfigChargeType.SPECIAL) {
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
|
|
121
139
|
const room = game.GetRoom();
|
|
122
140
|
const roomShape = room.GetRoomShape();
|
|
123
141
|
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CollectiblePedestalType,
|
|
3
|
+
CollectibleSpriteLayer,
|
|
3
4
|
CollectibleType,
|
|
4
5
|
EntityType,
|
|
6
|
+
ItemConfigChargeType,
|
|
5
7
|
ItemConfigTag,
|
|
6
8
|
ItemConfigTagZero,
|
|
7
9
|
ItemType,
|
|
@@ -32,8 +34,6 @@ import { clearSprite, spriteEquals } from "./sprites";
|
|
|
32
34
|
import { irange } from "./utils";
|
|
33
35
|
|
|
34
36
|
const COLLECTIBLE_ANM2_PATH = "gfx/005.100_collectible.anm2";
|
|
35
|
-
const COLLECTIBLE_SPRITE_LAYER = 1;
|
|
36
|
-
const COLLECTIBLE_SHADOW_LAYER = 4;
|
|
37
37
|
|
|
38
38
|
// Glitched items start at id 4294967295 (the final 32-bit integer) and increment backwards.
|
|
39
39
|
const GLITCHED_ITEM_THRESHOLD = 4000000000;
|
|
@@ -72,7 +72,7 @@ export function collectibleSpriteEquals(
|
|
|
72
72
|
return spriteEquals(
|
|
73
73
|
sprite1,
|
|
74
74
|
sprite2,
|
|
75
|
-
|
|
75
|
+
CollectibleSpriteLayer.HEAD,
|
|
76
76
|
xStart,
|
|
77
77
|
xFinish,
|
|
78
78
|
xIncrement,
|
|
@@ -82,6 +82,21 @@ export function collectibleSpriteEquals(
|
|
|
82
82
|
);
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
+
/**
|
|
86
|
+
* Helper function to get the charge type that a collectible has. Returns
|
|
87
|
+
* `ItemConfigChargeType.NORMAL` if the provided collectible type was not valid.
|
|
88
|
+
*/
|
|
89
|
+
export function getCollectibleChargeType(
|
|
90
|
+
collectibleType: CollectibleType,
|
|
91
|
+
): ItemConfigChargeType {
|
|
92
|
+
const itemConfigItem = itemConfig.GetCollectible(collectibleType);
|
|
93
|
+
if (itemConfigItem === undefined) {
|
|
94
|
+
return ItemConfigChargeType.NORMAL;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
return itemConfigItem.ChargeType;
|
|
98
|
+
}
|
|
99
|
+
|
|
85
100
|
/**
|
|
86
101
|
* Helper function to get the in-game description for a collectible. Returns "Unknown" if the
|
|
87
102
|
* provided collectible type was not valid.
|
|
@@ -482,7 +497,7 @@ export function newCollectibleSprite(collectibleType: CollectibleType): Sprite {
|
|
|
482
497
|
clearSprite(sprite);
|
|
483
498
|
|
|
484
499
|
const gfxFileName = getCollectibleGfxFilename(collectibleType);
|
|
485
|
-
sprite.ReplaceSpritesheet(
|
|
500
|
+
sprite.ReplaceSpritesheet(CollectibleSpriteLayer.HEAD, gfxFileName);
|
|
486
501
|
sprite.LoadGraphics();
|
|
487
502
|
|
|
488
503
|
return sprite;
|
|
@@ -615,9 +630,15 @@ export function setCollectibleSprite(
|
|
|
615
630
|
|
|
616
631
|
const sprite = collectible.GetSprite();
|
|
617
632
|
if (pngPath === undefined) {
|
|
618
|
-
|
|
633
|
+
// We want to remove the little circle that appears on top of the pedestal, which is why we also
|
|
634
|
+
// clear `CollectibleSpriteLayer.ITEM_SHADOW`.
|
|
635
|
+
clearSprite(
|
|
636
|
+
sprite,
|
|
637
|
+
CollectibleSpriteLayer.HEAD,
|
|
638
|
+
CollectibleSpriteLayer.ITEM_SHADOW,
|
|
639
|
+
);
|
|
619
640
|
} else {
|
|
620
|
-
sprite.ReplaceSpritesheet(
|
|
641
|
+
sprite.ReplaceSpritesheet(CollectibleSpriteLayer.HEAD, pngPath);
|
|
621
642
|
sprite.LoadGraphics();
|
|
622
643
|
}
|
|
623
644
|
}
|