How to use the @casual-simulation/aux-common.calculateBotValue function in @casual-simulation/aux-common

To help you get started, we’ve selected a few @casual-simulation/aux-common examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github casual-simulation / aux / src / aux-server / aux-web / shared / scene / decorators / IFramePlaneDecorator.ts View on Github external
// Get value of iframe element width.
        const iframeElementWidthValue = calculateNumericalTagValue(
            calc,
            this.bot3D.bot,
            'aux.iframe.element.width',
            DEFAULT_IFRAME_ELEMENT_WIDTH
        );
        let iframeElementWidthValueChanged = false;

        if (iframeElementWidthValue !== this._elementWidth) {
            this._elementWidth = iframeElementWidthValue;
            iframeElementWidthValueChanged = true;
        }

        // Get value of iframe url.
        const iframeValue = calculateBotValue(
            calc,
            this.bot3D.bot,
            'aux.iframe'
        );
        let iframeValueChanged = false;

        if (hasValue(iframeValue) && isValidURL(iframeValue)) {
            if (this.url !== iframeValue) {
                this.url = iframeValue;
                iframeValueChanged = true;
            }
        } else {
            if (this.url !== null && this.url !== undefined) {
                this.url = null;
                iframeValueChanged = true;
            }
github casual-simulation / aux / src / aux-server / aux-web / aux-player / scene / PlayerSimulation3D.ts View on Github external
tap(update => {
                            const bot = update;
                            // Update the context background color.
                            //let contextBackgroundColor =
                            //bot.tags['aux.context.color'];

                            let contextBackgroundColor = calculateBotValue(
                                calc,
                                bot,
                                `aux.context.color`
                            );

                            this._contextBackground = hasValue(
                                contextBackgroundColor
                            )
                                ? new Color(contextBackgroundColor)
                                : undefined;

                            this._pannable = calculateBooleanTagValue(
                                calc,
                                bot,
                                `aux.context.pannable`,
                                true
github casual-simulation / aux / src / aux-server / aux-web / shared / scene / WorkspaceMesh.ts View on Github external
bots.forEach(bot => {
            if (isUserBot(bot.bot)) {
                return;
            }
            let localPosition = calculateGridTileLocalCenter(
                calculateBotValue(calc, bot.bot, bot.context + 'X'),
                calculateBotValue(calc, bot.bot, bot.context + 'Y'),
                calculateBotValue(calc, bot.bot, bot.context + 'Z'),
                calculateGridScale(calc, bot.contextGroup.bot)
            );

            let axial: Axial = realPosToGridPos(
                new Vector2(localPosition.x, localPosition.z),
                scale
            );
            const hexgrid = this.hexGrid.addAt(axial);
            hexgrid.height =
                centerHeight || defaultHeight || DEFAULT_WORKSPACE_HEIGHT;
        });
github casual-simulation / aux / src / aux-vm-node / managers / AuxUserAuthenticator.ts View on Github external
private _calculateUserTokenInfo(
        context: BotCalculationContext,
        bot: Bot
    ): UserTokenInfo {
        return {
            id: bot.id,
            token: calculateBotValue(context, bot, 'aux.token'),
            username: calculateBotValue(context, bot, 'aux.token.username'),
            locked: calculateBooleanTagValue(
                context,
                bot,
                'aux.token.locked',
                false
            ),
        };
    }
github casual-simulation / aux / src / aux-vm-node / managers / AuxUserAuthenticator.ts View on Github external
private _calculateUserTokenInfo(
        context: BotCalculationContext,
        bot: Bot
    ): UserTokenInfo {
        return {
            id: bot.id,
            token: calculateBotValue(context, bot, 'aux.token'),
            username: calculateBotValue(context, bot, 'aux.token.username'),
            locked: calculateBooleanTagValue(
                context,
                bot,
                'aux.token.locked',
                false
            ),
        };
    }
github casual-simulation / aux / src / aux-vm-node / managers / AuxUserAuthenticator.ts View on Github external
private _calculateUserAccountInfo(
        context: BotCalculationContext,
        bot: Bot
    ): UserAccountInfo {
        return {
            username: calculateBotValue(context, bot, 'aux.account.username'),
            roles: getBotRoles(context, bot),
            locked: calculateBooleanTagValue(
                context,
                bot,
                'aux.account.locked',
                false
            ),
        };
    }
github casual-simulation / aux / src / aux-server / aux-web / shared / scene / WorkspaceMesh.ts View on Github external
bots.forEach(bot => {
            if (isUserBot(bot.bot)) {
                return;
            }
            let localPosition = calculateGridTileLocalCenter(
                calculateBotValue(calc, bot.bot, bot.context + 'X'),
                calculateBotValue(calc, bot.bot, bot.context + 'Y'),
                calculateBotValue(calc, bot.bot, bot.context + 'Z'),
                calculateGridScale(calc, bot.contextGroup.bot)
            );

            let axial: Axial = realPosToGridPos(
                new Vector2(localPosition.x, localPosition.z),
                scale
            );
            const hexgrid = this.hexGrid.addAt(axial);
            hexgrid.height =
                centerHeight || defaultHeight || DEFAULT_WORKSPACE_HEIGHT;
        });
github casual-simulation / aux / src / aux-server / aux-web / aux-player / MenuBot / MenuBot.ts View on Github external
private _updateColor(calc: BotCalculationContext, bot: Bot) {
        if (bot.tags['aux.color']) {
            this.backgroundColor = calculateBotValue(calc, bot, 'aux.color');
        } else {
            this.backgroundColor = '#FFF';
        }
    }
github casual-simulation / aux / src / aux-server / aux-web / aux-player / scene / PlayerSimulation3D.ts View on Github external
tap(update => {
                        const bot = update;
                        let userBackgroundColor = calculateBotValue(
                            calc,
                            bot,
                            `aux.context.color`
                        );
                        this._userInventoryColor = hasValue(userBackgroundColor)
                            ? new Color(userBackgroundColor)
                            : undefined;
                    })
                )