From f9ebe400f7f68bdeda4670f63ab2ecbb027376f5 Mon Sep 17 00:00:00 2001 From: David Cernat Date: Mon, 2 Jul 2018 15:54:39 +0300 Subject: [PATCH] [Server] Add script function for checking if object's summoner is player --- apps/openmw-mp/Script/Functions/Objects.cpp | 5 +++++ apps/openmw-mp/Script/Functions/Objects.hpp | 13 ++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/apps/openmw-mp/Script/Functions/Objects.cpp b/apps/openmw-mp/Script/Functions/Objects.cpp index 3c938dca4..d12c48ff3 100644 --- a/apps/openmw-mp/Script/Functions/Objects.cpp +++ b/apps/openmw-mp/Script/Functions/Objects.cpp @@ -123,6 +123,11 @@ double ObjectFunctions::GetObjectSummonDuration(unsigned int i) noexcept return readObjectList->baseObjects.at(i).summonDuration; } +bool ObjectFunctions::DoesObjectHavePlayerSummoner(unsigned int i) noexcept +{ + return readObjectList->baseObjects.at(i).master.isPlayer; +} + double ObjectFunctions::GetObjectPosX(unsigned int i) noexcept { return readObjectList->baseObjects.at(i).position.pos[0]; diff --git a/apps/openmw-mp/Script/Functions/Objects.hpp b/apps/openmw-mp/Script/Functions/Objects.hpp index acc10cd0c..d9a3d1a8f 100644 --- a/apps/openmw-mp/Script/Functions/Objects.hpp +++ b/apps/openmw-mp/Script/Functions/Objects.hpp @@ -26,6 +26,7 @@ {"GetObjectLockLevel", ObjectFunctions::GetObjectLockLevel},\ {"GetObjectSummonState", ObjectFunctions::GetObjectSummonState},\ {"GetObjectSummonDuration", ObjectFunctions::GetObjectSummonDuration},\ + {"DoesObjectHavePlayerSummoner", ObjectFunctions::DoesObjectHavePlayerSummoner},\ {"GetObjectPosX", ObjectFunctions::GetObjectPosX},\ {"GetObjectPosY", ObjectFunctions::GetObjectPosY},\ {"GetObjectPosZ", ObjectFunctions::GetObjectPosZ},\ @@ -257,7 +258,7 @@ public: * \brief Check whether the object at a certain index in the read object list's object changes * is a summon. * - * Only living actors can have be summoned. + * Only living actors can be summoned. * * \return The summon state. */ @@ -274,6 +275,16 @@ public: */ static double GetObjectSummonDuration(unsigned int i) noexcept; + /** + * \brief Check whether the object at a certain index in the read object list's object changes + * has a player as its summoner. + * + * Only living actors can be summoned. + * + * \return The summon state. + */ + static bool DoesObjectHavePlayerSummoner(unsigned int i) noexcept; + /** * \brief Get the X position of the object at a certain index in the read object list's object * changes.