isaacscript-common 3.6.0 → 3.9.0

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.
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,56 @@
1
+ local ____exports = {}
2
+ local hasSubscriptions, postUpdate, getAmbushType, v
3
+ local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
4
+ local ModCallback = ____isaac_2Dtypescript_2Ddefinitions.ModCallback
5
+ local RoomType = ____isaac_2Dtypescript_2Ddefinitions.RoomType
6
+ local ____cachedClasses = require("cachedClasses")
7
+ local game = ____cachedClasses.game
8
+ local ____AmbushType = require("enums.AmbushType")
9
+ local AmbushType = ____AmbushType.AmbushType
10
+ local ____exports = require("features.saveDataManager.exports")
11
+ local saveDataManager = ____exports.saveDataManager
12
+ local ____roomData = require("functions.roomData")
13
+ local getRoomType = ____roomData.getRoomType
14
+ local ____postAmbushFinished = require("callbacks.subscriptions.postAmbushFinished")
15
+ local postAmbushFinishedFire = ____postAmbushFinished.postAmbushFinishedFire
16
+ local postAmbushFinishedHasSubscriptions = ____postAmbushFinished.postAmbushFinishedHasSubscriptions
17
+ local ____postAmbushStarted = require("callbacks.subscriptions.postAmbushStarted")
18
+ local postAmbushStartedFire = ____postAmbushStarted.postAmbushStartedFire
19
+ local postAmbushStartedHasSubscriptions = ____postAmbushStarted.postAmbushStartedHasSubscriptions
20
+ function hasSubscriptions(self)
21
+ return postAmbushStartedHasSubscriptions(nil) or postAmbushFinishedHasSubscriptions(nil)
22
+ end
23
+ function postUpdate(self)
24
+ if not hasSubscriptions(nil) then
25
+ return
26
+ end
27
+ local room = game:GetRoom()
28
+ if not v.room.ambushActive then
29
+ local ambushActive = room:IsAmbushActive()
30
+ if ambushActive then
31
+ v.room.ambushActive = true
32
+ local ambushType = getAmbushType(nil)
33
+ postAmbushStartedFire(nil, ambushType)
34
+ end
35
+ end
36
+ if not v.room.ambushDone then
37
+ local ambushDone = room:IsAmbushDone()
38
+ if ambushDone then
39
+ v.room.ambushDone = true
40
+ local ambushType = getAmbushType(nil)
41
+ postAmbushFinishedFire(nil, ambushType)
42
+ end
43
+ end
44
+ end
45
+ function getAmbushType(self)
46
+ local roomType = getRoomType(nil)
47
+ return roomType == RoomType.BOSS_RUSH and AmbushType.BOSS_RUSH or AmbushType.CHALLENGE_ROOM
48
+ end
49
+ v = {room = {ambushActive = false, ambushDone = false}}
50
+ ---
51
+ -- @internal
52
+ function ____exports.postAmbushCallbacksInit(self, mod)
53
+ saveDataManager(nil, "postAmbushCallbacks", v, hasSubscriptions)
54
+ mod:AddCallback(ModCallback.POST_UPDATE, postUpdate)
55
+ end
56
+ return ____exports
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,33 @@
1
+ local ____lualib = require("lualib_bundle")
2
+ local Set = ____lualib.Set
3
+ local __TS__New = ____lualib.__TS__New
4
+ local ____exports = {}
5
+ local hasSubscriptions, postBombUpdate, v
6
+ local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
7
+ local ModCallback = ____isaac_2Dtypescript_2Ddefinitions.ModCallback
8
+ local ____exports = require("features.saveDataManager.exports")
9
+ local saveDataManager = ____exports.saveDataManager
10
+ local ____postBoneDetonated = require("callbacks.subscriptions.postBoneDetonated")
11
+ local postBombDetonatedFire = ____postBoneDetonated.postBombDetonatedFire
12
+ local postBombDetonatedHasSubscriptions = ____postBoneDetonated.postBombDetonatedHasSubscriptions
13
+ function hasSubscriptions(self)
14
+ return postBombDetonatedHasSubscriptions(nil)
15
+ end
16
+ function postBombUpdate(self, bomb)
17
+ if not hasSubscriptions(nil) then
18
+ return
19
+ end
20
+ local index = GetPtrHash(bomb)
21
+ if not v.room.firedSet:has(index) then
22
+ v.room.firedSet:add(index)
23
+ postBombDetonatedFire(nil, bomb)
24
+ end
25
+ end
26
+ v = {room = {firedSet = __TS__New(Set)}}
27
+ ---
28
+ -- @internal
29
+ function ____exports.postBombDetonatedInit(self, mod)
30
+ saveDataManager(nil, "postBombDetonated", v, hasSubscriptions)
31
+ mod:AddCallback(ModCallback.POST_BOMB_UPDATE, postBombUpdate)
32
+ end
33
+ return ____exports
@@ -0,0 +1,5 @@
1
+ import { AmbushType } from "../../enums/AmbushType";
2
+ export declare type PostAmbushFinishedRegisterParameters = [
3
+ callback: (ambushType: AmbushType) => void,
4
+ ambushType?: AmbushType
5
+ ];
@@ -0,0 +1,29 @@
1
+ local ____exports = {}
2
+ local subscriptions = {}
3
+ ---
4
+ -- @internal
5
+ function ____exports.postAmbushFinishedHasSubscriptions(self)
6
+ return #subscriptions > 0
7
+ end
8
+ ---
9
+ -- @internal
10
+ function ____exports.postAmbushFinishedRegister(self, ...)
11
+ local args = {...}
12
+ subscriptions[#subscriptions + 1] = args
13
+ end
14
+ ---
15
+ -- @internal
16
+ function ____exports.postAmbushFinishedFire(self, ambushType)
17
+ for ____, ____value in ipairs(subscriptions) do
18
+ local callback = ____value[1]
19
+ local callbackAmbushType = ____value[2]
20
+ do
21
+ if callbackAmbushType ~= nil and callbackAmbushType ~= ambushType then
22
+ goto __continue5
23
+ end
24
+ callback(nil, ambushType)
25
+ end
26
+ ::__continue5::
27
+ end
28
+ end
29
+ return ____exports
@@ -0,0 +1,5 @@
1
+ import { AmbushType } from "../../enums/AmbushType";
2
+ export declare type PostAmbushStartedRegisterParameters = [
3
+ callback: (ambushType: AmbushType) => void,
4
+ ambushType?: AmbushType
5
+ ];
@@ -0,0 +1,29 @@
1
+ local ____exports = {}
2
+ local subscriptions = {}
3
+ ---
4
+ -- @internal
5
+ function ____exports.postAmbushStartedHasSubscriptions(self)
6
+ return #subscriptions > 0
7
+ end
8
+ ---
9
+ -- @internal
10
+ function ____exports.postAmbushStartedRegister(self, ...)
11
+ local args = {...}
12
+ subscriptions[#subscriptions + 1] = args
13
+ end
14
+ ---
15
+ -- @internal
16
+ function ____exports.postAmbushStartedFire(self, ambushType)
17
+ for ____, ____value in ipairs(subscriptions) do
18
+ local callback = ____value[1]
19
+ local callbackAmbushType = ____value[2]
20
+ do
21
+ if callbackAmbushType ~= nil and callbackAmbushType ~= ambushType then
22
+ goto __continue5
23
+ end
24
+ callback(nil, ambushType)
25
+ end
26
+ ::__continue5::
27
+ end
28
+ end
29
+ return ____exports
@@ -0,0 +1,5 @@
1
+ import { BombVariant } from "isaac-typescript-definitions";
2
+ export declare type PostBombDetonatedRegisterParameters = [
3
+ callback: (bomb: EntityBomb) => void,
4
+ bombVariant?: BombVariant
5
+ ];
@@ -0,0 +1,29 @@
1
+ local ____exports = {}
2
+ local subscriptions = {}
3
+ ---
4
+ -- @internal
5
+ function ____exports.postBombDetonatedHasSubscriptions(self)
6
+ return #subscriptions > 0
7
+ end
8
+ ---
9
+ -- @internal
10
+ function ____exports.postBombDetonatedRegister(self, ...)
11
+ local args = {...}
12
+ subscriptions[#subscriptions + 1] = args
13
+ end
14
+ ---
15
+ -- @internal
16
+ function ____exports.postBombDetonatedFire(self, bomb)
17
+ for ____, ____value in ipairs(subscriptions) do
18
+ local callback = ____value[1]
19
+ local bombVariant = ____value[2]
20
+ do
21
+ if bombVariant ~= nil and bombVariant ~= bomb.Variant then
22
+ goto __continue5
23
+ end
24
+ callback(nil, bomb)
25
+ end
26
+ ::__continue5::
27
+ end
28
+ end
29
+ return ____exports
package/constants.d.ts CHANGED
@@ -73,6 +73,10 @@ export declare const MAX_PLAYER_HEART_CONTAINERS = 18;
73
73
  */
74
74
  export declare const MAX_PLAYER_SPEED_IN_UNITS = 9.8;
75
75
  export declare const MAX_PLAYER_TRINKET_SLOTS: number;
76
+ /** If you set `EntityPlayer.ShotSpeed` lower than this value, it will have no effect. */
77
+ export declare const MIN_PLAYER_SHOT_SPEED_STAT = 0.6;
78
+ /** If you set `EntityPlayer.Speed` lower than this value, it will have no effect. */
79
+ export declare const MIN_PLAYER_SPEED_STAT = 0.1;
76
80
  export declare const FIRST_ROOM_TYPE = RoomType.DEFAULT;
77
81
  export declare const LAST_ROOM_TYPE: RoomType;
78
82
  /**
package/constants.lua CHANGED
@@ -61,6 +61,10 @@ ____exports.MAX_PLAYER_HEART_CONTAINERS = 18
61
61
  -- constant specifies a value of 9.8 to be safe.
62
62
  ____exports.MAX_PLAYER_SPEED_IN_UNITS = 9.8
63
63
  ____exports.MAX_PLAYER_TRINKET_SLOTS = getEnumLength(nil, TrinketSlot)
64
+ --- If you set `EntityPlayer.ShotSpeed` lower than this value, it will have no effect.
65
+ ____exports.MIN_PLAYER_SHOT_SPEED_STAT = 0.6
66
+ --- If you set `EntityPlayer.Speed` lower than this value, it will have no effect.
67
+ ____exports.MIN_PLAYER_SPEED_STAT = 0.1
64
68
  ____exports.FIRST_ROOM_TYPE = RoomType.DEFAULT
65
69
  ____exports.LAST_ROOM_TYPE = getLastEnumValue(nil, RoomType)
66
70
  --- The maximum speed stat that a player can have. Any additional speed beyond this will not take
@@ -0,0 +1,4 @@
1
+ export declare enum AmbushType {
2
+ CHALLENGE_ROOM = 0,
3
+ BOSS_RUSH = 1
4
+ }
@@ -0,0 +1,7 @@
1
+ local ____exports = {}
2
+ ____exports.AmbushType = {}
3
+ ____exports.AmbushType.CHALLENGE_ROOM = 0
4
+ ____exports.AmbushType[____exports.AmbushType.CHALLENGE_ROOM] = "CHALLENGE_ROOM"
5
+ ____exports.AmbushType.BOSS_RUSH = 1
6
+ ____exports.AmbushType[____exports.AmbushType.BOSS_RUSH] = "BOSS_RUSH"
7
+ return ____exports