isaacscript-common 1.2.0 → 1.2.4
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/postPlayerFatalDamage.lua +9 -2
- package/dist/callbacks/reorderedCallbacks.d.ts +6 -0
- package/dist/callbacks/subscriptions/postPlayerFatalDamage.d.ts +1 -1
- package/dist/callbacks/subscriptions/postPlayerFatalDamage.lua +9 -2
- package/dist/functions/collectibles.d.ts +5 -0
- package/dist/functions/collectibles.lua +3 -0
- package/dist/functions/player.d.ts +5 -0
- package/dist/functions/player.lua +10 -0
- package/dist/functions/trinketGive.lua +3 -1
- package/dist/functions/trinkets.lua +3 -7
- package/dist/maps/roomShapeToTopLeftWallGridIndexMap.d.ts +4 -0
- package/package.json +2 -2
|
@@ -18,7 +18,7 @@ local postPlayerFatalDamageHasSubscriptions = ____postPlayerFatalDamage.postPlay
|
|
|
18
18
|
function hasSubscriptions(self)
|
|
19
19
|
return postPlayerFatalDamageHasSubscriptions(nil)
|
|
20
20
|
end
|
|
21
|
-
function entityTakeDmgPlayer(self, tookDamage, damageAmount,
|
|
21
|
+
function entityTakeDmgPlayer(self, tookDamage, damageAmount, damageFlags, damageSource, damageCountdownFrames)
|
|
22
22
|
if not hasSubscriptions(nil) then
|
|
23
23
|
return nil
|
|
24
24
|
end
|
|
@@ -46,7 +46,14 @@ function entityTakeDmgPlayer(self, tookDamage, damageAmount, _damageFlags, damag
|
|
|
46
46
|
) then
|
|
47
47
|
return nil
|
|
48
48
|
end
|
|
49
|
-
local shouldSustainDeath = postPlayerFatalDamageFire(
|
|
49
|
+
local shouldSustainDeath = postPlayerFatalDamageFire(
|
|
50
|
+
nil,
|
|
51
|
+
player,
|
|
52
|
+
damageAmount,
|
|
53
|
+
damageFlags,
|
|
54
|
+
damageSource,
|
|
55
|
+
damageCountdownFrames
|
|
56
|
+
)
|
|
50
57
|
if shouldSustainDeath ~= nil then
|
|
51
58
|
return shouldSustainDeath
|
|
52
59
|
end
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
+
* This is a utility function for users of the `ModCallbacksCustom.POST_NEW_LEVEL_REORDERED` custom
|
|
3
|
+
* callback.
|
|
4
|
+
*
|
|
2
5
|
* If some specific cases, mods can change the current level during run initialization on the 0th
|
|
3
6
|
* frame. However, due to how the callback reordering works, the custom PostNewLevel callback will
|
|
4
7
|
* never fire on the 0th frame. To get around this, call this function before changing levels to
|
|
@@ -6,6 +9,9 @@
|
|
|
6
9
|
*/
|
|
7
10
|
export declare function forceNewLevelCallback(): void;
|
|
8
11
|
/**
|
|
12
|
+
* This is a utility function for users of the `ModCallbacksCustom.POST_NEW_ROOM_REORDERED` custom
|
|
13
|
+
* callback.
|
|
14
|
+
*
|
|
9
15
|
* If some specific cases, mods can change the current room during run initialization on the 0th
|
|
10
16
|
* frame. However, due to how the callback reordering works, the custom PostNewRoom callback will
|
|
11
17
|
* never fire on the 0th frame. To get around this, call this function before changing rooms to
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/// <reference types="isaac-typescript-definitions" />
|
|
2
|
-
export declare type PostPlayerFatalDamageCallbackType = (player: EntityPlayer) => boolean | void;
|
|
2
|
+
export declare type PostPlayerFatalDamageCallbackType = (player: EntityPlayer, damageAmount: float, damageFlags: int, damageSource: EntityRef, damageCountdownFrames: int) => boolean | void;
|
|
@@ -9,7 +9,7 @@ end
|
|
|
9
9
|
function ____exports.postPlayerFatalDamageRegister(self, callback, playerVariant)
|
|
10
10
|
__TS__ArrayPush(subscriptions, {callback, playerVariant})
|
|
11
11
|
end
|
|
12
|
-
function ____exports.postPlayerFatalDamageFire(self, player)
|
|
12
|
+
function ____exports.postPlayerFatalDamageFire(self, player, damageAmount, damageFlags, damageSource, damageCountdownFrames)
|
|
13
13
|
for ____, ____value in ipairs(subscriptions) do
|
|
14
14
|
local callback = ____value[1]
|
|
15
15
|
local playerVariant = ____value[2]
|
|
@@ -17,7 +17,14 @@ function ____exports.postPlayerFatalDamageFire(self, player)
|
|
|
17
17
|
if playerVariant ~= nil and playerVariant ~= player.Variant then
|
|
18
18
|
goto __continue5
|
|
19
19
|
end
|
|
20
|
-
local shouldSustainDeath = callback(
|
|
20
|
+
local shouldSustainDeath = callback(
|
|
21
|
+
nil,
|
|
22
|
+
player,
|
|
23
|
+
damageAmount,
|
|
24
|
+
damageFlags,
|
|
25
|
+
damageSource,
|
|
26
|
+
damageCountdownFrames
|
|
27
|
+
)
|
|
21
28
|
if shouldSustainDeath ~= nil then
|
|
22
29
|
return shouldSustainDeath
|
|
23
30
|
end
|
|
@@ -89,6 +89,11 @@ export declare function removeCollectiblePickupDelay(collectible: EntityPickup):
|
|
|
89
89
|
* Python program located at: https://github.com/Rchardon/RebirthItemTracker
|
|
90
90
|
*/
|
|
91
91
|
export declare function removeCollectibleFromItemTracker(collectibleType: CollectibleType | int): void;
|
|
92
|
+
/**
|
|
93
|
+
* Helper function to put a message in the log.txt file to let the Rebirth Item Tracker know that
|
|
94
|
+
* the build has been rerolled.
|
|
95
|
+
*/
|
|
96
|
+
export declare function setCollectiblesRerolledForItemTracker(): void;
|
|
92
97
|
export declare function setCollectibleBlind(collectible: EntityPickup): void;
|
|
93
98
|
/**
|
|
94
99
|
* Helper function to remove the collectible from a collectible pedestal and make it appear as if a
|
|
@@ -164,6 +164,9 @@ function ____exports.removeCollectibleFromItemTracker(self, collectibleType)
|
|
|
164
164
|
local collectibleName = ____exports.getCollectibleName(nil, collectibleType)
|
|
165
165
|
Isaac.DebugString(((("Removing collectible " .. tostring(collectibleType)) .. " (") .. collectibleName) .. ") on player 0 (Player)")
|
|
166
166
|
end
|
|
167
|
+
function ____exports.setCollectiblesRerolledForItemTracker(self)
|
|
168
|
+
Isaac.DebugString("Added 3 Collectibles")
|
|
169
|
+
end
|
|
167
170
|
function ____exports.setCollectibleBlind(self, collectible)
|
|
168
171
|
if collectible.Variant ~= PickupVariant.PICKUP_COLLECTIBLE then
|
|
169
172
|
error("You cannot set a collectible to be blind for pickups of variant: " .. tostring(collectible.Variant))
|
|
@@ -244,3 +244,8 @@ export declare function setActiveItem(player: EntityPlayer, collectibleType: Col
|
|
|
244
244
|
* @param modifyCostume Optional. Whether to add or remove the blindfold costume. True by default.
|
|
245
245
|
*/
|
|
246
246
|
export declare function setBlindfold(player: EntityPlayer, enabled: boolean, modifyCostume?: boolean): void;
|
|
247
|
+
/**
|
|
248
|
+
* Helper function to use an active item without showing an animation, keeping the item, or adding
|
|
249
|
+
* any costumes.
|
|
250
|
+
*/
|
|
251
|
+
export declare function useActiveItemTemp(player: EntityPlayer, collectibleType: CollectibleType | int): void;
|
|
@@ -535,4 +535,14 @@ function ____exports.setBlindfold(self, player, enabled, modifyCostume)
|
|
|
535
535
|
end
|
|
536
536
|
end
|
|
537
537
|
end
|
|
538
|
+
function ____exports.useActiveItemTemp(self, player, collectibleType)
|
|
539
|
+
player:UseActiveItem(
|
|
540
|
+
collectibleType,
|
|
541
|
+
false,
|
|
542
|
+
false,
|
|
543
|
+
true,
|
|
544
|
+
false,
|
|
545
|
+
-1
|
|
546
|
+
)
|
|
547
|
+
end
|
|
538
548
|
return ____exports
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
local ____exports = {}
|
|
3
3
|
local ____constants = require("constants")
|
|
4
4
|
local GOLDEN_TRINKET_SHIFT = ____constants.GOLDEN_TRINKET_SHIFT
|
|
5
|
+
local ____player = require("functions.player")
|
|
6
|
+
local useActiveItemTemp = ____player.useActiveItemTemp
|
|
5
7
|
function ____exports.temporarilyRemoveTrinket(self, player, trinketType)
|
|
6
8
|
if not player:HasTrinket(trinketType) then
|
|
7
9
|
return nil
|
|
@@ -54,7 +56,7 @@ function ____exports.giveTrinketsBack(self, player, trinketSituation)
|
|
|
54
56
|
local i = 0
|
|
55
57
|
while i < trinketSituation.numSmeltedTrinkets do
|
|
56
58
|
player:AddTrinket(trinketSituation.trinketTypeRemoved, false)
|
|
57
|
-
player
|
|
59
|
+
useActiveItemTemp(nil, player, CollectibleType.COLLECTIBLE_SMELTER)
|
|
58
60
|
i = i + 1
|
|
59
61
|
end
|
|
60
62
|
end
|
|
@@ -10,6 +10,8 @@ local ____trinketNameMap = require("maps.trinketNameMap")
|
|
|
10
10
|
local TRINKET_NAME_MAP = ____trinketNameMap.TRINKET_NAME_MAP
|
|
11
11
|
local ____entity = require("functions.entity")
|
|
12
12
|
local getPickups = ____entity.getPickups
|
|
13
|
+
local ____player = require("functions.player")
|
|
14
|
+
local useActiveItemTemp = ____player.useActiveItemTemp
|
|
13
15
|
local ____trinketGive = require("functions.trinketGive")
|
|
14
16
|
local giveTrinketsBack = ____trinketGive.giveTrinketsBack
|
|
15
17
|
local temporarilyRemoveTrinkets = ____trinketGive.temporarilyRemoveTrinkets
|
|
@@ -90,13 +92,7 @@ function ____exports.smeltTrinket(self, player, trinketType, numTrinkets)
|
|
|
90
92
|
local i = 0
|
|
91
93
|
while i < numTrinkets do
|
|
92
94
|
player:AddTrinket(trinketType)
|
|
93
|
-
player
|
|
94
|
-
CollectibleType.COLLECTIBLE_SMELTER,
|
|
95
|
-
false,
|
|
96
|
-
false,
|
|
97
|
-
true,
|
|
98
|
-
false
|
|
99
|
-
)
|
|
95
|
+
useActiveItemTemp(nil, player, CollectibleType.COLLECTIBLE_SMELTER)
|
|
100
96
|
i = i + 1
|
|
101
97
|
end
|
|
102
98
|
end
|
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
/// <reference types="isaac-typescript-definitions" />
|
|
2
|
+
/**
|
|
3
|
+
* Only used for special room shapes where the top left wall grid index is not equal to
|
|
4
|
+
* `DEFAULT_TOP_LEFT_WALL_GRID_INDEX`.
|
|
5
|
+
*/
|
|
2
6
|
export declare const ROOM_SHAPE_TO_TOP_LEFT_WALL_GRID_INDEX_MAP: Map<RoomShape, number>;
|
|
3
7
|
export declare const DEFAULT_TOP_LEFT_WALL_GRID_INDEX = 0;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "isaacscript-common",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.4",
|
|
4
4
|
"description": "Helper functions for IsaacScript mods",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"isaac",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
],
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@zamiell/typescript-to-lua": "^1.4.0",
|
|
29
|
-
"isaac-typescript-definitions": "^1.0.
|
|
29
|
+
"isaac-typescript-definitions": "^1.0.334",
|
|
30
30
|
"isaacscript-lint": "^1.0.79",
|
|
31
31
|
"isaacscript-tsconfig": "^1.1.8",
|
|
32
32
|
"typedoc": "^0.22.11",
|