I want to write a plugin to this game using their scripting engine. The scripts can be either Local, Remote or Intransient.
Can you please verify in the code if local plugins are loaded when the game is in track designer, meaning when GameMode = track_designer
Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
This function is responsible for enabling the transient plugins, meaning all plugins that are not intransient. This function is called in GameLoadScripts
GameLoadInit is called when a park is loaded, or a new park is created, this can be verified by looking at Game::LoadParkFromFile or Game::NewGameWindowCallback
The code also shows that plugins are loaded and started when the game is started using the function ScriptEngine::StartIntransientPlugins().
The plugin type is determined by the PluginType enum in Plugin.h:
cpp
enum class PluginType
{
/**
* Scripts that can run on servers or clients with no impact on the game state and will not
* be uploaded to clients.
*/
Local,
/**
* Scripts that can run on servers and will be uploaded to clients with ability to
* modify game state in certain contexts.
*/
Remote,
/**
* Scripts that run when the game starts and only unload explicitly rather than when the
* park changes.
*/
Intransient,
};
This means that a plugin is transient if it's either local or remote and not intransient.
GameLoadScripts is not called when the game is in track designer mode which can be verified by looking at the Game::gameStateTick function, which is the function that runs during normal game play.
cpp
// Always perform autosave check, even when paused
if (!(gScreenFlags & SCREEN_FLAGS_TITLE_DEMO) && !(gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER)
&& !(gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER))
{
ScenarioAutosaveCheck();
}
And in Game::GameLoadOrQuitNoSavePrompt which is called when changing game modes:
cpp
auto loadOrQuitAction = LoadOrQuitAction(LoadOrQuitModes::CloseSavePrompt);
GameActions::Execute(&loadOrQuitAction);
ToolCancel();
if (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR)
{
LoadLandscape();
}
else
{
auto intent = Intent(WindowClass::Loadsave);
intent.PutExtra(INTENT_EXTRA_LOADSAVE_TYPE, LOADSAVETYPE_LOAD | LOADSAVETYPE_GAME);
intent.PutExtra(INTENT_EXTRA_CALLBACK, reinterpret_cast<CloseCallback>(GameLoadOrQuitNoSavePromptCallback));
ContextOpenIntent(&intent);
}
break;
}
This verifies that local and remote plugins are not loaded when the game is in the track designer, or track manager modes. Intransient plugins are loaded when the game is started.