isaacscript-common 3.15.1 → 3.15.2
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.
|
@@ -2,8 +2,11 @@ local ____lualib = require("lualib_bundle")
|
|
|
2
2
|
local Map = ____lualib.Map
|
|
3
3
|
local __TS__New = ____lualib.__TS__New
|
|
4
4
|
local ____exports = {}
|
|
5
|
-
local hasSubscriptions, entityTakeDmgPlayer, v
|
|
5
|
+
local hasSubscriptions, entityTakeDmgPlayer, preUseItemBible, v
|
|
6
6
|
local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
|
|
7
|
+
local BossID = ____isaac_2Dtypescript_2Ddefinitions.BossID
|
|
8
|
+
local CollectibleType = ____isaac_2Dtypescript_2Ddefinitions.CollectibleType
|
|
9
|
+
local DamageFlagZero = ____isaac_2Dtypescript_2Ddefinitions.DamageFlagZero
|
|
7
10
|
local EntityType = ____isaac_2Dtypescript_2Ddefinitions.EntityType
|
|
8
11
|
local ModCallback = ____isaac_2Dtypescript_2Ddefinitions.ModCallback
|
|
9
12
|
local ____cachedClasses = require("cachedClasses")
|
|
@@ -18,6 +21,8 @@ local isChildPlayer = ____playerIndex.isChildPlayer
|
|
|
18
21
|
local ____revive = require("functions.revive")
|
|
19
22
|
local isDamageToPlayerFatal = ____revive.isDamageToPlayerFatal
|
|
20
23
|
local willPlayerRevive = ____revive.willPlayerRevive
|
|
24
|
+
local ____rooms = require("functions.rooms")
|
|
25
|
+
local inBossRoomOf = ____rooms.inBossRoomOf
|
|
21
26
|
local ____postPlayerFatalDamage = require("callbacks.subscriptions.postPlayerFatalDamage")
|
|
22
27
|
local postPlayerFatalDamageFire = ____postPlayerFatalDamage.postPlayerFatalDamageFire
|
|
23
28
|
local postPlayerFatalDamageHasSubscriptions = ____postPlayerFatalDamage.postPlayerFatalDamageHasSubscriptions
|
|
@@ -63,11 +68,32 @@ function entityTakeDmgPlayer(self, tookDamage, damageAmount, damageFlags, damage
|
|
|
63
68
|
end
|
|
64
69
|
return nil
|
|
65
70
|
end
|
|
71
|
+
function preUseItemBible(self, _collectibleType, _rng, player)
|
|
72
|
+
if not hasSubscriptions(nil) then
|
|
73
|
+
return false
|
|
74
|
+
end
|
|
75
|
+
if not inBossRoomOf(nil, BossID.SATAN) then
|
|
76
|
+
return false
|
|
77
|
+
end
|
|
78
|
+
local shouldSustainDeath = postPlayerFatalDamageFire(
|
|
79
|
+
nil,
|
|
80
|
+
player,
|
|
81
|
+
0,
|
|
82
|
+
DamageFlagZero,
|
|
83
|
+
EntityRef(player),
|
|
84
|
+
0
|
|
85
|
+
)
|
|
86
|
+
if shouldSustainDeath ~= nil then
|
|
87
|
+
return not shouldSustainDeath
|
|
88
|
+
end
|
|
89
|
+
return false
|
|
90
|
+
end
|
|
66
91
|
v = {run = {playersLastDamageGameFrame = __TS__New(Map)}}
|
|
67
92
|
---
|
|
68
93
|
-- @internal
|
|
69
94
|
function ____exports.postPlayerFatalDamageInit(self, mod)
|
|
70
95
|
saveDataManager(nil, "postPlayerFatalDamage", v)
|
|
71
96
|
mod:AddCallback(ModCallback.ENTITY_TAKE_DMG, entityTakeDmgPlayer, EntityType.PLAYER)
|
|
97
|
+
mod:AddCallback(ModCallback.PRE_USE_ITEM, preUseItemBible, CollectibleType.BIBLE)
|
|
72
98
|
end
|
|
73
99
|
return ____exports
|