Capability-based API

Contents

Running multiple Game-Scripts

Currently OpenTTD only allows running a single Game-Script.

Capability-based API access

The main idea is:

API that could be shared, but are currently not

Various APIs that could be shared in theory, are currently not shareable because the implementation assumes there is only one Game-Script:

List of capabilities

API Capability ID Default for old GS Limitation
ScriptCargoMonitor

no conflict in theory, but in the current implementation
ScriptEngine::EnableForCompany, DisableForCompany EngineAvailability exclusive

ScriptGame::Pause/Unpause

no conflict in theory, but in the current implementation
ScriptGameSettings::SetValue Setting/xyz exclusive exclusive per setting
ScriptGoal

no conflict in theory, but in the current implementation
ScriptIndustry::SetControlFlags IndustryProduction exclusive

ScriptIndustry::SetExclusiveSupplier IndustryServicing exclusive

ScriptIndustry::SetExclusiveConsumer IndustryServicing exclusive

ScriptSign

Script communication protocol will break
ScriptSubsidy Subsidies shared

ScriptViewport Viewport shared

ScriptStoryPage

no conflict in theory, but in the current implementation
ScriptTown::SetName TownName shared

ScriptTown::SetText

no conflict in theory, but in the current implementation
ScriptTown::SetCargoGoal TownGrowth exclusive

ScriptTown::SetGrowthRate TownGrowth exclusive

ScriptTown::ExpandTown TownGrowth exclusive

ScriptTown::FoundTown TownFounding shared

ScriptTown::ChangeRating TownRating shared

TODO: