isaacscript-common 6.15.0 → 6.16.2

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.
Files changed (118) hide show
  1. package/dist/callbacks/postGridEntityCustomCollision.d.ts +2 -0
  2. package/dist/callbacks/postGridEntityCustomCollision.d.ts.map +1 -0
  3. package/dist/callbacks/postGridEntityCustomCollision.lua +71 -0
  4. package/dist/callbacks/postGridEntityCustomRender.lua +0 -7
  5. package/dist/callbacks/postGridEntityCustomUpdate.lua +0 -7
  6. package/dist/callbacks/subscriptions/postGridEntityCustomBroken.d.ts +6 -0
  7. package/dist/callbacks/subscriptions/postGridEntityCustomBroken.d.ts.map +1 -0
  8. package/dist/callbacks/subscriptions/postGridEntityCustomBroken.lua +24 -0
  9. package/dist/callbacks/subscriptions/postGridEntityCustomCollision.d.ts +6 -0
  10. package/dist/callbacks/subscriptions/postGridEntityCustomCollision.d.ts.map +1 -0
  11. package/dist/callbacks/subscriptions/postGridEntityCustomCollision.lua +29 -0
  12. package/dist/enums/ModCallbackCustom.d.ts +96 -62
  13. package/dist/enums/ModCallbackCustom.d.ts.map +1 -1
  14. package/dist/enums/ModCallbackCustom.lua +64 -60
  15. package/dist/features/customGridEntity.d.ts +5 -1
  16. package/dist/features/customGridEntity.d.ts.map +1 -1
  17. package/dist/features/customGridEntity.lua +65 -5
  18. package/dist/functions/color.d.ts +11 -15
  19. package/dist/functions/color.d.ts.map +1 -1
  20. package/dist/functions/color.lua +55 -74
  21. package/dist/functions/deepCopy.d.ts.map +1 -1
  22. package/dist/functions/deepCopy.lua +22 -1
  23. package/dist/functions/gridEntities.d.ts +0 -16
  24. package/dist/functions/gridEntities.d.ts.map +1 -1
  25. package/dist/functions/gridEntities.lua +0 -19
  26. package/dist/functions/isaacAPIClass.d.ts +1 -1
  27. package/dist/functions/isaacAPIClass.d.ts.map +1 -1
  28. package/dist/functions/kColor.d.ts +11 -15
  29. package/dist/functions/kColor.d.ts.map +1 -1
  30. package/dist/functions/kColor.lua +42 -61
  31. package/dist/functions/mergeTests.lua +2 -2
  32. package/dist/functions/npcs.d.ts +1 -29
  33. package/dist/functions/npcs.d.ts.map +1 -1
  34. package/dist/functions/npcs.lua +0 -45
  35. package/dist/functions/projectiles.d.ts +32 -0
  36. package/dist/functions/projectiles.d.ts.map +1 -0
  37. package/dist/functions/projectiles.lua +73 -0
  38. package/dist/functions/rng.d.ts +11 -15
  39. package/dist/functions/rng.d.ts.map +1 -1
  40. package/dist/functions/rng.lua +32 -52
  41. package/dist/functions/rockAlt.d.ts +27 -3
  42. package/dist/functions/rockAlt.d.ts.map +1 -1
  43. package/dist/functions/rockAlt.lua +113 -33
  44. package/dist/functions/saveFile.d.ts.map +1 -1
  45. package/dist/functions/saveFile.lua +3 -1
  46. package/dist/functions/serialization.d.ts +26 -7
  47. package/dist/functions/serialization.d.ts.map +1 -1
  48. package/dist/functions/serialization.lua +51 -19
  49. package/dist/functions/table.d.ts +2 -2
  50. package/dist/functions/table.lua +2 -2
  51. package/dist/functions/tstlClass.d.ts +1 -1
  52. package/dist/functions/tstlClass.d.ts.map +1 -1
  53. package/dist/functions/vector.d.ts +11 -15
  54. package/dist/functions/vector.d.ts.map +1 -1
  55. package/dist/functions/vector.lua +36 -55
  56. package/dist/index.d.ts +1 -0
  57. package/dist/index.d.ts.map +1 -1
  58. package/dist/index.lua +8 -0
  59. package/dist/initCustomCallbacks.d.ts.map +1 -1
  60. package/dist/initCustomCallbacks.lua +3 -0
  61. package/dist/interfaces/AddCallbackParameterCustom.d.ts +4 -0
  62. package/dist/interfaces/AddCallbackParameterCustom.d.ts.map +1 -1
  63. package/dist/objects/callbackRegisterFunctions.d.ts.map +1 -1
  64. package/dist/objects/callbackRegisterFunctions.lua +6 -0
  65. package/dist/objects/isaacAPIClassTypeToFunctions.d.ts +12 -0
  66. package/dist/objects/isaacAPIClassTypeToFunctions.d.ts.map +1 -0
  67. package/dist/objects/isaacAPIClassTypeToFunctions.lua +25 -0
  68. package/dist/types/{private/IsaacAPIClass.d.ts → IsaacAPIClass.d.ts} +0 -0
  69. package/dist/types/IsaacAPIClass.d.ts.map +1 -0
  70. package/dist/types/{private/IsaacAPIClass.lua → IsaacAPIClass.lua} +0 -0
  71. package/dist/types/{private/SerializedIsaacAPIClass.d.ts → SerializedIsaacAPIClass.d.ts} +0 -0
  72. package/dist/types/SerializedIsaacAPIClass.d.ts.map +1 -0
  73. package/dist/types/{private/SerializedIsaacAPIClass.lua → SerializedIsaacAPIClass.lua} +0 -0
  74. package/dist/types/{private/TSTLClass.d.ts → TSTLClass.d.ts} +0 -0
  75. package/dist/types/TSTLClass.d.ts.map +1 -0
  76. package/dist/types/{private/TSTLClass.lua → TSTLClass.lua} +0 -0
  77. package/package.json +2 -2
  78. package/src/callbacks/postGridEntityCustomCollision.ts +74 -0
  79. package/src/callbacks/postGridEntityCustomRender.ts +1 -17
  80. package/src/callbacks/postGridEntityCustomUpdate.ts +1 -17
  81. package/src/callbacks/subscriptions/postGridEntityCustomBroken.ts +36 -0
  82. package/src/callbacks/subscriptions/postGridEntityCustomCollision.ts +43 -0
  83. package/src/enums/ModCallbackCustom.ts +38 -2
  84. package/src/features/customGridEntity.ts +76 -0
  85. package/src/functions/color.ts +67 -87
  86. package/src/functions/deepCopy.ts +15 -2
  87. package/src/functions/gridEntities.ts +0 -23
  88. package/src/functions/isaacAPIClass.ts +1 -1
  89. package/src/functions/kColor.ts +65 -84
  90. package/src/functions/mergeTests.ts +2 -2
  91. package/src/functions/npcs.ts +1 -58
  92. package/src/functions/projectiles.ts +78 -0
  93. package/src/functions/rng.ts +45 -65
  94. package/src/functions/rockAlt.ts +127 -40
  95. package/src/functions/saveFile.ts +2 -1
  96. package/src/functions/serialization.ts +81 -25
  97. package/src/functions/table.ts +2 -2
  98. package/src/functions/tstlClass.ts +1 -1
  99. package/src/functions/vector.ts +55 -74
  100. package/src/index.ts +1 -0
  101. package/src/initCustomCallbacks.ts +2 -0
  102. package/src/interfaces/AddCallbackParameterCustom.ts +4 -0
  103. package/src/objects/callbackRegisterFunctions.ts +6 -0
  104. package/src/objects/isaacAPIClassTypeToFunctions.ts +63 -0
  105. package/src/types/{private/IsaacAPIClass.ts → IsaacAPIClass.ts} +0 -0
  106. package/src/types/{private/SerializedIsaacAPIClass.ts → SerializedIsaacAPIClass.ts} +0 -0
  107. package/src/types/{private/TSTLClass.ts → TSTLClass.ts} +0 -0
  108. package/dist/objects/isaacAPIClassTypeToCopyFunction.d.ts +0 -6
  109. package/dist/objects/isaacAPIClassTypeToCopyFunction.d.ts.map +0 -1
  110. package/dist/objects/isaacAPIClassTypeToCopyFunction.lua +0 -13
  111. package/dist/objects/serializedIsaacAPIClassTypeToIdentityFunction.d.ts +0 -5
  112. package/dist/objects/serializedIsaacAPIClassTypeToIdentityFunction.d.ts.map +0 -1
  113. package/dist/objects/serializedIsaacAPIClassTypeToIdentityFunction.lua +0 -13
  114. package/dist/types/private/IsaacAPIClass.d.ts.map +0 -1
  115. package/dist/types/private/SerializedIsaacAPIClass.d.ts.map +0 -1
  116. package/dist/types/private/TSTLClass.d.ts.map +0 -1
  117. package/src/objects/isaacAPIClassTypeToCopyFunction.ts +0 -18
  118. package/src/objects/serializedIsaacAPIClassTypeToIdentityFunction.ts +0 -14
@@ -22,8 +22,6 @@ local GRID_ENTITY_XML_MAP = ____gridEntityXMLMap.GRID_ENTITY_XML_MAP
22
22
  local ____roomShapeToTopLeftWallGridIndexMap = require("maps.roomShapeToTopLeftWallGridIndexMap")
23
23
  local DEFAULT_TOP_LEFT_WALL_GRID_INDEX = ____roomShapeToTopLeftWallGridIndexMap.DEFAULT_TOP_LEFT_WALL_GRID_INDEX
24
24
  local ROOM_SHAPE_TO_TOP_LEFT_WALL_GRID_INDEX_MAP = ____roomShapeToTopLeftWallGridIndexMap.ROOM_SHAPE_TO_TOP_LEFT_WALL_GRID_INDEX_MAP
25
- local ____backdropTypeToRockAltType = require("objects.backdropTypeToRockAltType")
26
- local BACKDROP_TYPE_TO_ROCK_ALT_TYPE = ____backdropTypeToRockAltType.BACKDROP_TYPE_TO_ROCK_ALT_TYPE
27
25
  local ____math = require("functions.math")
28
26
  local isCircleIntersectingRectangle = ____math.isCircleIntersectingRectangle
29
27
  local ____rooms = require("functions.rooms")
@@ -270,23 +268,6 @@ end
270
268
  function ____exports.getGridEntityIDFromConstituents(self, gridEntityType, variant)
271
269
  return (tostring(gridEntityType) .. ".") .. tostring(variant)
272
270
  end
273
- --- Helper function to get the alternate rock type (i.e. urn, mushroom, etc.) that the current room
274
- -- will have.
275
- --
276
- -- The rock type is based on the backdrop of the room.
277
- --
278
- -- For example, if you change the backdrop of the starting room of the run to `BackdropType.CAVES`,
279
- -- and then spawn `GridEntityType.ROCK_ALT`, it will be a mushroom instead of an urn. Additionally,
280
- -- if it is destroyed, it will generate mushroom-appropriate rewards.
281
- --
282
- -- On the other hand, if an urn is spawned first before the backdrop is changed to
283
- -- `BackdropType.CAVES`, the graphic of the urn will not switch to a mushroom. However, when
284
- -- destroyed, the urn will still generate mushroom-appropriate rewards.
285
- function ____exports.getRockAltType(self)
286
- local room = game:GetRoom()
287
- local backdropType = room:GetBackdropType()
288
- return BACKDROP_TYPE_TO_ROCK_ALT_TYPE[backdropType]
289
- end
290
271
  function ____exports.getSurroundingGridEntities(self, gridEntity)
291
272
  local room = game:GetRoom()
292
273
  local gridWidth = room:GetGridWidth()
@@ -17,7 +17,7 @@
17
17
  /// <reference types="isaac-typescript-definitions" />
18
18
  /// <reference types="isaac-typescript-definitions" />
19
19
  /// <reference types="isaac-typescript-definitions" />
20
- import { IsaacAPIClass } from "../types/private/IsaacAPIClass";
20
+ import { IsaacAPIClass } from "../types/IsaacAPIClass";
21
21
  /**
22
22
  * Helper function to get the name of a class from the Isaac API. This is contained within the
23
23
  * "__type" metatable key.
@@ -1 +1 @@
1
- {"version":3,"file":"isaacAPIClass.d.ts","sourceRoot":"","sources":["../../src/functions/isaacAPIClass.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;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,CAAC,QAAQ,EAAE,OAAO,GAAG,QAAQ,IAAI,YAAY,CAEpE;AAED,2EAA2E;AAC3E,wBAAgB,MAAM,CAAC,QAAQ,EAAE,OAAO,GAAG,QAAQ,IAAI,cAAc,CAEpE;AAED,oFAAoF;AACpF,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,OAAO,GAChB,QAAQ,IAAI,uBAAuB,CAErC;AAED,6EAA6E;AAC7E,wBAAgB,YAAY,CAAC,QAAQ,EAAE,OAAO,GAAG,QAAQ,IAAI,gBAAgB,CAE5E;AAED,2EAA2E;AAC3E,wBAAgB,MAAM,CAAC,QAAQ,EAAE,OAAO,GAAG,QAAQ,IAAI,cAAc,CAEpE;AAED,6EAA6E;AAC7E,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,OAAO,GAAG,QAAQ,IAAI,gBAAgB,CAExE;AAED,0EAA0E;AAC1E,wBAAgB,KAAK,CAAC,QAAQ,EAAE,OAAO,GAAG,QAAQ,IAAI,aAAa,CAElE;AAED,uEAAuE;AACvE,wBAAgB,MAAM,CAAC,QAAQ,EAAE,OAAO,GAAG,QAAQ,IAAI,UAAU,CAEhE;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,MAAM,EAAE,GACb,OAAO,CAKT"}
@@ -2,24 +2,16 @@
2
2
  /// <reference types="isaac-typescript-definitions" />
3
3
  /// <reference types="isaac-typescript-definitions" />
4
4
  /// <reference types="isaac-typescript-definitions" />
5
- import { SerializationType } from "../enums/SerializationType";
6
- declare type SerializedKColor = LuaMap<string, unknown> & {
5
+ export declare type SerializedKColor = LuaMap<string, unknown> & {
7
6
  readonly __serializedKColorBrand: symbol;
8
7
  };
9
- interface CopyKColorReturn {
10
- [SerializationType.NONE]: KColor;
11
- [SerializationType.SERIALIZE]: SerializedKColor;
12
- [SerializationType.DESERIALIZE]: KColor;
13
- }
8
+ /** Helper function to copy a `KColor` Isaac API class. */
9
+ export declare function copyKColor(kColor: KColor): KColor;
14
10
  /**
15
- * Helper function to copy a `KColor` object.
16
- *
17
- * @param kColor The KColor object to copy. In the case of deserialization, this will actually be a
18
- * Lua table instead of an instantiated KColor class.
19
- * @param serializationType Default is `SerializationType.NONE`.
11
+ * Helper function to convert a `SerializedKColor` object to a normal `KColor` object. (This is used
12
+ * by the save data manager when reading data from the "save#.dat" file.)
20
13
  */
21
- export declare function copyKColor<K extends KColor | SerializedKColor, S extends SerializationType>(kColor: K, serializationType: S): CopyKColorReturn[S];
22
- export declare function copyKColor<K extends KColor | SerializedKColor>(kColor: K): CopyKColorReturn[SerializationType.NONE];
14
+ export declare function deserializeKColor(kColor: SerializedKColor): KColor;
23
15
  /**
24
16
  * Helper function to get a random color.
25
17
  *
@@ -36,5 +28,9 @@ export declare function isKColor(object: unknown): object is KColor;
36
28
  */
37
29
  export declare function isSerializedKColor(object: unknown): object is SerializedKColor;
38
30
  export declare function kColorEquals(kColor1: KColor, kColor2: KColor): boolean;
39
- export {};
31
+ /**
32
+ * Helper function to convert a `KColor` object to a `SerializedKColor` object. (This is used by the
33
+ * save data manager when writing data from the "save#.dat" file.)
34
+ */
35
+ export declare function serializeKColor(kColor: KColor): SerializedKColor;
40
36
  //# sourceMappingURL=kColor.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"kColor.d.ts","sourceRoot":"","sources":["../../src/functions/kColor.ts"],"names":[],"mappings":";;;;AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAO/D,aAAK,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG;IAChD,QAAQ,CAAC,uBAAuB,EAAE,MAAM,CAAC;CAC1C,CAAC;AAEF,UAAU,gBAAgB;IACxB,CAAC,iBAAiB,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACjC,CAAC,iBAAiB,CAAC,SAAS,CAAC,EAAE,gBAAgB,CAAC;IAChD,CAAC,iBA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CAQR;AAED,8EAA8E;AAC9E,wBAAgB,QAAQ,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,IAAI,MAAM,CAE1D;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,OAAO,GACd,MAAM,IAAI,gBAAgB,CAQ5B;AAED,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAEtE;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,gBAAgB,CAWhE"}
@@ -2,8 +2,6 @@ local ____exports = {}
2
2
  local OBJECT_NAME
3
3
  local ____SerializationBrand = require("enums.private.SerializationBrand")
4
4
  local SerializationBrand = ____SerializationBrand.SerializationBrand
5
- local ____SerializationType = require("enums.SerializationType")
6
- local SerializationType = ____SerializationType.SerializationType
7
5
  local ____isaacAPIClass = require("functions.isaacAPIClass")
8
6
  local isaacAPIClassEquals = ____isaacAPIClass.isaacAPIClassEquals
9
7
  local isIsaacAPIClassOfType = ____isaacAPIClass.isIsaacAPIClassOfType
@@ -25,66 +23,38 @@ function ____exports.isKColor(self, object)
25
23
  end
26
24
  local KEYS = {"Red", "Green", "Blue", "Alpha"}
27
25
  OBJECT_NAME = "KColor"
28
- --- Helper function to copy a `KColor` object.
29
- --
30
- -- @param kColor The KColor object to copy. In the case of deserialization, this will actually be a
31
- -- Lua table instead of an instantiated KColor class.
32
- -- @param serializationType Default is `SerializationType.NONE`.
33
- function ____exports.copyKColor(self, kColor, serializationType)
34
- if serializationType == nil then
35
- serializationType = SerializationType.NONE
26
+ --- Helper function to copy a `KColor` Isaac API class.
27
+ function ____exports.copyKColor(self, kColor)
28
+ if not ____exports.isKColor(nil, kColor) then
29
+ error(((("Failed to copy a " .. OBJECT_NAME) .. " object since the provided object was not a userdata ") .. OBJECT_NAME) .. " class.")
36
30
  end
37
- repeat
38
- local ____switch3 = serializationType
39
- local ____cond3 = ____switch3 == SerializationType.NONE
40
- if ____cond3 then
41
- do
42
- if not ____exports.isKColor(nil, kColor) then
43
- error(((("Failed to copy a " .. OBJECT_NAME) .. " object since the provided object was not a userdata ") .. OBJECT_NAME) .. " class.")
44
- end
45
- return KColor(kColor.Red, kColor.Green, kColor.Blue, kColor.Alpha)
46
- end
47
- end
48
- ____cond3 = ____cond3 or ____switch3 == SerializationType.SERIALIZE
49
- if ____cond3 then
50
- do
51
- if not ____exports.isKColor(nil, kColor) then
52
- error(((("Failed to serialize a " .. OBJECT_NAME) .. " object since the provided object was not a userdata ") .. OBJECT_NAME) .. " class.")
53
- end
54
- local kColorTable = {}
55
- copyValuesToTable(nil, kColor, KEYS, kColorTable)
56
- kColorTable[SerializationBrand.K_COLOR] = ""
57
- return kColorTable
58
- end
59
- end
60
- ____cond3 = ____cond3 or ____switch3 == SerializationType.DESERIALIZE
61
- if ____cond3 then
62
- do
63
- if not isTable(nil, kColor) then
64
- error(("Failed to deserialize a " .. OBJECT_NAME) .. " object since the provided object was not a Lua table.")
65
- end
66
- local r, g, b, a = table.unpack(getNumbersFromTable(
67
- nil,
68
- kColor,
69
- OBJECT_NAME,
70
- table.unpack(KEYS)
71
- ))
72
- if r == nil then
73
- error(("Failed to deserialize a " .. OBJECT_NAME) .. " object since the provided object did not have a value for: r")
74
- end
75
- if g == nil then
76
- error(("Failed to deserialize a " .. OBJECT_NAME) .. " object since the provided object did not have a value for: g")
77
- end
78
- if b == nil then
79
- error(("Failed to deserialize a " .. OBJECT_NAME) .. " object since the provided object did not have a value for: b")
80
- end
81
- if a == nil then
82
- error(("Failed to deserialize a " .. OBJECT_NAME) .. " object since the provided object did not have a value for: a")
83
- end
84
- return KColor(r, g, b, a)
85
- end
86
- end
87
- until true
31
+ return KColor(kColor.Red, kColor.Green, kColor.Blue, kColor.Alpha)
32
+ end
33
+ --- Helper function to convert a `SerializedKColor` object to a normal `KColor` object. (This is used
34
+ -- by the save data manager when reading data from the "save#.dat" file.)
35
+ function ____exports.deserializeKColor(self, kColor)
36
+ if not isTable(nil, kColor) then
37
+ error(("Failed to deserialize a " .. OBJECT_NAME) .. " object since the provided object was not a Lua table.")
38
+ end
39
+ local r, g, b, a = table.unpack(getNumbersFromTable(
40
+ nil,
41
+ kColor,
42
+ OBJECT_NAME,
43
+ table.unpack(KEYS)
44
+ ))
45
+ if r == nil then
46
+ error(("Failed to deserialize a " .. OBJECT_NAME) .. " object since the provided object did not have a value for: Red")
47
+ end
48
+ if g == nil then
49
+ error(("Failed to deserialize a " .. OBJECT_NAME) .. " object since the provided object did not have a value for: Green")
50
+ end
51
+ if b == nil then
52
+ error(("Failed to deserialize a " .. OBJECT_NAME) .. " object since the provided object did not have a value for: Blue")
53
+ end
54
+ if a == nil then
55
+ error(("Failed to deserialize a " .. OBJECT_NAME) .. " object since the provided object did not have a value for: Alpha")
56
+ end
57
+ return KColor(r, g, b, a)
88
58
  end
89
59
  --- Helper function to get a random color.
90
60
  --
@@ -119,4 +89,15 @@ end
119
89
  function ____exports.kColorEquals(self, kColor1, kColor2)
120
90
  return isaacAPIClassEquals(nil, kColor1, kColor2, KEYS)
121
91
  end
92
+ --- Helper function to convert a `KColor` object to a `SerializedKColor` object. (This is used by the
93
+ -- save data manager when writing data from the "save#.dat" file.)
94
+ function ____exports.serializeKColor(self, kColor)
95
+ if not ____exports.isKColor(nil, kColor) then
96
+ error(((("Failed to serialize a " .. OBJECT_NAME) .. " object since the provided object was not a userdata ") .. OBJECT_NAME) .. " class.")
97
+ end
98
+ local kColorTable = {}
99
+ copyValuesToTable(nil, kColor, KEYS, kColorTable)
100
+ kColorTable[SerializationBrand.K_COLOR] = ""
101
+ return kColorTable
102
+ end
122
103
  return ____exports
@@ -19,8 +19,8 @@ local newRNG = ____rng.newRNG
19
19
  local ____serialization = require("functions.serialization")
20
20
  local isSerializedIsaacAPIClass = ____serialization.isSerializedIsaacAPIClass
21
21
  local ____vector = require("functions.vector")
22
- local copyVector = ____vector.copyVector
23
22
  local isVector = ____vector.isVector
23
+ local serializeVector = ____vector.serializeVector
24
24
  function oldTableHasUpdatedValue(self)
25
25
  local key = "foo"
26
26
  local oldValue = "bar"
@@ -60,7 +60,7 @@ function oldTableHasSerializedIsaacAPIClass(self)
60
60
  local x = 50
61
61
  local y = 60
62
62
  local vector = Vector(x, y)
63
- local vectorSerialized = copyVector(nil, vector, SerializationType.SERIALIZE)
63
+ local vectorSerialized = serializeVector(nil, vector)
64
64
  if not isSerializedIsaacAPIClass(nil, vectorSerialized) then
65
65
  error("The \"isSerializedIsaacAPIClass\" function says that a serialized vector is not serialized.")
66
66
  end
@@ -1,18 +1,4 @@
1
- import { EntityType, ProjectilesMode } from "isaac-typescript-definitions";
2
- /**
3
- * Helper function to make an NPC fire a projectile. Returns the fired projectile. Use this function
4
- * instead of the `EntityNPC.FireProjectiles` method, since that returns void.
5
- *
6
- * @param npc The NPC to fire the projectile from.
7
- * @param position The staring position of the projectile.
8
- * @param velocity The starting velocity of the projectile.
9
- * @param projectilesMode The mode of the projectile. Optional. Default is
10
- * `ProjectilesMode.ONE_PROJECTILE`.
11
- * @param projectileParams The parameters of the projectile. Optional. Default is
12
- * `ProjectileParams()`.
13
- * @returns The fired projectile.
14
- */
15
- export declare function fireProjectiles(npc: EntityNPC, position: Vector, velocity: Vector, projectilesMode?: ProjectilesMode, projectileParams?: ProjectileParams): EntityProjectile[];
1
+ import { EntityType } from "isaac-typescript-definitions";
16
2
  /**
17
3
  * Helper function to get all of the non-dead NPCs in the room.
18
4
  *
@@ -46,18 +32,4 @@ export declare function isDyingEggyWithNoSpidersLeft(npc: EntityNPC): boolean;
46
32
  * enemies.
47
33
  */
48
34
  export declare function isRaglingDeathPatch(npc: EntityNPC): boolean;
49
- /**
50
- * The base game `EntityNPC.FireProjectiles` method does not return anything, which is a problem in
51
- * situations where you need to work with the fired projectiles. This function runs that method, and
52
- * then returns the projectiles that were spawned.
53
- *
54
- * @param npc The EntityNPC firing projectiles.
55
- * @param position The starting position of the projectiles.
56
- * @param velocity The starting velocity of the projectiles.
57
- * @param projectilesMode A ProjectilesMode enum value defining how to fire the projectiles.
58
- * @param projectileParams A ProjectileParams object containing various parameters for the
59
- * projectiles.
60
- * @returns An array of EntityProjectiles containing all fired projectiles.
61
- */
62
- export declare function npcFireProjectiles(npc: EntityNPC, position: Vector, velocity: Vector, projectilesMode: ProjectilesMode, projectileParams: ProjectileParams): EntityProjectile[];
63
35
  //# sourceMappingURL=npcs.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"npcs.d.ts","sourceRoot":"","sources":["../../src/functions/npcs.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,UAAU,EAMV,eAAe,EAGhB,MAAM,8BAA8B,CAAC;AAgCtC;;;;;;;;;;;;GAYG;AACH,wBAAgB,eAAe,CAC7B,GAAG,EAAE,SAAS,EACd,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,eAAe,GAAE,eAAgD,EACjE,gBAAgB,GAAE,gBAAqC,GACtD,gBAAgB,EAAE,CAMpB;AAED;;;;;;;;;;;;;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,CAoB3D;AAED;;;;GAIG;AACH,wBAAgB,4BAA4B,CAAC,GAAG,EAAE,SAAS,GAAG,OAAO,CAKpE;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,SAAS,GAAG,OAAO,CAO3D;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,kBAAkB,CAChC,GAAG,EAAE,SAAS,EACd,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,eAAe,EAAE,eAAe,EAChC,gBAAgB,EAAE,gBAAgB,GACjC,gBAAgB,EAAE,CAOpB"}
1
+ {"version":3,"file":"npcs.d.ts","sourceRoot":"","sources":["../../src/functions/npcs.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,UAAU,EAQX,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,CAoB3D;AAED;;;;GAIG;AACH,wBAAgB,4BAA4B,CAAC,GAAG,EAAE,SAAS,GAAG,OAAO,CAKpE;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,SAAS,GAAG,OAAO,CAO3D"}
@@ -17,16 +17,12 @@ local MotherSubType = ____isaac_2Dtypescript_2Ddefinitions.MotherSubType
17
17
  local MotherVariant = ____isaac_2Dtypescript_2Ddefinitions.MotherVariant
18
18
  local NpcState = ____isaac_2Dtypescript_2Ddefinitions.NpcState
19
19
  local PeepVariant = ____isaac_2Dtypescript_2Ddefinitions.PeepVariant
20
- local ProjectilesMode = ____isaac_2Dtypescript_2Ddefinitions.ProjectilesMode
21
20
  local RaglingVariant = ____isaac_2Dtypescript_2Ddefinitions.RaglingVariant
22
21
  local VisVariant = ____isaac_2Dtypescript_2Ddefinitions.VisVariant
23
22
  local ____constants = require("constants")
24
23
  local EGGY_STATE_FRAME_OF_FINAL_SPIDER = ____constants.EGGY_STATE_FRAME_OF_FINAL_SPIDER
25
- local ____entities = require("functions.entities")
26
- local getFilteredNewEntities = ____entities.getFilteredNewEntities
27
24
  local ____entitiesSpecific = require("functions.entitiesSpecific")
28
25
  local getNPCs = ____entitiesSpecific.getNPCs
29
- local getProjectiles = ____entitiesSpecific.getProjectiles
30
26
  --- Checks for specific NPCs that have "CanShutDoors" set to true naturally by the game, but should
31
27
  -- not actually keep the doors closed (like Death's scythes).
32
28
  function ____exports.isAliveExceptionNPC(self, npc)
@@ -82,29 +78,6 @@ NON_ALIVE_NPCS_TYPE_VARIANT_SUBTYPE = __TS__New(
82
78
  (((tostring(EntityType.MOTHER) .. ".") .. tostring(MotherVariant.MOTHER_1)) .. ".") .. tostring(MotherSubType.PHASE_2)
83
79
  }
84
80
  )
85
- --- Helper function to make an NPC fire a projectile. Returns the fired projectile. Use this function
86
- -- instead of the `EntityNPC.FireProjectiles` method, since that returns void.
87
- --
88
- -- @param npc The NPC to fire the projectile from.
89
- -- @param position The staring position of the projectile.
90
- -- @param velocity The starting velocity of the projectile.
91
- -- @param projectilesMode The mode of the projectile. Optional. Default is
92
- -- `ProjectilesMode.ONE_PROJECTILE`.
93
- -- @param projectileParams The parameters of the projectile. Optional. Default is
94
- -- `ProjectileParams()`.
95
- -- @returns The fired projectile.
96
- function ____exports.fireProjectiles(self, npc, position, velocity, projectilesMode, projectileParams)
97
- if projectilesMode == nil then
98
- projectilesMode = ProjectilesMode.ONE_PROJECTILE
99
- end
100
- if projectileParams == nil then
101
- projectileParams = ProjectileParams()
102
- end
103
- local oldProjectiles = getProjectiles(nil, projectileParams.Variant)
104
- npc:FireProjectiles(position, velocity, projectilesMode, projectileParams)
105
- local newProjectiles = getProjectiles(nil, projectileParams.Variant)
106
- return getFilteredNewEntities(nil, oldProjectiles, newProjectiles)
107
- end
108
81
  --- Helper function to get all of the non-dead NPCs in the room.
109
82
  --
110
83
  -- This function will not include NPCs on an internal blacklist, such as Death's scythes or Big Horn
@@ -142,22 +115,4 @@ function ____exports.getAliveNPCs(self, entityType, variant, subType, ignoreFrie
142
115
  function(____, npc) return not npc:IsDead() and not ____exports.isAliveExceptionNPC(nil, npc) end
143
116
  )
144
117
  end
145
- --- The base game `EntityNPC.FireProjectiles` method does not return anything, which is a problem in
146
- -- situations where you need to work with the fired projectiles. This function runs that method, and
147
- -- then returns the projectiles that were spawned.
148
- --
149
- -- @param npc The EntityNPC firing projectiles.
150
- -- @param position The starting position of the projectiles.
151
- -- @param velocity The starting velocity of the projectiles.
152
- -- @param projectilesMode A ProjectilesMode enum value defining how to fire the projectiles.
153
- -- @param projectileParams A ProjectileParams object containing various parameters for the
154
- -- projectiles.
155
- -- @returns An array of EntityProjectiles containing all fired projectiles.
156
- function ____exports.npcFireProjectiles(self, npc, position, velocity, projectilesMode, projectileParams)
157
- local oldEntities = getProjectiles(nil)
158
- npc:FireProjectiles(position, velocity, projectilesMode, projectileParams)
159
- local newEntities = getProjectiles(nil)
160
- local filteredNewEntities = getFilteredNewEntities(nil, oldEntities, newEntities)
161
- return filteredNewEntities
162
- end
163
118
  return ____exports
@@ -0,0 +1,32 @@
1
+ import { ProjectilesMode } from "isaac-typescript-definitions";
2
+ /**
3
+ * Helper function to make an NPC fire one or more projectiles. Returns the fired projectile(s).
4
+ *
5
+ * Use this function instead of the `EntityNPC.FireProjectiles` method if you need to modify or
6
+ * access the `EntityProjectile` objects after they are fired, since this function returns the
7
+ * objects in an array.
8
+ *
9
+ * @param npc The NPC to fire the projectile(s) from. You can also pass undefined if you do not want
10
+ * the projectile(s) to come from anything in particular.
11
+ * @param position The staring position of the projectile(s).
12
+ * @param velocity The starting velocity of the projectile(s).
13
+ * @param projectilesMode Optional. The mode of the projectile(s). Default is
14
+ * `ProjectilesMode.ONE_PROJECTILE`.
15
+ * @param projectileParams Optional. The parameters of the projectile(s). Default is
16
+ * `ProjectileParams()`.
17
+ * @returns The fired projectile(s).
18
+ */
19
+ export declare function fireProjectiles(npc: EntityNPC | undefined, position: Vector, velocity: Vector, projectilesMode?: ProjectilesMode, projectileParams?: ProjectileParams): EntityProjectile[];
20
+ /**
21
+ * Helper function to spawn projectiles in a circle around a position. Under the hood, this
22
+ * leverages `ProjectileMode.N_PROJECTILES_IN_CIRCLE`.
23
+ *
24
+ * @param npc The NPC to fire the projectile(s) from. You can also pass undefined if you do not want
25
+ * the projectile(s) to come from anything in particular.
26
+ * @param position The staring position of the projectile(s).
27
+ * @param speed The speed of the projectile(s).
28
+ * @param numProjectiles The amount of projectiles to spawn.
29
+ * @returns The fired projectile(s).
30
+ */
31
+ export declare function fireProjectilesInCircle(npc: EntityNPC | undefined, position: Vector, speed: float, numProjectiles: int): EntityProjectile[];
32
+ //# sourceMappingURL=projectiles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"projectiles.d.ts","sourceRoot":"","sources":["../../src/functions/projectiles.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,eAAe,EAChB,MAAM,8BAA8B,CAAC;AAItC;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,eAAe,CAC7B,GAAG,EAAE,SAAS,GAAG,SAAS,EAC1B,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,eAAe,GAAE,eAAgD,EACjE,gBAAgB,GAAE,gBAAqC,GACtD,gBAAgB,EAAE,CAoBpB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,uBAAuB,CACrC,GAAG,EAAE,SAAS,GAAG,SAAS,EAC1B,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,KAAK,EACZ,cAAc,EAAE,GAAG,GAClB,gBAAgB,EAAE,CAQpB"}
@@ -0,0 +1,73 @@
1
+ local ____exports = {}
2
+ local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
3
+ local EntityFlag = ____isaac_2Dtypescript_2Ddefinitions.EntityFlag
4
+ local EntityType = ____isaac_2Dtypescript_2Ddefinitions.EntityType
5
+ local ProjectilesMode = ____isaac_2Dtypescript_2Ddefinitions.ProjectilesMode
6
+ local ____entities = require("functions.entities")
7
+ local getFilteredNewEntities = ____entities.getFilteredNewEntities
8
+ local ____entitiesSpecific = require("functions.entitiesSpecific")
9
+ local getProjectiles = ____entitiesSpecific.getProjectiles
10
+ local spawnNPC = ____entitiesSpecific.spawnNPC
11
+ --- Helper function to make an NPC fire one or more projectiles. Returns the fired projectile(s).
12
+ --
13
+ -- Use this function instead of the `EntityNPC.FireProjectiles` method if you need to modify or
14
+ -- access the `EntityProjectile` objects after they are fired, since this function returns the
15
+ -- objects in an array.
16
+ --
17
+ -- @param npc The NPC to fire the projectile(s) from. You can also pass undefined if you do not want
18
+ -- the projectile(s) to come from anything in particular.
19
+ -- @param position The staring position of the projectile(s).
20
+ -- @param velocity The starting velocity of the projectile(s).
21
+ -- @param projectilesMode Optional. The mode of the projectile(s). Default is
22
+ -- `ProjectilesMode.ONE_PROJECTILE`.
23
+ -- @param projectileParams Optional. The parameters of the projectile(s). Default is
24
+ -- `ProjectileParams()`.
25
+ -- @returns The fired projectile(s).
26
+ function ____exports.fireProjectiles(self, npc, position, velocity, projectilesMode, projectileParams)
27
+ if projectilesMode == nil then
28
+ projectilesMode = ProjectilesMode.ONE_PROJECTILE
29
+ end
30
+ if projectileParams == nil then
31
+ projectileParams = ProjectileParams()
32
+ end
33
+ local oldProjectiles = getProjectiles(nil, projectileParams.Variant)
34
+ local spawnedFly = false
35
+ if npc == nil then
36
+ spawnedFly = true
37
+ npc = spawnNPC(
38
+ nil,
39
+ EntityType.FLY,
40
+ 0,
41
+ 0,
42
+ position
43
+ )
44
+ npc.Visible = false
45
+ npc:ClearEntityFlags(EntityFlag.APPEAR)
46
+ end
47
+ npc:FireProjectiles(position, velocity, projectilesMode, projectileParams)
48
+ local newProjectiles = getProjectiles(nil, projectileParams.Variant)
49
+ if spawnedFly then
50
+ npc:Remove()
51
+ end
52
+ return getFilteredNewEntities(nil, oldProjectiles, newProjectiles)
53
+ end
54
+ --- Helper function to spawn projectiles in a circle around a position. Under the hood, this
55
+ -- leverages `ProjectileMode.N_PROJECTILES_IN_CIRCLE`.
56
+ --
57
+ -- @param npc The NPC to fire the projectile(s) from. You can also pass undefined if you do not want
58
+ -- the projectile(s) to come from anything in particular.
59
+ -- @param position The staring position of the projectile(s).
60
+ -- @param speed The speed of the projectile(s).
61
+ -- @param numProjectiles The amount of projectiles to spawn.
62
+ -- @returns The fired projectile(s).
63
+ function ____exports.fireProjectilesInCircle(self, npc, position, speed, numProjectiles)
64
+ local velocity = Vector(speed, numProjectiles)
65
+ return ____exports.fireProjectiles(
66
+ nil,
67
+ npc,
68
+ position,
69
+ velocity,
70
+ ProjectilesMode.N_PROJECTILES_IN_CIRCLE
71
+ )
72
+ end
73
+ return ____exports
@@ -1,24 +1,16 @@
1
1
  /// <reference types="typescript-to-lua/language-extensions" />
2
2
  /// <reference types="isaac-typescript-definitions" />
3
3
  /// <reference types="isaac-typescript-definitions" />
4
- import { SerializationType } from "../enums/SerializationType";
5
- declare type SerializedRNG = LuaMap<string, unknown> & {
4
+ export declare type SerializedRNG = LuaMap<string, unknown> & {
6
5
  readonly __serializedRNGBrand: symbol;
7
6
  };
8
- interface CopyRNGReturn {
9
- [SerializationType.NONE]: RNG;
10
- [SerializationType.SERIALIZE]: SerializedRNG;
11
- [SerializationType.DESERIALIZE]: RNG;
12
- }
7
+ /** Helper function to copy an `RNG` Isaac API class. */
8
+ export declare function copyRNG(rng: RNG): RNG;
13
9
  /**
14
- * Helper function to copy an `RNG` object.
15
- *
16
- * @param rng The RNG object to copy. In the case of deserialization, this will actually be a Lua
17
- * table instead of an instantiated RNG class.
18
- * @param serializationType Default is `SerializationType.NONE`.
10
+ * Helper function to convert a `SerializedRNG` object to a normal `RNG` object. (This is used by
11
+ * the save data manager when reading data from the "save#.dat" file.)
19
12
  */
20
- export declare function copyRNG<R extends RNG | SerializedRNG, S extends SerializationType>(rng: R, serializationType: S): CopyRNGReturn[S];
21
- export declare function copyRNG<R extends RNG | SerializedRNG>(rng: R): CopyRNGReturn[SerializationType.NONE];
13
+ export declare function deserializeRNG(rng: SerializedRNG): RNG;
22
14
  /**
23
15
  * Helper function to get a random `Seed` value to be used in spawning entities and so on. Use this
24
16
  * instead of calling the `Random` function directly since that can return a value of 0 and crash
@@ -39,6 +31,11 @@ export declare function isSerializedRNG(object: unknown): object is SerializedRN
39
31
  */
40
32
  export declare function newRNG(seed?: Seed): RNG;
41
33
  export declare function rngEquals(rng1: RNG, rng2: RNG): boolean;
34
+ /**
35
+ * Helper function to convert a `RNG` object to a `SerializedRNG` object. (This is used by the save
36
+ * data manager when writing data from the "save#.dat" file.)
37
+ */
38
+ export declare function serializeRNG(rng: RNG): SerializedRNG;
42
39
  /**
43
40
  * Helper function to iterate over the provided object and set the seed for all of the values that
44
41
  * are RNG objects equal to a particular seed.
@@ -51,5 +48,4 @@ export declare function setAllRNGToSeed(object: unknown, seed: Seed): void;
51
48
  export declare function setAllRNGToStartSeed(object: unknown): void;
52
49
  /** Helper function to set a seed to an RNG object using Blade's recommended shift index. */
53
50
  export declare function setSeed(rng: RNG, seed: Seed): void;
54
- export {};
55
51
  //# sourceMappingURL=rng.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"rng.d.ts","sourceRoot":"","sources":["../../src/functions/rng.ts"],"names":[],"mappings":";;;AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAK/D,aAAK,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG;IAC7C,QAAQ,CAAC,oBAAoB,EAAE,MAAM,CAAC;CACvC,CAAC;AAEF,UAAU,aAAa;IACrB,CAAC,iBAAiB,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC;IAC9B,CAAC,iBAAiB,CAAC,SAAS,CAAC,EAAE,aAAa,CAAC;IAC7C,CAAC,iBAAiB,CAAC,WAAW,CAAC,EAAE,GAAG,CAAC;CACtC;AAYD;;;;;;GAMG;AACH,wBAAgB,OAAO,CACrB,CAAC,SAAS,GAAG,GAAG,aAAa,EAC7B,CAAC,SAAS,iBAAiB,EAC3B,GAAG,EAAE,CAAC,EAAE,iBAAiB,EAAE,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,CAAC;AAClD,wBAAgB,OAAO,CAAC,CAAC,SAAS,GAAG,GAAG,aAAa,EACnD,GAAG,EAAE,CAAC,GACL,aAAa,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;AAiDzC;;;;GAIG;AACH,wB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