Files
ueblueprint/js/entity/IntegerEntity.js
2021-12-11 23:58:40 +01:00

31 lines
614 B
JavaScript
Executable File

import Entity from "./Entity"
export default class IntegerEntity extends Entity {
static attributes = {
value: Number
}
getAttributes() {
return IntegerEntity.attributes
}
constructor(options = {}) {
if (options.constructor === Number || options.constructor === String) {
options = {
value: options
}
}
super(options)
this.value = Math.round(this.value)
}
valueOf() {
return this.value
}
toString() {
return this.value.toString()
}
}