isaacscript-common 1.2.113 → 1.2.116
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.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
2
|
local ____exports = {}
|
|
3
|
-
local hasSubscriptions, postRender,
|
|
3
|
+
local hasSubscriptions, postRender, postPEffectUpdateReordered, checkWaitingForItemAnimation, postPlayerFatalDamage, preBerserkDeath, playerIsAboutToDie, CustomReviveState, v
|
|
4
4
|
local ____exports = require("features.saveDataManager.exports")
|
|
5
5
|
local saveDataManager = ____exports.saveDataManager
|
|
6
6
|
local ____collectibles = require("functions.collectibles")
|
|
@@ -27,15 +27,6 @@ function postRender(self)
|
|
|
27
27
|
local sfx = SFXManager()
|
|
28
28
|
sfx:Stop(SoundEffect.SOUND_1UP)
|
|
29
29
|
end
|
|
30
|
-
function postNewRoom(self)
|
|
31
|
-
if v.run.state == CustomReviveState.CHANGING_ROOMS then
|
|
32
|
-
v.run.state = CustomReviveState.WAITING_FOR_ITEM_ANIMATION
|
|
33
|
-
elseif v.run.state == CustomReviveState.WAITING_FOR_ITEM_ANIMATION then
|
|
34
|
-
v.run.state = CustomReviveState.DISABLED
|
|
35
|
-
v.run.revivalType = nil
|
|
36
|
-
v.run.dyingPlayerIndex = nil
|
|
37
|
-
end
|
|
38
|
-
end
|
|
39
30
|
function postPEffectUpdateReordered(self, player)
|
|
40
31
|
checkWaitingForItemAnimation(nil, player)
|
|
41
32
|
end
|
|
@@ -85,7 +76,7 @@ function playerIsAboutToDie(self, player)
|
|
|
85
76
|
if revivalType == nil then
|
|
86
77
|
return
|
|
87
78
|
end
|
|
88
|
-
v.run.state = CustomReviveState.
|
|
79
|
+
v.run.state = CustomReviveState.WAITING_FOR_ITEM_ANIMATION
|
|
89
80
|
v.run.revivalType = revivalType
|
|
90
81
|
v.run.dyingPlayerIndex = getPlayerIndex(nil, player)
|
|
91
82
|
player:AddCollectible(CollectibleType.COLLECTIBLE_1UP, 0, false)
|
|
@@ -95,15 +86,12 @@ end
|
|
|
95
86
|
CustomReviveState = CustomReviveState or ({})
|
|
96
87
|
CustomReviveState.DISABLED = 0
|
|
97
88
|
CustomReviveState[CustomReviveState.DISABLED] = "DISABLED"
|
|
98
|
-
CustomReviveState.
|
|
99
|
-
CustomReviveState[CustomReviveState.CHANGING_ROOMS] = "CHANGING_ROOMS"
|
|
100
|
-
CustomReviveState.WAITING_FOR_ITEM_ANIMATION = 2
|
|
89
|
+
CustomReviveState.WAITING_FOR_ITEM_ANIMATION = 1
|
|
101
90
|
CustomReviveState[CustomReviveState.WAITING_FOR_ITEM_ANIMATION] = "WAITING_FOR_ITEM_ANIMATION"
|
|
102
91
|
v = {run = {state = CustomReviveState.DISABLED, revivalType = nil, dyingPlayerIndex = nil}}
|
|
103
92
|
function ____exports.customReviveCallbacksInit(self, mod)
|
|
104
93
|
saveDataManager(nil, "customRevive", v, hasSubscriptions)
|
|
105
94
|
mod:AddCallback(ModCallbacks.MC_POST_RENDER, postRender)
|
|
106
|
-
mod:AddCallback(ModCallbacks.MC_POST_NEW_ROOM, postNewRoom)
|
|
107
95
|
mod:AddCallbackCustom(ModCallbacksCustom.MC_POST_PEFFECT_UPDATE_REORDERED, postPEffectUpdateReordered)
|
|
108
96
|
mod:AddCallbackCustom(ModCallbacksCustom.MC_POST_PLAYER_FATAL_DAMAGE, postPlayerFatalDamage)
|
|
109
97
|
mod:AddCallbackCustom(ModCallbacksCustom.MC_PRE_BERSERK_DEATH, preBerserkDeath)
|
package/dist/functions/log.d.ts
CHANGED
|
@@ -38,6 +38,7 @@ export declare function logColor(this: void, color: Color): void;
|
|
|
38
38
|
export declare function logEntity(this: void, entity: Entity): void;
|
|
39
39
|
export declare function logKColor(this: void, kColor: KColor): void;
|
|
40
40
|
export declare function logMap(this: void, map: Map<AnyNotNil, unknown>): void;
|
|
41
|
+
export declare function logPlayerHealth(this: void, player: EntityPlayer): void;
|
|
41
42
|
/** Helper function for printing out information about the current room. */
|
|
42
43
|
export declare function logRoom(this: void): void;
|
|
43
44
|
export declare function logTable(this: void, table: unknown, parentTables?: number): void;
|
package/dist/functions/log.lua
CHANGED
|
@@ -14,6 +14,9 @@ local ____flag = require("functions.flag")
|
|
|
14
14
|
local hasFlag = ____flag.hasFlag
|
|
15
15
|
local ____player = require("functions.player")
|
|
16
16
|
local getEffectsList = ____player.getEffectsList
|
|
17
|
+
local getPlayerName = ____player.getPlayerName
|
|
18
|
+
local ____playerHealth = require("functions.playerHealth")
|
|
19
|
+
local getPlayerHealth = ____playerHealth.getPlayerHealth
|
|
17
20
|
local ____rooms = require("functions.rooms")
|
|
18
21
|
local getRoomData = ____rooms.getRoomData
|
|
19
22
|
local getRoomGridIndex = ____rooms.getRoomGridIndex
|
|
@@ -130,6 +133,22 @@ function ____exports.logMap(map)
|
|
|
130
133
|
end
|
|
131
134
|
____exports.log("The size of the map was: " .. tostring(map.size))
|
|
132
135
|
end
|
|
136
|
+
function ____exports.logPlayerHealth(player)
|
|
137
|
+
local playerName = getPlayerName(nil, player)
|
|
138
|
+
local playerHealth = getPlayerHealth(nil, player)
|
|
139
|
+
____exports.log(("Player health for " .. playerName) .. ":")
|
|
140
|
+
____exports.log(" Max hearts: " .. tostring(playerHealth.maxHearts))
|
|
141
|
+
____exports.log(" Hearts: " .. tostring(playerHealth.hearts))
|
|
142
|
+
____exports.log(" Eternal hearts: " .. tostring(playerHealth.eternalHearts))
|
|
143
|
+
____exports.log(" Soul hearts: " .. tostring(playerHealth.soulHearts))
|
|
144
|
+
____exports.log(" Bone hearts: " .. tostring(playerHealth.boneHearts))
|
|
145
|
+
____exports.log(" Golden hearts: " .. tostring(playerHealth.goldenHearts))
|
|
146
|
+
____exports.log(" Rotten hearts: " .. tostring(playerHealth.rottenHearts))
|
|
147
|
+
____exports.log(" Broken hearts: " .. tostring(playerHealth.brokenHearts))
|
|
148
|
+
____exports.log(" Soul charges: " .. tostring(playerHealth.soulCharges))
|
|
149
|
+
____exports.log(" Blood charges: " .. tostring(playerHealth.bloodCharges))
|
|
150
|
+
____exports.log((" Soul heart types: [" .. table.concat(playerHealth.soulHeartTypes, "," or ",")) .. "]")
|
|
151
|
+
end
|
|
133
152
|
function ____exports.logRoom()
|
|
134
153
|
local roomGridIndex = getRoomGridIndex(nil)
|
|
135
154
|
local roomListIndex = getRoomListIndex(nil)
|
|
@@ -5,6 +5,10 @@ local __TS__ArrayForEach = ____lualib.__TS__ArrayForEach
|
|
|
5
5
|
local ____exports = {}
|
|
6
6
|
local ____constants = require("constants")
|
|
7
7
|
local MAX_PLAYER_HEART_CONTAINERS = ____constants.MAX_PLAYER_HEART_CONTAINERS
|
|
8
|
+
local ____player = require("functions.player")
|
|
9
|
+
local getHearts = ____player.getHearts
|
|
10
|
+
local ____utils = require("functions.utils")
|
|
11
|
+
local ____repeat = ____utils["repeat"]
|
|
8
12
|
function ____exports.removeAllPlayerHealth(self, player)
|
|
9
13
|
local character = player:GetPlayerType()
|
|
10
14
|
local goldenHearts = player:GetGoldenHearts()
|
|
@@ -29,7 +33,7 @@ function ____exports.getPlayerHealth(self, player)
|
|
|
29
33
|
local character = player:GetPlayerType()
|
|
30
34
|
local soulHeartTypes = {}
|
|
31
35
|
local maxHearts = player:GetMaxHearts()
|
|
32
|
-
local hearts = player
|
|
36
|
+
local hearts = getHearts(nil, player)
|
|
33
37
|
local soulHearts = player:GetSoulHearts()
|
|
34
38
|
local boneHearts = player:GetBoneHearts()
|
|
35
39
|
local goldenHearts = player:GetGoldenHearts()
|
|
@@ -47,7 +51,6 @@ function ____exports.getPlayerHealth(self, player)
|
|
|
47
51
|
maxHearts = subPlayer:GetBoneHearts() * 2
|
|
48
52
|
hearts = subPlayer:GetHearts()
|
|
49
53
|
end
|
|
50
|
-
hearts = hearts - rottenHearts * 2
|
|
51
54
|
local extraHearts = math.ceil(soulHearts / 2) + boneHearts
|
|
52
55
|
local currentSoulHeart = 0
|
|
53
56
|
do
|
|
@@ -75,7 +78,6 @@ function ____exports.getPlayerHealth(self, player)
|
|
|
75
78
|
end
|
|
76
79
|
end
|
|
77
80
|
return {
|
|
78
|
-
soulHeartTypes = soulHeartTypes,
|
|
79
81
|
maxHearts = maxHearts,
|
|
80
82
|
hearts = hearts,
|
|
81
83
|
eternalHearts = eternalHearts,
|
|
@@ -85,12 +87,14 @@ function ____exports.getPlayerHealth(self, player)
|
|
|
85
87
|
rottenHearts = rottenHearts,
|
|
86
88
|
brokenHearts = brokenHearts,
|
|
87
89
|
soulCharges = soulCharges,
|
|
88
|
-
bloodCharges = bloodCharges
|
|
90
|
+
bloodCharges = bloodCharges,
|
|
91
|
+
soulHeartTypes = soulHeartTypes
|
|
89
92
|
}
|
|
90
93
|
end
|
|
91
94
|
function ____exports.setPlayerHealth(self, player, playerHealth)
|
|
92
95
|
local character = player:GetPlayerType()
|
|
93
96
|
local subPlayer = player:GetSubPlayer()
|
|
97
|
+
local isTaintedMagdalene = character == PlayerType.PLAYER_MAGDALENE_B
|
|
94
98
|
____exports.removeAllPlayerHealth(nil, player)
|
|
95
99
|
if character == PlayerType.PLAYER_THESOUL and subPlayer ~= nil then
|
|
96
100
|
subPlayer:AddMaxHearts(playerHealth.maxHearts, false)
|
|
@@ -119,7 +123,16 @@ function ____exports.setPlayerHealth(self, player, playerHealth)
|
|
|
119
123
|
end
|
|
120
124
|
)
|
|
121
125
|
player:AddRottenHearts(playerHealth.rottenHearts)
|
|
122
|
-
|
|
126
|
+
____repeat(
|
|
127
|
+
nil,
|
|
128
|
+
playerHealth.hearts,
|
|
129
|
+
function()
|
|
130
|
+
player:AddHearts(1)
|
|
131
|
+
if isTaintedMagdalene then
|
|
132
|
+
player:AddHearts(-1)
|
|
133
|
+
end
|
|
134
|
+
end
|
|
135
|
+
)
|
|
123
136
|
player:AddGoldenHearts(playerHealth.goldenHearts)
|
|
124
137
|
player:AddBrokenHearts(playerHealth.brokenHearts)
|
|
125
138
|
if character == PlayerType.PLAYER_BETHANY then
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/// <reference types="isaac-typescript-definitions" />
|
|
2
2
|
export interface PlayerHealth {
|
|
3
|
-
soulHeartTypes: HeartSubType[];
|
|
4
3
|
maxHearts: int;
|
|
5
4
|
hearts: int;
|
|
6
5
|
eternalHearts: int;
|
|
@@ -11,4 +10,5 @@ export interface PlayerHealth {
|
|
|
11
10
|
brokenHearts: int;
|
|
12
11
|
soulCharges: int;
|
|
13
12
|
bloodCharges: int;
|
|
13
|
+
soulHeartTypes: HeartSubType[];
|
|
14
14
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "isaacscript-common",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.116",
|
|
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.359",
|
|
30
30
|
"isaacscript-lint": "^1.0.84",
|
|
31
31
|
"isaacscript-tsconfig": "^1.1.8",
|
|
32
32
|
"typedoc": "^0.22.13",
|