isaacscript-common 1.0.316 → 1.0.320

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.
@@ -42,10 +42,14 @@ function postNewRoomVanilla(self)
42
42
  local level = game:GetLevel()
43
43
  local stage = level:GetStage()
44
44
  local stageType = level:GetStageType()
45
- if usedGlowingHourGlass and ((currentStage ~= stage) or (currentStageType ~= stageType)) then
46
- recordCurrentStage(nil)
47
- postNewLevelReordered:fire()
48
- postNewRoomReordered:fire()
45
+ if usedGlowingHourGlass then
46
+ usedGlowingHourGlass = false
47
+ if (currentStage ~= stage) or (currentStageType ~= stageType) then
48
+ recordCurrentStage(nil)
49
+ postNewLevelReordered:fire()
50
+ postNewRoomReordered:fire()
51
+ return
52
+ end
49
53
  end
50
54
  if (((gameFrameCount == 0) or (currentStage ~= stage)) or (currentStageType ~= stageType)) and (not forceNewRoom) then
51
55
  return
@@ -11,6 +11,7 @@ local ____deepCopy = require("functions.deepCopy")
11
11
  local addTraversalDescription = ____deepCopy.addTraversalDescription
12
12
  local deepCopy = ____deepCopy.deepCopy
13
13
  local deserializeVector = ____deepCopy.deserializeVector
14
+ local isBrand = ____deepCopy.isBrand
14
15
  local SerializationType = ____deepCopy.SerializationType
15
16
  local ____log = require("functions.log")
16
17
  local log = ____log.log
@@ -55,6 +56,9 @@ function mergeTSTLObject(self, oldObject, newTable, traversalDescription)
55
56
  local convertStringKeysToNumbers = newTable[TSTL_OBJECT_WITH_NUMBER_KEYS_BRAND] ~= nil
56
57
  for key, value in pairs(newTable) do
57
58
  do
59
+ if isBrand(nil, key) then
60
+ goto __continue13
61
+ end
58
62
  local keyToUse = key
59
63
  if convertStringKeysToNumbers then
60
64
  local numberKey = tonumber(key)
@@ -81,26 +85,32 @@ function mergeTSTLObject(self, oldObject, newTable, traversalDescription)
81
85
  end
82
86
  function mergeTable(self, oldTable, newTable, traversalDescription)
83
87
  for key, value in pairs(newTable) do
84
- if mergeVector(nil, oldTable, key, value) then
85
- return
86
- end
87
- local valueType = type(value)
88
- if valueType == "table" then
89
- local oldValue = oldTable[key]
90
- local oldValueType = type(oldValue)
91
- if oldValueType == "table" then
92
- traversalDescription = addTraversalDescription(nil, key, traversalDescription)
93
- ____exports.merge(nil, oldValue, value, traversalDescription)
88
+ do
89
+ if isBrand(nil, key) then
90
+ goto __continue22
94
91
  end
95
- else
96
- if DEBUG then
97
- log(
98
- nil,
99
- (("Merging key \"" .. tostring(key)) .. "\" with value: ") .. tostring(value)
100
- )
92
+ if mergeVector(nil, oldTable, key, value) then
93
+ goto __continue22
94
+ end
95
+ local valueType = type(value)
96
+ if valueType == "table" then
97
+ local oldValue = oldTable[key]
98
+ local oldValueType = type(oldValue)
99
+ if oldValueType == "table" then
100
+ traversalDescription = addTraversalDescription(nil, key, traversalDescription)
101
+ ____exports.merge(nil, oldValue, value, traversalDescription)
102
+ end
103
+ else
104
+ if DEBUG then
105
+ log(
106
+ nil,
107
+ (("Merging key \"" .. tostring(key)) .. "\" with value: ") .. tostring(value)
108
+ )
109
+ end
110
+ oldTable[key] = value
101
111
  end
102
- oldTable[key] = value
103
112
  end
113
+ ::__continue22::
104
114
  end
105
115
  end
106
116
  function mergeVector(self, oldTable, key, value)
@@ -24,5 +24,6 @@ export declare enum SerializationType {
24
24
  * @param traversalDescription Used to track the current key that we are operating on.
25
25
  */
26
26
  export declare function deepCopy(oldObject: LuaTable | Map<AnyNotNil, unknown> | Set<AnyNotNil>, serializationType?: SerializationType, traversalDescription?: string): LuaTable | Map<AnyNotNil, unknown> | Set<AnyNotNil>;
27
+ export declare function isBrand(key: AnyNotNil): boolean;
27
28
  export declare function deserializeVector(vectorTable: LuaTable): Vector;
28
29
  export declare function addTraversalDescription(key: AnyNotNil, traversalDescription: string): string;
@@ -14,7 +14,7 @@ local log = ____log.log
14
14
  local ____util = require("functions.util")
15
15
  local isSerializedVector = ____util.isSerializedVector
16
16
  local isVector = ____util.isVector
17
- local TSTL_CLASS_KEYS, isTSTLClass, cloneClass, getNewClassFromMetatable, isBrand, deepCopyValue, copyVector, checkMetatable, validateValue
17
+ local TSTL_CLASS_KEYS, isTSTLClass, cloneClass, getNewClassFromMetatable, deepCopyValue, copyVector, checkMetatable, validateValue
18
18
  function ____exports.deepCopy(self, oldObject, serializationType, traversalDescription)
19
19
  if serializationType == nil then
20
20
  serializationType = ____exports.SerializationType.NONE
@@ -75,7 +75,7 @@ function ____exports.deepCopy(self, oldObject, serializationType, traversalDescr
75
75
  local value
76
76
  value = ____value[2]
77
77
  do
78
- if isBrand(nil, key) then
78
+ if ____exports.isBrand(nil, key) then
79
79
  goto __continue17
80
80
  end
81
81
  deepCopyValue(nil, oldObject, newObject, key, value, traversalDescription, serializationType)
@@ -87,7 +87,7 @@ function ____exports.deepCopy(self, oldObject, serializationType, traversalDescr
87
87
  oldObject:values()
88
88
  ) do
89
89
  do
90
- if isBrand(nil, key) then
90
+ if ____exports.isBrand(nil, key) then
91
91
  goto __continue20
92
92
  end
93
93
  local value = ""
@@ -98,7 +98,7 @@ function ____exports.deepCopy(self, oldObject, serializationType, traversalDescr
98
98
  else
99
99
  for key, value in pairs(oldObject) do
100
100
  do
101
- if isBrand(nil, key) then
101
+ if ____exports.isBrand(nil, key) then
102
102
  goto __continue23
103
103
  end
104
104
  deepCopyValue(nil, oldObject, newObject, key, value, traversalDescription, serializationType)
@@ -139,7 +139,7 @@ function getNewClassFromMetatable(self, metatable)
139
139
  newClass:____constructor()
140
140
  return newClass
141
141
  end
142
- function isBrand(self, key)
142
+ function ____exports.isBrand(self, key)
143
143
  return ((((key == TSTL_MAP_BRAND) or (key == TSTL_SET_BRAND)) or (key == TSTL_CLASS_BRAND)) or (key == TSTL_OBJECT_WITH_NUMBER_KEYS_BRAND)) or (key == VECTOR_BRAND)
144
144
  end
145
145
  function deepCopyValue(self, oldObject, newObject, key, value, traversalDescription, serializationType)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "1.0.316",
3
+ "version": "1.0.320",
4
4
  "description": "Helper functions for IsaacScript mods",
5
5
  "keywords": [
6
6
  "isaac",