Saxonberg Server API
    Preparing search index...

    Interface for objects with dynamic properties.

    interface Propertied {
        checkProp<T extends PropValue>(prop: Property<T>): PropOptions<T> | null;
        configureProp<T extends PropValue>(
            prop: Property<T>,
            options: Partial<PropOptions<T>>,
        ): boolean;
        defaultPropAccess(
            property: Property<PropValue>,
            op: PropOperation,
            special: unknown,
        ): boolean;
        generateUniquePropName<T extends PropValue>(seed?: string): Property<T>;
        getAllPropNames(): Property<PropValue>[];
        getProp<T extends PropValue>(prop: Property<T>): T | null;
        getProps(): Readonly<Record<string, PropValue>>;
        initProp<T extends PropValue>(
            prop: Property<T>,
            options?: PropOptionsInput<T>,
        ): boolean;
        isMaskingProp<T extends PropValue>(
            prop: Property<T>,
            owner?: Stuff,
        ): boolean;
        maskProp<T extends PropValue>(
            prop: Property<T>,
            mask: PropValueMask<T>,
            owner?: Stuff,
            ...extra: unknown[],
        ): boolean;
        removeProp<T extends PropValue>(prop: Property<T>): boolean;
        setProp<T extends PropValue>(prop: Property<T>, value: T): boolean;
        unmaskProp<T extends PropValue>(prop: Property<T>, owner?: Stuff): boolean;
    }
    Index

    Methods

    • Initialize a new property with options.

      Pass marshaller: '/lib/persistence/QuantityMarshaller/kg' (or any registered marshaller path) when the prop holds a rich value object that needs storage-shape conversion. The binding persists alongside savedProps, so loaded hosts round-trip through the same marshaller without redeclaring.

      Type Parameters

      Parameters

      Returns boolean

      true if successful, false if property already exists

    • Add value transformation mask (e.g., stat modifiers, equipment bonuses). Masks are applied during getProp() to transform the returned value.

      The owner is the in-world Stuff this mask belongs to — the ring that grants the bonus, the potion that doubles it, the curse that halves it. The caller retains the reference so it can later call unmaskProp(prop, owner) to remove its own masks without touching others'. Owner is also passed to access control as special.

      If owner is omitted, it defaults to the nearest Stuff on the call stack (the caller of this method, walking down past Api frames). The common case — Stuff A reaches into Stuff B and adds a mask — needs no explicit owner. Throws if no Stuff is reachable on the stack.

      Type Parameters

      Parameters

      • prop: Property<T>

        Property to mask

      • mask: PropValueMask<T>

        Value transformation function

      • Optionalowner: Stuff

        The Stuff this mask belongs to (defaults to nearest Stuff caller)

      • ...extra: unknown[]

        Additional arguments to pass to mask when executed

      Returns boolean

      true if successful, false if property doesn't exist or owner already has a mask

    • Remove masks by owner. Owner defaults to the nearest Stuff on the call stack — the same resolution rule as maskProp, so symmetric pairs need no explicit owner.

      Type Parameters

      Parameters

      • prop: Property<T>

        Property to unmask

      • Optionalowner: Stuff

        The Stuff whose masks should be removed (defaults to nearest Stuff caller)

      Returns boolean

      true if any masks were removed, false otherwise