isaacscript-common 1.0.532 → 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.
|
@@ -37,9 +37,12 @@ function queueEmpty(self, player, pickingUpItem)
|
|
|
37
37
|
end
|
|
38
38
|
function queueNotEmpty(self, player, pickingUpItem)
|
|
39
39
|
local queuedItem = player.QueuedItem.Item
|
|
40
|
-
if
|
|
41
|
-
|
|
40
|
+
if queuedItem == nil then
|
|
41
|
+
return
|
|
42
|
+
end
|
|
43
|
+
if (queuedItem.Type ~= pickingUpItem.type) or (queuedItem.ID ~= pickingUpItem.id) then
|
|
42
44
|
pickingUpItem.type = queuedItem.Type
|
|
45
|
+
pickingUpItem.id = queuedItem.ID
|
|
43
46
|
preItemPickupFire(nil, player, pickingUpItem)
|
|
44
47
|
end
|
|
45
48
|
end
|
|
@@ -1,10 +1,15 @@
|
|
|
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
|
|
12
|
+
local isChildPlayer = ____player.isChildPlayer
|
|
8
13
|
local ____revive = require("functions.revive")
|
|
9
14
|
local willPlayerRevive = ____revive.willPlayerRevive
|
|
10
15
|
local ____postPlayerFatalDamage = require("callbacks.subscriptions.postPlayerFatalDamage")
|
|
@@ -21,10 +26,21 @@ function entityTakeDmgPlayer(self, tookDamage, damageAmount, _damageFlags, _dama
|
|
|
21
26
|
if player == nil then
|
|
22
27
|
return nil
|
|
23
28
|
end
|
|
29
|
+
if player.Variant ~= 0 then
|
|
30
|
+
return nil
|
|
31
|
+
end
|
|
32
|
+
if isChildPlayer(nil, player) then
|
|
33
|
+
return nil
|
|
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)
|
|
24
40
|
if willPlayerRevive(nil, player) then
|
|
25
41
|
return nil
|
|
26
42
|
end
|
|
27
|
-
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
|
|
28
44
|
return nil
|
|
29
45
|
end
|
|
30
46
|
local shouldSustainDeath = postPlayerFatalDamageFire(nil, player)
|
|
@@ -33,7 +49,9 @@ function entityTakeDmgPlayer(self, tookDamage, damageAmount, _damageFlags, _dama
|
|
|
33
49
|
end
|
|
34
50
|
return nil
|
|
35
51
|
end
|
|
36
|
-
function damageIsFatal(self, player, damageAmount)
|
|
52
|
+
function damageIsFatal(self, player, damageAmount, lastDamageFrame)
|
|
53
|
+
local game = Game()
|
|
54
|
+
local gameFrameCount = game:GetFrameCount()
|
|
37
55
|
local character = player:GetPlayerType()
|
|
38
56
|
if character == PlayerType.PLAYER_JACOB2_B then
|
|
39
57
|
return true
|
|
@@ -46,6 +64,9 @@ function damageIsFatal(self, player, damageAmount)
|
|
|
46
64
|
if player:HasCollectible(CollectibleType.COLLECTIBLE_HEARTBREAK) and (playerAvailableHeartSlots >= 2) then
|
|
47
65
|
return false
|
|
48
66
|
end
|
|
67
|
+
if player:HasCollectible(CollectibleType.COLLECTIBLE_BROKEN_GLASS_CANNON) and (gameFrameCount == lastDamageFrame) then
|
|
68
|
+
return false
|
|
69
|
+
end
|
|
49
70
|
local hearts = player:GetHearts()
|
|
50
71
|
local eternalHearts = player:GetEternalHearts()
|
|
51
72
|
local soulHearts = player:GetSoulHearts()
|
|
@@ -55,7 +76,13 @@ function damageIsFatal(self, player, damageAmount)
|
|
|
55
76
|
end
|
|
56
77
|
return true
|
|
57
78
|
end
|
|
79
|
+
v = {
|
|
80
|
+
run = {
|
|
81
|
+
playerLastDamageFrame = __TS__New(Map)
|
|
82
|
+
}
|
|
83
|
+
}
|
|
58
84
|
function ____exports.postPlayerFatalDamageCallbackInit(self, mod)
|
|
85
|
+
saveDataManager(nil, "postPlayerFatalDamage", v)
|
|
59
86
|
mod:AddCallback(ModCallbacks.MC_ENTITY_TAKE_DMG, entityTakeDmgPlayer, EntityType.ENTITY_PLAYER)
|
|
60
87
|
end
|
|
61
88
|
return ____exports
|
|
@@ -311,7 +311,8 @@ function ____exports.getPlayerNumAllHearts(self, player)
|
|
|
311
311
|
local soulHearts = player:GetSoulHearts()
|
|
312
312
|
local boneHearts = player:GetBoneHearts()
|
|
313
313
|
local eternalHearts = player:GetEternalHearts()
|
|
314
|
-
|
|
314
|
+
local rottenHearts = player:GetRottenHearts()
|
|
315
|
+
return (((hearts + soulHearts) + boneHearts) + eternalHearts) - rottenHearts
|
|
315
316
|
end
|
|
316
317
|
function ____exports.getPlayersOfType(self, playerType)
|
|
317
318
|
local players = {}
|
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",
|