mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-02-27 01:39:45 +00:00
[Server] Add script functions that read & send ScriptGlobalShort packets
This commit is contained in:
parent
0d51eb5b23
commit
ca21bc35c2
2 changed files with 46 additions and 0 deletions
|
@ -254,6 +254,16 @@ const char *ObjectFunctions::GetVideoFilename(unsigned int index) noexcept
|
|||
return readObjectList->baseObjects.at(index).videoFilename.c_str();
|
||||
}
|
||||
|
||||
const char *ObjectFunctions::GetScriptVariableName(unsigned int index) noexcept
|
||||
{
|
||||
return readObjectList->baseObjects.at(index).varName.c_str();
|
||||
}
|
||||
|
||||
int ObjectFunctions::GetScriptVariableShortValue(unsigned int index) noexcept
|
||||
{
|
||||
return readObjectList->baseObjects.at(index).shortVal;
|
||||
}
|
||||
|
||||
unsigned int ObjectFunctions::GetContainerChangesSize(unsigned int objectIndex) noexcept
|
||||
{
|
||||
return readObjectList->baseObjects.at(objectIndex).containerItemCount;
|
||||
|
@ -436,6 +446,16 @@ void ObjectFunctions::SetObjectDoorDestinationRotation(double x, double z) noexc
|
|||
tempObject.destinationPosition.rot[2] = z;
|
||||
}
|
||||
|
||||
void ObjectFunctions::SetScriptVariableName(const char* varName) noexcept
|
||||
{
|
||||
tempObject.varName = varName;
|
||||
}
|
||||
|
||||
void ObjectFunctions::SetScriptVariableShortValue(int shortVal) noexcept
|
||||
{
|
||||
tempObject.shortVal = shortVal;
|
||||
}
|
||||
|
||||
void ObjectFunctions::SetPlayerAsObject(unsigned short pid) noexcept
|
||||
{
|
||||
Player *player;
|
||||
|
@ -622,6 +642,17 @@ void ObjectFunctions::SendVideoPlay(bool sendToOtherPlayers, bool skipAttachedPl
|
|||
packet->Send(true);
|
||||
}
|
||||
|
||||
void ObjectFunctions::SendScriptGlobalShort(bool sendToOtherPlayers, bool skipAttachedPlayer) noexcept
|
||||
{
|
||||
mwmp::ObjectPacket *packet = mwmp::Networking::get().getObjectPacketController()->GetPacket(ID_SCRIPT_GLOBAL_SHORT);
|
||||
packet->setObjectList(&writeObjectList);
|
||||
|
||||
if (!skipAttachedPlayer)
|
||||
packet->Send(false);
|
||||
if (sendToOtherPlayers)
|
||||
packet->Send(true);
|
||||
}
|
||||
|
||||
void ObjectFunctions::SendConsoleCommand(bool sendToOtherPlayers, bool skipAttachedPlayer) noexcept
|
||||
{
|
||||
mwmp::ObjectPacket *packet = mwmp::Networking::get().getObjectPacketController()->GetPacket(ID_CONSOLE_COMMAND);
|
||||
|
|
|
@ -54,6 +54,9 @@
|
|||
\
|
||||
{"GetVideoFilename", ObjectFunctions::GetVideoFilename},\
|
||||
\
|
||||
{"GetScriptVariableName", ObjectFunctions::GetScriptVariableName},\
|
||||
{"GetScriptVariableShortValue", ObjectFunctions::GetScriptVariableShortValue},\
|
||||
\
|
||||
{"GetContainerChangesSize", ObjectFunctions::GetContainerChangesSize},\
|
||||
{"GetContainerItemRefId", ObjectFunctions::GetContainerItemRefId},\
|
||||
{"GetContainerItemCount", ObjectFunctions::GetContainerItemCount},\
|
||||
|
@ -93,6 +96,9 @@
|
|||
{"SetObjectDoorDestinationPosition", ObjectFunctions::SetObjectDoorDestinationPosition},\
|
||||
{"SetObjectDoorDestinationRotation", ObjectFunctions::SetObjectDoorDestinationRotation},\
|
||||
\
|
||||
{"SetScriptVariableName", ObjectFunctions::SetScriptVariableName},\
|
||||
{"SetScriptVariableShortValue", ObjectFunctions::SetScriptVariableShortValue},\
|
||||
\
|
||||
{"SetPlayerAsObject", ObjectFunctions::SetPlayerAsObject},\
|
||||
\
|
||||
{"SetContainerItemRefId", ObjectFunctions::SetContainerItemRefId},\
|
||||
|
@ -118,6 +124,7 @@
|
|||
{"SendDoorDestination", ObjectFunctions::SendDoorDestination},\
|
||||
{"SendContainer", ObjectFunctions::SendContainer},\
|
||||
{"SendVideoPlay", ObjectFunctions::SendVideoPlay},\
|
||||
{"SendScriptGlobalShort", ObjectFunctions::SendScriptGlobalShort},\
|
||||
{"SendConsoleCommand", ObjectFunctions::SendConsoleCommand},\
|
||||
\
|
||||
{"ReadLastObjectList", ObjectFunctions::ReadLastObjectList},\
|
||||
|
@ -508,6 +515,9 @@ public:
|
|||
*/
|
||||
static const char *GetVideoFilename(unsigned int index) noexcept;
|
||||
|
||||
static const char *GetScriptVariableName(unsigned int index) noexcept;
|
||||
static int GetScriptVariableShortValue(unsigned int index) noexcept;
|
||||
|
||||
/**
|
||||
* \brief Get the number of container item indexes of the object at a certain index in the
|
||||
* read object list.
|
||||
|
@ -841,6 +851,9 @@ public:
|
|||
*/
|
||||
static void SetObjectDoorDestinationRotation(double x, double z) noexcept;
|
||||
|
||||
static void SetScriptVariableName(const char* varName) noexcept;
|
||||
static void SetScriptVariableShortValue(int shortVal) noexcept;
|
||||
|
||||
/**
|
||||
* \brief Set a player as the object in the temporary object stored on the server.
|
||||
* Currently only used for ConsoleCommand packets.
|
||||
|
@ -1057,6 +1070,8 @@ public:
|
|||
*/
|
||||
static void SendVideoPlay(bool sendToOtherPlayers, bool skipAttachedPlayer) noexcept;
|
||||
|
||||
static void SendScriptGlobalShort(bool sendToOtherPlayers, bool skipAttachedPlayer) noexcept;
|
||||
|
||||
/**
|
||||
* \brief Send a ConsoleCommand packet.
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue