Ejemplo n.º 1
0
        public override bool HandleIn(RegionSyncModule pRegionContext)
        {
            if (base.HandleIn(pRegionContext))
            {
            if (!pRegionContext.InfoManager.SyncInfoExists(Uuid))
                return false;

            // if this is a relay node, forward the message
            if (pRegionContext.IsSyncRelay)
            {
                pRegionContext.SendSpecialUpdateToRelevantSyncConnectors(ConnectorContext.otherSideActorID, this);
            }

            // This limits synced avatars to real clients (no npcs) until we sync PresenceType field
            ((ScenePresence)(((SyncInfoPresence)(pRegionContext.InfoManager.GetSyncInfo(Uuid))).SceneThing)).LifecycleState = ScenePresenceState.Removing;
            pRegionContext.Scene.RemoveClient(Uuid, false);
            }
            return true;
        }
Ejemplo n.º 2
0
        public override bool HandleIn(RegionSyncModule pRegionContext)
        {
            if (base.HandleIn(pRegionContext))
            {
            // If this is a relay node, forward the message
            if (pRegionContext.IsSyncRelay)
                pRegionContext.SendSpecialUpdateToRelevantSyncConnectors(ConnectorContext.otherSideActorID, this);

            SceneObjectGroup sog = null;
            SceneObjectPart sop;
            if (pRegionContext.Scene.TryGetSceneObjectPart(Uuid, out sop))
            {
                sog = sop.ParentGroup;
            }

            if (sog != null)
            {
                if (!SoftDelete)
                {
                    //m_log.DebugFormat("{0}: hard delete object {1}", LogHeader, sog.UUID);
                    foreach (SceneObjectPart part in sog.Parts)
                    {
                        pRegionContext.InfoManager.RemoveSyncInfo(part.UUID);
                    }
                    pRegionContext.Scene.DeleteSceneObject(sog, false);
                }
                else
                {
                    //m_log.DebugFormat("{0}: soft delete object {1}", LogHeader, sog.UUID);
                    pRegionContext.Scene.UnlinkSceneObject(sog, true);
                }
            }
            }
            return true;
        }
Ejemplo n.º 3
0
        public override bool HandleIn(RegionSyncModule pRegionContext)
        {
            if (base.HandleIn(pRegionContext))
            {
            pRegionContext.RememberLocallyGeneratedEvent(MType);
            // If this is a relay node, forward the message
            if (pRegionContext.IsSyncRelay)
                pRegionContext.SendSpecialUpdateToRelevantSyncConnectors(ConnectorContext.otherSideActorID, this);

            //Add the list of PrimSyncInfo to SyncInfoManager
            foreach (SyncInfoBase syncInfo in SyncInfos.Values)
                pRegionContext.InfoManager.InsertSyncInfo(syncInfo.UUID, syncInfo);

            // Add the decoded object to Scene
            // This will invoke OnObjectAddedToScene but the syncinfo has already been created so that's a NOP
            pRegionContext.Scene.EventManager.TriggerParcelPrimCountTainted();
            pRegionContext.Scene.AddNewSceneObject(SOG, true);

            // If it's an attachment, connect this to the presence
            if (SOG.IsAttachmentCheckFull())
            {
                //m_log.WarnFormat("{0}: HandleSyncNewObject: Adding attachement to presence", LogHeader);
                ScenePresence sp = pRegionContext.Scene.GetScenePresence(SOG.AttachedAvatar);
                if (sp != null)
                {
                    sp.AddAttachment(SOG);
                    SOG.RootPart.SetParentLocalId(sp.LocalId);

                    // In case it is later dropped, don't let it get cleaned up
                    SOG.RootPart.RemFlag(PrimFlags.TemporaryOnRez);

                    SOG.HasGroupChanged = true;
                }
            }

            /* Uncomment when quarks exist
            //If we just keep a copy of the object in our local Scene,
            //and is not supposed to operation on it (e.g. object in
            //passive quarks), then ignore the event.
            if (!ToOperateOnObject(group))
                return;
             */

            // Now that (if) the PhysActor of each part in sog has been created, set the PhysActor properties.
            if (SOG.RootPart.PhysActor != null)
            {
                foreach (SyncInfoBase syncInfo in SyncInfos.Values)
                {
                    // m_log.DebugFormat("{0}: HandleSyncNewObject: setting physical properties", LogHeader);
                    syncInfo.SetPropertyValues(SyncableProperties.PhysActorProperties);
                }
            }

            SOG.CreateScriptInstances(0, false, pRegionContext.Scene.DefaultScriptEngine, 0);
            SOG.ResumeScripts();

            // Trigger aggregateScriptEventSubscriptions since it may access PhysActor to link collision events
            foreach (SceneObjectPart part in SOG.Parts)
                part.aggregateScriptEvents();

            SOG.ScheduleGroupForFullUpdate();
            }
            return true;
        }
Ejemplo n.º 4
0
        public override bool HandleIn(RegionSyncModule pRegionContext)
        {
            if (base.HandleIn(pRegionContext))
            {
            // if this is a relay node, forward the message
            if (pRegionContext.IsSyncRelay)
                pRegionContext.SendSpecialUpdateToRelevantSyncConnectors(ConnectorContext.otherSideActorID, this);

            // If we receive a new presence that for some reason indicates this region is its "real region" then ignore it.
            // Maybe we should even send out a message to remove the avatar from other actors?
            if ((string)(((SyncInfoPresence)SyncInfo).CurrentlySyncedProperties[SyncableProperties.Type.RealRegion].LastUpdateValue) == RegionContext.Scene.Name)
            {
                m_log.WarnFormat("{0}: Attempt to handle NewPresence message with RealRegion = {1}", LogHeader, RegionContext.Scene.Name);
                return false;
            }

            //Add the SyncInfo to SyncInfoManager
            pRegionContext.InfoManager.InsertSyncInfo(SyncInfo.UUID, SyncInfo);

            // Get ACD and PresenceType from decoded SyncInfoPresence
            // NASTY CASTS AHEAD!
            AgentCircuitData acd = new AgentCircuitData();
            acd.UnpackAgentCircuitData((OSDMap)(((SyncInfoPresence)SyncInfo).CurrentlySyncedProperties[SyncableProperties.Type.AgentCircuitData].LastUpdateValue));
            // Unset the ViaLogin flag since this presence is being added to the scene by sync (not via login)
            acd.teleportFlags &= ~(uint)TeleportFlags.ViaLogin;
            PresenceType pt = (PresenceType)(int)(((SyncInfoPresence)SyncInfo).CurrentlySyncedProperties[SyncableProperties.Type.PresenceType].LastUpdateValue);
            // Fake like we're not a user so normal teleport processing will not happen.
            // No. If we make the presence an NPC, then we cannot prevent the local scene from rezzing a duplicate set of attachments.
            // So, ScenePresence will be added with the original presence type. NPC presences will always get duplicate attachments which will need
            // to be fixed to support NPC presences in DSG regions. We can fix that eventually with a DSGAttachmentsModule which will only rez for
            // presences added by the local scene. Then, we can go back to all Region Sync Avatars being NPCs.
            // PresenceType pt = PresenceType.Npc;

            // Add the decoded circuit to local scene
            pRegionContext.Scene.AuthenticateHandler.AddNewCircuit(acd.circuitcode, acd);

            // Create a client and add it to the local scene at the position of the last update from sync cache
            Vector3 currentPos = (Vector3)(((SyncInfoPresence)SyncInfo).CurrentlySyncedProperties[SyncableProperties.Type.AbsolutePosition].LastUpdateValue);
            IClientAPI client = new RegionSyncAvatar(acd.circuitcode, pRegionContext.Scene, acd.AgentID, acd.firstname, acd.lastname, currentPos);
            try
            {
                SyncInfo.SceneThing = pRegionContext.Scene.AddNewAgent(client, pt);
            }
            catch (Exception e)
            {
                m_log.WarnFormat("{0}: Exception in AddNewAgent: {1}", LogHeader, e.ToString());
            }
            // Maybe this should be the "real" region UUID but I don't think it will matter until we understand better how teleporting in DSG will work
            ScenePresence sp = (ScenePresence)SyncInfo.SceneThing;

            // SOME UNFORTUNATE REFLECTION IS REQUIRED TO GET THIS PRESENCE CREATED
            {
                // m_originRegionID is a private instance member of ScenePresence
                BindingFlags flags = BindingFlags.NonPublic | BindingFlags.Instance;

                // Get the field info instance corresponding to m_originRegionID
                FieldInfo field = typeof(ScenePresence).GetField("m_originRegionID", flags);

                // Set the value to the current scene
                field.SetValue(sp, pRegionContext.Scene.RegionInfo.RegionID);
            }

            // Now that we have a presence and a client, tell the region sync "client" to finish connecting.
            ((RegionSyncAvatar)client).PostCreateRegionSyncAvatar();

            // Might need to trigger something here to send new client messages to connected clients
            }
            return true;
        }
Ejemplo n.º 5
0
        public override bool HandleIn(RegionSyncModule pRegionContext)
        {
            if (base.HandleIn(pRegionContext))
            {
            // if this is a relay node, forward the message
            if (pRegionContext.IsSyncRelay)
            {
                //SendSceneEventToRelevantSyncConnectors(senderActorID, msg, linkedGroup);
                pRegionContext.SendSpecialUpdateToRelevantSyncConnectors(ConnectorContext.otherSideActorID, this);
            }

            //m_log.DebugFormat("{0}: received LinkObject from {1}", LogHeader, senderActorID);

            //Update properties, if any has changed
            foreach (KeyValuePair<UUID, SyncInfoBase> partSyncInfo in GroupSyncInfos)
            {
                UUID uuid = partSyncInfo.Key;
                SyncInfoBase updatedPrimSyncInfo = partSyncInfo.Value;

                SceneObjectPart part = pRegionContext.Scene.GetSceneObjectPart(uuid);
                if (part == null)
                {
                    m_log.ErrorFormat("{0}: HandleSyncLinkObject, prim {1} not in local Scene Graph after LinkObjectBySync is called", LogHeader, uuid);
                }
                else
                {
                    pRegionContext.InfoManager.UpdateSyncInfoBySync(part.UUID, updatedPrimSyncInfo);
                }
            }
            }
            return true;
        }