Fixing still

This commit is contained in:
barsdeveloper
2024-07-17 21:38:10 +02:00
parent e0d8990e6a
commit 8a2cd6c26e
28 changed files with 212 additions and 203 deletions

View File

@@ -74,12 +74,12 @@ export default class ArrayEntity extends IEntity {
printKey = Self.printKey,
wrap = Self.wrap,
) {
if (this.Self().inlined) {
if (Self.inlined) {
return super.toString.bind(this.values, insideString, indentation, Self, printKey, wrap)()
}
let result = this.values.map(v => v?.toString(insideString)).join(this.Self().attributeSeparator)
let result = this.values.map(v => v?.toString(insideString)).join(Self.attributeSeparator)
if (this.trailing) {
result += this.Self().attributeSeparator
result += Self.attributeSeparator
}
return `(${result})`
}

View File

@@ -56,18 +56,18 @@ export default class BlueprintEntity extends ObjectEntity {
/** @param {ObjectEntity} entity */
mergeWith(entity) {
if (!entity.ScriptVariables || entity.ScriptVariables.values.length === 0) {
if (!entity.ScriptVariables || entity.ScriptVariables.length === 0) {
return this
}
if (!this.ScriptVariables || this.ScriptVariables.values.length === 0) {
if (!this.ScriptVariables || this.ScriptVariables.length === 0) {
this.ScriptVariables = entity.ScriptVariables
}
let scriptVariables = Utility.mergeArrays(
this.ScriptVariables.values,
entity.ScriptVariables.values,
this.ScriptVariables.valueOf(),
entity.ScriptVariables.valueOf(),
(l, r) => l.OriginalChangeId.value == r.OriginalChangeId.value
)
if (scriptVariables.length === this.ScriptVariables.values.length) {
if (scriptVariables.length === this.ScriptVariables.length) {
return this
}
const entries = scriptVariables.concat(scriptVariables).map((v, i) => {

View File

@@ -30,11 +30,7 @@ export default class BooleanEntity extends IEntity {
return this.value
}
toString(
insideString = false,
indentation = "",
printKey = this.Self().printKey,
) {
toString() {
return this.value
? this.#uppercase
? "True"

View File

@@ -62,10 +62,10 @@ export default class FormatTextEntity extends IEntity {
printKey = Self.printKey,
wrap = Self.wrap,
) {
const separator = this.Self().attributeSeparator
const separator = Self.attributeSeparator
return this.lookbehind + "("
+ this.values.map(v => v.toString(insideString)).join(separator)
+ (this.Self().trailing ? separator : "")
+ (Self.trailing ? separator : "")
+ ")"
}
}

View File

@@ -28,7 +28,13 @@ export default class Integer64Entity extends IEntity {
return this.value
}
toString() {
toString(
insideString = false,
indentation = "",
Self = this.Self(),
printKey = Self.printKey,
wrap = Self.wrap,
) {
return this.value.toString()
}
}

View File

@@ -35,8 +35,11 @@ export default class MirroredEntity extends IEntity {
toString(
insideString = false,
indentation = "",
printKey = this.Self().printKey,
Self = this.Self(),
printKey = Self.printKey,
wrap = Self.wrap,
) {
return this.getter().toString(insideString, indentation, printKey)
this.toString = this.getter.toString.bind(this.getter())
return this.toString(insideString, indentation, Self, printKey, wrap)
}
}

View File

@@ -9,11 +9,7 @@ export default class NullEntity extends IEntity {
.map(v => new this())
)
toString(
insideString = false,
indentation = "",
printKey = this.Self().printKey,
) {
toString() {
return "()"
}
}

View File

@@ -48,13 +48,7 @@ export default class NumberEntity extends IEntity {
return this.value
}
toString(
insideString = false,
indentation = "",
Self = this.Self(),
printKey = Self.printKey,
wrap = Self.wrap,
) {
toString() {
if (this.value === Number.POSITIVE_INFINITY) {
return "+inf"
}

View File

@@ -147,7 +147,7 @@ export default class PinEntity extends IEntity {
}
getType() {
const category = this.PinType.PinCategory.toString().toLocaleLowerCase()
const category = this.PinType.PinCategory.valueOf().toLocaleLowerCase()
if (category === "struct" || category === "class" || category === "object" || category === "type") {
return this.PinType.PinSubCategoryObject.path
}
@@ -162,7 +162,7 @@ export default class PinEntity extends IEntity {
if (pinObjectReference) {
/** @type {ObjectEntity} */
const pinObject = pcgSuboject[Configuration.subObjectAttributeNameFromReference(pinObjectReference, true)]
let allowedTypes = pinObject.Properties?.AllowedTypes?.toString() ?? ""
let allowedTypes = pinObject.Properties?.AllowedTypes?.valueOf() ?? ""
if (allowedTypes == "") {
allowedTypes = this.PinType.PinCategory ?? ""
if (allowedTypes == "") {
@@ -171,8 +171,8 @@ export default class PinEntity extends IEntity {
}
if (allowedTypes) {
if (
pinObject.Properties.bAllowMultipleData !== false
&& pinObject.Properties.bAllowMultipleConnections !== false
pinObject.Properties.bAllowMultipleData?.valueOf() !== false
&& pinObject.Properties.bAllowMultipleConnections?.valueOf() !== false
) {
allowedTypes += "[]"
}
@@ -235,15 +235,15 @@ export default class PinEntity extends IEntity {
}
isHidden() {
return this.bHidden
return this.bHidden?.valueOf()
}
isInput() {
return !this.bHidden && this.Direction.toString() != "EGPD_Output"
return !this.isHidden() && this.Direction.valueOf() != "EGPD_Output"
}
isOutput() {
return !this.bHidden && this.Direction.toString() == "EGPD_Output"
return !this.isHidden() && this.Direction.valueOf() == "EGPD_Output"
}
isLinked() {

View File

@@ -25,13 +25,7 @@ export default class PinReferenceEntity extends IEntity {
this.pinGuid = pinGuid
}
toString(
insideString = false,
indentation = "",
Self = this.Self(),
printKey = Self.printKey,
wrap = Self.wrap,
) {
toString() {
return this.objectName.toString() + " " + this.pinGuid.toString()
}
}

View File

@@ -30,11 +30,12 @@ export default class SimpleSerializationRotatorEntity extends RotatorEntity {
toString(
insideString = false,
indentation = "",
printKey = this.Self().printKey,
Self = this.Self(),
printKey = Self.printKey,
wrap = Self.wrap,
) {
const Self = this.Self()
return this.P.toString(insideString) + Self.attributeSeparator
+ this.Y.toString(insideString) + Self.attributeSeparator
+ this.R.toString(insideString) + (this.trailing ? Self.attributeSeparator : "")
return this.P.toString() + Self.attributeSeparator
+ this.Y.toString() + Self.attributeSeparator
+ this.R.toString() + (this.trailing ? Self.attributeSeparator : "")
}
}

View File

@@ -26,10 +26,11 @@ export default class SimpleSerializationVector2DEntity extends Vector2DEntity {
toString(
insideString = false,
indentation = "",
printKey = this.Self().printKey,
Self = this.Self(),
printKey = Self.printKey,
wrap = Self.wrap,
) {
const Self = this.Self()
return this.X.toString(insideString) + Self.attributeSeparator
+ this.Y.toString(insideString) + (this.trailing ? Self.attributeSeparator : "")
return this.X.toString() + Self.attributeSeparator
+ this.Y.toString() + (this.trailing ? Self.attributeSeparator : "")
}
}

View File

@@ -31,11 +31,12 @@ export default class SimpleSerializationVectorEntity extends VectorEntity {
toString(
insideString = false,
indentation = "",
printKey = this.Self().printKey,
Self = this.Self(),
printKey = Self.printKey,
wrap = Self.wrap,
) {
const Self = this.Self()
return this.X.toString(insideString) + Self.attributeSeparator
+ this.Y.toString(insideString) + Self.attributeSeparator
+ this.Z.toString(insideString) + (this.trailing ? Self.attributeSeparator : "")
return this.X.toString() + Self.attributeSeparator
+ this.Y.toString() + Self.attributeSeparator
+ this.Z.toString() + (this.trailing ? Self.attributeSeparator : "")
}
}

View File

@@ -20,7 +20,13 @@ export default class StringEntity extends IEntity {
return this.value
}
toString(insideString = false) {
toString(
insideString = false,
indentation = "",
Self = this.Self(),
printKey = Self.printKey,
wrap = Self.wrap,
) {
let result = `"${Utility.escapeString(this.value)}"`
if (insideString) {
result = Utility.escapeString(result, false)