@@ -954,14 +954,19 @@ bool CStaticFunctionDefinitions::SetElementID(CElement* pElement, const char* sz
954954 return true ;
955955}
956956
957- bool CStaticFunctionDefinitions::SetElementData (CElement* pElement, const char * szName, const CLuaArgument& Variable, ESyncType syncType)
957+ bool CStaticFunctionDefinitions::SetElementData (CElement* pElement, const char * szName, const CLuaArgument& Variable, ESyncType syncType,
958+ std::optional<ECustomDataClientTrust> clientTrust)
958959{
959960 assert (pElement);
960961 assert (szName);
961962 assert (strlen (szName) <= MAX_CUSTOMDATA_NAME_LENGTH);
962963
963- ESyncType lastSyncType = ESyncType::BROADCAST;
964- CLuaArgument* pCurrentVariable = pElement->GetCustomData (szName, false , &lastSyncType);
964+ ESyncType lastSyncType = ESyncType::BROADCAST;
965+ ECustomDataClientTrust lastClientTrust{};
966+ CLuaArgument* pCurrentVariable = pElement->GetCustomData (szName, false , &lastSyncType, &lastClientTrust);
967+
968+ if (clientTrust.has_value () && lastClientTrust != clientTrust.value ())
969+ pElement->GetCustomDataManager ().SetClientChangesMode (szName, clientTrust.value ());
965970
966971 if (!pCurrentVariable || *pCurrentVariable != Variable || lastSyncType != syncType)
967972 {
@@ -984,7 +989,7 @@ bool CStaticFunctionDefinitions::SetElementData(CElement* pElement, const char*
984989 // Unsubscribe all the players
985990 if (lastSyncType == ESyncType::SUBSCRIBE && syncType != ESyncType::SUBSCRIBE)
986991 m_pPlayerManager->ClearElementData (pElement, szName);
987-
992+
988993 // Set its custom data
989994 pElement->SetCustomData (szName, Variable, syncType);
990995 return true ;
0 commit comments