isaacscript-common 1.0.535 → 1.0.536
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,8 +1,12 @@
|
|
|
1
1
|
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
|
+
require("lualib_bundle");
|
|
2
3
|
local ____exports = {}
|
|
3
|
-
local hasSubscriptions, entityTakeDmgPlayer, damageIsFatal
|
|
4
|
+
local hasSubscriptions, entityTakeDmgPlayer, damageIsFatal, v
|
|
5
|
+
local ____exports = require("features.saveDataManager.exports")
|
|
6
|
+
local saveDataManager = ____exports.saveDataManager
|
|
4
7
|
local ____player = require("functions.player")
|
|
5
8
|
local getPlayerAvailableHeartSlots = ____player.getPlayerAvailableHeartSlots
|
|
9
|
+
local getPlayerIndex = ____player.getPlayerIndex
|
|
6
10
|
local getPlayerNumAllHearts = ____player.getPlayerNumAllHearts
|
|
7
11
|
local hasLostCurse = ____player.hasLostCurse
|
|
8
12
|
local isChildPlayer = ____player.isChildPlayer
|
|
@@ -28,10 +32,15 @@ function entityTakeDmgPlayer(self, tookDamage, damageAmount, _damageFlags, _dama
|
|
|
28
32
|
if isChildPlayer(nil, player) then
|
|
29
33
|
return nil
|
|
30
34
|
end
|
|
35
|
+
local game = Game()
|
|
36
|
+
local gameFrameCount = game:GetFrameCount()
|
|
37
|
+
local playerIndex = getPlayerIndex(nil, player)
|
|
38
|
+
local lastDamageFrame = v.run.playerLastDamageFrame:get(playerIndex)
|
|
39
|
+
v.run.playerLastDamageFrame:set(playerIndex, gameFrameCount)
|
|
31
40
|
if willPlayerRevive(nil, player) then
|
|
32
41
|
return nil
|
|
33
42
|
end
|
|
34
|
-
if (not damageIsFatal(nil, player, damageAmount)) and (not hasLostCurse(nil, player)) then
|
|
43
|
+
if (not damageIsFatal(nil, player, damageAmount, lastDamageFrame)) and (not hasLostCurse(nil, player)) then
|
|
35
44
|
return nil
|
|
36
45
|
end
|
|
37
46
|
local shouldSustainDeath = postPlayerFatalDamageFire(nil, player)
|
|
@@ -40,7 +49,9 @@ function entityTakeDmgPlayer(self, tookDamage, damageAmount, _damageFlags, _dama
|
|
|
40
49
|
end
|
|
41
50
|
return nil
|
|
42
51
|
end
|
|
43
|
-
function damageIsFatal(self, player, damageAmount)
|
|
52
|
+
function damageIsFatal(self, player, damageAmount, lastDamageFrame)
|
|
53
|
+
local game = Game()
|
|
54
|
+
local gameFrameCount = game:GetFrameCount()
|
|
44
55
|
local character = player:GetPlayerType()
|
|
45
56
|
if character == PlayerType.PLAYER_JACOB2_B then
|
|
46
57
|
return true
|
|
@@ -53,6 +64,9 @@ function damageIsFatal(self, player, damageAmount)
|
|
|
53
64
|
if player:HasCollectible(CollectibleType.COLLECTIBLE_HEARTBREAK) and (playerAvailableHeartSlots >= 2) then
|
|
54
65
|
return false
|
|
55
66
|
end
|
|
67
|
+
if player:HasCollectible(CollectibleType.COLLECTIBLE_BROKEN_GLASS_CANNON) and (gameFrameCount == lastDamageFrame) then
|
|
68
|
+
return false
|
|
69
|
+
end
|
|
56
70
|
local hearts = player:GetHearts()
|
|
57
71
|
local eternalHearts = player:GetEternalHearts()
|
|
58
72
|
local soulHearts = player:GetSoulHearts()
|
|
@@ -62,7 +76,13 @@ function damageIsFatal(self, player, damageAmount)
|
|
|
62
76
|
end
|
|
63
77
|
return true
|
|
64
78
|
end
|
|
79
|
+
v = {
|
|
80
|
+
run = {
|
|
81
|
+
playerLastDamageFrame = __TS__New(Map)
|
|
82
|
+
}
|
|
83
|
+
}
|
|
65
84
|
function ____exports.postPlayerFatalDamageCallbackInit(self, mod)
|
|
85
|
+
saveDataManager(nil, "postPlayerFatalDamage", v)
|
|
66
86
|
mod:AddCallback(ModCallbacks.MC_ENTITY_TAKE_DMG, entityTakeDmgPlayer, EntityType.ENTITY_PLAYER)
|
|
67
87
|
end
|
|
68
88
|
return ____exports
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "isaacscript-common",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.536",
|
|
4
4
|
"description": "Helper functions for IsaacScript mods",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"isaac",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"dist/**/*.d.ts"
|
|
26
26
|
],
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"isaac-typescript-definitions": "^1.0.
|
|
28
|
+
"isaac-typescript-definitions": "^1.0.302",
|
|
29
29
|
"isaacscript-lint": "^1.0.72",
|
|
30
30
|
"typedoc": "^0.22.10",
|
|
31
31
|
"typescript": "4.4.4",
|