isaacscript-common 1.0.603 → 1.0.607
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/functions/globals.d.ts +14 -2
- package/dist/functions/globals.lua +52 -2
- package/dist/functions/npc.lua +3 -1
- package/dist/functions/util.d.ts +12 -0
- package/dist/functions/util.lua +8 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.lua +8 -0
- package/package.json +1 -1
|
@@ -1,2 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/// <reference types="typescript-to-lua/language-extensions" />
|
|
2
|
+
/**
|
|
3
|
+
* Helper function to get a set containing all of the global variable names that are contained
|
|
4
|
+
* within the Isaac environment by default.
|
|
5
|
+
*
|
|
6
|
+
* Returns a slightly different set depending on whether the "--luadebug" flag is enabled or not.
|
|
7
|
+
*/
|
|
8
|
+
export declare function getDefaultGlobals(): Set<string>;
|
|
9
|
+
/**
|
|
10
|
+
* Helper function to get an array of any added global variables in the Isaac Lua environment.
|
|
11
|
+
* Returns an array of key/value tuples.
|
|
12
|
+
*/
|
|
13
|
+
export declare function getNewGlobals(): [AnyNotNil, unknown][];
|
|
14
|
+
export declare function logNewGlobals(): void;
|
|
@@ -1,7 +1,20 @@
|
|
|
1
1
|
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
2
|
require("lualib_bundle");
|
|
3
3
|
local ____exports = {}
|
|
4
|
-
|
|
4
|
+
local twoDimensionalSort
|
|
5
|
+
local ____log = require("functions.log")
|
|
6
|
+
local log = ____log.log
|
|
7
|
+
local ____util = require("functions.util")
|
|
8
|
+
local addSetsToSet = ____util.addSetsToSet
|
|
9
|
+
local copySet = ____util.copySet
|
|
10
|
+
local isLuaDebugEnabled = ____util.isLuaDebugEnabled
|
|
11
|
+
function twoDimensionalSort(self, a, b)
|
|
12
|
+
if a[1] == b[1] then
|
|
13
|
+
return 0
|
|
14
|
+
end
|
|
15
|
+
return a[1] < b[1] and -1 or 1
|
|
16
|
+
end
|
|
17
|
+
local DEFAULT_GLOBALS = __TS__New(Set, {
|
|
5
18
|
"ActionTriggers",
|
|
6
19
|
"ActiveSlot",
|
|
7
20
|
"BabySubType",
|
|
@@ -121,6 +134,7 @@ ____exports.DEFAULT_GLOBALS = __TS__New(Set, {
|
|
|
121
134
|
"SeedEffect",
|
|
122
135
|
"Seeds",
|
|
123
136
|
"ShockwaveParams",
|
|
137
|
+
"SkinColor",
|
|
124
138
|
"SortingLayer",
|
|
125
139
|
"SoundEffect",
|
|
126
140
|
"Sprite",
|
|
@@ -167,5 +181,41 @@ ____exports.DEFAULT_GLOBALS = __TS__New(Set, {
|
|
|
167
181
|
"utf8",
|
|
168
182
|
"xpcall"
|
|
169
183
|
})
|
|
170
|
-
|
|
184
|
+
local LUA_DEBUG_ADDED_GLOBALS = __TS__New(Set, {"debug", "io", "os", "package"})
|
|
185
|
+
local RACING_PLUS_SANDBOX_ADDED_GLOBALS = __TS__New(Set, {"sandboxTraceback", "sandboxGetTraceback", "getParentFunctionDescription"})
|
|
186
|
+
function ____exports.getDefaultGlobals(self)
|
|
187
|
+
local defaultGlobals = copySet(nil, DEFAULT_GLOBALS)
|
|
188
|
+
if isLuaDebugEnabled(nil) then
|
|
189
|
+
addSetsToSet(nil, defaultGlobals, LUA_DEBUG_ADDED_GLOBALS)
|
|
190
|
+
end
|
|
191
|
+
addSetsToSet(nil, defaultGlobals, RACING_PLUS_SANDBOX_ADDED_GLOBALS)
|
|
192
|
+
return defaultGlobals
|
|
193
|
+
end
|
|
194
|
+
function ____exports.getNewGlobals(self)
|
|
195
|
+
local defaultGlobals = ____exports.getDefaultGlobals(nil)
|
|
196
|
+
local newGlobals = {}
|
|
197
|
+
for key, value in pairs(_G) do
|
|
198
|
+
if not defaultGlobals:has(key) then
|
|
199
|
+
local keyValueTuple = {key, value}
|
|
200
|
+
__TS__ArrayPush(newGlobals, keyValueTuple)
|
|
201
|
+
end
|
|
202
|
+
end
|
|
203
|
+
__TS__ArraySort(newGlobals, twoDimensionalSort)
|
|
204
|
+
return newGlobals
|
|
205
|
+
end
|
|
206
|
+
function ____exports.logNewGlobals(self)
|
|
207
|
+
local newGlobals = ____exports.getNewGlobals(nil)
|
|
208
|
+
log("List of added global variables in the Isaac environment:")
|
|
209
|
+
if #newGlobals == 0 then
|
|
210
|
+
log("- n/a (no extra global variables found)")
|
|
211
|
+
end
|
|
212
|
+
do
|
|
213
|
+
local i = 0
|
|
214
|
+
while i < #newGlobals do
|
|
215
|
+
local key, value = table.unpack(newGlobals[i + 1])
|
|
216
|
+
log((((tostring(i + 1) .. ") ") .. tostring(key)) .. " - ") .. tostring(value))
|
|
217
|
+
i = i + 1
|
|
218
|
+
end
|
|
219
|
+
end
|
|
220
|
+
end
|
|
171
221
|
return ____exports
|
package/dist/functions/npc.lua
CHANGED
|
@@ -70,7 +70,9 @@ NON_ALIVE_NPCS_TYPE_VARIANT = __TS__New(
|
|
|
70
70
|
(tostring(EntityType.ENTITY_MAMA_GURDY) .. ".") .. 1,
|
|
71
71
|
(tostring(EntityType.ENTITY_MAMA_GURDY) .. ".") .. 2,
|
|
72
72
|
(tostring(EntityType.ENTITY_BIG_HORN) .. ".") .. 1,
|
|
73
|
-
(tostring(EntityType.ENTITY_BIG_HORN) .. ".") .. 2
|
|
73
|
+
(tostring(EntityType.ENTITY_BIG_HORN) .. ".") .. 2,
|
|
74
|
+
(tostring(EntityType.ENTITY_DARK_ESAU) .. ".") .. 0,
|
|
75
|
+
(tostring(EntityType.ENTITY_DARK_ESAU) .. ".") .. 1
|
|
74
76
|
}
|
|
75
77
|
)
|
|
76
78
|
NON_ALIVE_NPCS_TYPE_VARIANT_SUBTYPE = __TS__New(
|
package/dist/functions/util.d.ts
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
/// <reference types="isaac-typescript-definitions" />
|
|
2
2
|
/// <reference types="typescript-to-lua/language-extensions" />
|
|
3
|
+
/**
|
|
4
|
+
* Helper function to add all of the contents of one set to another set. The first set passed will
|
|
5
|
+
* be modified in place.
|
|
6
|
+
*
|
|
7
|
+
* This function is variadic, meaning that you can specify N sets to add to the first set.
|
|
8
|
+
*/
|
|
9
|
+
export declare function addSetsToSet<T>(mainSet: Set<T>, ...setsToAdd: Array<Set<T>>): void;
|
|
3
10
|
/**
|
|
4
11
|
* Using a Map constructor to copy a Map does not seem to work properly, so use this helper function
|
|
5
12
|
* instead.
|
|
@@ -10,6 +17,11 @@ export declare function copyMap<K, V>(oldMap: Map<K, V>): Map<K, V>;
|
|
|
10
17
|
* instead.
|
|
11
18
|
*/
|
|
12
19
|
export declare function copySet<T>(oldSet: Set<T>): Set<T>;
|
|
20
|
+
/**
|
|
21
|
+
* Helper function to create a new set that is the composition of two or more sets.
|
|
22
|
+
*
|
|
23
|
+
* This function is variadic, meaning that you can specify N sets.
|
|
24
|
+
*/
|
|
13
25
|
export declare function combineSets<T>(...sets: Array<Set<T>>): Set<T>;
|
|
14
26
|
/**
|
|
15
27
|
* Helper function to get type safety on a switch statement.
|
package/dist/functions/util.lua
CHANGED
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
require("lualib_bundle");
|
|
3
3
|
local ____exports = {}
|
|
4
4
|
local HEX_STRING_LENGTH = 6
|
|
5
|
+
function ____exports.addSetsToSet(self, mainSet, ...)
|
|
6
|
+
local setsToAdd = {...}
|
|
7
|
+
for ____, set in ipairs(setsToAdd) do
|
|
8
|
+
for ____, value in __TS__Iterator(set:values()) do
|
|
9
|
+
mainSet:add(value)
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
5
13
|
function ____exports.copyMap(self, oldMap)
|
|
6
14
|
local newMap = __TS__New(Map)
|
|
7
15
|
for ____, ____value in __TS__Iterator(oldMap:entries()) do
|
package/dist/index.d.ts
CHANGED
|
@@ -23,6 +23,7 @@ export * from "./functions/doors";
|
|
|
23
23
|
export * from "./functions/entity";
|
|
24
24
|
export * from "./functions/familiars";
|
|
25
25
|
export * from "./functions/flag";
|
|
26
|
+
export * from "./functions/globals";
|
|
26
27
|
export * from "./functions/gridEntity";
|
|
27
28
|
export * from "./functions/input";
|
|
28
29
|
export * from "./functions/json";
|
package/dist/index.lua
CHANGED
|
@@ -190,6 +190,14 @@ do
|
|
|
190
190
|
end
|
|
191
191
|
end
|
|
192
192
|
end
|
|
193
|
+
do
|
|
194
|
+
local ____export = require("functions.globals")
|
|
195
|
+
for ____exportKey, ____exportValue in pairs(____export) do
|
|
196
|
+
if ____exportKey ~= "default" then
|
|
197
|
+
____exports[____exportKey] = ____exportValue
|
|
198
|
+
end
|
|
199
|
+
end
|
|
200
|
+
end
|
|
193
201
|
do
|
|
194
202
|
local ____export = require("functions.gridEntity")
|
|
195
203
|
for ____exportKey, ____exportValue in pairs(____export) do
|