Broken asset code + ObjectUpdate FIXME
parent
f40845db93
commit
0eabb4b98c
Binary file not shown.
|
@ -137,6 +137,7 @@ namespace OpenSim
|
||||||
break;
|
break;
|
||||||
case PacketType.RegionHandshakeReply:
|
case PacketType.RegionHandshakeReply:
|
||||||
OpenSim_Main.local_world.SendLayerData(this);
|
OpenSim_Main.local_world.SendLayerData(this);
|
||||||
|
ClientAvatar.SendInitialPosition();
|
||||||
break;
|
break;
|
||||||
case PacketType.AgentWearablesRequest:
|
case PacketType.AgentWearablesRequest:
|
||||||
ClientAvatar.SendInitialAppearance();
|
ClientAvatar.SendInitialAppearance();
|
||||||
|
@ -147,7 +148,6 @@ namespace OpenSim
|
||||||
TransferRequestPacket transfer = (TransferRequestPacket)Pack;
|
TransferRequestPacket transfer = (TransferRequestPacket)Pack;
|
||||||
AssetRequests.Enqueue(transfer);
|
AssetRequests.Enqueue(transfer);
|
||||||
Thread AssetLoaderThread = new Thread(new ThreadStart(AssetLoader));
|
Thread AssetLoaderThread = new Thread(new ThreadStart(AssetLoader));
|
||||||
AssetLoaderThread.IsBackground = true;
|
|
||||||
AssetLoaderThread.Start();
|
AssetLoaderThread.Start();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -210,7 +210,8 @@ namespace OpenSim
|
||||||
|
|
||||||
private void AckTimer_Elapsed(object sender, ElapsedEventArgs ea)
|
private void AckTimer_Elapsed(object sender, ElapsedEventArgs ea)
|
||||||
{
|
{
|
||||||
SendAcks(); ResendUnacked();
|
SendAcks();
|
||||||
|
ResendUnacked();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ProcessOutPacket(Packet Pack) {
|
public void ProcessOutPacket(Packet Pack) {
|
||||||
|
@ -230,7 +231,7 @@ namespace OpenSim
|
||||||
Pack.Header.Sequence = Sequence;
|
Pack.Header.Sequence = Sequence;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Pack.Header.Reliable)
|
if (Pack.Header.Reliable) //DIRTY HACK
|
||||||
{
|
{
|
||||||
lock (NeedAck)
|
lock (NeedAck)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using libsecondlife;
|
using libsecondlife;
|
||||||
using libsecondlife.Packets;
|
using libsecondlife.Packets;
|
||||||
|
@ -11,12 +12,42 @@ namespace OpenSim.world
|
||||||
public string firstname;
|
public string firstname;
|
||||||
public string lastname;
|
public string lastname;
|
||||||
public OpenSimClient ControllingClient;
|
public OpenSimClient ControllingClient;
|
||||||
|
private libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock AvatarTemplate;
|
||||||
|
|
||||||
public Avatar(OpenSimClient TheClient) {
|
public Avatar(OpenSimClient TheClient) {
|
||||||
Console.WriteLine("Avatar.cs - Loading details from grid (DUMMY)");
|
Console.WriteLine("Avatar.cs - Loading details from grid (DUMMY)");
|
||||||
ControllingClient=TheClient;
|
ControllingClient=TheClient;
|
||||||
|
SetupTemplate("avatar-template.dat");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void SetupTemplate(string name)
|
||||||
|
{
|
||||||
|
|
||||||
|
int i = 0;
|
||||||
|
FileInfo fInfo = new FileInfo(name);
|
||||||
|
long numBytes = fInfo.Length;
|
||||||
|
FileStream fStream = new FileStream(name, FileMode.Open, FileAccess.Read);
|
||||||
|
BinaryReader br = new BinaryReader(fStream);
|
||||||
|
byte [] data1 = br.ReadBytes((int)numBytes);
|
||||||
|
br.Close();
|
||||||
|
fStream.Close();
|
||||||
|
|
||||||
|
libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock objdata = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock(data1, ref i);
|
||||||
|
|
||||||
|
System.Text.Encoding enc = System.Text.Encoding.ASCII;
|
||||||
|
libsecondlife.LLVector3 pos = new LLVector3(objdata.ObjectData, 16);
|
||||||
|
pos.X = 100f;
|
||||||
|
objdata.ID = 8880000;
|
||||||
|
objdata.NameValue = enc.GetBytes("FirstName STRING RW SV Test \nLastName STRING RW SV User \0");
|
||||||
|
libsecondlife.LLVector3 pos2 = new LLVector3(13.981f,100.0f,20.0f);
|
||||||
|
//objdata.FullID=user.AgentID;
|
||||||
|
byte[] pb = pos.GetBytes();
|
||||||
|
Array.Copy(pb, 0, objdata.ObjectData, 16, pb.Length);
|
||||||
|
|
||||||
|
AvatarTemplate = objdata;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public void CompleteMovement(World RegionInfo) {
|
public void CompleteMovement(World RegionInfo) {
|
||||||
Console.WriteLine("Avatar.cs:CompleteMovement() - Constructing AgentMovementComplete packet");
|
Console.WriteLine("Avatar.cs:CompleteMovement() - Constructing AgentMovementComplete packet");
|
||||||
AgentMovementCompletePacket mov = new AgentMovementCompletePacket();
|
AgentMovementCompletePacket mov = new AgentMovementCompletePacket();
|
||||||
|
@ -33,6 +64,29 @@ namespace OpenSim.world
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SendInitialPosition() {
|
public void SendInitialPosition() {
|
||||||
|
System.Text.Encoding _enc = System.Text.Encoding.ASCII;
|
||||||
|
|
||||||
|
|
||||||
|
//send a objectupdate packet with information about the clients avatar
|
||||||
|
ObjectUpdatePacket objupdate = new ObjectUpdatePacket();
|
||||||
|
objupdate.RegionData.RegionHandle = OpenSim_Main.cfg.RegionHandle;
|
||||||
|
objupdate.RegionData.TimeDilation = 64096;
|
||||||
|
objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1];
|
||||||
|
|
||||||
|
objupdate.ObjectData[0] = AvatarTemplate;
|
||||||
|
//give this avatar object a local id and assign the user a name
|
||||||
|
objupdate.ObjectData[0].ID = 8880000 + OpenSim_Main.local_world._localNumber;
|
||||||
|
//User_info.name="Test"+this.local_numer+" User";
|
||||||
|
objupdate.ObjectData[0].FullID = ControllingClient.AgentID;
|
||||||
|
objupdate.ObjectData[0].NameValue = _enc.GetBytes("FirstName STRING RW SV " + firstname + "\nLastName STRING RW SV " + lastname + " \0");
|
||||||
|
|
||||||
|
libsecondlife.LLVector3 pos2 = new LLVector3(100f, 100.0f, 22.0f);
|
||||||
|
|
||||||
|
byte[] pb = pos2.GetBytes();
|
||||||
|
|
||||||
|
Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 16, pb.Length);
|
||||||
|
OpenSim_Main.local_world._localNumber++;
|
||||||
|
this.ControllingClient.OutPacket(objupdate);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SendInitialAppearance() {
|
public void SendInitialAppearance() {
|
||||||
|
|
|
@ -12,7 +12,7 @@ namespace OpenSim.world
|
||||||
public float[] LandMap;
|
public float[] LandMap;
|
||||||
public ScriptEngine Scripts;
|
public ScriptEngine Scripts;
|
||||||
public TerrainDecode terrainengine = new TerrainDecode();
|
public TerrainDecode terrainengine = new TerrainDecode();
|
||||||
|
public uint _localNumber=0;
|
||||||
|
|
||||||
public World()
|
public World()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue