isaacscript-common 1.2.79 → 1.2.82
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/features/saveDataManager/load.lua +2 -2
- package/dist/features/saveDataManager/save.lua +2 -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/jsonHelpers.d.ts +16 -0
- package/dist/functions/jsonHelpers.lua +28 -0
- package/dist/functions/pickups.d.ts +0 -21
- package/dist/functions/pickups.lua +0 -26
- package/dist/functions/player.d.ts +3 -3
- package/dist/functions/revive.d.ts +8 -2
- package/dist/functions/revive.lua +13 -3
- package/dist/functions/trinkets.lua +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.lua +1 -1
- 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")
|
|
@@ -3,8 +3,8 @@ local ____lualib = require("lualib_bundle")
|
|
|
3
3
|
local __TS__StringTrim = ____lualib.__TS__StringTrim
|
|
4
4
|
local ____exports = {}
|
|
5
5
|
local readSaveDatFile, tryLoadModData, DEFAULT_MOD_DATA
|
|
6
|
-
local
|
|
7
|
-
local jsonDecode =
|
|
6
|
+
local ____jsonHelpers = require("functions.jsonHelpers")
|
|
7
|
+
local jsonDecode = ____jsonHelpers.jsonDecode
|
|
8
8
|
local ____log = require("functions.log")
|
|
9
9
|
local log = ____log.log
|
|
10
10
|
local ____debug = require("features.saveDataManager.debug")
|
|
@@ -7,8 +7,8 @@ local getAllSaveDataToWriteToDisk
|
|
|
7
7
|
local ____deepCopy = require("functions.deepCopy")
|
|
8
8
|
local deepCopy = ____deepCopy.deepCopy
|
|
9
9
|
local SerializationType = ____deepCopy.SerializationType
|
|
10
|
-
local
|
|
11
|
-
local jsonEncode =
|
|
10
|
+
local ____jsonHelpers = require("functions.jsonHelpers")
|
|
11
|
+
local jsonEncode = ____jsonHelpers.jsonEncode
|
|
12
12
|
local ____log = require("functions.log")
|
|
13
13
|
local log = ____log.log
|
|
14
14
|
function getAllSaveDataToWriteToDisk(self, saveDataMap, saveDataConditionalFuncMap)
|
|
@@ -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)
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/// <reference types="typescript-to-lua/language-extensions" />
|
|
2
|
+
/**
|
|
3
|
+
* Converts a Lua table to a JSON string.
|
|
4
|
+
* In most cases, this function will be used for writing data to a "save#.dat" file.
|
|
5
|
+
* If encoding fails, it will throw an error to prevent writing a blank string or corrupted data to
|
|
6
|
+
* a user's "save#.dat" file.
|
|
7
|
+
*/
|
|
8
|
+
export declare function jsonEncode(table: unknown): string;
|
|
9
|
+
/**
|
|
10
|
+
* Converts a JSON string to a Lua table.
|
|
11
|
+
* In most cases, this function will be used for reading data from a "save#.dat" file.
|
|
12
|
+
* If decoding fails, it will return a blank Lua table instead of throwing an error.
|
|
13
|
+
* (This allows execution to continue in cases where users have no current save data or have
|
|
14
|
+
* manually removed their existing save data.)
|
|
15
|
+
*/
|
|
16
|
+
export declare function jsonDecode(jsonString: string): LuaTable;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
|
+
local ____exports = {}
|
|
3
|
+
local tryEncode, tryDecode
|
|
4
|
+
local json = require("@NoResolution:json")
|
|
5
|
+
local ____log = require("functions.log")
|
|
6
|
+
local log = ____log.log
|
|
7
|
+
function tryEncode(____table)
|
|
8
|
+
return json.encode(____table)
|
|
9
|
+
end
|
|
10
|
+
function tryDecode(jsonString)
|
|
11
|
+
return json.decode(jsonString)
|
|
12
|
+
end
|
|
13
|
+
function ____exports.jsonEncode(self, ____table)
|
|
14
|
+
local ok, jsonStringOrErrMsg = pcall(tryEncode, ____table)
|
|
15
|
+
if not ok then
|
|
16
|
+
error("Failed to convert the Lua table to JSON: " .. jsonStringOrErrMsg)
|
|
17
|
+
end
|
|
18
|
+
return jsonStringOrErrMsg
|
|
19
|
+
end
|
|
20
|
+
function ____exports.jsonDecode(self, jsonString)
|
|
21
|
+
local ok, luaTableOrErrMsg = pcall(tryDecode, jsonString)
|
|
22
|
+
if not ok then
|
|
23
|
+
log("Failed to convert the JSON string to a Lua table: " .. jsonString)
|
|
24
|
+
return {}
|
|
25
|
+
end
|
|
26
|
+
return luaTableOrErrMsg
|
|
27
|
+
end
|
|
28
|
+
return ____exports
|
|
@@ -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
|
|
@@ -97,9 +97,9 @@ export declare function getLastHeart(player: EntityPlayer): HealthType;
|
|
|
97
97
|
*/
|
|
98
98
|
export declare function getNewestPlayer(): EntityPlayer;
|
|
99
99
|
/**
|
|
100
|
-
* Returns the number of slots that the player has remaining for heart containers, accounting
|
|
101
|
-
* broken hearts. For example, if the player is Judas and has 1 red heart containers and 2 full
|
|
102
|
-
* hearts and 3 broken hearts, then this function would return 6 (i.e. 12 - 1 - 2 - 3).
|
|
100
|
+
* Returns the number of slots that the player has remaining for new heart containers, accounting
|
|
101
|
+
* for broken hearts. For example, if the player is Judas and has 1 red heart containers and 2 full
|
|
102
|
+
* soul hearts and 3 broken hearts, then this function would return 6 (i.e. 12 - 1 - 2 - 3).
|
|
103
103
|
*/
|
|
104
104
|
export declare function getPlayerAvailableHeartSlots(player: EntityPlayer): int;
|
|
105
105
|
/**
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
*/
|
|
6
6
|
export declare function isDamageToPlayerFatal(player: EntityPlayer, damageAmount: int, damageSource: EntityRef, lastDamageGameFrame: int): boolean;
|
|
7
7
|
/**
|
|
8
|
-
* The `EntityPlayer.WillPlayerRevive()` function does not properly account for Mysterious Paper,
|
|
9
|
-
*
|
|
8
|
+
* The `EntityPlayer.WillPlayerRevive()` function does not properly account for Mysterious Paper, so
|
|
9
|
+
* use this helper function instead for more robust revival detection.
|
|
10
10
|
*/
|
|
11
11
|
export declare function willPlayerRevive(player: EntityPlayer): boolean;
|
|
12
12
|
/**
|
|
@@ -18,6 +18,12 @@ export declare function willPlayerRevive(player: EntityPlayer): boolean;
|
|
|
18
18
|
* Mysterious Paper be Missing Power is: `gameFrameCount % 4 === 3`
|
|
19
19
|
*/
|
|
20
20
|
export declare function willMysteriousPaperRevive(player: EntityPlayer): boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Helper function to determine if the player will be revived by the Heartbreak collectible if they
|
|
23
|
+
* take fatal damage. This is contingent on the character that they are playing as and the amount of
|
|
24
|
+
* broken hearts that they already have.
|
|
25
|
+
*/
|
|
26
|
+
export declare function willReviveFromHeartbreak(player: EntityPlayer): boolean;
|
|
21
27
|
/**
|
|
22
28
|
* Helper function to determine if the Spirit Shackles item is in an enabled state. (It can be
|
|
23
29
|
* either enabled or disabled.)
|
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
local ____exports = {}
|
|
3
3
|
local ____player = require("functions.player")
|
|
4
4
|
local getDeathAnimationName = ____player.getDeathAnimationName
|
|
5
|
-
local
|
|
5
|
+
local getPlayerMaxHeartContainers = ____player.getPlayerMaxHeartContainers
|
|
6
6
|
local getPlayerNumHitsRemaining = ____player.getPlayerNumHitsRemaining
|
|
7
7
|
local hasLostCurse = ____player.hasLostCurse
|
|
8
|
+
local isKeeper = ____player.isKeeper
|
|
8
9
|
local ____sprite = require("functions.sprite")
|
|
9
10
|
local getFinalFrameOfAnimation = ____sprite.getFinalFrameOfAnimation
|
|
10
11
|
local ____trinketGive = require("functions.trinketGive")
|
|
@@ -19,6 +20,16 @@ function ____exports.willMysteriousPaperRevive(self, player)
|
|
|
19
20
|
local frameOfDeath = gameFrameCount + deathAnimationFrames + 1
|
|
20
21
|
return frameOfDeath % 4 == 3
|
|
21
22
|
end
|
|
23
|
+
function ____exports.willReviveFromHeartbreak(self, player)
|
|
24
|
+
if player:HasCollectible(CollectibleType.COLLECTIBLE_HEARTBREAK) then
|
|
25
|
+
return false
|
|
26
|
+
end
|
|
27
|
+
local numBrokenHeartsThatWillBeAdded = isKeeper(nil, player) and 1 or 2
|
|
28
|
+
local brokenHearts = player:GetBrokenHearts()
|
|
29
|
+
local numBrokenHeartsAfterRevival = numBrokenHeartsThatWillBeAdded + brokenHearts
|
|
30
|
+
local maxHeartContainers = getPlayerMaxHeartContainers(nil, player)
|
|
31
|
+
return numBrokenHeartsAfterRevival < maxHeartContainers
|
|
32
|
+
end
|
|
22
33
|
function ____exports.willReviveFromSpiritShackles(self, player)
|
|
23
34
|
if not player:HasCollectible(CollectibleType.COLLECTIBLE_SPIRIT_SHACKLES) then
|
|
24
35
|
return false
|
|
@@ -53,8 +64,7 @@ function ____exports.isDamageToPlayerFatal(self, player, damageAmount, damageSou
|
|
|
53
64
|
if damageAmount < playerNumAllHearts then
|
|
54
65
|
return false
|
|
55
66
|
end
|
|
56
|
-
|
|
57
|
-
if player:HasCollectible(CollectibleType.COLLECTIBLE_HEARTBREAK) and playerAvailableHeartSlots >= 2 then
|
|
67
|
+
if ____exports.willReviveFromHeartbreak(nil, player) then
|
|
58
68
|
return false
|
|
59
69
|
end
|
|
60
70
|
if player:HasCollectible(CollectibleType.COLLECTIBLE_BROKEN_GLASS_CANNON) and gameFrameCount == lastDamageGameFrame then
|
|
@@ -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")
|
package/dist/index.d.ts
CHANGED
|
@@ -29,7 +29,7 @@ export * from "./functions/flying";
|
|
|
29
29
|
export * from "./functions/globals";
|
|
30
30
|
export * from "./functions/gridEntity";
|
|
31
31
|
export * from "./functions/input";
|
|
32
|
-
export * from "./functions/
|
|
32
|
+
export * from "./functions/jsonHelpers";
|
|
33
33
|
export * from "./functions/jsonRoom";
|
|
34
34
|
export * from "./functions/language";
|
|
35
35
|
export * from "./functions/log";
|
package/dist/index.lua
CHANGED
|
@@ -243,7 +243,7 @@ do
|
|
|
243
243
|
end
|
|
244
244
|
end
|
|
245
245
|
do
|
|
246
|
-
local ____export = require("functions.
|
|
246
|
+
local ____export = require("functions.jsonHelpers")
|
|
247
247
|
for ____exportKey, ____exportValue in pairs(____export) do
|
|
248
248
|
if ____exportKey ~= "default" then
|
|
249
249
|
____exports[____exportKey] = ____exportValue
|