isaacscript-common 1.2.79 → 1.2.80
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/callbacks/postPurchase.lua +2 -2
- package/dist/features/deployJSONRoom.d.ts +0 -2
- package/dist/features/deployJSONRoom.lua +1 -2
- package/dist/functions/collectibles.lua +3 -3
- package/dist/functions/entity.d.ts +26 -5
- package/dist/functions/entity.lua +35 -14
- package/dist/functions/pickups.d.ts +0 -21
- package/dist/functions/pickups.lua +0 -26
- package/dist/functions/trinkets.lua +2 -2
- package/package.json +1 -1
|
@@ -9,8 +9,8 @@ local ____exports = {}
|
|
|
9
9
|
local hasSubscriptions, postUpdate, checkPickupsPurchased, getPlayerThatIsNoLongerHoldingAnItem, storePickupsInMap, storePlayersInMap, pickupAtIndexStillExists, v
|
|
10
10
|
local ____exports = require("features.saveDataManager.exports")
|
|
11
11
|
local saveDataManager = ____exports.saveDataManager
|
|
12
|
-
local
|
|
13
|
-
local getPickups =
|
|
12
|
+
local ____entity = require("functions.entity")
|
|
13
|
+
local getPickups = ____entity.getPickups
|
|
14
14
|
local ____player = require("functions.player")
|
|
15
15
|
local getPlayerIndex = ____player.getPlayerIndex
|
|
16
16
|
local getPlayers = ____player.getPlayers
|
|
@@ -10,8 +10,6 @@ import { JSONRoom } from "../types/JSONRoom";
|
|
|
10
10
|
* @param jsonRoom The JSON room to deploy. In practice, this will be something like:
|
|
11
11
|
* ```
|
|
12
12
|
* import customRooms from "./customRooms";
|
|
13
|
-
import { removeAllPickups } from '../functions/pickups';
|
|
14
|
-
import { removeAllBombs } from '../functions/entitySpecific';
|
|
15
13
|
*
|
|
16
14
|
* const firstJSONRoom = customRooms.rooms.room[0];
|
|
17
15
|
* deployJSONRoom(firstJSONRoom);
|
|
@@ -11,6 +11,7 @@ local ____errors = require("errors")
|
|
|
11
11
|
local getUpgradeErrorMsg = ____errors.getUpgradeErrorMsg
|
|
12
12
|
local ____entity = require("functions.entity")
|
|
13
13
|
local removeAllMatchingEntities = ____entity.removeAllMatchingEntities
|
|
14
|
+
local removeAllPickups = ____entity.removeAllPickups
|
|
14
15
|
local ____entitySpecific = require("functions.entitySpecific")
|
|
15
16
|
local removeAllBombs = ____entitySpecific.removeAllBombs
|
|
16
17
|
local ____gridEntity = require("functions.gridEntity")
|
|
@@ -27,8 +28,6 @@ local ____math = require("functions.math")
|
|
|
27
28
|
local range = ____math.range
|
|
28
29
|
local ____npc = require("functions.npc")
|
|
29
30
|
local getNPCs = ____npc.getNPCs
|
|
30
|
-
local ____pickups = require("functions.pickups")
|
|
31
|
-
local removeAllPickups = ____pickups.removeAllPickups
|
|
32
31
|
local ____random = require("functions.random")
|
|
33
32
|
local nextSeed = ____random.nextSeed
|
|
34
33
|
local ____rooms = require("functions.rooms")
|
|
@@ -8,11 +8,11 @@ local ____collectibleDescriptionMap = require("maps.collectibleDescriptionMap")
|
|
|
8
8
|
local COLLECTIBLE_DESCRIPTION_MAP = ____collectibleDescriptionMap.COLLECTIBLE_DESCRIPTION_MAP
|
|
9
9
|
local ____collectibleNameMap = require("maps.collectibleNameMap")
|
|
10
10
|
local COLLECTIBLE_NAME_MAP = ____collectibleNameMap.COLLECTIBLE_NAME_MAP
|
|
11
|
+
local ____entity = require("functions.entity")
|
|
12
|
+
local getPickups = ____entity.getPickups
|
|
13
|
+
local removeAllPickups = ____entity.removeAllPickups
|
|
11
14
|
local ____flag = require("functions.flag")
|
|
12
15
|
local hasFlag = ____flag.hasFlag
|
|
13
|
-
local ____pickups = require("functions.pickups")
|
|
14
|
-
local getPickups = ____pickups.getPickups
|
|
15
|
-
local removeAllPickups = ____pickups.removeAllPickups
|
|
16
16
|
local ____sprite = require("functions.sprite")
|
|
17
17
|
local clearSprite = ____sprite.clearSprite
|
|
18
18
|
function ____exports.setCollectibleSprite(self, collectible, pngPath)
|
|
@@ -42,6 +42,18 @@ export declare function getFilteredNewEntities<T extends AnyEntity>(oldEntities:
|
|
|
42
42
|
* returned. False by default. Will only be taken into account if `matchingEntityType` is specified.
|
|
43
43
|
*/
|
|
44
44
|
export declare function getEntities(matchingEntityType?: EntityType | int, matchingVariant?: number, matchingSubType?: number, ignoreFriendly?: boolean): Entity[];
|
|
45
|
+
/**
|
|
46
|
+
* Helper function to get all of the pickups in the room.
|
|
47
|
+
*
|
|
48
|
+
* Example:
|
|
49
|
+
* ```
|
|
50
|
+
* // Make all of the pickups in the room invisible
|
|
51
|
+
* for (const pickup of getPickups()) {
|
|
52
|
+
* pickup.Visible = false;
|
|
53
|
+
* }
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
export declare function getPickups(matchingVariant?: PickupVariant | int, matchingSubType?: number): EntityPickup[];
|
|
45
57
|
/**
|
|
46
58
|
* Helper function to measure an entity's velocity to see if it is moving.
|
|
47
59
|
*
|
|
@@ -55,6 +67,14 @@ export declare function isEntityMoving(entity: Entity, threshold?: number): bool
|
|
|
55
67
|
* to non-story bosses, like Vanishing Twin. Also see the `STORY_BOSSES` constant.
|
|
56
68
|
*/
|
|
57
69
|
export declare function isStoryBoss(entity: Entity): boolean;
|
|
70
|
+
/**
|
|
71
|
+
* Helper function to remove all of the entities in the supplied array.
|
|
72
|
+
*
|
|
73
|
+
* @param entities The array of entities to remove.
|
|
74
|
+
* @param cap Optional. If specified, will only remove the given amount of entities.
|
|
75
|
+
* @returns True if one or more entities was removed, false otherwise.
|
|
76
|
+
*/
|
|
77
|
+
export declare function removeEntities(entities: Entity[], cap?: int): boolean;
|
|
58
78
|
/**
|
|
59
79
|
* Helper function to remove all of the matching entities in the room.
|
|
60
80
|
*
|
|
@@ -68,13 +88,14 @@ export declare function isStoryBoss(entity: Entity): boolean;
|
|
|
68
88
|
*/
|
|
69
89
|
export declare function removeAllMatchingEntities(entityType: int, entityVariant?: number, entitySubType?: number, cap?: int | undefined): boolean;
|
|
70
90
|
/**
|
|
71
|
-
* Helper function to remove all of the
|
|
91
|
+
* Helper function to remove all of the pickups in the room.
|
|
72
92
|
*
|
|
73
|
-
* @param
|
|
74
|
-
* @param
|
|
75
|
-
* @
|
|
93
|
+
* @param variant Optional. If specified, will only remove pickups that match this variant.
|
|
94
|
+
* @param subType Optional. If specified, will only remove pickups that match this sub-type.
|
|
95
|
+
* @param cap Optional. If specified, will only remove the given amount of pickups.
|
|
96
|
+
* @returns True if one or more pickups was removed, false otherwise.
|
|
76
97
|
*/
|
|
77
|
-
export declare function
|
|
98
|
+
export declare function removeAllPickups(variant?: PickupVariant | int, subType?: int, cap?: int): boolean;
|
|
78
99
|
/**
|
|
79
100
|
* Helper function to reroll an enemy. Use this instead of the vanilla "Game.RerollEnemy" function
|
|
80
101
|
* if you want the rerolled enemy to be returned.
|
|
@@ -13,20 +13,6 @@ local getRandom = ____random.getRandom
|
|
|
13
13
|
local nextSeed = ____random.nextSeed
|
|
14
14
|
local ____utils = require("functions.utils")
|
|
15
15
|
local ____repeat = ____utils["repeat"]
|
|
16
|
-
function ____exports.removeEntities(self, entities, cap)
|
|
17
|
-
if #entities == 0 then
|
|
18
|
-
return false
|
|
19
|
-
end
|
|
20
|
-
local numEntitiesRemoved = 0
|
|
21
|
-
for ____, entity in ipairs(entities) do
|
|
22
|
-
entity:Remove()
|
|
23
|
-
numEntitiesRemoved = numEntitiesRemoved + 1
|
|
24
|
-
if cap ~= nil and numEntitiesRemoved >= cap then
|
|
25
|
-
return true
|
|
26
|
-
end
|
|
27
|
-
end
|
|
28
|
-
return true
|
|
29
|
-
end
|
|
30
16
|
function ____exports.anyEntityCloserThan(self, entities, position, distance)
|
|
31
17
|
return __TS__ArraySome(
|
|
32
18
|
entities,
|
|
@@ -77,6 +63,23 @@ function ____exports.getEntities(self, matchingEntityType, matchingVariant, matc
|
|
|
77
63
|
end
|
|
78
64
|
return Isaac.FindByType(matchingEntityType, matchingVariant, matchingSubType, ignoreFriendly)
|
|
79
65
|
end
|
|
66
|
+
function ____exports.getPickups(self, matchingVariant, matchingSubType)
|
|
67
|
+
if matchingVariant == nil then
|
|
68
|
+
matchingVariant = -1
|
|
69
|
+
end
|
|
70
|
+
if matchingSubType == nil then
|
|
71
|
+
matchingSubType = -1
|
|
72
|
+
end
|
|
73
|
+
local entities = ____exports.getEntities(nil, EntityType.ENTITY_PICKUP, matchingVariant, matchingSubType)
|
|
74
|
+
local pickups = {}
|
|
75
|
+
for ____, entity in ipairs(entities) do
|
|
76
|
+
local pickup = entity:ToPickup()
|
|
77
|
+
if pickup ~= nil then
|
|
78
|
+
__TS__ArrayPush(pickups, pickup)
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
return pickups
|
|
82
|
+
end
|
|
80
83
|
function ____exports.isEntityMoving(self, entity, threshold)
|
|
81
84
|
if threshold == nil then
|
|
82
85
|
threshold = 0.01
|
|
@@ -86,6 +89,20 @@ end
|
|
|
86
89
|
function ____exports.isStoryBoss(self, entity)
|
|
87
90
|
return STORY_BOSSES:has(entity.Type)
|
|
88
91
|
end
|
|
92
|
+
function ____exports.removeEntities(self, entities, cap)
|
|
93
|
+
if #entities == 0 then
|
|
94
|
+
return false
|
|
95
|
+
end
|
|
96
|
+
local numEntitiesRemoved = 0
|
|
97
|
+
for ____, entity in ipairs(entities) do
|
|
98
|
+
entity:Remove()
|
|
99
|
+
numEntitiesRemoved = numEntitiesRemoved + 1
|
|
100
|
+
if cap ~= nil and numEntitiesRemoved >= cap then
|
|
101
|
+
return true
|
|
102
|
+
end
|
|
103
|
+
end
|
|
104
|
+
return true
|
|
105
|
+
end
|
|
89
106
|
function ____exports.removeAllMatchingEntities(self, entityType, entityVariant, entitySubType, cap)
|
|
90
107
|
if entityVariant == nil then
|
|
91
108
|
entityVariant = -1
|
|
@@ -99,6 +116,10 @@ function ____exports.removeAllMatchingEntities(self, entityType, entityVariant,
|
|
|
99
116
|
local entities = ____exports.getEntities(nil, entityType, entityVariant, entitySubType)
|
|
100
117
|
return ____exports.removeEntities(nil, entities, cap)
|
|
101
118
|
end
|
|
119
|
+
function ____exports.removeAllPickups(self, variant, subType, cap)
|
|
120
|
+
local pickups = ____exports.getPickups(nil, variant, subType)
|
|
121
|
+
return ____exports.removeEntities(nil, pickups, cap)
|
|
122
|
+
end
|
|
102
123
|
function ____exports.rerollEnemy(self, entity)
|
|
103
124
|
local game = Game()
|
|
104
125
|
local oldEntities = ____exports.getEntities(nil)
|
|
@@ -1,16 +1,4 @@
|
|
|
1
1
|
/// <reference types="isaac-typescript-definitions" />
|
|
2
|
-
/**
|
|
3
|
-
* Helper function to get all of the pickups in the room.
|
|
4
|
-
*
|
|
5
|
-
* Example:
|
|
6
|
-
* ```
|
|
7
|
-
* // Make all of the pickups in the room invisible
|
|
8
|
-
* for (const pickup of getPickups()) {
|
|
9
|
-
* pickup.Visible = false;
|
|
10
|
-
* }
|
|
11
|
-
* ```
|
|
12
|
-
*/
|
|
13
|
-
export declare function getPickups(matchingVariant?: PickupVariant | int, matchingSubType?: number): EntityPickup[];
|
|
14
2
|
/**
|
|
15
3
|
* Has as an equal chance of returning any value in the `HeartSubType` enum. Useful for spawning a random type of heart.
|
|
16
4
|
*
|
|
@@ -19,12 +7,3 @@ export declare function getPickups(matchingVariant?: PickupVariant | int, matchi
|
|
|
19
7
|
*/
|
|
20
8
|
export declare function getRandomHeartSubType(seed?: number, exceptions?: HeartSubType[]): HeartSubType;
|
|
21
9
|
export declare function isChest(pickup: EntityPickup): boolean;
|
|
22
|
-
/**
|
|
23
|
-
* Helper function to remove all of the pickups in the room.
|
|
24
|
-
*
|
|
25
|
-
* @param variant Optional. If specified, will only remove pickups that match this variant.
|
|
26
|
-
* @param subType Optional. If specified, will only remove pickups that match this sub-type.
|
|
27
|
-
* @param cap Optional. If specified, will only remove the given amount of pickups.
|
|
28
|
-
* @returns True if one or more pickups was removed, false otherwise.
|
|
29
|
-
*/
|
|
30
|
-
export declare function removeAllPickups(variant?: PickupVariant | int, subType?: int, cap?: int): boolean;
|
|
@@ -1,33 +1,11 @@
|
|
|
1
1
|
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
|
-
local ____lualib = require("lualib_bundle")
|
|
3
|
-
local __TS__ArrayPush = ____lualib.__TS__ArrayPush
|
|
4
2
|
local ____exports = {}
|
|
5
3
|
local ____constants = require("constants")
|
|
6
4
|
local CHEST_PICKUP_VARIANTS = ____constants.CHEST_PICKUP_VARIANTS
|
|
7
5
|
local ____array = require("functions.array")
|
|
8
6
|
local getRandomArrayElement = ____array.getRandomArrayElement
|
|
9
|
-
local ____entity = require("functions.entity")
|
|
10
|
-
local getEntities = ____entity.getEntities
|
|
11
|
-
local removeEntities = ____entity.removeEntities
|
|
12
7
|
local ____utils = require("functions.utils")
|
|
13
8
|
local getEnumValues = ____utils.getEnumValues
|
|
14
|
-
function ____exports.getPickups(self, matchingVariant, matchingSubType)
|
|
15
|
-
if matchingVariant == nil then
|
|
16
|
-
matchingVariant = -1
|
|
17
|
-
end
|
|
18
|
-
if matchingSubType == nil then
|
|
19
|
-
matchingSubType = -1
|
|
20
|
-
end
|
|
21
|
-
local entities = getEntities(nil, EntityType.ENTITY_PICKUP, matchingVariant, matchingSubType)
|
|
22
|
-
local pickups = {}
|
|
23
|
-
for ____, entity in ipairs(entities) do
|
|
24
|
-
local pickup = entity:ToPickup()
|
|
25
|
-
if pickup ~= nil then
|
|
26
|
-
__TS__ArrayPush(pickups, pickup)
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
return pickups
|
|
30
|
-
end
|
|
31
9
|
function ____exports.getRandomHeartSubType(self, seed, exceptions)
|
|
32
10
|
if seed == nil then
|
|
33
11
|
seed = Random()
|
|
@@ -41,8 +19,4 @@ end
|
|
|
41
19
|
function ____exports.isChest(self, pickup)
|
|
42
20
|
return CHEST_PICKUP_VARIANTS:has(pickup.Variant)
|
|
43
21
|
end
|
|
44
|
-
function ____exports.removeAllPickups(self, variant, subType, cap)
|
|
45
|
-
local pickups = ____exports.getPickups(nil, variant, subType)
|
|
46
|
-
return removeEntities(nil, pickups, cap)
|
|
47
|
-
end
|
|
48
22
|
return ____exports
|
|
@@ -6,10 +6,10 @@ local ____trinketDescriptionMap = require("maps.trinketDescriptionMap")
|
|
|
6
6
|
local TRINKET_DESCRIPTION_MAP = ____trinketDescriptionMap.TRINKET_DESCRIPTION_MAP
|
|
7
7
|
local ____trinketNameMap = require("maps.trinketNameMap")
|
|
8
8
|
local TRINKET_NAME_MAP = ____trinketNameMap.TRINKET_NAME_MAP
|
|
9
|
+
local ____entity = require("functions.entity")
|
|
10
|
+
local getPickups = ____entity.getPickups
|
|
9
11
|
local ____flag = require("functions.flag")
|
|
10
12
|
local hasFlag = ____flag.hasFlag
|
|
11
|
-
local ____pickups = require("functions.pickups")
|
|
12
|
-
local getPickups = ____pickups.getPickups
|
|
13
13
|
local ____player = require("functions.player")
|
|
14
14
|
local useActiveItemTemp = ____player.useActiveItemTemp
|
|
15
15
|
local ____trinketGive = require("functions.trinketGive")
|