Showing the changes to libraries/script-engine/src/ScriptEngine.cpp (1 of 3 files). Show all
Unified · Split
| @@ -45,6 +45,7 @@ ScriptEngine::ScriptEngine(const QString& scriptContents, bool wantMenuItems, co · 44 unmodified lines | |||
| 45 | AbstractControllerScriptingInterface* controllerScriptingInterface) : | 45 | AbstractControllerScriptingInterface* controllerScriptingInterface) : |
| 46 | _isAvatar(false), | 46 | _isAvatar(false), |
| 47 | _avatarIdentityTimer(NULL), | 47 | _avatarIdentityTimer(NULL), |
| 48 | _avatarBillboardTimer(NULL), | ||
| 48 | _avatarData(NULL) | 49 | _avatarData(NULL) |
| 49 | { | 50 | { |
| 50 | _scriptContents = scriptContents; | 51 | _scriptContents = scriptContents; |
| @@ -79,14 +80,17 @@ void ScriptEngine::setIsAvatar(bool isAvatar) { · 28 unmodified lines | |||
| 79 | _isAvatar = isAvatar; | 80 | _isAvatar = isAvatar; |
| 80 | 81 | ||
| 81 | if (_isAvatar && !_avatarIdentityTimer) { | 82 | if (_isAvatar && !_avatarIdentityTimer) { |
| 82 | // set up the avatar identity timer | 83 | // set up the avatar timers |
| 83 | _avatarIdentityTimer = new QTimer(this); | 84 | _avatarIdentityTimer = new QTimer(this); |
| 85 | _avatarBillboardTimer = new QTimer(this); | ||
| 84 | 86 | ||
| 85 | // connect our slot | 87 | // connect our slot |
| 86 | connect(_avatarIdentityTimer, &QTimer::timeout, this, &ScriptEngine::sendAvatarIdentityPacket); | 88 | connect(_avatarIdentityTimer, &QTimer::timeout, this, &ScriptEngine::sendAvatarIdentityPacket); |
| 89 | connect(_avatarBillboardTimer, &QTimer::timeout, this, &ScriptEngine::sendAvatarBillboardPacket); | ||
| 87 | 90 | ||
| 88 | // start the timer | 91 | // start the timers |
| 89 | _avatarIdentityTimer->start(AVATAR_IDENTITY_PACKET_SEND_INTERVAL_MSECS); | 92 | _avatarIdentityTimer->start(AVATAR_IDENTITY_PACKET_SEND_INTERVAL_MSECS); |
| 93 | _avatarBillboardTimer->start(AVATAR_BILLBOARD_PACKET_SEND_INTERVAL_MSECS); | ||
| 90 | } | 94 | } |
| 91 | } | 95 | } |
| 92 | 96 | ||
| @@ -196,6 +200,12 @@ void ScriptEngine::sendAvatarIdentityPacket() { · 103 unmodified lines | |||
| 196 | } | 200 | } |
| 197 | } | 201 | } |
| 198 | 202 | ||
| 203 | void ScriptEngine::sendAvatarBillboardPacket() { | ||
| 204 | if (_isAvatar && _avatarData) { | ||
| 205 | _avatarData->sendBillboardPacket(); | ||
| 206 | } | ||
| 207 | } | ||
| 208 | |||
| 199 | void ScriptEngine::run() { | 209 | void ScriptEngine::run() { |
| 200 | if (!_isInitialized) { | 210 | if (!_isInitialized) { |
| 201 | init(); | 211 | init(); |