How to use the @casual-simulation/aux-common.tagsOnBot 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-vm / managers / DependencyManager.ts View on Github external
updateBot(update: UpdatedBot): BotDependentInfo {
        if (!update || !update.bot) {
            return {};
        }

        this._botIdMap.set(update.bot.id, update.bot);
        const tags = this._botMap.get(update.bot.id);
        if (tags) {
            // ID never updates so we don't need to include it.
            const botTags = tagsOnBot(update.bot);
            tags.splice(0, tags.length, ...botTags);

            const dependencies = this.getDependencies(update.bot.id);

            for (let tag of update.tags) {
                const bots = this._tagMap.get(tag);
                const val = update.bot.tags[tag];
                if (hasValue(val)) {
                    if (isFormula(val)) {
                        let formulaDependencies = this._dependencies.calculateAuxDependencies(
                            val
                        );

                        if (dependencies[tag]) {
                            this._removeTagDependents(
                                dependencies,
github casual-simulation / aux / src / aux-server / aux-web / aux-projector / MiniBot / MiniBot.ts View on Github external
private async _updateBot() {
        this.image = await this.botRenderer.render(
            this.bot,
            appManager.simulationManager.primary.helper.createContext(),
            this.diffball
        );

        this.isEmpty = tagsOnBot(this.bot).length === 0;

        let label = this.bot.tags['aux.label'];
        if (label) {
            this.label = appManager.simulationManager.primary.helper.calculateFormattedBotValue(
                this.bot,
                'aux.label'
            );

            const labelColor = this.bot.tags['aux.label.color'];
            if (labelColor) {
                this.labelColor = appManager.simulationManager.primary.helper.calculateFormattedBotValue(
                    this.bot,
                    'aux.label.color'
                );
            } else {
                this.labelColor = '#000';
github casual-simulation / aux / src / aux-vm / managers / DependencyManager.ts View on Github external
addBot(bot: Bot): BotDependentInfo {
        if (!bot) {
            return {};
        }

        const tags = ['id', ...tagsOnBot(bot)];
        let deps: BotDependencyInfo = {};

        const dependents = tags.map(t => this.getDependents(t));
        const updates =
            reduce(dependents, (first, second) =>
                this._mergeDependents(first, second)
            ) || {};

        for (let tag of tags) {
            const val = bot.tags[tag];
            if (isFormula(val)) {
                let formulaDependencies = this._dependencies.calculateAuxDependencies(
                    val
                );
                deps[tag] = formulaDependencies;
                this._addTagDependents(formulaDependencies, tag, bot);