isaacscript-common 17.0.0 → 17.0.1
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/index.d.ts +0 -1
- package/dist/isaacscript-common.lua +12 -14
- package/dist/src/classes/features/other/PersistentEntities.d.ts +0 -1
- package/dist/src/classes/features/other/PersistentEntities.d.ts.map +1 -1
- package/dist/src/classes/features/other/PersistentEntities.lua +11 -13
- package/package.json +1 -1
- package/src/classes/features/other/PersistentEntities.ts +8 -9
package/dist/index.d.ts
CHANGED
|
@@ -11387,7 +11387,6 @@ declare class Pause extends Feature {
|
|
|
11387
11387
|
declare class PersistentEntities extends Feature {
|
|
11388
11388
|
private roomHistory;
|
|
11389
11389
|
private postEntityRemove;
|
|
11390
|
-
private checkDespawningFromPlayerLeavingRoom;
|
|
11391
11390
|
/**
|
|
11392
11391
|
* The persistent entity is despawning because the player is in the process of leaving the room.
|
|
11393
11392
|
* Keep track of the position for later.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
--[[
|
|
2
2
|
|
|
3
|
-
isaacscript-common 17.0.
|
|
3
|
+
isaacscript-common 17.0.1
|
|
4
4
|
|
|
5
5
|
This is the "isaacscript-common" library, which was created with the IsaacScript tool.
|
|
6
6
|
|
|
@@ -46619,7 +46619,17 @@ function PersistentEntities.prototype.____constructor(self, roomHistory)
|
|
|
46619
46619
|
room = {spawnedPersistentEntities = __TS__New(Map)}
|
|
46620
46620
|
}
|
|
46621
46621
|
self.postEntityRemove = function(____, entity)
|
|
46622
|
-
|
|
46622
|
+
local ptrHash = GetPtrHash(entity)
|
|
46623
|
+
local tuple = self.v.room.spawnedPersistentEntities:get(ptrHash)
|
|
46624
|
+
if tuple == nil then
|
|
46625
|
+
return
|
|
46626
|
+
end
|
|
46627
|
+
local index = tuple[1]
|
|
46628
|
+
if self.roomHistory:isLeavingRoom() then
|
|
46629
|
+
self:trackDespawningPickupPosition(entity, index)
|
|
46630
|
+
else
|
|
46631
|
+
self:removePersistentEntity(index, false)
|
|
46632
|
+
end
|
|
46623
46633
|
end
|
|
46624
46634
|
self.postNewRoomReordered = function()
|
|
46625
46635
|
local roomListIndex = getRoomListIndex(nil)
|
|
@@ -46652,18 +46662,6 @@ function PersistentEntities.prototype.____constructor(self, roomHistory)
|
|
|
46652
46662
|
self.customCallbacksUsed = {{ModCallbackCustom.POST_NEW_ROOM_REORDERED, {self.postNewRoomReordered}}}
|
|
46653
46663
|
self.roomHistory = roomHistory
|
|
46654
46664
|
end
|
|
46655
|
-
function PersistentEntities.prototype.checkDespawningFromPlayerLeavingRoom(self, entity)
|
|
46656
|
-
local ptrHash = GetPtrHash(entity)
|
|
46657
|
-
local tuple = self.v.room.spawnedPersistentEntities:get(ptrHash)
|
|
46658
|
-
if tuple == nil then
|
|
46659
|
-
return
|
|
46660
|
-
end
|
|
46661
|
-
local index = tuple[1]
|
|
46662
|
-
if not self.roomHistory:isLeavingRoom() then
|
|
46663
|
-
return
|
|
46664
|
-
end
|
|
46665
|
-
self:trackDespawningPickupPosition(entity, index)
|
|
46666
|
-
end
|
|
46667
46665
|
function PersistentEntities.prototype.trackDespawningPickupPosition(self, entity, index)
|
|
46668
46666
|
local previousRoomDescription = self.roomHistory:getLatestRoomDescription()
|
|
46669
46667
|
if previousRoomDescription == nil then
|
|
@@ -3,7 +3,6 @@ import { Feature } from "../../private/Feature";
|
|
|
3
3
|
export declare class PersistentEntities extends Feature {
|
|
4
4
|
private roomHistory;
|
|
5
5
|
private postEntityRemove;
|
|
6
|
-
private checkDespawningFromPlayerLeavingRoom;
|
|
7
6
|
/**
|
|
8
7
|
* The persistent entity is despawning because the player is in the process of leaving the room.
|
|
9
8
|
* Keep track of the position for later.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PersistentEntities.d.ts","sourceRoot":"","sources":["../../../../../src/classes/features/other/PersistentEntities.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,UAAU,EAEX,MAAM,8BAA8B,CAAC;AAMtC,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAchD,qBAAa,kBAAmB,SAAQ,OAAO;IAuB7C,OAAO,CAAC,WAAW,CAAc;IAoBjC,OAAO,CAAC,gBAAgB,
|
|
1
|
+
{"version":3,"file":"PersistentEntities.d.ts","sourceRoot":"","sources":["../../../../../src/classes/features/other/PersistentEntities.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,UAAU,EAEX,MAAM,8BAA8B,CAAC;AAMtC,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAchD,qBAAa,kBAAmB,SAAQ,OAAO;IAuB7C,OAAO,CAAC,WAAW,CAAc;IAoBjC,OAAO,CAAC,gBAAgB,CAgBtB;IAEF;;;OAGG;IACH,OAAO,CAAC,6BAA6B;IAoBrC,OAAO,CAAC,oBAAoB,CAkB1B;IAEF,OAAO,CAAC,aAAa;IAsBrB;;;;;;;;;;;OAWG;IAEI,sBAAsB,CAC3B,qBAAqB,EAAE,GAAG,EAC1B,YAAY,UAAO,GAClB,IAAI;IAoBP;;;;;;;;;;;;;;;;;OAiBG;IAEI,qBAAqB,CAC1B,UAAU,EAAE,UAAU,EACtB,OAAO,EAAE,GAAG,EACZ,OAAO,EAAE,GAAG,EACZ,QAAQ,EAAE,MAAM,GACf,CAAC,MAAM,EAAE,GAAG,CAAC;CAajB"}
|
|
@@ -35,7 +35,17 @@ function PersistentEntities.prototype.____constructor(self, roomHistory)
|
|
|
35
35
|
room = {spawnedPersistentEntities = __TS__New(Map)}
|
|
36
36
|
}
|
|
37
37
|
self.postEntityRemove = function(____, entity)
|
|
38
|
-
|
|
38
|
+
local ptrHash = GetPtrHash(entity)
|
|
39
|
+
local tuple = self.v.room.spawnedPersistentEntities:get(ptrHash)
|
|
40
|
+
if tuple == nil then
|
|
41
|
+
return
|
|
42
|
+
end
|
|
43
|
+
local index = tuple[1]
|
|
44
|
+
if self.roomHistory:isLeavingRoom() then
|
|
45
|
+
self:trackDespawningPickupPosition(entity, index)
|
|
46
|
+
else
|
|
47
|
+
self:removePersistentEntity(index, false)
|
|
48
|
+
end
|
|
39
49
|
end
|
|
40
50
|
self.postNewRoomReordered = function()
|
|
41
51
|
local roomListIndex = getRoomListIndex(nil)
|
|
@@ -68,18 +78,6 @@ function PersistentEntities.prototype.____constructor(self, roomHistory)
|
|
|
68
78
|
self.customCallbacksUsed = {{ModCallbackCustom.POST_NEW_ROOM_REORDERED, {self.postNewRoomReordered}}}
|
|
69
79
|
self.roomHistory = roomHistory
|
|
70
80
|
end
|
|
71
|
-
function PersistentEntities.prototype.checkDespawningFromPlayerLeavingRoom(self, entity)
|
|
72
|
-
local ptrHash = GetPtrHash(entity)
|
|
73
|
-
local tuple = self.v.room.spawnedPersistentEntities:get(ptrHash)
|
|
74
|
-
if tuple == nil then
|
|
75
|
-
return
|
|
76
|
-
end
|
|
77
|
-
local index = tuple[1]
|
|
78
|
-
if not self.roomHistory:isLeavingRoom() then
|
|
79
|
-
return
|
|
80
|
-
end
|
|
81
|
-
self:trackDespawningPickupPosition(entity, index)
|
|
82
|
-
end
|
|
83
81
|
function PersistentEntities.prototype.trackDespawningPickupPosition(self, entity, index)
|
|
84
82
|
local previousRoomDescription = self.roomHistory:getLatestRoomDescription()
|
|
85
83
|
if previousRoomDescription == nil then
|
package/package.json
CHANGED
|
@@ -67,23 +67,22 @@ export class PersistentEntities extends Feature {
|
|
|
67
67
|
|
|
68
68
|
// ModCallback.POST_ENTITY_REMOVE (67)
|
|
69
69
|
private postEntityRemove = (entity: Entity) => {
|
|
70
|
-
this.checkDespawningFromPlayerLeavingRoom(entity);
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
private checkDespawningFromPlayerLeavingRoom(entity: Entity) {
|
|
74
70
|
const ptrHash = GetPtrHash(entity);
|
|
75
71
|
const tuple = this.v.room.spawnedPersistentEntities.get(ptrHash);
|
|
76
72
|
if (tuple === undefined) {
|
|
77
73
|
return;
|
|
78
74
|
}
|
|
75
|
+
|
|
76
|
+
// A persistent entity is being removed, either because it was killed / manually despawned, or
|
|
77
|
+
// the player left the room.
|
|
79
78
|
const index = tuple[0];
|
|
80
79
|
|
|
81
|
-
if (
|
|
82
|
-
|
|
80
|
+
if (this.roomHistory.isLeavingRoom()) {
|
|
81
|
+
this.trackDespawningPickupPosition(entity, index);
|
|
82
|
+
} else {
|
|
83
|
+
this.removePersistentEntity(index, false);
|
|
83
84
|
}
|
|
84
|
-
|
|
85
|
-
this.trackDespawningPickupPosition(entity, index);
|
|
86
|
-
}
|
|
85
|
+
};
|
|
87
86
|
|
|
88
87
|
/**
|
|
89
88
|
* The persistent entity is despawning because the player is in the process of leaving the room.
|