From a990a6d133860671491a6800fc1c0b6cf84eff79 Mon Sep 17 00:00:00 2001 From: mohe2015 Date: Sun, 13 Nov 2016 16:04:18 +0100 Subject: [PATCH] Add Lua API export for titles. (#3408) --- Server/Plugins/APIDump/APIDesc.lua | 72 ++++++++++++++++++++++++++++++ src/ClientHandle.h | 14 +++--- 2 files changed, 79 insertions(+), 7 deletions(-) diff --git a/Server/Plugins/APIDump/APIDesc.lua b/Server/Plugins/APIDump/APIDesc.lua index a32bec2e8..79fcc67c1 100644 --- a/Server/Plugins/APIDump/APIDesc.lua +++ b/Server/Plugins/APIDump/APIDesc.lua @@ -3471,6 +3471,10 @@ end }, Notes = "Sends the specified animation of the specified entity to the client. The AnimationNumber is protocol-specific.", }, + SendHideTitle = + { + Notes = "Hides the title. This makes the title and subtitle disappear, but if you call SendTitleTimes() the same title and subtitle will appear again." + }, SendPluginMessage = { Params = @@ -3486,6 +3490,54 @@ end }, Notes = "Sends the plugin message on the specified channel.", }, + SendResetTitle = + { + Notes = "Resets and hides the title but not the subtitle." + }, + SendSetSubTitle = + { + Params = + { + { + Name = "SubTitle", + Type = "cCompositeChat", + }, + }, + Notes = "Sends the subtitle to the client. Doesn't make the client display it yet, use SendTitleTimes() to show both the title and the subtitle." + }, + SendSetRawSubTitle = + { + Params = + { + { + Name = "SubTitle", + Type = "string", + }, + }, + Notes = "Sends the raw subtitle to the client. Doesn't make the client display it yet, use SendTitleTimes() to show both the title and the subtitle." + }, + SendSetTitle = + { + Params = + { + { + Name = "Title", + Type = "cCompositeChat", + }, + }, + Notes = "Sends the title to the client. Doesn't make the client display it yet, use SendTitleTimes() to show both the title and the subtitle." + }, + SendSetRawTitle = + { + Params = + { + { + Name = "Title", + Type = "string", + }, + }, + Notes = "Sends the raw title to the client. Doesn't make the client display it yet, use SendTitleTimes() to show both the title and the subtitle." + }, SendSoundEffect = { Params = @@ -3517,6 +3569,25 @@ end }, Notes = "Sends a sound effect request to the client. The sound is played at the specified coords, with the specified volume (a float, 1.0 is full volume, can be more) and pitch (0-255, 63 is 100%)", }, + SendTitleTimes = + { + Params = + { + { + Name = "FadeInTicks", + Type = "number", + }, + { + Name = "DisplayTicks", + Type = "number", + }, + { + Name = "FadeOutTicks", + Type = "number", + }, + }, + Notes = "Sends the request to display the title and subtitle, previously set with SendSetTitle, SendSetRawTitle, SendSetSubTitle and SendSetRawSubTitle, to the client." + }, SendTimeUpdate = { Params = @@ -17416,3 +17487,4 @@ end "__.*__", }, } + diff --git a/src/ClientHandle.h b/src/ClientHandle.h index 77c94db09..a361a0fb5 100644 --- a/src/ClientHandle.h +++ b/src/ClientHandle.h @@ -186,7 +186,7 @@ public: // tolua_export void SendExplosion (double a_BlockX, double a_BlockY, double a_BlockZ, float a_Radius, const cVector3iArray & a_BlocksAffected, const Vector3d & a_PlayerMotion); void SendGameMode (eGameMode a_GameMode); void SendHealth (void); - void SendHideTitle (void); + void SendHideTitle (void); // tolua_export void SendInventorySlot (char a_WindowID, short a_SlotNum, const cItem & a_Item); void SendMapData (const cMap & a_Map, int a_DataStartX, int a_DataStartY); void SendPaintingSpawn (const cPainting & a_Painting); @@ -205,14 +205,14 @@ public: // tolua_export void SendPlayerSpawn (const cPlayer & a_Player); void SendPluginMessage (const AString & a_Channel, const AString & a_Message); // Exported in ManualBindings.cpp void SendRemoveEntityEffect (const cEntity & a_Entity, int a_EffectID); - void SendResetTitle (void); + void SendResetTitle (void); // tolua_export void SendRespawn (eDimension a_Dimension, bool a_ShouldIgnoreDimensionChecks = false); void SendScoreUpdate (const AString & a_Objective, const AString & a_Player, cObjective::Score a_Score, Byte a_Mode); void SendScoreboardObjective (const AString & a_Name, const AString & a_DisplayName, Byte a_Mode); - void SendSetSubTitle (const cCompositeChat & a_SubTitle); - void SendSetRawSubTitle (const AString & a_SubTitle); - void SendSetTitle (const cCompositeChat & a_Title); - void SendSetRawTitle (const AString & a_Title); + void SendSetSubTitle (const cCompositeChat & a_SubTitle); // tolua_export + void SendSetRawSubTitle (const AString & a_SubTitle); // tolua_export + void SendSetTitle (const cCompositeChat & a_Title); // tolua_export + void SendSetRawTitle (const AString & a_Title); // tolua_export void SendSoundEffect (const AString & a_SoundName, double a_X, double a_Y, double a_Z, float a_Volume, float a_Pitch); // tolua_export void SendSoundParticleEffect (const EffectID a_EffectID, int a_SrcX, int a_SrcY, int a_SrcZ, int a_Data); void SendSpawnFallingBlock (const cFallingBlock & a_FallingBlock); @@ -223,7 +223,7 @@ public: // tolua_export void SendTabCompletionResults (const AStringVector & a_Results); void SendTeleportEntity (const cEntity & a_Entity); void SendThunderbolt (int a_BlockX, int a_BlockY, int a_BlockZ); - void SendTitleTimes (int a_FadeInTicks, int a_DisplayTicks, int a_FadeOutTicks); + void SendTitleTimes (int a_FadeInTicks, int a_DisplayTicks, int a_FadeOutTicks); // tolua_export void SendTimeUpdate (Int64 a_WorldAge, Int64 a_TimeOfDay, bool a_DoDaylightCycle); // tolua_export void SendUnloadChunk (int a_ChunkX, int a_ChunkZ); void SendUpdateBlockEntity (cBlockEntity & a_BlockEntity);