isaacscript-common 6.10.2 → 6.11.2

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.
Files changed (169) hide show
  1. package/dist/callbacks/postFlip.lua +2 -2
  2. package/dist/callbacks/postPlayerFatalDamage.lua +1 -1
  3. package/dist/callbacks/postPlayerInitFirst.d.ts +2 -0
  4. package/dist/callbacks/postPlayerInitFirst.d.ts.map +1 -0
  5. package/dist/callbacks/postPlayerInitFirst.lua +42 -0
  6. package/dist/callbacks/postPlayerInitLate.lua +5 -5
  7. package/dist/callbacks/postPlayerReorderedCallbacks.d.ts +2 -0
  8. package/dist/callbacks/postPlayerReorderedCallbacks.d.ts.map +1 -0
  9. package/dist/callbacks/{postPlayerReordered.lua → postPlayerReorderedCallbacks.lua} +11 -37
  10. package/dist/callbacks/subscriptions/postFirstFlip.d.ts +1 -1
  11. package/dist/callbacks/subscriptions/postFirstFlip.d.ts.map +1 -1
  12. package/dist/callbacks/subscriptions/postFirstFlip.lua +2 -2
  13. package/dist/callbacks/subscriptions/postFlip.d.ts +1 -1
  14. package/dist/callbacks/subscriptions/postFlip.d.ts.map +1 -1
  15. package/dist/callbacks/subscriptions/postFlip.lua +2 -2
  16. package/dist/callbacks/subscriptions/{postPlayerInitReordered.d.ts → postPlayerInitFirst.d.ts} +2 -2
  17. package/dist/callbacks/subscriptions/postPlayerInitFirst.d.ts.map +1 -0
  18. package/dist/callbacks/subscriptions/{postPlayerInitReordered.lua → postPlayerInitFirst.lua} +3 -3
  19. package/dist/enums/ModCallbackCustom.d.ts +19 -17
  20. package/dist/enums/ModCallbackCustom.d.ts.map +1 -1
  21. package/dist/enums/ModCallbackCustom.lua +3 -3
  22. package/dist/enums/private/StageTravelState.d.ts +9 -0
  23. package/dist/enums/private/StageTravelState.d.ts.map +1 -0
  24. package/dist/enums/private/StageTravelState.lua +15 -0
  25. package/dist/enums/private/TrapdoorAnimation.d.ts +6 -0
  26. package/dist/enums/private/TrapdoorAnimation.d.ts.map +1 -0
  27. package/dist/enums/private/TrapdoorAnimation.lua +6 -0
  28. package/dist/features/customGridEntity.d.ts +8 -5
  29. package/dist/features/customGridEntity.d.ts.map +1 -1
  30. package/dist/features/customGridEntity.lua +66 -17
  31. package/dist/features/customStage/exports.d.ts.map +1 -1
  32. package/dist/features/customStage/exports.lua +0 -13
  33. package/dist/features/customStage/init.d.ts.map +1 -1
  34. package/dist/features/customStage/init.lua +24 -2
  35. package/dist/features/customStage/streakText.d.ts +6 -0
  36. package/dist/features/customStage/streakText.d.ts.map +1 -1
  37. package/dist/features/customStage/streakText.lua +16 -12
  38. package/dist/features/customStage/versusScreen.d.ts +6 -0
  39. package/dist/features/customStage/versusScreen.d.ts.map +1 -1
  40. package/dist/features/customStage/versusScreen.lua +10 -5
  41. package/dist/features/customTrapdoor/blackSprite.d.ts +2 -0
  42. package/dist/features/customTrapdoor/blackSprite.d.ts.map +1 -0
  43. package/dist/features/customTrapdoor/blackSprite.lua +19 -0
  44. package/dist/features/customTrapdoor/customTrapdoorConstants.d.ts +15 -0
  45. package/dist/features/customTrapdoor/customTrapdoorConstants.d.ts.map +1 -0
  46. package/dist/features/customTrapdoor/customTrapdoorConstants.lua +16 -0
  47. package/dist/features/customTrapdoor/exports.d.ts +29 -0
  48. package/dist/features/customTrapdoor/exports.d.ts.map +1 -0
  49. package/dist/features/customTrapdoor/exports.lua +93 -0
  50. package/dist/features/customTrapdoor/init.d.ts +3 -0
  51. package/dist/features/customTrapdoor/init.d.ts.map +1 -0
  52. package/dist/features/customTrapdoor/init.lua +173 -0
  53. package/dist/features/customTrapdoor/openClose.d.ts +5 -0
  54. package/dist/features/customTrapdoor/openClose.d.ts.map +1 -0
  55. package/dist/features/customTrapdoor/openClose.lua +60 -0
  56. package/dist/features/customTrapdoor/touched.d.ts +4 -0
  57. package/dist/features/customTrapdoor/touched.d.ts.map +1 -0
  58. package/dist/features/customTrapdoor/touched.lua +141 -0
  59. package/dist/features/customTrapdoor/v.d.ts +18 -0
  60. package/dist/features/customTrapdoor/v.d.ts.map +1 -0
  61. package/dist/features/customTrapdoor/v.lua +17 -0
  62. package/dist/features/deployJSONRoom.d.ts.map +1 -1
  63. package/dist/features/deployJSONRoom.lua +1 -1
  64. package/dist/features/extraConsoleCommands/init.d.ts.map +1 -1
  65. package/dist/features/extraConsoleCommands/init.lua +3 -1
  66. package/dist/features/extraConsoleCommands/listCommands.lua +2 -2
  67. package/dist/features/taintedLazarusPlayers.d.ts.map +1 -1
  68. package/dist/features/taintedLazarusPlayers.lua +13 -21
  69. package/dist/functions/{character.d.ts → characters.d.ts} +3 -1
  70. package/dist/functions/characters.d.ts.map +1 -0
  71. package/dist/functions/{character.lua → characters.lua} +12 -0
  72. package/dist/functions/deepCopyTests.lua +35 -45
  73. package/dist/functions/jsonHelpers.d.ts +6 -0
  74. package/dist/functions/jsonHelpers.d.ts.map +1 -1
  75. package/dist/functions/jsonHelpers.lua +9 -3
  76. package/dist/functions/log.lua +3 -3
  77. package/dist/functions/playerIndex.d.ts +11 -2
  78. package/dist/functions/playerIndex.d.ts.map +1 -1
  79. package/dist/functions/playerIndex.lua +20 -8
  80. package/dist/functions/players.lua +4 -4
  81. package/dist/functions/revive.lua +2 -2
  82. package/dist/functions/table.d.ts +1 -1
  83. package/dist/functions/table.d.ts.map +1 -1
  84. package/dist/index.d.ts +3 -2
  85. package/dist/index.d.ts.map +1 -1
  86. package/dist/index.lua +10 -2
  87. package/dist/initCustomCallbacks.d.ts.map +1 -1
  88. package/dist/initCustomCallbacks.lua +5 -2
  89. package/dist/initFeatures.d.ts +1 -2
  90. package/dist/initFeatures.d.ts.map +1 -1
  91. package/dist/initFeatures.lua +10 -2
  92. package/dist/interfaces/AddCallbackParameterCustom.d.ts +2 -2
  93. package/dist/interfaces/AddCallbackParameterCustom.d.ts.map +1 -1
  94. package/dist/interfaces/CustomGridEntityData.d.ts +6 -2
  95. package/dist/interfaces/CustomGridEntityData.d.ts.map +1 -1
  96. package/dist/interfaces/private/CustomTrapdoorDescription.d.ts +7 -0
  97. package/dist/interfaces/private/CustomTrapdoorDescription.d.ts.map +1 -0
  98. package/dist/interfaces/private/CustomTrapdoorDescription.lua +2 -0
  99. package/dist/lib/jsonLua.lua +390 -0
  100. package/dist/objects/callbackRegisterFunctions.d.ts.map +1 -1
  101. package/dist/objects/callbackRegisterFunctions.lua +3 -3
  102. package/dist/objects/characterDamageMultipliers.d.ts +6 -0
  103. package/dist/objects/characterDamageMultipliers.d.ts.map +1 -0
  104. package/dist/objects/characterDamageMultipliers.lua +49 -0
  105. package/dist/upgradeMod.d.ts.map +1 -1
  106. package/dist/upgradeMod.lua +2 -4
  107. package/package.json +2 -2
  108. package/src/callbacks/customRevive.ts +3 -3
  109. package/src/callbacks/itemPickup.ts +3 -3
  110. package/src/callbacks/postAmbush.ts +3 -3
  111. package/src/callbacks/postEsauJr.ts +3 -3
  112. package/src/callbacks/postFlip.ts +6 -5
  113. package/src/callbacks/postGridEntity.ts +5 -5
  114. package/src/callbacks/postPlayerCollectible.ts +2 -2
  115. package/src/callbacks/postPlayerFatalDamage.ts +5 -0
  116. package/src/callbacks/postPlayerInitFirst.ts +57 -0
  117. package/src/callbacks/postPlayerInitLate.ts +9 -5
  118. package/src/callbacks/{postPlayerReordered.ts → postPlayerReorderedCallbacks.ts} +9 -29
  119. package/src/callbacks/postSlotInitUpdate.ts +5 -2
  120. package/src/callbacks/postSlotRender.ts +2 -2
  121. package/src/callbacks/reorderedCallbacks.ts +1 -1
  122. package/src/callbacks/subscriptions/postFirstFlip.ts +6 -3
  123. package/src/callbacks/subscriptions/postFlip.ts +6 -3
  124. package/src/callbacks/subscriptions/{postPlayerInitReordered.ts → postPlayerInitFirst.ts} +6 -6
  125. package/src/enums/ModCallbackCustom.ts +19 -17
  126. package/src/enums/private/StageTravelState.ts +8 -0
  127. package/src/enums/private/TrapdoorAnimation.ts +5 -0
  128. package/src/features/customGridEntity.ts +93 -12
  129. package/src/features/customStage/exports.ts +3 -22
  130. package/src/features/customStage/init.ts +30 -1
  131. package/src/features/customStage/streakText.ts +13 -5
  132. package/src/features/customStage/versusScreen.ts +20 -12
  133. package/src/features/customTrapdoor/blackSprite.ts +16 -0
  134. package/src/features/customTrapdoor/customTrapdoorConstants.ts +23 -0
  135. package/src/features/customTrapdoor/exports.ts +99 -0
  136. package/src/features/customTrapdoor/init.ts +215 -0
  137. package/src/features/customTrapdoor/openClose.ts +103 -0
  138. package/src/features/customTrapdoor/touched.ts +175 -0
  139. package/src/features/customTrapdoor/v.ts +26 -0
  140. package/src/features/deployJSONRoom.ts +6 -1
  141. package/src/features/extraConsoleCommands/init.ts +5 -2
  142. package/src/features/extraConsoleCommands/listCommands.ts +1 -1
  143. package/src/features/saveDataManager/main.ts +1 -1
  144. package/src/features/taintedLazarusPlayers.ts +32 -31
  145. package/src/functions/{character.ts → characters.ts} +13 -0
  146. package/src/functions/deepCopy.ts +2 -2
  147. package/src/functions/deepCopyTests.ts +44 -48
  148. package/src/functions/entities.ts +1 -1
  149. package/src/functions/jsonHelpers.ts +9 -3
  150. package/src/functions/playerIndex.ts +18 -2
  151. package/src/functions/players.ts +1 -1
  152. package/src/functions/revive.ts +1 -1
  153. package/src/functions/rng.ts +1 -1
  154. package/src/functions/table.ts +2 -2
  155. package/src/index.ts +6 -2
  156. package/src/initCustomCallbacks.ts +3 -1
  157. package/src/initFeatures.ts +9 -2
  158. package/src/interfaces/AddCallbackParameterCustom.ts +2 -2
  159. package/src/interfaces/CustomGridEntityData.ts +7 -2
  160. package/src/interfaces/private/CustomTrapdoorDescription.ts +7 -0
  161. package/src/lib/jsonLua.d.ts +10 -0
  162. package/src/lib/jsonLua.lua +390 -0
  163. package/src/objects/callbackRegisterFunctions.ts +2 -3
  164. package/src/objects/characterDamageMultipliers.ts +49 -0
  165. package/src/upgradeMod.ts +2 -3
  166. package/dist/callbacks/postPlayerReordered.d.ts +0 -2
  167. package/dist/callbacks/postPlayerReordered.d.ts.map +0 -1
  168. package/dist/callbacks/subscriptions/postPlayerInitReordered.d.ts.map +0 -1
  169. package/dist/functions/character.d.ts.map +0 -1
@@ -0,0 +1,390 @@
1
+ -- cspell:disable
2
+
3
+ --
4
+ -- json.lua
5
+ --
6
+ -- Copyright (c) 2020 rxi
7
+ --
8
+ -- Permission is hereby granted, free of charge, to any person obtaining a copy of
9
+ -- this software and associated documentation files (the "Software"), to deal in
10
+ -- the Software without restriction, including without limitation the rights to
11
+ -- use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
12
+ -- of the Software, and to permit persons to whom the Software is furnished to do
13
+ -- so, subject to the following conditions:
14
+ --
15
+ -- The above copyright notice and this permission notice shall be included in all
16
+ -- copies or substantial portions of the Software.
17
+ --
18
+ -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
+ -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
+ -- SOFTWARE.
25
+ --
26
+
27
+ local json = { _version = "0.1.2" }
28
+
29
+ -------------------------------------------------------------------------------
30
+ -- Encode
31
+ -------------------------------------------------------------------------------
32
+
33
+ local encode
34
+
35
+ local escape_char_map = {
36
+ [ "\\" ] = "\\",
37
+ [ "\"" ] = "\"",
38
+ [ "\b" ] = "b",
39
+ [ "\f" ] = "f",
40
+ [ "\n" ] = "n",
41
+ [ "\r" ] = "r",
42
+ [ "\t" ] = "t",
43
+ }
44
+
45
+ local escape_char_map_inv = { [ "/" ] = "/" }
46
+ for k, v in pairs(escape_char_map) do
47
+ escape_char_map_inv[v] = k
48
+ end
49
+
50
+
51
+ local function escape_char(c)
52
+ return "\\" .. (escape_char_map[c] or string.format("u%04x", c:byte()))
53
+ end
54
+
55
+
56
+ local function encode_nil(val)
57
+ return "null"
58
+ end
59
+
60
+
61
+ local function encode_table(val, stack)
62
+ local res = {}
63
+ stack = stack or {}
64
+
65
+ -- Circular reference?
66
+ if stack[val] then error("circular reference") end
67
+
68
+ stack[val] = true
69
+
70
+ if rawget(val, 1) ~= nil or next(val) == nil then
71
+ -- Treat as array -- check keys are valid and it is not sparse
72
+ local n = 0
73
+ for k in pairs(val) do
74
+ if type(k) ~= "number" then
75
+ error("invalid table: mixed or invalid key types")
76
+ end
77
+ n = n + 1
78
+ end
79
+ if n ~= #val then
80
+ error("invalid table: sparse array")
81
+ end
82
+ -- Encode
83
+ for i, v in ipairs(val) do
84
+ table.insert(res, encode(v, stack))
85
+ end
86
+ stack[val] = nil
87
+ return "[" .. table.concat(res, ",") .. "]"
88
+
89
+ else
90
+ -- Treat as an object
91
+ for k, v in pairs(val) do
92
+ if type(k) ~= "string" then
93
+ error("invalid table: mixed or invalid key types")
94
+ end
95
+ table.insert(res, encode(k, stack) .. ":" .. encode(v, stack))
96
+ end
97
+ stack[val] = nil
98
+ return "{" .. table.concat(res, ",") .. "}"
99
+ end
100
+ end
101
+
102
+
103
+ local function encode_string(val)
104
+ return '"' .. val:gsub('[%z\1-\31\\"]', escape_char) .. '"'
105
+ end
106
+
107
+
108
+ local function encode_number(val)
109
+ -- Check for NaN, -inf and inf
110
+ if val ~= val or val <= -math.huge or val >= math.huge then
111
+ error("unexpected number value '" .. tostring(val) .. "'")
112
+ end
113
+ return string.format("%.14g", val)
114
+ end
115
+
116
+
117
+ local type_func_map = {
118
+ [ "nil" ] = encode_nil,
119
+ [ "table" ] = encode_table,
120
+ [ "string" ] = encode_string,
121
+ [ "number" ] = encode_number,
122
+ [ "boolean" ] = tostring,
123
+ }
124
+
125
+
126
+ encode = function(val, stack)
127
+ local t = type(val)
128
+ local f = type_func_map[t]
129
+ if f then
130
+ return f(val, stack)
131
+ end
132
+ error("unexpected type '" .. t .. "'")
133
+ end
134
+
135
+
136
+ function json.encode(val)
137
+ return ( encode(val) )
138
+ end
139
+
140
+
141
+ -------------------------------------------------------------------------------
142
+ -- Decode
143
+ -------------------------------------------------------------------------------
144
+
145
+ local parse
146
+
147
+ local function create_set(...)
148
+ local res = {}
149
+ for i = 1, select("#", ...) do
150
+ res[ select(i, ...) ] = true
151
+ end
152
+ return res
153
+ end
154
+
155
+ local space_chars = create_set(" ", "\t", "\r", "\n")
156
+ local delim_chars = create_set(" ", "\t", "\r", "\n", "]", "}", ",")
157
+ local escape_chars = create_set("\\", "/", '"', "b", "f", "n", "r", "t", "u")
158
+ local literals = create_set("true", "false", "null")
159
+
160
+ local literal_map = {
161
+ [ "true" ] = true,
162
+ [ "false" ] = false,
163
+ [ "null" ] = nil,
164
+ }
165
+
166
+
167
+ local function next_char(str, idx, set, negate)
168
+ for i = idx, #str do
169
+ if set[str:sub(i, i)] ~= negate then
170
+ return i
171
+ end
172
+ end
173
+ return #str + 1
174
+ end
175
+
176
+
177
+ local function decode_error(str, idx, msg)
178
+ local line_count = 1
179
+ local col_count = 1
180
+ for i = 1, idx - 1 do
181
+ col_count = col_count + 1
182
+ if str:sub(i, i) == "\n" then
183
+ line_count = line_count + 1
184
+ col_count = 1
185
+ end
186
+ end
187
+ error( string.format("%s at line %d col %d", msg, line_count, col_count) )
188
+ end
189
+
190
+
191
+ local function codepoint_to_utf8(n)
192
+ -- http://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&id=iws-appendixa
193
+ local f = math.floor
194
+ if n <= 0x7f then
195
+ return string.char(n)
196
+ elseif n <= 0x7ff then
197
+ return string.char(f(n / 64) + 192, n % 64 + 128)
198
+ elseif n <= 0xffff then
199
+ return string.char(f(n / 4096) + 224, f(n % 4096 / 64) + 128, n % 64 + 128)
200
+ elseif n <= 0x10ffff then
201
+ return string.char(f(n / 262144) + 240, f(n % 262144 / 4096) + 128,
202
+ f(n % 4096 / 64) + 128, n % 64 + 128)
203
+ end
204
+ error( string.format("invalid unicode codepoint '%x'", n) )
205
+ end
206
+
207
+
208
+ local function parse_unicode_escape(s)
209
+ local n1 = tonumber( s:sub(1, 4), 16 )
210
+ local n2 = tonumber( s:sub(7, 10), 16 )
211
+ -- Surrogate pair?
212
+ if n2 then
213
+ return codepoint_to_utf8((n1 - 0xd800) * 0x400 + (n2 - 0xdc00) + 0x10000)
214
+ else
215
+ return codepoint_to_utf8(n1)
216
+ end
217
+ end
218
+
219
+
220
+ local function parse_string(str, i)
221
+ local res = ""
222
+ local j = i + 1
223
+ local k = j
224
+
225
+ while j <= #str do
226
+ local x = str:byte(j)
227
+
228
+ if x < 32 then
229
+ decode_error(str, j, "control character in string")
230
+
231
+ elseif x == 92 then -- `\`: Escape
232
+ res = res .. str:sub(k, j - 1)
233
+ j = j + 1
234
+ local c = str:sub(j, j)
235
+ if c == "u" then
236
+ local hex = str:match("^[dD][89aAbB]%x%x\\u%x%x%x%x", j + 1)
237
+ or str:match("^%x%x%x%x", j + 1)
238
+ or decode_error(str, j - 1, "invalid unicode escape in string")
239
+ res = res .. parse_unicode_escape(hex)
240
+ j = j + #hex
241
+ else
242
+ if not escape_chars[c] then
243
+ decode_error(str, j - 1, "invalid escape char '" .. c .. "' in string")
244
+ end
245
+ res = res .. escape_char_map_inv[c]
246
+ end
247
+ k = j + 1
248
+
249
+ elseif x == 34 then -- `"`: End of string
250
+ res = res .. str:sub(k, j - 1)
251
+ return res, j + 1
252
+ end
253
+
254
+ j = j + 1
255
+ end
256
+
257
+ decode_error(str, i, "expected closing quote for string")
258
+ end
259
+
260
+
261
+ local function parse_number(str, i)
262
+ local x = next_char(str, i, delim_chars)
263
+ local s = str:sub(i, x - 1)
264
+ local n = tonumber(s)
265
+ if not n then
266
+ decode_error(str, i, "invalid number '" .. s .. "'")
267
+ end
268
+ return n, x
269
+ end
270
+
271
+
272
+ local function parse_literal(str, i)
273
+ local x = next_char(str, i, delim_chars)
274
+ local word = str:sub(i, x - 1)
275
+ if not literals[word] then
276
+ decode_error(str, i, "invalid literal '" .. word .. "'")
277
+ end
278
+ return literal_map[word], x
279
+ end
280
+
281
+
282
+ local function parse_array(str, i)
283
+ local res = {}
284
+ local n = 1
285
+ i = i + 1
286
+ while 1 do
287
+ local x
288
+ i = next_char(str, i, space_chars, true)
289
+ -- Empty / end of array?
290
+ if str:sub(i, i) == "]" then
291
+ i = i + 1
292
+ break
293
+ end
294
+ -- Read token
295
+ x, i = parse(str, i)
296
+ res[n] = x
297
+ n = n + 1
298
+ -- Next token
299
+ i = next_char(str, i, space_chars, true)
300
+ local chr = str:sub(i, i)
301
+ i = i + 1
302
+ if chr == "]" then break end
303
+ if chr ~= "," then decode_error(str, i, "expected ']' or ','") end
304
+ end
305
+ return res, i
306
+ end
307
+
308
+
309
+ local function parse_object(str, i)
310
+ local res = {}
311
+ i = i + 1
312
+ while 1 do
313
+ local key, val
314
+ i = next_char(str, i, space_chars, true)
315
+ -- Empty / end of object?
316
+ if str:sub(i, i) == "}" then
317
+ i = i + 1
318
+ break
319
+ end
320
+ -- Read key
321
+ if str:sub(i, i) ~= '"' then
322
+ decode_error(str, i, "expected string for key")
323
+ end
324
+ key, i = parse(str, i)
325
+ -- Read ':' delimiter
326
+ i = next_char(str, i, space_chars, true)
327
+ if str:sub(i, i) ~= ":" then
328
+ decode_error(str, i, "expected ':' after key")
329
+ end
330
+ i = next_char(str, i + 1, space_chars, true)
331
+ -- Read value
332
+ val, i = parse(str, i)
333
+ -- Set
334
+ res[key] = val
335
+ -- Next token
336
+ i = next_char(str, i, space_chars, true)
337
+ local chr = str:sub(i, i)
338
+ i = i + 1
339
+ if chr == "}" then break end
340
+ if chr ~= "," then decode_error(str, i, "expected '}' or ','") end
341
+ end
342
+ return res, i
343
+ end
344
+
345
+
346
+ local char_func_map = {
347
+ [ '"' ] = parse_string,
348
+ [ "0" ] = parse_number,
349
+ [ "1" ] = parse_number,
350
+ [ "2" ] = parse_number,
351
+ [ "3" ] = parse_number,
352
+ [ "4" ] = parse_number,
353
+ [ "5" ] = parse_number,
354
+ [ "6" ] = parse_number,
355
+ [ "7" ] = parse_number,
356
+ [ "8" ] = parse_number,
357
+ [ "9" ] = parse_number,
358
+ [ "-" ] = parse_number,
359
+ [ "t" ] = parse_literal,
360
+ [ "f" ] = parse_literal,
361
+ [ "n" ] = parse_literal,
362
+ [ "[" ] = parse_array,
363
+ [ "{" ] = parse_object,
364
+ }
365
+
366
+
367
+ parse = function(str, idx)
368
+ local chr = str:sub(idx, idx)
369
+ local f = char_func_map[chr]
370
+ if f then
371
+ return f(str, idx)
372
+ end
373
+ decode_error(str, idx, "unexpected character '" .. chr .. "'")
374
+ end
375
+
376
+
377
+ function json.decode(str)
378
+ if type(str) ~= "string" then
379
+ error("expected argument of type string, got " .. type(str))
380
+ end
381
+ local res, idx = parse(str, next_char(str, 1, space_chars, true))
382
+ idx = next_char(str, idx, space_chars, true)
383
+ if idx <= #str then
384
+ decode_error(str, idx, "trailing garbage")
385
+ end
386
+ return res
387
+ end
388
+
389
+
390
+ return json
@@ -1 +1 @@
1
- {"version":3,"file":"callbackRegisterFunctions.d.ts","sourceRoot":"","sources":["../../src/objects/callbackRegisterFunctions.ts"],"names":[],"mappings":"AAmFA,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,0BAA0B,EAAE,MAAM,0CAA0C,CAAC;AAEtF,eAAO,MAAM,2BAA2B,EAAE;IACxC,QAAQ,EAAE,GAAG,IAAI,iBAAiB,GAAG,CACnC,GAAG,IAAI,EAAE,0BAA0B,CAAC,GAAG,CAAC,KACrC,IAAI;CAmGD,CAAC"}
1
+ {"version":3,"file":"callbackRegisterFunctions.d.ts","sourceRoot":"","sources":["../../src/objects/callbackRegisterFunctions.ts"],"names":[],"mappings":"AAmFA,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,0BAA0B,EAAE,MAAM,0CAA0C,CAAC;AAEtF,eAAO,MAAM,2BAA2B,EAAE;IACxC,QAAQ,EAAE,GAAG,IAAI,iBAAiB,GAAG,CACnC,GAAG,IAAI,EAAE,0BAA0B,CAAC,GAAG,CAAC,KACrC,IAAI;CAkGD,CAAC"}
@@ -103,10 +103,10 @@ local ____postPlayerCollectibleRemoved = require("callbacks.subscriptions.postPl
103
103
  local postPlayerCollectibleRemovedRegister = ____postPlayerCollectibleRemoved.postPlayerCollectibleRemovedRegister
104
104
  local ____postPlayerFatalDamage = require("callbacks.subscriptions.postPlayerFatalDamage")
105
105
  local postPlayerFatalDamageRegister = ____postPlayerFatalDamage.postPlayerFatalDamageRegister
106
+ local ____postPlayerInitFirst = require("callbacks.subscriptions.postPlayerInitFirst")
107
+ local postPlayerInitFirstRegister = ____postPlayerInitFirst.postPlayerInitFirstRegister
106
108
  local ____postPlayerInitLate = require("callbacks.subscriptions.postPlayerInitLate")
107
109
  local postPlayerInitLateRegister = ____postPlayerInitLate.postPlayerInitLateRegister
108
- local ____postPlayerInitReordered = require("callbacks.subscriptions.postPlayerInitReordered")
109
- local postPlayerInitReorderedRegister = ____postPlayerInitReordered.postPlayerInitReorderedRegister
110
110
  local ____postPlayerRenderReordered = require("callbacks.subscriptions.postPlayerRenderReordered")
111
111
  local postPlayerRenderReorderedRegister = ____postPlayerRenderReordered.postPlayerRenderReorderedRegister
112
112
  local ____postPlayerUpdateReordered = require("callbacks.subscriptions.postPlayerUpdateReordered")
@@ -220,8 +220,8 @@ ____exports.CALLBACK_REGISTER_FUNCTIONS = {
220
220
  [ModCallbackCustom.POST_PLAYER_COLLECTIBLE_ADDED] = postPlayerCollectibleAddedRegister,
221
221
  [ModCallbackCustom.POST_PLAYER_COLLECTIBLE_REMOVED] = postPlayerCollectibleRemovedRegister,
222
222
  [ModCallbackCustom.POST_PLAYER_FATAL_DAMAGE] = postPlayerFatalDamageRegister,
223
+ [ModCallbackCustom.POST_PLAYER_INIT_FIRST] = postPlayerInitFirstRegister,
223
224
  [ModCallbackCustom.POST_PLAYER_INIT_LATE] = postPlayerInitLateRegister,
224
- [ModCallbackCustom.POST_PLAYER_INIT_REORDERED] = postPlayerInitReorderedRegister,
225
225
  [ModCallbackCustom.POST_PLAYER_RENDER_REORDERED] = postPlayerRenderReorderedRegister,
226
226
  [ModCallbackCustom.POST_PLAYER_UPDATE_REORDERED] = postPlayerUpdateReorderedRegister,
227
227
  [ModCallbackCustom.POST_POOP_RENDER] = postPoopRenderRegister,
@@ -0,0 +1,6 @@
1
+ import { PlayerType } from "isaac-typescript-definitions";
2
+ /** From: https://bindingofisaacrebirth.fandom.com/wiki/Characters#Regular_Characters */
3
+ export declare const CHARACTER_DAMAGE_MULTIPLIERS: {
4
+ readonly [key in PlayerType]: float;
5
+ };
6
+ //# sourceMappingURL=characterDamageMultipliers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"characterDamageMultipliers.d.ts","sourceRoot":"","sources":["../../src/objects/characterDamageMultipliers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAE1D,wFAAwF;AACxF,eAAO,MAAM,4BAA4B,EAAE;IACzC,QAAQ,EAAE,GAAG,IAAI,UAAU,GAAG,KAAK;CA4C3B,CAAC"}
@@ -0,0 +1,49 @@
1
+ local ____exports = {}
2
+ local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
3
+ local PlayerType = ____isaac_2Dtypescript_2Ddefinitions.PlayerType
4
+ --- From: https://bindingofisaacrebirth.fandom.com/wiki/Characters#Regular_Characters
5
+ ____exports.CHARACTER_DAMAGE_MULTIPLIERS = {
6
+ [PlayerType.POSSESSOR] = 1,
7
+ [PlayerType.ISAAC] = 1,
8
+ [PlayerType.MAGDALENE] = 1,
9
+ [PlayerType.CAIN] = 1.2,
10
+ [PlayerType.JUDAS] = 1.35,
11
+ [PlayerType.BLUE_BABY] = 1.05,
12
+ [PlayerType.EVE] = 0.75,
13
+ [PlayerType.SAMSON] = 1,
14
+ [PlayerType.AZAZEL] = 1.5,
15
+ [PlayerType.LAZARUS] = 1,
16
+ [PlayerType.EDEN] = 1,
17
+ [PlayerType.THE_LOST] = 1,
18
+ [PlayerType.LAZARUS_2] = 1.4,
19
+ [PlayerType.BLACK_JUDAS] = 2,
20
+ [PlayerType.LILITH] = 1,
21
+ [PlayerType.KEEPER] = 1.2,
22
+ [PlayerType.APOLLYON] = 1,
23
+ [PlayerType.THE_FORGOTTEN] = 1.5,
24
+ [PlayerType.THE_SOUL] = 1,
25
+ [PlayerType.BETHANY] = 1,
26
+ [PlayerType.JACOB] = 1,
27
+ [PlayerType.ESAU] = 1,
28
+ [PlayerType.ISAAC_B] = 1,
29
+ [PlayerType.MAGDALENE_B] = 0.75,
30
+ [PlayerType.CAIN_B] = 1,
31
+ [PlayerType.JUDAS_B] = 1,
32
+ [PlayerType.BLUE_BABY_B] = 1,
33
+ [PlayerType.EVE_B] = 1.2,
34
+ [PlayerType.SAMSON_B] = 1,
35
+ [PlayerType.AZAZEL_B] = 1.5,
36
+ [PlayerType.LAZARUS_B] = 1,
37
+ [PlayerType.EDEN_B] = 1,
38
+ [PlayerType.THE_LOST_B] = 1.3,
39
+ [PlayerType.LILITH_B] = 1,
40
+ [PlayerType.KEEPER_B] = 1,
41
+ [PlayerType.APOLLYON_B] = 1,
42
+ [PlayerType.THE_FORGOTTEN_B] = 1.5,
43
+ [PlayerType.BETHANY_B] = 1,
44
+ [PlayerType.JACOB_B] = 1,
45
+ [PlayerType.LAZARUS_2_B] = 1.5,
46
+ [PlayerType.JACOB_2_B] = 1,
47
+ [PlayerType.THE_SOUL_B] = 1
48
+ }
49
+ return ____exports
@@ -1 +1 @@
1
- {"version":3,"file":"upgradeMod.d.ts","sourceRoot":"","sources":["../src/upgradeMod.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAWpD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,UAAU,CAAC,UAAU,EAAE,GAAG,GAAG,WAAW,CAwBvD"}
1
+ {"version":3,"file":"upgradeMod.d.ts","sourceRoot":"","sources":["../src/upgradeMod.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAWpD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,UAAU,CAAC,UAAU,EAAE,GAAG,GAAG,WAAW,CAuBvD"}
@@ -13,8 +13,7 @@ local setFeaturesInitialized = ____featuresInitialized.setFeaturesInitialized
13
13
  local ____initCustomCallbacks = require("initCustomCallbacks")
14
14
  local initCustomCallbacks = ____initCustomCallbacks.initCustomCallbacks
15
15
  local ____initFeatures = require("initFeatures")
16
- local initFeaturesMajor = ____initFeatures.initFeaturesMajor
17
- local initFeaturesMinor = ____initFeatures.initFeaturesMinor
16
+ local initFeatures = ____initFeatures.initFeatures
18
17
  local ____patchErrorFunctions = require("patchErrorFunctions")
19
18
  local patchErrorFunction = ____patchErrorFunctions.patchErrorFunction
20
19
  local ____shaderCrashFix = require("shaderCrashFix")
@@ -46,8 +45,7 @@ function ____exports.upgradeMod(self, modVanilla)
46
45
  postNewRoomEarlyCallbackInit(nil, mod)
47
46
  saveDataManagerInit(nil, mod)
48
47
  initCustomCallbacks(nil, mod)
49
- initFeaturesMajor(nil, mod)
50
- initFeaturesMinor(nil, mod)
48
+ initFeatures(nil, mod)
51
49
  end
52
50
  return mod
53
51
  end
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "6.10.2",
3
+ "version": "6.11.2",
4
4
  "description": "Helper functions and features for IsaacScript mods.",
5
5
  "keywords": [
6
6
  "isaac",
@@ -22,6 +22,6 @@
22
22
  "main": "dist/index",
23
23
  "types": "dist/index.d.ts",
24
24
  "dependencies": {
25
- "isaac-typescript-definitions": "^3.0.31"
25
+ "isaac-typescript-definitions": "^3.0.34"
26
26
  }
27
27
  }
@@ -1,6 +1,6 @@
1
- // This provides the logic for:
2
- // - PRE_CUSTOM_REVIVE
3
- // - POST_CUSTOM_REVIVE
1
+ // This provides the logic for the following callbacks:
2
+ // - `PRE_CUSTOM_REVIVE`
3
+ // - `POST_CUSTOM_REVIVE`
4
4
 
5
5
  import {
6
6
  CollectibleType,
@@ -1,6 +1,6 @@
1
- // This provides the logic for:
2
- // - PRE_ITEM_PICKUP
3
- // - POST_ITEM_PICKUP
1
+ // This provides the logic for the following callbacks:
2
+ // - `PRE_ITEM_PICKUP`
3
+ // - `POST_ITEM_PICKUP`
4
4
 
5
5
  import {
6
6
  CollectibleType,
@@ -1,6 +1,6 @@
1
- // This provides the logic for:
2
- // - POST_AMBUSH_STARTED
3
- // - POST_AMBUSH_FINISHED
1
+ // This provides the logic for the following callbacks:
2
+ // - `POST_AMBUSH_STARTED`
3
+ // - `POST_AMBUSH_FINISHED`
4
4
 
5
5
  import { ModCallback, RoomType } from "isaac-typescript-definitions";
6
6
  import { game } from "../cachedClasses";
@@ -1,6 +1,6 @@
1
- // This provides the logic for:
2
- // - POST_ESAU_JR
3
- // - POST_FIRST_ESAU_JR
1
+ // This provides the logic for the following callbacks:
2
+ // - `POST_ESAU_JR`
3
+ // - `POST_FIRST_ESAU_JR`
4
4
 
5
5
  import {
6
6
  CollectibleType,
@@ -1,6 +1,6 @@
1
- // This provides the logic for:
2
- // - POST_FLIP
3
- // - POST_FIRST_FLIP
1
+ // This provides the logic for the following callbacks:
2
+ // - `POST_FLIP`
3
+ // - `POST_FIRST_FLIP`
4
4
 
5
5
  import {
6
6
  CollectibleType,
@@ -21,6 +21,7 @@ import {
21
21
 
22
22
  const v = {
23
23
  run: {
24
+ /** We don't consider the case of a multiplayer game with more than one Tainted Lazarus. */
24
25
  usedFlipAtLeastOnce: false,
25
26
  },
26
27
  };
@@ -63,10 +64,10 @@ function useItemFlip(
63
64
 
64
65
  if (!v.run.usedFlipAtLeastOnce) {
65
66
  v.run.usedFlipAtLeastOnce = true;
66
- postFirstFlipFire(newLazarus);
67
+ postFirstFlipFire(newLazarus, player);
67
68
  }
68
69
 
69
- postFlipFire(newLazarus);
70
+ postFlipFire(newLazarus, player);
70
71
 
71
72
  return undefined;
72
73
  }
@@ -1,9 +1,9 @@
1
1
  // This provides the logic for the following callbacks:
2
- // - PostGridEntityInit
3
- // - PostGridEntityUpdate
4
- // - PostGridEntityRemove
5
- // - PostGridEntityStateChanged
6
- // - PostGridEntityBroken
2
+ // - `POST_GRID_ENTITY_INIT`
3
+ // - `POST_GRID_ENTITY_UPDATE`
4
+ // - `POST_GRID_ENTITY_REMOVE`
5
+ // - `POST_GRID_ENTITY_STATE_CHANGED`
6
+ // - `POST_GRID_ENTITY_BROKEN`
7
7
 
8
8
  import { GridEntityType, ModCallback } from "isaac-typescript-definitions";
9
9
  import { ModUpgraded } from "../classes/ModUpgraded";
@@ -1,6 +1,6 @@
1
1
  // This provides the logic for the following callbacks:
2
- // - PostPlayerCollectibleAdded
3
- // - PostPlayerCollectibleRemoved
2
+ // - `POST_PLAYER_COLLECTIBLE_ADDED`
3
+ // - `POST_PLAYER_COLLECTIBLE_REMOVED`
4
4
 
5
5
  import { CollectibleType, ModCallback } from "isaac-typescript-definitions";
6
6
  import { DefaultMap } from "../classes/DefaultMap";
@@ -1,10 +1,12 @@
1
1
  import {
2
+ ActiveSlot,
2
3
  BossID,
3
4
  CollectibleType,
4
5
  DamageFlag,
5
6
  DamageFlagZero,
6
7
  EntityType,
7
8
  ModCallback,
9
+ UseFlag,
8
10
  } from "isaac-typescript-definitions";
9
11
  import { game } from "../cachedClasses";
10
12
  import { saveDataManager } from "../features/saveDataManager/exports";
@@ -113,6 +115,9 @@ function preUseItemBible(
113
115
  _collectibleType: CollectibleType,
114
116
  _rng: RNG,
115
117
  player: EntityPlayer,
118
+ _useFlags: BitFlags<UseFlag>,
119
+ _activeSlot: ActiveSlot,
120
+ _customVarData: int,
116
121
  ): boolean | undefined {
117
122
  if (!hasSubscriptions()) {
118
123
  return undefined;