isaacscript-common 3.14.0 → 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.
- package/callbacks/postPlayerFatalDamage.lua +27 -1
- package/functions/ambush.d.ts +7 -0
- package/functions/ambush.lua +50 -0
- package/index.d.ts +1 -0
- package/index.lua +8 -0
- package/package.json +1 -1
|
@@ -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
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Helper function to start a Challenge Room or the Boss Rush.
|
|
3
|
+
*
|
|
4
|
+
* Specifically, this is performed by spawning a sack on top of the player, waiting a game frame,
|
|
5
|
+
* and then removing the sack and the pickups that the sack dropped.
|
|
6
|
+
*/
|
|
7
|
+
export declare function startAmbush(): void;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
local ____lualib = require("lualib_bundle")
|
|
2
|
+
local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
|
|
3
|
+
local ____exports = {}
|
|
4
|
+
local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
|
|
5
|
+
local PickupVariant = ____isaac_2Dtypescript_2Ddefinitions.PickupVariant
|
|
6
|
+
local ____runInNFrames = require("features.runInNFrames")
|
|
7
|
+
local runNextGameFrame = ____runInNFrames.runNextGameFrame
|
|
8
|
+
local ____entity = require("functions.entity")
|
|
9
|
+
local removeEntities = ____entity.removeEntities
|
|
10
|
+
local ____entitySpecific = require("functions.entitySpecific")
|
|
11
|
+
local spawnPickupWithSeed = ____entitySpecific.spawnPickupWithSeed
|
|
12
|
+
local ____pickups = require("functions.pickups")
|
|
13
|
+
local getCoins = ____pickups.getCoins
|
|
14
|
+
--- Hard-coding this makes it easier to clean up the pickups afterwards.
|
|
15
|
+
local SACK_SEED_THAT_SPAWNS_TWO_COINS = 6
|
|
16
|
+
--- Helper function to start a Challenge Room or the Boss Rush.
|
|
17
|
+
--
|
|
18
|
+
-- Specifically, this is performed by spawning a sack on top of the player, waiting a game frame,
|
|
19
|
+
-- and then removing the sack and the pickups that the sack dropped.
|
|
20
|
+
function ____exports.startAmbush(self)
|
|
21
|
+
local player = Isaac.GetPlayer()
|
|
22
|
+
local sack = spawnPickupWithSeed(
|
|
23
|
+
nil,
|
|
24
|
+
PickupVariant.SACK,
|
|
25
|
+
0,
|
|
26
|
+
player.Position,
|
|
27
|
+
SACK_SEED_THAT_SPAWNS_TWO_COINS
|
|
28
|
+
)
|
|
29
|
+
local sprite = sack:GetSprite()
|
|
30
|
+
sprite:Stop()
|
|
31
|
+
local sackPtr = EntityPtr(sack)
|
|
32
|
+
runNextGameFrame(
|
|
33
|
+
nil,
|
|
34
|
+
function()
|
|
35
|
+
local futureSack = sackPtr.Ref
|
|
36
|
+
if futureSack == nil then
|
|
37
|
+
return
|
|
38
|
+
end
|
|
39
|
+
futureSack:Remove()
|
|
40
|
+
local sackPtrHash = GetPtrHash(futureSack)
|
|
41
|
+
local coins = getCoins(nil)
|
|
42
|
+
local coinsFromSack = __TS__ArrayFilter(
|
|
43
|
+
coins,
|
|
44
|
+
function(____, pickup) return pickup.SpawnerEntity ~= nil and GetPtrHash(pickup.SpawnerEntity) == sackPtrHash end
|
|
45
|
+
)
|
|
46
|
+
removeEntities(nil, coinsFromSack)
|
|
47
|
+
end
|
|
48
|
+
)
|
|
49
|
+
end
|
|
50
|
+
return ____exports
|
package/index.d.ts
CHANGED
|
@@ -28,6 +28,7 @@ export { runInNGameFrames, runInNRenderFrames, runNextGameFrame, runNextRenderFr
|
|
|
28
28
|
export * from "./features/saveDataManager/exports";
|
|
29
29
|
export { hasSirenStolenFamiliar, setFamiliarNoSirenSteal, } from "./features/sirenHelpers";
|
|
30
30
|
export { getTaintedLazarusSubPlayer } from "./features/taintedLazarusPlayers";
|
|
31
|
+
export * from "./functions/ambush";
|
|
31
32
|
export * from "./functions/array";
|
|
32
33
|
export * from "./functions/benchmark";
|
|
33
34
|
export * from "./functions/bitwise";
|
package/index.lua
CHANGED
|
@@ -223,6 +223,14 @@ do
|
|
|
223
223
|
local getTaintedLazarusSubPlayer = ____taintedLazarusPlayers.getTaintedLazarusSubPlayer
|
|
224
224
|
____exports.getTaintedLazarusSubPlayer = getTaintedLazarusSubPlayer
|
|
225
225
|
end
|
|
226
|
+
do
|
|
227
|
+
local ____export = require("functions.ambush")
|
|
228
|
+
for ____exportKey, ____exportValue in pairs(____export) do
|
|
229
|
+
if ____exportKey ~= "default" then
|
|
230
|
+
____exports[____exportKey] = ____exportValue
|
|
231
|
+
end
|
|
232
|
+
end
|
|
233
|
+
end
|
|
226
234
|
do
|
|
227
235
|
local ____export = require("functions.array")
|
|
228
236
|
for ____exportKey, ____exportValue in pairs(____export) do
|