From 8cfdbd871d6c548c3978dabcc17faf0c995651b8 Mon Sep 17 00:00:00 2001 From: Ted John Date: Tue, 26 Jan 2021 23:18:48 +0000 Subject: [PATCH] Improve title sequence API --- distribution/openrct2.d.ts | 32 +++++++++++-------- src/openrct2-ui/scripting/ScTitleSequence.hpp | 2 ++ 2 files changed, 21 insertions(+), 13 deletions(-) diff --git a/distribution/openrct2.d.ts b/distribution/openrct2.d.ts index fefe6f29a7..88916dc30b 100644 --- a/distribution/openrct2.d.ts +++ b/distribution/openrct2.d.ts @@ -2243,51 +2243,55 @@ declare global { 'restart' | 'end'; - interface TitleSequenceCommandBase { - type: TitleSequenceCommandType; - } - - interface LoadTitleSequenceCommand extends TitleSequenceCommandBase { + interface LoadTitleSequenceCommand { type: 'load'; index: number; } - interface LocationTitleSequenceCommand extends TitleSequenceCommandBase { + interface LocationTitleSequenceCommand { type: 'location'; x: number; y: number; } - interface RotateTitleSequenceCommand extends TitleSequenceCommandBase { + interface RotateTitleSequenceCommand { type: 'rotate'; rotations: number; } - interface ZoomTitleSequenceCommand extends TitleSequenceCommandBase { + interface ZoomTitleSequenceCommand { type: 'zoom'; zoom: number; } - interface FollowTitleSequenceCommand extends TitleSequenceCommandBase { + interface FollowTitleSequenceCommand { type: 'follow'; id: number | null; } - interface SpeedTitleSequenceCommand extends TitleSequenceCommandBase { + interface SpeedTitleSequenceCommand { type: 'speed'; speed: number; } - interface WaitTitleSequenceCommand extends TitleSequenceCommandBase { + interface WaitTitleSequenceCommand { type: 'wait'; duration: number; } - interface LoadScenarioTitleSequenceCommand extends TitleSequenceCommandBase { + interface LoadScenarioTitleSequenceCommand { type: 'loadsc'; scenario: string; } + interface RestartTitleSequenceCommand { + type: 'restart'; + } + + interface EndTitleSequenceCommand { + type: 'end'; + } + type TitleSequenceCommand = LoadTitleSequenceCommand | LocationTitleSequenceCommand | @@ -2296,7 +2300,9 @@ declare global { FollowTitleSequenceCommand | SpeedTitleSequenceCommand | WaitTitleSequenceCommand | - LoadScenarioTitleSequenceCommand; + LoadScenarioTitleSequenceCommand | + RestartTitleSequenceCommand | + EndTitleSequenceCommand; interface TitleSequenceManager { /** diff --git a/src/openrct2-ui/scripting/ScTitleSequence.hpp b/src/openrct2-ui/scripting/ScTitleSequence.hpp index 07130c1703..b67f10c73c 100644 --- a/src/openrct2-ui/scripting/ScTitleSequence.hpp +++ b/src/openrct2-ui/scripting/ScTitleSequence.hpp @@ -29,6 +29,8 @@ namespace OpenRCT2::Scripting { "speed", TitleScript::Speed }, { "wait", TitleScript::Wait }, { "loadsc", TitleScript::LoadSc }, + { "restart", TitleScript::Restart }, + { "end", TitleScript::End }, }); template<> DukValue ToDuk(duk_context* ctx, const TitleScript& value)