isaacscript-common 1.0.448 → 1.0.452
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.
- package/dist/constants.d.ts +1 -1
- package/dist/constants.lua +1 -1
- package/dist/functions/collectibles.d.ts +5 -0
- package/dist/functions/collectibles.lua +4 -0
- package/dist/functions/position.d.ts +9 -0
- package/dist/functions/position.lua +35 -0
- package/dist/functions/util.d.ts +6 -0
- package/dist/functions/util.lua +3 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.lua +8 -0
- package/package.json +2 -2
package/dist/constants.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
export declare const AZAZEL_DEFAULT_BRIMSTONE_DISTANCE = 75.125;
|
|
7
7
|
/** Bombs explode when their frame count is equal to this value. */
|
|
8
|
-
export declare const BOMB_EXPLODE_FRAME =
|
|
8
|
+
export declare const BOMB_EXPLODE_FRAME = 45;
|
|
9
9
|
export declare const CHARACTERS_WITH_NO_RED_HEARTS: Set<PlayerType>;
|
|
10
10
|
/** This is also the distance that a player spawns from the door that they enter a room from. */
|
|
11
11
|
export declare const DISTANCE_OF_GRID_TILE = 40;
|
package/dist/constants.lua
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
require("lualib_bundle");
|
|
3
3
|
local ____exports = {}
|
|
4
4
|
____exports.AZAZEL_DEFAULT_BRIMSTONE_DISTANCE = 75.125
|
|
5
|
-
____exports.BOMB_EXPLODE_FRAME =
|
|
5
|
+
____exports.BOMB_EXPLODE_FRAME = 45
|
|
6
6
|
____exports.CHARACTERS_WITH_NO_RED_HEARTS = __TS__New(Set, {PlayerType.PLAYER_BLUEBABY, PlayerType.PLAYER_BLACKJUDAS, PlayerType.PLAYER_JUDAS_B, PlayerType.PLAYER_BLUEBABY_B, PlayerType.PLAYER_THEFORGOTTEN_B, PlayerType.PLAYER_BETHANY_B})
|
|
7
7
|
____exports.DISTANCE_OF_GRID_TILE = 40
|
|
8
8
|
____exports.DOOR_HITBOX_DISTANCE = 11
|
|
@@ -32,6 +32,11 @@ export declare function getMaxCollectibleID(): int;
|
|
|
32
32
|
* in secret rooms and I AM ERROR rooms if the "Corrupted Data" achievement is unlocked.
|
|
33
33
|
*/
|
|
34
34
|
export declare function isGlitchedCollectible(entity: Entity): boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Returns true if the item type in the item config is equal to `ItemType.ITEM_PASSIVE` or
|
|
37
|
+
* `ItemType.ITEM_FAMILIAR`.
|
|
38
|
+
*/
|
|
39
|
+
export declare function isPassiveCollectible(collectibleType: CollectibleType | int): true | ItemType.ITEM_FAMILIAR;
|
|
35
40
|
export declare function isQuestCollectible(collectibleType: CollectibleType | int): boolean;
|
|
36
41
|
export declare function removeAllCollectibles(): void;
|
|
37
42
|
/**
|
|
@@ -116,6 +116,10 @@ end
|
|
|
116
116
|
function ____exports.isGlitchedCollectible(self, entity)
|
|
117
117
|
return ((entity.Type == EntityType.ENTITY_PICKUP) and (entity.Variant == PickupVariant.PICKUP_COLLECTIBLE)) and (entity.SubType > GLITCHED_ITEM_THRESHOLD)
|
|
118
118
|
end
|
|
119
|
+
function ____exports.isPassiveCollectible(self, collectibleType)
|
|
120
|
+
local itemType = ____exports.getCollectibleItemType(nil, collectibleType)
|
|
121
|
+
return (itemType == ItemType.ITEM_PASSIVE) or ItemType.ITEM_FAMILIAR
|
|
122
|
+
end
|
|
119
123
|
function ____exports.isQuestCollectible(self, collectibleType)
|
|
120
124
|
return ____exports.collectibleHasTag(nil, collectibleType, 32768)
|
|
121
125
|
end
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="isaac-typescript-definitions" />
|
|
2
|
+
/**
|
|
3
|
+
* Helper function to get a room position that is not overlapping with a grid entity, a heaven door,
|
|
4
|
+
* or a player. The `Room.FindFreePickupSpawnPosition()` function will return locations that overlap
|
|
5
|
+
* with heaven doors and partially overlap with players, if the thing being spawned is bigger than a
|
|
6
|
+
* tile (like a Blood Donation Machine). Use this function instead if you want to account for those
|
|
7
|
+
* specific situations.
|
|
8
|
+
*/
|
|
9
|
+
export declare function findFreePosition(startingPosition: Vector): Vector;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
|
+
local ____exports = {}
|
|
3
|
+
local ____constants = require("constants")
|
|
4
|
+
local DISTANCE_OF_GRID_TILE = ____constants.DISTANCE_OF_GRID_TILE
|
|
5
|
+
local ____entity = require("functions.entity")
|
|
6
|
+
local anyEntityCloserThan = ____entity.anyEntityCloserThan
|
|
7
|
+
local getEffects = ____entity.getEffects
|
|
8
|
+
local ____player = require("functions.player")
|
|
9
|
+
local getPlayerCloserThan = ____player.getPlayerCloserThan
|
|
10
|
+
function ____exports.findFreePosition(self, startingPosition)
|
|
11
|
+
local game = Game()
|
|
12
|
+
local room = game:GetRoom()
|
|
13
|
+
local heavenDoors = getEffects(nil, EffectVariant.HEAVEN_LIGHT_DOOR, 0)
|
|
14
|
+
do
|
|
15
|
+
local i = 0
|
|
16
|
+
while i < 100 do
|
|
17
|
+
do
|
|
18
|
+
local position = room:FindFreePickupSpawnPosition(startingPosition, i)
|
|
19
|
+
local closePlayer = getPlayerCloserThan(nil, position, DISTANCE_OF_GRID_TILE)
|
|
20
|
+
if closePlayer ~= nil then
|
|
21
|
+
goto __continue3
|
|
22
|
+
end
|
|
23
|
+
local isCloseHeavenDoor = anyEntityCloserThan(nil, heavenDoors, position, DISTANCE_OF_GRID_TILE)
|
|
24
|
+
if isCloseHeavenDoor then
|
|
25
|
+
goto __continue3
|
|
26
|
+
end
|
|
27
|
+
return position
|
|
28
|
+
end
|
|
29
|
+
::__continue3::
|
|
30
|
+
i = i + 1
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
return room:FindFreePickupSpawnPosition(startingPosition)
|
|
34
|
+
end
|
|
35
|
+
return ____exports
|
package/dist/functions/util.d.ts
CHANGED
|
@@ -63,6 +63,12 @@ export declare function isGreedMode(): boolean;
|
|
|
63
63
|
* the game will not switch to a different seed.
|
|
64
64
|
*/
|
|
65
65
|
export declare function onSetSeed(): boolean;
|
|
66
|
+
/**
|
|
67
|
+
* Helper function to print something to the in-game console. Use this instead of invoking
|
|
68
|
+
* `Isaac.ConsoleOutput()` directly because it will automatically insert a newline at the end of the
|
|
69
|
+
* message (which `Isaac.ConsoleOutput()` does not do by default).
|
|
70
|
+
*/
|
|
71
|
+
export declare function printConsole(msg: string): void;
|
|
66
72
|
/**
|
|
67
73
|
* In a Map, you can use the `clear` method to delete every element. However, in a LuaTable, the
|
|
68
74
|
* `clear` method does not exist. Use this helper function as a drop-in replacement for this.
|
package/dist/functions/util.lua
CHANGED
|
@@ -58,6 +58,9 @@ function ____exports.onSetSeed(self)
|
|
|
58
58
|
local challenge = Isaac.GetChallenge()
|
|
59
59
|
return (challenge == Challenge.CHALLENGE_NULL) and customRun
|
|
60
60
|
end
|
|
61
|
+
function ____exports.printConsole(self, msg)
|
|
62
|
+
Isaac.ConsoleOutput(msg .. "\n")
|
|
63
|
+
end
|
|
61
64
|
function ____exports.tableClear(self, ____table)
|
|
62
65
|
for key in pairs(____table) do
|
|
63
66
|
____table[key] = nil
|
package/dist/index.d.ts
CHANGED
|
@@ -30,6 +30,7 @@ export * from "./functions/pickups";
|
|
|
30
30
|
export * from "./functions/player";
|
|
31
31
|
export * from "./functions/playerHealth";
|
|
32
32
|
export * from "./functions/pocketItems";
|
|
33
|
+
export * from "./functions/position";
|
|
33
34
|
export * from "./functions/random";
|
|
34
35
|
export * from "./functions/revive";
|
|
35
36
|
export * from "./functions/rooms";
|
package/dist/index.lua
CHANGED
|
@@ -251,6 +251,14 @@ do
|
|
|
251
251
|
end
|
|
252
252
|
end
|
|
253
253
|
end
|
|
254
|
+
do
|
|
255
|
+
local ____export = require("functions.position")
|
|
256
|
+
for ____exportKey, ____exportValue in pairs(____export) do
|
|
257
|
+
if ____exportKey ~= "default" then
|
|
258
|
+
____exports[____exportKey] = ____exportValue
|
|
259
|
+
end
|
|
260
|
+
end
|
|
261
|
+
end
|
|
254
262
|
do
|
|
255
263
|
local ____export = require("functions.random")
|
|
256
264
|
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.
|
|
3
|
+
"version": "1.0.452",
|
|
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.
|
|
28
|
+
"isaac-typescript-definitions": "^1.0.276",
|
|
29
29
|
"isaacscript-lint": "^1.0.67",
|
|
30
30
|
"typedoc": "^0.22.9",
|
|
31
31
|
"typescript": "4.4.4",
|