isaacscript-common 8.4.5 → 8.4.6
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/postCursedTeleport.lua +4 -4
- package/dist/callbacks/postPlayerFatalDamage.lua +7 -7
- package/dist/callbacks/postSacrifice.lua +2 -2
- package/dist/callbacks/postTrinketBreak.lua +2 -2
- package/dist/callbacks/subscriptions/postPlayerFatalDamage.d.ts +2 -2
- package/dist/callbacks/subscriptions/postPlayerFatalDamage.d.ts.map +1 -1
- package/dist/callbacks/subscriptions/postPlayerFatalDamage.lua +4 -4
- package/dist/features/customGridEntity.d.ts.map +1 -1
- package/dist/features/customGridEntity.lua +3 -36
- package/dist/features/extraConsoleCommands/init.d.ts.map +1 -1
- package/dist/features/extraConsoleCommands/init.lua +1 -1
- package/dist/functions/flag.d.ts +1 -1
- package/dist/functions/flag.lua +1 -1
- package/dist/functions/revive.d.ts +1 -1
- package/dist/functions/revive.d.ts.map +1 -1
- package/dist/functions/revive.lua +3 -3
- package/dist/index.d.ts +3 -3
- package/package.json +2 -2
- package/src/callbacks/postCursedTeleport.ts +7 -7
- package/src/callbacks/postPlayerFatalDamage.ts +9 -16
- package/src/callbacks/postSacrifice.ts +5 -5
- package/src/callbacks/postTrinketBreak.ts +5 -5
- package/src/callbacks/subscriptions/postPlayerFatalDamage.ts +9 -9
- package/src/features/customGridEntity.ts +0 -55
- package/src/features/extraConsoleCommands/init.ts +8 -1
- package/src/functions/flag.ts +1 -1
- package/src/functions/revive.ts +4 -4
|
@@ -28,17 +28,17 @@ local postCursedTeleportHasSubscriptions = ____postCursedTeleport.postCursedTele
|
|
|
28
28
|
function hasSubscriptions(self)
|
|
29
29
|
return postCursedTeleportHasSubscriptions(nil)
|
|
30
30
|
end
|
|
31
|
-
function entityTakeDmgPlayer(self,
|
|
31
|
+
function entityTakeDmgPlayer(self, entity, _amount, damageFlags, _source, _countdownFrames)
|
|
32
32
|
if not hasSubscriptions(nil) then
|
|
33
33
|
return nil
|
|
34
34
|
end
|
|
35
35
|
incrementNumSacrifices(nil, damageFlags)
|
|
36
|
-
setDamageFrame(nil,
|
|
36
|
+
setDamageFrame(nil, entity, damageFlags)
|
|
37
37
|
return nil
|
|
38
38
|
end
|
|
39
|
-
function setDamageFrame(self,
|
|
39
|
+
function setDamageFrame(self, entity, damageFlags)
|
|
40
40
|
local gameFrameCount = game:GetFrameCount()
|
|
41
|
-
local player =
|
|
41
|
+
local player = entity:ToPlayer()
|
|
42
42
|
if player == nil then
|
|
43
43
|
return
|
|
44
44
|
end
|
|
@@ -29,11 +29,11 @@ local postPlayerFatalDamageHasSubscriptions = ____postPlayerFatalDamage.postPlay
|
|
|
29
29
|
function hasSubscriptions(self)
|
|
30
30
|
return postPlayerFatalDamageHasSubscriptions(nil)
|
|
31
31
|
end
|
|
32
|
-
function entityTakeDmgPlayer(self,
|
|
32
|
+
function entityTakeDmgPlayer(self, entity, amount, damageFlags, source, countdownFrames)
|
|
33
33
|
if not hasSubscriptions(nil) then
|
|
34
34
|
return nil
|
|
35
35
|
end
|
|
36
|
-
local player =
|
|
36
|
+
local player = entity:ToPlayer()
|
|
37
37
|
if player == nil then
|
|
38
38
|
return nil
|
|
39
39
|
end
|
|
@@ -49,8 +49,8 @@ function entityTakeDmgPlayer(self, tookDamage, damageAmount, damageFlags, damage
|
|
|
49
49
|
if not isDamageToPlayerFatal(
|
|
50
50
|
nil,
|
|
51
51
|
player,
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
amount,
|
|
53
|
+
source,
|
|
54
54
|
lastDamageGameFrame
|
|
55
55
|
) then
|
|
56
56
|
return nil
|
|
@@ -58,10 +58,10 @@ function entityTakeDmgPlayer(self, tookDamage, damageAmount, damageFlags, damage
|
|
|
58
58
|
local shouldSustainDeath = postPlayerFatalDamageFire(
|
|
59
59
|
nil,
|
|
60
60
|
player,
|
|
61
|
-
|
|
61
|
+
amount,
|
|
62
62
|
damageFlags,
|
|
63
|
-
|
|
64
|
-
|
|
63
|
+
source,
|
|
64
|
+
countdownFrames
|
|
65
65
|
)
|
|
66
66
|
if shouldSustainDeath ~= nil then
|
|
67
67
|
return shouldSustainDeath
|
|
@@ -17,11 +17,11 @@ local postSacrificeHasSubscriptions = ____postSacrifice.postSacrificeHasSubscrip
|
|
|
17
17
|
function hasSubscriptions(self)
|
|
18
18
|
return postSacrificeHasSubscriptions(nil)
|
|
19
19
|
end
|
|
20
|
-
function entityTakeDmgPlayer(self,
|
|
20
|
+
function entityTakeDmgPlayer(self, entity, _amount, damageFlags, _source, _countdownFrames)
|
|
21
21
|
if not hasSubscriptions(nil) then
|
|
22
22
|
return nil
|
|
23
23
|
end
|
|
24
|
-
local player =
|
|
24
|
+
local player = entity:ToPlayer()
|
|
25
25
|
if player == nil then
|
|
26
26
|
return nil
|
|
27
27
|
end
|
|
@@ -22,11 +22,11 @@ local postTrinketBreakHasSubscriptions = ____postTrinketBreak.postTrinketBreakHa
|
|
|
22
22
|
function hasSubscriptions(self)
|
|
23
23
|
return postTrinketBreakHasSubscriptions(nil)
|
|
24
24
|
end
|
|
25
|
-
function entityTakeDmgPlayer(self,
|
|
25
|
+
function entityTakeDmgPlayer(self, entity, _amount, _damageFlags, _source, _countdownFrames)
|
|
26
26
|
if not hasSubscriptions(nil) then
|
|
27
27
|
return nil
|
|
28
28
|
end
|
|
29
|
-
local player =
|
|
29
|
+
local player = entity:ToPlayer()
|
|
30
30
|
if player == nil then
|
|
31
31
|
return nil
|
|
32
32
|
end
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { DamageFlag, PlayerType, PlayerVariant } from "isaac-typescript-definitions";
|
|
2
2
|
export declare type PostPlayerFatalDamageRegisterParameters = [
|
|
3
|
-
callback: (player: EntityPlayer,
|
|
3
|
+
callback: (player: EntityPlayer, amount: float, damageFlags: BitFlags<DamageFlag>, source: EntityRef, countdownFrames: int) => boolean | undefined,
|
|
4
4
|
playerVariant?: PlayerVariant,
|
|
5
5
|
character?: PlayerType
|
|
6
6
|
];
|
|
7
7
|
export declare function postPlayerFatalDamageHasSubscriptions(): boolean;
|
|
8
8
|
export declare function postPlayerFatalDamageRegister(...args: PostPlayerFatalDamageRegisterParameters): void;
|
|
9
|
-
export declare function postPlayerFatalDamageFire(player: EntityPlayer,
|
|
9
|
+
export declare function postPlayerFatalDamageFire(player: EntityPlayer, amount: float, damageFlags: BitFlags<DamageFlag>, source: EntityRef, countdownFrames: int): boolean | undefined;
|
|
10
10
|
//# sourceMappingURL=postPlayerFatalDamage.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"postPlayerFatalDamage.d.ts","sourceRoot":"","sources":["../../../src/callbacks/subscriptions/postPlayerFatalDamage.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,UAAU,EACV,aAAa,EACd,MAAM,8BAA8B,CAAC;AAEtC,oBAAY,uCAAuC,GAAG;IACpD,QAAQ,EAAE,CACR,MAAM,EAAE,YAAY,EACpB,
|
|
1
|
+
{"version":3,"file":"postPlayerFatalDamage.d.ts","sourceRoot":"","sources":["../../../src/callbacks/subscriptions/postPlayerFatalDamage.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,UAAU,EACV,aAAa,EACd,MAAM,8BAA8B,CAAC;AAEtC,oBAAY,uCAAuC,GAAG;IACpD,QAAQ,EAAE,CACR,MAAM,EAAE,YAAY,EACpB,MAAM,EAAE,KAAK,EACb,WAAW,EAAE,QAAQ,CAAC,UAAU,CAAC,EACjC,MAAM,EAAE,SAAS,EACjB,eAAe,EAAE,GAAG,KACjB,OAAO,GAAG,SAAS;IACxB,aAAa,CAAC,EAAE,aAAa;IAC7B,SAAS,CAAC,EAAE,UAAU;CACvB,CAAC;AAIF,wBAAgB,qCAAqC,IAAI,OAAO,CAE/D;AAED,wBAAgB,6BAA6B,CAC3C,GAAG,IAAI,EAAE,uCAAuC,GAC/C,IAAI,CAEN;AAED,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,YAAY,EACpB,MAAM,EAAE,KAAK,EACb,WAAW,EAAE,QAAQ,CAAC,UAAU,CAAC,EACjC,MAAM,EAAE,SAAS,EACjB,eAAe,EAAE,GAAG,GACnB,OAAO,GAAG,SAAS,CA4BrB"}
|
|
@@ -7,7 +7,7 @@ function ____exports.postPlayerFatalDamageRegister(self, ...)
|
|
|
7
7
|
local args = {...}
|
|
8
8
|
subscriptions[#subscriptions + 1] = args
|
|
9
9
|
end
|
|
10
|
-
function ____exports.postPlayerFatalDamageFire(self, player,
|
|
10
|
+
function ____exports.postPlayerFatalDamageFire(self, player, amount, damageFlags, source, countdownFrames)
|
|
11
11
|
local character = player:GetPlayerType()
|
|
12
12
|
for ____, ____value in ipairs(subscriptions) do
|
|
13
13
|
local callback = ____value[1]
|
|
@@ -23,10 +23,10 @@ function ____exports.postPlayerFatalDamageFire(self, player, damageAmount, damag
|
|
|
23
23
|
local shouldSustainDeath = callback(
|
|
24
24
|
nil,
|
|
25
25
|
player,
|
|
26
|
-
|
|
26
|
+
amount,
|
|
27
27
|
damageFlags,
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
source,
|
|
29
|
+
countdownFrames
|
|
30
30
|
)
|
|
31
31
|
if shouldSustainDeath ~= nil then
|
|
32
32
|
return shouldSustainDeath
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customGridEntity.d.ts","sourceRoot":"","sources":["../../src/features/customGridEntity.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"customGridEntity.d.ts","sourceRoot":"","sources":["../../src/features/customGridEntity.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,kBAAkB,EAClB,cAAc,EAGf,MAAM,8BAA8B,CAAC;AAgBtC,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAyH1E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,wBAAgB,qBAAqB,CACnC,oBAAoB,EAAE,cAAc,EACpC,mBAAmB,EAAE,GAAG,GAAG,MAAM,EACjC,kBAAkB,CAAC,EAAE,kBAAkB,EACvC,QAAQ,CAAC,EAAE,MAAM,EACjB,gBAAgB,CAAC,EAAE,MAAM,EACzB,kBAAkB,iBAA4B,EAC9C,qBAAqB,SAAI,GACxB,UAAU,CA8CZ;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,sBAAsB,CACpC,+BAA+B,EAAE,GAAG,GAAG,MAAM,GAAG,UAAU,EAC1D,UAAU,UAAO,GAChB,UAAU,GAAG,SAAS,CAuCxB;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,IAAI,KAAK,CAC5C;IAAC,UAAU,EAAE,UAAU;IAAE,IAAI,EAAE,oBAAoB;CAAC,CACrD,CAqBA;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CACrC,qBAAqB,EAAE,UAAU,GAAG,GAAG,GACtC,cAAc,GAAG,SAAS,CAsB5B;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,qBAAqB,EAAE,UAAU,GAAG,GAAG,GACtC,OAAO,CAOT"}
|
|
@@ -4,16 +4,12 @@ local __TS__New = ____lualib.__TS__New
|
|
|
4
4
|
local Set = ____lualib.Set
|
|
5
5
|
local __TS__Iterator = ____lualib.__TS__Iterator
|
|
6
6
|
local ____exports = {}
|
|
7
|
-
local
|
|
7
|
+
local preUseItemWeNeedToGoDeeper, postNewRoomReordered, v
|
|
8
8
|
local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
|
|
9
9
|
local CollectibleType = ____isaac_2Dtypescript_2Ddefinitions.CollectibleType
|
|
10
|
-
local DamageFlag = ____isaac_2Dtypescript_2Ddefinitions.DamageFlag
|
|
11
|
-
local EntityType = ____isaac_2Dtypescript_2Ddefinitions.EntityType
|
|
12
10
|
local GridCollisionClass = ____isaac_2Dtypescript_2Ddefinitions.GridCollisionClass
|
|
13
11
|
local GridEntityType = ____isaac_2Dtypescript_2Ddefinitions.GridEntityType
|
|
14
12
|
local ModCallback = ____isaac_2Dtypescript_2Ddefinitions.ModCallback
|
|
15
|
-
local ____postGridEntityCustomBroken = require("callbacks.subscriptions.postGridEntityCustomBroken")
|
|
16
|
-
local postGridEntityCustomBrokenFire = ____postGridEntityCustomBroken.postGridEntityCustomBrokenFire
|
|
17
13
|
local ____DefaultMap = require("classes.DefaultMap")
|
|
18
14
|
local DefaultMap = ____DefaultMap.DefaultMap
|
|
19
15
|
local ____cachedClasses = require("core.cachedClasses")
|
|
@@ -23,8 +19,6 @@ local ModCallbackCustom = ____ModCallbackCustom.ModCallbackCustom
|
|
|
23
19
|
local ____featuresInitialized = require("featuresInitialized")
|
|
24
20
|
local areFeaturesInitialized = ____featuresInitialized.areFeaturesInitialized
|
|
25
21
|
local errorIfFeaturesNotInitialized = ____featuresInitialized.errorIfFeaturesNotInitialized
|
|
26
|
-
local ____flag = require("functions.flag")
|
|
27
|
-
local hasFlag = ____flag.hasFlag
|
|
28
22
|
local ____gridEntities = require("functions.gridEntities")
|
|
29
23
|
local removeGridEntity = ____gridEntities.removeGridEntity
|
|
30
24
|
local spawnGridEntityWithVariant = ____gridEntities.spawnGridEntityWithVariant
|
|
@@ -38,32 +32,6 @@ local ____runInNFrames = require("features.runInNFrames")
|
|
|
38
32
|
local runNextGameFrame = ____runInNFrames.runNextGameFrame
|
|
39
33
|
local ____exports = require("features.saveDataManager.exports")
|
|
40
34
|
local saveDataManager = ____exports.saveDataManager
|
|
41
|
-
function entityTakeDmgGenericProp(self, tookDamage, _damageAmount, damageFlags, _damageSource, _damageCountdownFrames)
|
|
42
|
-
local ptrHash = GetPtrHash(tookDamage)
|
|
43
|
-
if not v.room.genericPropPtrHashes:has(ptrHash) then
|
|
44
|
-
return nil
|
|
45
|
-
end
|
|
46
|
-
if not hasFlag(nil, damageFlags, DamageFlag.EXPLOSION) then
|
|
47
|
-
return false
|
|
48
|
-
end
|
|
49
|
-
local room = game:GetRoom()
|
|
50
|
-
local roomListIndex = getRoomListIndex(nil)
|
|
51
|
-
local roomCustomGridEntities = v.level.customGridEntities:get(roomListIndex)
|
|
52
|
-
if roomCustomGridEntities == nil then
|
|
53
|
-
return false
|
|
54
|
-
end
|
|
55
|
-
local gridIndex = room:GetGridIndex(tookDamage.Position)
|
|
56
|
-
local data = roomCustomGridEntities:get(gridIndex)
|
|
57
|
-
if data == nil then
|
|
58
|
-
return false
|
|
59
|
-
end
|
|
60
|
-
local gridEntity = room:GetGridEntity(gridIndex)
|
|
61
|
-
if gridEntity == nil then
|
|
62
|
-
error("Failed to get the grid entity for a custom grid entity that broke at grid index: " .. tostring(gridIndex))
|
|
63
|
-
end
|
|
64
|
-
postGridEntityCustomBrokenFire(nil, gridEntity, data.gridEntityTypeCustom)
|
|
65
|
-
return false
|
|
66
|
-
end
|
|
67
35
|
function preUseItemWeNeedToGoDeeper(self, _collectibleType, _rng, player, _useFlags, _activeSlot, _customVarData)
|
|
68
36
|
local room = game:GetRoom()
|
|
69
37
|
local roomListIndex = getRoomListIndex(nil)
|
|
@@ -113,7 +81,7 @@ function postNewRoomReordered(self)
|
|
|
113
81
|
local decoration = room:GetGridEntity(gridIndex)
|
|
114
82
|
if decoration == nil then
|
|
115
83
|
roomCustomGridEntities:delete(gridIndex)
|
|
116
|
-
goto
|
|
84
|
+
goto __continue13
|
|
117
85
|
end
|
|
118
86
|
if data.anm2Path ~= nil then
|
|
119
87
|
local sprite = decoration:GetSprite()
|
|
@@ -122,7 +90,7 @@ function postNewRoomReordered(self)
|
|
|
122
90
|
sprite:Play(animationToPlay, true)
|
|
123
91
|
end
|
|
124
92
|
end
|
|
125
|
-
::
|
|
93
|
+
::__continue13::
|
|
126
94
|
end
|
|
127
95
|
end
|
|
128
96
|
local FEATURE_NAME = "customGridEntity"
|
|
@@ -140,7 +108,6 @@ v = {
|
|
|
140
108
|
-- @internal
|
|
141
109
|
function ____exports.customGridEntityInit(self, mod)
|
|
142
110
|
saveDataManager(nil, FEATURE_NAME, v)
|
|
143
|
-
mod:AddCallback(ModCallback.ENTITY_TAKE_DMG, entityTakeDmgGenericProp, EntityType.GENERIC_PROP)
|
|
144
111
|
mod:AddCallback(ModCallback.PRE_USE_ITEM, preUseItemWeNeedToGoDeeper, CollectibleType.WE_NEED_TO_GO_DEEPER)
|
|
145
112
|
mod:AddCallbackCustom(ModCallbackCustom.POST_NEW_ROOM_REORDERED, postNewRoomReordered)
|
|
146
113
|
end
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../src/features/extraConsoleCommands/init.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../src/features/extraConsoleCommands/init.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAWxD,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,WAAW,GAAG,IAAI,CAK/D"}
|
|
@@ -208,7 +208,7 @@ function evaluateCacheFlying(self, player)
|
|
|
208
208
|
player.CanFly = true
|
|
209
209
|
end
|
|
210
210
|
end
|
|
211
|
-
function entityTakeDmgPlayer(self)
|
|
211
|
+
function entityTakeDmgPlayer(self, _entity, _damageAmount, _damageFlags, _damageSource, _damageCountdownFrames)
|
|
212
212
|
if v.run.spamBloodRights then
|
|
213
213
|
return false
|
|
214
214
|
end
|
package/dist/functions/flag.d.ts
CHANGED
|
@@ -74,7 +74,7 @@ export declare function hasFlag<T extends BitFlag | BitFlag128>(flags: T | BitFl
|
|
|
74
74
|
*/
|
|
75
75
|
export declare function isEmptyFlag<T extends BitFlag | BitFlag128>(flag: T): boolean;
|
|
76
76
|
/**
|
|
77
|
-
* Helper function to determine whether damage to a player in the
|
|
77
|
+
* Helper function to determine whether damage to a player in the `ENTITY_TAKE_DMG` callback was
|
|
78
78
|
* self-inflicted. For example, damage from a Curse Room door, a Razor, or a Blood Donation Machine
|
|
79
79
|
* would count as self-inflicted damage.
|
|
80
80
|
*/
|
package/dist/functions/flag.lua
CHANGED
|
@@ -92,7 +92,7 @@ end
|
|
|
92
92
|
function ____exports.isEmptyFlag(self, flag)
|
|
93
93
|
return flag == 0
|
|
94
94
|
end
|
|
95
|
-
--- Helper function to determine whether damage to a player in the
|
|
95
|
+
--- Helper function to determine whether damage to a player in the `ENTITY_TAKE_DMG` callback was
|
|
96
96
|
-- self-inflicted. For example, damage from a Curse Room door, a Razor, or a Blood Donation Machine
|
|
97
97
|
-- would count as self-inflicted damage.
|
|
98
98
|
function ____exports.isSelfDamage(self, damageFlags)
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Uses the player's current health and other miscellaneous things to determine if incoming damage
|
|
6
6
|
* will be fatal.
|
|
7
7
|
*/
|
|
8
|
-
export declare function isDamageToPlayerFatal(player: EntityPlayer,
|
|
8
|
+
export declare function isDamageToPlayerFatal(player: EntityPlayer, amount: int, source: EntityRef, lastDamageGameFrame: int | undefined): boolean;
|
|
9
9
|
/**
|
|
10
10
|
* Assuming that we are on the frame of fatal damage, this function returns whether or not
|
|
11
11
|
* Mysterious Paper would rotate to Missing Poster on the frame that the "Game Over" screen would
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"revive.d.ts","sourceRoot":"","sources":["../../src/functions/revive.ts"],"names":[],"mappings":";;;AAsBA;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,YAAY,EACpB,
|
|
1
|
+
{"version":3,"file":"revive.d.ts","sourceRoot":"","sources":["../../src/functions/revive.ts"],"names":[],"mappings":";;;AAsBA;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,YAAY,EACpB,MAAM,EAAE,GAAG,EACX,MAAM,EAAE,SAAS,EACjB,mBAAmB,EAAE,GAAG,GAAG,SAAS,GACnC,OAAO,CAuFT;AAED;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAavE;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAa9D;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAYtE;AAED;;;GAGG;AACH,wBAAgB,4BAA4B,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAe1E"}
|
|
@@ -48,12 +48,12 @@ function ____exports.willReviveFromSpiritShackles(self, player)
|
|
|
48
48
|
end
|
|
49
49
|
--- Uses the player's current health and other miscellaneous things to determine if incoming damage
|
|
50
50
|
-- will be fatal.
|
|
51
|
-
function ____exports.isDamageToPlayerFatal(self, player,
|
|
51
|
+
function ____exports.isDamageToPlayerFatal(self, player, amount, source, lastDamageGameFrame)
|
|
52
52
|
local gameFrameCount = game:GetFrameCount()
|
|
53
53
|
local character = player:GetPlayerType()
|
|
54
54
|
local effects = player:GetEffects()
|
|
55
55
|
local isBerserk = effects:HasCollectibleEffect(CollectibleType.BERSERK)
|
|
56
|
-
if character == PlayerType.JACOB_B and
|
|
56
|
+
if character == PlayerType.JACOB_B and source.Type == EntityType.DARK_ESAU then
|
|
57
57
|
return false
|
|
58
58
|
end
|
|
59
59
|
if isBerserk then
|
|
@@ -73,7 +73,7 @@ function ____exports.isDamageToPlayerFatal(self, player, damageAmount, damageSou
|
|
|
73
73
|
return true
|
|
74
74
|
end
|
|
75
75
|
local playerNumAllHearts = getPlayerNumHitsRemaining(nil, player)
|
|
76
|
-
if
|
|
76
|
+
if amount < playerNumAllHearts then
|
|
77
77
|
return false
|
|
78
78
|
end
|
|
79
79
|
if ____exports.willReviveFromHeartbreak(nil, player) then
|
package/dist/index.d.ts
CHANGED
|
@@ -5662,7 +5662,7 @@ export declare function isDamageFromPlayer(damageSource: Entity): boolean;
|
|
|
5662
5662
|
* Uses the player's current health and other miscellaneous things to determine if incoming damage
|
|
5663
5663
|
* will be fatal.
|
|
5664
5664
|
*/
|
|
5665
|
-
export declare function isDamageToPlayerFatal(player: EntityPlayer,
|
|
5665
|
+
export declare function isDamageToPlayerFatal(player: EntityPlayer, amount: int, source: EntityRef, lastDamageGameFrame: int | undefined): boolean;
|
|
5666
5666
|
|
|
5667
5667
|
/**
|
|
5668
5668
|
* Helper function to check if the given room grid index is a dead end. Specifically, this is
|
|
@@ -6069,7 +6069,7 @@ export declare function isSack(pickup: EntityPickup): pickup is EntityPickupSack
|
|
|
6069
6069
|
export declare function isSecretRoomDoor(door: GridEntityDoor): boolean;
|
|
6070
6070
|
|
|
6071
6071
|
/**
|
|
6072
|
-
* Helper function to determine whether damage to a player in the
|
|
6072
|
+
* Helper function to determine whether damage to a player in the `ENTITY_TAKE_DMG` callback was
|
|
6073
6073
|
* self-inflicted. For example, damage from a Curse Room door, a Razor, or a Blood Donation Machine
|
|
6074
6074
|
* would count as self-inflicted damage.
|
|
6075
6075
|
*/
|
|
@@ -8705,7 +8705,7 @@ collectibleType?: CollectibleType
|
|
|
8705
8705
|
];
|
|
8706
8706
|
|
|
8707
8707
|
declare type PostPlayerFatalDamageRegisterParameters = [
|
|
8708
|
-
callback: (player: EntityPlayer,
|
|
8708
|
+
callback: (player: EntityPlayer, amount: float, damageFlags: BitFlags<DamageFlag>, source: EntityRef, countdownFrames: int) => boolean | undefined,
|
|
8709
8709
|
playerVariant?: PlayerVariant,
|
|
8710
8710
|
character?: PlayerType
|
|
8711
8711
|
];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "isaacscript-common",
|
|
3
|
-
"version": "8.4.
|
|
3
|
+
"version": "8.4.6",
|
|
4
4
|
"description": "Helper functions and features for IsaacScript mods.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"isaac",
|
|
@@ -22,6 +22,6 @@
|
|
|
22
22
|
"main": "dist/index",
|
|
23
23
|
"types": "dist/index.d.ts",
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"isaac-typescript-definitions": "^3.5.
|
|
25
|
+
"isaac-typescript-definitions": "^3.5.2"
|
|
26
26
|
}
|
|
27
27
|
}
|
|
@@ -54,26 +54,26 @@ function hasSubscriptions() {
|
|
|
54
54
|
// ModCallback.ENTITY_TAKE_DMG (11)
|
|
55
55
|
// EntityType.PLAYER (1)
|
|
56
56
|
function entityTakeDmgPlayer(
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
entity: Entity,
|
|
58
|
+
_amount: float,
|
|
59
59
|
damageFlags: BitFlags<DamageFlag>,
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
_source: EntityRef,
|
|
61
|
+
_countdownFrames: int,
|
|
62
62
|
): boolean | undefined {
|
|
63
63
|
if (!hasSubscriptions()) {
|
|
64
64
|
return undefined;
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
incrementNumSacrifices(damageFlags); // Has to be before setting the damage frame
|
|
68
|
-
setDamageFrame(
|
|
68
|
+
setDamageFrame(entity, damageFlags);
|
|
69
69
|
|
|
70
70
|
return undefined;
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
function setDamageFrame(
|
|
73
|
+
function setDamageFrame(entity: Entity, damageFlags: BitFlags<DamageFlag>) {
|
|
74
74
|
const gameFrameCount = game.GetFrameCount();
|
|
75
75
|
|
|
76
|
-
const player =
|
|
76
|
+
const player = entity.ToPlayer();
|
|
77
77
|
if (player === undefined) {
|
|
78
78
|
return;
|
|
79
79
|
}
|
|
@@ -50,17 +50,17 @@ function hasSubscriptions() {
|
|
|
50
50
|
// ModCallback.ENTITY_TAKE_DMG (11)
|
|
51
51
|
// EntityType.PLAYER (1)
|
|
52
52
|
function entityTakeDmgPlayer(
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
entity: Entity,
|
|
54
|
+
amount: float,
|
|
55
55
|
damageFlags: BitFlags<DamageFlag>,
|
|
56
|
-
|
|
57
|
-
|
|
56
|
+
source: EntityRef,
|
|
57
|
+
countdownFrames: int,
|
|
58
58
|
): boolean | undefined {
|
|
59
59
|
if (!hasSubscriptions()) {
|
|
60
60
|
return undefined;
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
const player =
|
|
63
|
+
const player = entity.ToPlayer();
|
|
64
64
|
if (player === undefined) {
|
|
65
65
|
return undefined;
|
|
66
66
|
}
|
|
@@ -83,23 +83,16 @@ function entityTakeDmgPlayer(
|
|
|
83
83
|
return undefined;
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
if (
|
|
87
|
-
!isDamageToPlayerFatal(
|
|
88
|
-
player,
|
|
89
|
-
damageAmount,
|
|
90
|
-
damageSource,
|
|
91
|
-
lastDamageGameFrame,
|
|
92
|
-
)
|
|
93
|
-
) {
|
|
86
|
+
if (!isDamageToPlayerFatal(player, amount, source, lastDamageGameFrame)) {
|
|
94
87
|
return undefined;
|
|
95
88
|
}
|
|
96
89
|
|
|
97
90
|
const shouldSustainDeath = postPlayerFatalDamageFire(
|
|
98
91
|
player,
|
|
99
|
-
|
|
92
|
+
amount,
|
|
100
93
|
damageFlags,
|
|
101
|
-
|
|
102
|
-
|
|
94
|
+
source,
|
|
95
|
+
countdownFrames,
|
|
103
96
|
);
|
|
104
97
|
if (shouldSustainDeath !== undefined) {
|
|
105
98
|
return shouldSustainDeath;
|
|
@@ -35,17 +35,17 @@ function hasSubscriptions() {
|
|
|
35
35
|
// ModCallback.ENTITY_TAKE_DMG (11)
|
|
36
36
|
// EntityType.PLAYER (1)
|
|
37
37
|
function entityTakeDmgPlayer(
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
entity: Entity,
|
|
39
|
+
_amount: float,
|
|
40
40
|
damageFlags: BitFlags<DamageFlag>,
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
_source: EntityRef,
|
|
42
|
+
_countdownFrames: int,
|
|
43
43
|
): boolean | undefined {
|
|
44
44
|
if (!hasSubscriptions()) {
|
|
45
45
|
return undefined;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
const player =
|
|
48
|
+
const player = entity.ToPlayer();
|
|
49
49
|
if (player === undefined) {
|
|
50
50
|
return undefined;
|
|
51
51
|
}
|
|
@@ -52,17 +52,17 @@ function hasSubscriptions() {
|
|
|
52
52
|
// ModCallback.ENTITY_TAKE_DMG (11)
|
|
53
53
|
// EntityType.PLAYER (1)
|
|
54
54
|
function entityTakeDmgPlayer(
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
entity: Entity,
|
|
56
|
+
_amount: float,
|
|
57
57
|
_damageFlags: BitFlags<DamageFlag>,
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
_source: EntityRef,
|
|
59
|
+
_countdownFrames: int,
|
|
60
60
|
): boolean | undefined {
|
|
61
61
|
if (!hasSubscriptions()) {
|
|
62
62
|
return undefined;
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
const player =
|
|
65
|
+
const player = entity.ToPlayer();
|
|
66
66
|
if (player === undefined) {
|
|
67
67
|
return undefined;
|
|
68
68
|
}
|
|
@@ -7,10 +7,10 @@ import {
|
|
|
7
7
|
export type PostPlayerFatalDamageRegisterParameters = [
|
|
8
8
|
callback: (
|
|
9
9
|
player: EntityPlayer,
|
|
10
|
-
|
|
10
|
+
amount: float,
|
|
11
11
|
damageFlags: BitFlags<DamageFlag>,
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
source: EntityRef,
|
|
13
|
+
countdownFrames: int,
|
|
14
14
|
) => boolean | undefined,
|
|
15
15
|
playerVariant?: PlayerVariant,
|
|
16
16
|
character?: PlayerType,
|
|
@@ -30,10 +30,10 @@ export function postPlayerFatalDamageRegister(
|
|
|
30
30
|
|
|
31
31
|
export function postPlayerFatalDamageFire(
|
|
32
32
|
player: EntityPlayer,
|
|
33
|
-
|
|
33
|
+
amount: float,
|
|
34
34
|
damageFlags: BitFlags<DamageFlag>,
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
source: EntityRef,
|
|
36
|
+
countdownFrames: int,
|
|
37
37
|
): boolean | undefined {
|
|
38
38
|
const character = player.GetPlayerType();
|
|
39
39
|
|
|
@@ -50,10 +50,10 @@ export function postPlayerFatalDamageFire(
|
|
|
50
50
|
|
|
51
51
|
const shouldSustainDeath = callback(
|
|
52
52
|
player,
|
|
53
|
-
|
|
53
|
+
amount,
|
|
54
54
|
damageFlags,
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
source,
|
|
56
|
+
countdownFrames,
|
|
57
57
|
);
|
|
58
58
|
|
|
59
59
|
if (shouldSustainDeath !== undefined) {
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ActiveSlot,
|
|
3
3
|
CollectibleType,
|
|
4
|
-
DamageFlag,
|
|
5
|
-
EntityType,
|
|
6
4
|
GridCollisionClass,
|
|
7
5
|
GridEntityType,
|
|
8
6
|
ModCallback,
|
|
9
7
|
UseFlag,
|
|
10
8
|
} from "isaac-typescript-definitions";
|
|
11
|
-
import { postGridEntityCustomBrokenFire } from "../callbacks/subscriptions/postGridEntityCustomBroken";
|
|
12
9
|
import { DefaultMap } from "../classes/DefaultMap";
|
|
13
10
|
import { ModUpgraded } from "../classes/ModUpgraded";
|
|
14
11
|
import { game } from "../core/cachedClasses";
|
|
@@ -17,7 +14,6 @@ import {
|
|
|
17
14
|
areFeaturesInitialized,
|
|
18
15
|
errorIfFeaturesNotInitialized,
|
|
19
16
|
} from "../featuresInitialized";
|
|
20
|
-
import { hasFlag } from "../functions/flag";
|
|
21
17
|
import {
|
|
22
18
|
removeGridEntity,
|
|
23
19
|
spawnGridEntityWithVariant,
|
|
@@ -49,12 +45,6 @@ const v = {
|
|
|
49
45
|
export function customGridEntityInit(mod: ModUpgraded): void {
|
|
50
46
|
saveDataManager(FEATURE_NAME, v);
|
|
51
47
|
|
|
52
|
-
mod.AddCallback(
|
|
53
|
-
ModCallback.ENTITY_TAKE_DMG,
|
|
54
|
-
entityTakeDmgGenericProp,
|
|
55
|
-
EntityType.GENERIC_PROP,
|
|
56
|
-
); // 11
|
|
57
|
-
|
|
58
48
|
mod.AddCallback(
|
|
59
49
|
ModCallback.PRE_USE_ITEM,
|
|
60
50
|
preUseItemWeNeedToGoDeeper,
|
|
@@ -67,51 +57,6 @@ export function customGridEntityInit(mod: ModUpgraded): void {
|
|
|
67
57
|
);
|
|
68
58
|
}
|
|
69
59
|
|
|
70
|
-
// ModCallback.ENTITY_TAKE_DMG (11)
|
|
71
|
-
// EntityType.GENERIC_PROP (960)
|
|
72
|
-
function entityTakeDmgGenericProp(
|
|
73
|
-
tookDamage: Entity,
|
|
74
|
-
_damageAmount: float,
|
|
75
|
-
damageFlags: BitFlags<DamageFlag>,
|
|
76
|
-
_damageSource: EntityRef,
|
|
77
|
-
_damageCountdownFrames: int,
|
|
78
|
-
): boolean | undefined {
|
|
79
|
-
const ptrHash = GetPtrHash(tookDamage);
|
|
80
|
-
if (!v.room.genericPropPtrHashes.has(ptrHash)) {
|
|
81
|
-
return undefined;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
if (!hasFlag(damageFlags, DamageFlag.EXPLOSION)) {
|
|
85
|
-
return false;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
const room = game.GetRoom();
|
|
89
|
-
const roomListIndex = getRoomListIndex();
|
|
90
|
-
const roomCustomGridEntities = v.level.customGridEntities.get(roomListIndex);
|
|
91
|
-
if (roomCustomGridEntities === undefined) {
|
|
92
|
-
return false;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
const gridIndex = room.GetGridIndex(tookDamage.Position);
|
|
96
|
-
const data = roomCustomGridEntities.get(gridIndex);
|
|
97
|
-
if (data === undefined) {
|
|
98
|
-
return false;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
const gridEntity = room.GetGridEntity(gridIndex);
|
|
102
|
-
if (gridEntity === undefined) {
|
|
103
|
-
error(
|
|
104
|
-
`Failed to get the grid entity for a custom grid entity that broke at grid index: ${gridIndex}`,
|
|
105
|
-
);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
postGridEntityCustomBrokenFire(gridEntity, data.gridEntityTypeCustom);
|
|
109
|
-
|
|
110
|
-
// Even though the custom grid entity is now broken, we do not want to remove it, as the end-user
|
|
111
|
-
// could intend for it to persist with different graphics (or take multiple hits to be destroyed).
|
|
112
|
-
return false;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
60
|
// ModCallback.PRE_USE_ITEM (23)
|
|
116
61
|
// CollectibleType.WE_NEED_TO_GO_DEEPER (84)
|
|
117
62
|
function preUseItemWeNeedToGoDeeper(
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CacheFlag,
|
|
3
3
|
CollectibleType,
|
|
4
|
+
DamageFlag,
|
|
4
5
|
EntityType,
|
|
5
6
|
LevelCurse,
|
|
6
7
|
ModCallback,
|
|
@@ -348,7 +349,13 @@ function evaluateCacheFlying(player: EntityPlayer) {
|
|
|
348
349
|
|
|
349
350
|
// ModCallback.ENTITY_TAKE_DMG (11)
|
|
350
351
|
// EntityType.PLAYER (1)
|
|
351
|
-
function entityTakeDmgPlayer(
|
|
352
|
+
function entityTakeDmgPlayer(
|
|
353
|
+
_entity: Entity,
|
|
354
|
+
_damageAmount: float,
|
|
355
|
+
_damageFlags: BitFlags<DamageFlag>,
|
|
356
|
+
_damageSource: EntityRef,
|
|
357
|
+
_damageCountdownFrames: int,
|
|
358
|
+
) {
|
|
352
359
|
if (v.run.spamBloodRights) {
|
|
353
360
|
return false;
|
|
354
361
|
}
|
package/src/functions/flag.ts
CHANGED
|
@@ -119,7 +119,7 @@ export function isEmptyFlag<T extends BitFlag | BitFlag128>(flag: T): boolean {
|
|
|
119
119
|
}
|
|
120
120
|
|
|
121
121
|
/**
|
|
122
|
-
* Helper function to determine whether damage to a player in the
|
|
122
|
+
* Helper function to determine whether damage to a player in the `ENTITY_TAKE_DMG` callback was
|
|
123
123
|
* self-inflicted. For example, damage from a Curse Room door, a Razor, or a Blood Donation Machine
|
|
124
124
|
* would count as self-inflicted damage.
|
|
125
125
|
*/
|
package/src/functions/revive.ts
CHANGED
|
@@ -26,8 +26,8 @@ import { giveTrinketsBack, temporarilyRemoveTrinket } from "./trinketGive";
|
|
|
26
26
|
*/
|
|
27
27
|
export function isDamageToPlayerFatal(
|
|
28
28
|
player: EntityPlayer,
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
amount: int,
|
|
30
|
+
source: EntityRef,
|
|
31
31
|
lastDamageGameFrame: int | undefined,
|
|
32
32
|
): boolean {
|
|
33
33
|
const gameFrameCount = game.GetFrameCount();
|
|
@@ -39,7 +39,7 @@ export function isDamageToPlayerFatal(
|
|
|
39
39
|
// (because we will transform into Tainted Jacob's lost form).
|
|
40
40
|
if (
|
|
41
41
|
character === PlayerType.JACOB_B &&
|
|
42
|
-
|
|
42
|
+
source.Type === EntityType.DARK_ESAU
|
|
43
43
|
) {
|
|
44
44
|
return false;
|
|
45
45
|
}
|
|
@@ -79,7 +79,7 @@ export function isDamageToPlayerFatal(
|
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
const playerNumAllHearts = getPlayerNumHitsRemaining(player);
|
|
82
|
-
if (
|
|
82
|
+
if (amount < playerNumAllHearts) {
|
|
83
83
|
return false;
|
|
84
84
|
}
|
|
85
85
|
|