isaacscript-common 1.2.157 → 1.2.160
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/features/isPonyActive.d.ts +2 -2
- package/dist/features/runInNFrames.lua +7 -2
- package/dist/features/saveDataManager/exports.d.ts +5 -3
- package/dist/features/saveDataManager/exports.lua +1 -1
- package/dist/features/saveDataManager/save.lua +0 -3
- package/dist/features/taintedLazarusPlayers.d.ts +13 -0
- package/dist/features/taintedLazarusPlayers.lua +72 -0
- package/dist/functions/log.d.ts +1 -1
- package/dist/functions/log.lua +20 -4
- package/dist/index.d.ts +1 -0
- package/dist/index.lua +5 -0
- package/dist/types/private/SaveData.d.ts +0 -1
- package/dist/upgradeMod.lua +3 -0
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="isaac-typescript-definitions" />
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
3
|
+
* Helper function to see if the player is under the effects of A Pony or White Pony charge.
|
|
4
|
+
* Detecting this is difficult, as the temporary effect will disappear upon entering a new room.
|
|
5
5
|
*/
|
|
6
6
|
export declare function isPonyActive(player: EntityPlayer): boolean;
|
|
@@ -40,9 +40,14 @@ function checkExecuteQueuedFunctions(self, frameCount, functionTuples)
|
|
|
40
40
|
end
|
|
41
41
|
end
|
|
42
42
|
local FEATURE_NAME = "run in N frames"
|
|
43
|
-
v = {
|
|
43
|
+
v = {run = {queuedGameFunctionTuples = {}, queuedRenderFunctionTuples = {}}}
|
|
44
44
|
function ____exports.runInNFramesInit(self, mod)
|
|
45
|
-
saveDataManager(
|
|
45
|
+
saveDataManager(
|
|
46
|
+
nil,
|
|
47
|
+
"runInNFrames",
|
|
48
|
+
v,
|
|
49
|
+
function() return false end
|
|
50
|
+
)
|
|
46
51
|
mod:AddCallback(ModCallbacks.MC_POST_UPDATE, postUpdate)
|
|
47
52
|
mod:AddCallback(ModCallbacks.MC_POST_RENDER, postRender)
|
|
48
53
|
end
|
|
@@ -69,9 +69,11 @@ import { SaveData } from "../../types/private/SaveData";
|
|
|
69
69
|
* manager. The save data manager will throw an error if the key is already registered.
|
|
70
70
|
* @param saveData An object that corresponds to the `SaveData` interface. The object is
|
|
71
71
|
* conventionally called "v" for brevity (which is short for "local variables").
|
|
72
|
-
* @param conditionalFunc An optional function to run upon saving this key to disk.
|
|
73
|
-
*
|
|
74
|
-
*
|
|
72
|
+
* @param conditionalFunc An optional function to run upon saving this key to disk. For example,
|
|
73
|
+
* this allows features to only save data to disk if the feature is enabled. Specify a value of
|
|
74
|
+
* `() => false` to completely disable saving this feature to disk. This is useful if you are using
|
|
75
|
+
* data that is not serializable, or you want to use the save data manager to automatically reset
|
|
76
|
+
* variables on run/level/room, but not clutter the the "save#.dat" file with unnecessary keys.
|
|
75
77
|
*/
|
|
76
78
|
export declare function saveDataManager(key: string, saveData: SaveData, conditionalFunc?: () => boolean): void;
|
|
77
79
|
/**
|
|
@@ -29,7 +29,7 @@ function ____exports.saveDataManager(self, key, saveData, conditionalFunc)
|
|
|
29
29
|
saveDataMap[key] = saveData
|
|
30
30
|
local saveDataKeys = __TS__ObjectKeys(saveData)
|
|
31
31
|
if #saveDataKeys == 1 and saveDataKeys[1] == "room" then
|
|
32
|
-
|
|
32
|
+
conditionalFunc = function() return false end
|
|
33
33
|
end
|
|
34
34
|
local saveDataTable = saveData
|
|
35
35
|
local saveDataTableCopy = deepCopy(nil, saveDataTable, SerializationType.NONE, key)
|
|
@@ -17,9 +17,6 @@ function getAllSaveDataToWriteToDisk(self, saveDataMap, saveDataConditionalFuncM
|
|
|
17
17
|
local allSaveData = {}
|
|
18
18
|
for subscriberName, saveData in pairs(saveDataMap) do
|
|
19
19
|
do
|
|
20
|
-
if saveData.dontSave ~= nil then
|
|
21
|
-
goto __continue4
|
|
22
|
-
end
|
|
23
20
|
local conditionalFunc = saveDataConditionalFuncMap:get(subscriberName)
|
|
24
21
|
if conditionalFunc ~= nil then
|
|
25
22
|
local shouldSave = conditionalFunc(nil)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="isaac-typescript-definitions" />
|
|
2
|
+
/**
|
|
3
|
+
* Helper function to get the other version of Tainted Lazarus.
|
|
4
|
+
*
|
|
5
|
+
* - On Tainted Lazarus, returns the player object for Dead Tainted Lazarus.
|
|
6
|
+
* - On Dead Tainted Lazarus, returns the player object for Tainted Lazarus.
|
|
7
|
+
* - Returns undefined if player object retrieval failed for any reason.
|
|
8
|
+
*
|
|
9
|
+
* If you call the `EntityPlayer.Exists` method on the returned object, it will return false.
|
|
10
|
+
* However, you can still call the other methods like you normally would (e.g.
|
|
11
|
+
* `EntityPlayer.AddCollectible`).
|
|
12
|
+
*/
|
|
13
|
+
export declare function getTaintedLazarusSubPlayer(player: EntityPlayer): EntityPlayer | undefined;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
|
+
local ____lualib = require("lualib_bundle")
|
|
3
|
+
local Map = ____lualib.Map
|
|
4
|
+
local __TS__New = ____lualib.__TS__New
|
|
5
|
+
local __TS__ArrayPush = ____lualib.__TS__ArrayPush
|
|
6
|
+
local __TS__ArrayShift = ____lualib.__TS__ArrayShift
|
|
7
|
+
local ____exports = {}
|
|
8
|
+
local postPlayerInit, checkDequeue, v
|
|
9
|
+
local ____featuresInitialized = require("featuresInitialized")
|
|
10
|
+
local errorIfFeaturesNotInitialized = ____featuresInitialized.errorIfFeaturesNotInitialized
|
|
11
|
+
local ____exports = require("features.saveDataManager.exports")
|
|
12
|
+
local saveDataManager = ____exports.saveDataManager
|
|
13
|
+
function postPlayerInit(self, player)
|
|
14
|
+
local entityPtr = EntityPtr(player)
|
|
15
|
+
local character = player:GetPlayerType()
|
|
16
|
+
if character == PlayerType.PLAYER_LAZARUS_B then
|
|
17
|
+
__TS__ArrayPush(v.run.queuedTaintedLazarus, entityPtr)
|
|
18
|
+
elseif character == PlayerType.PLAYER_LAZARUS2_B then
|
|
19
|
+
__TS__ArrayPush(v.run.queuedDeadTaintedLazarus, entityPtr)
|
|
20
|
+
else
|
|
21
|
+
return
|
|
22
|
+
end
|
|
23
|
+
checkDequeue(nil)
|
|
24
|
+
end
|
|
25
|
+
function checkDequeue(self)
|
|
26
|
+
if #v.run.queuedTaintedLazarus == 0 or #v.run.queuedDeadTaintedLazarus == 0 then
|
|
27
|
+
return
|
|
28
|
+
end
|
|
29
|
+
local taintedLazarusPtr = __TS__ArrayShift(v.run.queuedTaintedLazarus)
|
|
30
|
+
local deadTaintedLazarusPtr = __TS__ArrayShift(v.run.queuedDeadTaintedLazarus)
|
|
31
|
+
if taintedLazarusPtr == nil or deadTaintedLazarusPtr == nil then
|
|
32
|
+
return
|
|
33
|
+
end
|
|
34
|
+
local taintedLazarus = taintedLazarusPtr.Ref
|
|
35
|
+
local deadTaintedLazarus = deadTaintedLazarusPtr.Ref
|
|
36
|
+
if taintedLazarus == nil or deadTaintedLazarus == nil then
|
|
37
|
+
return
|
|
38
|
+
end
|
|
39
|
+
local taintedLazarusPtrHash = GetPtrHash(taintedLazarus)
|
|
40
|
+
local deadTaintedLazarusPtrHash = GetPtrHash(deadTaintedLazarus)
|
|
41
|
+
v.run.subPlayerMap:set(taintedLazarusPtrHash, deadTaintedLazarusPtr)
|
|
42
|
+
v.run.subPlayerMap:set(deadTaintedLazarusPtrHash, taintedLazarusPtr)
|
|
43
|
+
end
|
|
44
|
+
local FEATURE_NAME = "Tainted Lazarus entity finder"
|
|
45
|
+
v = {run = {
|
|
46
|
+
queuedTaintedLazarus = {},
|
|
47
|
+
queuedDeadTaintedLazarus = {},
|
|
48
|
+
subPlayerMap = __TS__New(Map)
|
|
49
|
+
}}
|
|
50
|
+
function ____exports.taintedLazarusPlayersInit(self, mod)
|
|
51
|
+
saveDataManager(
|
|
52
|
+
nil,
|
|
53
|
+
"taintedLazarusPlayers",
|
|
54
|
+
v,
|
|
55
|
+
function() return false end
|
|
56
|
+
)
|
|
57
|
+
mod:AddCallback(ModCallbacks.MC_POST_PLAYER_INIT, postPlayerInit)
|
|
58
|
+
end
|
|
59
|
+
function ____exports.getTaintedLazarusSubPlayer(self, player)
|
|
60
|
+
errorIfFeaturesNotInitialized(nil, FEATURE_NAME)
|
|
61
|
+
local ptrHash = GetPtrHash(player)
|
|
62
|
+
local entityPtr = v.run.subPlayerMap:get(ptrHash)
|
|
63
|
+
if entityPtr == nil then
|
|
64
|
+
return nil
|
|
65
|
+
end
|
|
66
|
+
local entity = entityPtr.Ref
|
|
67
|
+
if entity == nil then
|
|
68
|
+
return nil
|
|
69
|
+
end
|
|
70
|
+
return entity:ToPlayer()
|
|
71
|
+
end
|
|
72
|
+
return ____exports
|
package/dist/functions/log.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ export declare function logAllDamageFlags(this: void, flags: int): void;
|
|
|
15
15
|
/** Helper function for printing out every entity flag that is turned on. Useful when debugging. */
|
|
16
16
|
export declare function logAllEntityFlags(this: void, flags: int): void;
|
|
17
17
|
/** Helper function for printing out every flag that is turned on. Useful when debugging. */
|
|
18
|
-
export declare function logAllFlags(this: void, flags: int, flagEnum
|
|
18
|
+
export declare function logAllFlags(this: void, flags: int, flagEnum?: LuaTable, description?: string): void;
|
|
19
19
|
/**
|
|
20
20
|
* Helper function for printing out every game state flag that is turned on. Useful when debugging.
|
|
21
21
|
*/
|
package/dist/functions/log.lua
CHANGED
|
@@ -62,13 +62,29 @@ function ____exports.logAllFlags(flags, flagEnum, description)
|
|
|
62
62
|
if description ~= "" then
|
|
63
63
|
description = description .. " "
|
|
64
64
|
end
|
|
65
|
-
|
|
65
|
+
if flagEnum == nil then
|
|
66
|
+
flagEnum = {}
|
|
67
|
+
do
|
|
68
|
+
local i = 0
|
|
69
|
+
while i <= 62 do
|
|
70
|
+
flagEnum["1 << " .. tostring(i)] = 1 << i
|
|
71
|
+
i = i + 1
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
____exports.log(((("Logging all " .. description) .. "flags for value ") .. tostring(flags)) .. ":")
|
|
66
76
|
local hasNoFlags = true
|
|
67
77
|
for key, value in pairs(flagEnum) do
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
78
|
+
do
|
|
79
|
+
if type(value) ~= "number" then
|
|
80
|
+
goto __continue13
|
|
81
|
+
end
|
|
82
|
+
if hasFlag(nil, flags, value) then
|
|
83
|
+
____exports.log((((" Has flag: " .. tostring(key)) .. " (") .. tostring(value)) .. ")")
|
|
84
|
+
hasNoFlags = false
|
|
85
|
+
end
|
|
71
86
|
end
|
|
87
|
+
::__continue13::
|
|
72
88
|
end
|
|
73
89
|
if hasNoFlags then
|
|
74
90
|
____exports.log(" n/a (no flags)")
|
package/dist/index.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ export { preventCollectibleRotate } from "./features/preventCollectibleRotate";
|
|
|
14
14
|
export { runInNGameFrames, runInNRenderFrames, runNextGameFrame, runNextRenderFrame, } from "./features/runInNFrames";
|
|
15
15
|
export * from "./features/saveDataManager/exports";
|
|
16
16
|
export { hasSirenStolenFamiliar, setFamiliarNoSirenSteal, } from "./features/sirenHelpers";
|
|
17
|
+
export { getTaintedLazarusSubPlayer } from "./features/taintedLazarusPlayers";
|
|
17
18
|
export * from "./functions/array";
|
|
18
19
|
export * from "./functions/bitwise";
|
|
19
20
|
export * from "./functions/cards";
|
package/dist/index.lua
CHANGED
|
@@ -126,6 +126,11 @@ do
|
|
|
126
126
|
____exports.hasSirenStolenFamiliar = hasSirenStolenFamiliar
|
|
127
127
|
____exports.setFamiliarNoSirenSteal = setFamiliarNoSirenSteal
|
|
128
128
|
end
|
|
129
|
+
do
|
|
130
|
+
local ____taintedLazarusPlayers = require("features.taintedLazarusPlayers")
|
|
131
|
+
local getTaintedLazarusSubPlayer = ____taintedLazarusPlayers.getTaintedLazarusSubPlayer
|
|
132
|
+
____exports.getTaintedLazarusSubPlayer = getTaintedLazarusSubPlayer
|
|
133
|
+
end
|
|
129
134
|
do
|
|
130
135
|
local ____export = require("functions.array")
|
|
131
136
|
for ____exportKey, ____exportValue in pairs(____export) do
|
package/dist/upgradeMod.lua
CHANGED
|
@@ -95,6 +95,8 @@ local ____main = require("features.saveDataManager.main")
|
|
|
95
95
|
local saveDataManagerInit = ____main.saveDataManagerInit
|
|
96
96
|
local ____sirenHelpers = require("features.sirenHelpers")
|
|
97
97
|
local sirenHelpersInit = ____sirenHelpers.sirenHelpersInit
|
|
98
|
+
local ____taintedLazarusPlayers = require("features.taintedLazarusPlayers")
|
|
99
|
+
local taintedLazarusPlayersInit = ____taintedLazarusPlayers.taintedLazarusPlayersInit
|
|
98
100
|
local ____featuresInitialized = require("featuresInitialized")
|
|
99
101
|
local areFeaturesInitialized = ____featuresInitialized.areFeaturesInitialized
|
|
100
102
|
local setFeaturesInitialized = ____featuresInitialized.setFeaturesInitialized
|
|
@@ -149,6 +151,7 @@ function initFeatures(self, mod)
|
|
|
149
151
|
sirenHelpersInit(nil, mod)
|
|
150
152
|
isPonyActiveInit(nil, mod)
|
|
151
153
|
playerInventoryInit(nil, mod)
|
|
154
|
+
taintedLazarusPlayersInit(nil, mod)
|
|
152
155
|
end
|
|
153
156
|
function ____exports.upgradeMod(self, modVanilla, verbose)
|
|
154
157
|
if verbose == nil then
|