mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 18:50:00 +02:00
Send new entity physics packet from physics simulation, accept in server,
and make it go through filter (when supplied) regardless of lock rights.
This commit is contained in:
parent
8b44e83d9e
commit
dacaa3df1d
2 changed files with 10 additions and 7 deletions
|
@ -104,6 +104,7 @@ bool EntityTree::handlesEditPacketType(PacketType packetType) const {
|
||||||
case PacketType::EntityAdd:
|
case PacketType::EntityAdd:
|
||||||
case PacketType::EntityEdit:
|
case PacketType::EntityEdit:
|
||||||
case PacketType::EntityErase:
|
case PacketType::EntityErase:
|
||||||
|
case PacketType::EntityPhysics:
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
|
@ -1001,6 +1002,7 @@ int EntityTree::processEditPacketData(ReceivedMessage& message, const unsigned c
|
||||||
|
|
||||||
case PacketType::EntityAdd:
|
case PacketType::EntityAdd:
|
||||||
isAdd = true; // fall through to next case
|
isAdd = true; // fall through to next case
|
||||||
|
case PacketType::EntityPhysics:
|
||||||
case PacketType::EntityEdit: {
|
case PacketType::EntityEdit: {
|
||||||
quint64 startDecode = 0, endDecode = 0;
|
quint64 startDecode = 0, endDecode = 0;
|
||||||
quint64 startLookup = 0, endLookup = 0;
|
quint64 startLookup = 0, endLookup = 0;
|
||||||
|
@ -1010,6 +1012,7 @@ int EntityTree::processEditPacketData(ReceivedMessage& message, const unsigned c
|
||||||
quint64 startLogging = 0, endLogging = 0;
|
quint64 startLogging = 0, endLogging = 0;
|
||||||
|
|
||||||
bool suppressDisallowedScript = false;
|
bool suppressDisallowedScript = false;
|
||||||
|
bool isPhysics = message.getType() == PacketType::EntityPhysics;
|
||||||
|
|
||||||
_totalEditMessages++;
|
_totalEditMessages++;
|
||||||
|
|
||||||
|
@ -1021,6 +1024,7 @@ int EntityTree::processEditPacketData(ReceivedMessage& message, const unsigned c
|
||||||
entityItemID, properties);
|
entityItemID, properties);
|
||||||
endDecode = usecTimestampNow();
|
endDecode = usecTimestampNow();
|
||||||
|
|
||||||
|
|
||||||
if (validEditPacket && !_entityScriptSourceWhitelist.isEmpty() && !properties.getScript().isEmpty()) {
|
if (validEditPacket && !_entityScriptSourceWhitelist.isEmpty() && !properties.getScript().isEmpty()) {
|
||||||
bool passedWhiteList = false;
|
bool passedWhiteList = false;
|
||||||
|
|
||||||
|
@ -1053,8 +1057,7 @@ int EntityTree::processEditPacketData(ReceivedMessage& message, const unsigned c
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((isAdd ||
|
if ((isAdd || properties.lifetimeChanged()) &&
|
||||||
(message.getType() == PacketType::EntityEdit && properties.lifetimeChanged())) &&
|
|
||||||
!senderNode->getCanRez() && senderNode->getCanRezTmp()) {
|
!senderNode->getCanRez() && senderNode->getCanRezTmp()) {
|
||||||
// this node is only allowed to rez temporary entities. if need be, cap the lifetime.
|
// this node is only allowed to rez temporary entities. if need be, cap the lifetime.
|
||||||
if (properties.getLifetime() == ENTITY_ITEM_IMMORTAL_LIFETIME ||
|
if (properties.getLifetime() == ENTITY_ITEM_IMMORTAL_LIFETIME ||
|
||||||
|
@ -1070,8 +1073,8 @@ int EntityTree::processEditPacketData(ReceivedMessage& message, const unsigned c
|
||||||
|
|
||||||
startFilter = usecTimestampNow();
|
startFilter = usecTimestampNow();
|
||||||
bool wasChanged = false;
|
bool wasChanged = false;
|
||||||
// Having (un)lock rights bypasses the filter.
|
// Having (un)lock rights bypasses the filter, unless it's a physics result.
|
||||||
bool allowed = senderNode->isAllowedEditor() || filterProperties(properties, properties, wasChanged, isAdd);
|
bool allowed = (!isPhysics && senderNode->isAllowedEditor()) || filterProperties(properties, properties, wasChanged, isAdd);
|
||||||
if (!allowed) {
|
if (!allowed) {
|
||||||
auto timestamp = properties.getLastEdited();
|
auto timestamp = properties.getLastEdited();
|
||||||
properties = EntityItemProperties();
|
properties = EntityItemProperties();
|
||||||
|
@ -1088,7 +1091,7 @@ int EntityTree::processEditPacketData(ReceivedMessage& message, const unsigned c
|
||||||
startLookup = usecTimestampNow();
|
startLookup = usecTimestampNow();
|
||||||
EntityItemPointer existingEntity = findEntityByEntityItemID(entityItemID);
|
EntityItemPointer existingEntity = findEntityByEntityItemID(entityItemID);
|
||||||
endLookup = usecTimestampNow();
|
endLookup = usecTimestampNow();
|
||||||
if (existingEntity && message.getType() == PacketType::EntityEdit) {
|
if (existingEntity && !isAdd) {
|
||||||
|
|
||||||
if (suppressDisallowedScript) {
|
if (suppressDisallowedScript) {
|
||||||
bumpTimestamp(properties);
|
bumpTimestamp(properties);
|
||||||
|
|
|
@ -614,7 +614,7 @@ void EntityMotionState::sendUpdate(OctreeEditPacketSender* packetSender, uint32_
|
||||||
properties.setClientOnly(_entity->getClientOnly());
|
properties.setClientOnly(_entity->getClientOnly());
|
||||||
properties.setOwningAvatarID(_entity->getOwningAvatarID());
|
properties.setOwningAvatarID(_entity->getOwningAvatarID());
|
||||||
|
|
||||||
entityPacketSender->queueEditEntityMessage(PacketType::EntityEdit, tree, id, properties);
|
entityPacketSender->queueEditEntityMessage(PacketType::EntityPhysics, tree, id, properties);
|
||||||
_entity->setLastBroadcast(now);
|
_entity->setLastBroadcast(now);
|
||||||
|
|
||||||
// if we've moved an entity with children, check/update the queryAACube of all descendents and tell the server
|
// if we've moved an entity with children, check/update the queryAACube of all descendents and tell the server
|
||||||
|
@ -630,7 +630,7 @@ void EntityMotionState::sendUpdate(OctreeEditPacketSender* packetSender, uint32_
|
||||||
newQueryCubeProperties.setClientOnly(entityDescendant->getClientOnly());
|
newQueryCubeProperties.setClientOnly(entityDescendant->getClientOnly());
|
||||||
newQueryCubeProperties.setOwningAvatarID(entityDescendant->getOwningAvatarID());
|
newQueryCubeProperties.setOwningAvatarID(entityDescendant->getOwningAvatarID());
|
||||||
|
|
||||||
entityPacketSender->queueEditEntityMessage(PacketType::EntityEdit, tree,
|
entityPacketSender->queueEditEntityMessage(PacketType::EntityPhysics, tree,
|
||||||
descendant->getID(), newQueryCubeProperties);
|
descendant->getID(), newQueryCubeProperties);
|
||||||
entityDescendant->setLastBroadcast(now);
|
entityDescendant->setLastBroadcast(now);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue