isaacscript-common 1.0.555 → 1.0.559
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 +71 -0
- package/dist/callbacks/subscriptions/postTrinketBreak.d.ts +2 -0
- package/dist/callbacks/subscriptions/postTrinketBreak.lua +26 -0
- package/dist/functions/player.d.ts +7 -4
- package/dist/functions/player.lua +10 -2
- package/dist/types/CallbackParametersCustom.d.ts +5 -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 +2 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,71 @@
|
|
|
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
|
+
do
|
|
36
|
+
local numTrinketsHeld = player:GetTrinketMultiplier(trinketType)
|
|
37
|
+
local oldNumTrinketsHeld = trinketMap:get(trinketType)
|
|
38
|
+
if (oldNumTrinketsHeld == nil) or (numTrinketsHeld >= oldNumTrinketsHeld) then
|
|
39
|
+
goto __continue10
|
|
40
|
+
end
|
|
41
|
+
trinketMap:set(trinketType, numTrinketsHeld)
|
|
42
|
+
local numTrinketsOnGround = Isaac.CountEntities(nil, EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_TRINKET, trinketType)
|
|
43
|
+
if numTrinketsOnGround > 0 then
|
|
44
|
+
goto __continue10
|
|
45
|
+
end
|
|
46
|
+
postTrinketBreakFire(nil, player, trinketType)
|
|
47
|
+
end
|
|
48
|
+
::__continue10::
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
function getTrinketMap(self, player)
|
|
52
|
+
local playerIndex = getPlayerIndex(nil, player)
|
|
53
|
+
local playerTrinketMap = v.run.playerTrinketMap:get(playerIndex)
|
|
54
|
+
if playerTrinketMap == nil then
|
|
55
|
+
playerTrinketMap = __TS__New(Map)
|
|
56
|
+
v.run.playerTrinketMap:set(playerIndex, playerTrinketMap)
|
|
57
|
+
end
|
|
58
|
+
return playerTrinketMap
|
|
59
|
+
end
|
|
60
|
+
TRINKETS_THAT_CAN_BREAK = {TrinketType.TRINKET_WISH_BONE, TrinketType.TRINKET_WALNUT}
|
|
61
|
+
v = {
|
|
62
|
+
run = {
|
|
63
|
+
playerTrinketMap = __TS__New(Map)
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
function ____exports.postTrinketBreakCallbackInit(self, mod)
|
|
67
|
+
saveDataManager(nil, "postTrinketBreak", v, hasSubscriptions)
|
|
68
|
+
mod:AddCallback(ModCallbacks.MC_POST_PEFFECT_UPDATE, postPEffectUpdate)
|
|
69
|
+
mod:AddCallback(ModCallbacks.MC_ENTITY_TAKE_DMG, entityTakeDmgPlayer, EntityType.ENTITY_PLAYER)
|
|
70
|
+
end
|
|
71
|
+
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
|
|
@@ -209,9 +209,12 @@ export declare function removeTrinketCostume(player: EntityPlayer, trinketType:
|
|
|
209
209
|
*/
|
|
210
210
|
export declare function setActiveItem(player: EntityPlayer, collectibleType: CollectibleType, activeSlot: ActiveSlot, charge?: int, keepInPools?: boolean): void;
|
|
211
211
|
/**
|
|
212
|
-
*
|
|
213
|
-
* `player.TryRemoveNullCostume(NullItemID.ID_BLINDFOLD)` after invoking this function.
|
|
212
|
+
* Helper function to blindfold the player by using a hack with the challenge variable.
|
|
214
213
|
*
|
|
215
|
-
*
|
|
214
|
+
* The method used in this function was discovered by im_tem.
|
|
215
|
+
*
|
|
216
|
+
* @param player The player to apply or remove the blindfold state from.
|
|
217
|
+
* @param enabled Whether or not to apply or remove the blindfold.
|
|
218
|
+
* @param modifyCostume Optional. Whether to add or remove the blindfold costume. True by default.
|
|
216
219
|
*/
|
|
217
|
-
export declare function setBlindfold(player: EntityPlayer, enabled: boolean): void;
|
|
220
|
+
export declare function setBlindfold(player: EntityPlayer, enabled: boolean, modifyCostume?: boolean): void;
|
|
@@ -472,7 +472,10 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
|
|
|
472
472
|
end
|
|
473
473
|
until true
|
|
474
474
|
end
|
|
475
|
-
function ____exports.setBlindfold(self, player, enabled)
|
|
475
|
+
function ____exports.setBlindfold(self, player, enabled, modifyCostume)
|
|
476
|
+
if modifyCostume == nil then
|
|
477
|
+
modifyCostume = true
|
|
478
|
+
end
|
|
476
479
|
local game = Game()
|
|
477
480
|
local character = player:GetPlayerType()
|
|
478
481
|
local challenge = Isaac.GetChallenge()
|
|
@@ -480,11 +483,16 @@ function ____exports.setBlindfold(self, player, enabled)
|
|
|
480
483
|
game.Challenge = Challenge.CHALLENGE_SOLAR_SYSTEM
|
|
481
484
|
player:ChangePlayerType(character)
|
|
482
485
|
game.Challenge = challenge
|
|
486
|
+
if not modifyCostume then
|
|
487
|
+
player:TryRemoveNullCostume(NullItemID.ID_BLINDFOLD)
|
|
488
|
+
end
|
|
483
489
|
else
|
|
484
490
|
game.Challenge = Challenge.CHALLENGE_NULL
|
|
485
491
|
player:ChangePlayerType(character)
|
|
486
492
|
game.Challenge = challenge
|
|
487
|
-
|
|
493
|
+
if modifyCostume then
|
|
494
|
+
player:TryRemoveNullCostume(NullItemID.ID_BLINDFOLD)
|
|
495
|
+
end
|
|
488
496
|
end
|
|
489
497
|
end
|
|
490
498
|
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,10 @@ 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
|
+
trinketType?: TrinketType
|
|
171
|
+
];
|
|
167
172
|
[ModCallbacksCustom.MC_POST_SLOT_INIT]: [
|
|
168
173
|
callback: PostSlotInitCallbackType,
|
|
169
174
|
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)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "isaacscript-common",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.559",
|
|
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
|
"isaac-typescript-definitions": "^1.0.307",
|
|
29
|
-
"isaacscript-lint": "^1.0.
|
|
29
|
+
"isaacscript-lint": "^1.0.74",
|
|
30
30
|
"typedoc": "^0.22.10",
|
|
31
31
|
"typescript": "4.4.4",
|
|
32
32
|
"typescript-to-lua": "1.1.1"
|