isaacscript-common 1.0.504 → 1.0.508

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
@@ -44,6 +44,15 @@ export declare function isDoorToMines(door: GridEntityDoor): boolean;
44
44
  export declare function isDoorToMomsHeart(door: GridEntityDoor): boolean;
45
45
  export declare function isRepentanceDoor(door: GridEntityDoor): boolean;
46
46
  export declare function isSecretRoomDoor(door: GridEntityDoor): boolean;
47
+ /**
48
+ * Helper function to reset an unlocked door back to a locked state. Doing this is non-trivial
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.
54
+ */
55
+ export declare function lockDoor(door: GridEntityDoor): void;
47
56
  /**
48
57
  * For the purposes of this function, doors to Secret Rooms or Super Secret Rooms that have not been
49
58
  * discovered yet will not be opened.
@@ -125,6 +125,15 @@ function ____exports.isDoorToMomsHeart(self, door)
125
125
  local filename = sprite:GetFilename()
126
126
  return filename == "gfx/grid/Door_MomsHeart.anm2"
127
127
  end
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
133
+ door:SetVariant(DoorVariant.DOOR_LOCKED)
134
+ door:SetLocked(true)
135
+ door:Close(true)
136
+ end
128
137
  function ____exports.openAllDoors(self)
129
138
  for ____, door in ipairs(____exports.getDoors(nil)) do
130
139
  door:Open()
@@ -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.504",
3
+ "version": "1.0.508",
4
4
  "description": "Helper functions for IsaacScript mods",
5
5
  "keywords": [
6
6
  "isaac",
@@ -26,7 +26,7 @@
26
26
  ],
27
27
  "devDependencies": {
28
28
  "isaac-typescript-definitions": "^1.0.292",
29
- "isaacscript-lint": "^1.0.68",
29
+ "isaacscript-lint": "^1.0.69",
30
30
  "typedoc": "^0.22.10",
31
31
  "typescript": "4.5.2",
32
32
  "typescript-to-lua": "^1.2.0"