public void SendInitialAppearance() { AgentWearablesUpdatePacket aw = new AgentWearablesUpdatePacket(); aw.AgentData.AgentID = this.ControllingClient.AgentID; aw.AgentData.SerialNum = 0; aw.AgentData.SessionID = ControllingClient.SessionID; aw.WearableData = new AgentWearablesUpdatePacket.WearableDataBlock[13]; AgentWearablesUpdatePacket.WearableDataBlock awb; for (int i = 0; i < 13; i++) { awb = new AgentWearablesUpdatePacket.WearableDataBlock(); awb.WearableType = (byte)i; awb.AssetID = this.Wearables[i].AssetID; awb.ItemID = this.Wearables[i].ItemID; aw.WearableData[i] = awb; } ControllingClient.OutPacket(aw); }
public override void update() { if (this._physActor == null) { //HACKHACK: Note to work out why this entity does not have a physics actor // and prehaps create one. return; } libsecondlife.LLVector3 pos2 = new LLVector3(this._physActor.Position.X, this._physActor.Position.Y, this._physActor.Position.Z); if (this.updateflag) { //need to send movement info //so create the improvedterseobjectupdate packet //use CreateTerseBlock() ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock = CreateTerseBlock(); ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket(); terse.RegionData.RegionHandle = m_regionHandle; // FIXME terse.RegionData.TimeDilation = 64096; terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; terse.ObjectData[0] = terseBlock; foreach (SimClient client in m_clientThreads.Values) { client.OutPacket(terse); } updateflag = false; //this._updateCount = 0; } else { if ((pos2 != this.positionLastFrame) || (this.movementflag == 16)) { _updateCount++; if (((!PhysicsEngineFlying) && (_updateCount > 3)) || (PhysicsEngineFlying) && (_updateCount > 0)) { //It has been a while since last update was sent so lets send one. ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock = CreateTerseBlock(); ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket(); terse.RegionData.RegionHandle = m_regionHandle; // FIXME terse.RegionData.TimeDilation = 64096; terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; terse.ObjectData[0] = terseBlock; foreach (SimClient client in m_clientThreads.Values) { client.OutPacket(terse); } _updateCount = 0; } if (this.movementflag == 16) { movementflag = 0; } } } this.positionLastFrame = pos2; if (!this.ControllingClient.m_sandboxMode) { if (pos2.X < 0) { ControllingClient.CrossSimBorder(new LLVector3(this._physActor.Position.X, this._physActor.Position.Y, this._physActor.Position.Z)); } if (pos2.Y < 0) { ControllingClient.CrossSimBorder(new LLVector3(this._physActor.Position.X, this._physActor.Position.Y, this._physActor.Position.Z)); } if (pos2.X > 255) { ControllingClient.CrossSimBorder(new LLVector3(this._physActor.Position.X, this._physActor.Position.Y, this._physActor.Position.Z)); } if (pos2.Y > 255) { ControllingClient.CrossSimBorder(new LLVector3(this._physActor.Position.X, this._physActor.Position.Y, this._physActor.Position.Z)); } } }