isaacscript-common 1.0.555 → 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/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
|
|
@@ -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)
|