isaacscript-common 1.0.552 → 1.0.556
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/postTrinketBreak.d.ts +1 -0
- package/dist/callbacks/postTrinketBreak.lua +63 -0
- package/dist/callbacks/subscriptions/postTrinketBreak.d.ts +2 -0
- package/dist/callbacks/subscriptions/postTrinketBreak.lua +26 -0
- package/dist/functions/array.d.ts +7 -1
- package/dist/functions/array.lua +9 -13
- package/dist/functions/doors.d.ts +6 -1
- package/dist/functions/doors.lua +5 -3
- package/dist/functions/util.d.ts +0 -1
- package/dist/functions/util.lua +0 -4
- package/dist/types/CallbackParametersCustom.d.ts +4 -0
- package/dist/types/ModCallbacksCustom.d.ts +8 -7
- package/dist/types/ModCallbacksCustom.lua +9 -7
- package/dist/types/ModUpgraded.lua +8 -0
- package/dist/upgradeMod.lua +3 -0
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
|
+
require("lualib_bundle");
|
|
3
|
+
local ____exports = {}
|
|
4
|
+
local hasSubscriptions, postPEffectUpdate, entityTakeDmgPlayer, getTrinketMap, TRINKETS_THAT_CAN_BREAK, v
|
|
5
|
+
local ____exports = require("features.saveDataManager.exports")
|
|
6
|
+
local saveDataManager = ____exports.saveDataManager
|
|
7
|
+
local ____player = require("functions.player")
|
|
8
|
+
local getPlayerIndex = ____player.getPlayerIndex
|
|
9
|
+
local ____postTrinketBreak = require("callbacks.subscriptions.postTrinketBreak")
|
|
10
|
+
local postTrinketBreakFire = ____postTrinketBreak.postTrinketBreakFire
|
|
11
|
+
local postTrinketBreakHasSubscriptions = ____postTrinketBreak.postTrinketBreakHasSubscriptions
|
|
12
|
+
function hasSubscriptions(self)
|
|
13
|
+
return postTrinketBreakHasSubscriptions(nil)
|
|
14
|
+
end
|
|
15
|
+
function postPEffectUpdate(self, player)
|
|
16
|
+
if not hasSubscriptions(nil) then
|
|
17
|
+
return
|
|
18
|
+
end
|
|
19
|
+
local trinketMap = getTrinketMap(nil, player)
|
|
20
|
+
for ____, trinketType in ipairs(TRINKETS_THAT_CAN_BREAK) do
|
|
21
|
+
local numTrinkets = player:GetTrinketMultiplier(trinketType)
|
|
22
|
+
trinketMap:set(trinketType, numTrinkets)
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
function entityTakeDmgPlayer(self, tookDamage, _damageAmount, _damageFlags, _damageSource, _damageCountdownFrames)
|
|
26
|
+
if not hasSubscriptions(nil) then
|
|
27
|
+
return
|
|
28
|
+
end
|
|
29
|
+
local player = tookDamage:ToPlayer()
|
|
30
|
+
if player == nil then
|
|
31
|
+
return
|
|
32
|
+
end
|
|
33
|
+
local trinketMap = getTrinketMap(nil, player)
|
|
34
|
+
for ____, trinketType in ipairs(TRINKETS_THAT_CAN_BREAK) do
|
|
35
|
+
local numTrinkets = player:GetTrinketMultiplier(trinketType)
|
|
36
|
+
local oldNumTrinkets = trinketMap:get(trinketType)
|
|
37
|
+
if (oldNumTrinkets ~= nil) and (numTrinkets < oldNumTrinkets) then
|
|
38
|
+
trinketMap:set(trinketType, numTrinkets)
|
|
39
|
+
postTrinketBreakFire(nil, player, trinketType)
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
function getTrinketMap(self, player)
|
|
44
|
+
local playerIndex = getPlayerIndex(nil, player)
|
|
45
|
+
local playerTrinketMap = v.run.playerTrinketMap:get(playerIndex)
|
|
46
|
+
if playerTrinketMap == nil then
|
|
47
|
+
playerTrinketMap = __TS__New(Map)
|
|
48
|
+
v.run.playerTrinketMap:set(playerIndex, playerTrinketMap)
|
|
49
|
+
end
|
|
50
|
+
return playerTrinketMap
|
|
51
|
+
end
|
|
52
|
+
TRINKETS_THAT_CAN_BREAK = {TrinketType.TRINKET_WISH_BONE, TrinketType.TRINKET_WALNUT}
|
|
53
|
+
v = {
|
|
54
|
+
run = {
|
|
55
|
+
playerTrinketMap = __TS__New(Map)
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
function ____exports.postTrinketBreakCallbackInit(self, mod)
|
|
59
|
+
saveDataManager(nil, "postTrinketBreak", v, hasSubscriptions)
|
|
60
|
+
mod:AddCallback(ModCallbacks.MC_POST_PEFFECT_UPDATE, postPEffectUpdate)
|
|
61
|
+
mod:AddCallback(ModCallbacks.MC_ENTITY_TAKE_DMG, entityTakeDmgPlayer, EntityType.ENTITY_PLAYER)
|
|
62
|
+
end
|
|
63
|
+
return ____exports
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
|
+
require("lualib_bundle");
|
|
3
|
+
local ____exports = {}
|
|
4
|
+
local subscriptions = {}
|
|
5
|
+
function ____exports.postTrinketBreakHasSubscriptions(self)
|
|
6
|
+
return #subscriptions > 0
|
|
7
|
+
end
|
|
8
|
+
function ____exports.postTrinketBreakRegister(self, callback, trinketType)
|
|
9
|
+
__TS__ArrayPush(subscriptions, {callback, trinketType})
|
|
10
|
+
end
|
|
11
|
+
function ____exports.postTrinketBreakFire(self, player, trinketType)
|
|
12
|
+
for ____, ____value in ipairs(subscriptions) do
|
|
13
|
+
local callback
|
|
14
|
+
callback = ____value[1]
|
|
15
|
+
local callbackTrinketType
|
|
16
|
+
callbackTrinketType = ____value[2]
|
|
17
|
+
do
|
|
18
|
+
if (callbackTrinketType ~= nil) and (callbackTrinketType ~= trinketType) then
|
|
19
|
+
goto __continue5
|
|
20
|
+
end
|
|
21
|
+
callback(nil, player, trinketType)
|
|
22
|
+
end
|
|
23
|
+
::__continue5::
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
return ____exports
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
/// <reference types="isaac-typescript-definitions" />
|
|
2
2
|
/// <reference types="typescript-to-lua/language-extensions" />
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Helper function to combine arrays. Returns a new array that is the composition of all of the
|
|
5
|
+
* specified arrays. This function is variadic, meaning that you can specify N arguments to combine
|
|
6
|
+
* N arrays. Note that this will only perform a shallow copy of the array elements.
|
|
7
|
+
*/
|
|
8
|
+
export declare function arrayCombine<T>(...arrays: T[][]): T[];
|
|
9
|
+
/** Helper function to perform a shallow copy. */
|
|
4
10
|
export declare function arrayCopy<T>(array: T[]): T[];
|
|
5
11
|
export declare function arrayEmpty<T>(array: T[]): void;
|
|
6
12
|
/** Helper function for determining if two arrays contain the exact same elements. */
|
package/dist/functions/array.lua
CHANGED
|
@@ -27,19 +27,15 @@ function ____exports.getRandomArrayIndex(self, array, seed)
|
|
|
27
27
|
local randomIndex = getRandomInt(nil, 0, #array - 1, seed)
|
|
28
28
|
return randomIndex
|
|
29
29
|
end
|
|
30
|
-
function ____exports.arrayCombine(self,
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
40
|
-
)
|
|
41
|
-
)
|
|
42
|
-
}
|
|
30
|
+
function ____exports.arrayCombine(self, ...)
|
|
31
|
+
local arrays = {...}
|
|
32
|
+
local elements = {}
|
|
33
|
+
for ____, array in ipairs(arrays) do
|
|
34
|
+
for ____, element in ipairs(array) do
|
|
35
|
+
__TS__ArrayPush(elements, element)
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
return elements
|
|
43
39
|
end
|
|
44
40
|
function ____exports.arrayCopy(self, array)
|
|
45
41
|
return {
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
/// <reference types="isaac-typescript-definitions" />
|
|
2
2
|
export declare function closeAllDoors(): void;
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Helper function to get all of the doors in the room. By default, it will return every door. You
|
|
5
|
+
* can optionally specify one or more room types to return only the doors that match the specified
|
|
6
|
+
* room types.
|
|
7
|
+
*/
|
|
8
|
+
export declare function getDoors(...roomTypes: RoomType[]): GridEntityDoor[];
|
|
4
9
|
export declare function getAngelRoomDoor(): GridEntityDoor | undefined;
|
|
5
10
|
export declare function getDevilRoomDoor(): GridEntityDoor | undefined;
|
|
6
11
|
/**
|
package/dist/functions/doors.lua
CHANGED
|
@@ -3,9 +3,11 @@ require("lualib_bundle");
|
|
|
3
3
|
local ____exports = {}
|
|
4
4
|
local ____constants = require("constants")
|
|
5
5
|
local MAX_NUM_DOORS = ____constants.MAX_NUM_DOORS
|
|
6
|
-
function ____exports.getDoors(self,
|
|
6
|
+
function ____exports.getDoors(self, ...)
|
|
7
|
+
local roomTypes = {...}
|
|
7
8
|
local game = Game()
|
|
8
9
|
local room = game:GetRoom()
|
|
10
|
+
local roomTypesSet = __TS__New(Set, roomTypes)
|
|
9
11
|
local doors = {}
|
|
10
12
|
do
|
|
11
13
|
local i = 0
|
|
@@ -15,9 +17,9 @@ function ____exports.getDoors(self, roomType)
|
|
|
15
17
|
if door == nil then
|
|
16
18
|
goto __continue5
|
|
17
19
|
end
|
|
18
|
-
if
|
|
20
|
+
if #roomTypes == 0 then
|
|
19
21
|
__TS__ArrayPush(doors, door)
|
|
20
|
-
elseif
|
|
22
|
+
elseif roomTypesSet:has(door.TargetRoomType) then
|
|
21
23
|
__TS__ArrayPush(doors, door)
|
|
22
24
|
end
|
|
23
25
|
end
|
package/dist/functions/util.d.ts
CHANGED
|
@@ -61,7 +61,6 @@ export declare function getEnumValues(transpiledEnum: unknown): int[];
|
|
|
61
61
|
* @param hexString A hex string like "#ffffff" or "ffffff". (The "#" character is optional.)
|
|
62
62
|
*/
|
|
63
63
|
export declare function hexToKColor(hexString: string, alpha: float): KColor;
|
|
64
|
-
export declare function isGreedMode(): boolean;
|
|
65
64
|
/**
|
|
66
65
|
* Players can boot the game with an launch option called "--luadebug", which will enable additional
|
|
67
66
|
* functionality that is considered to be unsafe. For more information about this flag, see the
|
package/dist/functions/util.lua
CHANGED
|
@@ -60,10 +60,6 @@ function ____exports.hexToKColor(self, hexString, alpha)
|
|
|
60
60
|
local base = 255
|
|
61
61
|
return KColor(R / base, G / base, B / base, alpha)
|
|
62
62
|
end
|
|
63
|
-
function ____exports.isGreedMode(self)
|
|
64
|
-
local game = Game()
|
|
65
|
-
return (game.Difficulty == Difficulty.DIFFICULTY_GREED) or (game.Difficulty == Difficulty.DIFFICULTY_GREEDIER)
|
|
66
|
-
end
|
|
67
63
|
function ____exports.isLuaDebugEnabled(self)
|
|
68
64
|
return package ~= nil
|
|
69
65
|
end
|
|
@@ -38,6 +38,7 @@ import { PostSlotUpdateCallbackType } from "../callbacks/subscriptions/postSlotU
|
|
|
38
38
|
import { PostTearInitLateCallbackType } from "../callbacks/subscriptions/postTearInitLate";
|
|
39
39
|
import { PostTearInitVeryLateCallbackType } from "../callbacks/subscriptions/postTearInitVeryLate";
|
|
40
40
|
import { PostTransformationCallbackType } from "../callbacks/subscriptions/postTransformation";
|
|
41
|
+
import { PostTrinketBreakCallbackType } from "../callbacks/subscriptions/postTrinketBreak";
|
|
41
42
|
import { PreCustomReviveCallbackType } from "../callbacks/subscriptions/preCustomRevive";
|
|
42
43
|
import { PreItemPickupCallbackType } from "../callbacks/subscriptions/preItemPickup";
|
|
43
44
|
import { PreNewLevelCallbackType } from "../callbacks/subscriptions/PreNewLevel";
|
|
@@ -164,6 +165,9 @@ export interface CallbackParametersCustom {
|
|
|
164
165
|
[ModCallbacksCustom.MC_POST_CURSED_TELEPORT]: [
|
|
165
166
|
callback: PostCursedTeleportCallbackType
|
|
166
167
|
];
|
|
168
|
+
[ModCallbacksCustom.MC_POST_TRINKET_BREAK]: [
|
|
169
|
+
callback: PostTrinketBreakCallbackType
|
|
170
|
+
];
|
|
167
171
|
[ModCallbacksCustom.MC_POST_SLOT_INIT]: [
|
|
168
172
|
callback: PostSlotInitCallbackType,
|
|
169
173
|
slotVariant?: SlotVariant
|
|
@@ -41,11 +41,12 @@ export declare enum ModCallbacksCustom {
|
|
|
41
41
|
MC_POST_PURCHASE = 32,
|
|
42
42
|
MC_POST_SACRIFICE = 33,
|
|
43
43
|
MC_POST_CURSED_TELEPORT = 34,
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
44
|
+
MC_POST_TRINKET_BREAK = 35,
|
|
45
|
+
MC_POST_SLOT_INIT = 36,
|
|
46
|
+
MC_POST_SLOT_UPDATE = 37,
|
|
47
|
+
MC_POST_SLOT_RENDER = 38,
|
|
48
|
+
MC_POST_SLOT_DESTROYED = 39,
|
|
49
|
+
MC_POST_GRID_ENTITY_INIT = 40,
|
|
50
|
+
MC_POST_GRID_ENTITY_UPDATE = 41,
|
|
51
|
+
MC_POST_GRID_ENTITY_REMOVE = 42
|
|
51
52
|
}
|
|
@@ -71,18 +71,20 @@ ____exports.ModCallbacksCustom.MC_POST_SACRIFICE = 33
|
|
|
71
71
|
____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_POST_SACRIFICE] = "MC_POST_SACRIFICE"
|
|
72
72
|
____exports.ModCallbacksCustom.MC_POST_CURSED_TELEPORT = 34
|
|
73
73
|
____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_POST_CURSED_TELEPORT] = "MC_POST_CURSED_TELEPORT"
|
|
74
|
-
____exports.ModCallbacksCustom.
|
|
74
|
+
____exports.ModCallbacksCustom.MC_POST_TRINKET_BREAK = 35
|
|
75
|
+
____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_POST_TRINKET_BREAK] = "MC_POST_TRINKET_BREAK"
|
|
76
|
+
____exports.ModCallbacksCustom.MC_POST_SLOT_INIT = 36
|
|
75
77
|
____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_POST_SLOT_INIT] = "MC_POST_SLOT_INIT"
|
|
76
|
-
____exports.ModCallbacksCustom.MC_POST_SLOT_UPDATE =
|
|
78
|
+
____exports.ModCallbacksCustom.MC_POST_SLOT_UPDATE = 37
|
|
77
79
|
____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_POST_SLOT_UPDATE] = "MC_POST_SLOT_UPDATE"
|
|
78
|
-
____exports.ModCallbacksCustom.MC_POST_SLOT_RENDER =
|
|
80
|
+
____exports.ModCallbacksCustom.MC_POST_SLOT_RENDER = 38
|
|
79
81
|
____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_POST_SLOT_RENDER] = "MC_POST_SLOT_RENDER"
|
|
80
|
-
____exports.ModCallbacksCustom.MC_POST_SLOT_DESTROYED =
|
|
82
|
+
____exports.ModCallbacksCustom.MC_POST_SLOT_DESTROYED = 39
|
|
81
83
|
____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_POST_SLOT_DESTROYED] = "MC_POST_SLOT_DESTROYED"
|
|
82
|
-
____exports.ModCallbacksCustom.MC_POST_GRID_ENTITY_INIT =
|
|
84
|
+
____exports.ModCallbacksCustom.MC_POST_GRID_ENTITY_INIT = 40
|
|
83
85
|
____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_POST_GRID_ENTITY_INIT] = "MC_POST_GRID_ENTITY_INIT"
|
|
84
|
-
____exports.ModCallbacksCustom.MC_POST_GRID_ENTITY_UPDATE =
|
|
86
|
+
____exports.ModCallbacksCustom.MC_POST_GRID_ENTITY_UPDATE = 41
|
|
85
87
|
____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_POST_GRID_ENTITY_UPDATE] = "MC_POST_GRID_ENTITY_UPDATE"
|
|
86
|
-
____exports.ModCallbacksCustom.MC_POST_GRID_ENTITY_REMOVE =
|
|
88
|
+
____exports.ModCallbacksCustom.MC_POST_GRID_ENTITY_REMOVE = 42
|
|
87
89
|
____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_POST_GRID_ENTITY_REMOVE] = "MC_POST_GRID_ENTITY_REMOVE"
|
|
88
90
|
return ____exports
|
|
@@ -80,6 +80,8 @@ local ____postTearInitVeryLate = require("callbacks.subscriptions.postTearInitVe
|
|
|
80
80
|
local postTearInitVeryLateRegister = ____postTearInitVeryLate.postTearInitVeryLateRegister
|
|
81
81
|
local ____postTransformation = require("callbacks.subscriptions.postTransformation")
|
|
82
82
|
local postTransformationRegister = ____postTransformation.postTransformationRegister
|
|
83
|
+
local ____postTrinketBreak = require("callbacks.subscriptions.postTrinketBreak")
|
|
84
|
+
local postTrinketBreakRegister = ____postTrinketBreak.postTrinketBreakRegister
|
|
83
85
|
local ____preCustomRevive = require("callbacks.subscriptions.preCustomRevive")
|
|
84
86
|
local preCustomReviveRegister = ____preCustomRevive.preCustomReviveRegister
|
|
85
87
|
local ____preItemPickup = require("callbacks.subscriptions.preItemPickup")
|
|
@@ -319,6 +321,12 @@ function getCallbackRegisterFunction(self, callbackID)
|
|
|
319
321
|
return postCursedTeleportRegister
|
|
320
322
|
end
|
|
321
323
|
end
|
|
324
|
+
____cond18 = ____cond18 or (____switch18 == ModCallbacksCustom.MC_POST_TRINKET_BREAK)
|
|
325
|
+
if ____cond18 then
|
|
326
|
+
do
|
|
327
|
+
return postTrinketBreakRegister
|
|
328
|
+
end
|
|
329
|
+
end
|
|
322
330
|
____cond18 = ____cond18 or (____switch18 == ModCallbacksCustom.MC_POST_SLOT_INIT)
|
|
323
331
|
if ____cond18 then
|
|
324
332
|
do
|
package/dist/upgradeMod.lua
CHANGED
|
@@ -58,6 +58,8 @@ local ____postTearInitVeryLate = require("callbacks.postTearInitVeryLate")
|
|
|
58
58
|
local postTearInitVeryLateCallbackInit = ____postTearInitVeryLate.postTearInitVeryLateCallbackInit
|
|
59
59
|
local ____postTransformation = require("callbacks.postTransformation")
|
|
60
60
|
local postTransformationCallbackInit = ____postTransformation.postTransformationCallbackInit
|
|
61
|
+
local ____postTrinketBreak = require("callbacks.postTrinketBreak")
|
|
62
|
+
local postTrinketBreakCallbackInit = ____postTrinketBreak.postTrinketBreakCallbackInit
|
|
61
63
|
local ____preNewLevel = require("callbacks.preNewLevel")
|
|
62
64
|
local preNewLevelCallbackInit = ____preNewLevel.preNewLevelCallbackInit
|
|
63
65
|
local ____reorderedCallbacks = require("callbacks.reorderedCallbacks")
|
|
@@ -111,6 +113,7 @@ function initCustomCallbacks(self, mod)
|
|
|
111
113
|
postTransformationCallbackInit(nil, mod)
|
|
112
114
|
postPurchaseCallbackInit(nil, mod)
|
|
113
115
|
postSacrificeCallbackInit(nil, mod)
|
|
116
|
+
postTrinketBreakCallbackInit(nil, mod)
|
|
114
117
|
postCursedTeleportCallbackInit(nil, mod)
|
|
115
118
|
postSlotInitUpdateCallbacksInit(nil, mod)
|
|
116
119
|
postSlotRenderBrokenCallbacksInit(nil, mod)
|