mirror of
https://github.com/TES3MP/TES3MP.git
synced 2025-09-23 20:48:16 -04:00
Merge pull request #36 from DreamWeave-MP/you-will-be-my-instrument
Feat(Server): Add functions to send music packets to clients
This commit is contained in:
commit
d1d8eb207b
@ -561,6 +561,11 @@ void ObjectFunctions::SetObjectSound(const char* soundId, double volume, double
|
|||||||
tempObject.pitch = pitch;
|
tempObject.pitch = pitch;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ObjectFunctions::SetObjectTrack(const char *soundId) noexcept
|
||||||
|
{
|
||||||
|
tempObject.musicFilename = soundId;
|
||||||
|
}
|
||||||
|
|
||||||
void ObjectFunctions::SetObjectSummonState(bool summonState) noexcept
|
void ObjectFunctions::SetObjectSummonState(bool summonState) noexcept
|
||||||
{
|
{
|
||||||
tempObject.isSummon = summonState;
|
tempObject.isSummon = summonState;
|
||||||
@ -833,6 +838,16 @@ void ObjectFunctions::SendObjectSound(bool sendToOtherPlayers, bool skipAttached
|
|||||||
packet->Send(true);
|
packet->Send(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ObjectFunctions::SendObjectTrack(bool sendToOtherPlayers, bool skipAttachedPlayer) noexcept {
|
||||||
|
mwmp::ObjectPacket *packet = mwmp::Networking::get().getObjectPacketController()->GetPacket(ID_MUSIC_PLAY);
|
||||||
|
packet->setObjectList(&writeObjectList);
|
||||||
|
|
||||||
|
if (!skipAttachedPlayer)
|
||||||
|
packet->Send(false);
|
||||||
|
if (sendToOtherPlayers)
|
||||||
|
packet->Send(true);
|
||||||
|
}
|
||||||
|
|
||||||
void ObjectFunctions::SendObjectState(bool sendToOtherPlayers, bool skipAttachedPlayer) noexcept
|
void ObjectFunctions::SendObjectState(bool sendToOtherPlayers, bool skipAttachedPlayer) noexcept
|
||||||
{
|
{
|
||||||
mwmp::ObjectPacket *packet = mwmp::Networking::get().getObjectPacketController()->GetPacket(ID_OBJECT_STATE);
|
mwmp::ObjectPacket *packet = mwmp::Networking::get().getObjectPacketController()->GetPacket(ID_OBJECT_STATE);
|
||||||
|
@ -117,6 +117,7 @@
|
|||||||
{"SetObjectPosition", ObjectFunctions::SetObjectPosition},\
|
{"SetObjectPosition", ObjectFunctions::SetObjectPosition},\
|
||||||
{"SetObjectRotation", ObjectFunctions::SetObjectRotation},\
|
{"SetObjectRotation", ObjectFunctions::SetObjectRotation},\
|
||||||
{"SetObjectSound", ObjectFunctions::SetObjectSound},\
|
{"SetObjectSound", ObjectFunctions::SetObjectSound},\
|
||||||
|
{"SetObjectTrack", ObjectFunctions::SetObjectTrack},\
|
||||||
\
|
\
|
||||||
{"SetObjectSummonState", ObjectFunctions::SetObjectSummonState},\
|
{"SetObjectSummonState", ObjectFunctions::SetObjectSummonState},\
|
||||||
{"SetObjectSummonEffectId", ObjectFunctions::SetObjectSummonEffectId},\
|
{"SetObjectSummonEffectId", ObjectFunctions::SetObjectSummonEffectId},\
|
||||||
@ -160,6 +161,7 @@
|
|||||||
{"SendObjectTrap", ObjectFunctions::SendObjectTrap},\
|
{"SendObjectTrap", ObjectFunctions::SendObjectTrap},\
|
||||||
{"SendObjectScale", ObjectFunctions::SendObjectScale},\
|
{"SendObjectScale", ObjectFunctions::SendObjectScale},\
|
||||||
{"SendObjectSound", ObjectFunctions::SendObjectSound},\
|
{"SendObjectSound", ObjectFunctions::SendObjectSound},\
|
||||||
|
{"SendObjectTrack", ObjectFunctions::SendObjectTrack},\
|
||||||
{"SendObjectState", ObjectFunctions::SendObjectState},\
|
{"SendObjectState", ObjectFunctions::SendObjectState},\
|
||||||
{"SendObjectMove", ObjectFunctions::SendObjectMove},\
|
{"SendObjectMove", ObjectFunctions::SendObjectMove},\
|
||||||
{"SendObjectRotate", ObjectFunctions::SendObjectRotate},\
|
{"SendObjectRotate", ObjectFunctions::SendObjectRotate},\
|
||||||
@ -1087,7 +1089,21 @@ public:
|
|||||||
*/
|
*/
|
||||||
static void SetObjectRotation(double x, double y, double z) noexcept;
|
static void SetObjectRotation(double x, double y, double z) noexcept;
|
||||||
|
|
||||||
static void SetObjectSound(const char* soundId, double volume, double pitch) noexcept;
|
/**
|
||||||
|
* \brief Set the Sound of the temporary object stored on the server
|
||||||
|
*
|
||||||
|
* \param soundId Sets the refId of the sound to be played on the client
|
||||||
|
* \param volume Set the volume of the sound to be played on the client
|
||||||
|
* \param pitch Set the pitch of the sound to be played on the client
|
||||||
|
*/
|
||||||
|
static void SetObjectSound(const char *soundId, double volume, double pitch) noexcept;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Set the Sound of the temporary object stored on the server
|
||||||
|
*
|
||||||
|
* \param track Sets the track name to be played on the client
|
||||||
|
*/
|
||||||
|
static void SetObjectTrack(const char *soundId) noexcept;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Set the summon state of the temporary object stored on the server.
|
* \brief Set the summon state of the temporary object stored on the server.
|
||||||
@ -1439,6 +1455,17 @@ public:
|
|||||||
*/
|
*/
|
||||||
static void SendObjectSound(bool sendToOtherPlayers, bool skipAttachedPlayer) noexcept;
|
static void SendObjectSound(bool sendToOtherPlayers, bool skipAttachedPlayer) noexcept;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Send a Music_Play packet.
|
||||||
|
*
|
||||||
|
* \param sendToOtherPlayers Whether this packet should be sent to players other than the
|
||||||
|
* player attached to the packet (false by default).
|
||||||
|
* \param skipAttachedPlayer Whether the packet should skip being sent to the player attached
|
||||||
|
* to the packet (false by default).
|
||||||
|
* \return void
|
||||||
|
*/
|
||||||
|
static void SendObjectTrack(bool sendToOtherPlayers, bool skipAttachedPlayer) noexcept;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Send an ObjectState packet.
|
* \brief Send an ObjectState packet.
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user