isaacscript-common 1.2.168 → 1.2.171

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.
@@ -1,11 +1,13 @@
1
1
  --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
2
  local ____exports = {}
3
- local hasSubscriptions, postNewRoom, preEntitySpawn, checkRoomChanged, currentRoomTopLeftWallPtrHash
3
+ local hasSubscriptions, postNewRoom, preEntitySpawn, checkRoomChanged, currentRoomTopLeftWallPtrHash, currentRoomTopLeftWallPtrHash2
4
4
  local ____cachedClasses = require("cachedClasses")
5
5
  local game = ____cachedClasses.game
6
6
  local ____gridEntity = require("functions.gridEntity")
7
7
  local getTopLeftWallGridIndex = ____gridEntity.getTopLeftWallGridIndex
8
8
  local spawnGridEntity = ____gridEntity.spawnGridEntity
9
+ local ____log = require("functions.log")
10
+ local log = ____log.log
9
11
  local ____postNewRoomEarly = require("callbacks.subscriptions.postNewRoomEarly")
10
12
  local postNewRoomEarlyFire = ____postNewRoomEarly.postNewRoomEarlyFire
11
13
  local postNewRoomEarlyHasSubscriptions = ____postNewRoomEarly.postNewRoomEarlyHasSubscriptions
@@ -31,16 +33,31 @@ function checkRoomChanged(self)
31
33
  if topLeftWall == nil then
32
34
  topLeftWall = spawnGridEntity(nil, GridEntityType.GRID_WALL, topLeftWallGridIndex)
33
35
  if topLeftWall == nil then
36
+ log("Error: Failed to spawn a new wall (1) for the PostNewRoomEarly callback.")
34
37
  return
35
38
  end
39
+ log("Spawned a new wall (2) for the PostNewRoomEarly callback.")
40
+ end
41
+ local rightOfTopWallGridIndex = topLeftWallGridIndex + 1
42
+ local topLeftWall2 = room:GetGridEntity(rightOfTopWallGridIndex)
43
+ if topLeftWall2 == nil then
44
+ topLeftWall2 = spawnGridEntity(nil, GridEntityType.GRID_WALL, topLeftWallGridIndex)
45
+ if topLeftWall2 == nil then
46
+ log("Error: Failed to spawn a new wall (1) for the PostNewRoomEarly callback.")
47
+ return
48
+ end
49
+ log("Spawned a new wall (2) for the PostNewRoomEarly callback.")
36
50
  end
37
51
  local topLeftWallPtrHash = GetPtrHash(topLeftWall)
38
- if topLeftWallPtrHash ~= currentRoomTopLeftWallPtrHash then
52
+ local topLeftWallPtrHash2 = GetPtrHash(topLeftWall2)
53
+ if topLeftWallPtrHash ~= currentRoomTopLeftWallPtrHash or topLeftWallPtrHash2 ~= currentRoomTopLeftWallPtrHash2 then
39
54
  currentRoomTopLeftWallPtrHash = topLeftWallPtrHash
55
+ currentRoomTopLeftWallPtrHash2 = topLeftWallPtrHash2
40
56
  postNewRoomEarlyFire(nil)
41
57
  end
42
58
  end
43
59
  currentRoomTopLeftWallPtrHash = nil
60
+ currentRoomTopLeftWallPtrHash2 = nil
44
61
  function ____exports.postNewRoomEarlyCallbackInit(self, mod)
45
62
  mod:AddCallback(ModCallbacks.MC_POST_NEW_ROOM, postNewRoom)
46
63
  mod:AddCallback(ModCallbacks.MC_PRE_ENTITY_SPAWN, preEntitySpawn)
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Null is a class that represents the JavaScript/TypeScript type of "null".
3
+ *
4
+ * Do not instantiate this class directly and instead use the `Nul` singleton.
5
+ */
6
+ export declare class Null {
7
+ }
8
+ /**
9
+ * Nul is a singleton that represents an instantiated version of the `Null` class.
10
+ *
11
+ * In TSTL, `null` transpiles to `nil`. This is problematic because if you use it as an object or
12
+ * map value, the corresponding key will be deleted. You can work around this by using this `Nul`,
13
+ * which is an instantiated version of the `Null` custom class.
14
+ */
15
+ export declare const Nul: Null;
@@ -0,0 +1,12 @@
1
+ --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
+ local ____lualib = require("lualib_bundle")
3
+ local __TS__Class = ____lualib.__TS__Class
4
+ local __TS__New = ____lualib.__TS__New
5
+ local ____exports = {}
6
+ ____exports.Null = __TS__Class()
7
+ local Null = ____exports.Null
8
+ Null.name = "Null"
9
+ function Null.prototype.____constructor(self)
10
+ end
11
+ ____exports.Nul = __TS__New(____exports.Null)
12
+ return ____exports
@@ -12,6 +12,8 @@ local SaveDataKeys = ____SaveDataKeys.SaveDataKeys
12
12
  local ____deepCopy = require("functions.deepCopy")
13
13
  local deepCopy = ____deepCopy.deepCopy
14
14
  local SerializationType = ____deepCopy.SerializationType
15
+ local ____log = require("functions.log")
16
+ local log = ____log.log
15
17
  local ____table = require("functions.table")
16
18
  local clearTable = ____table.clearTable
17
19
  local ____constants = require("features.saveDataManager.constants")
@@ -62,6 +64,7 @@ function restoreDefaults(self, childTableName)
62
64
  if childTableName ~= SaveDataKeys.Run and childTableName ~= SaveDataKeys.Level and childTableName ~= SaveDataKeys.Room then
63
65
  error("Unknown child table name of: " .. childTableName)
64
66
  end
67
+ log("Resetting data for type: " .. childTableName)
65
68
  for subscriberName, saveData in pairs(saveDataMap) do
66
69
  do
67
70
  local childTable = saveData[childTableName]
package/dist/index.d.ts CHANGED
@@ -3,6 +3,7 @@ export { initCustomDoor, spawnCustomDoor, } from "./callbacks/postCustomDoorEnte
3
3
  export { forceNewLevelCallback, forceNewRoomCallback, } from "./callbacks/reorderedCallbacks";
4
4
  export * from "./classes/DefaultMap";
5
5
  export * from "./classes/ModUpgraded";
6
+ export * from "./classes/Null";
6
7
  export * from "./constants";
7
8
  export * from "./enums/CardType";
8
9
  export * from "./enums/CollectiblePedestalType";
package/dist/index.lua CHANGED
@@ -38,6 +38,14 @@ do
38
38
  end
39
39
  end
40
40
  end
41
+ do
42
+ local ____export = require("classes.Null")
43
+ for ____exportKey, ____exportValue in pairs(____export) do
44
+ if ____exportKey ~= "default" then
45
+ ____exports[____exportKey] = ____exportValue
46
+ end
47
+ end
48
+ end
41
49
  do
42
50
  local ____export = require("constants")
43
51
  for ____exportKey, ____exportValue in pairs(____export) do
File without changes
@@ -0,0 +1 @@
1
+ --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
@@ -1,11 +1,18 @@
1
+ declare type Primitive = boolean | number | string;
2
+ declare type Serializable = Primitive | unknown;
3
+ /**
4
+ * Each sub-object of save data has a string as a key, without arbitrary data as a value. However,
5
+ * the data has to be serializable (i.e. no `userdata` objects).
6
+ */
7
+ declare type SaveDataGroup = Record<string, Serializable>;
8
+ /**
9
+ * The object that contains all of the variables that will be managed by the save data manager.
10
+ * Depending on which property is used, the variables will be reset at certain times.
11
+ */
1
12
  export interface SaveData {
2
- persistent?: Record<string, unknown>;
3
- run?: Record<string, unknown>;
4
- level?: Record<string, unknown>;
5
- room?: Record<string, unknown>;
6
- }
7
- export interface SaveDataWithoutRoom {
8
- persistent?: Record<string, unknown>;
9
- run?: Record<string, unknown>;
10
- level?: Record<string, unknown>;
13
+ persistent?: SaveDataGroup;
14
+ run?: SaveDataGroup;
15
+ level?: SaveDataGroup;
16
+ room?: SaveDataGroup;
11
17
  }
18
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "1.2.168",
3
+ "version": "1.2.171",
4
4
  "description": "Helper functions for IsaacScript mods",
5
5
  "keywords": [
6
6
  "isaac",
@@ -25,7 +25,7 @@
25
25
  "dist/**/*.d.ts"
26
26
  ],
27
27
  "devDependencies": {
28
- "isaac-typescript-definitions": "^1.0.370",
28
+ "isaac-typescript-definitions": "^1.0.371",
29
29
  "isaacscript-lint": "^1.0.91",
30
30
  "isaacscript-tsconfig": "^1.1.8",
31
31
  "typedoc": "^0.22.13",