[Server] Add GetVideoFilename() and SendVideoPlay() script functions

0.6.3
David Cernat 7 years ago
parent 3ed9d89280
commit 14e4f64296

@ -183,6 +183,11 @@ double ObjectFunctions::GetObjectRotZ(unsigned int i) noexcept
return readObjectList->baseObjects.at(i).position.rot[2];
}
const char *ObjectFunctions::GetVideoFilename(unsigned int i) noexcept
{
return readObjectList->baseObjects.at(i).videoFilename.c_str();
}
unsigned int ObjectFunctions::GetContainerChangesSize(unsigned int objectIndex) noexcept
{
return readObjectList->baseObjects.at(objectIndex).containerItemCount;
@ -494,6 +499,16 @@ void ObjectFunctions::SendContainer(bool broadcast) noexcept
packet->Send(true);
}
void ObjectFunctions::SendVideoPlay(bool broadcast) noexcept
{
mwmp::ObjectPacket *packet = mwmp::Networking::get().getObjectPacketController()->GetPacket(ID_VIDEO_PLAY);
packet->setObjectList(&writeObjectList);
packet->Send(false);
if (broadcast)
packet->Send(true);
}
void ObjectFunctions::SendConsoleCommand(bool broadcast) noexcept
{
mwmp::ObjectPacket *packet = mwmp::Networking::get().getObjectPacketController()->GetPacket(ID_CONSOLE_COMMAND);

@ -40,6 +40,8 @@
{"GetObjectRotY", ObjectFunctions::GetObjectRotY},\
{"GetObjectRotZ", ObjectFunctions::GetObjectRotZ},\
\
{"GetVideoFilename", ObjectFunctions::GetVideoFilename},\
\
{"GetContainerChangesSize", ObjectFunctions::GetContainerChangesSize},\
{"GetContainerItemRefId", ObjectFunctions::GetContainerItemRefId},\
{"GetContainerItemCount", ObjectFunctions::GetContainerItemCount},\
@ -97,6 +99,7 @@
{"SendDoorState", ObjectFunctions::SendDoorState},\
{"SendDoorDestination", ObjectFunctions::SendDoorDestination},\
{"SendContainer", ObjectFunctions::SendContainer},\
{"SendVideoPlay", ObjectFunctions::SendVideoPlay},\
{"SendConsoleCommand", ObjectFunctions::SendConsoleCommand},\
\
{"ReadLastEvent", ObjectFunctions::ReadLastEvent},\
@ -381,6 +384,14 @@ public:
*/
static double GetObjectRotZ(unsigned int i) noexcept;
/**
* \brief Get the videoFilename of the object at a certain index in the read object list's object
* changes.
*
* \return The videoFilename.
*/
static const char *GetVideoFilename(unsigned int i) noexcept;
/**
* \brief Get the number of container item indexes of the object at a certain index in the
* read object list's object changes.
@ -865,6 +876,16 @@ public:
*/
static void SendContainer(bool broadcast = false) noexcept;
/**
* \brief Send a VideoPlay packet.
*
* \param broadcast Whether this packet should be sent only to the player for whom the current
* object list was initialized or to everyone on the server.
*
* \return void
*/
static void SendVideoPlay(bool broadcast = false) noexcept;
/**
* \brief Send a ConsoleCommand packet.
*

Loading…
Cancel
Save