isaacscript-common 1.0.469 → 1.0.473

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.
@@ -21,6 +21,10 @@ export declare function deployJSONRoom(jsonRoom: JSONRoom, seed?: number): int;
21
21
  *
22
22
  * This function is meant to be used in the PostNewRoom callback.
23
23
  *
24
+ * Note that this function does not simply choose a random element in the provided array; it will
25
+ * properly account for each room weight using the algorithm from:
26
+ * https://stackoverflow.com/questions/1761626/weighted-random-numbers
27
+ *
24
28
  * @returns The iterated seed, which can be used in subsequent room deployments. (The seed is used
25
29
  * to spawn every entity contained within the custom room.)
26
30
  */
@@ -29,7 +33,7 @@ export declare function deployRandomJSONRoom(jsonRooms: JSONRoom[], seed?: numbe
29
33
  * Helper function to remove all naturally spawning entities and grid entities from a room. Notably,
30
34
  * this will not remove players (1), tears (2), familiars (3), lasers (7), knives (8),
31
35
  * projectiles (9), blacklisted NPCs such as Dark Esau, charmed NPCs, friendly NPCs, persistent
32
- * NPCs, doors, and walls.
36
+ * NPCs, most effects (1000), doors, and walls.
33
37
  *
34
38
  * @param fillWithDecorations Optional. Set to true to fill every grid tile with an invisible
35
39
  * decoration, which prevents vanilla entities in the room from respawning the next time that the
@@ -1,7 +1,7 @@
1
1
  --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
2
  require("lualib_bundle");
3
3
  local ____exports = {}
4
- local postNewRoom, setDecorationsInvisible, respawnPersistentEntities, removeSpecificNPCs, fillRoomWithDecorations, spawnAllEntities, spawnGridEntity, spawnNormalEntity, storePersistentEntity, fixPitGraphics, getPitMap, getPitFrame, FEATURE_NAME, NPCS_TO_NOT_REMOVE, PERSISTENT_ENTITY_TYPES, initialized, v
4
+ local postNewRoom, setDecorationsInvisible, respawnPersistentEntities, removeSpecificNPCs, fillRoomWithDecorations, spawnAllEntities, spawnGridEntity, spawnNormalEntity, storePersistentEntity, fixPitGraphics, getPitMap, getPitFrame, FEATURE_NAME, NPC_TYPES_TO_NOT_REMOVE, PERSISTENT_ENTITY_TYPES, initialized, v
5
5
  local ____errors = require("errors")
6
6
  local getUpgradeErrorMsg = ____errors.getUpgradeErrorMsg
7
7
  local ____entity = require("functions.entity")
@@ -75,6 +75,8 @@ function ____exports.emptyRoom(self, fillWithDecorations)
75
75
  removeAllPickups(nil)
76
76
  removeAllMatchingEntities(nil, EntityType.ENTITY_SLOT)
77
77
  removeSpecificNPCs(nil)
78
+ removeAllMatchingEntities(nil, EntityType.ENTITY_EFFECT, EffectVariant.DEVIL)
79
+ removeAllMatchingEntities(nil, EntityType.ENTITY_EFFECT, EffectVariant.ANGEL)
78
80
  removeAllGridEntitiesExceptFor(nil, GridEntityType.GRID_WALL, GridEntityType.GRID_DOOR)
79
81
  setRoomCleared(nil)
80
82
  if fillWithDecorations then
@@ -88,7 +90,7 @@ function removeSpecificNPCs(self)
88
90
  getNPCs(nil)
89
91
  ) do
90
92
  do
91
- if NPCS_TO_NOT_REMOVE:has(npc.Type) then
93
+ if NPC_TYPES_TO_NOT_REMOVE:has(npc.Type) then
92
94
  goto __continue20
93
95
  end
94
96
  if (npc:HasEntityFlags(EntityFlag.FLAG_CHARM) or npc:HasEntityFlags(EntityFlag.FLAG_FRIENDLY)) or npc:HasEntityFlags(EntityFlag.FLAG_PERSISTENT) then
@@ -348,7 +350,7 @@ function getPitFrame(self, L, R, U, D, UL, UR, DL, DR)
348
350
  return F
349
351
  end
350
352
  FEATURE_NAME = "JSON room deployer"
351
- NPCS_TO_NOT_REMOVE = __TS__New(Set, {EntityType.ENTITY_DARK_ESAU})
353
+ NPC_TYPES_TO_NOT_REMOVE = __TS__New(Set, {EntityType.ENTITY_DARK_ESAU})
352
354
  PERSISTENT_ENTITY_TYPES = __TS__New(Set, {EntityType.ENTITY_WALL_HUGGER})
353
355
  initialized = false
354
356
  v = {
@@ -1,5 +1,5 @@
1
1
  /// <reference types="isaac-typescript-definitions" />
2
2
  import { JSONRoom } from "../types/JSONRoom";
3
- export declare function getJSONRoomOfVariant(jsonRooms: JSONRoom[], variant: int): JSONRoom | null;
3
+ export declare function getJSONRoomOfVariant(jsonRooms: JSONRoom[], variant: int): JSONRoom | undefined;
4
4
  export declare function getJSONRoomsOfSubType(jsonRooms: JSONRoom[], subType: int): JSONRoom[];
5
5
  export declare function getRandomJSONRoom(jsonRooms: JSONRoom[], seed?: number): JSONRoom;
@@ -102,6 +102,7 @@ export declare function inCrawlspace(): boolean;
102
102
  * area.
103
103
  */
104
104
  export declare function inDeathCertificateArea(): boolean;
105
+ export declare function isDevilsCrownTreasureRoom(): boolean;
105
106
  export declare function inDimension(dimension: Dimension): boolean;
106
107
  /** Helper function to see if the current room shape is one of the four L room shapes. */
107
108
  export declare function inLRoom(): boolean;
@@ -11,6 +11,8 @@ local ____doors = require("functions.doors")
11
11
  local closeAllDoors = ____doors.closeAllDoors
12
12
  local getDoors = ____doors.getDoors
13
13
  local isHiddenSecretRoomDoor = ____doors.isHiddenSecretRoomDoor
14
+ local ____flag = require("functions.flag")
15
+ local hasFlag = ____flag.hasFlag
14
16
  function ____exports.getRoomIndex(self)
15
17
  local game = Game()
16
18
  local level = game:GetLevel()
@@ -164,6 +166,12 @@ function ____exports.inDeathCertificateArea(self)
164
166
  local roomSubType = ____exports.getRoomSubType(nil)
165
167
  return (roomStageID == 35) and ((roomSubType == 33) or (roomSubType == 33))
166
168
  end
169
+ function ____exports.isDevilsCrownTreasureRoom(self)
170
+ local game = Game()
171
+ local level = game:GetLevel()
172
+ local roomDesc = level:GetCurrentRoomDesc()
173
+ return hasFlag(nil, roomDesc.Flags, 2048)
174
+ end
167
175
  function ____exports.inDimension(self, dimension)
168
176
  return dimension == ____exports.getCurrentDimension(nil)
169
177
  end
@@ -202,14 +210,14 @@ function ____exports.setRoomCleared(self)
202
210
  ) do
203
211
  do
204
212
  if isHiddenSecretRoomDoor(nil, door) then
205
- goto __continue37
213
+ goto __continue38
206
214
  end
207
215
  door.State = DoorState.STATE_OPEN
208
216
  local sprite = door:GetSprite()
209
217
  sprite:Play("Opened", true)
210
218
  door.ExtraVisible = false
211
219
  end
212
- ::__continue37::
220
+ ::__continue38::
213
221
  end
214
222
  sfx:Stop(SoundEffect.SOUND_DOOR_HEAVY_OPEN)
215
223
  game:ShakeScreen(0)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "1.0.469",
3
+ "version": "1.0.473",
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.281",
28
+ "isaac-typescript-definitions": "^1.0.282",
29
29
  "isaacscript-lint": "^1.0.67",
30
30
  "typedoc": "^0.22.10",
31
31
  "typescript": "4.4.4",