diff --git a/apps/openmw-mp/Script/Functions/Objects.cpp b/apps/openmw-mp/Script/Functions/Objects.cpp index 93a91dce6..4e8528a6b 100644 --- a/apps/openmw-mp/Script/Functions/Objects.cpp +++ b/apps/openmw-mp/Script/Functions/Objects.cpp @@ -399,6 +399,15 @@ void ObjectFunctions::SetObjectRotation(double x, double y, double z) noexcept tempObject.position.rot[2] = z; } +void ObjectFunctions::SetObjectActivatingPid(unsigned short pid) noexcept +{ + Player *player; + GET_PLAYER(pid, player, ); + + tempObject.activatingActor.guid = player->guid; + tempObject.activatingActor.isPlayer = true; +} + void ObjectFunctions::SetObjectDoorState(int doorState) noexcept { tempObject.doorState = doorState; diff --git a/apps/openmw-mp/Script/Functions/Objects.hpp b/apps/openmw-mp/Script/Functions/Objects.hpp index 95ef01deb..bed37e903 100644 --- a/apps/openmw-mp/Script/Functions/Objects.hpp +++ b/apps/openmw-mp/Script/Functions/Objects.hpp @@ -85,6 +85,8 @@ {"SetObjectPosition", ObjectFunctions::SetObjectPosition},\ {"SetObjectRotation", ObjectFunctions::SetObjectRotation},\ \ + {"SetObjectActivatingPid", ObjectFunctions::SetObjectActivatingPid},\ + \ {"SetObjectDoorState", ObjectFunctions::SetObjectDoorState},\ {"SetObjectDoorTeleportState", ObjectFunctions::SetObjectDoorTeleportState},\ {"SetObjectDoorDestinationCell", ObjectFunctions::SetObjectDoorDestinationCell},\ @@ -776,6 +778,15 @@ public: */ static void SetObjectRotation(double x, double y, double z) noexcept; + /** + * \brief Set the player ID of the player activating the temporary object stored on the + * server. Currently only used for ObjectActivate packets. + * + * \param pid The pid of the player. + * \return void + */ + static void SetObjectActivatingPid(unsigned short pid) noexcept; + /** * \brief Set the door state of the temporary object stored on the server. *