aboutsummaryrefslogtreecommitdiff
path: root/src/new_fields/ObjectField.ts
blob: 9aa1c9b0483e294ad6718f2670b989d6d09e67c8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import { RefField } from "./RefField";
import { OnUpdate, Parent, Copy, ToScriptString, ToString } from "./FieldSymbols";
import { Scripting } from "../client/util/Scripting";

export abstract class ObjectField {
    protected [OnUpdate](diff?: any) { }
    private [Parent]?: RefField | ObjectField;
    abstract [Copy](): ObjectField;

    abstract [ToScriptString](): string;
    abstract [ToString](): string;
}

export namespace ObjectField {
    export function MakeCopy<T extends ObjectField>(field: T) {
        return field?.[Copy]();
    }
}

Scripting.addGlobal(ObjectField);