isaacscript-common 1.0.505 → 1.0.509

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.
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Helper function to print a stack trace to the "log.txt" file, similar to JavaScript's
3
+ * `console.trace()` function. This will only work if the `--luadebug` launch option is enabled.
4
+ */
5
+ export declare function traceback(): void;
@@ -0,0 +1,15 @@
1
+ --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
+ local ____exports = {}
3
+ function ____exports.traceback(self)
4
+ if debug ~= nil then
5
+ local tracebackMsg = debug.traceback()
6
+ Isaac.DebugString(tracebackMsg)
7
+ return
8
+ end
9
+ if sandboxTraceback ~= nil then
10
+ sandboxTraceback()
11
+ return
12
+ end
13
+ Isaac.DebugString("Error: Cannot perform a traceback since --luadebug is not enabled.")
14
+ end
15
+ return ____exports
@@ -46,8 +46,11 @@ export declare function isRepentanceDoor(door: GridEntityDoor): boolean;
46
46
  export declare function isSecretRoomDoor(door: GridEntityDoor): boolean;
47
47
  /**
48
48
  * Helper function to reset an unlocked door back to a locked state. Doing this is non-trivial
49
- * because you must also set the variant and close the door in addition to calling the `SetLocked()`
50
- * method.
49
+ * because in addition to calling the `SetLocked()` method, you must also:
50
+ *
51
+ * - Modify the `VisitedCount` of the room's `RoomDescription` to be set to 0.
52
+ * - Set the variant to `DoorVariant.DOOR_LOCKED`.
53
+ * - Close the door.
51
54
  */
52
55
  export declare function lockDoor(door: GridEntityDoor): void;
53
56
  /**
@@ -126,6 +126,10 @@ function ____exports.isDoorToMomsHeart(self, door)
126
126
  return filename == "gfx/grid/Door_MomsHeart.anm2"
127
127
  end
128
128
  function ____exports.lockDoor(self, door)
129
+ local game = Game()
130
+ local level = game:GetLevel()
131
+ local roomDesc = level:GetRoomByIdx(door.TargetRoomIndex)
132
+ roomDesc.VisitedCount = 0
129
133
  door:SetVariant(DoorVariant.DOOR_LOCKED)
130
134
  door:SetLocked(true)
131
135
  door:Close(true)
@@ -41,8 +41,3 @@ export declare function logVector(this: void, vector: Vector): void;
41
41
  * This is useful for printing out variables from the in-game debug console.
42
42
  */
43
43
  export declare function setLogFunctionsGlobal(): void;
44
- /**
45
- * Helper function to print a stack trace to the "log.txt" file, similar to JavaScript's
46
- * `console.trace()` function. This will only work if the `--luadebug` launch option is enabled.
47
- */
48
- export declare function traceback(): void;
@@ -126,16 +126,4 @@ function ____exports.setLogFunctionsGlobal(self)
126
126
  globals.logSet = ____exports.logSet
127
127
  globals.logVector = ____exports.logVector
128
128
  end
129
- function ____exports.traceback(self)
130
- if debug ~= nil then
131
- local tracebackMsg = debug.traceback()
132
- Isaac.DebugString(tracebackMsg)
133
- return
134
- end
135
- if sandboxTraceback ~= nil then
136
- sandboxTraceback()
137
- return
138
- end
139
- Isaac.DebugString("Error: Cannot perform a traceback since --luadebug is not enabled.")
140
- end
141
129
  return ____exports
@@ -1,11 +1,14 @@
1
1
  --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
2
  local ____exports = {}
3
3
  local RECOMMENDED_SHIFT_IDX
4
+ local ____debug = require("functions.debug")
5
+ local traceback = ____debug.traceback
4
6
  function ____exports.initRNG(self, seed)
5
7
  if seed == nil then
6
8
  seed = Random()
7
9
  end
8
10
  if seed == 0 then
11
+ traceback(nil)
9
12
  error("You cannot initialize an RNG object with a seed of 0, or the game will crash.")
10
13
  end
11
14
  local rng = RNG()
package/dist/index.d.ts CHANGED
@@ -15,6 +15,7 @@ export * from "./functions/charge";
15
15
  export * from "./functions/collectibles";
16
16
  export * from "./functions/collectibleSet";
17
17
  export * from "./functions/color";
18
+ export * from "./functions/debug";
18
19
  export { deepCopy } from "./functions/deepCopy";
19
20
  export { deepCopyTests } from "./functions/deepCopyTests";
20
21
  export * from "./functions/doors";
package/dist/index.lua CHANGED
@@ -132,6 +132,14 @@ do
132
132
  end
133
133
  end
134
134
  end
135
+ do
136
+ local ____export = require("functions.debug")
137
+ for ____exportKey, ____exportValue in pairs(____export) do
138
+ if ____exportKey ~= "default" then
139
+ ____exports[____exportKey] = ____exportValue
140
+ end
141
+ end
142
+ end
135
143
  do
136
144
  local ____deepCopy = require("functions.deepCopy")
137
145
  local deepCopy = ____deepCopy.deepCopy
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "1.0.505",
3
+ "version": "1.0.509",
4
4
  "description": "Helper functions for IsaacScript mods",
5
5
  "keywords": [
6
6
  "isaac",
@@ -25,10 +25,10 @@
25
25
  "dist/**/*.d.ts"
26
26
  ],
27
27
  "devDependencies": {
28
- "isaac-typescript-definitions": "^1.0.292",
29
- "isaacscript-lint": "^1.0.68",
28
+ "isaac-typescript-definitions": "^1.0.293",
29
+ "isaacscript-lint": "^1.0.71",
30
30
  "typedoc": "^0.22.10",
31
- "typescript": "4.5.2",
31
+ "typescript": "4.4.4",
32
32
  "typescript-to-lua": "^1.2.0"
33
33
  }
34
34
  }