isaacscript-common 6.16.2 → 6.18.0
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/enums/ModCallbackCustom.d.ts +1 -1
- package/dist/features/customGridEntity.d.ts +3 -3
- package/dist/features/customGridEntity.d.ts.map +1 -1
- package/dist/features/customGridEntity.lua +18 -11
- package/dist/features/extraConsoleCommands/listCommands.lua +2 -2
- package/dist/features/persistentEntities.d.ts.map +1 -1
- package/dist/features/persistentEntities.lua +15 -5
- package/dist/features/pickupIndex.d.ts.map +1 -1
- package/dist/features/pickupIndex.lua +5 -6
- package/dist/features/roomHistory.d.ts +11 -4
- package/dist/features/roomHistory.d.ts.map +1 -1
- package/dist/features/roomHistory.lua +18 -5
- package/dist/functions/log.d.ts +1 -1
- package/dist/functions/log.d.ts.map +1 -1
- package/dist/functions/log.lua +33 -28
- package/dist/functions/npcs.d.ts +9 -0
- package/dist/functions/npcs.d.ts.map +1 -1
- package/dist/functions/npcs.lua +16 -3
- package/dist/functions/playerHealth.d.ts.map +1 -1
- package/dist/functions/playerHealth.lua +29 -12
- package/dist/functions/rockAlt.d.ts +4 -4
- package/dist/functions/rockAlt.d.ts.map +1 -1
- package/dist/functions/rockAlt.lua +38 -87
- package/dist/functions/saveFile.d.ts +5 -0
- package/dist/functions/saveFile.d.ts.map +1 -1
- package/dist/functions/saveFile.lua +112 -3
- package/dist/index.d.ts +1 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.lua +1 -9
- package/dist/interfaces/{CustomGridEntityData.d.ts → GridEntityCustomData.d.ts} +2 -2
- package/dist/interfaces/{CustomGridEntityData.d.ts.map → GridEntityCustomData.d.ts.map} +1 -1
- package/dist/interfaces/{CustomGridEntityData.lua → GridEntityCustomData.lua} +0 -0
- package/dist/interfaces/PlayerHealth.d.ts +4 -1
- package/dist/interfaces/PlayerHealth.d.ts.map +1 -1
- package/dist/interfaces/RoomDescription.d.ts +1 -0
- package/dist/interfaces/RoomDescription.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/enums/ModCallbackCustom.ts +1 -1
- package/src/features/customGridEntity.ts +30 -17
- package/src/features/extraConsoleCommands/listCommands.ts +2 -2
- package/src/features/persistentEntities.ts +19 -5
- package/src/features/pickupIndex.ts +9 -15
- package/src/features/roomHistory.ts +24 -4
- package/src/functions/log.ts +35 -30
- package/src/functions/npcs.ts +27 -2
- package/src/functions/playerHealth.ts +25 -12
- package/src/functions/rockAlt.ts +50 -132
- package/src/functions/saveFile.ts +146 -4
- package/src/index.ts +1 -2
- package/src/interfaces/{CustomGridEntityData.ts → GridEntityCustomData.ts} +1 -1
- package/src/interfaces/PlayerHealth.ts +12 -1
- package/src/interfaces/RoomDescription.ts +1 -0
- package/dist/functions/itemPool.d.ts +0 -10
- package/dist/functions/itemPool.d.ts.map +0 -1
- package/dist/functions/itemPool.lua +0 -116
- package/src/functions/itemPool.ts +0 -153
|
@@ -519,7 +519,7 @@ export declare enum ModCallbackCustom {
|
|
|
519
519
|
* - When registering the callback, takes an optional second argument that will make the callback
|
|
520
520
|
* only fire if it matches the `ItemType` provided.
|
|
521
521
|
* - When registering the callback, takes an optional third argument that will make the callback
|
|
522
|
-
* only fire if the `CollectibleType` or the `TrinketType` matches the
|
|
522
|
+
* only fire if the `CollectibleType` or the `TrinketType` matches the sub-type provided.
|
|
523
523
|
*
|
|
524
524
|
* ```ts
|
|
525
525
|
* function postItemPickup(
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { GridCollisionClass, GridEntityType } from "isaac-typescript-definitions";
|
|
2
|
-
import {
|
|
2
|
+
import { GridEntityCustomData } from "../interfaces/GridEntityCustomData";
|
|
3
3
|
/**
|
|
4
4
|
* Helper function to spawn a custom grid entity. Custom grid entities are persistent in that they
|
|
5
5
|
* will reappear if the player leaves and re-enters the room. (It will be manually respawned in the
|
|
@@ -46,13 +46,13 @@ export declare function spawnCustomGridEntity(gridEntityTypeCustom: GridEntityTy
|
|
|
46
46
|
* @returns The grid entity that was removed. Returns undefined if no grid entity was found at the
|
|
47
47
|
* given location or if the given grid entity was not a custom grid entity.
|
|
48
48
|
*/
|
|
49
|
-
export declare function
|
|
49
|
+
export declare function removeCustomGridEntity(gridIndexOrPositionOrGridEntity: int | Vector | GridEntity, updateRoom?: boolean): GridEntity | undefined;
|
|
50
50
|
/**
|
|
51
51
|
* Helper function to get the custom grid entities in the current room. Returns an array of tuples
|
|
52
52
|
* containing the raw decoration grid entity and the associated entity data.
|
|
53
53
|
*/
|
|
54
54
|
export declare function getCustomGridEntities(): Array<[
|
|
55
55
|
gridEntity: GridEntity,
|
|
56
|
-
data:
|
|
56
|
+
data: GridEntityCustomData
|
|
57
57
|
]>;
|
|
58
58
|
//# sourceMappingURL=customGridEntity.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customGridEntity.d.ts","sourceRoot":"","sources":["../../src/features/customGridEntity.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"customGridEntity.d.ts","sourceRoot":"","sources":["../../src/features/customGridEntity.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,kBAAkB,EAClB,cAAc,EAGf,MAAM,8BAA8B,CAAC;AAgBtC,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AA2K1E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,qBAAqB,CACnC,oBAAoB,EAAE,cAAc,EACpC,mBAAmB,EAAE,GAAG,GAAG,MAAM,EACjC,kBAAkB,EAAE,kBAAkB,EACtC,QAAQ,EAAE,MAAM,EAChB,gBAAgB,CAAC,EAAE,MAAM,EACzB,SAAS,UAAQ,GAChB,UAAU,CAyEZ;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,sBAAsB,CACpC,+BAA+B,EAAE,GAAG,GAAG,MAAM,GAAG,UAAU,EAC1D,UAAU,UAAO,GAChB,UAAU,GAAG,SAAS,CAqCxB;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,IAAI,KAAK,CAC5C;IAAC,UAAU,EAAE,UAAU;IAAE,IAAI,EAAE,oBAAoB;CAAC,CACrD,CAiBA"}
|
|
@@ -4,10 +4,11 @@ local __TS__New = ____lualib.__TS__New
|
|
|
4
4
|
local Set = ____lualib.Set
|
|
5
5
|
local __TS__Iterator = ____lualib.__TS__Iterator
|
|
6
6
|
local ____exports = {}
|
|
7
|
-
local
|
|
7
|
+
local entityTakeDmgGenericProp, preUseItemWeNeedToGoDeeper, postNewRoomReordered, v
|
|
8
8
|
local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
|
|
9
9
|
local CollectibleType = ____isaac_2Dtypescript_2Ddefinitions.CollectibleType
|
|
10
10
|
local DamageFlag = ____isaac_2Dtypescript_2Ddefinitions.DamageFlag
|
|
11
|
+
local EntityFlag = ____isaac_2Dtypescript_2Ddefinitions.EntityFlag
|
|
11
12
|
local EntityType = ____isaac_2Dtypescript_2Ddefinitions.EntityType
|
|
12
13
|
local GridCollisionClass = ____isaac_2Dtypescript_2Ddefinitions.GridCollisionClass
|
|
13
14
|
local GridEntityType = ____isaac_2Dtypescript_2Ddefinitions.GridEntityType
|
|
@@ -24,8 +25,8 @@ local ____ModCallbackCustom = require("enums.ModCallbackCustom")
|
|
|
24
25
|
local ModCallbackCustom = ____ModCallbackCustom.ModCallbackCustom
|
|
25
26
|
local ____featuresInitialized = require("featuresInitialized")
|
|
26
27
|
local errorIfFeaturesNotInitialized = ____featuresInitialized.errorIfFeaturesNotInitialized
|
|
27
|
-
local
|
|
28
|
-
local
|
|
28
|
+
local ____entities = require("functions.entities")
|
|
29
|
+
local spawn = ____entities.spawn
|
|
29
30
|
local ____flag = require("functions.flag")
|
|
30
31
|
local hasFlag = ____flag.hasFlag
|
|
31
32
|
local ____gridEntities = require("functions.gridEntities")
|
|
@@ -39,9 +40,9 @@ local ____runInNFrames = require("features.runInNFrames")
|
|
|
39
40
|
local runNextGameFrame = ____runInNFrames.runNextGameFrame
|
|
40
41
|
local ____exports = require("features.saveDataManager.exports")
|
|
41
42
|
local saveDataManager = ____exports.saveDataManager
|
|
42
|
-
function
|
|
43
|
+
function entityTakeDmgGenericProp(self, tookDamage, _damageAmount, damageFlags, _damageSource, _damageCountdownFrames)
|
|
43
44
|
local ptrHash = GetPtrHash(tookDamage)
|
|
44
|
-
if not v.room.
|
|
45
|
+
if not v.room.genericPropPtrHashes:has(ptrHash) then
|
|
45
46
|
return nil
|
|
46
47
|
end
|
|
47
48
|
if not hasFlag(nil, damageFlags, DamageFlag.EXPLOSION) then
|
|
@@ -125,13 +126,14 @@ function postNewRoomReordered(self)
|
|
|
125
126
|
end
|
|
126
127
|
end
|
|
127
128
|
local FEATURE_NAME = "customGridEntity"
|
|
129
|
+
local GENERIC_PROP_SIZE_MULTIPLIER = 0.66
|
|
128
130
|
v = {
|
|
129
131
|
level = {customGridEntities = __TS__New(
|
|
130
132
|
DefaultMap,
|
|
131
133
|
function() return __TS__New(Map) end
|
|
132
134
|
)},
|
|
133
135
|
room = {
|
|
134
|
-
|
|
136
|
+
genericPropPtrHashes = __TS__New(Set),
|
|
135
137
|
manuallyUsingShovel = false
|
|
136
138
|
}
|
|
137
139
|
}
|
|
@@ -139,7 +141,7 @@ v = {
|
|
|
139
141
|
-- @internal
|
|
140
142
|
function ____exports.customGridEntityInit(self, mod)
|
|
141
143
|
saveDataManager(nil, FEATURE_NAME, v)
|
|
142
|
-
mod:AddCallback(ModCallback.ENTITY_TAKE_DMG,
|
|
144
|
+
mod:AddCallback(ModCallback.ENTITY_TAKE_DMG, entityTakeDmgGenericProp, EntityType.GENERIC_PROP)
|
|
143
145
|
mod:AddCallback(ModCallback.PRE_USE_ITEM, preUseItemWeNeedToGoDeeper, CollectibleType.WE_NEED_TO_GO_DEEPER)
|
|
144
146
|
mod:AddCallbackCustom(ModCallbackCustom.POST_NEW_ROOM_REORDERED, postNewRoomReordered)
|
|
145
147
|
end
|
|
@@ -188,6 +190,7 @@ function ____exports.spawnCustomGridEntity(self, gridEntityTypeCustom, gridIndex
|
|
|
188
190
|
if decoration == nil then
|
|
189
191
|
error("Failed to spawn a decoration for a custom grid entity.")
|
|
190
192
|
end
|
|
193
|
+
decoration.CollisionClass = gridCollisionClass
|
|
191
194
|
local sprite = decoration:GetSprite()
|
|
192
195
|
sprite:Load(anm2Path, true)
|
|
193
196
|
local animationToPlay = defaultAnimation == nil and sprite:GetDefaultAnimation() or defaultAnimation
|
|
@@ -204,14 +207,18 @@ function ____exports.spawnCustomGridEntity(self, gridEntityTypeCustom, gridIndex
|
|
|
204
207
|
roomCustomGridEntities:set(gridIndex, customGridEntityData)
|
|
205
208
|
if breakable then
|
|
206
209
|
local position = room:GetGridPosition(gridIndex)
|
|
207
|
-
local
|
|
210
|
+
local entity = spawn(
|
|
208
211
|
nil,
|
|
209
|
-
EntityType.
|
|
212
|
+
EntityType.GENERIC_PROP,
|
|
210
213
|
0,
|
|
211
214
|
0,
|
|
212
215
|
position
|
|
213
216
|
)
|
|
214
|
-
|
|
217
|
+
entity:ClearEntityFlags(EntityFlag.APPEAR)
|
|
218
|
+
entity.Visible = false
|
|
219
|
+
entity.SizeMulti = Vector(GENERIC_PROP_SIZE_MULTIPLIER, GENERIC_PROP_SIZE_MULTIPLIER)
|
|
220
|
+
local ptrHash = GetPtrHash(entity)
|
|
221
|
+
v.room.genericPropPtrHashes:add(ptrHash)
|
|
215
222
|
end
|
|
216
223
|
return decoration
|
|
217
224
|
end
|
|
@@ -228,7 +235,7 @@ end
|
|
|
228
235
|
-- multiple times.
|
|
229
236
|
-- @returns The grid entity that was removed. Returns undefined if no grid entity was found at the
|
|
230
237
|
-- given location or if the given grid entity was not a custom grid entity.
|
|
231
|
-
function ____exports.
|
|
238
|
+
function ____exports.removeCustomGridEntity(self, gridIndexOrPositionOrGridEntity, updateRoom)
|
|
232
239
|
if updateRoom == nil then
|
|
233
240
|
updateRoom = true
|
|
234
241
|
end
|
|
@@ -53,7 +53,7 @@ local addFlag = ____flag.addFlag
|
|
|
53
53
|
local ____gridEntities = require("functions.gridEntities")
|
|
54
54
|
local spawnGridEntity = ____gridEntities.spawnGridEntity
|
|
55
55
|
local ____log = require("functions.log")
|
|
56
|
-
local
|
|
56
|
+
local logPlayerEffects = ____log.logPlayerEffects
|
|
57
57
|
local logRoom = ____log.logRoom
|
|
58
58
|
local logSeedEffects = ____log.logSeedEffects
|
|
59
59
|
local logSounds = ____log.logSounds
|
|
@@ -512,7 +512,7 @@ end
|
|
|
512
512
|
--- Logs the player's current temporary effects to the "log.txt" file.
|
|
513
513
|
function ____exports.effects(self)
|
|
514
514
|
local player = Isaac.GetPlayer()
|
|
515
|
-
|
|
515
|
+
logPlayerEffects(player)
|
|
516
516
|
printConsole(nil, "Logged the player's effects to the \"log.txt\" file.")
|
|
517
517
|
end
|
|
518
518
|
--- Alias for the "eternalHearts" command.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"persistentEntities.d.ts","sourceRoot":"","sources":["../../src/features/persistentEntities.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,UAAU,EAEX,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"persistentEntities.d.ts","sourceRoot":"","sources":["../../src/features/persistentEntities.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,UAAU,EAEX,MAAM,8BAA8B,CAAC;AAgHtC;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,qBAAqB,CACnC,UAAU,EAAE,UAAU,EACtB,OAAO,EAAE,GAAG,EACZ,OAAO,EAAE,GAAG,EACZ,QAAQ,EAAE,MAAM,GACf,CAAC,MAAM,EAAE,GAAG,CAAC,CAcf;AAwBD;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CACpC,qBAAqB,EAAE,GAAG,EAC1B,YAAY,UAAO,GAClB,IAAI,CAiBN"}
|
|
@@ -3,7 +3,7 @@ local Map = ____lualib.Map
|
|
|
3
3
|
local __TS__New = ____lualib.__TS__New
|
|
4
4
|
local __TS__Iterator = ____lualib.__TS__Iterator
|
|
5
5
|
local ____exports = {}
|
|
6
|
-
local postEntityRemove, postNewRoomReordered, spawnAndTrack, v
|
|
6
|
+
local postEntityRemove, checkDespawningFromPlayerLeavingRoom, trackDespawningPickupPosition, postNewRoomReordered, spawnAndTrack, v
|
|
7
7
|
local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
|
|
8
8
|
local EntityFlag = ____isaac_2Dtypescript_2Ddefinitions.EntityFlag
|
|
9
9
|
local ModCallback = ____isaac_2Dtypescript_2Ddefinitions.ModCallback
|
|
@@ -17,15 +17,25 @@ local ____roomData = require("functions.roomData")
|
|
|
17
17
|
local getRoomListIndex = ____roomData.getRoomListIndex
|
|
18
18
|
local ____roomHistory = require("features.roomHistory")
|
|
19
19
|
local getLatestRoomDescription = ____roomHistory.getLatestRoomDescription
|
|
20
|
+
local isLeavingRoom = ____roomHistory.isLeavingRoom
|
|
20
21
|
local ____exports = require("features.saveDataManager.exports")
|
|
21
22
|
local saveDataManager = ____exports.saveDataManager
|
|
22
23
|
function postEntityRemove(self, entity)
|
|
24
|
+
checkDespawningFromPlayerLeavingRoom(nil, entity)
|
|
25
|
+
end
|
|
26
|
+
function checkDespawningFromPlayerLeavingRoom(self, entity)
|
|
23
27
|
local ptrHash = GetPtrHash(entity)
|
|
24
28
|
local tuple = v.room.spawnedPersistentEntities:get(ptrHash)
|
|
25
29
|
if tuple == nil then
|
|
26
30
|
return
|
|
27
31
|
end
|
|
28
32
|
local index = tuple[1]
|
|
33
|
+
if not isLeavingRoom(nil) then
|
|
34
|
+
return
|
|
35
|
+
end
|
|
36
|
+
trackDespawningPickupPosition(nil, entity, index)
|
|
37
|
+
end
|
|
38
|
+
function trackDespawningPickupPosition(self, entity, index)
|
|
29
39
|
local previousRoomDescription = getLatestRoomDescription(nil)
|
|
30
40
|
local previousRoomListIndex = previousRoomDescription.roomListIndex
|
|
31
41
|
local persistentEntityDescription = {
|
|
@@ -44,7 +54,7 @@ function postNewRoomReordered(self)
|
|
|
44
54
|
local description = ____value[2]
|
|
45
55
|
do
|
|
46
56
|
if roomListIndex ~= description.roomListIndex then
|
|
47
|
-
goto
|
|
57
|
+
goto __continue9
|
|
48
58
|
end
|
|
49
59
|
v.level.persistentEntities:delete(index)
|
|
50
60
|
spawnAndTrack(
|
|
@@ -57,7 +67,7 @@ function postNewRoomReordered(self)
|
|
|
57
67
|
true
|
|
58
68
|
)
|
|
59
69
|
end
|
|
60
|
-
::
|
|
70
|
+
::__continue9::
|
|
61
71
|
end
|
|
62
72
|
end
|
|
63
73
|
function spawnAndTrack(self, entityType, variant, subType, position, index, respawning)
|
|
@@ -142,14 +152,14 @@ function ____exports.removePersistentEntity(self, persistentEntityIndex, removeE
|
|
|
142
152
|
do
|
|
143
153
|
local index, entityPtr = table.unpack(tuple)
|
|
144
154
|
if index ~= persistentEntityIndex then
|
|
145
|
-
goto
|
|
155
|
+
goto __continue16
|
|
146
156
|
end
|
|
147
157
|
v.room.spawnedPersistentEntities:delete(ptrHash)
|
|
148
158
|
if removeEntity and entityPtr.Ref ~= nil then
|
|
149
159
|
entityPtr.Ref:Remove()
|
|
150
160
|
end
|
|
151
161
|
end
|
|
152
|
-
::
|
|
162
|
+
::__continue16::
|
|
153
163
|
end
|
|
154
164
|
end
|
|
155
165
|
return ____exports
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pickupIndex.d.ts","sourceRoot":"","sources":["../../src/features/pickupIndex.ts"],"names":[],"mappings":";AAOA,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAQrD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"pickupIndex.d.ts","sourceRoot":"","sources":["../../src/features/pickupIndex.ts"],"names":[],"mappings":";AAOA,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAQrD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AA+BnD,wBAAgB,eAAe,CAAC,GAAG,EAAE,WAAW,GAAG,IAAI,CAatD;AAqKD;;;;;;;;;;;;GAYG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,YAAY,GAAG,WAAW,CAahE"}
|
|
@@ -28,6 +28,7 @@ local ____vector = require("functions.vector")
|
|
|
28
28
|
local vectorEquals = ____vector.vectorEquals
|
|
29
29
|
local ____roomHistory = require("features.roomHistory")
|
|
30
30
|
local getLatestRoomDescription = ____roomHistory.getLatestRoomDescription
|
|
31
|
+
local isLeavingRoom = ____roomHistory.isLeavingRoom
|
|
31
32
|
local ____exports = require("features.saveDataManager.exports")
|
|
32
33
|
local saveDataManager = ____exports.saveDataManager
|
|
33
34
|
function postPickupInit(self, pickup)
|
|
@@ -44,7 +45,6 @@ function postPickupInit(self, pickup)
|
|
|
44
45
|
local ____v_run_0, ____pickupCounter_1 = v.run, "pickupCounter"
|
|
45
46
|
____v_run_0[____pickupCounter_1] = ____v_run_0[____pickupCounter_1] + 1
|
|
46
47
|
v.room.pickupIndexes:set(ptrHash, v.run.pickupCounter)
|
|
47
|
-
v.run.currentRoomListIndex = getRoomListIndex(nil)
|
|
48
48
|
end
|
|
49
49
|
function postEntityRemovePickup(self, entity)
|
|
50
50
|
checkDespawningFromPlayerLeavingRoom(nil, entity)
|
|
@@ -55,8 +55,7 @@ function checkDespawningFromPlayerLeavingRoom(self, entity)
|
|
|
55
55
|
if pickupIndex == nil then
|
|
56
56
|
return
|
|
57
57
|
end
|
|
58
|
-
|
|
59
|
-
if roomListIndex == v.run.currentRoomListIndex then
|
|
58
|
+
if not isLeavingRoom(nil) then
|
|
60
59
|
return
|
|
61
60
|
end
|
|
62
61
|
trackDespawningPickupMetadata(nil, entity, pickupIndex)
|
|
@@ -109,8 +108,9 @@ function postNewRoomReordered(self)
|
|
|
109
108
|
pickupIndex = getPostAscentPickupIndex(nil, pickup)
|
|
110
109
|
end
|
|
111
110
|
if pickupIndex == nil then
|
|
112
|
-
local
|
|
113
|
-
|
|
111
|
+
local ____v_run_2, ____pickupCounter_3 = v.run, "pickupCounter"
|
|
112
|
+
____v_run_2[____pickupCounter_3] = ____v_run_2[____pickupCounter_3] + 1
|
|
113
|
+
pickupIndex = v.run.pickupCounter
|
|
114
114
|
end
|
|
115
115
|
local ptrHash = GetPtrHash(pickup)
|
|
116
116
|
v.room.pickupIndexes:set(ptrHash, pickupIndex)
|
|
@@ -157,7 +157,6 @@ local FEATURE_NAME = "pickupIndex"
|
|
|
157
157
|
v = {
|
|
158
158
|
run = {
|
|
159
159
|
pickupCounter = 0,
|
|
160
|
-
currentRoomListIndex = 0,
|
|
161
160
|
pickupDataTreasureRooms = __TS__New(Map),
|
|
162
161
|
pickupDataBossRooms = __TS__New(Map)
|
|
163
162
|
},
|
|
@@ -15,10 +15,17 @@ export declare function getPreviousRoomDescription(): RoomDescription;
|
|
|
15
15
|
* Helper function to get information about the most recent room that is stored in the room history
|
|
16
16
|
* array.
|
|
17
17
|
*
|
|
18
|
-
* This is useful in the `POST_ENTITY_REMOVE` callback
|
|
19
|
-
* player having left the room, the current room will have changed already, but the `POST_NEW_ROOM`
|
|
20
|
-
* callback will not have fired yet, and there will not be an entry in the room history array for
|
|
21
|
-
* the current room.
|
|
18
|
+
* This is useful in the `POST_ENTITY_REMOVE` callback; see the `isLeavingRoom` function.
|
|
22
19
|
*/
|
|
23
20
|
export declare function getLatestRoomDescription(): RoomDescription;
|
|
21
|
+
/**
|
|
22
|
+
* Helper function to detect if the game is in the state where the room index has changed to a new
|
|
23
|
+
* room, but the entities from the previous room are currently in the process of despawning. (At
|
|
24
|
+
* this point, the `POST_NEW_ROOM` callback will not have fired yet, and there will not be an entry
|
|
25
|
+
* in the room history array for the current room.)
|
|
26
|
+
*
|
|
27
|
+
* This function is intended to be used in the `POST_ENTITY_REMOVE` callback to detect when an
|
|
28
|
+
* entity is pseudo-persistent entity such as a pickup is despawning.
|
|
29
|
+
*/
|
|
30
|
+
export declare function isLeavingRoom(): boolean;
|
|
24
31
|
//# sourceMappingURL=roomHistory.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"roomHistory.d.ts","sourceRoot":"","sources":["../../src/features/roomHistory.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"roomHistory.d.ts","sourceRoot":"","sources":["../../src/features/roomHistory.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAmDhE;;;GAGG;AACH,wBAAgB,cAAc,IAAI,SAAS,eAAe,EAAE,CAG3D;AAED;;;;;GAKG;AACH,wBAAgB,0BAA0B,IAAI,eAAe,CAe5D;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,IAAI,eAAe,CAS1D;AAED;;;;;;;;GAQG;AACH,wBAAgB,aAAa,IAAI,OAAO,CASvC"}
|
|
@@ -15,6 +15,7 @@ local getRoomName = ____roomData.getRoomName
|
|
|
15
15
|
local getRoomStageID = ____roomData.getRoomStageID
|
|
16
16
|
local getRoomSubType = ____roomData.getRoomSubType
|
|
17
17
|
local getRoomVariant = ____roomData.getRoomVariant
|
|
18
|
+
local getRoomVisitedCount = ____roomData.getRoomVisitedCount
|
|
18
19
|
local ____exports = require("features.saveDataManager.exports")
|
|
19
20
|
local saveDataManager = ____exports.saveDataManager
|
|
20
21
|
function postNewRoomEarly(self)
|
|
@@ -29,6 +30,7 @@ function postNewRoomEarly(self)
|
|
|
29
30
|
local roomName = getRoomName(nil)
|
|
30
31
|
local roomGridIndex = getRoomGridIndex(nil)
|
|
31
32
|
local roomListIndex = getRoomListIndex(nil)
|
|
33
|
+
local roomVisitedCount = getRoomVisitedCount(nil)
|
|
32
34
|
local roomDescription = {
|
|
33
35
|
stage = stage,
|
|
34
36
|
stageType = stageType,
|
|
@@ -38,7 +40,8 @@ function postNewRoomEarly(self)
|
|
|
38
40
|
roomSubType = roomSubType,
|
|
39
41
|
roomName = roomName,
|
|
40
42
|
roomGridIndex = roomGridIndex,
|
|
41
|
-
roomListIndex = roomListIndex
|
|
43
|
+
roomListIndex = roomListIndex,
|
|
44
|
+
roomVisitedCount = roomVisitedCount
|
|
42
45
|
}
|
|
43
46
|
local ____v_run_roomHistory_0 = v.run.roomHistory
|
|
44
47
|
____v_run_roomHistory_0[#____v_run_roomHistory_0 + 1] = roomDescription
|
|
@@ -75,10 +78,7 @@ end
|
|
|
75
78
|
--- Helper function to get information about the most recent room that is stored in the room history
|
|
76
79
|
-- array.
|
|
77
80
|
--
|
|
78
|
-
-- This is useful in the `POST_ENTITY_REMOVE` callback
|
|
79
|
-
-- player having left the room, the current room will have changed already, but the `POST_NEW_ROOM`
|
|
80
|
-
-- callback will not have fired yet, and there will not be an entry in the room history array for
|
|
81
|
-
-- the current room.
|
|
81
|
+
-- This is useful in the `POST_ENTITY_REMOVE` callback; see the `isLeavingRoom` function.
|
|
82
82
|
function ____exports.getLatestRoomDescription(self)
|
|
83
83
|
local latestRoomDescription = getLastElement(nil, v.run.roomHistory)
|
|
84
84
|
if latestRoomDescription == nil then
|
|
@@ -86,4 +86,17 @@ function ____exports.getLatestRoomDescription(self)
|
|
|
86
86
|
end
|
|
87
87
|
return latestRoomDescription
|
|
88
88
|
end
|
|
89
|
+
--- Helper function to detect if the game is in the state where the room index has changed to a new
|
|
90
|
+
-- room, but the entities from the previous room are currently in the process of despawning. (At
|
|
91
|
+
-- this point, the `POST_NEW_ROOM` callback will not have fired yet, and there will not be an entry
|
|
92
|
+
-- in the room history array for the current room.)
|
|
93
|
+
--
|
|
94
|
+
-- This function is intended to be used in the `POST_ENTITY_REMOVE` callback to detect when an
|
|
95
|
+
-- entity is pseudo-persistent entity such as a pickup is despawning.
|
|
96
|
+
function ____exports.isLeavingRoom(self)
|
|
97
|
+
local roomListIndex = getRoomListIndex(nil)
|
|
98
|
+
local roomVisitedCount = getRoomVisitedCount(nil)
|
|
99
|
+
local latestRoomDescription = ____exports.getLatestRoomDescription(nil)
|
|
100
|
+
return roomListIndex ~= latestRoomDescription.roomListIndex or roomVisitedCount ~= latestRoomDescription.roomVisitedCount
|
|
101
|
+
end
|
|
89
102
|
return ____exports
|
package/dist/functions/log.d.ts
CHANGED
|
@@ -21,7 +21,6 @@ export declare function logArray<T>(this: void, array: T[] | readonly T[]): void
|
|
|
21
21
|
export declare function logColor(this: void, color: Color): void;
|
|
22
22
|
/** Helper function for printing out every damage flag that is turned on. Useful when debugging. */
|
|
23
23
|
export declare function logDamageFlags(this: void, flags: DamageFlag | BitFlags<DamageFlag>): void;
|
|
24
|
-
export declare function logEffects(this: void, player: EntityPlayer): void;
|
|
25
24
|
/** Helper function for logging an array of specific entities. */
|
|
26
25
|
export declare function logEntities(this: void, entities: Entity[]): void;
|
|
27
26
|
/** Helper function to log information about a specific entity. */
|
|
@@ -52,6 +51,7 @@ export declare function logKColor(this: void, kColor: KColor): void;
|
|
|
52
51
|
*/
|
|
53
52
|
export declare function logLevelStateFlags(this: void): void;
|
|
54
53
|
export declare function logMap(this: void, map: Map<AnyNotNil, unknown>): void;
|
|
54
|
+
export declare function logPlayerEffects(this: void, player: EntityPlayer): void;
|
|
55
55
|
export declare function logPlayerHealth(this: void, player: EntityPlayer): void;
|
|
56
56
|
/**
|
|
57
57
|
* Helper function for printing out every projectile flag that is turned on. Useful when debugging.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../src/functions/log.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,UAAU,EAEV,UAAU,EACV,UAAU,EAEV,cAAc,
|
|
1
|
+
{"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../src/functions/log.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,UAAU,EAEV,UAAU,EACV,UAAU,EAEV,cAAc,EAId,cAAc,EAGd,QAAQ,EACR,OAAO,EACR,MAAM,8BAA8B,CAAC;AA+BtC;;GAEG;AACH,wBAAgB,qBAAqB,CACnC,GAAG,EAAE,MAAM,EAKX,kBAAkB,SAAI,G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Ddefinitions.EntityFlag
|
|
|
16
16
|
local GameStateFlag = ____isaac_2Dtypescript_2Ddefinitions.GameStateFlag
|
|
17
17
|
local GridEntityType = ____isaac_2Dtypescript_2Ddefinitions.GridEntityType
|
|
18
18
|
local GridRoom = ____isaac_2Dtypescript_2Ddefinitions.GridRoom
|
|
19
|
+
local HeartSubType = ____isaac_2Dtypescript_2Ddefinitions.HeartSubType
|
|
19
20
|
local LevelStateFlag = ____isaac_2Dtypescript_2Ddefinitions.LevelStateFlag
|
|
20
21
|
local ProjectileFlag = ____isaac_2Dtypescript_2Ddefinitions.ProjectileFlag
|
|
21
22
|
local SeedEffect = ____isaac_2Dtypescript_2Ddefinitions.SeedEffect
|
|
@@ -311,32 +312,6 @@ end
|
|
|
311
312
|
function ____exports.logDamageFlags(flags)
|
|
312
313
|
____exports.logFlags(flags, DamageFlag, "damage")
|
|
313
314
|
end
|
|
314
|
-
function ____exports.logEffects(player)
|
|
315
|
-
local effects = getEffectsList(nil, player)
|
|
316
|
-
____exports.log("Logging player effects:")
|
|
317
|
-
if #effects == 0 then
|
|
318
|
-
____exports.log(" n/a (no effects)")
|
|
319
|
-
return
|
|
320
|
-
end
|
|
321
|
-
__TS__ArrayForEach(
|
|
322
|
-
effects,
|
|
323
|
-
function(____, effect, i)
|
|
324
|
-
local effectDescription
|
|
325
|
-
if effect.Item:IsCollectible() then
|
|
326
|
-
local collectibleName = getCollectibleName(nil, effect.Item.ID)
|
|
327
|
-
effectDescription = "Collectible: " .. collectibleName
|
|
328
|
-
elseif effect.Item:IsTrinket() then
|
|
329
|
-
local trinketName = getTrinketName(nil, effect.Item.ID)
|
|
330
|
-
effectDescription = "Trinket: " .. trinketName
|
|
331
|
-
elseif effect.Item:IsNull() then
|
|
332
|
-
effectDescription = "Null item: " .. tostring(effect.Item.ID)
|
|
333
|
-
else
|
|
334
|
-
effectDescription = "Unknown type of effect: " .. tostring(effect.Item.ID)
|
|
335
|
-
end
|
|
336
|
-
____exports.log((((((" " .. tostring(i + 1)) .. ") ") .. effectDescription) .. " (x") .. tostring(effect.Count)) .. ")")
|
|
337
|
-
end
|
|
338
|
-
)
|
|
339
|
-
end
|
|
340
315
|
--- Helper function for logging an array of specific entities.
|
|
341
316
|
function ____exports.logEntities(entities)
|
|
342
317
|
for ____, entity in ipairs(entities) do
|
|
@@ -416,6 +391,32 @@ function ____exports.logMap(map)
|
|
|
416
391
|
end
|
|
417
392
|
____exports.log(" The size of the map was: " .. tostring(map.size))
|
|
418
393
|
end
|
|
394
|
+
function ____exports.logPlayerEffects(player)
|
|
395
|
+
local effects = getEffectsList(nil, player)
|
|
396
|
+
____exports.log("Logging player effects:")
|
|
397
|
+
if #effects == 0 then
|
|
398
|
+
____exports.log(" n/a (no effects)")
|
|
399
|
+
return
|
|
400
|
+
end
|
|
401
|
+
__TS__ArrayForEach(
|
|
402
|
+
effects,
|
|
403
|
+
function(____, effect, i)
|
|
404
|
+
local effectDescription
|
|
405
|
+
if effect.Item:IsCollectible() then
|
|
406
|
+
local collectibleName = getCollectibleName(nil, effect.Item.ID)
|
|
407
|
+
effectDescription = "Collectible: " .. collectibleName
|
|
408
|
+
elseif effect.Item:IsTrinket() then
|
|
409
|
+
local trinketName = getTrinketName(nil, effect.Item.ID)
|
|
410
|
+
effectDescription = "Trinket: " .. trinketName
|
|
411
|
+
elseif effect.Item:IsNull() then
|
|
412
|
+
effectDescription = "Null item: " .. tostring(effect.Item.ID)
|
|
413
|
+
else
|
|
414
|
+
effectDescription = "Unknown type of effect: " .. tostring(effect.Item.ID)
|
|
415
|
+
end
|
|
416
|
+
____exports.log((((((" " .. tostring(i + 1)) .. ") ") .. effectDescription) .. " (x") .. tostring(effect.Count)) .. ")")
|
|
417
|
+
end
|
|
418
|
+
)
|
|
419
|
+
end
|
|
419
420
|
function ____exports.logPlayerHealth(player)
|
|
420
421
|
local playerName = getPlayerName(nil, player)
|
|
421
422
|
local playerHealth = getPlayerHealth(nil, player)
|
|
@@ -430,7 +431,11 @@ function ____exports.logPlayerHealth(player)
|
|
|
430
431
|
____exports.log(" Broken hearts: " .. tostring(playerHealth.brokenHearts))
|
|
431
432
|
____exports.log(" Soul charges: " .. tostring(playerHealth.soulCharges))
|
|
432
433
|
____exports.log(" Blood charges: " .. tostring(playerHealth.bloodCharges))
|
|
433
|
-
____exports.log(
|
|
434
|
+
____exports.log(" Soul heart types: [")
|
|
435
|
+
for ____, soulHeartType in ipairs(playerHealth.soulHeartTypes) do
|
|
436
|
+
____exports.log(" HeartSubType." .. tostring(HeartSubType[soulHeartType]))
|
|
437
|
+
end
|
|
438
|
+
____exports.log(" ]")
|
|
434
439
|
end
|
|
435
440
|
--- Helper function for printing out every projectile flag that is turned on. Useful when debugging.
|
|
436
441
|
function ____exports.logProjectileFlags(flags)
|
|
@@ -608,7 +613,6 @@ function ____exports.setLogFunctionsGlobal(self)
|
|
|
608
613
|
globals.logArray = ____exports.logArray
|
|
609
614
|
globals.logColor = ____exports.logColor
|
|
610
615
|
globals.logDamageFlags = ____exports.logDamageFlags
|
|
611
|
-
globals.logEffects = ____exports.logEffects
|
|
612
616
|
globals.logEntities = ____exports.logEntities
|
|
613
617
|
globals.logEntity = ____exports.logEntity
|
|
614
618
|
globals.logEntityID = ____exports.logEntityID
|
|
@@ -621,6 +625,7 @@ function ____exports.setLogFunctionsGlobal(self)
|
|
|
621
625
|
globals.logKColor = ____exports.logKColor
|
|
622
626
|
globals.logLevelStateFlags = ____exports.logLevelStateFlags
|
|
623
627
|
globals.logMap = ____exports.logMap
|
|
628
|
+
globals.logPlayerEffects = ____exports.logPlayerEffects
|
|
624
629
|
globals.logPlayerHealth = ____exports.logPlayerHealth
|
|
625
630
|
globals.logProjectileFlags = ____exports.logProjectileFlags
|
|
626
631
|
globals.logRoom = ____exports.logRoom
|
package/dist/functions/npcs.d.ts
CHANGED
|
@@ -19,6 +19,15 @@ export declare function getAliveNPCs(entityType?: EntityType, variant?: number,
|
|
|
19
19
|
* not actually keep the doors closed (like Death's scythes).
|
|
20
20
|
*/
|
|
21
21
|
export declare function isAliveExceptionNPC(npc: EntityNPC): boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Helper function to distinguish between a normal Daddy Long Legs / Triachnid and the child entity
|
|
24
|
+
* that is spawned when the boss does the multi-stomp attack.
|
|
25
|
+
*
|
|
26
|
+
* When this attack occurs, four extra copies of Daddy Long Legs will be spawned with the same
|
|
27
|
+
* entity type, variant, and sub-type. The `Entity.Parent` property will be undefined in this case,
|
|
28
|
+
* so the way to tell them apart is to check for a non-undefined `Entity.SpawnerEntity` property.
|
|
29
|
+
*/
|
|
30
|
+
export declare function isDaddyLongLegsChildStompEntity(npc: EntityNPC): boolean;
|
|
22
31
|
/**
|
|
23
32
|
* Helper function to detect the custom death state of an Eggy. Eggies are never actually marked
|
|
24
33
|
* dead by the game. Instead, when Eggies take fatal damage, they go into NpcState.STATE_SUICIDE and
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"npcs.d.ts","sourceRoot":"","sources":["../../src/functions/npcs.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,UAAU,
|
|
1
|
+
{"version":3,"file":"npcs.d.ts","sourceRoot":"","sources":["../../src/functions/npcs.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,UAAU,EASX,MAAM,8BAA8B,CAAC;AA+BtC;;;;;;;;;;;;;GAaG;AACH,wBAAgB,YAAY,CAC1B,UAAU,GAAE,UAAe,EAC3B,OAAO,SAAK,EACZ,OAAO,SAAK,EACZ,cAAc,UAAQ,GACrB,SAAS,EAAE,CAGb;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,SAAS,GAAG,OAAO,CA4B3D;AAED;;;;;;;GAOG;AACH,wBAAgB,+BAA+B,CAAC,GAAG,EAAE,SAAS,GAAG,OAAO,CAIvE;AAED;;;;GAIG;AACH,wBAAgB,4BAA4B,CAAC,GAAG,EAAE,SAAS,GAAG,OAAO,CAOpE;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,SAAS,GAAG,OAAO,CAO3D"}
|
package/dist/functions/npcs.lua
CHANGED
|
@@ -12,6 +12,7 @@ local ChargerVariant = ____isaac_2Dtypescript_2Ddefinitions.ChargerVariant
|
|
|
12
12
|
local DarkEsauVariant = ____isaac_2Dtypescript_2Ddefinitions.DarkEsauVariant
|
|
13
13
|
local DeathVariant = ____isaac_2Dtypescript_2Ddefinitions.DeathVariant
|
|
14
14
|
local EntityType = ____isaac_2Dtypescript_2Ddefinitions.EntityType
|
|
15
|
+
local HopperVariant = ____isaac_2Dtypescript_2Ddefinitions.HopperVariant
|
|
15
16
|
local MamaGurdyVariant = ____isaac_2Dtypescript_2Ddefinitions.MamaGurdyVariant
|
|
16
17
|
local MotherSubType = ____isaac_2Dtypescript_2Ddefinitions.MotherSubType
|
|
17
18
|
local MotherVariant = ____isaac_2Dtypescript_2Ddefinitions.MotherVariant
|
|
@@ -34,19 +35,31 @@ function ____exports.isAliveExceptionNPC(self, npc)
|
|
|
34
35
|
if NON_ALIVE_NPCS_TYPE_VARIANT_SUBTYPE:has(entityTypeVariantSubType) then
|
|
35
36
|
return true
|
|
36
37
|
end
|
|
37
|
-
if ____exports.
|
|
38
|
+
if ____exports.isDyingEggyWithNoSpidersLeft(nil, npc) then
|
|
38
39
|
return true
|
|
39
40
|
end
|
|
40
|
-
if ____exports.
|
|
41
|
+
if ____exports.isDaddyLongLegsChildStompEntity(nil, npc) then
|
|
42
|
+
return true
|
|
43
|
+
end
|
|
44
|
+
if ____exports.isRaglingDeathPatch(nil, npc) then
|
|
41
45
|
return true
|
|
42
46
|
end
|
|
43
47
|
return false
|
|
44
48
|
end
|
|
49
|
+
--- Helper function to distinguish between a normal Daddy Long Legs / Triachnid and the child entity
|
|
50
|
+
-- that is spawned when the boss does the multi-stomp attack.
|
|
51
|
+
--
|
|
52
|
+
-- When this attack occurs, four extra copies of Daddy Long Legs will be spawned with the same
|
|
53
|
+
-- entity type, variant, and sub-type. The `Entity.Parent` property will be undefined in this case,
|
|
54
|
+
-- so the way to tell them apart is to check for a non-undefined `Entity.SpawnerEntity` property.
|
|
55
|
+
function ____exports.isDaddyLongLegsChildStompEntity(self, npc)
|
|
56
|
+
return npc.Type == EntityType.DADDY_LONG_LEGS and npc.SpawnerEntity ~= nil
|
|
57
|
+
end
|
|
45
58
|
--- Helper function to detect the custom death state of an Eggy. Eggies are never actually marked
|
|
46
59
|
-- dead by the game. Instead, when Eggies take fatal damage, they go into NpcState.STATE_SUICIDE and
|
|
47
60
|
-- spawn 14 Swarm Spiders while their StateFrame ticks upwards.
|
|
48
61
|
function ____exports.isDyingEggyWithNoSpidersLeft(self, npc)
|
|
49
|
-
return npc.State == NpcState.SUICIDE and npc.StateFrame >= EGGY_STATE_FRAME_OF_FINAL_SPIDER
|
|
62
|
+
return npc.Type == EntityType.HOPPER and npc.Variant == HopperVariant.EGGY and npc.State == NpcState.SUICIDE and npc.StateFrame >= EGGY_STATE_FRAME_OF_FINAL_SPIDER
|
|
50
63
|
end
|
|
51
64
|
--- Helper function to detect the custom death state of a Rag Man Ragling. When Rag Man Raglings die,
|
|
52
65
|
-- they turn into a patch on the ground and can be revived by Rag Man at a later time. This causes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"playerHealth.d.ts","sourceRoot":"","sources":["../../src/functions/playerHealth.ts"],"names":[],"mappings":";;AAOA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,YAAY,
|
|
1
|
+
{"version":3,"file":"playerHealth.d.ts","sourceRoot":"","sources":["../../src/functions/playerHealth.ts"],"names":[],"mappings":";;AAOA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAiB,MAAM,4BAA4B,CAAC;AAWzE,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,YAAY,EACpB,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,GAAG,GACb,IAAI,CA+CN;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,YAAY,GAAG,YAAY,CA2ElE;AAED,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,YAAY,EACpB,UAAU,EAAE,UAAU,GACrB,GAAG,CAmDL;AAED,mDAAmD;AACnD,wBAAgB,eAAe,IAAI,YAAY,CAc9C;AAED,wBAAgB,oCAAoC,CAClD,MAAM,EAAE,YAAY,GACnB,IAAI,CAQN;AAED,wBAAgB,oCAAoC,CAClD,MAAM,EAAE,YAAY,GACnB,IAAI,CAQN;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAMjE;AAED,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI,CAwBhE;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,YAAY,EACpB,YAAY,EAAE,YAAY,GACzB,IAAI,CAyGN"}
|
|
@@ -69,21 +69,38 @@ function ____exports.setPlayerHealth(self, player, playerHealth)
|
|
|
69
69
|
local soulHeartsRemaining = playerHealth.soulHearts
|
|
70
70
|
__TS__ArrayForEach(
|
|
71
71
|
playerHealth.soulHeartTypes,
|
|
72
|
-
function(____,
|
|
72
|
+
function(____, soulHeartType, i)
|
|
73
73
|
local isHalf = playerHealth.soulHearts + playerHealth.boneHearts * 2 < (i + 1) * 2
|
|
74
74
|
local addAmount = 2
|
|
75
|
-
if isHalf or
|
|
75
|
+
if isHalf or soulHeartType == HeartSubType.BONE or soulHeartsRemaining < 2 then
|
|
76
76
|
addAmount = 1
|
|
77
77
|
end
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
78
|
+
repeat
|
|
79
|
+
local ____switch52 = soulHeartType
|
|
80
|
+
local ____cond52 = ____switch52 == HeartSubType.SOUL
|
|
81
|
+
if ____cond52 then
|
|
82
|
+
do
|
|
83
|
+
player:AddSoulHearts(addAmount)
|
|
84
|
+
soulHeartsRemaining = soulHeartsRemaining - addAmount
|
|
85
|
+
break
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
____cond52 = ____cond52 or ____switch52 == HeartSubType.BLACK
|
|
89
|
+
if ____cond52 then
|
|
90
|
+
do
|
|
91
|
+
player:AddBlackHearts(addAmount)
|
|
92
|
+
soulHeartsRemaining = soulHeartsRemaining - addAmount
|
|
93
|
+
break
|
|
94
|
+
end
|
|
95
|
+
end
|
|
96
|
+
____cond52 = ____cond52 or ____switch52 == HeartSubType.BONE
|
|
97
|
+
if ____cond52 then
|
|
98
|
+
do
|
|
99
|
+
player:AddBoneHearts(addAmount)
|
|
100
|
+
break
|
|
101
|
+
end
|
|
102
|
+
end
|
|
103
|
+
until true
|
|
87
104
|
end
|
|
88
105
|
)
|
|
89
106
|
player:AddRottenHearts(playerHealth.rottenHearts)
|
|
@@ -187,7 +204,6 @@ end
|
|
|
187
204
|
-- This is based on the `REVEL.StoreHealth` function in the Revelations mod.
|
|
188
205
|
function ____exports.getPlayerHealth(self, player)
|
|
189
206
|
local character = player:GetPlayerType()
|
|
190
|
-
local soulHeartTypes = {}
|
|
191
207
|
local maxHearts = player:GetMaxHearts()
|
|
192
208
|
local hearts = getPlayerHearts(nil, player)
|
|
193
209
|
local soulHearts = player:GetSoulHearts()
|
|
@@ -209,6 +225,7 @@ function ____exports.getPlayerHealth(self, player)
|
|
|
209
225
|
end
|
|
210
226
|
local extraHearts = math.ceil(soulHearts / 2) + boneHearts
|
|
211
227
|
local currentSoulHeart = 0
|
|
228
|
+
local soulHeartTypes = {}
|
|
212
229
|
do
|
|
213
230
|
local i = 0
|
|
214
231
|
while i < extraHearts do
|