public void HandleAgentAnimation(Message m) { var req = (AgentAnimation)m; SceneInterface scene; AgentCircuit circuit; if (!Circuits.TryGetValue(m.CircuitSceneID, out circuit)) { return; } scene = circuit.Scene; if (scene == null) { return; } AssetServiceInterface sceneAssetService = scene.AssetService; if (sceneAssetService == null) { return; } AssetMetadata metadata; foreach (var e in req.AnimationEntryList) { if (e.StartAnim) { if (!sceneAssetService.Metadata.TryGetValue(e.AnimID, out metadata)) { AssetData data; if (AssetService.TryGetValue(e.AnimID, out data)) { sceneAssetService.Store(data); if (data.Type != AssetType.Animation) { /* ignore non-animation content here */ continue; } } else { /* asset not there so ignore */ continue; } } else if (metadata.Type != AssetType.Animation) { /* ignore non-animation content here */ continue; } PlayAnimation(e.AnimID, UUID.Zero); } else { StopAnimation(e.AnimID, UUID.Zero); } } }
private void ChildUpdateOnPositionChange(IObject own) { AgentCircuit c; if (Circuits.TryGetValue(SceneID, out c)) { var scene = c.Scene; if (scene != null) { foreach (var kvp in ActiveChilds) { var m = new ChildAgentPositionUpdate { AgentID = ID, AgentPosition = GlobalPosition, AgentVelocity = Velocity, ChangedGrid = false, AtAxis = CameraAtAxis, Center = CameraPosition, LeftAxis = CameraLeftAxis, RegionLocation = scene.GridPosition, SessionID = SessionID, Size = Size, UpAxis = CameraUpAxis }; var childUpdater = kvp.Value.ChildAgentUpdateService; childUpdater?.SendMessage(m); } } } }
public override void SendKillObject(UUID sceneID) { AgentCircuit circuit; if (Circuits.TryGetValue(sceneID, out circuit)) { circuit.SendKillObject(); } }
private void HandleAppearanceUpdate(IAgent agent) { AgentCircuit circuit; if (Circuits.TryGetValue(m_CurrentSceneID, out circuit)) { circuit.Scene.SendAgentAppearanceToAllAgents(this); } }
private void ChildUpdateOnParamChange() { AgentCircuit c; if (Circuits.TryGetValue(SceneID, out c)) { var scene = c.Scene; if (scene != null) { foreach (var kvp in ActiveChilds) { var m = new ChildAgentUpdate { RegionID = scene.ID, RegionLocation = scene.GridPosition, AgentID = ID, SessionID = SessionID, AgentPosition = GlobalPosition, AgentVelocity = Velocity, Center = CameraPosition, Size = Size, AtAxis = CameraAtAxis, LeftAxis = CameraLeftAxis, UpAxis = CameraUpAxis, ChangedGrid = false, Far = m_DrawDistance, Aspect = 1, Throttles = new byte[9], //m.LocomotionState; HeadRotation = HeadRotation, BodyRotation = BodyRotation, ControlFlags = m_ActiveAgentControlFlags, EnergyLevel = 0, GodLevel = 0, AlwaysRun = m_IsRunning, PreyAgent = UUID.Zero, AgentAccess = 0, //m.AgentTextures; ActiveGroupID = Group.ID, //m.GroupData; //m.AnimationData; //m_AnimationController. //m.GranterBlock; VisualParams = VisualParams }; //m.AgentAccessList; //m.AgentInfo; var childUpdater = kvp.Value.ChildAgentUpdateService; childUpdater?.SendMessage(m); } } } }
public override void SendUpdateObject(UUID sceneID) { AgentCircuit circuit; if (Circuits.TryGetValue(sceneID, out circuit)) { #if DEBUG m_Log.DebugFormat("Sending update for {0} at {1}", Owner, sceneID); #endif circuit.Scene?.ScheduleUpdate(GetUpdateInfo(sceneID)); } }
public void HandleAgentDataUpdateRequest(Message m) { var adur = (AgentDataUpdateRequest)m; if (adur.AgentID == ID && adur.SessionID == adur.CircuitSessionID) { AgentCircuit circuit; if (Circuits.TryGetValue(adur.CircuitSceneID, out circuit)) { SendAgentDataUpdate(circuit); } } }
public void HandleLandStatRequest(Message m) { var req = (LandStatRequest)m; if (req.CircuitAgentID != req.AgentID || req.CircuitSessionID != req.SessionID) { return; } AgentCircuit circuit; if (!Circuits.TryGetValue(req.CircuitSceneID, out circuit)) { return; } SceneInterface scene = circuit.Scene; if (scene == null) { return; } UGUIWithName agentID = circuit.Agent.NamedOwner; if (!scene.IsRegionOwner(agentID) && !scene.IsEstateOwner(agentID) && !scene.IsEstateManager(agentID)) { return; } switch (req.ReportType) { case LandStatReportEnum.TopScripts: ProcessTopScripts(circuit, scene, req.RequestFlags, req.Filter); break; case LandStatReportEnum.TopColliders: ProcessTopColliders(circuit, scene, req.RequestFlags, req.Filter); break; default: break; } }
uint ILocalIDAccessor.this[UUID sceneID] { get { AgentCircuit circuit; return(Circuits.TryGetValue(sceneID, out circuit) ? circuit.UpdateInfo.LocalID : 0); } set { AgentCircuit circuit; if (Circuits.TryGetValue(sceneID, out circuit)) { circuit.UpdateInfo.LocalID = value; } else { m_Log.DebugFormat("Setting LocalID on agent {0} for region {1} has no circuit", ID, sceneID); } } }
public void HandleRegionHandshakeReply(Message m) { var rhr = (Messages.Region.RegionHandshakeReply)m; AgentCircuit circuit; if (Circuits.TryGetValue(rhr.CircuitSceneID, out circuit)) { var scene = circuit.Scene; /* Add our agent to scene */ scene.SendAllParcelOverlaysTo(this); scene.Terrain.UpdateTerrainDataToSingleClient(this); scene.Environment.UpdateWindDataToSingleClient(this); scene.SendAgentObjectToAllAgents(this); scene.SendRegionInfo(this); ParcelInfo pinfo; if (scene.Parcels.TryGetValue(GlobalPosition, out pinfo)) { var props = scene.ParcelInfo2ParcelProperties(Owner.ID, pinfo, NextParcelSequenceId, ParcelProperties.RequestResultType.Single); circuit.SendMessage(props); } circuit.ScheduleFirstUpdate(); } }
public void HandleAvatarTexturesRequest(Message p) { var gm = (GenericMessage)p; if (gm.AgentID != ID || gm.SessionID != gm.CircuitSessionID || gm.ParamList.Count < 1) { return; } UUID avatarId; if (!UUID.TryParse(gm.ParamList[0].FromUTF8Bytes(), out avatarId)) { return; } IAgent agent; AgentCircuit circuit; SceneInterface scene; if (!Circuits.TryGetValue(gm.CircuitSceneID, out circuit)) { return; } scene = circuit.Scene; if (scene == null) { return; } if (scene.RootAgents.TryGetValue(avatarId, out agent)) { SendMessageAlways(agent.GetAvatarAppearanceMsg(), SceneID); } }
public bool TryGetCameraConstraints(Vector3 wantedCamPosition, out Vector4 collisionplane) { AgentCircuit circuit; SceneInterface scene; collisionplane = new Vector4(0.9f, 0.0f, 0.361f, -10000f); if (!Circuits.TryGetValue(m_CurrentSceneID, out circuit)) { return(false); } scene = circuit.Scene; if (scene == null) { return(false); } IPhysicsScene physicsScene = scene.PhysicsScene; if (physicsScene == null) { return(false); } RayResult[] results = physicsScene.RayTest(GlobalPosition, wantedCamPosition, RayTestHitFlags.All, 1); if (results.Length == 0) { return(false); } Vector3 normal = results[0].HitNormalWorld; collisionplane.X = normal.X; collisionplane.Y = normal.Y; collisionplane.Z = normal.Z; collisionplane.W = results[0].HitPointWorld.Dot(normal); return(true); }
public override AgentUpdateInfo GetUpdateInfo(UUID sceneID) { AgentCircuit circuit; return(Circuits.TryGetValue(sceneID, out circuit) ? circuit.UpdateInfo : null); }
public void HandleCompleteAgentMovement(Message m) { var cam = (CompleteAgentMovement)m; AgentCircuit circuit; if (cam.SessionID != cam.CircuitSessionID || cam.AgentID != cam.CircuitAgentID) { m_Log.InfoFormat("Unexpected CompleteAgentMovement with invalid details"); } else if (Circuits.TryGetValue(cam.CircuitSceneID, out circuit)) { var scene = circuit.Scene; if (scene == null) { return; } /* switch agent region */ if (m_IsActiveGod && !scene.IsPossibleGod(Owner)) { /* revoke god powers when changing region and new region has a different owner */ var gm = new GrantGodlikePowers { AgentID = ID, SessionID = circuit.SessionID, GodLevel = 0, Token = UUID.Zero }; SendMessageIfRootAgent(gm, SceneID); m_IsActiveGod = false; } SceneID = scene.ID; scene.TriggerAgentChangedScene(this); if (circuit.LastTeleportFlags.NeedsInitialPosition()) { try { scene.DetermineInitialAgentLocation(this, circuit.LastTeleportFlags, GlobalPosition, LookAt); } catch { /* TODO: how to do this? */ return; } } var amc = new AgentMovementComplete { AgentID = cam.AgentID, ChannelVersion = VersionInfo.SimulatorVersion, LookAt = circuit.Agent.LookAt, Position = GlobalPosition, SessionID = cam.SessionID, GridPosition = circuit.Scene.GridPosition, Timestamp = (uint)Date.GetUnixTime() }; amc.OnSendCompletion += (bool success) => { if (success) { HandleChildAgentChanges(circuit); } }; circuit.SendMessage(amc); SendAgentDataUpdate(circuit); scene.SendAgentObjectToAllAgents(this); var clu = new CoarseLocationUpdate { You = 0, Prey = -1 }; var ad = new CoarseLocationUpdate.AgentDataEntry { X = (byte)(uint)GlobalPosition.X, Y = (byte)(uint)GlobalPosition.Y, Z = (byte)(uint)GlobalPosition.Z, AgentID = ID }; clu.AgentData.Add(ad); circuit.SendMessage(clu); scene.Environment.UpdateWindlightProfileToClientNoReset(this); scene.Environment.SendSimulatorTimeMessageToClient(this); foreach (var action in circuit.m_TriggerOnRootAgentActions) { action.TriggerOnRootAgent(ID, scene); } } }
public void HandleEstateOwnerMessage(Message m) { var req = (EstateOwnerMessage)m; if (req.SessionID != SessionID || req.AgentID != ID) { return; } AgentCircuit circuit; if (!Circuits.TryGetValue(req.CircuitSceneID, out circuit)) { return; } if (!circuit.Scene.IsEstateManager(Owner) && circuit.Scene.Owner != Owner) { /* only RO, EO and EM allowed behind */ /* some messages later will be limited further */ return; } switch (req.Method) { case "getinfo": EstateOwner_GetInfo(circuit, req); break; case "setregioninfo": EstateOwner_SetRegionInfo(circuit, req); break; #if TEXTUREBASE case "texturebase": break; #endif case "texturedetail": EstateOwner_TextureDetail(circuit, req); break; case "textureheights": EstateOwner_TextureHeights(circuit, req); break; case "texturecommit": EstateOwner_TextureCommit(circuit, req); break; case "setregionterrain": EstateOwner_SetRegionTerrain(circuit, req); break; case "restart": EstateOwner_Restart(circuit, req); break; case "estatechangecovenantid": if (!circuit.Scene.IsEstateManager(Owner)) { /* only EO and EM */ return; } EstateOwner_EstateChangeCovenantId(circuit, req); break; case "estateaccessdelta": if (!circuit.Scene.IsEstateManager(Owner)) { /* only EO and EM */ return; } EstateOwner_EstateAccessDelta(circuit, req); break; case "estateexperiencedelta": if (!circuit.Scene.IsEstateManager(Owner)) { /* only EO and EM */ return; } EstateOwner_EstateExperienceDelta(circuit, req); break; case "simulatormessage": EstateOwner_SimulatorMessage(circuit, req); break; case "instantmessage": EstateOwner_InstantMessage(circuit, req); break; case "setregiondebug": EstateOwner_SetRegionDebug(circuit, req); break; case "teleporthomeuser": EstateOwner_TeleportHomeUser(circuit, req); break; case "teleporthomeallusers": EstateOwner_TeleportHomeAllUsers(circuit, req); break; case "colliders": EstateOwner_Colliders(circuit, req); break; case "scripts": EstateOwner_Scripts(circuit, req); break; case "terrain": EstateOwner_Terrain(circuit, req); break; case "estatechangeinfo": if (!circuit.Scene.IsEstateManager(Owner)) { /* only EO and EM */ return; } EstateOwner_EstateChangeInfo(circuit, req); break; case "telehub": EstateOwner_Telehub(circuit, req); break; case "kickestate": EstateOwner_KickEstate(circuit, req); break; default: m_Log.DebugFormat("EstateOwnerMessage: Unknown method {0} requested", req.Method); break; } }