isaacscript-common 29.5.0 → 29.5.2
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 +148 -228
- package/dist/isaacscript-common.lua +1682 -1711
- package/dist/src/callbackClasses.d.ts +0 -1
- package/dist/src/callbackClasses.d.ts.map +1 -1
- package/dist/src/callbackClasses.lua +0 -5
- package/dist/src/callbacks.d.ts +126 -127
- package/dist/src/callbacks.d.ts.map +1 -1
- package/dist/src/callbacks.lua +0 -1
- package/dist/src/classes/features/callbackLogic/EsauJrDetection.d.ts +1 -1
- package/dist/src/classes/features/callbackLogic/EsauJrDetection.d.ts.map +1 -1
- package/dist/src/classes/features/callbackLogic/EsauJrDetection.lua +2 -2
- package/dist/src/classes/features/callbackLogic/FlipDetection.d.ts +1 -1
- package/dist/src/classes/features/callbackLogic/FlipDetection.d.ts.map +1 -1
- package/dist/src/classes/features/callbackLogic/FlipDetection.lua +2 -2
- package/dist/src/classes/features/callbackLogic/GameReorderedCallbacks.d.ts +1 -1
- package/dist/src/classes/features/callbackLogic/GameReorderedCallbacks.d.ts.map +1 -1
- package/dist/src/classes/features/callbackLogic/GameReorderedCallbacks.lua +2 -2
- package/dist/src/classes/features/callbackLogic/PlayerCollectibleDetection.d.ts +1 -1
- package/dist/src/classes/features/callbackLogic/PlayerCollectibleDetection.d.ts.map +1 -1
- package/dist/src/classes/features/callbackLogic/PlayerCollectibleDetection.lua +2 -2
- package/dist/src/classes/features/other/PickupIndexCreation.d.ts +4 -0
- package/dist/src/classes/features/other/PickupIndexCreation.d.ts.map +1 -1
- package/dist/src/classes/features/other/PreventCollectibleRotation.d.ts +9 -3
- package/dist/src/classes/features/other/PreventCollectibleRotation.d.ts.map +1 -1
- package/dist/src/classes/features/other/PreventCollectibleRotation.lua +66 -25
- package/dist/src/enums/ModCallbackCustom.d.ts +126 -144
- package/dist/src/enums/ModCallbackCustom.d.ts.map +1 -1
- package/dist/src/enums/ModCallbackCustom.lua +126 -128
- package/dist/src/features.d.ts.map +1 -1
- package/dist/src/features.lua +2 -2
- package/dist/src/functions/collectibles.d.ts +0 -52
- package/dist/src/functions/collectibles.d.ts.map +1 -1
- package/dist/src/functions/collectibles.lua +0 -68
- package/dist/src/functions/playerIndex.d.ts +3 -3
- package/dist/src/functions/playerIndex.lua +3 -3
- package/dist/src/functions/utils.d.ts +2 -0
- package/dist/src/functions/utils.d.ts.map +1 -1
- package/dist/src/functions/utils.lua +2 -0
- package/dist/src/index.d.ts +0 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/interfaces/private/AddCallbackParametersCustom.d.ts +0 -4
- package/dist/src/interfaces/private/AddCallbackParametersCustom.d.ts.map +1 -1
- package/dist/src/shouldFire.d.ts +0 -1
- package/dist/src/shouldFire.d.ts.map +1 -1
- package/dist/src/shouldFire.lua +0 -5
- package/package.json +2 -2
- package/src/callbackClasses.ts +0 -1
- package/src/callbacks.ts +0 -1
- package/src/classes/features/callbackLogic/EsauJrDetection.ts +2 -2
- package/src/classes/features/callbackLogic/FlipDetection.ts +2 -2
- package/src/classes/features/callbackLogic/GameReorderedCallbacks.ts +2 -2
- package/src/classes/features/callbackLogic/PlayerCollectibleDetection.ts +2 -2
- package/src/classes/features/other/PickupIndexCreation.ts +4 -0
- package/src/classes/features/other/PreventCollectibleRotation.ts +108 -49
- package/src/enums/ModCallbackCustom.ts +0 -19
- package/src/features.ts +7 -5
- package/src/functions/collectibles.ts +0 -79
- package/src/functions/playerIndex.ts +3 -3
- package/src/functions/utils.ts +2 -0
- package/src/index.ts +0 -1
- package/src/interfaces/private/AddCallbackParametersCustom.ts +0 -5
- package/src/shouldFire.ts +0 -13
- package/dist/src/classes/callbacks/PostCollectibleInitFirst.d.ts +0 -15
- package/dist/src/classes/callbacks/PostCollectibleInitFirst.d.ts.map +0 -1
- package/dist/src/classes/callbacks/PostCollectibleInitFirst.lua +0 -36
- package/dist/src/types/CollectibleIndex.d.ts +0 -18
- package/dist/src/types/CollectibleIndex.d.ts.map +0 -1
- package/dist/src/types/CollectibleIndex.lua +0 -2
- package/src/classes/callbacks/PostCollectibleInitFirst.ts +0 -44
- package/src/types/CollectibleIndex.ts +0 -17
|
@@ -1,68 +1,109 @@
|
|
|
1
1
|
local ____lualib = require("lualib_bundle")
|
|
2
|
-
local Map = ____lualib.Map
|
|
3
2
|
local __TS__New = ____lualib.__TS__New
|
|
3
|
+
local Map = ____lualib.Map
|
|
4
4
|
local __TS__Class = ____lualib.__TS__Class
|
|
5
5
|
local __TS__ClassExtends = ____lualib.__TS__ClassExtends
|
|
6
6
|
local __TS__Decorate = ____lualib.__TS__Decorate
|
|
7
7
|
local ____exports = {}
|
|
8
|
-
local
|
|
8
|
+
local markRollFrame, v
|
|
9
9
|
local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
|
|
10
10
|
local CardType = ____isaac_2Dtypescript_2Ddefinitions.CardType
|
|
11
11
|
local CollectibleType = ____isaac_2Dtypescript_2Ddefinitions.CollectibleType
|
|
12
|
+
local DiceFloorSubType = ____isaac_2Dtypescript_2Ddefinitions.DiceFloorSubType
|
|
12
13
|
local ModCallback = ____isaac_2Dtypescript_2Ddefinitions.ModCallback
|
|
13
14
|
local PickupVariant = ____isaac_2Dtypescript_2Ddefinitions.PickupVariant
|
|
14
15
|
local ____cachedClasses = require("src.core.cachedClasses")
|
|
15
16
|
local game = ____cachedClasses.game
|
|
16
17
|
local ____decorators = require("src.decorators")
|
|
17
18
|
local Exported = ____decorators.Exported
|
|
19
|
+
local ____ISCFeature = require("src.enums.ISCFeature")
|
|
20
|
+
local ISCFeature = ____ISCFeature.ISCFeature
|
|
21
|
+
local ____ModCallbackCustom = require("src.enums.ModCallbackCustom")
|
|
22
|
+
local ModCallbackCustom = ____ModCallbackCustom.ModCallbackCustom
|
|
18
23
|
local ____collectibles = require("src.functions.collectibles")
|
|
19
24
|
local setCollectibleSubType = ____collectibles.setCollectibleSubType
|
|
20
25
|
local ____entities = require("src.functions.entities")
|
|
21
26
|
local getEntityID = ____entities.getEntityID
|
|
27
|
+
local ____pickupsSpecific = require("src.functions.pickupsSpecific")
|
|
28
|
+
local getCollectibles = ____pickupsSpecific.getCollectibles
|
|
22
29
|
local ____pickupVariants = require("src.functions.pickupVariants")
|
|
23
30
|
local isCollectible = ____pickupVariants.isCollectible
|
|
31
|
+
local ____types = require("src.functions.types")
|
|
32
|
+
local asCollectibleType = ____types.asCollectibleType
|
|
33
|
+
local ____ReadonlySet = require("src.types.ReadonlySet")
|
|
34
|
+
local ReadonlySet = ____ReadonlySet.ReadonlySet
|
|
24
35
|
local ____Feature = require("src.classes.private.Feature")
|
|
25
36
|
local Feature = ____Feature.Feature
|
|
26
|
-
function
|
|
27
|
-
|
|
28
|
-
local gridIndex = room:GetGridIndex(collectible.Position)
|
|
29
|
-
return (tostring(gridIndex) .. ",") .. tostring(collectible.InitSeed)
|
|
37
|
+
function markRollFrame(self)
|
|
38
|
+
v.run.rollGameFrame = game:GetFrameCount()
|
|
30
39
|
end
|
|
31
|
-
local
|
|
40
|
+
local ROLL_COLLECTIBLE_TYPES = __TS__New(ReadonlySet, {CollectibleType.D6, CollectibleType.ETERNAL_D6, CollectibleType.SPINDOWN_DICE})
|
|
41
|
+
local ROLL_FLOOR_DICE_FLOOR_SUB_TYPES = __TS__New(ReadonlySet, {DiceFloorSubType.FOUR_PIP, DiceFloorSubType.SIX_PIP})
|
|
42
|
+
v = {run = {
|
|
43
|
+
trackedCollectibles = __TS__New(Map),
|
|
44
|
+
rollGameFrame = nil
|
|
45
|
+
}}
|
|
32
46
|
____exports.PreventCollectibleRotation = __TS__Class()
|
|
33
47
|
local PreventCollectibleRotation = ____exports.PreventCollectibleRotation
|
|
34
48
|
PreventCollectibleRotation.name = "PreventCollectibleRotation"
|
|
35
49
|
__TS__ClassExtends(PreventCollectibleRotation, Feature)
|
|
36
|
-
function PreventCollectibleRotation.prototype.____constructor(self)
|
|
50
|
+
function PreventCollectibleRotation.prototype.____constructor(self, pickupIndexCreation)
|
|
37
51
|
Feature.prototype.____constructor(self)
|
|
38
52
|
self.v = v
|
|
39
|
-
self.
|
|
40
|
-
|
|
53
|
+
self.preUseItem = function(____, collectibleType)
|
|
54
|
+
if ROLL_COLLECTIBLE_TYPES:has(collectibleType) then
|
|
55
|
+
markRollFrame(nil)
|
|
56
|
+
end
|
|
57
|
+
return nil
|
|
41
58
|
end
|
|
42
|
-
self.
|
|
43
|
-
local
|
|
44
|
-
|
|
59
|
+
self.postUseCardSoulOfIsaac = function()
|
|
60
|
+
local collectibles = getCollectibles(nil)
|
|
61
|
+
for ____, collectible in ipairs(collectibles) do
|
|
62
|
+
local pickupIndex = self.pickupIndexCreation:getPickupIndex(collectible)
|
|
63
|
+
v.run.trackedCollectibles:delete(pickupIndex)
|
|
64
|
+
end
|
|
45
65
|
end
|
|
46
|
-
self.
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
return
|
|
66
|
+
self.postDiceRoomActivated = function(____, _player, diceFloorSubType)
|
|
67
|
+
if ROLL_FLOOR_DICE_FLOOR_SUB_TYPES:has(diceFloorSubType) then
|
|
68
|
+
v.run.trackedCollectibles:clear()
|
|
69
|
+
end
|
|
51
70
|
end
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
71
|
+
self.postPickupChanged = function(____, pickup, oldVariant, _oldSubType, newVariant, newSubType)
|
|
72
|
+
if oldVariant ~= PickupVariant.COLLECTIBLE or newVariant ~= PickupVariant.COLLECTIBLE then
|
|
73
|
+
return
|
|
74
|
+
end
|
|
75
|
+
if asCollectibleType(nil, newSubType) == CollectibleType.NULL then
|
|
76
|
+
return
|
|
77
|
+
end
|
|
78
|
+
local pickupIndex = self.pickupIndexCreation:getPickupIndex(pickup)
|
|
79
|
+
local trackedCollectibleType = v.run.trackedCollectibles:get(pickupIndex)
|
|
80
|
+
if trackedCollectibleType == nil then
|
|
81
|
+
return
|
|
82
|
+
end
|
|
83
|
+
local gameFrameCount = game:GetFrameCount()
|
|
84
|
+
if gameFrameCount == v.run.rollGameFrame then
|
|
85
|
+
v.run.trackedCollectibles:delete(pickupIndex)
|
|
86
|
+
return
|
|
87
|
+
end
|
|
88
|
+
if trackedCollectibleType ~= asCollectibleType(nil, newSubType) then
|
|
89
|
+
setCollectibleSubType(nil, pickup, trackedCollectibleType)
|
|
90
|
+
end
|
|
56
91
|
end
|
|
92
|
+
self.featuresUsed = {ISCFeature.PICKUP_INDEX_CREATION}
|
|
93
|
+
self.callbacksUsed = {{ModCallback.POST_USE_CARD, self.postUseCardSoulOfIsaac, {CardType.SOUL_ISAAC}}, {ModCallback.PRE_USE_ITEM, self.preUseItem}}
|
|
94
|
+
self.customCallbacksUsed = {{ModCallbackCustom.POST_DICE_ROOM_ACTIVATED, self.postDiceRoomActivated}, {ModCallbackCustom.POST_PICKUP_CHANGED, self.postPickupChanged}}
|
|
95
|
+
self.pickupIndexCreation = pickupIndexCreation
|
|
57
96
|
end
|
|
58
97
|
function PreventCollectibleRotation.prototype.preventCollectibleRotation(self, collectible, collectibleType)
|
|
59
98
|
if not isCollectible(nil, collectible) then
|
|
60
99
|
local entityID = getEntityID(nil, collectible)
|
|
61
100
|
error("The \"preventCollectibleRotate\" function was given a non-collectible: " .. entityID)
|
|
62
101
|
end
|
|
63
|
-
local
|
|
64
|
-
v.
|
|
65
|
-
|
|
102
|
+
local pickupIndex = self.pickupIndexCreation:getPickupIndex(collectible)
|
|
103
|
+
v.run.trackedCollectibles:set(pickupIndex, collectibleType)
|
|
104
|
+
if collectible.SubType ~= collectibleType then
|
|
105
|
+
setCollectibleSubType(nil, collectible, collectibleType)
|
|
106
|
+
end
|
|
66
107
|
end
|
|
67
108
|
__TS__Decorate({Exported}, PreventCollectibleRotation.prototype, "preventCollectibleRotation", true)
|
|
68
109
|
return ____exports
|