isaacscript-common 1.2.47 → 1.2.50
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/postPlayerChangeHealth.lua +6 -5
- package/dist/callbacks/postPlayerChangeType.lua +1 -1
- package/dist/callbacks/subscriptions/postPlayerChangeType.d.ts +1 -1
- package/dist/callbacks/subscriptions/postPlayerChangeType.lua +2 -2
- package/dist/features/saveDataManager/main.lua +2 -2
- package/dist/features/saveDataManager/merge.lua +2 -2
- package/dist/functions/player.d.ts +7 -7
- package/dist/functions/table.d.ts +1 -1
- package/dist/functions/table.lua +1 -1
- package/dist/types/CallbackParametersCustom.d.ts +2 -2
- package/package.json +1 -1
|
@@ -26,14 +26,15 @@ function postPEffectUpdateReordered(self, player)
|
|
|
26
26
|
return
|
|
27
27
|
end
|
|
28
28
|
local playerIndex = getPlayerIndex(nil, player)
|
|
29
|
-
local
|
|
30
|
-
if
|
|
31
|
-
|
|
29
|
+
local playerHealthMap = v.run.playersHealthMap:get(playerIndex)
|
|
30
|
+
if playerHealthMap == nil then
|
|
31
|
+
playerHealthMap = __TS__New(Map)
|
|
32
32
|
end
|
|
33
33
|
local healthTypes = getEnumValues(nil, HealthType)
|
|
34
34
|
for ____, healthType in ipairs(healthTypes) do
|
|
35
|
-
local storedHealthValue =
|
|
35
|
+
local storedHealthValue = playerHealthMap:get(healthType)
|
|
36
36
|
local currentHealthValue = getCurrentHealthValue(nil, player, healthType)
|
|
37
|
+
playerHealthMap:set(healthType, currentHealthValue)
|
|
37
38
|
if storedHealthValue ~= nil and storedHealthValue ~= currentHealthValue then
|
|
38
39
|
local amount = currentHealthValue - storedHealthValue
|
|
39
40
|
postPlayerChangeHealthFire(nil, player, healthType, amount)
|
|
@@ -98,7 +99,7 @@ function getCurrentHealthValue(self, player, healthType)
|
|
|
98
99
|
end
|
|
99
100
|
until true
|
|
100
101
|
end
|
|
101
|
-
v = {run = {
|
|
102
|
+
v = {run = {playersHealthMap = __TS__New(Map)}}
|
|
102
103
|
function ____exports.postPlayerChangeHealthCallbackInit(self, mod)
|
|
103
104
|
saveDataManager(nil, "postPlayerChangeHealth", v, hasSubscriptions)
|
|
104
105
|
mod:AddCallbackCustom(ModCallbacksCustom.MC_POST_PEFFECT_UPDATE_REORDERED, postPEffectUpdateReordered)
|
|
@@ -29,7 +29,7 @@ function postPEffectUpdateReordered(self, player)
|
|
|
29
29
|
end
|
|
30
30
|
if character ~= storedCharacter then
|
|
31
31
|
v.run.characterMap:set(playerIndex, character)
|
|
32
|
-
postPlayerChangeTypeFire(nil, player, character)
|
|
32
|
+
postPlayerChangeTypeFire(nil, player, storedCharacter, character)
|
|
33
33
|
end
|
|
34
34
|
end
|
|
35
35
|
v = {run = {characterMap = __TS__New(Map)}}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/// <reference types="isaac-typescript-definitions" />
|
|
2
|
-
export declare type PostPlayerChangeTypeCallbackType = (player: EntityPlayer,
|
|
2
|
+
export declare type PostPlayerChangeTypeCallbackType = (player: EntityPlayer, oldCharacter: PlayerType | int, newCharacter: PlayerType | int) => void;
|
|
@@ -9,10 +9,10 @@ end
|
|
|
9
9
|
function ____exports.postPlayerChangeTypeRegister(self, callback)
|
|
10
10
|
__TS__ArrayPush(subscriptions, {callback})
|
|
11
11
|
end
|
|
12
|
-
function ____exports.postPlayerChangeTypeFire(self, player,
|
|
12
|
+
function ____exports.postPlayerChangeTypeFire(self, player, oldCharacter, newCharacter)
|
|
13
13
|
for ____, ____value in ipairs(subscriptions) do
|
|
14
14
|
local callback = ____value[1]
|
|
15
|
-
callback(nil, player,
|
|
15
|
+
callback(nil, player, oldCharacter, newCharacter)
|
|
16
16
|
end
|
|
17
17
|
end
|
|
18
18
|
return ____exports
|
|
@@ -9,7 +9,7 @@ local ____deepCopy = require("functions.deepCopy")
|
|
|
9
9
|
local deepCopy = ____deepCopy.deepCopy
|
|
10
10
|
local SerializationType = ____deepCopy.SerializationType
|
|
11
11
|
local ____table = require("functions.table")
|
|
12
|
-
local
|
|
12
|
+
local clearTable = ____table.clearTable
|
|
13
13
|
local ____ModCallbacksCustom = require("types.ModCallbacksCustom")
|
|
14
14
|
local ModCallbacksCustom = ____ModCallbacksCustom.ModCallbacksCustom
|
|
15
15
|
local ____SaveData = require("types.SaveData")
|
|
@@ -85,7 +85,7 @@ function restoreDefaults(self, childTableName)
|
|
|
85
85
|
end
|
|
86
86
|
end
|
|
87
87
|
function clearAndCopyAllElements(self, oldTable, newTable)
|
|
88
|
-
|
|
88
|
+
clearTable(nil, oldTable)
|
|
89
89
|
for key, value in pairs(newTable) do
|
|
90
90
|
oldTable[key] = value
|
|
91
91
|
end
|
|
@@ -21,7 +21,7 @@ local SerializationType = ____deepCopy.SerializationType
|
|
|
21
21
|
local ____log = require("functions.log")
|
|
22
22
|
local log = ____log.log
|
|
23
23
|
local ____table = require("functions.table")
|
|
24
|
-
local
|
|
24
|
+
local clearTable = ____table.clearTable
|
|
25
25
|
function ____exports.merge(self, oldObject, newTable, traversalDescription)
|
|
26
26
|
local oldObjectType = type(oldObject)
|
|
27
27
|
if oldObjectType ~= "table" then
|
|
@@ -48,7 +48,7 @@ function mergeArray(self, oldObject, newTable)
|
|
|
48
48
|
if not isArray(nil, oldArray) or not isArray(nil, newTable) then
|
|
49
49
|
return false
|
|
50
50
|
end
|
|
51
|
-
|
|
51
|
+
clearTable(nil, oldArray)
|
|
52
52
|
for key, value in pairs(newTable) do
|
|
53
53
|
oldArray[key] = value
|
|
54
54
|
end
|
|
@@ -25,26 +25,26 @@ export declare function anyPlayerHasTrinket(trinketType: TrinketType | int): boo
|
|
|
25
25
|
* This function is variadic, meaning that you can supply as many characters as you want to check
|
|
26
26
|
* for. Returns true if any of the characters supplied are present.
|
|
27
27
|
*/
|
|
28
|
-
export declare function anyPlayerIs(...matchingCharacters: PlayerType
|
|
28
|
+
export declare function anyPlayerIs(...matchingCharacters: Array<PlayerType | int>): boolean;
|
|
29
29
|
/**
|
|
30
30
|
* Helper function to determine if the provided character can have red heart containers. Returns
|
|
31
31
|
* true for characters like Isaac, Magdalene, or Cain. Returns true for Keeper and Tainted Keeper,
|
|
32
32
|
* even though coin containers are not technically the same as red heart containers. Returns false
|
|
33
33
|
* for characters like Blue Baby. Returns false for The Lost and Tainted Lost.
|
|
34
34
|
*/
|
|
35
|
-
export declare function characterCanHaveRedHearts(character: PlayerType): boolean;
|
|
35
|
+
export declare function characterCanHaveRedHearts(character: PlayerType | int): boolean;
|
|
36
36
|
/**
|
|
37
37
|
* Helper function to determine if the provided character can have soul hearts. Returns true for
|
|
38
38
|
* characters like Isaac, Magdalene, or Cain. Returns false for characters like Bethany. Returns
|
|
39
39
|
* false for The Lost and Tainted Lost.
|
|
40
40
|
*/
|
|
41
|
-
export declare function characterCanHaveSoulHearts(character: PlayerType): boolean;
|
|
41
|
+
export declare function characterCanHaveSoulHearts(character: PlayerType | int): boolean;
|
|
42
42
|
/**
|
|
43
43
|
* Normally, characters get a red heart container upon reaching a new floor with an eternal heart,
|
|
44
44
|
* but some characters grant a black heart instead. Returns true for Dark Judas and Tainted Judas.
|
|
45
45
|
* Otherwise, returns false.
|
|
46
46
|
*/
|
|
47
|
-
export declare function characterGetsBlackHeartFromEternalHeart(character: PlayerType): boolean;
|
|
47
|
+
export declare function characterGetsBlackHeartFromEternalHeart(character: PlayerType | int): boolean;
|
|
48
48
|
/**
|
|
49
49
|
* Helper function to get how long Azazel's Brimstone laser should be. You can pass either an
|
|
50
50
|
* `EntityPlayer` object or a tear height stat.
|
|
@@ -86,7 +86,7 @@ export declare function getPlayerAvailableHeartSlots(player: EntityPlayer): int;
|
|
|
86
86
|
* but with Keeper it is 3, with Tainted Keeper it is 2. Does not account for Birthright or Mother's
|
|
87
87
|
* Kiss; use the `getPlayerMaxHeartContainers()` function for that.
|
|
88
88
|
*/
|
|
89
|
-
export declare function getCharacterMaxHeartContainers(character: PlayerType): int;
|
|
89
|
+
export declare function getCharacterMaxHeartContainers(character: PlayerType | int): int;
|
|
90
90
|
/** Helper function to get an array containing the characters of all of the current players. */
|
|
91
91
|
export declare function getCharacters(): number[];
|
|
92
92
|
/**
|
|
@@ -170,7 +170,7 @@ export declare function getPlayers(performExclusions?: boolean): EntityPlayer[];
|
|
|
170
170
|
* This function is variadic, meaning that you can supply as many characters as you want to check
|
|
171
171
|
* for. Returns true if any of the characters supplied are present.
|
|
172
172
|
*/
|
|
173
|
-
export declare function getPlayersOfType(...characters: PlayerType
|
|
173
|
+
export declare function getPlayersOfType(...characters: Array<PlayerType | int>): EntityPlayer[];
|
|
174
174
|
/**
|
|
175
175
|
* Helper function to return the active charge and the battery charge combined. This is useful
|
|
176
176
|
* because you are not able to set the battery charge directly.
|
|
@@ -203,7 +203,7 @@ export declare function isBethany(player: EntityPlayer): boolean;
|
|
|
203
203
|
*/
|
|
204
204
|
export declare function isChildPlayer(player: EntityPlayer): boolean;
|
|
205
205
|
/** Uses the player's current health and character to determine if incoming damage will be fatal. */
|
|
206
|
-
export declare function isDamageToPlayerFatal(player: EntityPlayer, damageAmount: int, damageSource: EntityRef, lastDamageFrame
|
|
206
|
+
export declare function isDamageToPlayerFatal(player: EntityPlayer, damageAmount: int, damageSource: EntityRef, lastDamageFrame?: int): boolean;
|
|
207
207
|
export declare function isFirstPlayer(player: EntityPlayer): boolean;
|
|
208
208
|
/**
|
|
209
209
|
* Helper function for detecting when a player is Jacob or Esau. This will only match the
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* In a Map, you can use the `clear` method to delete every element. However, in a LuaTable, the
|
|
4
4
|
* `clear` method does not exist. Use this helper function as a drop-in replacement for this.
|
|
5
5
|
*/
|
|
6
|
-
export declare function
|
|
6
|
+
export declare function clearTable(table: LuaTable): void;
|
package/dist/functions/table.lua
CHANGED
|
@@ -63,7 +63,7 @@ export interface CallbackParametersCustom {
|
|
|
63
63
|
];
|
|
64
64
|
[ModCallbacksCustom.MC_POST_PEFFECT_UPDATE_REORDERED]: [
|
|
65
65
|
callback: PostPEffectUpdateReorderedCallbackType,
|
|
66
|
-
character?: PlayerType
|
|
66
|
+
character?: PlayerType | int
|
|
67
67
|
];
|
|
68
68
|
[ModCallbacksCustom.MC_POST_PLAYER_UPDATE_REORDERED]: [
|
|
69
69
|
callback: PostPlayerUpdateReorderedCallbackType,
|
|
@@ -115,7 +115,7 @@ export interface CallbackParametersCustom {
|
|
|
115
115
|
];
|
|
116
116
|
[ModCallbacksCustom.MC_POST_NPC_INIT_LATE]: [
|
|
117
117
|
callback: PostNPCInitLateCallbackType,
|
|
118
|
-
entityType?: EntityType
|
|
118
|
+
entityType?: EntityType | int
|
|
119
119
|
];
|
|
120
120
|
[ModCallbacksCustom.MC_POST_EFFECT_INIT_LATE]: [
|
|
121
121
|
callback: PostEffectInitLateCallbackType,
|