isaacscript-common 3.15.3 → 3.15.6
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/callbacks/postSlotDestroyed.lua +9 -7
- package/callbacks/subscriptions/postSlotDestroyed.d.ts +4 -2
- package/callbacks/subscriptions/postSlotDestroyed.lua +8 -4
- package/enums/ModCallbackCustom.d.ts +9 -7
- package/enums/SlotDestructionType.d.ts +4 -0
- package/enums/SlotDestructionType.lua +7 -0
- package/package.json +2 -2
|
@@ -3,14 +3,17 @@ local Set = ____lualib.Set
|
|
|
3
3
|
local __TS__New = ____lualib.__TS__New
|
|
4
4
|
local Map = ____lualib.Map
|
|
5
5
|
local ____exports = {}
|
|
6
|
-
local hasSubscriptions, postEntityRemove, postSlotAnimationChanged,
|
|
6
|
+
local hasSubscriptions, postEntityRemove, postSlotAnimationChanged, PRIZE_GAME_FRAME_DELAY_UNTIL_REMOVAL, v
|
|
7
7
|
local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
|
|
8
|
+
local EntityGridCollisionClass = ____isaac_2Dtypescript_2Ddefinitions.EntityGridCollisionClass
|
|
8
9
|
local EntityType = ____isaac_2Dtypescript_2Ddefinitions.EntityType
|
|
9
10
|
local ModCallback = ____isaac_2Dtypescript_2Ddefinitions.ModCallback
|
|
10
11
|
local ____cachedClasses = require("cachedClasses")
|
|
11
12
|
local game = ____cachedClasses.game
|
|
12
13
|
local ____ModCallbackCustom = require("enums.ModCallbackCustom")
|
|
13
14
|
local ModCallbackCustom = ____ModCallbackCustom.ModCallbackCustom
|
|
15
|
+
local ____SlotDestructionType = require("enums.SlotDestructionType")
|
|
16
|
+
local SlotDestructionType = ____SlotDestructionType.SlotDestructionType
|
|
14
17
|
local ____exports = require("features.saveDataManager.exports")
|
|
15
18
|
local saveDataManager = ____exports.saveDataManager
|
|
16
19
|
local ____postSlotDestroyed = require("callbacks.subscriptions.postSlotDestroyed")
|
|
@@ -28,7 +31,7 @@ function postEntityRemove(self, entity)
|
|
|
28
31
|
return
|
|
29
32
|
end
|
|
30
33
|
if prizeFrame + PRIZE_GAME_FRAME_DELAY_UNTIL_REMOVAL == gameFrameCount then
|
|
31
|
-
postSlotDestroyedFire(nil, slot)
|
|
34
|
+
postSlotDestroyedFire(nil, slot, SlotDestructionType.COLLECTIBLE_PAYOUT)
|
|
32
35
|
end
|
|
33
36
|
end
|
|
34
37
|
function postSlotAnimationChanged(self, slot)
|
|
@@ -38,19 +41,18 @@ function postSlotAnimationChanged(self, slot)
|
|
|
38
41
|
if alreadyBroken then
|
|
39
42
|
return
|
|
40
43
|
end
|
|
41
|
-
|
|
42
|
-
local animation = sprite:GetAnimation()
|
|
43
|
-
if BROKEN_ANIMATIONS:has(animation) then
|
|
44
|
+
if slot.GridCollisionClass == EntityGridCollisionClass.GROUND then
|
|
44
45
|
v.room.brokenSlots:add(ptrHash)
|
|
45
|
-
postSlotDestroyedFire(nil, slot)
|
|
46
|
+
postSlotDestroyedFire(nil, slot, SlotDestructionType.NORMAL)
|
|
46
47
|
end
|
|
48
|
+
local sprite = slot:GetSprite()
|
|
49
|
+
local animation = sprite:GetAnimation()
|
|
47
50
|
if animation == "Prize" then
|
|
48
51
|
v.room.slotPrizeAnimationGameFrame:set(ptrHash, gameFrameCount)
|
|
49
52
|
else
|
|
50
53
|
v.room.slotPrizeAnimationGameFrame:delete(ptrHash)
|
|
51
54
|
end
|
|
52
55
|
end
|
|
53
|
-
BROKEN_ANIMATIONS = __TS__New(Set, {"Broken", "Death"})
|
|
54
56
|
PRIZE_GAME_FRAME_DELAY_UNTIL_REMOVAL = 3
|
|
55
57
|
v = {room = {
|
|
56
58
|
brokenSlots = __TS__New(Set),
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { SlotVariant } from "isaac-typescript-definitions";
|
|
2
|
+
import { SlotDestructionType } from "../../enums/SlotDestructionType";
|
|
2
3
|
export declare type PostSlotDestroyedRegisterParameters = [
|
|
3
|
-
callback: (slot: EntitySlot) => void,
|
|
4
|
-
slotVariant?: SlotVariant
|
|
4
|
+
callback: (slot: EntitySlot, slotDestructionType: SlotDestructionType) => void,
|
|
5
|
+
slotVariant?: SlotVariant,
|
|
6
|
+
slotDestructionType?: SlotDestructionType
|
|
5
7
|
];
|
|
@@ -13,15 +13,19 @@ function ____exports.postSlotDestroyedRegister(self, ...)
|
|
|
13
13
|
end
|
|
14
14
|
---
|
|
15
15
|
-- @internal
|
|
16
|
-
function ____exports.postSlotDestroyedFire(self, slot)
|
|
16
|
+
function ____exports.postSlotDestroyedFire(self, slot, slotDestructionType)
|
|
17
17
|
for ____, ____value in ipairs(subscriptions) do
|
|
18
18
|
local callback = ____value[1]
|
|
19
|
-
local
|
|
19
|
+
local callbackSlotVariant = ____value[2]
|
|
20
|
+
local callbackSlotDestructionType = ____value[3]
|
|
20
21
|
do
|
|
21
|
-
if
|
|
22
|
+
if callbackSlotVariant ~= nil and callbackSlotVariant ~= slot.Variant then
|
|
22
23
|
goto __continue5
|
|
23
24
|
end
|
|
24
|
-
|
|
25
|
+
if callbackSlotDestructionType ~= nil and callbackSlotDestructionType ~= slotDestructionType then
|
|
26
|
+
goto __continue5
|
|
27
|
+
end
|
|
28
|
+
callback(nil, slot, slotDestructionType)
|
|
25
29
|
end
|
|
26
30
|
::__continue5::
|
|
27
31
|
end
|
|
@@ -421,7 +421,7 @@ export declare enum ModCallbackCustom {
|
|
|
421
421
|
* ```ts
|
|
422
422
|
* function postItemDischarge(
|
|
423
423
|
* player: EntityPlayer,
|
|
424
|
-
* collectibleType: CollectibleType
|
|
424
|
+
* collectibleType: CollectibleType,
|
|
425
425
|
* activeSlot: ActiveSlot,
|
|
426
426
|
* ): void {}
|
|
427
427
|
* ```
|
|
@@ -692,8 +692,8 @@ export declare enum ModCallbackCustom {
|
|
|
692
692
|
* ```ts
|
|
693
693
|
* function postPlayerChangeType(
|
|
694
694
|
* player: EntityPlayer,
|
|
695
|
-
* oldCharacter: PlayerType
|
|
696
|
-
* newCharacter: PlayerType
|
|
695
|
+
* oldCharacter: PlayerType,
|
|
696
|
+
* newCharacter: PlayerType,
|
|
697
697
|
* ) {}
|
|
698
698
|
* ```
|
|
699
699
|
*/
|
|
@@ -964,11 +964,13 @@ export declare enum ModCallbackCustom {
|
|
|
964
964
|
* Fires from the `POST_RENDER` callback when a slot plays the animation that indicates that it
|
|
965
965
|
* has broken.
|
|
966
966
|
*
|
|
967
|
-
* When registering the callback, takes an optional second argument that will make the callback
|
|
968
|
-
*
|
|
967
|
+
* - When registering the callback, takes an optional second argument that will make the callback
|
|
968
|
+
* only fire if it matches the `SlotVariant` provided.
|
|
969
|
+
* - When registering the callback, takes an optional third argument that will make the callback
|
|
970
|
+
* only fire if the destruction type matches the `SlotDestructionType` provided.
|
|
969
971
|
*
|
|
970
972
|
* ```ts
|
|
971
|
-
* function postSlotDestroyed(slot: Entity): void {}
|
|
973
|
+
* function postSlotDestroyed(slot: Entity, slotDestructionType: SlotDestructionType): void {}
|
|
972
974
|
* ```
|
|
973
975
|
*/
|
|
974
976
|
POST_SLOT_DESTROYED = 66,
|
|
@@ -1110,7 +1112,7 @@ export declare enum ModCallbackCustom {
|
|
|
1110
1112
|
* ```ts
|
|
1111
1113
|
* function postTrinketBreak(
|
|
1112
1114
|
* player: EntityPlayer,
|
|
1113
|
-
* trinketType: TrinketType
|
|
1115
|
+
* trinketType: TrinketType,
|
|
1114
1116
|
* ): void {}
|
|
1115
1117
|
* ```
|
|
1116
1118
|
*/
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
local ____exports = {}
|
|
2
|
+
____exports.SlotDestructionType = {}
|
|
3
|
+
____exports.SlotDestructionType.NORMAL = 0
|
|
4
|
+
____exports.SlotDestructionType[____exports.SlotDestructionType.NORMAL] = "NORMAL"
|
|
5
|
+
____exports.SlotDestructionType.COLLECTIBLE_PAYOUT = 1
|
|
6
|
+
____exports.SlotDestructionType[____exports.SlotDestructionType.COLLECTIBLE_PAYOUT] = "COLLECTIBLE_PAYOUT"
|
|
7
|
+
return ____exports
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "isaacscript-common",
|
|
3
|
-
"version": "3.15.
|
|
3
|
+
"version": "3.15.6",
|
|
4
4
|
"description": "Helper functions and features for IsaacScript mods.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"isaac",
|
|
@@ -22,6 +22,6 @@
|
|
|
22
22
|
"main": "index",
|
|
23
23
|
"types": "index.d.ts",
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"isaac-typescript-definitions": "^2.2.
|
|
25
|
+
"isaac-typescript-definitions": "^2.2.3"
|
|
26
26
|
}
|
|
27
27
|
}
|