diff --git a/frontend/src/components/BotList.svelte b/frontend/src/components/BotList.svelte index a427d50..3173415 100644 --- a/frontend/src/components/BotList.svelte +++ b/frontend/src/components/BotList.svelte @@ -210,7 +210,6 @@ function filterBots( } function scriptDuplicateAgentIdWarning(d: ToggleableScript): string | null { - const agentId = d.info.config.settings.agentId; if (!agentId) { diff --git a/frontend/src/components/Teams/TeamBotList.svelte b/frontend/src/components/Teams/TeamBotList.svelte index f4b9e53..1f048ce 100644 --- a/frontend/src/components/Teams/TeamBotList.svelte +++ b/frontend/src/components/Teams/TeamBotList.svelte @@ -12,7 +12,7 @@ import cannotAutoRunIcon from "../../assets/cannot_play.svg"; import defaultIcon from "../../assets/rlbot_mono.png"; import PlayerOverridesModal from "./PlayerOverridesModal.svelte"; -import {Browser} from "@wailsio/runtime"; +import { Browser } from "@wailsio/runtime"; import warningIcon from "../../assets/exclamation-triangle-fill.svg"; let { diff --git a/frontend/src/pages/Home.svelte b/frontend/src/pages/Home.svelte index 429c2a2..3c3b5c9 100644 --- a/frontend/src/pages/Home.svelte +++ b/frontend/src/pages/Home.svelte @@ -186,7 +186,7 @@ function collectDuplicateAgentIds( bots: DraggablePlayer[], scripts: ToggleableScript[], ): Set { - const agentIdTomlMap: { [id: string]: string } = {} + const agentIdTomlMap: { [id: string]: string } = {}; const duplicateAgentIds = new Set(); for (const bot of bots) { diff --git a/players.go b/players.go index f893368..773473a 100644 --- a/players.go +++ b/players.go @@ -244,6 +244,15 @@ func (botInfo BotInfo) ToPlayerConfig(team uint32) *flat.PlayerConfigurationT { Hivemind: botInfo.Config.Settings.Hivemind, } + // Add environment variables from the bot's config toml first + for k, v := range botInfo.Config.Settings.Environment { + customBot.Environment = append(customBot.Environment, &flat.EnvironmentVariableT{ + Name: k, + Value: v, + }) + } + + // Then append torch paths (if found) so they combine properly with any toml-specified paths setTorchEnv(botInfo.TomlPath, &customBot.Environment) return &flat.PlayerConfigurationT{ @@ -279,6 +288,8 @@ type BotSettings struct { RunCommandLinux string `toml:"run_command_linux" json:"runCommandLinux"` // If bot can handle multiple agents with one client Hivemind bool `toml:"hivemind" json:"hivemind"` + // Additional environment variables to set for the bot process + Environment map[string]string `toml:"environment" json:"environment"` } type BotDetails struct { diff --git a/scripts.go b/scripts.go index 930be60..df3ad34 100644 --- a/scripts.go +++ b/scripts.go @@ -28,6 +28,15 @@ func (botInfo BotInfo) ToScriptConfig() *flat.ScriptConfigurationT { ScriptId: 0, // let core do this } + // Add environment variables from the script's config toml first + for k, v := range botInfo.Config.Settings.Environment { + scriptConfig.Environment = append(scriptConfig.Environment, &flat.EnvironmentVariableT{ + Name: k, + Value: v, + }) + } + + // Then append torch paths (if found) so they combine properly with any toml-specified paths setTorchEnv(botInfo.TomlPath, &scriptConfig.Environment) return scriptConfig