mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-07-13 05:51:46 +00:00
[General] Implement sending of ActorSpeech packets from server scripts
This commit is contained in:
parent
338efdb705
commit
5fd4113978
4 changed files with 49 additions and 1 deletions
|
@ -311,6 +311,11 @@ void ActorFunctions::SetActorFatigueModified(double value) noexcept
|
||||||
tempActor.creatureStats.mDynamic[2].mMod = value;
|
tempActor.creatureStats.mDynamic[2].mMod = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ActorFunctions::SetActorSound(const char* sound) noexcept
|
||||||
|
{
|
||||||
|
tempActor.sound = sound;
|
||||||
|
}
|
||||||
|
|
||||||
void ActorFunctions::SetActorAIAction(unsigned int action) noexcept
|
void ActorFunctions::SetActorAIAction(unsigned int action) noexcept
|
||||||
{
|
{
|
||||||
tempActor.aiAction = action;
|
tempActor.aiAction = action;
|
||||||
|
@ -459,6 +464,25 @@ void ActorFunctions::SendActorEquipment(bool sendToOtherVisitors, bool skipAttac
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ActorFunctions::SendActorSpeech(bool sendToOtherVisitors, bool skipAttachedPlayer) noexcept
|
||||||
|
{
|
||||||
|
mwmp::ActorPacket *actorPacket = mwmp::Networking::get().getActorPacketController()->GetPacket(ID_ACTOR_SPEECH);
|
||||||
|
actorPacket->setActorList(&writeActorList);
|
||||||
|
|
||||||
|
if (!skipAttachedPlayer)
|
||||||
|
actorPacket->Send(writeActorList.guid);
|
||||||
|
|
||||||
|
if (sendToOtherVisitors)
|
||||||
|
{
|
||||||
|
Cell *serverCell = CellController::get()->getCell(&writeActorList.cell);
|
||||||
|
|
||||||
|
if (serverCell != nullptr)
|
||||||
|
{
|
||||||
|
serverCell->sendToLoaded(actorPacket, &writeActorList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ActorFunctions::SendActorAI(bool sendToOtherVisitors, bool skipAttachedPlayer) noexcept
|
void ActorFunctions::SendActorAI(bool sendToOtherVisitors, bool skipAttachedPlayer) noexcept
|
||||||
{
|
{
|
||||||
mwmp::ActorPacket *actorPacket = mwmp::Networking::get().getActorPacketController()->GetPacket(ID_ACTOR_AI);
|
mwmp::ActorPacket *actorPacket = mwmp::Networking::get().getActorPacketController()->GetPacket(ID_ACTOR_AI);
|
||||||
|
|
|
@ -71,6 +71,8 @@
|
||||||
{"SetActorFatigueCurrent", ActorFunctions::SetActorFatigueCurrent},\
|
{"SetActorFatigueCurrent", ActorFunctions::SetActorFatigueCurrent},\
|
||||||
{"SetActorFatigueModified", ActorFunctions::SetActorFatigueModified},\
|
{"SetActorFatigueModified", ActorFunctions::SetActorFatigueModified},\
|
||||||
\
|
\
|
||||||
|
{"SetActorSound", ActorFunctions::SetActorSound},\
|
||||||
|
\
|
||||||
{"SetActorAIAction", ActorFunctions::SetActorAIAction},\
|
{"SetActorAIAction", ActorFunctions::SetActorAIAction},\
|
||||||
{"SetActorAITargetToPlayer", ActorFunctions::SetActorAITargetToPlayer},\
|
{"SetActorAITargetToPlayer", ActorFunctions::SetActorAITargetToPlayer},\
|
||||||
{"SetActorAITargetToObject", ActorFunctions::SetActorAITargetToObject},\
|
{"SetActorAITargetToObject", ActorFunctions::SetActorAITargetToObject},\
|
||||||
|
@ -89,6 +91,7 @@
|
||||||
{"SendActorPosition", ActorFunctions::SendActorPosition},\
|
{"SendActorPosition", ActorFunctions::SendActorPosition},\
|
||||||
{"SendActorStatsDynamic", ActorFunctions::SendActorStatsDynamic},\
|
{"SendActorStatsDynamic", ActorFunctions::SendActorStatsDynamic},\
|
||||||
{"SendActorEquipment", ActorFunctions::SendActorEquipment},\
|
{"SendActorEquipment", ActorFunctions::SendActorEquipment},\
|
||||||
|
{"SendActorSpeech", ActorFunctions::SendActorSpeech},\
|
||||||
{"SendActorAI", ActorFunctions::SendActorAI},\
|
{"SendActorAI", ActorFunctions::SendActorAI},\
|
||||||
{"SendActorCellChange", ActorFunctions::SendActorCellChange},\
|
{"SendActorCellChange", ActorFunctions::SendActorCellChange},\
|
||||||
\
|
\
|
||||||
|
@ -570,6 +573,14 @@ public:
|
||||||
*/
|
*/
|
||||||
static void SetActorFatigueModified(double value) noexcept;
|
static void SetActorFatigueModified(double value) noexcept;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Set the sound of the temporary actor stored on the server.
|
||||||
|
*
|
||||||
|
* \param sound The sound.
|
||||||
|
* \return void
|
||||||
|
*/
|
||||||
|
static void SetActorSound(const char* sound) noexcept;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Set the AI action of the temporary actor stored on the server.
|
* \brief Set the AI action of the temporary actor stored on the server.
|
||||||
*
|
*
|
||||||
|
@ -720,6 +731,17 @@ public:
|
||||||
*/
|
*/
|
||||||
static void SendActorEquipment(bool sendToOtherVisitors, bool skipAttachedPlayer) noexcept;
|
static void SendActorEquipment(bool sendToOtherVisitors, bool skipAttachedPlayer) noexcept;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Send an ActorSpeech packet.
|
||||||
|
*
|
||||||
|
* \param sendToOtherVisitors Whether this packet should be sent to cell visitors 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 SendActorSpeech(bool sendToOtherVisitors, bool skipAttachedPlayer) noexcept;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Send an ActorAI packet.
|
* \brief Send an ActorAI packet.
|
||||||
*
|
*
|
||||||
|
|
|
@ -82,7 +82,7 @@ public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Play a certain sound for a player as spoken by their character by sending
|
* \brief Play a certain sound for a player as spoken by their character by sending
|
||||||
* a PlayerSound packet.
|
* a PlayerSpeech packet.
|
||||||
*
|
*
|
||||||
* \param pid The player ID of the character playing the sound.
|
* \param pid The player ID of the character playing the sound.
|
||||||
* \param sound The path of the sound file.
|
* \param sound The path of the sound file.
|
||||||
|
|
|
@ -233,6 +233,8 @@ void Cell::readEquipment(ActorList& actorList)
|
||||||
|
|
||||||
void Cell::readSpeech(ActorList& actorList)
|
void Cell::readSpeech(ActorList& actorList)
|
||||||
{
|
{
|
||||||
|
initializeDedicatedActors(actorList);
|
||||||
|
|
||||||
for (const auto &baseActor : actorList.baseActors)
|
for (const auto &baseActor : actorList.baseActors)
|
||||||
{
|
{
|
||||||
std::string mapIndex = Main::get().getCellController()->generateMapIndex(baseActor);
|
std::string mapIndex = Main::get().getCellController()->generateMapIndex(baseActor);
|
||||||
|
|
Loading…
Reference in a new issue