isaacscript-common 1.0.582 → 1.0.586
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/customRevive.lua +34 -6
- package/dist/functions/gridEntity.d.ts +19 -0
- package/dist/functions/gridEntity.lua +5 -0
- package/dist/functions/playerHealth.lua +10 -1
- package/dist/functions/position.d.ts +5 -1
- package/dist/functions/position.lua +5 -2
- package/dist/types/PlayerHealth.d.ts +2 -0
- package/package.json +2 -2
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
2
|
local ____exports = {}
|
|
3
|
-
local hasSubscriptions, postRender, postNewRoom, postPEffectUpdateReordered, postPlayerFatalDamage, CustomReviveState, v
|
|
3
|
+
local hasSubscriptions, postRender, postNewRoom, postPEffectUpdateReordered, postPEffectUpdateReorderedWaitingForBerserkToEnd, postPEffectUpdateReorderedWaitingForItemAnimation, postPlayerFatalDamage, CustomReviveState, v
|
|
4
4
|
local ____exports = require("features.saveDataManager.exports")
|
|
5
5
|
local saveDataManager = ____exports.saveDataManager
|
|
6
6
|
local ____collectibles = require("functions.collectibles")
|
|
7
7
|
local removeCollectibleFromItemTracker = ____collectibles.removeCollectibleFromItemTracker
|
|
8
8
|
local ____entity = require("functions.entity")
|
|
9
|
-
local
|
|
9
|
+
local removeAllFamiliars = ____entity.removeAllFamiliars
|
|
10
10
|
local ____player = require("functions.player")
|
|
11
11
|
local getPlayerIndex = ____player.getPlayerIndex
|
|
12
12
|
local ____ModCallbacksCustom = require("types.ModCallbacksCustom")
|
|
@@ -37,6 +37,29 @@ function postNewRoom(self)
|
|
|
37
37
|
end
|
|
38
38
|
end
|
|
39
39
|
function postPEffectUpdateReordered(self, player)
|
|
40
|
+
postPEffectUpdateReorderedWaitingForBerserkToEnd(nil, player)
|
|
41
|
+
postPEffectUpdateReorderedWaitingForItemAnimation(nil, player)
|
|
42
|
+
end
|
|
43
|
+
function postPEffectUpdateReorderedWaitingForBerserkToEnd(self, player)
|
|
44
|
+
if v.run.state ~= CustomReviveState.WAITING_FOR_BERSERK_TO_END then
|
|
45
|
+
return
|
|
46
|
+
end
|
|
47
|
+
if v.run.dyingPlayerIndex == nil then
|
|
48
|
+
return
|
|
49
|
+
end
|
|
50
|
+
local playerIndex = getPlayerIndex(nil, player)
|
|
51
|
+
local effects = player:GetEffects()
|
|
52
|
+
if playerIndex ~= v.run.dyingPlayerIndex then
|
|
53
|
+
return
|
|
54
|
+
end
|
|
55
|
+
removeAllFamiliars(nil, FamiliarVariant.ONE_UP)
|
|
56
|
+
local isBerserk = effects:HasCollectibleEffect(CollectibleType.COLLECTIBLE_BERSERK)
|
|
57
|
+
if isBerserk then
|
|
58
|
+
return
|
|
59
|
+
end
|
|
60
|
+
v.run.state = CustomReviveState.CHANGING_ROOMS
|
|
61
|
+
end
|
|
62
|
+
function postPEffectUpdateReorderedWaitingForItemAnimation(self, player)
|
|
40
63
|
if v.run.state ~= CustomReviveState.WAITING_FOR_ITEM_ANIMATION then
|
|
41
64
|
return
|
|
42
65
|
end
|
|
@@ -73,19 +96,24 @@ function postPlayerFatalDamage(self, player)
|
|
|
73
96
|
if revivalType == nil then
|
|
74
97
|
return
|
|
75
98
|
end
|
|
76
|
-
|
|
99
|
+
local effects = player:GetEffects()
|
|
100
|
+
local isBerserk = effects:HasCollectibleEffect(CollectibleType.COLLECTIBLE_BERSERK)
|
|
101
|
+
local newState = isBerserk and CustomReviveState.WAITING_FOR_BERSERK_TO_END or CustomReviveState.CHANGING_ROOMS
|
|
102
|
+
v.run.state = newState
|
|
77
103
|
v.run.revivalType = revivalType
|
|
78
104
|
v.run.dyingPlayerIndex = getPlayerIndex(nil, player)
|
|
79
105
|
player:AddCollectible(CollectibleType.COLLECTIBLE_1UP, 0, false)
|
|
80
|
-
|
|
106
|
+
removeAllFamiliars(nil, FamiliarVariant.ONE_UP)
|
|
81
107
|
removeCollectibleFromItemTracker(nil, CollectibleType.COLLECTIBLE_1UP)
|
|
82
108
|
end
|
|
83
109
|
CustomReviveState = CustomReviveState or ({})
|
|
84
110
|
CustomReviveState.DISABLED = 0
|
|
85
111
|
CustomReviveState[CustomReviveState.DISABLED] = "DISABLED"
|
|
86
|
-
CustomReviveState.
|
|
112
|
+
CustomReviveState.WAITING_FOR_BERSERK_TO_END = 1
|
|
113
|
+
CustomReviveState[CustomReviveState.WAITING_FOR_BERSERK_TO_END] = "WAITING_FOR_BERSERK_TO_END"
|
|
114
|
+
CustomReviveState.CHANGING_ROOMS = 2
|
|
87
115
|
CustomReviveState[CustomReviveState.CHANGING_ROOMS] = "CHANGING_ROOMS"
|
|
88
|
-
CustomReviveState.WAITING_FOR_ITEM_ANIMATION =
|
|
116
|
+
CustomReviveState.WAITING_FOR_ITEM_ANIMATION = 3
|
|
89
117
|
CustomReviveState[CustomReviveState.WAITING_FOR_ITEM_ANIMATION] = "WAITING_FOR_ITEM_ANIMATION"
|
|
90
118
|
v = {run = {state = CustomReviveState.DISABLED, revivalType = nil, dyingPlayerIndex = nil}}
|
|
91
119
|
function ____exports.customReviveCallbacksInit(self, mod)
|
|
@@ -93,6 +93,25 @@ export declare function removeGridEntity(gridEntity: GridEntity, updateRoom?: bo
|
|
|
93
93
|
* For more information, see the documentation for the `clearSprite()` helper function.
|
|
94
94
|
*/
|
|
95
95
|
export declare function setGridEntityInvisible(gridEntity: GridEntity): void;
|
|
96
|
+
/**
|
|
97
|
+
* Helper function to spawn a giant poop. This is performed by spawning each of the four quadrant
|
|
98
|
+
* grid entities in the appropriate positions.
|
|
99
|
+
*/
|
|
96
100
|
export declare function spawnGiantPoop(topLeftGridIndex: int): void;
|
|
101
|
+
/**
|
|
102
|
+
* Helper function to spawn a grid entity. This function assumes you want to give the grid entity a
|
|
103
|
+
* variant of 0. Use this instead of the `Isaac.GridSpawn()` method since it handles giving pits
|
|
104
|
+
* collision and it allows you to specify the grid index instead of the position.
|
|
105
|
+
*/
|
|
97
106
|
export declare function spawnGridEntity(gridEntityType: GridEntityType, gridIndex: int): GridEntity;
|
|
107
|
+
/**
|
|
108
|
+
* Helper function to spawn a grid entity with a specific variant. Use this instead of the
|
|
109
|
+
* `Isaac.GridSpawn()` method since it handles giving pits collision and it allows you to specify
|
|
110
|
+
* the grid index instead of the position.
|
|
111
|
+
*/
|
|
98
112
|
export declare function spawnGridEntityWithVariant(gridEntityType: GridEntityType, variant: int, gridIndex: int): GridEntity;
|
|
113
|
+
/**
|
|
114
|
+
* Helper function to spawn a Void Portal. This is more complicated than simply spawning a trapdoor
|
|
115
|
+
* with the appropriate variant, as the game does not give it the correct sprite automatically.
|
|
116
|
+
*/
|
|
117
|
+
export declare function spawnVoidPortal(gridIndex: int): void;
|
|
@@ -183,4 +183,9 @@ end
|
|
|
183
183
|
function ____exports.spawnGridEntity(self, gridEntityType, gridIndex)
|
|
184
184
|
return ____exports.spawnGridEntityWithVariant(nil, gridEntityType, 0, gridIndex)
|
|
185
185
|
end
|
|
186
|
+
function ____exports.spawnVoidPortal(self, gridIndex)
|
|
187
|
+
local voidPortal = ____exports.spawnGridEntityWithVariant(nil, GridEntityType.GRID_TRAPDOOR, 1, gridIndex)
|
|
188
|
+
local sprite = voidPortal:GetSprite()
|
|
189
|
+
sprite:Load("gfx/grid/voidtrapdoor.anm2", true)
|
|
190
|
+
end
|
|
186
191
|
return ____exports
|
|
@@ -27,6 +27,8 @@ function ____exports.getPlayerHealth(self, player)
|
|
|
27
27
|
local rottenHearts = player:GetRottenHearts()
|
|
28
28
|
local brokenHearts = player:GetBrokenHearts()
|
|
29
29
|
local subPlayer = player:GetSubPlayer()
|
|
30
|
+
local soulCharges = player:GetEffectiveSoulCharge()
|
|
31
|
+
local bloodCharges = player:GetEffectiveBloodCharge()
|
|
30
32
|
if character == PlayerType.PLAYER_THEFORGOTTEN and subPlayer ~= nil then
|
|
31
33
|
maxHearts = boneHearts * 2
|
|
32
34
|
boneHearts = 0
|
|
@@ -71,7 +73,9 @@ function ____exports.getPlayerHealth(self, player)
|
|
|
71
73
|
boneHearts = boneHearts,
|
|
72
74
|
goldenHearts = goldenHearts,
|
|
73
75
|
rottenHearts = rottenHearts,
|
|
74
|
-
brokenHearts = brokenHearts
|
|
76
|
+
brokenHearts = brokenHearts,
|
|
77
|
+
soulCharges = soulCharges,
|
|
78
|
+
bloodCharges = bloodCharges
|
|
75
79
|
}
|
|
76
80
|
end
|
|
77
81
|
function ____exports.setPlayerHealth(self, player, playerHealth)
|
|
@@ -110,5 +114,10 @@ function ____exports.setPlayerHealth(self, player, playerHealth)
|
|
|
110
114
|
player:AddHearts(playerHealth.hearts)
|
|
111
115
|
player:AddGoldenHearts(playerHealth.goldenHearts)
|
|
112
116
|
player:AddBrokenHearts(playerHealth.brokenHearts)
|
|
117
|
+
if character == PlayerType.PLAYER_BETHANY then
|
|
118
|
+
player:SetSoulCharge(playerHealth.soulCharges)
|
|
119
|
+
elseif character == PlayerType.PLAYER_BETHANY_B then
|
|
120
|
+
player:SetBloodCharge(playerHealth.bloodCharges)
|
|
121
|
+
end
|
|
113
122
|
end
|
|
114
123
|
return ____exports
|
|
@@ -5,5 +5,9 @@
|
|
|
5
5
|
* with heaven doors and partially overlap with players, if the thing being spawned is bigger than a
|
|
6
6
|
* tile (like a Blood Donation Machine). Use this function instead if you want to account for those
|
|
7
7
|
* specific situations.
|
|
8
|
+
*
|
|
9
|
+
* @param startingPosition The position to start searching from. If this position is not overlapping
|
|
10
|
+
* with anything, then it will be returned.
|
|
11
|
+
* @param avoidActiveEntities Optional. False by default.
|
|
8
12
|
*/
|
|
9
|
-
export declare function findFreePosition(startingPosition: Vector): Vector;
|
|
13
|
+
export declare function findFreePosition(startingPosition: Vector, avoidActiveEntities?: boolean): Vector;
|
|
@@ -7,7 +7,10 @@ local anyEntityCloserThan = ____entity.anyEntityCloserThan
|
|
|
7
7
|
local getEffects = ____entity.getEffects
|
|
8
8
|
local ____player = require("functions.player")
|
|
9
9
|
local getPlayerCloserThan = ____player.getPlayerCloserThan
|
|
10
|
-
function ____exports.findFreePosition(self, startingPosition)
|
|
10
|
+
function ____exports.findFreePosition(self, startingPosition, avoidActiveEntities)
|
|
11
|
+
if avoidActiveEntities == nil then
|
|
12
|
+
avoidActiveEntities = false
|
|
13
|
+
end
|
|
11
14
|
local game = Game()
|
|
12
15
|
local room = game:GetRoom()
|
|
13
16
|
local heavenDoors = getEffects(nil, EffectVariant.HEAVEN_LIGHT_DOOR, 0)
|
|
@@ -15,7 +18,7 @@ function ____exports.findFreePosition(self, startingPosition)
|
|
|
15
18
|
local i = 0
|
|
16
19
|
while i < 100 do
|
|
17
20
|
do
|
|
18
|
-
local position = room:FindFreePickupSpawnPosition(startingPosition, i)
|
|
21
|
+
local position = room:FindFreePickupSpawnPosition(startingPosition, i, avoidActiveEntities)
|
|
19
22
|
local closePlayer = getPlayerCloserThan(nil, position, DISTANCE_OF_GRID_TILE)
|
|
20
23
|
if closePlayer ~= nil then
|
|
21
24
|
goto __continue3
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "isaacscript-common",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.586",
|
|
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.329",
|
|
29
29
|
"isaacscript-lint": "^1.0.77",
|
|
30
30
|
"typedoc": "^0.22.10",
|
|
31
31
|
"typescript": "^4.5.4",
|