isaacscript-common 1.0.588 → 1.0.592
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/customRevive.lua +16 -31
- package/dist/callbacks/postPlayerFatalDamage.lua +10 -36
- package/dist/callbacks/postTrinketBreak.lua +17 -15
- package/dist/callbacks/preBerserkDeath.d.ts +1 -0
- package/dist/callbacks/preBerserkDeath.lua +32 -0
- package/dist/callbacks/subscriptions/preBerserkDeath.d.ts +2 -0
- package/dist/callbacks/subscriptions/preBerserkDeath.lua +25 -0
- package/dist/constants.d.ts +1 -0
- package/dist/constants.lua +1 -0
- package/dist/functions/gridEntity.lua +2 -0
- package/dist/functions/player.d.ts +2 -0
- package/dist/functions/player.lua +47 -9
- package/dist/types/CallbackParametersCustom.d.ts +5 -0
- package/dist/types/ModCallbacksCustom.d.ts +19 -18
- package/dist/types/ModCallbacksCustom.lua +20 -18
- package/dist/types/ModUpgraded.lua +8 -0
- package/dist/upgradeMod.lua +3 -0
- package/package.json +5 -4
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
2
|
local ____exports = {}
|
|
3
|
-
local hasSubscriptions, postRender, postNewRoom, postPEffectUpdateReordered,
|
|
3
|
+
local hasSubscriptions, postRender, postNewRoom, 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")
|
|
@@ -37,29 +37,9 @@ function postNewRoom(self)
|
|
|
37
37
|
end
|
|
38
38
|
end
|
|
39
39
|
function postPEffectUpdateReordered(self, player)
|
|
40
|
-
|
|
41
|
-
postPEffectUpdateReorderedWaitingForItemAnimation(nil, player)
|
|
40
|
+
checkWaitingForItemAnimation(nil, player)
|
|
42
41
|
end
|
|
43
|
-
function
|
|
44
|
-
if v.run.state ~= CustomReviveState.WAITING_FOR_BERSERK_TO_END then
|
|
45
|
-
return
|
|
46
|
-
end
|
|
47
|
-
if v.run.dyingPlayerIndex == nil then
|
|
48
|
-
return
|
|
49
|
-
end
|
|
50
|
-
local playerIndex = getPlayerIndex(nil, player)
|
|
51
|
-
local effects = player:GetEffects()
|
|
52
|
-
if playerIndex ~= v.run.dyingPlayerIndex then
|
|
53
|
-
return
|
|
54
|
-
end
|
|
55
|
-
removeAllFamiliars(nil, FamiliarVariant.ONE_UP)
|
|
56
|
-
local isBerserk = effects:HasCollectibleEffect(CollectibleType.COLLECTIBLE_BERSERK)
|
|
57
|
-
if isBerserk then
|
|
58
|
-
return
|
|
59
|
-
end
|
|
60
|
-
v.run.state = CustomReviveState.CHANGING_ROOMS
|
|
61
|
-
end
|
|
62
|
-
function postPEffectUpdateReorderedWaitingForItemAnimation(self, player)
|
|
42
|
+
function checkWaitingForItemAnimation(self, player)
|
|
63
43
|
if v.run.state ~= CustomReviveState.WAITING_FOR_ITEM_ANIMATION then
|
|
64
44
|
return
|
|
65
45
|
end
|
|
@@ -92,14 +72,20 @@ function postPlayerFatalDamage(self, player)
|
|
|
92
72
|
if not hasSubscriptions(nil) then
|
|
93
73
|
return
|
|
94
74
|
end
|
|
75
|
+
playerIsAboutToDie(nil, player)
|
|
76
|
+
end
|
|
77
|
+
function preBerserkDeath(self, player)
|
|
78
|
+
if not hasSubscriptions(nil) then
|
|
79
|
+
return
|
|
80
|
+
end
|
|
81
|
+
playerIsAboutToDie(nil, player)
|
|
82
|
+
end
|
|
83
|
+
function playerIsAboutToDie(self, player)
|
|
95
84
|
local revivalType = preCustomReviveFire(nil, player)
|
|
96
85
|
if revivalType == nil then
|
|
97
86
|
return
|
|
98
87
|
end
|
|
99
|
-
|
|
100
|
-
local isBerserk = effects:HasCollectibleEffect(CollectibleType.COLLECTIBLE_BERSERK)
|
|
101
|
-
local newState = isBerserk and CustomReviveState.WAITING_FOR_BERSERK_TO_END or CustomReviveState.CHANGING_ROOMS
|
|
102
|
-
v.run.state = newState
|
|
88
|
+
v.run.state = CustomReviveState.CHANGING_ROOMS
|
|
103
89
|
v.run.revivalType = revivalType
|
|
104
90
|
v.run.dyingPlayerIndex = getPlayerIndex(nil, player)
|
|
105
91
|
player:AddCollectible(CollectibleType.COLLECTIBLE_1UP, 0, false)
|
|
@@ -109,11 +95,9 @@ end
|
|
|
109
95
|
CustomReviveState = CustomReviveState or ({})
|
|
110
96
|
CustomReviveState.DISABLED = 0
|
|
111
97
|
CustomReviveState[CustomReviveState.DISABLED] = "DISABLED"
|
|
112
|
-
CustomReviveState.
|
|
113
|
-
CustomReviveState[CustomReviveState.WAITING_FOR_BERSERK_TO_END] = "WAITING_FOR_BERSERK_TO_END"
|
|
114
|
-
CustomReviveState.CHANGING_ROOMS = 2
|
|
98
|
+
CustomReviveState.CHANGING_ROOMS = 1
|
|
115
99
|
CustomReviveState[CustomReviveState.CHANGING_ROOMS] = "CHANGING_ROOMS"
|
|
116
|
-
CustomReviveState.WAITING_FOR_ITEM_ANIMATION =
|
|
100
|
+
CustomReviveState.WAITING_FOR_ITEM_ANIMATION = 2
|
|
117
101
|
CustomReviveState[CustomReviveState.WAITING_FOR_ITEM_ANIMATION] = "WAITING_FOR_ITEM_ANIMATION"
|
|
118
102
|
v = {run = {state = CustomReviveState.DISABLED, revivalType = nil, dyingPlayerIndex = nil}}
|
|
119
103
|
function ____exports.customReviveCallbacksInit(self, mod)
|
|
@@ -122,5 +106,6 @@ function ____exports.customReviveCallbacksInit(self, mod)
|
|
|
122
106
|
mod:AddCallback(ModCallbacks.MC_POST_NEW_ROOM, postNewRoom)
|
|
123
107
|
mod:AddCallbackCustom(ModCallbacksCustom.MC_POST_PEFFECT_UPDATE_REORDERED, postPEffectUpdateReordered)
|
|
124
108
|
mod:AddCallbackCustom(ModCallbacksCustom.MC_POST_PLAYER_FATAL_DAMAGE, postPlayerFatalDamage)
|
|
109
|
+
mod:AddCallbackCustom(ModCallbacksCustom.MC_PRE_BERSERK_DEATH, preBerserkDeath)
|
|
125
110
|
end
|
|
126
111
|
return ____exports
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
2
|
require("lualib_bundle");
|
|
3
3
|
local ____exports = {}
|
|
4
|
-
local hasSubscriptions, entityTakeDmgPlayer,
|
|
4
|
+
local hasSubscriptions, entityTakeDmgPlayer, v
|
|
5
5
|
local ____exports = require("features.saveDataManager.exports")
|
|
6
6
|
local saveDataManager = ____exports.saveDataManager
|
|
7
7
|
local ____player = require("functions.player")
|
|
8
|
-
local getPlayerAvailableHeartSlots = ____player.getPlayerAvailableHeartSlots
|
|
9
8
|
local getPlayerIndex = ____player.getPlayerIndex
|
|
10
|
-
local getPlayerNumAllHearts = ____player.getPlayerNumAllHearts
|
|
11
|
-
local hasLostCurse = ____player.hasLostCurse
|
|
12
9
|
local isChildPlayer = ____player.isChildPlayer
|
|
10
|
+
local isDamageToPlayerFatal = ____player.isDamageToPlayerFatal
|
|
13
11
|
local ____revive = require("functions.revive")
|
|
14
12
|
local willPlayerRevive = ____revive.willPlayerRevive
|
|
15
13
|
local ____postPlayerFatalDamage = require("callbacks.subscriptions.postPlayerFatalDamage")
|
|
@@ -18,7 +16,7 @@ local postPlayerFatalDamageHasSubscriptions = ____postPlayerFatalDamage.postPlay
|
|
|
18
16
|
function hasSubscriptions(self)
|
|
19
17
|
return postPlayerFatalDamageHasSubscriptions(nil)
|
|
20
18
|
end
|
|
21
|
-
function entityTakeDmgPlayer(self, tookDamage, damageAmount, _damageFlags,
|
|
19
|
+
function entityTakeDmgPlayer(self, tookDamage, damageAmount, _damageFlags, damageSource, _damageCountdownFrames)
|
|
22
20
|
if not hasSubscriptions(nil) then
|
|
23
21
|
return nil
|
|
24
22
|
end
|
|
@@ -26,9 +24,6 @@ function entityTakeDmgPlayer(self, tookDamage, damageAmount, _damageFlags, _dama
|
|
|
26
24
|
if player == nil then
|
|
27
25
|
return nil
|
|
28
26
|
end
|
|
29
|
-
if player.Variant ~= 0 then
|
|
30
|
-
return nil
|
|
31
|
-
end
|
|
32
27
|
if isChildPlayer(nil, player) then
|
|
33
28
|
return nil
|
|
34
29
|
end
|
|
@@ -40,7 +35,13 @@ function entityTakeDmgPlayer(self, tookDamage, damageAmount, _damageFlags, _dama
|
|
|
40
35
|
if willPlayerRevive(nil, player) then
|
|
41
36
|
return nil
|
|
42
37
|
end
|
|
43
|
-
if not
|
|
38
|
+
if not isDamageToPlayerFatal(
|
|
39
|
+
nil,
|
|
40
|
+
player,
|
|
41
|
+
damageAmount,
|
|
42
|
+
damageSource,
|
|
43
|
+
lastDamageFrame
|
|
44
|
+
) then
|
|
44
45
|
return nil
|
|
45
46
|
end
|
|
46
47
|
local shouldSustainDeath = postPlayerFatalDamageFire(nil, player)
|
|
@@ -49,33 +50,6 @@ function entityTakeDmgPlayer(self, tookDamage, damageAmount, _damageFlags, _dama
|
|
|
49
50
|
end
|
|
50
51
|
return nil
|
|
51
52
|
end
|
|
52
|
-
function damageIsFatal(self, player, damageAmount, lastDamageFrame)
|
|
53
|
-
local game = Game()
|
|
54
|
-
local gameFrameCount = game:GetFrameCount()
|
|
55
|
-
local character = player:GetPlayerType()
|
|
56
|
-
if character == PlayerType.PLAYER_JACOB2_B then
|
|
57
|
-
return true
|
|
58
|
-
end
|
|
59
|
-
local playerNumAllHearts = getPlayerNumAllHearts(nil, player)
|
|
60
|
-
if damageAmount < playerNumAllHearts then
|
|
61
|
-
return false
|
|
62
|
-
end
|
|
63
|
-
local playerAvailableHeartSlots = getPlayerAvailableHeartSlots(nil, player)
|
|
64
|
-
if player:HasCollectible(CollectibleType.COLLECTIBLE_HEARTBREAK) and playerAvailableHeartSlots >= 2 then
|
|
65
|
-
return false
|
|
66
|
-
end
|
|
67
|
-
if player:HasCollectible(CollectibleType.COLLECTIBLE_BROKEN_GLASS_CANNON) and gameFrameCount == lastDamageFrame then
|
|
68
|
-
return false
|
|
69
|
-
end
|
|
70
|
-
local hearts = player:GetHearts()
|
|
71
|
-
local eternalHearts = player:GetEternalHearts()
|
|
72
|
-
local soulHearts = player:GetSoulHearts()
|
|
73
|
-
local boneHearts = player:GetBoneHearts()
|
|
74
|
-
if hearts > 0 and soulHearts > 0 or hearts > 0 and boneHearts > 0 or soulHearts > 0 and boneHearts > 0 or soulHearts > 0 and eternalHearts > 0 or boneHearts >= 2 then
|
|
75
|
-
return false
|
|
76
|
-
end
|
|
77
|
-
return true
|
|
78
|
-
end
|
|
79
53
|
v = {run = {playerLastDamageFrame = __TS__New(Map)}}
|
|
80
54
|
function ____exports.postPlayerFatalDamageCallbackInit(self, mod)
|
|
81
55
|
saveDataManager(nil, "postPlayerFatalDamage", v)
|
|
@@ -1,27 +1,19 @@
|
|
|
1
1
|
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
2
|
require("lualib_bundle");
|
|
3
3
|
local ____exports = {}
|
|
4
|
-
local hasSubscriptions,
|
|
4
|
+
local hasSubscriptions, entityTakeDmgPlayer, postPEffectUpdateReordered, getTrinketMap, TRINKETS_THAT_CAN_BREAK, v
|
|
5
5
|
local ____exports = require("features.saveDataManager.exports")
|
|
6
6
|
local saveDataManager = ____exports.saveDataManager
|
|
7
7
|
local ____player = require("functions.player")
|
|
8
8
|
local getPlayerIndex = ____player.getPlayerIndex
|
|
9
|
+
local ____ModCallbacksCustom = require("types.ModCallbacksCustom")
|
|
10
|
+
local ModCallbacksCustom = ____ModCallbacksCustom.ModCallbacksCustom
|
|
9
11
|
local ____postTrinketBreak = require("callbacks.subscriptions.postTrinketBreak")
|
|
10
12
|
local postTrinketBreakFire = ____postTrinketBreak.postTrinketBreakFire
|
|
11
13
|
local postTrinketBreakHasSubscriptions = ____postTrinketBreak.postTrinketBreakHasSubscriptions
|
|
12
14
|
function hasSubscriptions(self)
|
|
13
15
|
return postTrinketBreakHasSubscriptions(nil)
|
|
14
16
|
end
|
|
15
|
-
function postPEffectUpdate(self, player)
|
|
16
|
-
if not hasSubscriptions(nil) then
|
|
17
|
-
return
|
|
18
|
-
end
|
|
19
|
-
local trinketMap = getTrinketMap(nil, player)
|
|
20
|
-
for ____, trinketType in ipairs(TRINKETS_THAT_CAN_BREAK) do
|
|
21
|
-
local numTrinkets = player:GetTrinketMultiplier(trinketType)
|
|
22
|
-
trinketMap:set(trinketType, numTrinkets)
|
|
23
|
-
end
|
|
24
|
-
end
|
|
25
17
|
function entityTakeDmgPlayer(self, tookDamage, _damageAmount, _damageFlags, _damageSource, _damageCountdownFrames)
|
|
26
18
|
if not hasSubscriptions(nil) then
|
|
27
19
|
return
|
|
@@ -36,16 +28,26 @@ function entityTakeDmgPlayer(self, tookDamage, _damageAmount, _damageFlags, _dam
|
|
|
36
28
|
local numTrinketsHeld = player:GetTrinketMultiplier(trinketType)
|
|
37
29
|
local oldNumTrinketsHeld = trinketMap:get(trinketType)
|
|
38
30
|
if oldNumTrinketsHeld == nil or numTrinketsHeld >= oldNumTrinketsHeld then
|
|
39
|
-
goto
|
|
31
|
+
goto __continue7
|
|
40
32
|
end
|
|
41
33
|
trinketMap:set(trinketType, numTrinketsHeld)
|
|
42
34
|
local numTrinketsOnGround = Isaac.CountEntities(nil, EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_TRINKET, trinketType)
|
|
43
35
|
if numTrinketsOnGround > 0 then
|
|
44
|
-
goto
|
|
36
|
+
goto __continue7
|
|
45
37
|
end
|
|
46
38
|
postTrinketBreakFire(nil, player, trinketType)
|
|
47
39
|
end
|
|
48
|
-
::
|
|
40
|
+
::__continue7::
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
function postPEffectUpdateReordered(self, player)
|
|
44
|
+
if not hasSubscriptions(nil) then
|
|
45
|
+
return
|
|
46
|
+
end
|
|
47
|
+
local trinketMap = getTrinketMap(nil, player)
|
|
48
|
+
for ____, trinketType in ipairs(TRINKETS_THAT_CAN_BREAK) do
|
|
49
|
+
local numTrinkets = player:GetTrinketMultiplier(trinketType)
|
|
50
|
+
trinketMap:set(trinketType, numTrinkets)
|
|
49
51
|
end
|
|
50
52
|
end
|
|
51
53
|
function getTrinketMap(self, player)
|
|
@@ -61,7 +63,7 @@ TRINKETS_THAT_CAN_BREAK = {TrinketType.TRINKET_WISH_BONE, TrinketType.TRINKET_WA
|
|
|
61
63
|
v = {run = {playerTrinketMap = __TS__New(Map)}}
|
|
62
64
|
function ____exports.postTrinketBreakCallbackInit(self, mod)
|
|
63
65
|
saveDataManager(nil, "postTrinketBreak", v, hasSubscriptions)
|
|
64
|
-
mod:AddCallback(ModCallbacks.MC_POST_PEFFECT_UPDATE, postPEffectUpdate)
|
|
65
66
|
mod:AddCallback(ModCallbacks.MC_ENTITY_TAKE_DMG, entityTakeDmgPlayer, EntityType.ENTITY_PLAYER)
|
|
67
|
+
mod:AddCallbackCustom(ModCallbacksCustom.MC_POST_PEFFECT_UPDATE_REORDERED, postPEffectUpdateReordered)
|
|
66
68
|
end
|
|
67
69
|
return ____exports
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
|
+
local ____exports = {}
|
|
3
|
+
local hasSubscriptions, postPEffectUpdateReordered
|
|
4
|
+
local ____player = require("functions.player")
|
|
5
|
+
local getPlayerNumAllHearts = ____player.getPlayerNumAllHearts
|
|
6
|
+
local isChildPlayer = ____player.isChildPlayer
|
|
7
|
+
local ____ModCallbacksCustom = require("types.ModCallbacksCustom")
|
|
8
|
+
local ModCallbacksCustom = ____ModCallbacksCustom.ModCallbacksCustom
|
|
9
|
+
local ____preBerserkDeath = require("callbacks.subscriptions.preBerserkDeath")
|
|
10
|
+
local preBerserkDeathFire = ____preBerserkDeath.preBerserkDeathFire
|
|
11
|
+
local preBerserkDeathHasSubscriptions = ____preBerserkDeath.preBerserkDeathHasSubscriptions
|
|
12
|
+
function hasSubscriptions(self)
|
|
13
|
+
return preBerserkDeathHasSubscriptions(nil)
|
|
14
|
+
end
|
|
15
|
+
function postPEffectUpdateReordered(self, player)
|
|
16
|
+
if not hasSubscriptions(nil) then
|
|
17
|
+
return
|
|
18
|
+
end
|
|
19
|
+
if isChildPlayer(nil, player) then
|
|
20
|
+
return
|
|
21
|
+
end
|
|
22
|
+
local effects = player:GetEffects()
|
|
23
|
+
local berserkEffect = effects:GetCollectibleEffect(CollectibleType.COLLECTIBLE_BERSERK)
|
|
24
|
+
local playerNumAllHearts = getPlayerNumAllHearts(nil, player)
|
|
25
|
+
if berserkEffect ~= nil and berserkEffect.Cooldown == 1 and playerNumAllHearts == 0 then
|
|
26
|
+
preBerserkDeathFire(nil, player)
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
function ____exports.preBerserkDeathCallbackInit(self, mod)
|
|
30
|
+
mod:AddCallbackCustom(ModCallbacksCustom.MC_POST_PEFFECT_UPDATE_REORDERED, postPEffectUpdateReordered)
|
|
31
|
+
end
|
|
32
|
+
return ____exports
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
|
+
require("lualib_bundle");
|
|
3
|
+
local ____exports = {}
|
|
4
|
+
local subscriptions = {}
|
|
5
|
+
function ____exports.preBerserkDeathHasSubscriptions(self)
|
|
6
|
+
return #subscriptions > 0
|
|
7
|
+
end
|
|
8
|
+
function ____exports.preBerserkDeathRegister(self, callback, playerVariant)
|
|
9
|
+
__TS__ArrayPush(subscriptions, {callback, playerVariant})
|
|
10
|
+
end
|
|
11
|
+
function ____exports.preBerserkDeathFire(self, player)
|
|
12
|
+
for ____, ____value in ipairs(subscriptions) do
|
|
13
|
+
local callback = ____value[1]
|
|
14
|
+
local playerVariant = ____value[2]
|
|
15
|
+
do
|
|
16
|
+
if playerVariant ~= nil and playerVariant ~= player.Variant then
|
|
17
|
+
goto __continue5
|
|
18
|
+
end
|
|
19
|
+
callback(nil, player)
|
|
20
|
+
end
|
|
21
|
+
::__continue5::
|
|
22
|
+
end
|
|
23
|
+
return nil
|
|
24
|
+
end
|
|
25
|
+
return ____exports
|
package/dist/constants.d.ts
CHANGED
|
@@ -99,6 +99,7 @@ export declare const MAX_PLAYER_TRINKET_SLOTS = 2;
|
|
|
99
99
|
* on. The maximum room index possible is 168. (It is not 169 because we start at 0 instead of 1.)
|
|
100
100
|
*/
|
|
101
101
|
export declare const MAX_ROOM_INDEX = 168;
|
|
102
|
+
export declare const MAX_VANILLA_CHARACTER = PlayerType.PLAYER_THESOUL_B;
|
|
102
103
|
export declare const MAX_VANILLA_COLLECTIBLE_TYPE = CollectibleType.COLLECTIBLE_MOMS_RING;
|
|
103
104
|
export declare const MOVEMENT_ACTIONS: Set<ButtonAction>;
|
|
104
105
|
export declare const ONE_BY_ONE_ROOM_GRID_SIZE = 135;
|
package/dist/constants.lua
CHANGED
|
@@ -83,6 +83,7 @@ ____exports.MAX_PLAYER_POCKET_ITEM_SLOTS = 4
|
|
|
83
83
|
____exports.MAX_PLAYER_SPEED_IN_UNITS = 9.8
|
|
84
84
|
____exports.MAX_PLAYER_TRINKET_SLOTS = 2
|
|
85
85
|
____exports.MAX_ROOM_INDEX = 168
|
|
86
|
+
____exports.MAX_VANILLA_CHARACTER = PlayerType.PLAYER_THESOUL_B
|
|
86
87
|
____exports.MAX_VANILLA_COLLECTIBLE_TYPE = CollectibleType.COLLECTIBLE_MOMS_RING
|
|
87
88
|
____exports.MOVEMENT_ACTIONS = __TS__New(Set, {ButtonAction.ACTION_LEFT, ButtonAction.ACTION_RIGHT, ButtonAction.ACTION_UP, ButtonAction.ACTION_DOWN})
|
|
88
89
|
____exports.ONE_BY_ONE_ROOM_GRID_SIZE = 135
|
|
@@ -43,6 +43,8 @@ function ____exports.spawnGridEntityWithVariant(self, gridEntityType, variant, g
|
|
|
43
43
|
if pit ~= nil then
|
|
44
44
|
pit:UpdateCollision()
|
|
45
45
|
end
|
|
46
|
+
elseif gridEntityType == GridEntityType.GRID_WALL then
|
|
47
|
+
gridEntity.CollisionClass = GridCollisionClass.COLLISION_WALL
|
|
46
48
|
end
|
|
47
49
|
return gridEntity
|
|
48
50
|
end
|
|
@@ -174,6 +174,8 @@ export declare function isBethany(player: EntityPlayer): boolean;
|
|
|
174
174
|
* (For example, the Strawman Keeper.)
|
|
175
175
|
*/
|
|
176
176
|
export declare function isChildPlayer(player: EntityPlayer): boolean;
|
|
177
|
+
/** Uses the player's current health and character to determine if incoming damage will be fatal. */
|
|
178
|
+
export declare function isDamageToPlayerFatal(player: EntityPlayer, damageAmount: int, damageSource: EntityRef, lastDamageFrame: int | undefined): boolean;
|
|
177
179
|
export declare function isFirstPlayer(player: EntityPlayer): boolean;
|
|
178
180
|
/**
|
|
179
181
|
* Helper function for detecting when a player is Jacob or Esau. This will only match the
|
|
@@ -345,6 +345,44 @@ function ____exports.isBethany(self, player)
|
|
|
345
345
|
local character = player:GetPlayerType()
|
|
346
346
|
return character == PlayerType.PLAYER_BETHANY or character == PlayerType.PLAYER_BETHANY_B
|
|
347
347
|
end
|
|
348
|
+
function ____exports.isDamageToPlayerFatal(self, player, damageAmount, damageSource, lastDamageFrame)
|
|
349
|
+
local game = Game()
|
|
350
|
+
local gameFrameCount = game:GetFrameCount()
|
|
351
|
+
local character = player:GetPlayerType()
|
|
352
|
+
local effects = player:GetEffects()
|
|
353
|
+
local isBerserk = effects:HasCollectibleEffect(CollectibleType.COLLECTIBLE_BERSERK)
|
|
354
|
+
if character == PlayerType.PLAYER_JACOB_B and damageSource.Type == EntityType.ENTITY_DARK_ESAU then
|
|
355
|
+
return false
|
|
356
|
+
end
|
|
357
|
+
if isBerserk then
|
|
358
|
+
return false
|
|
359
|
+
end
|
|
360
|
+
if character == PlayerType.PLAYER_JACOB2_B then
|
|
361
|
+
return true
|
|
362
|
+
end
|
|
363
|
+
if ____exports.hasLostCurse(nil, player) then
|
|
364
|
+
return true
|
|
365
|
+
end
|
|
366
|
+
local playerNumAllHearts = ____exports.getPlayerNumAllHearts(nil, player)
|
|
367
|
+
if damageAmount < playerNumAllHearts then
|
|
368
|
+
return false
|
|
369
|
+
end
|
|
370
|
+
local playerAvailableHeartSlots = ____exports.getPlayerAvailableHeartSlots(nil, player)
|
|
371
|
+
if player:HasCollectible(CollectibleType.COLLECTIBLE_HEARTBREAK) and playerAvailableHeartSlots >= 2 then
|
|
372
|
+
return false
|
|
373
|
+
end
|
|
374
|
+
if player:HasCollectible(CollectibleType.COLLECTIBLE_BROKEN_GLASS_CANNON) and gameFrameCount == lastDamageFrame then
|
|
375
|
+
return false
|
|
376
|
+
end
|
|
377
|
+
local hearts = player:GetHearts()
|
|
378
|
+
local eternalHearts = player:GetEternalHearts()
|
|
379
|
+
local soulHearts = player:GetSoulHearts()
|
|
380
|
+
local boneHearts = player:GetBoneHearts()
|
|
381
|
+
if hearts > 0 and soulHearts > 0 or hearts > 0 and boneHearts > 0 or soulHearts > 0 and boneHearts > 0 or soulHearts > 0 and eternalHearts > 0 or boneHearts >= 2 then
|
|
382
|
+
return false
|
|
383
|
+
end
|
|
384
|
+
return true
|
|
385
|
+
end
|
|
348
386
|
function ____exports.isFirstPlayer(self, player)
|
|
349
387
|
return ____exports.getPlayerIndexVanilla(nil, player) == 0
|
|
350
388
|
end
|
|
@@ -405,9 +443,9 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
|
|
|
405
443
|
itemPool:RemoveCollectible(collectibleType)
|
|
406
444
|
end
|
|
407
445
|
repeat
|
|
408
|
-
local
|
|
409
|
-
local
|
|
410
|
-
if
|
|
446
|
+
local ____switch117 = activeSlot
|
|
447
|
+
local ____cond117 = ____switch117 == ActiveSlot.SLOT_PRIMARY
|
|
448
|
+
if ____cond117 then
|
|
411
449
|
do
|
|
412
450
|
if primaryCollectibleType ~= CollectibleType.COLLECTIBLE_NULL then
|
|
413
451
|
player:RemoveCollectible(primaryCollectibleType)
|
|
@@ -416,8 +454,8 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
|
|
|
416
454
|
break
|
|
417
455
|
end
|
|
418
456
|
end
|
|
419
|
-
|
|
420
|
-
if
|
|
457
|
+
____cond117 = ____cond117 or ____switch117 == ActiveSlot.SLOT_SECONDARY
|
|
458
|
+
if ____cond117 then
|
|
421
459
|
do
|
|
422
460
|
if primaryCollectibleType ~= CollectibleType.COLLECTIBLE_NULL then
|
|
423
461
|
player:RemoveCollectible(primaryCollectibleType)
|
|
@@ -432,16 +470,16 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
|
|
|
432
470
|
break
|
|
433
471
|
end
|
|
434
472
|
end
|
|
435
|
-
|
|
436
|
-
if
|
|
473
|
+
____cond117 = ____cond117 or ____switch117 == ActiveSlot.SLOT_POCKET
|
|
474
|
+
if ____cond117 then
|
|
437
475
|
do
|
|
438
476
|
player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
|
|
439
477
|
player:SetActiveCharge(charge, activeSlot)
|
|
440
478
|
break
|
|
441
479
|
end
|
|
442
480
|
end
|
|
443
|
-
|
|
444
|
-
if
|
|
481
|
+
____cond117 = ____cond117 or ____switch117 == ActiveSlot.SLOT_POCKET2
|
|
482
|
+
if ____cond117 then
|
|
445
483
|
do
|
|
446
484
|
player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
|
|
447
485
|
break
|
|
@@ -40,6 +40,7 @@ import { PostTearInitLateCallbackType } from "../callbacks/subscriptions/postTea
|
|
|
40
40
|
import { PostTearInitVeryLateCallbackType } from "../callbacks/subscriptions/postTearInitVeryLate";
|
|
41
41
|
import { PostTransformationCallbackType } from "../callbacks/subscriptions/postTransformation";
|
|
42
42
|
import { PostTrinketBreakCallbackType } from "../callbacks/subscriptions/postTrinketBreak";
|
|
43
|
+
import { PreBerserkDeathCallbackType } from "../callbacks/subscriptions/preBerserkDeath";
|
|
43
44
|
import { PreCustomReviveCallbackType } from "../callbacks/subscriptions/preCustomRevive";
|
|
44
45
|
import { PreItemPickupCallbackType } from "../callbacks/subscriptions/preItemPickup";
|
|
45
46
|
import { PreNewLevelCallbackType } from "../callbacks/subscriptions/PreNewLevel";
|
|
@@ -143,6 +144,10 @@ export interface CallbackParametersCustom {
|
|
|
143
144
|
callback: PostPlayerFatalDamageCallbackType,
|
|
144
145
|
playerVariant?: PlayerVariant
|
|
145
146
|
];
|
|
147
|
+
[ModCallbacksCustom.MC_PRE_BERSERK_DEATH]: [
|
|
148
|
+
callback: PreBerserkDeathCallbackType,
|
|
149
|
+
playerVariant?: PlayerVariant
|
|
150
|
+
];
|
|
146
151
|
[ModCallbacksCustom.MC_PRE_CUSTOM_REVIVE]: [
|
|
147
152
|
callback: PreCustomReviveCallbackType
|
|
148
153
|
];
|
|
@@ -32,22 +32,23 @@ export declare enum ModCallbacksCustom {
|
|
|
32
32
|
MC_POST_PLAYER_CHANGE_TYPE = 23,
|
|
33
33
|
MC_POST_PLAYER_CHANGE_HEALTH = 24,
|
|
34
34
|
MC_POST_PLAYER_FATAL_DAMAGE = 25,
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
35
|
+
MC_PRE_BERSERK_DEATH = 26,
|
|
36
|
+
MC_PRE_CUSTOM_REVIVE = 27,
|
|
37
|
+
MC_POST_CUSTOM_REVIVE = 28,
|
|
38
|
+
MC_POST_FLIP = 29,
|
|
39
|
+
MC_POST_FIRST_FLIP = 30,
|
|
40
|
+
MC_POST_ESAU_JR = 31,
|
|
41
|
+
MC_POST_FIRST_ESAU_JR = 32,
|
|
42
|
+
MC_POST_TRANSFORMATION = 33,
|
|
43
|
+
MC_POST_PURCHASE = 34,
|
|
44
|
+
MC_POST_SACRIFICE = 35,
|
|
45
|
+
MC_POST_CURSED_TELEPORT = 36,
|
|
46
|
+
MC_POST_TRINKET_BREAK = 37,
|
|
47
|
+
MC_POST_SLOT_INIT = 38,
|
|
48
|
+
MC_POST_SLOT_UPDATE = 39,
|
|
49
|
+
MC_POST_SLOT_RENDER = 40,
|
|
50
|
+
MC_POST_SLOT_DESTROYED = 41,
|
|
51
|
+
MC_POST_GRID_ENTITY_INIT = 42,
|
|
52
|
+
MC_POST_GRID_ENTITY_UPDATE = 43,
|
|
53
|
+
MC_POST_GRID_ENTITY_REMOVE = 44
|
|
53
54
|
}
|
|
@@ -53,40 +53,42 @@ ____exports.ModCallbacksCustom.MC_POST_PLAYER_CHANGE_HEALTH = 24
|
|
|
53
53
|
____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_POST_PLAYER_CHANGE_HEALTH] = "MC_POST_PLAYER_CHANGE_HEALTH"
|
|
54
54
|
____exports.ModCallbacksCustom.MC_POST_PLAYER_FATAL_DAMAGE = 25
|
|
55
55
|
____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_POST_PLAYER_FATAL_DAMAGE] = "MC_POST_PLAYER_FATAL_DAMAGE"
|
|
56
|
-
____exports.ModCallbacksCustom.
|
|
56
|
+
____exports.ModCallbacksCustom.MC_PRE_BERSERK_DEATH = 26
|
|
57
|
+
____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_PRE_BERSERK_DEATH] = "MC_PRE_BERSERK_DEATH"
|
|
58
|
+
____exports.ModCallbacksCustom.MC_PRE_CUSTOM_REVIVE = 27
|
|
57
59
|
____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_PRE_CUSTOM_REVIVE] = "MC_PRE_CUSTOM_REVIVE"
|
|
58
|
-
____exports.ModCallbacksCustom.MC_POST_CUSTOM_REVIVE =
|
|
60
|
+
____exports.ModCallbacksCustom.MC_POST_CUSTOM_REVIVE = 28
|
|
59
61
|
____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_POST_CUSTOM_REVIVE] = "MC_POST_CUSTOM_REVIVE"
|
|
60
|
-
____exports.ModCallbacksCustom.MC_POST_FLIP =
|
|
62
|
+
____exports.ModCallbacksCustom.MC_POST_FLIP = 29
|
|
61
63
|
____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_POST_FLIP] = "MC_POST_FLIP"
|
|
62
|
-
____exports.ModCallbacksCustom.MC_POST_FIRST_FLIP =
|
|
64
|
+
____exports.ModCallbacksCustom.MC_POST_FIRST_FLIP = 30
|
|
63
65
|
____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_POST_FIRST_FLIP] = "MC_POST_FIRST_FLIP"
|
|
64
|
-
____exports.ModCallbacksCustom.MC_POST_ESAU_JR =
|
|
66
|
+
____exports.ModCallbacksCustom.MC_POST_ESAU_JR = 31
|
|
65
67
|
____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_POST_ESAU_JR] = "MC_POST_ESAU_JR"
|
|
66
|
-
____exports.ModCallbacksCustom.MC_POST_FIRST_ESAU_JR =
|
|
68
|
+
____exports.ModCallbacksCustom.MC_POST_FIRST_ESAU_JR = 32
|
|
67
69
|
____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_POST_FIRST_ESAU_JR] = "MC_POST_FIRST_ESAU_JR"
|
|
68
|
-
____exports.ModCallbacksCustom.MC_POST_TRANSFORMATION =
|
|
70
|
+
____exports.ModCallbacksCustom.MC_POST_TRANSFORMATION = 33
|
|
69
71
|
____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_POST_TRANSFORMATION] = "MC_POST_TRANSFORMATION"
|
|
70
|
-
____exports.ModCallbacksCustom.MC_POST_PURCHASE =
|
|
72
|
+
____exports.ModCallbacksCustom.MC_POST_PURCHASE = 34
|
|
71
73
|
____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_POST_PURCHASE] = "MC_POST_PURCHASE"
|
|
72
|
-
____exports.ModCallbacksCustom.MC_POST_SACRIFICE =
|
|
74
|
+
____exports.ModCallbacksCustom.MC_POST_SACRIFICE = 35
|
|
73
75
|
____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_POST_SACRIFICE] = "MC_POST_SACRIFICE"
|
|
74
|
-
____exports.ModCallbacksCustom.MC_POST_CURSED_TELEPORT =
|
|
76
|
+
____exports.ModCallbacksCustom.MC_POST_CURSED_TELEPORT = 36
|
|
75
77
|
____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_POST_CURSED_TELEPORT] = "MC_POST_CURSED_TELEPORT"
|
|
76
|
-
____exports.ModCallbacksCustom.MC_POST_TRINKET_BREAK =
|
|
78
|
+
____exports.ModCallbacksCustom.MC_POST_TRINKET_BREAK = 37
|
|
77
79
|
____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_POST_TRINKET_BREAK] = "MC_POST_TRINKET_BREAK"
|
|
78
|
-
____exports.ModCallbacksCustom.MC_POST_SLOT_INIT =
|
|
80
|
+
____exports.ModCallbacksCustom.MC_POST_SLOT_INIT = 38
|
|
79
81
|
____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_POST_SLOT_INIT] = "MC_POST_SLOT_INIT"
|
|
80
|
-
____exports.ModCallbacksCustom.MC_POST_SLOT_UPDATE =
|
|
82
|
+
____exports.ModCallbacksCustom.MC_POST_SLOT_UPDATE = 39
|
|
81
83
|
____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_POST_SLOT_UPDATE] = "MC_POST_SLOT_UPDATE"
|
|
82
|
-
____exports.ModCallbacksCustom.MC_POST_SLOT_RENDER =
|
|
84
|
+
____exports.ModCallbacksCustom.MC_POST_SLOT_RENDER = 40
|
|
83
85
|
____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_POST_SLOT_RENDER] = "MC_POST_SLOT_RENDER"
|
|
84
|
-
____exports.ModCallbacksCustom.MC_POST_SLOT_DESTROYED =
|
|
86
|
+
____exports.ModCallbacksCustom.MC_POST_SLOT_DESTROYED = 41
|
|
85
87
|
____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_POST_SLOT_DESTROYED] = "MC_POST_SLOT_DESTROYED"
|
|
86
|
-
____exports.ModCallbacksCustom.MC_POST_GRID_ENTITY_INIT =
|
|
88
|
+
____exports.ModCallbacksCustom.MC_POST_GRID_ENTITY_INIT = 42
|
|
87
89
|
____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_POST_GRID_ENTITY_INIT] = "MC_POST_GRID_ENTITY_INIT"
|
|
88
|
-
____exports.ModCallbacksCustom.MC_POST_GRID_ENTITY_UPDATE =
|
|
90
|
+
____exports.ModCallbacksCustom.MC_POST_GRID_ENTITY_UPDATE = 43
|
|
89
91
|
____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_POST_GRID_ENTITY_UPDATE] = "MC_POST_GRID_ENTITY_UPDATE"
|
|
90
|
-
____exports.ModCallbacksCustom.MC_POST_GRID_ENTITY_REMOVE =
|
|
92
|
+
____exports.ModCallbacksCustom.MC_POST_GRID_ENTITY_REMOVE = 44
|
|
91
93
|
____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_POST_GRID_ENTITY_REMOVE] = "MC_POST_GRID_ENTITY_REMOVE"
|
|
92
94
|
return ____exports
|
|
@@ -84,6 +84,8 @@ local ____postTransformation = require("callbacks.subscriptions.postTransformati
|
|
|
84
84
|
local postTransformationRegister = ____postTransformation.postTransformationRegister
|
|
85
85
|
local ____postTrinketBreak = require("callbacks.subscriptions.postTrinketBreak")
|
|
86
86
|
local postTrinketBreakRegister = ____postTrinketBreak.postTrinketBreakRegister
|
|
87
|
+
local ____preBerserkDeath = require("callbacks.subscriptions.preBerserkDeath")
|
|
88
|
+
local preBerserkDeathRegister = ____preBerserkDeath.preBerserkDeathRegister
|
|
87
89
|
local ____preCustomRevive = require("callbacks.subscriptions.preCustomRevive")
|
|
88
90
|
local preCustomReviveRegister = ____preCustomRevive.preCustomReviveRegister
|
|
89
91
|
local ____preItemPickup = require("callbacks.subscriptions.preItemPickup")
|
|
@@ -265,6 +267,12 @@ function getCallbackRegisterFunction(self, callbackID)
|
|
|
265
267
|
return postPlayerFatalDamageRegister
|
|
266
268
|
end
|
|
267
269
|
end
|
|
270
|
+
____cond19 = ____cond19 or ____switch19 == ModCallbacksCustom.MC_PRE_BERSERK_DEATH
|
|
271
|
+
if ____cond19 then
|
|
272
|
+
do
|
|
273
|
+
return preBerserkDeathRegister
|
|
274
|
+
end
|
|
275
|
+
end
|
|
268
276
|
____cond19 = ____cond19 or ____switch19 == ModCallbacksCustom.MC_PRE_CUSTOM_REVIVE
|
|
269
277
|
if ____cond19 then
|
|
270
278
|
do
|
package/dist/upgradeMod.lua
CHANGED
|
@@ -60,6 +60,8 @@ local ____postTransformation = require("callbacks.postTransformation")
|
|
|
60
60
|
local postTransformationCallbackInit = ____postTransformation.postTransformationCallbackInit
|
|
61
61
|
local ____postTrinketBreak = require("callbacks.postTrinketBreak")
|
|
62
62
|
local postTrinketBreakCallbackInit = ____postTrinketBreak.postTrinketBreakCallbackInit
|
|
63
|
+
local ____preBerserkDeath = require("callbacks.preBerserkDeath")
|
|
64
|
+
local preBerserkDeathCallbackInit = ____preBerserkDeath.preBerserkDeathCallbackInit
|
|
63
65
|
local ____preNewLevel = require("callbacks.preNewLevel")
|
|
64
66
|
local preNewLevelCallbackInit = ____preNewLevel.preNewLevelCallbackInit
|
|
65
67
|
local ____reorderedCallbacks = require("callbacks.reorderedCallbacks")
|
|
@@ -107,6 +109,7 @@ function initCustomCallbacks(self, mod)
|
|
|
107
109
|
postPlayerChangeTypeCallbackInit(nil, mod)
|
|
108
110
|
postPlayerChangeHealthCallbackInit(nil, mod)
|
|
109
111
|
postPlayerFatalDamageCallbackInit(nil, mod)
|
|
112
|
+
preBerserkDeathCallbackInit(nil, mod)
|
|
110
113
|
customReviveCallbacksInit(nil, mod)
|
|
111
114
|
postFlipCallbacksInit(nil, mod)
|
|
112
115
|
postEsauJrCallbacksInit(nil, mod)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "isaacscript-common",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.592",
|
|
4
4
|
"description": "Helper functions for IsaacScript mods",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"isaac",
|
|
@@ -25,10 +25,11 @@
|
|
|
25
25
|
"dist/**/*.d.ts"
|
|
26
26
|
],
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"isaac-typescript-definitions": "^1.0.
|
|
29
|
-
"isaacscript-lint": "^1.0.
|
|
28
|
+
"isaac-typescript-definitions": "^1.0.331",
|
|
29
|
+
"isaacscript-lint": "^1.0.79",
|
|
30
|
+
"isaacscript-tsconfig": "^1.1.8",
|
|
30
31
|
"typedoc": "^0.22.10",
|
|
31
32
|
"typescript": "^4.5.4",
|
|
32
|
-
"typescript-to-lua": "^1.3.
|
|
33
|
+
"typescript-to-lua": "^1.3.1"
|
|
33
34
|
}
|
|
34
35
|
}
|