isaacscript-common 1.0.336 → 1.0.340

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,3 @@
1
+ /// <reference types="isaac-typescript-definitions" />
2
+ export declare function getKBitOfN(k: int, n: int): int;
3
+ export declare function getNumBitsOfN(n: int): int;
@@ -0,0 +1,14 @@
1
+ --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
+ local ____exports = {}
3
+ function ____exports.getKBitOfN(self, k, n)
4
+ return (n >> k) & 1
5
+ end
6
+ function ____exports.getNumBitsOfN(self, n)
7
+ local numBits = 0
8
+ while n > 0 do
9
+ numBits = numBits + 1
10
+ n = n >> 1
11
+ end
12
+ return numBits
13
+ end
14
+ return ____exports
@@ -163,3 +163,5 @@ export declare function isJacobOrEsau(player: EntityPlayer): boolean;
163
163
  export declare function isKeeper(player: EntityPlayer): boolean;
164
164
  export declare function isLost(player: EntityPlayer): boolean;
165
165
  export declare function removeDeadEyeMultiplier(player: EntityPlayer): void;
166
+ /** This function was originally created by im_tem. */
167
+ export declare function setBlindfold(player: EntityPlayer, enabled: boolean): void;
@@ -337,4 +337,19 @@ function ____exports.removeDeadEyeMultiplier(self, player)
337
337
  end
338
338
  end
339
339
  end
340
+ function ____exports.setBlindfold(self, player, enabled)
341
+ local game = Game()
342
+ local character = player:GetPlayerType()
343
+ local challenge = Isaac.GetChallenge()
344
+ if enabled then
345
+ game.Challenge = Challenge.CHALLENGE_SOLAR_SYSTEM
346
+ player:ChangePlayerType(character)
347
+ game.Challenge = challenge
348
+ else
349
+ game.Challenge = Challenge.CHALLENGE_NULL
350
+ player:ChangePlayerType(character)
351
+ game.Challenge = challenge
352
+ player:TryRemoveNullCostume(NullItemID.ID_BLINDFOLD)
353
+ end
354
+ end
340
355
  return ____exports
@@ -36,6 +36,12 @@ export declare function getRoomIndex(): int;
36
36
  * This function only searches through rooms in the current dimension.
37
37
  */
38
38
  export declare function getRoomIndexesForType(roomType: RoomType): Set<int>;
39
+ /**
40
+ * Helper function to get the name of the room as it appears in the STB/XML data.
41
+ *
42
+ * @returns The room name. Returns "Unknown" if the type was not found.
43
+ */
44
+ export declare function getRoomName(): string;
39
45
  /**
40
46
  * Helper function to get the stage ID for the room from the XML/STB data. The room stage ID will
41
47
  * correspond to the first number in the filename of the XML/STB file. For example, a Depths room
@@ -75,6 +75,13 @@ function ____exports.getRoomIndexesForType(self, roomType)
75
75
  end
76
76
  return roomIndexes
77
77
  end
78
+ function ____exports.getRoomName(self)
79
+ local roomData = ____exports.getRoomData(nil)
80
+ if roomData == nil then
81
+ return "Unknown"
82
+ end
83
+ return roomData.Name
84
+ end
78
85
  function ____exports.getRoomStageID(self)
79
86
  local roomData = ____exports.getRoomData(nil)
80
87
  if roomData == nil then
package/dist/index.d.ts CHANGED
@@ -5,6 +5,7 @@ export { forgottenSwitch } from "./features/forgottenSwitch";
5
5
  export { runInNFrames, runNextFrame } from "./features/runInNFrames";
6
6
  export { saveDataManager, saveDataManagerSave, saveDataManagerSetGlobal, } from "./features/saveDataManager/main";
7
7
  export * from "./functions/array";
8
+ export * from "./functions/bitwise";
8
9
  export * from "./functions/collectibles";
9
10
  export { deepCopy } from "./functions/deepCopy";
10
11
  export { deepCopyTests } from "./functions/deepCopyTests";
package/dist/index.lua CHANGED
@@ -88,6 +88,14 @@ do
88
88
  end
89
89
  end
90
90
  end
91
+ do
92
+ local ____export = require("functions.bitwise")
93
+ for ____exportKey, ____exportValue in pairs(____export) do
94
+ if ____exportKey ~= "default" then
95
+ ____exports[____exportKey] = ____exportValue
96
+ end
97
+ end
98
+ end
91
99
  do
92
100
  local ____export = require("functions.collectibles")
93
101
  for ____exportKey, ____exportValue in pairs(____export) do
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "1.0.336",
3
+ "version": "1.0.340",
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.201",
28
+ "isaac-typescript-definitions": "^1.0.208",
29
29
  "isaacscript-lint": "^1.0.61",
30
30
  "typedoc": "^0.22.5",
31
31
  "typescript": "4.4.3",