isaacscript-common 1.2.90 → 1.2.93

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.
@@ -10,18 +10,18 @@ export declare function getDebugPrependString(msg: string, numParentFunctions?:
10
10
  * and the line number before the string.
11
11
  */
12
12
  export declare function log(this: void, msg: string): void;
13
- /** Helper function for printing out every damage flag that is turned on. Helpful when debugging. */
13
+ /** Helper function for printing out every damage flag that is turned on. Useful when debugging. */
14
14
  export declare function logAllDamageFlags(this: void, flags: int): void;
15
- /** Helper function for printing out every entity flag that is turned on. Helpful when debugging. */
15
+ /** Helper function for printing out every entity flag that is turned on. Useful when debugging. */
16
16
  export declare function logAllEntityFlags(this: void, flags: int): void;
17
- /** Helper function for printing out every flag that is turned on. Helpful when debugging. */
17
+ /** Helper function for printing out every flag that is turned on. Useful when debugging. */
18
18
  export declare function logAllFlags(this: void, flags: int, flagEnum: LuaTable, description?: string): void;
19
19
  /**
20
- * Helper function for printing out every game state flag that is turned on. Helpful when debugging.
20
+ * Helper function for printing out every game state flag that is turned on. Useful when debugging.
21
21
  */
22
22
  export declare function logAllGameStateFlags(this: void): void;
23
23
  /**
24
- * Helper function for printing out every projectile flag that is turned on. Helpful when debugging.
24
+ * Helper function for printing out every projectile flag that is turned on. Useful when debugging.
25
25
  */
26
26
  export declare function logAllProjectileFlags(this: void, flags: int): void;
27
27
  /**
@@ -29,15 +29,16 @@ export declare function logAllProjectileFlags(this: void, flags: int): void;
29
29
  * particular run.
30
30
  */
31
31
  export declare function logAllSeedEffects(this: void): void;
32
- /** Helper function for printing out every use flag that is turned on. Helpful when debugging. */
32
+ /** Helper function for printing out every tear flag that is turned on. Useful when debugging. */
33
33
  export declare function logAllTearFlags(this: void, flags: int): void;
34
- /** Helper function for printing out every use flag that is turned on. Helpful when debugging. */
34
+ /** Helper function for printing out every use flag that is turned on. Useful when debugging. */
35
35
  export declare function logAllUseFlags(this: void, flags: int): void;
36
36
  export declare function logArray<T>(this: void, array: T[]): void;
37
37
  export declare function logColor(this: void, color: Color): void;
38
38
  export declare function logEntity(this: void, entity: Entity): void;
39
39
  export declare function logKColor(this: void, kColor: KColor): void;
40
40
  export declare function logMap(this: void, map: Map<AnyNotNil, unknown>): void;
41
+ /** Helper function for printing out information about the current room. */
41
42
  export declare function logTable(this: void, table: unknown, parentTables?: number): void;
42
43
  export declare function logTemporaryEffects(this: void, player: EntityPlayer): void;
43
44
  export declare function logSet(this: void, set: Set<AnyNotNil>): void;
@@ -1,7 +1,8 @@
1
1
  --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
2
  local ____lualib = require("lualib_bundle")
3
3
  local Map = ____lualib.Map
4
- local __TS__Iterator = ____lualib.__TS__Iterator
4
+ local __TS__Spread = ____lualib.__TS__Spread
5
+ local __TS__ArraySort = ____lualib.__TS__ArraySort
5
6
  local __TS__ArrayForEach = ____lualib.__TS__ArrayForEach
6
7
  local Set = ____lualib.Set
7
8
  local ____exports = {}
@@ -115,9 +116,10 @@ function ____exports.logKColor(kColor)
115
116
  end
116
117
  function ____exports.logMap(map)
117
118
  ____exports.log("Printing out a TSTL Map:")
118
- for ____, ____value in __TS__Iterator(map:entries()) do
119
- local key = ____value[1]
120
- local value = ____value[2]
119
+ local mapKeys = {__TS__Spread(map:keys())}
120
+ __TS__ArraySort(mapKeys)
121
+ for ____, key in ipairs(mapKeys) do
122
+ local value = map:get(key)
121
123
  ____exports.log(((" Key: " .. tostring(key)) .. ", Value: ") .. tostring(value))
122
124
  end
123
125
  ____exports.log("The size of the map was: " .. tostring(map.size))
@@ -134,13 +136,16 @@ function ____exports.logTable(____table, parentTables)
134
136
  " ",
135
137
  math.floor(numSpaces)
136
138
  )
139
+ local numKeys = 0
137
140
  for key, value in pairs(____table) do
138
141
  ____exports.log((((indentation .. "Key: ") .. tostring(key)) .. ", Value: ") .. tostring(value))
139
142
  local valueType = type(value)
140
143
  if valueType == "table" then
141
144
  ____exports.logTable(value, parentTables + 1)
142
145
  end
146
+ numKeys = numKeys + 1
143
147
  end
148
+ ____exports.log("The size of the table was: " .. tostring(numKeys))
144
149
  end
145
150
  function ____exports.logTemporaryEffects(player)
146
151
  local effects = getEffectsList(nil, player)
@@ -168,7 +173,9 @@ function ____exports.logTemporaryEffects(player)
168
173
  end
169
174
  function ____exports.logSet(set)
170
175
  ____exports.log("Printing out a TSTL Set:")
171
- for ____, value in __TS__Iterator(set:values()) do
176
+ local setValues = {__TS__Spread(set:values())}
177
+ __TS__ArraySort(setValues)
178
+ for ____, value in ipairs(setValues) do
172
179
  ____exports.log(" Value: " .. tostring(value))
173
180
  end
174
181
  ____exports.log("The size of the set was: " .. tostring(set.size))
@@ -13,6 +13,7 @@ export declare function getAngleDifference(angle1: float, angle2: float): float;
13
13
  * this can be optionally changed by specifying this argument.
14
14
  */
15
15
  export declare function getCircleDiscretizedPoints(centerPos: Vector, radius: float, numPoints: int, xMultiplier?: number, yMultiplier?: number, initialDirection?: Direction): Vector[];
16
+ export declare function getSetBits(n: int): int;
16
17
  /**
17
18
  * Helper function to check if a given position is within a given rectangle. This is an inclusive
18
19
  * check, meaning that it will return true if the position is on the border of the rectangle.
@@ -74,6 +74,14 @@ function ____exports.getCircleDiscretizedPoints(self, centerPos, radius, numPoin
74
74
  end
75
75
  return positions
76
76
  end
77
+ function ____exports.getSetBits(self, n)
78
+ local count = 0
79
+ while n > 0 do
80
+ n = n & n - 1
81
+ count = count + 1
82
+ end
83
+ return count
84
+ end
77
85
  function ____exports.inRectangle(self, position, topLeft, bottomRight)
78
86
  return position.X >= topLeft.X and position.X <= bottomRight.X and position.Y <= topLeft.Y and position.Y >= bottomRight.Y
79
87
  end
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "1.2.90",
3
+ "version": "1.2.93",
4
4
  "description": "Helper functions for IsaacScript mods",
5
5
  "keywords": [
6
6
  "isaac",
@@ -27,9 +27,9 @@
27
27
  "devDependencies": {
28
28
  "@zamiell/typescript-to-lua": "^1.4.0",
29
29
  "isaac-typescript-definitions": "^1.0.355",
30
- "isaacscript-lint": "^1.0.81",
30
+ "isaacscript-lint": "^1.0.83",
31
31
  "isaacscript-tsconfig": "^1.1.8",
32
32
  "typedoc": "^0.22.12",
33
- "typescript": "^4.5.5"
33
+ "typescript": "4.5.5"
34
34
  }
35
35
  }