mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-02-14 17:14:41 +08:00
More entities fixed
This commit is contained in:
@@ -1,21 +1,39 @@
|
||||
import P from "parsernostrum"
|
||||
import Grammar from "../serialization/Grammar.js"
|
||||
import RotatorEntity from "./RotatorEntity.js"
|
||||
import NumberEntity from "./NumberEntity.js"
|
||||
|
||||
export default class SimpleSerializationRotatorEntity extends RotatorEntity {
|
||||
|
||||
static attributeSeparator = ", "
|
||||
/** @type {P<SimpleSerializationRotatorEntity>} */
|
||||
static grammar = P.alt(
|
||||
P.regArray(new RegExp(
|
||||
`(${Grammar.numberRegexSource})`
|
||||
`(${NumberEntity.numberRegexSource})`
|
||||
+ String.raw`\s*,\s*`
|
||||
+ `(${Grammar.numberRegexSource})`
|
||||
+ `(${NumberEntity.numberRegexSource})`
|
||||
+ String.raw`\s*,\s*`
|
||||
+ `(${Grammar.numberRegexSource})`
|
||||
)).map(([_, p, y, r]) => new this({
|
||||
R: Number(r),
|
||||
P: Number(p),
|
||||
Y: Number(y),
|
||||
+ `(${NumberEntity.numberRegexSource})`
|
||||
)).map(([_, p, pPrecision, y, yPrecision, r, rPrecision]) => new this({
|
||||
R: new NumberEntity(r, rPrecision?.length),
|
||||
P: new NumberEntity(p, pPrecision?.length),
|
||||
Y: new NumberEntity(y, yPrecision?.length),
|
||||
})),
|
||||
RotatorEntity.grammar
|
||||
)
|
||||
RotatorEntity.grammar.map(v => new this({
|
||||
R: v.R,
|
||||
P: v.P,
|
||||
Y: v.Y,
|
||||
}))
|
||||
).label("SimpleSerializationRotatorEntity")
|
||||
|
||||
toString(
|
||||
insideString = false,
|
||||
indentation = "",
|
||||
printKey = this.Self().printKey,
|
||||
) {
|
||||
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 : "")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user