isaacscript-common 1.0.533 → 1.0.537
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
|
|
@@ -19,7 +19,13 @@ export declare function addTrinketCostume(player: EntityPlayer, trinketType: Tri
|
|
|
19
19
|
export declare function anyPlayerCloserThan(position: Vector, distance: float): boolean;
|
|
20
20
|
export declare function anyPlayerHasCollectible(collectibleType: CollectibleType | int): boolean;
|
|
21
21
|
export declare function anyPlayerHasTrinket(trinketType: TrinketType | int): boolean;
|
|
22
|
-
|
|
22
|
+
/**
|
|
23
|
+
* Helper function to determine if the given character is present.
|
|
24
|
+
*
|
|
25
|
+
* This function is variadic, meaning that you can supply as many characters as you want to check
|
|
26
|
+
* for. Returns true if any of the characters supplied are present.
|
|
27
|
+
*/
|
|
28
|
+
export declare function anyPlayerIs(...characters: PlayerType[]): boolean;
|
|
23
29
|
/**
|
|
24
30
|
* Helper function to determine if the provided character can have red heart containers. Returns
|
|
25
31
|
* true for characters like Isaac, Magdalene, or Cain. Returns true for Keeper and Tainted Keeper,
|
|
@@ -126,12 +126,14 @@ function ____exports.anyPlayerHasTrinket(self, trinketType)
|
|
|
126
126
|
end
|
|
127
127
|
return false
|
|
128
128
|
end
|
|
129
|
-
function ____exports.anyPlayerIs(self,
|
|
129
|
+
function ____exports.anyPlayerIs(self, ...)
|
|
130
|
+
local characters = {...}
|
|
131
|
+
local characterSet = __TS__New(Set, characters)
|
|
130
132
|
for ____, player in ipairs(
|
|
131
133
|
____exports.getPlayers(nil)
|
|
132
134
|
) do
|
|
133
135
|
local character = player:GetPlayerType()
|
|
134
|
-
if character
|
|
136
|
+
if characterSet:has(character) then
|
|
135
137
|
return true
|
|
136
138
|
end
|
|
137
139
|
end
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "isaacscript-common",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.537",
|
|
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",
|