1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-03-31 03:06:44 +00:00

[Server] Add server functions for handling the droppedByPlayer boolean

This commit is contained in:
David Cernat 2020-02-27 14:53:03 +02:00
parent 8b2bf941cd
commit 1a7060c5c5
2 changed files with 31 additions and 1 deletions

View file

@ -380,6 +380,11 @@ bool ObjectFunctions::DoesObjectHaveContainer(unsigned int index) noexcept
return readObjectList->baseObjects.at(index).hasContainer;
}
bool ObjectFunctions::IsObjectDroppedByPlayer(unsigned int index) noexcept
{
return readObjectList->baseObjects.at(index).droppedByPlayer;
}
void ObjectFunctions::SetObjectListCell(const char* cellDescription) noexcept
{
writeObjectList.cell = Utils::getCellFromDescription(cellDescription);
@ -455,6 +460,11 @@ void ObjectFunctions::SetObjectDisarmState(bool disarmState) noexcept
tempObject.isDisarmed = disarmState;
}
void ObjectFunctions::SetObjectDroppedByPlayerState(bool droppedByPlayer) noexcept
{
tempObject.droppedByPlayer = droppedByPlayer;
}
void ObjectFunctions::SetObjectPosition(double x, double y, double z) noexcept
{
tempObject.position.pos[0] = x;
@ -598,7 +608,6 @@ void ObjectFunctions::SetContainerItemActionCountByIndex(unsigned int objectInde
void ObjectFunctions::AddObject() noexcept
{
tempObject.droppedByPlayer = false;
writeObjectList.baseObjects.push_back(tempObject);
tempObject = emptyObject;

View file

@ -80,6 +80,7 @@
{"GetContainerItemActionCount", ObjectFunctions::GetContainerItemActionCount},\
\
{"DoesObjectHaveContainer", ObjectFunctions::DoesObjectHaveContainer},\
{"IsObjectDroppedByPlayer", ObjectFunctions::IsObjectDroppedByPlayer},\
\
{"SetObjectListCell", ObjectFunctions::SetObjectListCell},\
{"SetObjectListAction", ObjectFunctions::SetObjectListAction},\
@ -97,6 +98,7 @@
{"SetObjectState", ObjectFunctions::SetObjectState},\
{"SetObjectLockLevel", ObjectFunctions::SetObjectLockLevel},\
{"SetObjectDisarmState", ObjectFunctions::SetObjectDisarmState},\
{"SetObjectDroppedByPlayerState", ObjectFunctions::SetObjectDroppedByPlayerState},\
{"SetObjectPosition", ObjectFunctions::SetObjectPosition},\
{"SetObjectRotation", ObjectFunctions::SetObjectRotation},\
\
@ -732,6 +734,17 @@ public:
*/
static bool DoesObjectHaveContainer(unsigned int index) noexcept;
/**
* \brief Check whether the object at a certain index in the read object list has been
* dropped by a player.
*
* Note: Only ObjectLists from ObjectPlace packets contain this information.
*
* \param index The index of the object.
* \return Whether the object has been dropped by a player.
*/
static bool IsObjectDroppedByPlayer(unsigned int index) noexcept;
/**
* \brief Set the cell of the temporary object list stored on the server.
*
@ -883,6 +896,14 @@ public:
*/
static void SetObjectDisarmState(bool disarmState) noexcept;
/**
* \brief Set the droppedByPlayer state of the temporary object stored on the server.
*
* \param droppedByPlayer Whether the object has been dropped by a player or not.
* \return void
*/
static void SetObjectDroppedByPlayerState(bool dropedByPlayerState) noexcept;
/**
* \brief Set the position of the temporary object stored on the server.
*