isaacscript-common 1.2.123 → 1.2.124
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/itemPickup.lua +3 -4
- package/dist/callbacks/postCursedTeleport.lua +12 -10
- package/dist/constants.d.ts +28 -1
- package/dist/constants.lua +4 -1
- package/dist/functions/map.d.ts +6 -6
- package/dist/functions/map.lua +3 -3
- package/dist/functions/trinketGive.lua +3 -3
- package/dist/functions/trinkets.lua +2 -2
- package/package.json +2 -2
|
@@ -5,8 +5,8 @@ local ____exports = {}
|
|
|
5
5
|
local hasSubscriptions, postPEffectUpdateReordered, queueEmpty, queueNotEmpty, v
|
|
6
6
|
local ____exports = require("features.saveDataManager.exports")
|
|
7
7
|
local saveDataManager = ____exports.saveDataManager
|
|
8
|
-
local
|
|
9
|
-
local
|
|
8
|
+
local ____map = require("functions.map")
|
|
9
|
+
local getDefaultMapPlayer = ____map.getDefaultMapPlayer
|
|
10
10
|
local ____DefaultMap = require("types.DefaultMap")
|
|
11
11
|
local DefaultMap = ____DefaultMap.DefaultMap
|
|
12
12
|
local ____ModCallbacksCustom = require("types.ModCallbacksCustom")
|
|
@@ -27,8 +27,7 @@ function postPEffectUpdateReordered(self, player)
|
|
|
27
27
|
if not hasSubscriptions(nil) then
|
|
28
28
|
return
|
|
29
29
|
end
|
|
30
|
-
local
|
|
31
|
-
local pickingUpItem = v.run.playerPickingUpItemMap:getAndSetDefault(playerIndex)
|
|
30
|
+
local pickingUpItem = getDefaultMapPlayer(nil, v.run.playerPickingUpItemMap, player)
|
|
32
31
|
if player:IsItemQueueEmpty() then
|
|
33
32
|
queueEmpty(nil, player, pickingUpItem)
|
|
34
33
|
else
|
|
@@ -8,8 +8,10 @@ local ____exports = require("features.saveDataManager.exports")
|
|
|
8
8
|
local saveDataManager = ____exports.saveDataManager
|
|
9
9
|
local ____flag = require("functions.flag")
|
|
10
10
|
local hasFlag = ____flag.hasFlag
|
|
11
|
+
local ____map = require("functions.map")
|
|
12
|
+
local getMapPlayer = ____map.getMapPlayer
|
|
13
|
+
local setMapPlayer = ____map.setMapPlayer
|
|
11
14
|
local ____player = require("functions.player")
|
|
12
|
-
local getPlayerIndex = ____player.getPlayerIndex
|
|
13
15
|
local getPlayerNumHitsRemaining = ____player.getPlayerNumHitsRemaining
|
|
14
16
|
local ____postCursedTeleport = require("callbacks.subscriptions.postCursedTeleport")
|
|
15
17
|
local postCursedTeleportFire = ____postCursedTeleport.postCursedTeleportFire
|
|
@@ -31,8 +33,7 @@ function setDamageFrame(self, tookDamage, damageFlags)
|
|
|
31
33
|
if player == nil then
|
|
32
34
|
return
|
|
33
35
|
end
|
|
34
|
-
local
|
|
35
|
-
local trackingArray = v.run.damageFrameMap:get(playerIndex)
|
|
36
|
+
local trackingArray = getMapPlayer(nil, v.run.playersDamageFrameMap, player)
|
|
36
37
|
if trackingArray ~= nil then
|
|
37
38
|
local lastDamageFrame, callbackFiredOnThisFrame = table.unpack(trackingArray)
|
|
38
39
|
if lastDamageFrame == gameFrameCount and callbackFiredOnThisFrame then
|
|
@@ -42,7 +43,8 @@ function setDamageFrame(self, tookDamage, damageFlags)
|
|
|
42
43
|
if isPotentialNaturalTeleportFromSacrificeRoom(nil, damageFlags) then
|
|
43
44
|
return
|
|
44
45
|
end
|
|
45
|
-
|
|
46
|
+
local newTrackingArray = {gameFrameCount, false}
|
|
47
|
+
setMapPlayer(nil, v.run.playersDamageFrameMap, player, newTrackingArray)
|
|
46
48
|
end
|
|
47
49
|
function isPotentialNaturalTeleportFromSacrificeRoom(self, damageFlags)
|
|
48
50
|
local game = Game()
|
|
@@ -65,10 +67,7 @@ function postPlayerRenderPlayer(self, player)
|
|
|
65
67
|
if not hasSubscriptions(nil) then
|
|
66
68
|
return
|
|
67
69
|
end
|
|
68
|
-
local
|
|
69
|
-
local gameFrameCount = game:GetFrameCount()
|
|
70
|
-
local playerIndex = getPlayerIndex(nil, player)
|
|
71
|
-
local trackingArray = v.run.damageFrameMap:get(playerIndex)
|
|
70
|
+
local trackingArray = getMapPlayer(nil, v.run.playersDamageFrameMap, player)
|
|
72
71
|
if trackingArray == nil then
|
|
73
72
|
return
|
|
74
73
|
end
|
|
@@ -79,7 +78,10 @@ function postPlayerRenderPlayer(self, player)
|
|
|
79
78
|
if callbackActivatedOnThisFrame then
|
|
80
79
|
return
|
|
81
80
|
end
|
|
82
|
-
|
|
81
|
+
local game = Game()
|
|
82
|
+
local gameFrameCount = game:GetFrameCount()
|
|
83
|
+
local newTrackingArray = {gameFrameCount, true}
|
|
84
|
+
setMapPlayer(nil, v.run.playersDamageFrameMap, player, newTrackingArray)
|
|
83
85
|
postCursedTeleportFire(nil, player)
|
|
84
86
|
end
|
|
85
87
|
function playerIsTeleportingFromCursedTeleport(self, player, lastDamageFrame)
|
|
@@ -102,7 +104,7 @@ function playerIsTeleportingFromCursedTeleport(self, player, lastDamageFrame)
|
|
|
102
104
|
return false
|
|
103
105
|
end
|
|
104
106
|
v = {
|
|
105
|
-
run = {
|
|
107
|
+
run = {playersDamageFrameMap = __TS__New(Map)},
|
|
106
108
|
level = {numSacrifices = 0}
|
|
107
109
|
}
|
|
108
110
|
function ____exports.postCursedTeleportCallbackInit(self, mod)
|
package/dist/constants.d.ts
CHANGED
|
@@ -63,7 +63,6 @@ export declare const FINAL_STAGE: number;
|
|
|
63
63
|
* second TMTRAINER item subtracts one from that, and so on.
|
|
64
64
|
*/
|
|
65
65
|
export declare const FIRST_GLITCHED_COLLECTIBLE_TYPE: number;
|
|
66
|
-
export declare const GOLDEN_TRINKET_SHIFT: number;
|
|
67
66
|
export declare const GRID_INDEX_CENTER_OF_1X1_ROOM = 67;
|
|
68
67
|
export declare const GAME_FRAMES_PER_SECOND = 30;
|
|
69
68
|
export declare const ISAAC_FRAMES_PER_SECOND = 60;
|
|
@@ -105,8 +104,36 @@ export declare const NUM_DIMENSIONS = 3;
|
|
|
105
104
|
export declare const SECOND_IN_MILLISECONDS = 1000;
|
|
106
105
|
export declare const MINUTE_IN_MILLISECONDS: number;
|
|
107
106
|
export declare const ONE_BY_ONE_ROOM_GRID_SIZE = 135;
|
|
107
|
+
/**
|
|
108
|
+
* In vanilla, this is part of the `PillColor` enum, but we implement it as a constant in
|
|
109
|
+
* IsaacScript since it is not a real pill color.
|
|
110
|
+
*
|
|
111
|
+
* 1 << 11
|
|
112
|
+
*/
|
|
113
|
+
export declare const PILL_GIANT_FLAG = 2048;
|
|
114
|
+
/**
|
|
115
|
+
* In vanilla, this is part of the `PillColor` enum, but we implement it as a constant in
|
|
116
|
+
* IsaacScript since it is not a real pill color.
|
|
117
|
+
*
|
|
118
|
+
* (1 << 11) - 1
|
|
119
|
+
*/
|
|
120
|
+
export declare const PILL_COLOR_MASK = 2047;
|
|
108
121
|
export declare const SINGLE_USE_ACTIVE_COLLECTIBLE_TYPES: ReadonlySet<CollectibleType>;
|
|
109
122
|
export declare const STORY_BOSSES: ReadonlySet<EntityType>;
|
|
123
|
+
/**
|
|
124
|
+
* In vanilla, this is part of the `TrinketType` enum, but we implement it as a constant in
|
|
125
|
+
* IsaacScript since it is not a real trinket type.
|
|
126
|
+
*
|
|
127
|
+
* 1 << 15
|
|
128
|
+
*/
|
|
129
|
+
export declare const TRINKET_GOLDEN_FLAG = 32768;
|
|
130
|
+
/**
|
|
131
|
+
* In vanilla, this is part of the `TrinketType` enum, but we implement it as a constant in
|
|
132
|
+
* IsaacScript since it is not a real trinket type.
|
|
133
|
+
*
|
|
134
|
+
* (1 << 15) - 1
|
|
135
|
+
*/
|
|
136
|
+
export declare const TRINKET_ID_MASK = 32767;
|
|
110
137
|
/**
|
|
111
138
|
* This is the number of draw coordinates that each heart spans on the UI in the upper left hand
|
|
112
139
|
* corner.
|
package/dist/constants.lua
CHANGED
|
@@ -79,7 +79,6 @@ ____exports.FAMILIARS_THAT_SHOOT_PLAYER_TEARS = __TS__New(Set, {
|
|
|
79
79
|
})
|
|
80
80
|
____exports.FINAL_STAGE = LevelStage.NUM_STAGES - 1
|
|
81
81
|
____exports.FIRST_GLITCHED_COLLECTIBLE_TYPE = (1 << 32) - 1
|
|
82
|
-
____exports.GOLDEN_TRINKET_SHIFT = 1 << 15
|
|
83
82
|
____exports.GRID_INDEX_CENTER_OF_1X1_ROOM = 67
|
|
84
83
|
____exports.GAME_FRAMES_PER_SECOND = 30
|
|
85
84
|
____exports.ISAAC_FRAMES_PER_SECOND = 60
|
|
@@ -104,6 +103,8 @@ ____exports.NUM_DIMENSIONS = 3
|
|
|
104
103
|
____exports.SECOND_IN_MILLISECONDS = 1000
|
|
105
104
|
____exports.MINUTE_IN_MILLISECONDS = 60 * ____exports.SECOND_IN_MILLISECONDS
|
|
106
105
|
____exports.ONE_BY_ONE_ROOM_GRID_SIZE = 135
|
|
106
|
+
____exports.PILL_GIANT_FLAG = 2048
|
|
107
|
+
____exports.PILL_COLOR_MASK = 2047
|
|
107
108
|
____exports.SINGLE_USE_ACTIVE_COLLECTIBLE_TYPES = __TS__New(Set, {
|
|
108
109
|
CollectibleType.COLLECTIBLE_FORGET_ME_NOW,
|
|
109
110
|
CollectibleType.COLLECTIBLE_EDENS_SOUL,
|
|
@@ -129,5 +130,7 @@ ____exports.STORY_BOSSES = __TS__New(Set, {
|
|
|
129
130
|
EntityType.ENTITY_DOGMA,
|
|
130
131
|
EntityType.ENTITY_BEAST
|
|
131
132
|
})
|
|
133
|
+
____exports.TRINKET_GOLDEN_FLAG = 32768
|
|
134
|
+
____exports.TRINKET_ID_MASK = 32767
|
|
132
135
|
____exports.UI_HEART_WIDTH = 12
|
|
133
136
|
return ____exports
|
package/dist/functions/map.d.ts
CHANGED
|
@@ -5,16 +5,16 @@ import { PlayerIndex } from "../types/PlayerIndex";
|
|
|
5
5
|
export declare function copyMap<K, V>(oldMap: Map<K, V>): Map<K, V>;
|
|
6
6
|
/**
|
|
7
7
|
* Helper function to make using default maps with an index of `PlayerIndex` easier. Use this
|
|
8
|
-
* instead of the `DefaultMap.getAndSetDefault` method.
|
|
8
|
+
* instead of the `DefaultMap.getAndSetDefault` method if you have a default map of this type.
|
|
9
9
|
*/
|
|
10
|
-
export declare function
|
|
10
|
+
export declare function getDefaultMapPlayer<V>(map: DefaultMap<PlayerIndex, V>, player: EntityPlayer): V;
|
|
11
11
|
/**
|
|
12
12
|
* Helper function to make using maps with an index of `PlayerIndex` easier. Use this instead of the
|
|
13
|
-
* `Map.get` method.
|
|
13
|
+
* `Map.get` method if you have a map of this type.
|
|
14
14
|
*/
|
|
15
|
-
export declare function
|
|
15
|
+
export declare function getMapPlayer<V>(map: Map<PlayerIndex, V>, player: EntityPlayer): V | undefined;
|
|
16
16
|
/**
|
|
17
17
|
* Helper function to make using maps with an index of `PlayerIndex` easier. Use this instead of the
|
|
18
|
-
* `Map.set` method.
|
|
18
|
+
* `Map.set` method if you have a map of this type.
|
|
19
19
|
*/
|
|
20
|
-
export declare function
|
|
20
|
+
export declare function setMapPlayer<V>(map: Map<PlayerIndex, V>, player: EntityPlayer, value: V): void;
|
package/dist/functions/map.lua
CHANGED
|
@@ -15,15 +15,15 @@ function ____exports.copyMap(self, oldMap)
|
|
|
15
15
|
end
|
|
16
16
|
return newMap
|
|
17
17
|
end
|
|
18
|
-
function ____exports.
|
|
18
|
+
function ____exports.getDefaultMapPlayer(self, map, player)
|
|
19
19
|
local playerIndex = getPlayerIndex(nil, player)
|
|
20
20
|
return map:getAndSetDefault(playerIndex)
|
|
21
21
|
end
|
|
22
|
-
function ____exports.
|
|
22
|
+
function ____exports.getMapPlayer(self, map, player)
|
|
23
23
|
local playerIndex = getPlayerIndex(nil, player)
|
|
24
24
|
return map:get(playerIndex)
|
|
25
25
|
end
|
|
26
|
-
function ____exports.
|
|
26
|
+
function ____exports.setMapPlayer(self, map, player, value)
|
|
27
27
|
local playerIndex = getPlayerIndex(nil, player)
|
|
28
28
|
map:set(playerIndex, value)
|
|
29
29
|
end
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
2
|
local ____exports = {}
|
|
3
3
|
local ____constants = require("constants")
|
|
4
|
-
local
|
|
4
|
+
local TRINKET_GOLDEN_FLAG = ____constants.TRINKET_GOLDEN_FLAG
|
|
5
5
|
local ____player = require("functions.player")
|
|
6
6
|
local useActiveItemTemp = ____player.useActiveItemTemp
|
|
7
7
|
local ____utils = require("functions.utils")
|
|
@@ -18,11 +18,11 @@ function ____exports.temporarilyRemoveTrinket(self, player, trinketType)
|
|
|
18
18
|
numTrinkets = numTrinkets + 1
|
|
19
19
|
end
|
|
20
20
|
local numSmeltedTrinkets = numTrinkets
|
|
21
|
-
local trinketWasInSlot1 = trinket1 == trinketType or trinket1 +
|
|
21
|
+
local trinketWasInSlot1 = trinket1 == trinketType or trinket1 + TRINKET_GOLDEN_FLAG == trinketType
|
|
22
22
|
if trinketWasInSlot1 then
|
|
23
23
|
numSmeltedTrinkets = numSmeltedTrinkets - 1
|
|
24
24
|
end
|
|
25
|
-
local trinketWasInSlot2 = trinket2 == trinketType or trinket2 +
|
|
25
|
+
local trinketWasInSlot2 = trinket2 == trinketType or trinket2 + TRINKET_GOLDEN_FLAG == trinketType
|
|
26
26
|
if trinketWasInSlot2 then
|
|
27
27
|
numSmeltedTrinkets = numSmeltedTrinkets - 1
|
|
28
28
|
end
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
2
|
local ____exports = {}
|
|
3
3
|
local ____constants = require("constants")
|
|
4
|
-
local
|
|
4
|
+
local TRINKET_GOLDEN_FLAG = ____constants.TRINKET_GOLDEN_FLAG
|
|
5
5
|
local ____trinketDescriptionMap = require("maps.trinketDescriptionMap")
|
|
6
6
|
local TRINKET_DESCRIPTION_MAP = ____trinketDescriptionMap.TRINKET_DESCRIPTION_MAP
|
|
7
7
|
local ____trinketNameMap = require("maps.trinketNameMap")
|
|
@@ -83,7 +83,7 @@ function ____exports.hasOpenTrinketSlot(self, player)
|
|
|
83
83
|
return openTrinketSlot ~= nil
|
|
84
84
|
end
|
|
85
85
|
function ____exports.isGoldenTrinket(self, trinketType)
|
|
86
|
-
return trinketType >
|
|
86
|
+
return trinketType > TRINKET_GOLDEN_FLAG
|
|
87
87
|
end
|
|
88
88
|
function ____exports.smeltTrinket(self, player, trinketType, numTrinkets)
|
|
89
89
|
if numTrinkets == nil then
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "isaacscript-common",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.124",
|
|
4
4
|
"description": "Helper functions for IsaacScript mods",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"isaac",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
],
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@zamiell/typescript-to-lua": "^1.4.2",
|
|
29
|
-
"isaac-typescript-definitions": "^1.0.
|
|
29
|
+
"isaac-typescript-definitions": "^1.0.361",
|
|
30
30
|
"isaacscript-lint": "^1.0.84",
|
|
31
31
|
"isaacscript-tsconfig": "^1.1.8",
|
|
32
32
|
"typedoc": "^0.22.13",
|