diff --git a/src/Config/SimConfig/AssemblyInfo.cs b/src/Config/SimConfig/AssemblyInfo.cs index f8931bd9df..96c3e7383d 100644 --- a/src/Config/SimConfig/AssemblyInfo.cs +++ b/src/Config/SimConfig/AssemblyInfo.cs @@ -1,21 +1,31 @@ -using System; -using System.Reflection; -using System.Runtime.InteropServices; - -// ------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Mono Runtime Version: 2.0.50727.42 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -// ------------------------------------------------------------------------------ - -[assembly: ComVisibleAttribute(false)] -[assembly: CLSCompliantAttribute(false)] -[assembly: AssemblyVersionAttribute("0.1.*.148")] -[assembly: AssemblyTitleAttribute("opensim-simconfig")] -[assembly: AssemblyDescriptionAttribute("The default configuration handler")] -[assembly: AssemblyCopyrightAttribute("Copyright © OGS development team 2007")] - +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// Information about this assembly is defined by the following +// attributes. +// +// change them to the information which is associated with the assembly +// you compile. + +[assembly: AssemblyTitle("SimConfig")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("SimConfig")] +[assembly: AssemblyCopyright("")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// This sets the default COM visibility of types in the assembly to invisible. +// If you need to expose a type to COM, use [ComVisible(true)] on that type. +[assembly: ComVisible(false)] + +// The assembly version has following format : +// +// Major.Minor.Build.Revision +// +// You can specify all values by your own or you can build default build and revision +// numbers with the '*' character (the default): + +[assembly: AssemblyVersion("1.0.*")] diff --git a/src/Config/SimConfig/Db4SimConfig.cs b/src/Config/SimConfig/Db4SimConfig.cs index ebd93113e5..cc31328218 100644 --- a/src/Config/SimConfig/Db4SimConfig.cs +++ b/src/Config/SimConfig/Db4SimConfig.cs @@ -119,11 +119,6 @@ namespace Db40SimConfig ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - No heightmap found, generating new one"); HeightmapGenHills hills = new HeightmapGenHills(); blank.LandMap = hills.GenerateHeightmap(200, 4.0f, 80.0f, false); - /* blank.LandMap = new float[65536]; - for(int i = 0 ; i <65536; i++) - { - blank.LandMap[i] = 20.49f; - }*/ ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - Saving heightmap to local database"); db.Set(blank.LandMap); db.Commit(); diff --git a/src/Config/SimConfig/SimConfig.csproj b/src/Config/SimConfig/SimConfig.csproj index 1f147d79a3..08f0f24bc7 100644 --- a/src/Config/SimConfig/SimConfig.csproj +++ b/src/Config/SimConfig/SimConfig.csproj @@ -26,12 +26,8 @@ - - ..\..\bin\OpenSim.exe - False - - ..\..\..\..\..\Program Files\Db4objects\db4o-6.1\bin\net-2.0\Db4objects.Db4o.dll + ..\..\..\bin\Db4objects.Db4o.dll False @@ -44,6 +40,10 @@ {C9A6026D-8E0C-4FE4-8691-FB2A566AA245} ServerConsole + + {132A6E3E-8F2D-4BF5-BDFB-8555F53F334E} + Second-server + \ No newline at end of file diff --git a/src/GridInterfaces/AssemblyInfo.cs b/src/GridInterfaces/AssemblyInfo.cs index 32ad78b64c..89731a1f0d 100644 --- a/src/GridInterfaces/AssemblyInfo.cs +++ b/src/GridInterfaces/AssemblyInfo.cs @@ -1,21 +1,31 @@ -using System; -using System.Reflection; -using System.Runtime.InteropServices; - -// ------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Mono Runtime Version: 2.0.50727.42 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -// ------------------------------------------------------------------------------ - -[assembly: ComVisibleAttribute(false)] -[assembly: CLSCompliantAttribute(false)] -[assembly: AssemblyVersionAttribute("0.1.*.148")] -[assembly: AssemblyTitleAttribute("opensim-gridinterfaces")] -[assembly: AssemblyDescriptionAttribute("Definitions for OGS interface")] -[assembly: AssemblyCopyrightAttribute("Copyright © OGS development team 2007")] - +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// Information about this assembly is defined by the following +// attributes. +// +// change them to the information which is associated with the assembly +// you compile. + +[assembly: AssemblyTitle("GridInterfaces")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("GridInterfaces")] +[assembly: AssemblyCopyright("")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// This sets the default COM visibility of types in the assembly to invisible. +// If you need to expose a type to COM, use [ComVisible(true)] on that type. +[assembly: ComVisible(false)] + +// The assembly version has following format : +// +// Major.Minor.Build.Revision +// +// You can specify all values by your own or you can build default build and revision +// numbers with the '*' character (the default): + +[assembly: AssemblyVersion("1.0.*")] diff --git a/src/GridInterfaces/GridInterfaces.csproj b/src/GridInterfaces/GridInterfaces.csproj index 489ed972c6..3284e7f29b 100644 --- a/src/GridInterfaces/GridInterfaces.csproj +++ b/src/GridInterfaces/GridInterfaces.csproj @@ -27,7 +27,7 @@ - ..\..\Libsecond-dailys\libsl07-03\trunk\libsecondlife-cs\obj\Debug\libsecondlife.dll + ..\..\..\..\..\..\Libsecond-dailys\libsl07-03\trunk\libsecondlife-cs\obj\Debug\libsecondlife.dll False diff --git a/src/LocalServers/LocalGridServers/AssemblyInfo.cs b/src/LocalServers/LocalGridServers/AssemblyInfo.cs index c523a99c21..103b49a207 100644 --- a/src/LocalServers/LocalGridServers/AssemblyInfo.cs +++ b/src/LocalServers/LocalGridServers/AssemblyInfo.cs @@ -1,21 +1,31 @@ -using System; -using System.Reflection; -using System.Runtime.InteropServices; - -// ------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Mono Runtime Version: 2.0.50727.42 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -// ------------------------------------------------------------------------------ - -[assembly: ComVisibleAttribute(false)] -[assembly: CLSCompliantAttribute(false)] -[assembly: AssemblyVersionAttribute("0.1.*.148")] -[assembly: AssemblyTitleAttribute("opensim-localservers")] -[assembly: AssemblyDescriptionAttribute("local grid servers")] -[assembly: AssemblyCopyrightAttribute("Copyright © OGS development team 2007")] - +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// Information about this assembly is defined by the following +// attributes. +// +// change them to the information which is associated with the assembly +// you compile. + +[assembly: AssemblyTitle("LocalGridServers")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("LocalGridServers")] +[assembly: AssemblyCopyright("")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// This sets the default COM visibility of types in the assembly to invisible. +// If you need to expose a type to COM, use [ComVisible(true)] on that type. +[assembly: ComVisible(false)] + +// The assembly version has following format : +// +// Major.Minor.Build.Revision +// +// You can specify all values by your own or you can build default build and revision +// numbers with the '*' character (the default): + +[assembly: AssemblyVersion("1.0.*")] diff --git a/src/LocalServers/LocalGridServers/LocalGridServers.csproj b/src/LocalServers/LocalGridServers/LocalGridServers.csproj index 63f41c0d56..dc9c566511 100644 --- a/src/LocalServers/LocalGridServers/LocalGridServers.csproj +++ b/src/LocalServers/LocalGridServers/LocalGridServers.csproj @@ -27,7 +27,7 @@ - ..\..\..\Libsecond-dailys\libsl07-03\trunk\libsecondlife-cs\obj\Debug\libsecondlife.dll + ..\..\..\..\..\..\..\Libsecond-dailys\libsl07-03\trunk\libsecondlife-cs\obj\Debug\libsecondlife.dll False diff --git a/src/Main.cs b/src/Main.cs index f728928295..4fc7d54d32 100644 --- a/src/Main.cs +++ b/src/Main.cs @@ -47,126 +47,126 @@ using PhysicsSystem; namespace OpenSim { - /// - /// Description of MainForm. - /// - public class OpenSim_Main - { - public static OpenSim_Main sim; - public static SimConfig cfg; - public static World local_world; - public static Grid gridServers; - - public static Socket Server; - private static IPEndPoint ServerIncoming; - private static byte[] RecvBuffer = new byte[4096]; - private byte[] ZeroBuffer = new byte[8192]; - private static IPEndPoint ipeSender; - private static EndPoint epSender; - private static AsyncCallback ReceivedData; + /// + /// Description of MainForm. + /// + public class OpenSim_Main + { + public static OpenSim_Main sim; + public static SimConfig cfg; + public static World local_world; + public static Grid gridServers; + + public static Socket Server; + private static IPEndPoint ServerIncoming; + private static byte[] RecvBuffer = new byte[4096]; + private byte[] ZeroBuffer = new byte[8192]; + private static IPEndPoint ipeSender; + private static EndPoint epSender; + private static AsyncCallback ReceivedData; - public AssetCache assetCache; - public DateTime startuptime; - public Dictionary ClientThreads = new Dictionary(); - private PhysicsManager physManager; - private System.Timers.Timer timer1 = new System.Timers.Timer(); - private string ConfigDll = "SimConfig.dll"; - public bool sandbox = false; - public bool loginserver = false; - - [STAThread] - public static void Main( string[] args ) - { - Console.WriteLine("OpenSim " + VersionInfo.Version + "\n"); - Console.WriteLine("Starting...\n"); - ServerConsole.MainConsole.Instance = new MServerConsole(ServerConsole.ConsoleBase.ConsoleType.Local,"",0); - - sim = new OpenSim_Main(); - - for (int i = 0; i < args.Length; i++) - { - if(args[i] == "-sandbox") - { - sim.sandbox = true; - } - if(args[i] == "-loginserver") - { - sim.loginserver = true; - } - } - - OpenSim_Main.gridServers = new Grid(); - if(sim.sandbox) - { - OpenSim_Main.gridServers.AssetDll = "LocalGridServers.dll"; - OpenSim_Main.gridServers.GridDll = "LocalGridServers.dll"; - OpenSim_Main.gridServers.LoadPlugins(); - ServerConsole.MainConsole.Instance.WriteLine("Starting in Sandbox mode"); - } - else - { - OpenSim_Main.gridServers.AssetDll = "RemoteGridServers.dll"; - OpenSim_Main.gridServers.GridDll = "RemoteGridServers.dll"; - OpenSim_Main.gridServers.LoadPlugins(); - ServerConsole.MainConsole.Instance.WriteLine("Starting in Grid mode"); - } - - if(sim.loginserver && sim.sandbox) - { - LoginServer loginServer = new LoginServer(OpenSim_Main.gridServers.GridServer); - loginServer.Startup(); - } - sim.assetCache = new AssetCache(OpenSim_Main.gridServers.AssetServer); - - sim.Startup(); - - while(true) { - ServerConsole.MainConsole.Instance.MainConsolePrompt(); - } - } + public AssetCache assetCache; + public DateTime startuptime; + public Dictionary ClientThreads = new Dictionary(); + private PhysicsManager physManager; + private System.Timers.Timer timer1 = new System.Timers.Timer(); + private string ConfigDll = "SimConfig.dll"; + public bool sandbox = false; + public bool loginserver = false; + + [STAThread] + public static void Main( string[] args ) + { + Console.WriteLine("OpenSim " + VersionInfo.Version + "\n"); + Console.WriteLine("Starting...\n"); + ServerConsole.MainConsole.Instance = new MServerConsole(ServerConsole.ConsoleBase.ConsoleType.Local,"",0); + + sim = new OpenSim_Main(); + + for (int i = 0; i < args.Length; i++) + { + if(args[i] == "-sandbox") + { + sim.sandbox = true; + } + if(args[i] == "-loginserver") + { + sim.loginserver = true; + } + } + + OpenSim_Main.gridServers = new Grid(); + if(sim.sandbox) + { + OpenSim_Main.gridServers.AssetDll = "LocalGridServers.dll"; + OpenSim_Main.gridServers.GridDll = "LocalGridServers.dll"; + OpenSim_Main.gridServers.LoadPlugins(); + ServerConsole.MainConsole.Instance.WriteLine("Starting in Sandbox mode"); + } + else + { + OpenSim_Main.gridServers.AssetDll = "RemoteGridServers.dll"; + OpenSim_Main.gridServers.GridDll = "RemoteGridServers.dll"; + OpenSim_Main.gridServers.LoadPlugins(); + ServerConsole.MainConsole.Instance.WriteLine("Starting in Grid mode"); + } + + if(sim.loginserver && sim.sandbox) + { + LoginServer loginServer = new LoginServer(OpenSim_Main.gridServers.GridServer); + loginServer.Startup(); + } + sim.assetCache = new AssetCache(OpenSim_Main.gridServers.AssetServer); + + sim.Startup(); + + while(true) { + ServerConsole.MainConsole.Instance.MainConsolePrompt(); + } + } - private OpenSim_Main() { - } - - private void Startup() { - startuptime=DateTime.Now; - timer1.Enabled = true; - timer1.Interval = 100; - timer1.Elapsed +=new ElapsedEventHandler( this.Timer1Tick ); - - // We check our local database first, then the grid for config options - ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Startup() - Loading configuration"); - cfg = this.LoadConfigDll(this.ConfigDll); - cfg.InitConfig(); - ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Startup() - Contacting gridserver"); - cfg.LoadFromGrid(); + private OpenSim_Main() { + } + + private void Startup() { + startuptime=DateTime.Now; + timer1.Enabled = true; + timer1.Interval = 100; + timer1.Elapsed +=new ElapsedEventHandler( this.Timer1Tick ); + + // We check our local database first, then the grid for config options + ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Startup() - Loading configuration"); + cfg = this.LoadConfigDll(this.ConfigDll); + cfg.InitConfig(); + ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Startup() - Contacting gridserver"); + cfg.LoadFromGrid(); - ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Startup() - We are " + cfg.RegionName + " at " + cfg.RegionLocX.ToString() + "," + cfg.RegionLocY.ToString()); - ServerConsole.MainConsole.Instance.WriteLine("Initialising world"); - local_world = cfg.LoadWorld(); - - this.physManager = new PhysicsSystem.PhysicsManager(); - this.physManager.LoadPlugins(); - ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Startup() - Starting up messaging system"); - local_world.PhysScene = this.physManager.GetPhysicsScene("PhysX"); //should be reading from the config file what physics engine to use - local_world.PhysScene.SetTerrain(local_world.LandMap); - OpenSim_Main.gridServers.AssetServer.SetServerInfo(OpenSim_Main.cfg.AssetURL, OpenSim_Main.cfg.AssetSendKey); - OpenSim_Main.gridServers.GridServer.SetServerInfo(OpenSim_Main.cfg.GridURL, OpenSim_Main.cfg.GridSendKey); - - MainServerListener(); + ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Startup() - We are " + cfg.RegionName + " at " + cfg.RegionLocX.ToString() + "," + cfg.RegionLocY.ToString()); + ServerConsole.MainConsole.Instance.WriteLine("Initialising world"); + local_world = cfg.LoadWorld(); + + this.physManager = new PhysicsSystem.PhysicsManager(); + this.physManager.LoadPlugins(); + ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Startup() - Starting up messaging system"); + local_world.PhysScene = this.physManager.GetPhysicsScene("PhysX"); //should be reading from the config file what physics engine to use + local_world.PhysScene.SetTerrain(local_world.LandMap); + OpenSim_Main.gridServers.AssetServer.SetServerInfo(OpenSim_Main.cfg.AssetURL, OpenSim_Main.cfg.AssetSendKey); + OpenSim_Main.gridServers.GridServer.SetServerInfo(OpenSim_Main.cfg.GridURL, OpenSim_Main.cfg.GridSendKey); + + MainServerListener(); - } - - private SimConfig LoadConfigDll(string dllName) - { - Assembly pluginAssembly = Assembly.LoadFrom(dllName); + } + + private SimConfig LoadConfigDll(string dllName) + { + Assembly pluginAssembly = Assembly.LoadFrom(dllName); SimConfig config = null; foreach (Type pluginType in pluginAssembly.GetTypes()) { - if (pluginType.IsPublic) + if (pluginType.IsPublic) { - if (!pluginType.IsAbstract) + if (!pluginType.IsAbstract) { Type typeInterface = pluginType.GetInterface("ISimConfig", true); @@ -175,100 +175,99 @@ namespace OpenSim ISimConfig plug = (ISimConfig)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); config = plug.GetConfigObject(); break; - } + } - typeInterface = null; - } - } + typeInterface = null; + } + } } - pluginAssembly = null; + pluginAssembly = null; return config; - } + } - private void OnReceivedData(IAsyncResult result) { - ipeSender = new IPEndPoint(IPAddress.Any, 0); - epSender = (EndPoint)ipeSender; - Packet packet = null; - int numBytes = Server.EndReceiveFrom(result, ref epSender); - int packetEnd = numBytes - 1; - packet = Packet.BuildPacket(RecvBuffer, ref packetEnd, ZeroBuffer); - //Console.Error.WriteLine(packet.ToString()); + private void OnReceivedData(IAsyncResult result) { + ipeSender = new IPEndPoint(IPAddress.Any, 0); + epSender = (EndPoint)ipeSender; + Packet packet = null; + int numBytes = Server.EndReceiveFrom(result, ref epSender); + int packetEnd = numBytes - 1; + packet = Packet.BuildPacket(RecvBuffer, ref packetEnd, ZeroBuffer); + + // This is either a new client or a packet to send to an old one + if(ClientThreads.ContainsKey(epSender)) { + ClientThreads[epSender].InPacket(packet); + } else if( packet.Type == PacketType.UseCircuitCode ) { // new client + OpenSimClient newuser = new OpenSimClient(epSender,(UseCircuitCodePacket)packet); + ClientThreads.Add(epSender, newuser); + } else { // invalid client + Console.Error.WriteLine("Main.cs:OnReceivedData() - WARNING: Got a packet from an invalid client - " + epSender.ToString()); + } + Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null); + } - // This is either a new client or a packet to send to an old one - if(ClientThreads.ContainsKey(epSender)) { - ClientThreads[epSender].InPacket(packet); - } else if( packet.Type == PacketType.UseCircuitCode ) { // new client - OpenSimClient newuser = new OpenSimClient(epSender,(UseCircuitCodePacket)packet); - ClientThreads.Add(epSender, newuser); - } else { // invalid client - Console.Error.WriteLine("Main.cs:OnReceivedData() - WARNING: Got a packet from an invalid client - " + epSender.ToString()); - } - Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null); - } + private void MainServerListener() { + ServerConsole.MainConsole.Instance.WriteLine("Main.cs:MainServerListener() - New thread started"); + ServerConsole.MainConsole.Instance.WriteLine("Main.cs:MainServerListener() - Opening UDP socket on " + cfg.IPListenAddr + ":" + cfg.IPListenPort); - private void MainServerListener() { - ServerConsole.MainConsole.Instance.WriteLine("Main.cs:MainServerListener() - New thread started"); - ServerConsole.MainConsole.Instance.WriteLine("Main.cs:MainServerListener() - Opening UDP socket on " + cfg.IPListenAddr + ":" + cfg.IPListenPort); + ServerIncoming = new IPEndPoint(IPAddress.Any, cfg.IPListenPort); + Server = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); + Server.Bind(ServerIncoming); + + ServerConsole.MainConsole.Instance.WriteLine("Main.cs:MainServerListener() - UDP socket bound, getting ready to listen"); - ServerIncoming = new IPEndPoint(IPAddress.Any, cfg.IPListenPort); - Server = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); - Server.Bind(ServerIncoming); - - ServerConsole.MainConsole.Instance.WriteLine("Main.cs:MainServerListener() - UDP socket bound, getting ready to listen"); - - ipeSender = new IPEndPoint(IPAddress.Any, 0); - epSender = (EndPoint) ipeSender; - ReceivedData = new AsyncCallback(this.OnReceivedData); - Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null); - - ServerConsole.MainConsole.Instance.WriteLine("Main.cs:MainServerListener() - Listening..."); - - } - - public static void Shutdown() { - ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Shutdown() - Closing all threads"); - ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Shutdown() - Killing listener thread"); - ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Shutdown() - Killing clients"); - // IMPLEMENT THIS - ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Shutdown() - Closing console and terminating"); - ServerConsole.MainConsole.Instance.Close(); - Environment.Exit(0); - } - - void Timer1Tick( object sender, System.EventArgs e ) - { - Console.WriteLine("UPDATE WORLD!"); - local_world.Update(); - } - } - - public class Grid - { - public IAssetServer AssetServer; - public IGridServer GridServer; - public string AssetDll = ""; - public string GridDll = ""; - - public Grid() - { - } - - public void LoadPlugins() - { - this.AssetServer = this.LoadAssetDll(this.AssetDll); - this.GridServer = this.LoadGridDll(this.GridDll); - } - - private IAssetServer LoadAssetDll(string dllName) - { - Assembly pluginAssembly = Assembly.LoadFrom(dllName); + ipeSender = new IPEndPoint(IPAddress.Any, 0); + epSender = (EndPoint) ipeSender; + ReceivedData = new AsyncCallback(this.OnReceivedData); + Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null); + + ServerConsole.MainConsole.Instance.WriteLine("Main.cs:MainServerListener() - Listening..."); + + } + + public static void Shutdown() { + ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Shutdown() - Closing all threads"); + ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Shutdown() - Killing listener thread"); + ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Shutdown() - Killing clients"); + // IMPLEMENT THIS + ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Shutdown() - Closing console and terminating"); + ServerConsole.MainConsole.Instance.Close(); + Environment.Exit(0); + } + + void Timer1Tick( object sender, System.EventArgs e ) + { + + local_world.Update(); + } + } + + public class Grid + { + public IAssetServer AssetServer; + public IGridServer GridServer; + public string AssetDll = ""; + public string GridDll = ""; + + public Grid() + { + } + + public void LoadPlugins() + { + this.AssetServer = this.LoadAssetDll(this.AssetDll); + this.GridServer = this.LoadGridDll(this.GridDll); + } + + private IAssetServer LoadAssetDll(string dllName) + { + Assembly pluginAssembly = Assembly.LoadFrom(dllName); IAssetServer server = null; foreach (Type pluginType in pluginAssembly.GetTypes()) { - if (pluginType.IsPublic) + if (pluginType.IsPublic) { - if (!pluginType.IsAbstract) + if (!pluginType.IsAbstract) { Type typeInterface = pluginType.GetInterface("IAssetPlugin", true); @@ -277,26 +276,26 @@ namespace OpenSim IAssetPlugin plug = (IAssetPlugin)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); server = plug.GetAssetServer(); break; - } + } - typeInterface = null; - } - } + typeInterface = null; + } + } } - pluginAssembly = null; + pluginAssembly = null; return server; - } - - private IGridServer LoadGridDll(string dllName) - { - Assembly pluginAssembly = Assembly.LoadFrom(dllName); + } + + private IGridServer LoadGridDll(string dllName) + { + Assembly pluginAssembly = Assembly.LoadFrom(dllName); IGridServer server = null; foreach (Type pluginType in pluginAssembly.GetTypes()) { - if (pluginType.IsPublic) + if (pluginType.IsPublic) { - if (!pluginType.IsAbstract) + if (!pluginType.IsAbstract) { Type typeInterface = pluginType.GetInterface("IGridPlugin", true); @@ -305,14 +304,14 @@ namespace OpenSim IGridPlugin plug = (IGridPlugin)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); server = plug.GetGridServer(); break; - } + } - typeInterface = null; - } - } + typeInterface = null; + } + } } - pluginAssembly = null; + pluginAssembly = null; return server; - } - } + } + } } diff --git a/src/OpenSimClient.cs b/src/OpenSimClient.cs index e05681ff55..7ab3a19128 100644 --- a/src/OpenSimClient.cs +++ b/src/OpenSimClient.cs @@ -91,6 +91,9 @@ namespace OpenSim case PacketType.AgentWearablesRequest: ClientAvatar.SendInitialAppearance(); break; + case PacketType.ObjectAdd: + OpenSim_Main.local_world.AddNewPrim((ObjectAddPacket)Pack, this); + break; case PacketType.TransferRequest: //Console.WriteLine("OpenSimClient.cs:ProcessInPacket() - Got transfer request"); TransferRequestPacket transfer = (TransferRequestPacket)Pack; @@ -251,7 +254,7 @@ namespace OpenSim } } - ServerConsole.MainConsole.Instance.WriteLine("OUT: \n" + Pack.ToString()); + ServerConsole.MainConsole.Instance.WriteLine("OUT: \n" + Pack.ToString()); byte[] ZeroOutBuffer = new byte[4096]; byte[] sendbuffer; diff --git a/src/RemoteServers/RemoteGridServers/AssemblyInfo.cs b/src/RemoteServers/RemoteGridServers/AssemblyInfo.cs index 2eec0d5e5e..0fa7d6ea66 100644 --- a/src/RemoteServers/RemoteGridServers/AssemblyInfo.cs +++ b/src/RemoteServers/RemoteGridServers/AssemblyInfo.cs @@ -1,21 +1,31 @@ -using System; -using System.Reflection; -using System.Runtime.InteropServices; - -// ------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Mono Runtime Version: 2.0.50727.42 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -// ------------------------------------------------------------------------------ - -[assembly: ComVisibleAttribute(false)] -[assembly: CLSCompliantAttribute(false)] -[assembly: AssemblyVersionAttribute("0.1.*.148")] -[assembly: AssemblyTitleAttribute("opensim-remoteservers")] -[assembly: AssemblyDescriptionAttribute("Connects to remote OGS installation")] -[assembly: AssemblyCopyrightAttribute("Copyright © OGS development team 2007")] - +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// Information about this assembly is defined by the following +// attributes. +// +// change them to the information which is associated with the assembly +// you compile. + +[assembly: AssemblyTitle("RemoteGridServers")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("RemoteGridServers")] +[assembly: AssemblyCopyright("")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// This sets the default COM visibility of types in the assembly to invisible. +// If you need to expose a type to COM, use [ComVisible(true)] on that type. +[assembly: ComVisible(false)] + +// The assembly version has following format : +// +// Major.Minor.Build.Revision +// +// You can specify all values by your own or you can build default build and revision +// numbers with the '*' character (the default): + +[assembly: AssemblyVersion("1.0.*")] diff --git a/src/RemoteServers/RemoteGridServers/RemoteGridServers.csproj b/src/RemoteServers/RemoteGridServers/RemoteGridServers.csproj index cb081846bc..6fc1e5a7d1 100644 --- a/src/RemoteServers/RemoteGridServers/RemoteGridServers.csproj +++ b/src/RemoteServers/RemoteGridServers/RemoteGridServers.csproj @@ -27,7 +27,7 @@ - ..\..\..\Libsecond-dailys\libsl07-03\trunk\libsecondlife-cs\obj\Debug\libsecondlife.dll + ..\..\..\..\..\..\..\Libsecond-dailys\libsl07-03\trunk\libsecondlife-cs\obj\Debug\libsecondlife.dll False diff --git a/src/Second-server.csproj b/src/Second-server.csproj index 5b9c76400c..dfb5168633 100644 --- a/src/Second-server.csproj +++ b/src/Second-server.csproj @@ -39,16 +39,16 @@ - - ..\Version0_2_myserver\OpenSim\bin\Debug\log4net.dll + + ..\..\..\..\..\Libsecond-dailys\libsl07-03\trunk\libsecondlife-cs\obj\Debug\libsecondlife.dll False - ..\Version0_2_myserver\OpenSim\bin\Debug\Axiom.MathLib.dll + ..\..\..\..\..\Opensim-pluginsystem\bin\Axiom.MathLib.dll False - - ..\Libsecond-dailys\libsl07-03\trunk\libsecondlife-cs\obj\Debug\libsecondlife.dll + + ..\bin\log4net.dll False diff --git a/src/ServerConsole/ServerConsole/AssemblyInfo.cs b/src/ServerConsole/ServerConsole/AssemblyInfo.cs index db928ea40d..00a9b7d748 100644 --- a/src/ServerConsole/ServerConsole/AssemblyInfo.cs +++ b/src/ServerConsole/ServerConsole/AssemblyInfo.cs @@ -1,21 +1,31 @@ -using System; -using System.Reflection; -using System.Runtime.InteropServices; - -// ------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Mono Runtime Version: 2.0.50727.42 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -// ------------------------------------------------------------------------------ - -[assembly: ComVisibleAttribute(false)] -[assembly: CLSCompliantAttribute(false)] -[assembly: AssemblyVersionAttribute("0.1.*.148")] -[assembly: AssemblyTitleAttribute("opensim-serverconsole")] -[assembly: AssemblyDescriptionAttribute("The default server console")] -[assembly: AssemblyCopyrightAttribute("Copyright © OGS development team 2007")] - +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// Information about this assembly is defined by the following +// attributes. +// +// change them to the information which is associated with the assembly +// you compile. + +[assembly: AssemblyTitle("ServerConsole")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("ServerConsole")] +[assembly: AssemblyCopyright("")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// This sets the default COM visibility of types in the assembly to invisible. +// If you need to expose a type to COM, use [ComVisible(true)] on that type. +[assembly: ComVisible(false)] + +// The assembly version has following format : +// +// Major.Minor.Build.Revision +// +// You can specify all values by your own or you can build default build and revision +// numbers with the '*' character (the default): + +[assembly: AssemblyVersion("1.0.*")] diff --git a/src/Util.cs b/src/Util.cs index 2474166e10..d575beee17 100644 --- a/src/Util.cs +++ b/src/Util.cs @@ -84,120 +84,4 @@ namespace OpenSim } } } - - public class VoipConnectionPacket : Packet - { - /// - // [XmlType("VoipConnection_Serverblock1")] - public class ServerBlock - { - public uint Test1; - public uint IP; - public ushort Port; - private byte[] userName; - public byte[] UserName - { - get { return userName; } - set - { - if (value == null) { userName = null; return; } - if (value.Length > 255) { throw new OverflowException("Value exceeds 255 characters"); } - else { userName = new byte[value.Length]; Array.Copy(value, userName, value.Length); } - } - } - - //[XmlIgnore] - public int Length - { - get - { - int length = 4; - if (UserName != null) { length += 1 + UserName.Length; } - return length; - } - } - - public ServerBlock() { } - public ServerBlock(byte[] bytes, ref int i) - { - try - { - Test1 = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24)); - } - catch (Exception) - { - throw new MalformedDataException(); - } - } - - public void ToBytes(byte[] bytes, ref int i) - { - bytes[i++] = (byte)(Test1 % 256); - bytes[i++] = (byte)((Test1 >> 8) % 256); - bytes[i++] = (byte)((Test1 >> 16) % 256); - bytes[i++] = (byte)((Test1 >> 24) % 256); - if(UserName == null) { Console.WriteLine("Warning: UserName is null, in " + this.GetType()); } - bytes[i++] = (byte)UserName.Length; - Array.Copy(UserName, 0, bytes, i, UserName.Length); - i += UserName.Length; - } - - public override string ToString() - { - string output = "-- ServerBlock1 --" + Environment.NewLine; - output += "Test1: " + Test1.ToString() + "" + Environment.NewLine; - output = output.Trim(); - return output; - } - } - - - private Header header; - public override Header Header { get { return header; } set { header = value; } } - public override PacketType Type { get { return PacketType.TestMessage; } } - public ServerBlock ServerBlock1; - - public VoipConnectionPacket() - { - Header = new LowHeader(); - Header.ID = 600; - Header.Reliable = true; - Header.Zerocoded = true; - ServerBlock1 = new ServerBlock(); - } - - public VoipConnectionPacket(byte[] bytes, ref int i) - { - int packetEnd = bytes.Length - 1; - Header = new LowHeader(bytes, ref i, ref packetEnd); - ServerBlock1 = new ServerBlock(bytes, ref i); - } - - public VoipConnectionPacket(Header head, byte[] bytes, ref int i) - { - Header = head; - ServerBlock1 = new ServerBlock(bytes, ref i); - } - - public override byte[] ToBytes() - { - int length = 8; - length += ServerBlock1.Length;; - if (header.AckList.Length > 0) { length += header.AckList.Length * 4 + 1; } - byte[] bytes = new byte[length]; - int i = 0; - header.ToBytes(bytes, ref i); - ServerBlock1.ToBytes(bytes, ref i); - if (header.AckList.Length > 0) { header.AcksToBytes(bytes, ref i); } - return bytes; - } - - public override string ToString() - { - string output = "--- VoipConnection ---" + Environment.NewLine; - output += ServerBlock1.ToString() + Environment.NewLine; - return output; - } - - } } diff --git a/src/physics/AssemblyInfo.cs b/src/physics/AssemblyInfo.cs index f6a450e4fc..57a8913d33 100644 --- a/src/physics/AssemblyInfo.cs +++ b/src/physics/AssemblyInfo.cs @@ -1,21 +1,31 @@ -using System; -using System.Reflection; -using System.Runtime.InteropServices; - -// ------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Mono Runtime Version: 2.0.50727.42 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -// ------------------------------------------------------------------------------ - -[assembly: ComVisibleAttribute(false)] -[assembly: CLSCompliantAttribute(false)] -[assembly: AssemblyVersionAttribute("0.1.*.148")] -[assembly: AssemblyTitleAttribute("opensim-physicsmanager")] -[assembly: AssemblyDescriptionAttribute("Handles physics plugins")] -[assembly: AssemblyCopyrightAttribute("Copyright © OGS development team 2007")] - +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// Information about this assembly is defined by the following +// attributes. +// +// change them to the information which is associated with the assembly +// you compile. + +[assembly: AssemblyTitle("PhysicsManager")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("PhysicsManager")] +[assembly: AssemblyCopyright("")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// This sets the default COM visibility of types in the assembly to invisible. +// If you need to expose a type to COM, use [ComVisible(true)] on that type. +[assembly: ComVisible(false)] + +// The assembly version has following format : +// +// Major.Minor.Build.Revision +// +// You can specify all values by your own or you can build default build and revision +// numbers with the '*' character (the default): + +[assembly: AssemblyVersion("1.0.*")] diff --git a/src/physics/plugins/AssemblyInfo.cs b/src/physics/plugins/AssemblyInfo.cs index c2986adc93..0c9c06c43d 100644 --- a/src/physics/plugins/AssemblyInfo.cs +++ b/src/physics/plugins/AssemblyInfo.cs @@ -1,21 +1,31 @@ -using System; -using System.Reflection; -using System.Runtime.InteropServices; - -// ------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Mono Runtime Version: 2.0.50727.42 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -// ------------------------------------------------------------------------------ - -[assembly: ComVisibleAttribute(false)] -[assembly: CLSCompliantAttribute(false)] -[assembly: AssemblyVersionAttribute("0.1.*.148")] -[assembly: AssemblyTitleAttribute("opensim-physicsmanager-physx")] -[assembly: AssemblyDescriptionAttribute("PhysX plugin for OpenSim")] -[assembly: AssemblyCopyrightAttribute("Copyright © OGS development team 2007")] - +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// Information about this assembly is defined by the following +// attributes. +// +// change them to the information which is associated with the assembly +// you compile. + +[assembly: AssemblyTitle("PhysXplugin")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("PhysXplugin")] +[assembly: AssemblyCopyright("")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// This sets the default COM visibility of types in the assembly to invisible. +// If you need to expose a type to COM, use [ComVisible(true)] on that type. +[assembly: ComVisible(false)] + +// The assembly version has following format : +// +// Major.Minor.Build.Revision +// +// You can specify all values by your own or you can build default build and revision +// numbers with the '*' character (the default): + +[assembly: AssemblyVersion("1.0.*")] diff --git a/src/physics/plugins/PhysXplugin.cs b/src/physics/plugins/PhysXplugin.cs index 163b65bd68..58a82fb58a 100644 --- a/src/physics/plugins/PhysXplugin.cs +++ b/src/physics/plugins/PhysXplugin.cs @@ -87,10 +87,8 @@ namespace PhysXplugin public override void Simulate(float timeStep) { - Console.WriteLine("SIMULATE!"); foreach (PhysXActor actor in _actors) { - Console.WriteLine("AN ACTOR!"); actor.Position.X = actor.Position.X + actor.Velocity.X * timeStep; actor.Position.Y = actor.Position.Y + actor.Velocity.Y * timeStep; actor.Position.Z = actor.Position.Z + actor.Velocity.Z * timeStep; @@ -120,7 +118,7 @@ namespace PhysXplugin public override void GetResults() { - Console.WriteLine("GET RESULTS!"); + } public override bool IsThreaded diff --git a/src/world/Avatar.cs b/src/world/Avatar.cs index a3443832d7..c8469f8ef0 100644 --- a/src/world/Avatar.cs +++ b/src/world/Avatar.cs @@ -26,6 +26,7 @@ namespace OpenSim.world ControllingClient=TheClient; SetupTemplate("avatar-template.dat"); position = new LLVector3(100.0f,100.0f,30.0f); + position.Z = OpenSim_Main.local_world.LandMap[(int)position.Y * 256 + (int)position.X]+1; } public PhysicsActor PhysActor @@ -43,7 +44,6 @@ namespace OpenSim.world { for(int i=0 ; i < this.forcesList.Count; i++) { - Console.WriteLine("ADDING A FORCE!"); NewForce force = this.forcesList[i]; PhysicsVector phyVector = new PhysicsVector(force.X, force.Y, force.Z); this._physActor.Velocity = phyVector; @@ -61,8 +61,8 @@ namespace OpenSim.world public override void update() { - Console.WriteLine("UPDATING AVATAR!"); - if(this.updateflag) + + if(this.updateflag) { //need to send movement info //so create the improvedterseobjectupdate packet @@ -74,28 +74,31 @@ namespace OpenSim.world terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; terse.ObjectData[0] = terseBlock; foreach(OpenSimClient client in OpenSim_Main.sim.ClientThreads.Values) { - client.OutPacket(terse); - } + client.OutPacket(terse); + } - updateflag =false; + updateflag =false; this._updateCount = 0; } else { - _updateCount++; - if(_updateCount>5) + if(walking) { - //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 = OpenSim_Main.cfg.RegionHandle; // FIXME - terse.RegionData.TimeDilation = 64096; - terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; - terse.ObjectData[0] = terseBlock; - foreach(OpenSimClient client in OpenSim_Main.sim.ClientThreads.Values) { - client.OutPacket(terse); + _updateCount++; + if(_updateCount>3) + { + //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 = OpenSim_Main.cfg.RegionHandle; // FIXME + terse.RegionData.TimeDilation = 64096; + terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; + terse.ObjectData[0] = terseBlock; + foreach(OpenSimClient client in OpenSim_Main.sim.ClientThreads.Values) { + client.OutPacket(terse); + } + _updateCount = 0; } - _updateCount = 0; } } } diff --git a/src/world/Entity.cs b/src/world/Entity.cs index 7e986a5e97..147478b2b7 100644 --- a/src/world/Entity.cs +++ b/src/world/Entity.cs @@ -9,8 +9,8 @@ namespace OpenSim.world { public class Entity { - protected libsecondlife.LLUUID uuid; - protected uint localid; + public libsecondlife.LLUUID uuid; + public uint localid; public LLVector3 position; public LLVector3 velocity; public Quaternion rotation; diff --git a/src/world/Primitive.cs b/src/world/Primitive.cs index 143fa55a33..18b5715338 100644 --- a/src/world/Primitive.cs +++ b/src/world/Primitive.cs @@ -2,6 +2,8 @@ using System; using System.Collections.Generic; using System.Text; using OpenSim.types; +using libsecondlife; +using libsecondlife.Packets; namespace OpenSim.world { @@ -9,6 +11,9 @@ namespace OpenSim.world { protected float mesh_cutbegin; protected float mesh_cutend; + protected PrimData primData; + protected bool newPrimFlag; + protected ObjectUpdatePacket OurPacket; public Primitive() { @@ -29,5 +34,103 @@ namespace OpenSim.world return mesh; } + + public override void update() + { + if(this.newPrimFlag) + { + foreach(OpenSimClient client in OpenSim_Main.sim.ClientThreads.Values) { + client.OutPacket(OurPacket); + } + this.newPrimFlag = false; + } + } + + public void CreateFromPacket( ObjectAddPacket addPacket, LLUUID agentID, uint localID) + { + ObjectUpdatePacket objupdate = new ObjectUpdatePacket(); + objupdate.RegionData.RegionHandle = OpenSim_Main.cfg.RegionHandle; + objupdate.RegionData.TimeDilation = 64096; + + objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1]; + PrimData PData = new PrimData(); + this.primData = PData; + objupdate.ObjectData[0] = new ObjectUpdatePacket.ObjectDataBlock();//OpenSim_Main.local_world.PrimTemplate; + objupdate.ObjectData[0].PSBlock = new byte[0]; + objupdate.ObjectData[0].ExtraParams = new byte[1]; + objupdate.ObjectData[0].MediaURL = new byte[0]; + objupdate.ObjectData[0].NameValue = new byte[0]; + objupdate.ObjectData[0].PSBlock = new byte[0]; + objupdate.ObjectData[0].Text = new byte[0]; + objupdate.ObjectData[0].TextColor = new byte[4]; + objupdate.ObjectData[0].JointAxisOrAnchor = new LLVector3(0,0,0); + objupdate.ObjectData[0].JointPivot = new LLVector3(0,0,0); + objupdate.ObjectData[0].Material = 3; + objupdate.ObjectData[0].TextureAnim = new byte[0]; + objupdate.ObjectData[0].Sound = LLUUID.Zero; + LLObject.TextureEntry ntex = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-5005-000000000005")); + objupdate.ObjectData[0].TextureEntry = ntex.ToBytes(); + objupdate.ObjectData[0].State = 0; + objupdate.ObjectData[0].Data = new byte[0]; + PData.OwnerID = objupdate.ObjectData[0].OwnerID = agentID; + PData.PCode = objupdate.ObjectData[0].PCode = addPacket.ObjectData.PCode; + PData.PathBegin = objupdate.ObjectData[0].PathBegin = addPacket.ObjectData.PathBegin; + PData.PathEnd = objupdate.ObjectData[0].PathEnd = addPacket.ObjectData.PathEnd; + PData.PathScaleX = objupdate.ObjectData[0].PathScaleX = addPacket.ObjectData.PathScaleX; + PData.PathScaleY = objupdate.ObjectData[0].PathScaleY = addPacket.ObjectData.PathScaleY; + PData.PathShearX = objupdate.ObjectData[0].PathShearX = addPacket.ObjectData.PathShearX; + PData.PathShearY = objupdate.ObjectData[0].PathShearY = addPacket.ObjectData.PathShearY; + PData.PathSkew = objupdate.ObjectData[0].PathSkew = addPacket.ObjectData.PathSkew; + PData.ProfileBegin = objupdate.ObjectData[0].ProfileBegin = addPacket.ObjectData.ProfileBegin; + PData.ProfileEnd = objupdate.ObjectData[0].ProfileEnd = addPacket.ObjectData.ProfileEnd; + PData.Scale = objupdate.ObjectData[0].Scale = addPacket.ObjectData.Scale; + PData.PathCurve = objupdate.ObjectData[0].PathCurve = addPacket.ObjectData.PathCurve; + PData.ProfileCurve = objupdate.ObjectData[0].ProfileCurve = addPacket.ObjectData.ProfileCurve; + PData.ParentID = objupdate.ObjectData[0].ParentID = 0; + PData.ProfileHollow = objupdate.ObjectData[0].ProfileHollow = addPacket.ObjectData.ProfileHollow; + //finish off copying rest of shape data + + objupdate.ObjectData[0].ID = (uint)(localID); + objupdate.ObjectData[0].FullID = new LLUUID("edba7151-5857-acc5-b30b-f01efefda" + (localID- 702000).ToString("000")); + + objupdate.ObjectData[0].ObjectData = new byte[60]; + objupdate.ObjectData[0].ObjectData[46] = 128; + objupdate.ObjectData[0].ObjectData[47] = 63; + LLVector3 pos1= addPacket.ObjectData.RayEnd; + //update position + byte[] pb = pos1.GetBytes(); + Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 0, pb.Length); + + this.newPrimFlag = true; + this.uuid = objupdate.ObjectData[0].FullID; + this.localid = objupdate.ObjectData[0].ID; + this.position = pos1; + this.OurPacket = objupdate; + } + } + + public class PrimData + { + public LLUUID OwnerID; + public byte PCode; + public byte PathBegin; + public byte PathEnd; + public byte PathScaleX; + public byte PathScaleY; + public byte PathShearX; + public byte PathShearY; + public sbyte PathSkew; + public byte ProfileBegin; + public byte ProfileEnd; + public LLVector3 Scale; + public byte PathCurve; + public byte ProfileCurve; + public uint ParentID=0; + public byte ProfileHollow; + + public PrimData() + { + + } } } diff --git a/src/world/World.cs b/src/world/World.cs index 2645113151..8427a3860e 100644 --- a/src/world/World.cs +++ b/src/world/World.cs @@ -18,6 +18,7 @@ namespace OpenSim.world private libsecondlife.TerrainManager TerrainManager; private Random Rand = new Random(); + private uint _primCount = 702000; public World() { @@ -95,11 +96,22 @@ namespace OpenSim.world //this.Update(); // will work for now, but needs to be optimised so we don't update everything in the sim for each new user this.Entities.Add(AgentClient.AgentID, NewAvatar); } + + public void AddNewPrim(ObjectAddPacket addPacket, OpenSimClient AgentClient) + { + ServerConsole.MainConsole.Instance.WriteLine("World.cs: AddNewPrim() - Creating new prim"); + Primitive prim = new Primitive(); + prim.CreateFromPacket(addPacket, AgentClient.AgentID, this._primCount); + this.Entities.Add(prim.uuid, prim); + this._primCount++; + } public bool Backup() { /* TODO: Save the current world entities state. */ return false; } + + } }