isaacscript-common 1.2.86 → 1.2.87

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.
@@ -45,7 +45,7 @@ function checkPickupsPurchased(self, pickups, players)
45
45
  nil,
46
46
  player,
47
47
  pickupDescription.variant,
48
- pickupDescription.subtype,
48
+ pickupDescription.subType,
49
49
  pickupDescription.price
50
50
  )
51
51
  end
@@ -70,7 +70,7 @@ function storePickupsInMap(self, pickups)
70
70
  function(____, pickup) return pickup.Price ~= 0 end
71
71
  )
72
72
  for ____, pickup in ipairs(pickupsWithPrice) do
73
- v.room.pickupMap:set(pickup.Index, {variant = pickup.Variant, subtype = pickup.SubType, price = pickup.Price})
73
+ v.room.pickupMap:set(pickup.Index, {variant = pickup.Variant, subType = pickup.SubType, price = pickup.Price})
74
74
  end
75
75
  end
76
76
  function storePlayersInMap(self, players)
@@ -4,8 +4,8 @@
4
4
  * beginning of every run.
5
5
  *
6
6
  * @param familiarVariant The familiar variant to blacklist.
7
- * @param familiarSubType The subtype to blacklist. Optional. The default is to blacklist all
8
- * subtypes of the given variant.
7
+ * @param familiarSubType The sub-type to blacklist. Optional. The default is to blacklist all
8
+ * sub-types of the given variant.
9
9
  */
10
10
  export declare function setFamiliarNoSirenSteal(familiarVariant: FamiliarVariant | int, familiarSubType?: int): void;
11
11
  /**
@@ -0,0 +1,3 @@
1
+ /// <reference types="isaac-typescript-definitions" />
2
+ export declare function testInit(mod: Mod): void;
3
+ export declare function test(): void;
@@ -0,0 +1,24 @@
1
+ --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
+ local ____lualib = require("lualib_bundle")
3
+ local Set = ____lualib.Set
4
+ local __TS__New = ____lualib.__TS__New
5
+ local ____exports = {}
6
+ local postPEffectUpdate
7
+ local ____errors = require("errors")
8
+ local getUpgradeErrorMsg = ____errors.getUpgradeErrorMsg
9
+ function postPEffectUpdate(self, _player)
10
+ end
11
+ local FEATURE_NAME = "test"
12
+ local initialized = false
13
+ local v = {run = {playersIsPonyActive = __TS__New(Set)}}
14
+ function ____exports.testInit(self, mod)
15
+ initialized = true
16
+ mod:AddCallback(ModCallbacks.MC_POST_PEFFECT_UPDATE, postPEffectUpdate)
17
+ end
18
+ function ____exports.test(self)
19
+ if not initialized then
20
+ local msg = getUpgradeErrorMsg(nil, FEATURE_NAME)
21
+ error(msg)
22
+ end
23
+ end
24
+ return ____exports
@@ -43,13 +43,11 @@ function ____exports.logAllFlags(flags, flagEnum, description)
43
43
  end
44
44
  ____exports.log(("Logging all " .. description) .. "flags:")
45
45
  local hasNoFlags = true
46
- local i = 1
47
46
  for key, value in pairs(flagEnum) do
48
47
  if hasFlag(nil, flags, value) then
49
- ____exports.log((((((" " .. tostring(i)) .. ") Has flag: ") .. tostring(key)) .. " (") .. tostring(value)) .. ")")
48
+ ____exports.log((((" Has flag: " .. tostring(key)) .. " (") .. tostring(value)) .. ")")
50
49
  hasNoFlags = false
51
50
  end
52
- i = i + 1
53
51
  end
54
52
  if hasNoFlags then
55
53
  ____exports.log(" n/a (no flags)")
@@ -65,15 +63,13 @@ function ____exports.logAllGameStateFlags()
65
63
  local game = Game()
66
64
  ____exports.log("Logging all game state flags:")
67
65
  local hasNoFlags = true
68
- local i = 1
69
66
  for key, value in pairs(GameStateFlag) do
70
67
  local gameStateFlag = value
71
68
  local flagValue = game:GetStateFlag(gameStateFlag)
72
69
  if flagValue then
73
- ____exports.log((((((" " .. tostring(i)) .. ") Has flag: ") .. key) .. " (") .. tostring(value)) .. ")")
70
+ ____exports.log((((" Has flag: " .. key) .. " (") .. tostring(value)) .. ")")
74
71
  hasNoFlags = false
75
72
  end
76
- i = i + 1
77
73
  end
78
74
  if hasNoFlags then
79
75
  ____exports.log(" n/a (no flags)")
@@ -87,14 +83,12 @@ function ____exports.logAllSeedEffects()
87
83
  local seeds = game:GetSeeds()
88
84
  ____exports.log("Logging all seed effects:")
89
85
  local hasNoSeedEffects = true
90
- local i = 1
91
86
  for key, value in pairs(SeedEffect) do
92
87
  local seedEffect = value
93
88
  if seeds:HasSeedEffect(seedEffect) then
94
- ____exports.log((((((" " .. tostring(i)) .. ") ") .. key) .. " (") .. tostring(value)) .. ")")
89
+ ____exports.log((((" " .. key) .. " (") .. tostring(value)) .. ")")
95
90
  hasNoSeedEffects = false
96
91
  end
97
- i = i + 1
98
92
  end
99
93
  if hasNoSeedEffects then
100
94
  ____exports.log(" n/a (no seed effects)")
@@ -1,18 +1,6 @@
1
1
  /// <reference types="isaac-typescript-definitions" />
2
2
  import { HealthType } from "../types/HealthType";
3
- /**
4
- * PlayerIndex is a specific type of string; see the documentation for the [[`getPlayerIndex`]]
5
- * function. Mods can signify that data structures handle EntityPlayers by using this type:
6
- *
7
- * ```
8
- * const myPlayerMap = new Map<PlayerIndex, string>();
9
- * ```
10
- *
11
- * This type is branded for extra type safety.
12
- */
13
- export declare type PlayerIndex = int & {
14
- __playerIndexBrand: unknown;
15
- };
3
+ import { PlayerIndex } from "../types/PlayerIndex";
16
4
  export declare function addCollectibleCostume(player: EntityPlayer, collectibleType: CollectibleType | int): void;
17
5
  export declare function addTrinketCostume(player: EntityPlayer, trinketType: TrinketType | int): void;
18
6
  /** Iterates over all players and checks if any player is close enough to the specified position. */
@@ -23,15 +23,11 @@ export declare function getCurrentRoomDescriptorReadOnly(): RoomDescriptorReadOn
23
23
  */
24
24
  export declare function getRoomData(roomGridIndex?: int): RoomConfig | undefined;
25
25
  /**
26
- * Helper function to get the type of a room from the XML/STB data. The room data type will
27
- * correspond to different things depending on what XML/STB file it draws from. For example, in the
28
- * "00.special rooms.stb" file, a room type of 2 corresponds to a shop, a room type of 3 corresponds
29
- * to an I AM ERROR room, and so on.
26
+ * Helper function for getting the type of the room with the given grid index.
30
27
  *
31
- * @param roomGridIndex Optional. Equal to the current room index by default.
32
28
  * @returns The room data type. Returns -1 if the type was not found.
33
29
  */
34
- export declare function getRoomDataType(roomGridIndex?: int): int;
30
+ export declare function getRoomType(roomGridIndex: int): RoomType;
35
31
  /**
36
32
  * Helper function to get the descriptor for a room.
37
33
  *
@@ -97,13 +93,13 @@ export declare function getRoomSafeGridIndex(roomGridIndex?: int): int;
97
93
  */
98
94
  export declare function getRoomStageID(roomGridIndex?: int): StageID;
99
95
  /**
100
- * Helper function to get the subtype for a room from the XML/STB data. The room subtype will
96
+ * Helper function to get the sub-type for a room from the XML/STB data. The room sub-type will
101
97
  * correspond to different things depending on what XML/STB file it draws from. For example, in the
102
- * "00.special rooms.stb" file, an Angel Room with a subtype of 0 will correspond to a normal Angel
103
- * Room and a subtype of 1 will correspond to an Angel Room shop for The Stairway.
98
+ * "00.special rooms.stb" file, an Angel Room with a sub-type of 0 will correspond to a normal Angel
99
+ * Room and a sub-type of 1 will correspond to an Angel Room shop for The Stairway.
104
100
  *
105
101
  * @param roomGridIndex Optional. Equal to the current room index by default.
106
- * @returns The room subtype. Returns -1 if the subtype was not found.
102
+ * @returns The room sub-type. Returns -1 if the sub-type was not found.
107
103
  */
108
104
  export declare function getRoomSubType(roomGridIndex?: int): int;
109
105
  /**
@@ -129,7 +129,7 @@ function ____exports.getCurrentDimension(self)
129
129
  end
130
130
  return error("Failed to get the current dimension using the starting room index of: " .. tostring(startingRoomGridIndex))
131
131
  end
132
- function ____exports.getRoomDataType(self, roomGridIndex)
132
+ function ____exports.getRoomType(self, roomGridIndex)
133
133
  local roomData = ____exports.getRoomData(nil, roomGridIndex)
134
134
  return roomData == nil and -1 or roomData.Type
135
135
  end
package/dist/index.d.ts CHANGED
@@ -92,6 +92,7 @@ export * from "./types/PickingUpItem";
92
92
  export * from "./types/PillEffectClass";
93
93
  export * from "./types/PillEffectType";
94
94
  export * from "./types/PlayerHealth";
95
+ export * from "./types/PlayerIndex";
95
96
  export * from "./types/PocketItemDescription";
96
97
  export * from "./types/PocketItemType";
97
98
  export * from "./types/TrinketSituation";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "1.2.86",
3
+ "version": "1.2.87",
4
4
  "description": "Helper functions for IsaacScript mods",
5
5
  "keywords": [
6
6
  "isaac",