diff --git a/fxr.ts b/fxr.ts index 03bc46e..3afd3ae 100644 --- a/fxr.ts +++ b/fxr.ts @@ -13449,15 +13449,15 @@ abstract class Property impleme } -class ValueProperty - extends Property - implements IModifiableProperty, IValueProperty { +class ValueProperty + extends Property + implements IModifiableProperty, IValueProperty { value: ValueTypeMap[T] constructor( valueType: T, - func: F, + func: ValuePropertyFunction, value: ValueTypeMap[T], modifiers: Modifier[] = [] ) { @@ -13490,25 +13490,25 @@ class ValueProperty } } - static fromFields( + static fromFields( valueType: T, - func: F, + func: ValuePropertyFunction, modifiers: Modifier[], fieldValues: number[] - ): ValueProperty { + ): ValueProperty { switch (func) { case PropertyFunction.Zero: return new ZeroProperty(valueType).withModifiers( ...modifiers - ) as unknown as ValueProperty + ) as unknown as ValueProperty case PropertyFunction.One: return new OneProperty(valueType).withModifiers( ...modifiers - ) as unknown as ValueProperty + ) as unknown as ValueProperty case PropertyFunction.Constant: return new ConstantProperty(...(fieldValues as [number] | Vector)).withModifiers( ...modifiers - ) as unknown as ValueProperty + ) as unknown as ValueProperty default: throw new Error('Incompatible or unknown function in property: ' + func) } @@ -13556,6 +13556,7 @@ class ValueProperty } scale(factor: number) { + this.function = PropertyFunction.Constant if (this.valueType === ValueType.Scalar) { (this.value as number) *= factor } else { @@ -13564,6 +13565,7 @@ class ValueProperty } power(exponent: number) { + this.function = PropertyFunction.Constant if (this.valueType === ValueType.Scalar) { (this.value as number) **= exponent } else { @@ -13572,6 +13574,7 @@ class ValueProperty } add(summand: number) { + this.function = PropertyFunction.Constant if (this.valueType === ValueType.Scalar) { (this.value as number) += summand } else { @@ -13579,7 +13582,7 @@ class ValueProperty } } - minify(): ValueProperty { + minify(): ValueProperty { switch (this.function) { case PropertyFunction.Zero: case PropertyFunction.One: @@ -13607,7 +13610,7 @@ class ValueProperty return this.value } - clone(): ValueProperty { + clone(): ValueProperty { return new ValueProperty(this.valueType, this.function, this.value, this.modifiers.map(e => Modifier.copy(e))) } @@ -14001,7 +14004,7 @@ class ComponentKeyframeProperty } -class ZeroProperty extends ValueProperty { +class ZeroProperty extends ValueProperty { constructor(valueType: ValueType = ValueType.Scalar, modifiers: Modifier[] = []) { super( valueType, @@ -14012,7 +14015,7 @@ class ZeroProperty extends ValueProperty { } } -class OneProperty extends ValueProperty { +class OneProperty extends ValueProperty { constructor(valueType: ValueType = ValueType.Scalar, modifiers: Modifier[] = []) { super( valueType, @@ -14023,7 +14026,7 @@ class OneProperty extends ValueProperty { } } -class ConstantProperty extends ValueProperty { +class ConstantProperty extends ValueProperty { constructor( ...args: diff --git a/package-lock.json b/package-lock.json index a37322c..ca461fc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@cccode/fxr", - "version": "5.0.0", + "version": "5.0.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@cccode/fxr", - "version": "5.0.0", + "version": "5.0.1", "license": "Unlicense", "devDependencies": { "cpy-cli": "^5.0.0", diff --git a/package.json b/package.json index d6826d5..d3b2a21 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@cccode/fxr", - "version": "5.0.0", + "version": "5.0.1", "description": "JavaScript library for editing FXR files from Dark Souls 3, Sekiro, Elden Ring, and Armored Core 6.", "author": "CCCode", "type": "module",