isaacscript-common 1.0.596 → 1.0.600
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/preBerserkDeath.lua +3 -1
- package/dist/constants.d.ts +2 -0
- package/dist/constants.lua +16 -0
- package/dist/functions/entity.d.ts +6 -0
- package/dist/functions/entity.lua +5 -0
- package/dist/functions/player.d.ts +5 -0
- package/dist/functions/player.lua +14 -9
- package/dist/functions/stage.d.ts +1 -0
- package/dist/functions/stage.lua +17 -14
- package/dist/lualib_bundle.lua +9 -0
- package/package.json +5 -5
|
@@ -4,6 +4,8 @@ local hasSubscriptions, postPEffectUpdateReordered
|
|
|
4
4
|
local ____player = require("functions.player")
|
|
5
5
|
local getPlayerNumAllHearts = ____player.getPlayerNumAllHearts
|
|
6
6
|
local isChildPlayer = ____player.isChildPlayer
|
|
7
|
+
local ____revive = require("functions.revive")
|
|
8
|
+
local willPlayerRevive = ____revive.willPlayerRevive
|
|
7
9
|
local ____ModCallbacksCustom = require("types.ModCallbacksCustom")
|
|
8
10
|
local ModCallbacksCustom = ____ModCallbacksCustom.ModCallbacksCustom
|
|
9
11
|
local ____preBerserkDeath = require("callbacks.subscriptions.preBerserkDeath")
|
|
@@ -22,7 +24,7 @@ function postPEffectUpdateReordered(self, player)
|
|
|
22
24
|
local effects = player:GetEffects()
|
|
23
25
|
local berserkEffect = effects:GetCollectibleEffect(CollectibleType.COLLECTIBLE_BERSERK)
|
|
24
26
|
local playerNumAllHearts = getPlayerNumAllHearts(nil, player)
|
|
25
|
-
if berserkEffect ~= nil and berserkEffect.Cooldown == 1 and playerNumAllHearts == 0 then
|
|
27
|
+
if berserkEffect ~= nil and berserkEffect.Cooldown == 1 and playerNumAllHearts == 0 and not willPlayerRevive(nil, player) then
|
|
26
28
|
preBerserkDeathFire(nil, player)
|
|
27
29
|
end
|
|
28
30
|
end
|
package/dist/constants.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ export declare const BLIND_ITEM_PNG_PATH = "gfx/items/collectibles/questionmark.
|
|
|
13
13
|
export declare const BOMB_EXPLODE_FRAME = 45;
|
|
14
14
|
export declare const CHARACTERS_WITH_AN_ACTIVE_ITEM: Set<PlayerType>;
|
|
15
15
|
export declare const CHARACTERS_WITH_BLACK_HEART_FROM_ETERNAL_HEART: Set<PlayerType>;
|
|
16
|
+
export declare const CHARACTERS_WITH_FREE_DEVIL_DEALS: Set<PlayerType>;
|
|
16
17
|
/**
|
|
17
18
|
* The set of characters where red heart containers will be turned into soul hearts (e.g. Blue
|
|
18
19
|
* Baby). This includes The Lost and Tainted Lost. This does not include Keeper or Tainted Keeper.
|
|
@@ -105,6 +106,7 @@ export declare const MOVEMENT_ACTIONS: Set<ButtonAction>;
|
|
|
105
106
|
export declare const ONE_BY_ONE_ROOM_GRID_SIZE = 135;
|
|
106
107
|
export declare const SINGLE_USE_ACTIVE_COLLECTIBLE_TYPES: Set<CollectibleType>;
|
|
107
108
|
export declare const SHOOTING_ACTIONS: Set<ButtonAction>;
|
|
109
|
+
export declare const STORY_BOSSES: Set<EntityType>;
|
|
108
110
|
/**
|
|
109
111
|
* This is the number of draw coordinates that each heart spans on the UI in the upper left hand
|
|
110
112
|
* corner.
|
package/dist/constants.lua
CHANGED
|
@@ -18,6 +18,7 @@ ____exports.CHARACTERS_WITH_AN_ACTIVE_ITEM = __TS__New(Set, {
|
|
|
18
18
|
PlayerType.PLAYER_EDEN_B
|
|
19
19
|
})
|
|
20
20
|
____exports.CHARACTERS_WITH_BLACK_HEART_FROM_ETERNAL_HEART = __TS__New(Set, {PlayerType.PLAYER_BLACKJUDAS, PlayerType.PLAYER_JUDAS_B})
|
|
21
|
+
____exports.CHARACTERS_WITH_FREE_DEVIL_DEALS = __TS__New(Set, {PlayerType.PLAYER_THELOST, PlayerType.PLAYER_THELOST_B, PlayerType.PLAYER_JACOB2_B})
|
|
21
22
|
____exports.CHARACTERS_WITH_NO_RED_HEARTS = __TS__New(Set, {
|
|
22
23
|
PlayerType.PLAYER_BLUEBABY,
|
|
23
24
|
PlayerType.PLAYER_THELOST,
|
|
@@ -98,5 +99,20 @@ ____exports.SINGLE_USE_ACTIVE_COLLECTIBLE_TYPES = __TS__New(Set, {
|
|
|
98
99
|
CollectibleType.COLLECTIBLE_R_KEY
|
|
99
100
|
})
|
|
100
101
|
____exports.SHOOTING_ACTIONS = __TS__New(Set, {ButtonAction.ACTION_SHOOTLEFT, ButtonAction.ACTION_SHOOTRIGHT, ButtonAction.ACTION_SHOOTUP, ButtonAction.ACTION_SHOOTDOWN})
|
|
102
|
+
____exports.STORY_BOSSES = __TS__New(Set, {
|
|
103
|
+
EntityType.ENTITY_MOM,
|
|
104
|
+
EntityType.ENTITY_MOMS_HEART,
|
|
105
|
+
EntityType.ENTITY_SATAN,
|
|
106
|
+
EntityType.ENTITY_ISAAC,
|
|
107
|
+
EntityType.ENTITY_THE_LAMB,
|
|
108
|
+
EntityType.ENTITY_MEGA_SATAN,
|
|
109
|
+
EntityType.ENTITY_MEGA_SATAN_2,
|
|
110
|
+
EntityType.ENTITY_ULTRA_GREED,
|
|
111
|
+
EntityType.ENTITY_HUSH,
|
|
112
|
+
EntityType.ENTITY_DELIRIUM,
|
|
113
|
+
EntityType.ENTITY_MOTHER,
|
|
114
|
+
EntityType.ENTITY_DOGMA,
|
|
115
|
+
EntityType.ENTITY_BEAST
|
|
116
|
+
})
|
|
101
117
|
____exports.UI_HEART_WIDTH = 12
|
|
102
118
|
return ____exports
|
|
@@ -165,6 +165,12 @@ export declare function getTears(matchingVariant?: number, matchingSubType?: num
|
|
|
165
165
|
* @param threshold Optional. The threshold from 0 to consider to be moving. 0.01 by default.
|
|
166
166
|
*/
|
|
167
167
|
export declare function isEntityMoving(entity: Entity, threshold?: number): boolean;
|
|
168
|
+
/**
|
|
169
|
+
* Helper function to determine if the current entity is an end-game story boss, like Isaac, Blue
|
|
170
|
+
* Baby, Mega Satan, The Beast, and so on. This is useful because certain effects should only apply
|
|
171
|
+
* to non-story bosses, like Vanishing Twin. Also see the `STORY_BOSSES` constant.
|
|
172
|
+
*/
|
|
173
|
+
export declare function isStoryBoss(entity: Entity): boolean;
|
|
168
174
|
/**
|
|
169
175
|
* Helper function to remove all of the entities in the supplied array.
|
|
170
176
|
*
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
2
|
require("lualib_bundle");
|
|
3
3
|
local ____exports = {}
|
|
4
|
+
local ____constants = require("constants")
|
|
5
|
+
local STORY_BOSSES = ____constants.STORY_BOSSES
|
|
4
6
|
local ____random = require("functions.random")
|
|
5
7
|
local getRandom = ____random.getRandom
|
|
6
8
|
local nextSeed = ____random.nextSeed
|
|
@@ -230,6 +232,9 @@ function ____exports.isEntityMoving(self, entity, threshold)
|
|
|
230
232
|
end
|
|
231
233
|
return entity.Velocity:Length() >= threshold
|
|
232
234
|
end
|
|
235
|
+
function ____exports.isStoryBoss(self, entity)
|
|
236
|
+
return STORY_BOSSES:has(entity.Type)
|
|
237
|
+
end
|
|
233
238
|
function ____exports.removeEntities(self, entities, cap)
|
|
234
239
|
if #entities == 0 then
|
|
235
240
|
return false
|
|
@@ -195,6 +195,11 @@ export declare function isJacobOrEsau(player: EntityPlayer): boolean;
|
|
|
195
195
|
export declare function isKeeper(player: EntityPlayer): boolean;
|
|
196
196
|
/** Helper function for detecting when a player is The Lost or Tainted Lost. */
|
|
197
197
|
export declare function isLost(player: EntityPlayer): boolean;
|
|
198
|
+
/**
|
|
199
|
+
* Helper function for detecting when a player is one of the characters that can take free Devil
|
|
200
|
+
* Deals. (e.g. The Lost, Tainted Lost, etc.)
|
|
201
|
+
*/
|
|
202
|
+
export declare function canTakeFreeDevilDeals(player: EntityPlayer): boolean;
|
|
198
203
|
/** Helper function for detecting when a player is Tainted Lazarus or Dead Tainted Lazarus. */
|
|
199
204
|
export declare function isTaintedLazarus(player: EntityPlayer): boolean;
|
|
200
205
|
export declare function removeCollectibleCostume(player: EntityPlayer, collectibleType: CollectibleType | int): void;
|
|
@@ -4,6 +4,7 @@ local ____exports = {}
|
|
|
4
4
|
local EXCLUDED_CHARACTERS
|
|
5
5
|
local ____constants = require("constants")
|
|
6
6
|
local CHARACTERS_WITH_BLACK_HEART_FROM_ETERNAL_HEART = ____constants.CHARACTERS_WITH_BLACK_HEART_FROM_ETERNAL_HEART
|
|
7
|
+
local CHARACTERS_WITH_FREE_DEVIL_DEALS = ____constants.CHARACTERS_WITH_FREE_DEVIL_DEALS
|
|
7
8
|
local CHARACTERS_WITH_NO_RED_HEARTS = ____constants.CHARACTERS_WITH_NO_RED_HEARTS
|
|
8
9
|
local CHARACTERS_WITH_NO_SOUL_HEARTS = ____constants.CHARACTERS_WITH_NO_SOUL_HEARTS
|
|
9
10
|
local LOST_STYLE_PLAYER_TYPES = ____constants.LOST_STYLE_PLAYER_TYPES
|
|
@@ -400,6 +401,10 @@ function ____exports.isLost(self, player)
|
|
|
400
401
|
local character = player:GetPlayerType()
|
|
401
402
|
return character == PlayerType.PLAYER_THELOST or character == PlayerType.PLAYER_THELOST_B
|
|
402
403
|
end
|
|
404
|
+
function ____exports.canTakeFreeDevilDeals(self, player)
|
|
405
|
+
local character = player:GetPlayerType()
|
|
406
|
+
return CHARACTERS_WITH_FREE_DEVIL_DEALS:has(character)
|
|
407
|
+
end
|
|
403
408
|
function ____exports.isTaintedLazarus(self, player)
|
|
404
409
|
local character = player:GetPlayerType()
|
|
405
410
|
return character == PlayerType.PLAYER_LAZARUS_B or character == PlayerType.PLAYER_LAZARUS2_B
|
|
@@ -445,9 +450,9 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
|
|
|
445
450
|
itemPool:RemoveCollectible(collectibleType)
|
|
446
451
|
end
|
|
447
452
|
repeat
|
|
448
|
-
local
|
|
449
|
-
local
|
|
450
|
-
if
|
|
453
|
+
local ____switch118 = activeSlot
|
|
454
|
+
local ____cond118 = ____switch118 == ActiveSlot.SLOT_PRIMARY
|
|
455
|
+
if ____cond118 then
|
|
451
456
|
do
|
|
452
457
|
if primaryCollectibleType ~= CollectibleType.COLLECTIBLE_NULL then
|
|
453
458
|
player:RemoveCollectible(primaryCollectibleType)
|
|
@@ -456,8 +461,8 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
|
|
|
456
461
|
break
|
|
457
462
|
end
|
|
458
463
|
end
|
|
459
|
-
|
|
460
|
-
if
|
|
464
|
+
____cond118 = ____cond118 or ____switch118 == ActiveSlot.SLOT_SECONDARY
|
|
465
|
+
if ____cond118 then
|
|
461
466
|
do
|
|
462
467
|
if primaryCollectibleType ~= CollectibleType.COLLECTIBLE_NULL then
|
|
463
468
|
player:RemoveCollectible(primaryCollectibleType)
|
|
@@ -472,16 +477,16 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
|
|
|
472
477
|
break
|
|
473
478
|
end
|
|
474
479
|
end
|
|
475
|
-
|
|
476
|
-
if
|
|
480
|
+
____cond118 = ____cond118 or ____switch118 == ActiveSlot.SLOT_POCKET
|
|
481
|
+
if ____cond118 then
|
|
477
482
|
do
|
|
478
483
|
player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
|
|
479
484
|
player:SetActiveCharge(charge, activeSlot)
|
|
480
485
|
break
|
|
481
486
|
end
|
|
482
487
|
end
|
|
483
|
-
|
|
484
|
-
if
|
|
488
|
+
____cond118 = ____cond118 or ____switch118 == ActiveSlot.SLOT_POCKET2
|
|
489
|
+
if ____cond118 then
|
|
485
490
|
do
|
|
486
491
|
player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
|
|
487
492
|
break
|
|
@@ -11,6 +11,7 @@ export declare function getStage(): LevelStage;
|
|
|
11
11
|
export declare function getStageType(): StageType;
|
|
12
12
|
/** Helper function to directly warp to a specific stage using the "stage" console command. */
|
|
13
13
|
export declare function goToStage(stage: LevelStage, stageType: StageType): void;
|
|
14
|
+
export declare function isRepentanceStage(stageType: int): boolean;
|
|
14
15
|
export declare function onCathedral(): boolean;
|
|
15
16
|
export declare function onChest(): boolean;
|
|
16
17
|
export declare function onDarkRoom(): boolean;
|
package/dist/functions/stage.lua
CHANGED
|
@@ -2,47 +2,50 @@
|
|
|
2
2
|
local ____exports = {}
|
|
3
3
|
local ____util = require("functions.util")
|
|
4
4
|
local ensureAllCases = ____util.ensureAllCases
|
|
5
|
+
function ____exports.isRepentanceStage(self, stageType)
|
|
6
|
+
return stageType == StageType.STAGETYPE_REPENTANCE or stageType == StageType.STAGETYPE_REPENTANCE_B
|
|
7
|
+
end
|
|
5
8
|
function ____exports.onRepentanceStage(self)
|
|
6
9
|
local game = Game()
|
|
7
10
|
local level = game:GetLevel()
|
|
8
11
|
local stageType = level:GetStageType()
|
|
9
|
-
return
|
|
12
|
+
return ____exports.isRepentanceStage(nil, stageType)
|
|
10
13
|
end
|
|
11
14
|
function ____exports.stageTypeToLetter(self, stageType)
|
|
12
15
|
repeat
|
|
13
|
-
local
|
|
14
|
-
local
|
|
15
|
-
if
|
|
16
|
+
local ____switch15 = stageType
|
|
17
|
+
local ____cond15 = ____switch15 == StageType.STAGETYPE_ORIGINAL
|
|
18
|
+
if ____cond15 then
|
|
16
19
|
do
|
|
17
20
|
return ""
|
|
18
21
|
end
|
|
19
22
|
end
|
|
20
|
-
|
|
21
|
-
if
|
|
23
|
+
____cond15 = ____cond15 or ____switch15 == StageType.STAGETYPE_WOTL
|
|
24
|
+
if ____cond15 then
|
|
22
25
|
do
|
|
23
26
|
return "a"
|
|
24
27
|
end
|
|
25
28
|
end
|
|
26
|
-
|
|
27
|
-
if
|
|
29
|
+
____cond15 = ____cond15 or ____switch15 == StageType.STAGETYPE_AFTERBIRTH
|
|
30
|
+
if ____cond15 then
|
|
28
31
|
do
|
|
29
32
|
return "b"
|
|
30
33
|
end
|
|
31
34
|
end
|
|
32
|
-
|
|
33
|
-
if
|
|
35
|
+
____cond15 = ____cond15 or ____switch15 == StageType.STAGETYPE_GREEDMODE
|
|
36
|
+
if ____cond15 then
|
|
34
37
|
do
|
|
35
38
|
return ""
|
|
36
39
|
end
|
|
37
40
|
end
|
|
38
|
-
|
|
39
|
-
if
|
|
41
|
+
____cond15 = ____cond15 or ____switch15 == StageType.STAGETYPE_REPENTANCE
|
|
42
|
+
if ____cond15 then
|
|
40
43
|
do
|
|
41
44
|
return "c"
|
|
42
45
|
end
|
|
43
46
|
end
|
|
44
|
-
|
|
45
|
-
if
|
|
47
|
+
____cond15 = ____cond15 or ____switch15 == StageType.STAGETYPE_REPENTANCE_B
|
|
48
|
+
if ____cond15 then
|
|
46
49
|
do
|
|
47
50
|
return "d"
|
|
48
51
|
end
|
package/dist/lualib_bundle.lua
CHANGED
|
@@ -1335,6 +1335,15 @@ Map = Map
|
|
|
1335
1335
|
|
|
1336
1336
|
__TS__MathAtan2 = math.atan2 or math.atan
|
|
1337
1337
|
|
|
1338
|
+
function __TS__MathSign(val)
|
|
1339
|
+
if val > 0 then
|
|
1340
|
+
return 1
|
|
1341
|
+
elseif val < 0 then
|
|
1342
|
+
return -1
|
|
1343
|
+
end
|
|
1344
|
+
return 0
|
|
1345
|
+
end
|
|
1346
|
+
|
|
1338
1347
|
function __TS__Number(value)
|
|
1339
1348
|
local valueType = type(value)
|
|
1340
1349
|
if valueType == "number" then
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "isaacscript-common",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.600",
|
|
4
4
|
"description": "Helper functions for IsaacScript mods",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"isaac",
|
|
@@ -25,11 +25,11 @@
|
|
|
25
25
|
"dist/**/*.d.ts"
|
|
26
26
|
],
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"isaac-typescript-definitions": "^1.0.
|
|
28
|
+
"isaac-typescript-definitions": "^1.0.332",
|
|
29
29
|
"isaacscript-lint": "^1.0.79",
|
|
30
30
|
"isaacscript-tsconfig": "^1.1.8",
|
|
31
|
-
"typedoc": "^0.22.
|
|
32
|
-
"typescript": "^4.5.
|
|
33
|
-
"typescript-to-lua": "^1.3.
|
|
31
|
+
"typedoc": "^0.22.11",
|
|
32
|
+
"typescript": "^4.5.5",
|
|
33
|
+
"typescript-to-lua": "^1.3.3"
|
|
34
34
|
}
|
|
35
35
|
}
|