mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 20:58:38 +02:00
changes to send an update to entity-server when AvatarActionHold releases an entity
This commit is contained in:
parent
5bc5b3ce62
commit
4ed8a1e5d1
5 changed files with 27 additions and 7 deletions
|
@ -30,7 +30,7 @@ public:
|
||||||
QByteArray serialize() const;
|
QByteArray serialize() const;
|
||||||
virtual void deserialize(QByteArray serializedArguments);
|
virtual void deserialize(QByteArray serializedArguments);
|
||||||
|
|
||||||
virtual bool shouldSuppressLocationEdits() { return true; }
|
virtual bool shouldSuppressLocationEdits() { return _active && !_ownerEntity.expired(); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static const uint16_t holdVersion;
|
static const uint16_t holdVersion;
|
||||||
|
|
|
@ -611,6 +611,16 @@ EntityItemPointer EntityTree::findEntityByEntityItemID(const EntityItemID& entit
|
||||||
return foundEntity;
|
return foundEntity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void EntityTree::fixupTerseEditLogging(EntityItemProperties& properties, QList<QString>& changedProperties) {
|
||||||
|
if (properties.simulationOwnerChanged()) {
|
||||||
|
int simIndex = changedProperties.indexOf("simulationOwner");
|
||||||
|
if (simIndex >= 0) {
|
||||||
|
SimulationOwner simOwner = properties.getSimulationOwner();
|
||||||
|
changedProperties[simIndex] = QString("simulationOwner:") + QString::number((int)simOwner.getPriority());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int EntityTree::processEditPacketData(NLPacket& packet, const unsigned char* editData, int maxLength,
|
int EntityTree::processEditPacketData(NLPacket& packet, const unsigned char* editData, int maxLength,
|
||||||
const SharedNodePointer& senderNode) {
|
const SharedNodePointer& senderNode) {
|
||||||
|
|
||||||
|
@ -661,7 +671,9 @@ int EntityTree::processEditPacketData(NLPacket& packet, const unsigned char* edi
|
||||||
qCDebug(entities) << " properties:" << properties;
|
qCDebug(entities) << " properties:" << properties;
|
||||||
}
|
}
|
||||||
if (wantTerseEditLogging()) {
|
if (wantTerseEditLogging()) {
|
||||||
qCDebug(entities) << "edit" << entityItemID.toString() << properties.listChangedProperties();
|
QList<QString> changedProperties = properties.listChangedProperties();
|
||||||
|
fixupTerseEditLogging(properties, changedProperties);
|
||||||
|
qCDebug(entities) << "edit" << entityItemID.toString() << changedProperties;
|
||||||
}
|
}
|
||||||
endLogging = usecTimestampNow();
|
endLogging = usecTimestampNow();
|
||||||
|
|
||||||
|
@ -689,7 +701,9 @@ int EntityTree::processEditPacketData(NLPacket& packet, const unsigned char* edi
|
||||||
qCDebug(entities) << " properties:" << properties;
|
qCDebug(entities) << " properties:" << properties;
|
||||||
}
|
}
|
||||||
if (wantTerseEditLogging()) {
|
if (wantTerseEditLogging()) {
|
||||||
qCDebug(entities) << "add" << entityItemID.toString() << properties.listChangedProperties();
|
QList<QString> changedProperties = properties.listChangedProperties();
|
||||||
|
fixupTerseEditLogging(properties, changedProperties);
|
||||||
|
qCDebug(entities) << "add" << entityItemID.toString() << changedProperties;
|
||||||
}
|
}
|
||||||
endLogging = usecTimestampNow();
|
endLogging = usecTimestampNow();
|
||||||
|
|
||||||
|
|
|
@ -77,6 +77,7 @@ public:
|
||||||
virtual bool canProcessVersion(PacketVersion thisVersion) const
|
virtual bool canProcessVersion(PacketVersion thisVersion) const
|
||||||
{ return thisVersion >= VERSION_ENTITIES_USE_METERS_AND_RADIANS; }
|
{ return thisVersion >= VERSION_ENTITIES_USE_METERS_AND_RADIANS; }
|
||||||
virtual bool handlesEditPacketType(PacketType packetType) const;
|
virtual bool handlesEditPacketType(PacketType packetType) const;
|
||||||
|
void fixupTerseEditLogging(EntityItemProperties& properties, QList<QString>& changedProperties);
|
||||||
virtual int processEditPacketData(NLPacket& packet, const unsigned char* editData, int maxLength,
|
virtual int processEditPacketData(NLPacket& packet, const unsigned char* editData, int maxLength,
|
||||||
const SharedNodePointer& senderNode);
|
const SharedNodePointer& senderNode);
|
||||||
|
|
||||||
|
|
|
@ -79,8 +79,13 @@ EntityMotionState::~EntityMotionState() {
|
||||||
assert(!_entity);
|
assert(!_entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EntityMotionState::updateServerPhysicsVariables() {
|
void EntityMotionState::updateServerPhysicsVariables(const QUuid& sessionID) {
|
||||||
assert(entityTreeIsLocked());
|
assert(entityTreeIsLocked());
|
||||||
|
if (_entity->getSimulatorID() == sessionID) {
|
||||||
|
// don't slam these values if we are the simulation owner
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
_serverPosition = _entity->getPosition();
|
_serverPosition = _entity->getPosition();
|
||||||
_serverRotation = _entity->getRotation();
|
_serverRotation = _entity->getRotation();
|
||||||
_serverVelocity = _entity->getVelocity();
|
_serverVelocity = _entity->getVelocity();
|
||||||
|
@ -92,7 +97,7 @@ void EntityMotionState::updateServerPhysicsVariables() {
|
||||||
// virtual
|
// virtual
|
||||||
bool EntityMotionState::handleEasyChanges(uint32_t flags, PhysicsEngine* engine) {
|
bool EntityMotionState::handleEasyChanges(uint32_t flags, PhysicsEngine* engine) {
|
||||||
assert(entityTreeIsLocked());
|
assert(entityTreeIsLocked());
|
||||||
updateServerPhysicsVariables();
|
updateServerPhysicsVariables(engine->getSessionID());
|
||||||
ObjectMotionState::handleEasyChanges(flags, engine);
|
ObjectMotionState::handleEasyChanges(flags, engine);
|
||||||
|
|
||||||
if (flags & Simulation::DIRTY_SIMULATOR_ID) {
|
if (flags & Simulation::DIRTY_SIMULATOR_ID) {
|
||||||
|
@ -129,7 +134,7 @@ bool EntityMotionState::handleEasyChanges(uint32_t flags, PhysicsEngine* engine)
|
||||||
|
|
||||||
// virtual
|
// virtual
|
||||||
bool EntityMotionState::handleHardAndEasyChanges(uint32_t flags, PhysicsEngine* engine) {
|
bool EntityMotionState::handleHardAndEasyChanges(uint32_t flags, PhysicsEngine* engine) {
|
||||||
updateServerPhysicsVariables();
|
updateServerPhysicsVariables(engine->getSessionID());
|
||||||
return ObjectMotionState::handleHardAndEasyChanges(flags, engine);
|
return ObjectMotionState::handleHardAndEasyChanges(flags, engine);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ public:
|
||||||
EntityMotionState(btCollisionShape* shape, EntityItemPointer item);
|
EntityMotionState(btCollisionShape* shape, EntityItemPointer item);
|
||||||
virtual ~EntityMotionState();
|
virtual ~EntityMotionState();
|
||||||
|
|
||||||
void updateServerPhysicsVariables();
|
void updateServerPhysicsVariables(const QUuid& sessionID);
|
||||||
virtual bool handleEasyChanges(uint32_t flags, PhysicsEngine* engine);
|
virtual bool handleEasyChanges(uint32_t flags, PhysicsEngine* engine);
|
||||||
virtual bool handleHardAndEasyChanges(uint32_t flags, PhysicsEngine* engine);
|
virtual bool handleHardAndEasyChanges(uint32_t flags, PhysicsEngine* engine);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue