summaryrefslogtreecommitdiff
path: root/src/script/api/game/game_event_types.hpp.sq
diff options
context:
space:
mode:
authorNiels Martin Hansen <nielsm@indvikleren.dk>2020-05-22 22:22:55 +0200
committerGitHub <noreply@github.com>2020-05-22 22:22:55 +0200
commit800ade77021b34adf8daa5ca5de0efaa8df24152 (patch)
tree7a2eb5c73c926476c81cd782bcb9b42c93bafdc4 /src/script/api/game/game_event_types.hpp.sq
parentc972a63c8cbee7fa8d6d5af2cbbecb8c75ee561a (diff)
downloadopenttd-800ade77021b34adf8daa5ca5de0efaa8df24152.tar.xz
Feature: Push-buttons on storybook pages (#7896)
Allow more direct player-initiated interaction for Game Scripts, by letting the GS put push-buttons on storybook pages. These buttons can either trigger an immediate event, or require the player to first select a tile on the map, or a vehicle. Additionally this reworks how the storybook pages are layouted and rendered, to allow for slightly more complex layouts, and maybe speeding drawing up a bit.
Diffstat (limited to 'src/script/api/game/game_event_types.hpp.sq')
-rw-r--r--src/script/api/game/game_event_types.hpp.sq53
1 files changed, 53 insertions, 0 deletions
diff --git a/src/script/api/game/game_event_types.hpp.sq b/src/script/api/game/game_event_types.hpp.sq
index 62e4f6a08..6a0e89b49 100644
--- a/src/script/api/game/game_event_types.hpp.sq
+++ b/src/script/api/game/game_event_types.hpp.sq
@@ -308,3 +308,56 @@ void SQGSEventRoadReconstruction_Register(Squirrel *engine)
SQGSEventRoadReconstruction.PostRegister(engine);
}
+
+
+template <> const char *GetClassName<ScriptEventStoryPageButtonClick, ST_GS>() { return "GSEventStoryPageButtonClick"; }
+
+void SQGSEventStoryPageButtonClick_Register(Squirrel *engine)
+{
+ DefSQClass<ScriptEventStoryPageButtonClick, ST_GS> SQGSEventStoryPageButtonClick("GSEventStoryPageButtonClick");
+ SQGSEventStoryPageButtonClick.PreRegister(engine, "GSEvent");
+
+ SQGSEventStoryPageButtonClick.DefSQStaticMethod(engine, &ScriptEventStoryPageButtonClick::Convert, "Convert", 2, ".x");
+
+ SQGSEventStoryPageButtonClick.DefSQMethod(engine, &ScriptEventStoryPageButtonClick::GetCompanyID, "GetCompanyID", 1, "x");
+ SQGSEventStoryPageButtonClick.DefSQMethod(engine, &ScriptEventStoryPageButtonClick::GetStoryPageID, "GetStoryPageID", 1, "x");
+ SQGSEventStoryPageButtonClick.DefSQMethod(engine, &ScriptEventStoryPageButtonClick::GetElementID, "GetElementID", 1, "x");
+
+ SQGSEventStoryPageButtonClick.PostRegister(engine);
+}
+
+
+template <> const char *GetClassName<ScriptEventStoryPageTileSelect, ST_GS>() { return "GSEventStoryPageTileSelect"; }
+
+void SQGSEventStoryPageTileSelect_Register(Squirrel *engine)
+{
+ DefSQClass<ScriptEventStoryPageTileSelect, ST_GS> SQGSEventStoryPageTileSelect("GSEventStoryPageTileSelect");
+ SQGSEventStoryPageTileSelect.PreRegister(engine, "GSEvent");
+
+ SQGSEventStoryPageTileSelect.DefSQStaticMethod(engine, &ScriptEventStoryPageTileSelect::Convert, "Convert", 2, ".x");
+
+ SQGSEventStoryPageTileSelect.DefSQMethod(engine, &ScriptEventStoryPageTileSelect::GetCompanyID, "GetCompanyID", 1, "x");
+ SQGSEventStoryPageTileSelect.DefSQMethod(engine, &ScriptEventStoryPageTileSelect::GetStoryPageID, "GetStoryPageID", 1, "x");
+ SQGSEventStoryPageTileSelect.DefSQMethod(engine, &ScriptEventStoryPageTileSelect::GetElementID, "GetElementID", 1, "x");
+ SQGSEventStoryPageTileSelect.DefSQMethod(engine, &ScriptEventStoryPageTileSelect::GetTile, "GetTile", 1, "x");
+
+ SQGSEventStoryPageTileSelect.PostRegister(engine);
+}
+
+
+template <> const char *GetClassName<ScriptEventStoryPageVehicleSelect, ST_GS>() { return "GSEventStoryPageVehicleSelect"; }
+
+void SQGSEventStoryPageVehicleSelect_Register(Squirrel *engine)
+{
+ DefSQClass<ScriptEventStoryPageVehicleSelect, ST_GS> SQGSEventStoryPageVehicleSelect("GSEventStoryPageVehicleSelect");
+ SQGSEventStoryPageVehicleSelect.PreRegister(engine, "GSEvent");
+
+ SQGSEventStoryPageVehicleSelect.DefSQStaticMethod(engine, &ScriptEventStoryPageVehicleSelect::Convert, "Convert", 2, ".x");
+
+ SQGSEventStoryPageVehicleSelect.DefSQMethod(engine, &ScriptEventStoryPageVehicleSelect::GetCompanyID, "GetCompanyID", 1, "x");
+ SQGSEventStoryPageVehicleSelect.DefSQMethod(engine, &ScriptEventStoryPageVehicleSelect::GetStoryPageID, "GetStoryPageID", 1, "x");
+ SQGSEventStoryPageVehicleSelect.DefSQMethod(engine, &ScriptEventStoryPageVehicleSelect::GetElementID, "GetElementID", 1, "x");
+ SQGSEventStoryPageVehicleSelect.DefSQMethod(engine, &ScriptEventStoryPageVehicleSelect::GetVehicleID, "GetVehicleID", 1, "x");
+
+ SQGSEventStoryPageVehicleSelect.PostRegister(engine);
+}