isaacscript-common 1.2.233 → 1.2.236

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.
@@ -97,3 +97,15 @@ export declare function removeEntities(entities: Entity[], cap?: int): boolean;
97
97
  */
98
98
  export declare function rerollEnemy(entity: Entity): Entity | undefined;
99
99
  export declare function setEntityRandomColor(entity: Entity): void;
100
+ /**
101
+ * Helper function to spawn an entity. Use this instead of the `Isaac.Spawn` method if you do not
102
+ * need to specify the velocity or spawner.
103
+ *
104
+ * Also see the `spawnWithSeed` helper function.
105
+ */
106
+ export declare function spawn(entityType: EntityType | int, variant: int, subType: int, position: Vector, velocity?: Readonly<Vector>, spawner?: Entity | undefined, seed?: Seed | undefined): Entity;
107
+ /**
108
+ * Helper function to spawn an entity. Use this instead of the `Game.Spawn` method if you do not
109
+ * need to specify the velocity or spawner.
110
+ */
111
+ export declare function spawnWithSeed(entityType: EntityType | int, variant: int, subType: int, position: Vector, seed: Seed, velocity?: Readonly<Vector>, spawner?: Entity | undefined): Entity;
@@ -6,6 +6,8 @@ local __TS__ArrayPush = ____lualib.__TS__ArrayPush
6
6
  local ____exports = {}
7
7
  local ____cachedClasses = require("cachedClasses")
8
8
  local game = ____cachedClasses.game
9
+ local ____constants = require("constants")
10
+ local VectorZero = ____constants.VectorZero
9
11
  local ____storyBossesSet = require("sets.storyBossesSet")
10
12
  local STORY_BOSSES_SET = ____storyBossesSet.STORY_BOSSES_SET
11
13
  local ____random = require("functions.random")
@@ -155,4 +157,51 @@ function ____exports.setEntityRandomColor(self, entity)
155
157
  false
156
158
  )
157
159
  end
160
+ function ____exports.spawn(self, entityType, variant, subType, position, velocity, spawner, seed)
161
+ if velocity == nil then
162
+ velocity = VectorZero
163
+ end
164
+ if spawner == nil then
165
+ spawner = nil
166
+ end
167
+ if seed == nil then
168
+ seed = nil
169
+ end
170
+ if seed == nil then
171
+ return Isaac.Spawn(
172
+ entityType,
173
+ variant,
174
+ subType,
175
+ position,
176
+ velocity,
177
+ spawner
178
+ )
179
+ end
180
+ return game:Spawn(
181
+ entityType,
182
+ variant,
183
+ position,
184
+ velocity,
185
+ spawner,
186
+ subType,
187
+ seed
188
+ )
189
+ end
190
+ function ____exports.spawnWithSeed(self, entityType, variant, subType, position, seed, velocity, spawner)
191
+ if velocity == nil then
192
+ velocity = VectorZero
193
+ end
194
+ if spawner == nil then
195
+ spawner = nil
196
+ end
197
+ return game:Spawn(
198
+ entityType,
199
+ variant,
200
+ position,
201
+ velocity,
202
+ spawner,
203
+ subType,
204
+ seed
205
+ )
206
+ end
158
207
  return ____exports
@@ -27,8 +27,6 @@ export declare function isSerializedVector(object: unknown): object is Serialize
27
27
  /** Helper function to check if something is an instantiated Vector object. */
28
28
  export declare function isVector(object: unknown): object is Vector;
29
29
  export declare function vectorEquals(vector1: Vector, vector2: Vector): boolean;
30
- /** Helper function to get a new vector of length N. */
31
- export declare function vectorN(n: int): Vector;
32
30
  /** Helper function for finding out which way a vector is pointing. */
33
31
  export declare function vectorToDirection(vector: Vector): Direction;
34
32
  export declare function vectorToString(vector: Vector, round?: boolean): string;
@@ -89,9 +89,6 @@ end
89
89
  function ____exports.vectorEquals(self, vector1, vector2)
90
90
  return isaacAPIClassEquals(nil, vector1, vector2, KEYS)
91
91
  end
92
- function ____exports.vectorN(self, n)
93
- return Vector(n, n)
94
- end
95
92
  function ____exports.vectorToDirection(self, vector)
96
93
  local degrees = vector:GetAngleDegrees()
97
94
  if degrees > -45 and degrees < 45 then
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "1.2.233",
3
+ "version": "1.2.236",
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.386",
28
+ "isaac-typescript-definitions": "^1.0.387",
29
29
  "isaacscript-lint": "^1.0.95",
30
30
  "isaacscript-tsconfig": "^1.1.8",
31
31
  "typedoc": "^0.22.13",