More refactoring, Removed the static variables from OpenSim_Main, and now just have that a singleton of that class.
Moved the abstract SimConfig class to the framework as well as HeightmapGenHills.cs. Added IUserServer.cs for the interface through which the sim will contact the user server for things like inventory details.physics-inventorytesting
parent
423c51ac7f
commit
d363a96e8d
|
@ -27,7 +27,7 @@
|
|||
|
||||
using System;
|
||||
|
||||
namespace OpenSim
|
||||
namespace OpenSim.Framework.Terrain
|
||||
{
|
||||
public class HeightmapGenHills
|
||||
{
|
|
@ -61,21 +61,6 @@ namespace OpenSim.Framework.Interfaces
|
|||
public bool IsTexture;
|
||||
}
|
||||
|
||||
/*public class AssetBase
|
||||
{
|
||||
public byte[] Data;
|
||||
public LLUUID FullID;
|
||||
public sbyte Type;
|
||||
public sbyte InvType;
|
||||
public string Name;
|
||||
public string Description;
|
||||
|
||||
public AssetBase()
|
||||
{
|
||||
|
||||
}
|
||||
}*/
|
||||
|
||||
public interface IAssetPlugin
|
||||
{
|
||||
IAssetServer GetAssetServer();
|
||||
|
|
|
@ -31,9 +31,9 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using libsecondlife;
|
||||
using OpenSim.world;
|
||||
//using OpenSim.world;
|
||||
|
||||
namespace OpenSim
|
||||
namespace OpenSim.Framework.Interfaces
|
||||
{
|
||||
/// <summary>
|
||||
/// This class handles connection to the underlying database used for configuration of the region.
|
||||
|
@ -60,10 +60,10 @@ namespace OpenSim
|
|||
public string GridURL;
|
||||
public string GridSendKey;
|
||||
|
||||
public abstract void InitConfig();
|
||||
public abstract void InitConfig(bool sandboxMode);
|
||||
public abstract void LoadFromGrid();
|
||||
public abstract World LoadWorld();
|
||||
public abstract void SaveMap();
|
||||
public abstract float[] LoadWorld();
|
||||
public abstract void SaveMap(float[] heightmap);
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using OpenSim.Framework.Inventory;
|
||||
using libsecondlife;
|
||||
|
||||
namespace OpenSim.Framework.Interfaces
|
||||
{
|
||||
public interface IUserServer
|
||||
{
|
||||
AgentInventory RequestAgentsInventory(LLUUID agentID);
|
||||
}
|
||||
}
|
|
@ -41,10 +41,13 @@
|
|||
<ItemGroup>
|
||||
<Compile Include="AssetBase.cs" />
|
||||
<Compile Include="BlockingQueue.cs" />
|
||||
<Compile Include="HeightMapGenHills.cs" />
|
||||
<Compile Include="IAssetServer.cs" />
|
||||
<Compile Include="IConfig.cs" />
|
||||
<Compile Include="IGridServer.cs" />
|
||||
<Compile Include="ILocalStorage.cs" />
|
||||
<Compile Include="Inventory.cs" />
|
||||
<Compile Include="IUserServer.cs" />
|
||||
<Compile Include="LoginService.cs" />
|
||||
<Compile Include="PrimData.cs" />
|
||||
<Compile Include="SimProfile.cs" />
|
||||
|
|
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
|||
using System.Text;
|
||||
using libsecondlife;
|
||||
using OpenSim.Framework.Utilities;
|
||||
using OpenSim.Framework.Inventory;
|
||||
|
||||
namespace OpenSim.Framework.User
|
||||
{
|
||||
|
@ -75,5 +76,16 @@ namespace OpenSim.Framework.User
|
|||
return newprofile;
|
||||
}
|
||||
|
||||
public virtual AgentInventory GetUsersInventory(LLUUID agentID)
|
||||
{
|
||||
UserProfile user = this.GetProfileByLLUUID(agentID);
|
||||
if (user != null)
|
||||
{
|
||||
return user.Inventory;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,11 +8,21 @@ namespace OpenSim.Framework.Utilities
|
|||
{
|
||||
public class Util
|
||||
{
|
||||
private static Random randomClass = new Random();
|
||||
|
||||
public static ulong UIntsToLong(uint X, uint Y)
|
||||
{
|
||||
return Helpers.UIntsToLong(X, Y);
|
||||
}
|
||||
|
||||
public static Random RandomClass
|
||||
{
|
||||
get
|
||||
{
|
||||
return randomClass;
|
||||
}
|
||||
}
|
||||
|
||||
public Util()
|
||||
{
|
||||
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -63,7 +63,7 @@ namespace OpenSim
|
|||
ServerConsole.MainConsole.Instance.WriteLine("SimHttp.cs:StartHTTP() - Spawned main thread OK");
|
||||
Listener = new HttpListener();
|
||||
|
||||
Listener.Prefixes.Add("http://+:" + OpenSim_Main.cfg.IPListenPort + "/");
|
||||
Listener.Prefixes.Add("http://+:" + OpenSim_Main.Instance.Cfg.IPListenPort + "/");
|
||||
Listener.Start();
|
||||
|
||||
HttpListenerContext context;
|
||||
|
@ -96,9 +96,9 @@ namespace OpenSim
|
|||
agent_data.lastname = (string)requestData["lastname"];
|
||||
agent_data.AgentID = new LLUUID((string)requestData["agent_id"]);
|
||||
agent_data.circuitcode = Convert.ToUInt32(requestData["circuit_code"]);
|
||||
if (OpenSim_Main.gridServers.GridServer.GetName() == "Remote")
|
||||
if (OpenSim_Main.Instance.GridServers.GridServer.GetName() == "Remote")
|
||||
{
|
||||
((RemoteGridBase)OpenSim_Main.gridServers.GridServer).agentcircuits.Add((uint)agent_data.circuitcode, agent_data);
|
||||
((RemoteGridBase)OpenSim_Main.Instance.GridServers.GridServer).agentcircuits.Add((uint)agent_data.circuitcode, agent_data);
|
||||
}
|
||||
return "<?xml version=\"1.0\"?><methodResponse><params /></methodResponse>";
|
||||
break;
|
||||
|
|
|
@ -28,7 +28,9 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using OpenSim;
|
||||
using OpenSim.Framework.Utilities;
|
||||
using OpenSim.world;
|
||||
using OpenSim.Framework.Interfaces;
|
||||
using OpenSim.Framework.Terrain;
|
||||
//using OpenSim.world;
|
||||
using Db4objects.Db4o;
|
||||
|
||||
namespace Db40SimConfig
|
||||
|
@ -44,6 +46,7 @@ namespace Db40SimConfig
|
|||
|
||||
public class DbSimConfig :SimConfig
|
||||
{
|
||||
private bool isSandbox;
|
||||
private IObjectContainer db;
|
||||
|
||||
public void LoadDefaults() {
|
||||
|
@ -55,7 +58,7 @@ namespace Db40SimConfig
|
|||
this.IPListenPort=Convert.ToInt32(ServerConsole.MainConsole.Instance.CmdPrompt("UDP port for client connections [9000]: ","9000"));
|
||||
this.IPListenAddr=ServerConsole.MainConsole.Instance.CmdPrompt("IP Address to listen on for client connections [127.0.0.1]: ","127.0.0.1");
|
||||
|
||||
if(!OpenSim_Main.sim.sandbox)
|
||||
if(!isSandbox)
|
||||
{
|
||||
this.AssetURL=ServerConsole.MainConsole.Instance.CmdPrompt("Asset server URL: ");
|
||||
this.AssetSendKey=ServerConsole.MainConsole.Instance.CmdPrompt("Asset server key: ");
|
||||
|
@ -65,7 +68,8 @@ namespace Db40SimConfig
|
|||
this.RegionHandle = Util.UIntsToLong((RegionLocX*256), (RegionLocY*256));
|
||||
}
|
||||
|
||||
public override void InitConfig() {
|
||||
public override void InitConfig(bool sandboxMode) {
|
||||
this.isSandbox = sandboxMode;
|
||||
try {
|
||||
db = Db4oFactory.OpenFile("opensim.yap");
|
||||
IObjectSet result = db.Get(typeof(DbSimConfig));
|
||||
|
@ -100,37 +104,40 @@ namespace Db40SimConfig
|
|||
ServerConsole.MainConsole.Instance.WriteLine("Region Location: [" + this.RegionLocX.ToString() + "," + this.RegionLocY + "]");
|
||||
ServerConsole.MainConsole.Instance.WriteLine("Region Handle: " + this.RegionHandle.ToString());
|
||||
ServerConsole.MainConsole.Instance.WriteLine("Listening on IP: " + this.IPListenAddr + ":" + this.IPListenPort);
|
||||
ServerConsole.MainConsole.Instance.WriteLine("Sandbox Mode? " + OpenSim_Main.sim.sandbox.ToString());
|
||||
ServerConsole.MainConsole.Instance.WriteLine("Sandbox Mode? " + isSandbox.ToString());
|
||||
ServerConsole.MainConsole.Instance.WriteLine("Asset URL: " + this.AssetURL);
|
||||
ServerConsole.MainConsole.Instance.WriteLine("Asset key: " + this.AssetSendKey);
|
||||
ServerConsole.MainConsole.Instance.WriteLine("Grid URL: " + this.GridURL);
|
||||
ServerConsole.MainConsole.Instance.WriteLine("Grid key: " + this.GridSendKey);
|
||||
}
|
||||
|
||||
public override World LoadWorld()
|
||||
public override float[] LoadWorld()
|
||||
{
|
||||
ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - Loading world....");
|
||||
World blank = new World();
|
||||
//World blank = new World();
|
||||
float[] heightmap = null;
|
||||
ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - Looking for a heightmap in local DB");
|
||||
IObjectSet world_result = db.Get(typeof(MapStorage));
|
||||
if(world_result.Count>0) {
|
||||
ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - Found a heightmap in local database, loading");
|
||||
MapStorage map=(MapStorage)world_result.Next();
|
||||
blank.LandMap = map.Map;
|
||||
//blank.LandMap = map.Map;
|
||||
heightmap = map.Map;
|
||||
} else {
|
||||
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 = hills.GenerateHeightmap(200, 4.0f, 80.0f, false);
|
||||
heightmap = hills.GenerateHeightmap(200, 4.0f, 80.0f, false);
|
||||
ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - Saving heightmap to local database");
|
||||
MapStorage map= new MapStorage();
|
||||
map.Map = blank.LandMap;
|
||||
map.Map = heightmap; //blank.LandMap;
|
||||
db.Set(map);
|
||||
db.Commit();
|
||||
}
|
||||
return blank;
|
||||
return heightmap;
|
||||
}
|
||||
|
||||
public override void SaveMap()
|
||||
public override void SaveMap(float[] heightmap)
|
||||
{
|
||||
IObjectSet world_result = db.Get(typeof(MapStorage));
|
||||
if(world_result.Count>0) {
|
||||
|
@ -139,7 +146,7 @@ namespace Db40SimConfig
|
|||
db.Delete(map);
|
||||
}
|
||||
MapStorage map1= new MapStorage();
|
||||
map1.Map = OpenSim_Main.local_world.LandMap;
|
||||
map1.Map = heightmap; //OpenSim_Main.local_world.LandMap;
|
||||
db.Set(map1);
|
||||
db.Commit();
|
||||
}
|
||||
|
|
|
@ -44,10 +44,6 @@
|
|||
<Project>{C9A6026D-8E0C-4FE4-8691-FB2A566AA245}</Project>
|
||||
<Name>ServerConsole</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Second-server.csproj">
|
||||
<Project>{132A6E3E-8F2D-4BF5-BDFB-8555F53F334E}</Project>
|
||||
<Name>Second-server</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
|
||||
</Project>
|
|
@ -0,0 +1,88 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Reflection;
|
||||
using OpenSim.Framework.Interfaces;
|
||||
using OpenSim.Framework.LocalServers;
|
||||
|
||||
namespace OpenSim
|
||||
{
|
||||
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);
|
||||
}
|
||||
public void Close()
|
||||
{
|
||||
this.AssetServer.Close();
|
||||
this.GridServer.Close();
|
||||
}
|
||||
|
||||
private IAssetServer LoadAssetDll(string dllName)
|
||||
{
|
||||
Assembly pluginAssembly = Assembly.LoadFrom(dllName);
|
||||
IAssetServer server = null;
|
||||
|
||||
foreach (Type pluginType in pluginAssembly.GetTypes())
|
||||
{
|
||||
if (pluginType.IsPublic)
|
||||
{
|
||||
if (!pluginType.IsAbstract)
|
||||
{
|
||||
Type typeInterface = pluginType.GetInterface("IAssetPlugin", true);
|
||||
|
||||
if (typeInterface != null)
|
||||
{
|
||||
IAssetPlugin plug = (IAssetPlugin)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
|
||||
server = plug.GetAssetServer();
|
||||
break;
|
||||
}
|
||||
|
||||
typeInterface = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
pluginAssembly = null;
|
||||
return server;
|
||||
}
|
||||
|
||||
private IGridServer LoadGridDll(string dllName)
|
||||
{
|
||||
Assembly pluginAssembly = Assembly.LoadFrom(dllName);
|
||||
IGridServer server = null;
|
||||
|
||||
foreach (Type pluginType in pluginAssembly.GetTypes())
|
||||
{
|
||||
if (pluginType.IsPublic)
|
||||
{
|
||||
if (!pluginType.IsAbstract)
|
||||
{
|
||||
Type typeInterface = pluginType.GetInterface("IGridPlugin", true);
|
||||
|
||||
if (typeInterface != null)
|
||||
{
|
||||
IGridPlugin plug = (IGridPlugin)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
|
||||
server = plug.GetGridServer();
|
||||
break;
|
||||
}
|
||||
|
||||
typeInterface = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
pluginAssembly = null;
|
||||
return server;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -19,13 +19,18 @@ namespace OpenSim.Framework.LocalServers
|
|||
_gridServer = gridServer;
|
||||
}
|
||||
|
||||
public override void InitUserProfiles()
|
||||
{
|
||||
// TODO: need to load from database
|
||||
}
|
||||
|
||||
public override void CustomiseResponse(ref System.Collections.Hashtable response, UserProfile theUser)
|
||||
{
|
||||
uint circode = (uint)response["circuit_code"];
|
||||
theUser.AddSimCircuit(circode, LLUUID.Random());
|
||||
response["home"] = "{'region_handle':[r" + (997 * 256).ToString() + ",r" + (996 * 256).ToString() + "], 'position':[r" + theUser.homepos.X.ToString() + ",r" + theUser.homepos.Y.ToString() + ",r" + theUser.homepos.Z.ToString() + "], 'look_at':[r" + theUser.homelookat.X.ToString() + ",r" + theUser.homelookat.Y.ToString() + ",r" + theUser.homelookat.Z.ToString() + "]}";
|
||||
response["sim_port"] = OpenSim_Main.cfg.IPListenPort;
|
||||
response["sim_ip"] = OpenSim_Main.cfg.IPListenAddr;
|
||||
response["sim_port"] = OpenSim_Main.Instance.Cfg.IPListenPort;
|
||||
response["sim_ip"] = OpenSim_Main.Instance.Cfg.IPListenAddr;
|
||||
response["region_y"] = (Int32)996 * 256;
|
||||
response["region_x"] = (Int32)997* 256;
|
||||
|
||||
|
@ -62,7 +67,7 @@ namespace OpenSim.Framework.LocalServers
|
|||
_login.InventoryFolder = new LLUUID((string)Inventory1["folder_id"]);
|
||||
|
||||
//working on local computer if so lets add to the gridserver's list of sessions?
|
||||
if (OpenSim_Main.gridServers.GridServer.GetName() == "Local")
|
||||
if (OpenSim_Main.Instance.GridServers.GridServer.GetName() == "Local")
|
||||
{
|
||||
((LocalGridBase)this._gridServer).AddNewSession(_login);
|
||||
}
|
||||
|
|
|
@ -42,6 +42,7 @@ using OpenSim.Framework.Interfaces;
|
|||
using OpenSim.Framework.Grid;
|
||||
using OpenSim.Framework.Inventory;
|
||||
using OpenSim.Framework.User;
|
||||
using OpenSim.Framework.Utilities;
|
||||
|
||||
namespace OpenSim.Framework.LocalServers
|
||||
{
|
||||
|
@ -49,20 +50,13 @@ namespace OpenSim.Framework.LocalServers
|
|||
/// <summary>
|
||||
/// When running in local (default) mode , handles client logins.
|
||||
/// </summary>
|
||||
public class LoginServer : LoginService
|
||||
public class LoginServer : LoginService , IUserServer
|
||||
{
|
||||
public LoginServer(IGridServer gridServer)
|
||||
{
|
||||
_gridServer = gridServer;
|
||||
}
|
||||
|
||||
private Login _login;
|
||||
private IGridServer _gridServer;
|
||||
private ushort _loginPort = 8080;
|
||||
public IPAddress clientAddress = IPAddress.Loopback;
|
||||
public IPAddress remoteAddress = IPAddress.Any;
|
||||
private Socket loginServer;
|
||||
private Random RandomClass = new Random();
|
||||
private int NumClients;
|
||||
private string _defaultResponse;
|
||||
private bool userAccounts = false;
|
||||
|
@ -70,6 +64,11 @@ namespace OpenSim.Framework.LocalServers
|
|||
private bool _needPasswd = false;
|
||||
private LocalUserProfileManager userManager;
|
||||
|
||||
public LoginServer(IGridServer gridServer)
|
||||
{
|
||||
_gridServer = gridServer;
|
||||
}
|
||||
|
||||
// InitializeLogin: initialize the login
|
||||
private void InitializeLogin()
|
||||
{
|
||||
|
@ -89,7 +88,10 @@ namespace OpenSim.Framework.LocalServers
|
|||
}
|
||||
SR.Close();
|
||||
this._mpasswd = EncodePassword("testpass");
|
||||
|
||||
userManager = new LocalUserProfileManager(this._gridServer);
|
||||
userManager.InitUserProfiles();
|
||||
userManager.SetKeys("", "", "", "Welcome to OpenSim");
|
||||
|
||||
loginServer = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
|
||||
loginServer.Bind(new IPEndPoint(remoteAddress, _loginPort));
|
||||
|
@ -174,6 +176,7 @@ namespace OpenSim.Framework.LocalServers
|
|||
|
||||
if (this.userAccounts)
|
||||
{
|
||||
//ask the UserProfile Manager to process the request
|
||||
string reply = this.userManager.ParseXMLRPC(new String(content));
|
||||
// forward the XML-RPC response to the client
|
||||
writer.WriteLine("HTTP/1.0 200 OK");
|
||||
|
@ -183,138 +186,158 @@ namespace OpenSim.Framework.LocalServers
|
|||
}
|
||||
else
|
||||
{
|
||||
//handle ourselves
|
||||
XmlRpcRequest request = (XmlRpcRequest)(new XmlRpcRequestDeserializer()).Deserialize(new String(content));
|
||||
this.ProcessXmlRequest(request, writer);
|
||||
if (request.MethodName == "login_to_simulator")
|
||||
{
|
||||
this.ProcessXmlRequest(request, writer);
|
||||
}
|
||||
else
|
||||
{
|
||||
XmlRpcResponse PresenceErrorResp = new XmlRpcResponse();
|
||||
Hashtable PresenceErrorRespData = new Hashtable();
|
||||
PresenceErrorRespData["reason"] = "XmlRequest"; ;
|
||||
PresenceErrorRespData["message"] = "Unknown Rpc request";
|
||||
PresenceErrorRespData["login"] = "false";
|
||||
PresenceErrorResp.Value = PresenceErrorRespData;
|
||||
string reply = Regex.Replace(XmlRpcResponseSerializer.Singleton.Serialize(PresenceErrorResp), " encoding=\"utf-16\"", "");
|
||||
writer.WriteLine("HTTP/1.0 200 OK");
|
||||
writer.WriteLine("Content-type: text/xml");
|
||||
writer.WriteLine();
|
||||
writer.WriteLine(reply);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool ProcessXmlRequest(XmlRpcRequest request, StreamWriter writer)
|
||||
{
|
||||
if (request.MethodName == "login_to_simulator")
|
||||
Hashtable requestData = (Hashtable)request.Params[0];
|
||||
string first;
|
||||
string last;
|
||||
string passwd;
|
||||
LLUUID Agent;
|
||||
LLUUID Session;
|
||||
|
||||
//get login name
|
||||
if (requestData.Contains("first"))
|
||||
{
|
||||
Hashtable requestData = (Hashtable)request.Params[0];
|
||||
string first;
|
||||
string last;
|
||||
string passwd;
|
||||
LLUUID Agent;
|
||||
LLUUID Session;
|
||||
|
||||
//get login name
|
||||
if (requestData.Contains("first"))
|
||||
{
|
||||
first = (string)requestData["first"];
|
||||
}
|
||||
else
|
||||
{
|
||||
first = "test";
|
||||
}
|
||||
|
||||
if (requestData.Contains("last"))
|
||||
{
|
||||
last = (string)requestData["last"];
|
||||
}
|
||||
else
|
||||
{
|
||||
last = "User" + NumClients.ToString();
|
||||
}
|
||||
|
||||
if (requestData.Contains("passwd"))
|
||||
{
|
||||
passwd = (string)requestData["passwd"];
|
||||
}
|
||||
else
|
||||
{
|
||||
passwd = "notfound";
|
||||
}
|
||||
|
||||
if (!Authenticate(first, last, passwd))
|
||||
{
|
||||
// Fail miserably
|
||||
writer.WriteLine("HTTP/1.0 403 Authentication Forbidden");
|
||||
writer.WriteLine();
|
||||
return false;
|
||||
}
|
||||
NumClients++;
|
||||
|
||||
//create a agent and session LLUUID
|
||||
Agent = GetAgentId(first, last);
|
||||
int SessionRand = this.RandomClass.Next(1, 999);
|
||||
Session = new LLUUID("aaaabbbb-0200-" + SessionRand.ToString("0000") + "-8664-58f53e442797");
|
||||
|
||||
//create some login info
|
||||
Hashtable LoginFlagsHash = new Hashtable();
|
||||
LoginFlagsHash["daylight_savings"] = "N";
|
||||
LoginFlagsHash["stipend_since_login"] = "N";
|
||||
LoginFlagsHash["gendered"] = "Y";
|
||||
LoginFlagsHash["ever_logged_in"] = "Y";
|
||||
ArrayList LoginFlags = new ArrayList();
|
||||
LoginFlags.Add(LoginFlagsHash);
|
||||
|
||||
Hashtable GlobalT = new Hashtable();
|
||||
GlobalT["sun_texture_id"] = "cce0f112-878f-4586-a2e2-a8f104bba271";
|
||||
GlobalT["cloud_texture_id"] = "fc4b9f0b-d008-45c6-96a4-01dd947ac621";
|
||||
GlobalT["moon_texture_id"] = "fc4b9f0b-d008-45c6-96a4-01dd947ac621";
|
||||
ArrayList GlobalTextures = new ArrayList();
|
||||
GlobalTextures.Add(GlobalT);
|
||||
|
||||
XmlRpcResponse response = (XmlRpcResponse)(new XmlRpcResponseDeserializer()).Deserialize(this._defaultResponse);
|
||||
Hashtable responseData = (Hashtable)response.Value;
|
||||
|
||||
responseData["sim_port"] = OpenSim_Main.cfg.IPListenPort;
|
||||
responseData["sim_ip"] = OpenSim_Main.cfg.IPListenAddr;
|
||||
responseData["agent_id"] = Agent.ToStringHyphenated();
|
||||
responseData["session_id"] = Session.ToStringHyphenated();
|
||||
responseData["seconds_since_epoch"] = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
|
||||
responseData["login-flags"] = LoginFlags;
|
||||
responseData["global-textures"] = GlobalTextures;
|
||||
|
||||
//inventory
|
||||
ArrayList InventoryList = (ArrayList)responseData["inventory-skeleton"];
|
||||
Hashtable Inventory1 = (Hashtable)InventoryList[0];
|
||||
Hashtable Inventory2 = (Hashtable)InventoryList[1];
|
||||
LLUUID BaseFolderID = LLUUID.Random();
|
||||
LLUUID InventoryFolderID = LLUUID.Random();
|
||||
Inventory2["name"] = "Base";
|
||||
Inventory2["folder_id"] = BaseFolderID.ToStringHyphenated();
|
||||
Inventory2["type_default"] = 6;
|
||||
Inventory1["folder_id"] = InventoryFolderID.ToStringHyphenated();
|
||||
|
||||
ArrayList InventoryRoot = (ArrayList)responseData["inventory-root"];
|
||||
Hashtable Inventoryroot = (Hashtable)InventoryRoot[0];
|
||||
Inventoryroot["folder_id"] = InventoryFolderID.ToStringHyphenated();
|
||||
|
||||
CustomiseLoginResponse(responseData, first, last);
|
||||
|
||||
this._login = new Login();
|
||||
//copy data to login object
|
||||
_login.First = first;
|
||||
_login.Last = last;
|
||||
_login.Agent = Agent;
|
||||
_login.Session = Session;
|
||||
_login.BaseFolder = BaseFolderID;
|
||||
_login.InventoryFolder = InventoryFolderID;
|
||||
|
||||
//working on local computer if so lets add to the gridserver's list of sessions?
|
||||
if (OpenSim_Main.gridServers.GridServer.GetName() == "Local")
|
||||
{
|
||||
((LocalGridBase)this._gridServer).AddNewSession(_login);
|
||||
}
|
||||
|
||||
// forward the XML-RPC response to the client
|
||||
writer.WriteLine("HTTP/1.0 200 OK");
|
||||
writer.WriteLine("Content-type: text/xml");
|
||||
writer.WriteLine();
|
||||
|
||||
XmlTextWriter responseWriter = new XmlTextWriter(writer);
|
||||
XmlRpcResponseSerializer.Singleton.Serialize(responseWriter, response);
|
||||
responseWriter.Close();
|
||||
first = (string)requestData["first"];
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.WriteLine("HTTP/1.0 403 Authentication Forbidden");
|
||||
writer.WriteLine();
|
||||
first = "test";
|
||||
}
|
||||
|
||||
if (requestData.Contains("last"))
|
||||
{
|
||||
last = (string)requestData["last"];
|
||||
}
|
||||
else
|
||||
{
|
||||
last = "User" + NumClients.ToString();
|
||||
}
|
||||
|
||||
if (requestData.Contains("passwd"))
|
||||
{
|
||||
passwd = (string)requestData["passwd"];
|
||||
}
|
||||
else
|
||||
{
|
||||
passwd = "notfound";
|
||||
}
|
||||
|
||||
if (!Authenticate(first, last, passwd))
|
||||
{
|
||||
XmlRpcResponse PresenceErrorResp = new XmlRpcResponse();
|
||||
Hashtable PresenceErrorRespData = new Hashtable();
|
||||
PresenceErrorRespData["reason"] = "key"; ;
|
||||
PresenceErrorRespData["message"] = "You have entered an invalid name/password combination. Check Caps/lock.";
|
||||
PresenceErrorRespData["login"] = "false";
|
||||
PresenceErrorResp.Value = PresenceErrorRespData;
|
||||
string reply = Regex.Replace(XmlRpcResponseSerializer.Singleton.Serialize(PresenceErrorResp), " encoding=\"utf-16\"", "");
|
||||
writer.WriteLine("HTTP/1.0 200 OK");
|
||||
writer.WriteLine("Content-type: text/xml");
|
||||
writer.WriteLine();
|
||||
writer.WriteLine(reply);
|
||||
return false;
|
||||
}
|
||||
|
||||
NumClients++;
|
||||
|
||||
//create a agent and session LLUUID
|
||||
Agent = GetAgentId(first, last);
|
||||
int SessionRand = Util.RandomClass.Next(1, 999);
|
||||
Session = new LLUUID("aaaabbbb-0200-" + SessionRand.ToString("0000") + "-8664-58f53e442797");
|
||||
|
||||
//create some login info
|
||||
Hashtable LoginFlagsHash = new Hashtable();
|
||||
LoginFlagsHash["daylight_savings"] = "N";
|
||||
LoginFlagsHash["stipend_since_login"] = "N";
|
||||
LoginFlagsHash["gendered"] = "Y";
|
||||
LoginFlagsHash["ever_logged_in"] = "Y";
|
||||
ArrayList LoginFlags = new ArrayList();
|
||||
LoginFlags.Add(LoginFlagsHash);
|
||||
|
||||
Hashtable GlobalT = new Hashtable();
|
||||
GlobalT["sun_texture_id"] = "cce0f112-878f-4586-a2e2-a8f104bba271";
|
||||
GlobalT["cloud_texture_id"] = "fc4b9f0b-d008-45c6-96a4-01dd947ac621";
|
||||
GlobalT["moon_texture_id"] = "fc4b9f0b-d008-45c6-96a4-01dd947ac621";
|
||||
ArrayList GlobalTextures = new ArrayList();
|
||||
GlobalTextures.Add(GlobalT);
|
||||
|
||||
XmlRpcResponse response = (XmlRpcResponse)(new XmlRpcResponseDeserializer()).Deserialize(this._defaultResponse);
|
||||
Hashtable responseData = (Hashtable)response.Value;
|
||||
|
||||
responseData["sim_port"] = OpenSim_Main.Instance.Cfg.IPListenPort;
|
||||
responseData["sim_ip"] = OpenSim_Main.Instance.Cfg.IPListenAddr;
|
||||
responseData["agent_id"] = Agent.ToStringHyphenated();
|
||||
responseData["session_id"] = Session.ToStringHyphenated();
|
||||
responseData["seconds_since_epoch"] = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
|
||||
responseData["login-flags"] = LoginFlags;
|
||||
responseData["global-textures"] = GlobalTextures;
|
||||
|
||||
//inventory
|
||||
ArrayList InventoryList = (ArrayList)responseData["inventory-skeleton"];
|
||||
Hashtable Inventory1 = (Hashtable)InventoryList[0];
|
||||
Hashtable Inventory2 = (Hashtable)InventoryList[1];
|
||||
LLUUID BaseFolderID = LLUUID.Random();
|
||||
LLUUID InventoryFolderID = LLUUID.Random();
|
||||
Inventory2["name"] = "Base";
|
||||
Inventory2["folder_id"] = BaseFolderID.ToStringHyphenated();
|
||||
Inventory2["type_default"] = 6;
|
||||
Inventory1["folder_id"] = InventoryFolderID.ToStringHyphenated();
|
||||
|
||||
ArrayList InventoryRoot = (ArrayList)responseData["inventory-root"];
|
||||
Hashtable Inventoryroot = (Hashtable)InventoryRoot[0];
|
||||
Inventoryroot["folder_id"] = InventoryFolderID.ToStringHyphenated();
|
||||
|
||||
CustomiseLoginResponse(responseData, first, last);
|
||||
|
||||
Login _login = new Login();
|
||||
//copy data to login object
|
||||
_login.First = first;
|
||||
_login.Last = last;
|
||||
_login.Agent = Agent;
|
||||
_login.Session = Session;
|
||||
_login.BaseFolder = BaseFolderID;
|
||||
_login.InventoryFolder = InventoryFolderID;
|
||||
|
||||
//working on local computer if so lets add to the gridserver's list of sessions?
|
||||
if (OpenSim_Main.Instance.GridServers.GridServer.GetName() == "Local")
|
||||
{
|
||||
((LocalGridBase)this._gridServer).AddNewSession(_login);
|
||||
}
|
||||
|
||||
// forward the XML-RPC response to the client
|
||||
writer.WriteLine("HTTP/1.0 200 OK");
|
||||
writer.WriteLine("Content-type: text/xml");
|
||||
writer.WriteLine();
|
||||
|
||||
XmlTextWriter responseWriter = new XmlTextWriter(writer);
|
||||
XmlRpcResponseSerializer.Singleton.Serialize(responseWriter, response);
|
||||
responseWriter.Close();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -325,7 +348,7 @@ namespace OpenSim.Framework.LocalServers
|
|||
protected virtual LLUUID GetAgentId(string firstName, string lastName)
|
||||
{
|
||||
LLUUID Agent;
|
||||
int AgentRand = this.RandomClass.Next(1, 9999);
|
||||
int AgentRand = Util.RandomClass.Next(1, 9999);
|
||||
Agent = new LLUUID("99998888-0100-" + AgentRand.ToString("0000") + "-8ec1-0b1d5cd6aead");
|
||||
return Agent;
|
||||
}
|
||||
|
@ -365,6 +388,17 @@ namespace OpenSim.Framework.LocalServers
|
|||
return Regex.Replace(BitConverter.ToString(encodedBytes), "-", "").ToLower();
|
||||
}
|
||||
|
||||
public AgentInventory RequestAgentsInventory(LLUUID agentID)
|
||||
{
|
||||
AgentInventory aInventory = null;
|
||||
if (this.userAccounts)
|
||||
{
|
||||
aInventory = this.userManager.GetUsersInventory(agentID);
|
||||
}
|
||||
|
||||
return aInventory;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
178
src/Main.cs
178
src/Main.cs
|
@ -52,12 +52,23 @@ namespace OpenSim
|
|||
/// </summary>
|
||||
public class OpenSim_Main
|
||||
{
|
||||
public static OpenSim_Main sim;
|
||||
public static SimConfig cfg;
|
||||
public static World local_world;
|
||||
public static Grid gridServers;
|
||||
private static OpenSim_Main instance = null;
|
||||
|
||||
public static OpenSim_Main Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
|
||||
public World LocalWorld;
|
||||
public Grid GridServers;
|
||||
public SimConfig Cfg;
|
||||
public SimCAPSHTTPServer HttpServer;
|
||||
public AssetCache AssetCache;
|
||||
public InventoryManager InventoryCache;
|
||||
|
||||
public SimCAPSHTTPServer http_server;
|
||||
public Socket Server;
|
||||
private IPEndPoint ServerIncoming;
|
||||
private byte[] RecvBuffer = new byte[4096];
|
||||
|
@ -66,8 +77,6 @@ namespace OpenSim
|
|||
private EndPoint epSender;
|
||||
private AsyncCallback ReceivedData;
|
||||
|
||||
public AssetCache assetCache;
|
||||
public InventoryManager inventoryManager;
|
||||
public DateTime startuptime;
|
||||
public Dictionary<EndPoint, OpenSimClient> ClientThreads = new Dictionary<EndPoint, OpenSimClient>();
|
||||
private PhysicsManager physManager;
|
||||
|
@ -84,55 +93,55 @@ namespace OpenSim
|
|||
Console.WriteLine("Starting...\n");
|
||||
ServerConsole.MainConsole.Instance = new MServerConsole(ServerConsole.ConsoleBase.ConsoleType.Local, "", 0);
|
||||
|
||||
sim = new OpenSim_Main();
|
||||
instance = new OpenSim_Main();
|
||||
|
||||
sim.sandbox = false;
|
||||
sim.loginserver = false;
|
||||
sim._physicsEngine = "PhysX";
|
||||
Instance.sandbox = false;
|
||||
Instance.loginserver = false;
|
||||
Instance._physicsEngine = "PhysX";
|
||||
|
||||
for (int i = 0; i < args.Length; i++)
|
||||
{
|
||||
if (args[i] == "-sandbox")
|
||||
{
|
||||
sim.sandbox = true;
|
||||
Instance.sandbox = true;
|
||||
}
|
||||
|
||||
if (args[i] == "-loginserver")
|
||||
{
|
||||
sim.loginserver = true;
|
||||
Instance.loginserver = true;
|
||||
}
|
||||
if (args[i] == "-realphysx")
|
||||
{
|
||||
sim._physicsEngine = "RealPhysX";
|
||||
Instance._physicsEngine = "RealPhysX";
|
||||
OpenSim.world.Avatar.PhysicsEngineFlying = true;
|
||||
}
|
||||
}
|
||||
|
||||
OpenSim_Main.gridServers = new Grid();
|
||||
if (sim.sandbox)
|
||||
OpenSim_Main.Instance.GridServers = new Grid();
|
||||
if (Instance.sandbox)
|
||||
{
|
||||
OpenSim_Main.gridServers.AssetDll = "LocalGridServers.dll";
|
||||
OpenSim_Main.gridServers.GridDll = "LocalGridServers.dll";
|
||||
OpenSim_Main.gridServers.LoadPlugins();
|
||||
OpenSim_Main.Instance.GridServers.AssetDll = "LocalGridServers.dll";
|
||||
OpenSim_Main.Instance.GridServers.GridDll = "LocalGridServers.dll";
|
||||
OpenSim_Main.Instance.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();
|
||||
OpenSim_Main.Instance.GridServers.AssetDll = "RemoteGridServers.dll";
|
||||
OpenSim_Main.Instance.GridServers.GridDll = "RemoteGridServers.dll";
|
||||
OpenSim_Main.Instance.GridServers.LoadPlugins();
|
||||
ServerConsole.MainConsole.Instance.WriteLine("Starting in Grid mode");
|
||||
}
|
||||
|
||||
if (sim.loginserver && sim.sandbox)
|
||||
if (Instance.loginserver && Instance.sandbox)
|
||||
{
|
||||
LoginServer loginServer = new LoginServer(OpenSim_Main.gridServers.GridServer);
|
||||
LoginServer loginServer = new LoginServer(OpenSim_Main.Instance.GridServers.GridServer);
|
||||
loginServer.Startup();
|
||||
}
|
||||
sim.assetCache = new AssetCache(OpenSim_Main.gridServers.AssetServer);
|
||||
sim.inventoryManager = new InventoryManager();
|
||||
Instance.AssetCache = new AssetCache(OpenSim_Main.Instance.GridServers.AssetServer);
|
||||
Instance.InventoryCache = new InventoryManager();
|
||||
|
||||
sim.Startup();
|
||||
Instance.Startup();
|
||||
|
||||
while (true)
|
||||
{
|
||||
|
@ -150,41 +159,41 @@ namespace OpenSim
|
|||
|
||||
// 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();
|
||||
Cfg = this.LoadConfigDll(this.ConfigDll);
|
||||
Cfg.InitConfig(this.sandbox);
|
||||
ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Startup() - Contacting gridserver");
|
||||
cfg.LoadFromGrid();
|
||||
Cfg.LoadFromGrid();
|
||||
|
||||
ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Startup() - We are " + cfg.RegionName + " at " + cfg.RegionLocX.ToString() + "," + cfg.RegionLocY.ToString());
|
||||
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();
|
||||
Instance.LocalWorld = new World();
|
||||
Instance.LocalWorld.LandMap = 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(this._physicsEngine); //should be reading from the config file what physics engine to use
|
||||
local_world.PhysScene.SetTerrain(local_world.LandMap);
|
||||
Instance.LocalWorld.PhysScene = this.physManager.GetPhysicsScene(this._physicsEngine); //should be reading from the config file what physics engine to use
|
||||
Instance.LocalWorld.PhysScene.SetTerrain(Instance.LocalWorld.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);
|
||||
OpenSim_Main.Instance.GridServers.AssetServer.SetServerInfo(OpenSim_Main.Instance.Cfg.AssetURL, OpenSim_Main.Instance.Cfg.AssetSendKey);
|
||||
OpenSim_Main.Instance.GridServers.GridServer.SetServerInfo(OpenSim_Main.Instance.Cfg.GridURL, OpenSim_Main.Instance.Cfg.GridSendKey);
|
||||
|
||||
local_world.LoadStorageDLL("Db4LocalStorage.dll"); //all these dll names shouldn't be hard coded.
|
||||
local_world.LoadPrimsFromStorage();
|
||||
Instance.LocalWorld.LoadStorageDLL("Db4LocalStorage.dll"); //all these dll names shouldn't be hard coded.
|
||||
Instance.LocalWorld.LoadPrimsFromStorage();
|
||||
|
||||
if (this.sandbox)
|
||||
{
|
||||
this.assetCache.LoadDefaultTextureSet();
|
||||
this.AssetCache.LoadDefaultTextureSet();
|
||||
}
|
||||
|
||||
ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Startup() - Starting CAPS HTTP server");
|
||||
http_server = new SimCAPSHTTPServer();
|
||||
HttpServer = new SimCAPSHTTPServer();
|
||||
|
||||
timer1.Enabled = true;
|
||||
timer1.Interval = 100;
|
||||
timer1.Elapsed += new ElapsedEventHandler(this.Timer1Tick);
|
||||
|
||||
MainServerListener();
|
||||
|
||||
}
|
||||
|
||||
private SimConfig LoadConfigDll(string dllName)
|
||||
|
@ -244,9 +253,9 @@ namespace OpenSim
|
|||
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);
|
||||
ServerConsole.MainConsole.Instance.WriteLine("Main.cs:MainServerListener() - Opening UDP socket on " + Cfg.IPListenAddr + ":" + Cfg.IPListenPort);
|
||||
|
||||
ServerIncoming = new IPEndPoint(IPAddress.Any, cfg.IPListenPort);
|
||||
ServerIncoming = new IPEndPoint(IPAddress.Any, Cfg.IPListenPort);
|
||||
Server = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
|
||||
Server.Bind(ServerIncoming);
|
||||
|
||||
|
@ -268,8 +277,8 @@ namespace OpenSim
|
|||
ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Shutdown() - Killing clients");
|
||||
// IMPLEMENT THIS
|
||||
ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Shutdown() - Closing console and terminating");
|
||||
OpenSim_Main.local_world.Close();
|
||||
OpenSim_Main.gridServers.Close();
|
||||
OpenSim_Main.Instance.LocalWorld.Close();
|
||||
OpenSim_Main.Instance.GridServers.Close();
|
||||
ServerConsole.MainConsole.Instance.Close();
|
||||
Environment.Exit(0);
|
||||
}
|
||||
|
@ -277,86 +286,9 @@ namespace OpenSim
|
|||
void Timer1Tick(object sender, System.EventArgs e)
|
||||
{
|
||||
|
||||
local_world.Update();
|
||||
Instance.LocalWorld.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);
|
||||
}
|
||||
public void Close()
|
||||
{
|
||||
this.AssetServer.Close();
|
||||
this.GridServer.Close();
|
||||
}
|
||||
|
||||
private IAssetServer LoadAssetDll(string dllName)
|
||||
{
|
||||
Assembly pluginAssembly = Assembly.LoadFrom(dllName);
|
||||
IAssetServer server = null;
|
||||
|
||||
foreach (Type pluginType in pluginAssembly.GetTypes())
|
||||
{
|
||||
if (pluginType.IsPublic)
|
||||
{
|
||||
if (!pluginType.IsAbstract)
|
||||
{
|
||||
Type typeInterface = pluginType.GetInterface("IAssetPlugin", true);
|
||||
|
||||
if (typeInterface != null)
|
||||
{
|
||||
IAssetPlugin plug = (IAssetPlugin)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
|
||||
server = plug.GetAssetServer();
|
||||
break;
|
||||
}
|
||||
|
||||
typeInterface = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
pluginAssembly = null;
|
||||
return server;
|
||||
}
|
||||
|
||||
private IGridServer LoadGridDll(string dllName)
|
||||
{
|
||||
Assembly pluginAssembly = Assembly.LoadFrom(dllName);
|
||||
IGridServer server = null;
|
||||
|
||||
foreach (Type pluginType in pluginAssembly.GetTypes())
|
||||
{
|
||||
if (pluginType.IsPublic)
|
||||
{
|
||||
if (!pluginType.IsAbstract)
|
||||
{
|
||||
Type typeInterface = pluginType.GetInterface("IGridPlugin", true);
|
||||
|
||||
if (typeInterface != null)
|
||||
{
|
||||
IGridPlugin plug = (IGridPlugin)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
|
||||
server = plug.GetGridServer();
|
||||
break;
|
||||
}
|
||||
|
||||
typeInterface = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
pluginAssembly = null;
|
||||
return server;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -103,15 +103,15 @@ namespace OpenSim
|
|||
switch (Pack.Type)
|
||||
{
|
||||
case PacketType.CompleteAgentMovement:
|
||||
ClientAvatar.CompleteMovement(OpenSim_Main.local_world);
|
||||
ClientAvatar.CompleteMovement(OpenSim_Main.Instance.LocalWorld);
|
||||
ClientAvatar.SendInitialPosition();
|
||||
break;
|
||||
case PacketType.RegionHandshakeReply:
|
||||
OpenSim_Main.local_world.SendLayerData(this);
|
||||
OpenSim_Main.Instance.LocalWorld.SendLayerData(this);
|
||||
break;
|
||||
case PacketType.AgentWearablesRequest:
|
||||
ClientAvatar.SendInitialAppearance();
|
||||
foreach (OpenSimClient client in OpenSim_Main.sim.ClientThreads.Values)
|
||||
foreach (OpenSimClient client in OpenSim_Main.Instance.ClientThreads.Values)
|
||||
{
|
||||
if (client.AgentID != this.AgentID)
|
||||
{
|
||||
|
@ -120,10 +120,10 @@ namespace OpenSim
|
|||
client.ClientAvatar.SendAppearanceToOtherAgent(this);
|
||||
}
|
||||
}
|
||||
OpenSim_Main.local_world.GetInitialPrims(this);
|
||||
OpenSim_Main.Instance.LocalWorld.GetInitialPrims(this);
|
||||
break;
|
||||
case PacketType.ObjectAdd:
|
||||
OpenSim_Main.local_world.AddNewPrim((ObjectAddPacket)Pack, this);
|
||||
OpenSim_Main.Instance.LocalWorld.AddNewPrim((ObjectAddPacket)Pack, this);
|
||||
break;
|
||||
case PacketType.ObjectLink:
|
||||
ServerConsole.MainConsole.Instance.WriteLine(Pack.ToString());
|
||||
|
@ -135,7 +135,7 @@ namespace OpenSim
|
|||
ObjectShapePacket shape = (ObjectShapePacket)Pack;
|
||||
for (int i = 0; i < shape.ObjectData.Length; i++)
|
||||
{
|
||||
foreach (Entity ent in OpenSim_Main.local_world.Entities.Values)
|
||||
foreach (Entity ent in OpenSim_Main.Instance.LocalWorld.Entities.Values)
|
||||
{
|
||||
if (ent.localid == shape.ObjectData[i].ObjectLocalID)
|
||||
{
|
||||
|
@ -152,7 +152,7 @@ namespace OpenSim
|
|||
if (multipleupdate.ObjectData[i].Type == 9) //change position
|
||||
{
|
||||
libsecondlife.LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0);
|
||||
foreach (Entity ent in OpenSim_Main.local_world.Entities.Values)
|
||||
foreach (Entity ent in OpenSim_Main.Instance.LocalWorld.Entities.Values)
|
||||
{
|
||||
if (ent.localid == multipleupdate.ObjectData[i].ObjectLocalID)
|
||||
{
|
||||
|
@ -166,7 +166,7 @@ namespace OpenSim
|
|||
else if (multipleupdate.ObjectData[i].Type == 10)//rotation
|
||||
{
|
||||
libsecondlife.LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 0, true);
|
||||
foreach (Entity ent in OpenSim_Main.local_world.Entities.Values)
|
||||
foreach (Entity ent in OpenSim_Main.Instance.LocalWorld.Entities.Values)
|
||||
{
|
||||
if (ent.localid == multipleupdate.ObjectData[i].ObjectLocalID)
|
||||
{
|
||||
|
@ -179,7 +179,7 @@ namespace OpenSim
|
|||
{
|
||||
|
||||
libsecondlife.LLVector3 scale = new LLVector3(multipleupdate.ObjectData[i].Data, 12);
|
||||
foreach (Entity ent in OpenSim_Main.local_world.Entities.Values)
|
||||
foreach (Entity ent in OpenSim_Main.Instance.LocalWorld.Entities.Values)
|
||||
{
|
||||
if (ent.localid == multipleupdate.ObjectData[i].ObjectLocalID)
|
||||
{
|
||||
|
@ -193,13 +193,13 @@ namespace OpenSim
|
|||
RequestImagePacket imageRequest = (RequestImagePacket)Pack;
|
||||
for (int i = 0; i < imageRequest.RequestImage.Length; i++)
|
||||
{
|
||||
OpenSim_Main.sim.assetCache.AddTextureRequest(this, imageRequest.RequestImage[i].Image);
|
||||
OpenSim_Main.Instance.AssetCache.AddTextureRequest(this, imageRequest.RequestImage[i].Image);
|
||||
}
|
||||
break;
|
||||
case PacketType.TransferRequest:
|
||||
//Console.WriteLine("OpenSimClient.cs:ProcessInPacket() - Got transfer request");
|
||||
TransferRequestPacket transfer = (TransferRequestPacket)Pack;
|
||||
OpenSim_Main.sim.assetCache.AddAssetRequest(this, transfer);
|
||||
OpenSim_Main.Instance.AssetCache.AddAssetRequest(this, transfer);
|
||||
break;
|
||||
case PacketType.AgentUpdate:
|
||||
ClientAvatar.HandleUpdate((AgentUpdatePacket)Pack);
|
||||
|
@ -219,17 +219,17 @@ namespace OpenSim
|
|||
kill.ObjectData = new KillObjectPacket.ObjectDataBlock[1];
|
||||
kill.ObjectData[0] = new KillObjectPacket.ObjectDataBlock();
|
||||
kill.ObjectData[0].ID = this.ClientAvatar.localid;
|
||||
foreach (OpenSimClient client in OpenSim_Main.sim.ClientThreads.Values)
|
||||
foreach (OpenSimClient client in OpenSim_Main.Instance.ClientThreads.Values)
|
||||
{
|
||||
client.OutPacket(kill);
|
||||
}
|
||||
OpenSim_Main.gridServers.GridServer.LogoutSession(this.SessionID, this.AgentID, this.CircuitCode);
|
||||
lock (OpenSim_Main.local_world.Entities)
|
||||
OpenSim_Main.Instance.GridServers.GridServer.LogoutSession(this.SessionID, this.AgentID, this.CircuitCode);
|
||||
lock (OpenSim_Main.Instance.LocalWorld.Entities)
|
||||
{
|
||||
OpenSim_Main.local_world.Entities.Remove(this.AgentID);
|
||||
OpenSim_Main.Instance.LocalWorld.Entities.Remove(this.AgentID);
|
||||
}
|
||||
//need to do other cleaning up here too
|
||||
OpenSim_Main.sim.ClientThreads.Remove(this.userEP);
|
||||
OpenSim_Main.Instance.ClientThreads.Remove(this.userEP);
|
||||
this.ClientThread.Abort();
|
||||
break;
|
||||
case PacketType.ChatFromViewer:
|
||||
|
@ -246,7 +246,7 @@ namespace OpenSim
|
|||
reply.ChatData.FromName = _enc.GetBytes(this.ClientAvatar.firstname + " " + this.ClientAvatar.lastname + "\0");
|
||||
reply.ChatData.OwnerID = this.AgentID;
|
||||
reply.ChatData.SourceID = this.AgentID;
|
||||
foreach (OpenSimClient client in OpenSim_Main.sim.ClientThreads.Values)
|
||||
foreach (OpenSimClient client in OpenSim_Main.Instance.ClientThreads.Values)
|
||||
{
|
||||
client.OutPacket(reply);
|
||||
}
|
||||
|
@ -255,7 +255,7 @@ namespace OpenSim
|
|||
ObjectImagePacket imagePack = (ObjectImagePacket)Pack;
|
||||
for (int i = 0; i < imagePack.ObjectData.Length; i++)
|
||||
{
|
||||
foreach (Entity ent in OpenSim_Main.local_world.Entities.Values)
|
||||
foreach (Entity ent in OpenSim_Main.Instance.LocalWorld.Entities.Values)
|
||||
{
|
||||
if (ent.localid == imagePack.ObjectData[i].ObjectLocalID)
|
||||
{
|
||||
|
@ -266,7 +266,7 @@ namespace OpenSim
|
|||
break;
|
||||
case PacketType.ObjectFlagUpdate:
|
||||
ObjectFlagUpdatePacket flags = (ObjectFlagUpdatePacket)Pack;
|
||||
foreach (Entity ent in OpenSim_Main.local_world.Entities.Values)
|
||||
foreach (Entity ent in OpenSim_Main.Instance.LocalWorld.Entities.Values)
|
||||
{
|
||||
if (ent.localid == flags.AgentData.ObjectLocalID)
|
||||
{
|
||||
|
@ -321,11 +321,11 @@ namespace OpenSim
|
|||
case PacketType.FetchInventory:
|
||||
Console.WriteLine("fetch item packet");
|
||||
FetchInventoryPacket FetchInventory = (FetchInventoryPacket)Pack;
|
||||
OpenSim_Main.sim.inventoryManager.FetchInventory(this, FetchInventory);
|
||||
OpenSim_Main.Instance.InventoryCache.FetchInventory(this, FetchInventory);
|
||||
break;
|
||||
case PacketType.FetchInventoryDescendents:
|
||||
FetchInventoryDescendentsPacket Fetch = (FetchInventoryDescendentsPacket)Pack;
|
||||
OpenSim_Main.sim.inventoryManager.FetchInventoryDescendents(this, Fetch);
|
||||
OpenSim_Main.Instance.InventoryCache.FetchInventoryDescendents(this, Fetch);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -464,11 +464,11 @@ namespace OpenSim
|
|||
if (Pack.Header.Zerocoded)
|
||||
{
|
||||
int packetsize = Helpers.ZeroEncode(sendbuffer, sendbuffer.Length, ZeroOutBuffer);
|
||||
OpenSim_Main.sim.Server.SendTo(ZeroOutBuffer, packetsize, SocketFlags.None, userEP);
|
||||
OpenSim_Main.Instance.Server.SendTo(ZeroOutBuffer, packetsize, SocketFlags.None, userEP);
|
||||
}
|
||||
else
|
||||
{
|
||||
OpenSim_Main.sim.Server.SendTo(sendbuffer, sendbuffer.Length, SocketFlags.None, userEP);
|
||||
OpenSim_Main.Instance.Server.SendTo(sendbuffer, sendbuffer.Length, SocketFlags.None, userEP);
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
|
@ -569,14 +569,14 @@ namespace OpenSim
|
|||
private void InitNewClient()
|
||||
{
|
||||
ServerConsole.MainConsole.Instance.WriteLine("OpenSimClient.cs:InitNewClient() - Adding viewer agent to world");
|
||||
OpenSim_Main.local_world.AddViewerAgent(this);
|
||||
world.Entity tempent = OpenSim_Main.local_world.Entities[this.AgentID];
|
||||
OpenSim_Main.Instance.LocalWorld.AddViewerAgent(this);
|
||||
world.Entity tempent = OpenSim_Main.Instance.LocalWorld.Entities[this.AgentID];
|
||||
this.ClientAvatar = (world.Avatar)tempent;
|
||||
}
|
||||
|
||||
private void AuthUser()
|
||||
{
|
||||
AuthenticateResponse sessionInfo = OpenSim_Main.gridServers.GridServer.AuthenticateSession(cirpack.CircuitCode.SessionID, cirpack.CircuitCode.ID, cirpack.CircuitCode.Code);
|
||||
AuthenticateResponse sessionInfo = OpenSim_Main.Instance.GridServers.GridServer.AuthenticateSession(cirpack.CircuitCode.SessionID, cirpack.CircuitCode.ID, cirpack.CircuitCode.Code);
|
||||
if (!sessionInfo.Authorised)
|
||||
{
|
||||
//session/circuit not authorised
|
||||
|
@ -595,16 +595,16 @@ namespace OpenSim
|
|||
this.ClientAvatar.lastname = sessionInfo.LoginInfo.Last;
|
||||
|
||||
// Create Inventory, currently only works for sandbox mode
|
||||
if (OpenSim_Main.sim.sandbox)
|
||||
if (OpenSim_Main.Instance.sandbox)
|
||||
{
|
||||
if (sessionInfo.LoginInfo.InventoryFolder != null)
|
||||
{
|
||||
this.CreateInventory(sessionInfo.LoginInfo.InventoryFolder);
|
||||
if (sessionInfo.LoginInfo.BaseFolder != null)
|
||||
{
|
||||
OpenSim_Main.sim.inventoryManager.CreateNewInventoryFolder(this, sessionInfo.LoginInfo.BaseFolder);
|
||||
OpenSim_Main.Instance.InventoryCache.CreateNewInventoryFolder(this, sessionInfo.LoginInfo.BaseFolder);
|
||||
this.newAssetFolder = sessionInfo.LoginInfo.BaseFolder;
|
||||
AssetBase[] inventorySet = OpenSim_Main.sim.assetCache.CreateNewInventorySet(this.AgentID);
|
||||
AssetBase[] inventorySet = OpenSim_Main.Instance.AssetCache.CreateNewInventorySet(this.AgentID);
|
||||
if (inventorySet != null)
|
||||
{
|
||||
for (int i = 0; i < inventorySet.Length; i++)
|
||||
|
@ -612,7 +612,7 @@ namespace OpenSim
|
|||
if (inventorySet[i] != null)
|
||||
{
|
||||
Console.WriteLine(Helpers.FieldToString(inventorySet[i].Data));
|
||||
OpenSim_Main.sim.inventoryManager.AddNewInventoryItem(this, sessionInfo.LoginInfo.BaseFolder, inventorySet[i]);
|
||||
OpenSim_Main.Instance.InventoryCache.AddNewInventoryItem(this, sessionInfo.LoginInfo.BaseFolder, inventorySet[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -628,8 +628,8 @@ namespace OpenSim
|
|||
{
|
||||
AgentInventory inventory = new AgentInventory();
|
||||
inventory.AgentID = this.AgentID;
|
||||
OpenSim_Main.sim.inventoryManager.AddNewAgentsInventory(inventory);
|
||||
OpenSim_Main.sim.inventoryManager.CreateNewInventoryFolder(this, baseFolder);
|
||||
OpenSim_Main.Instance.InventoryCache.AddNewAgentsInventory(inventory);
|
||||
OpenSim_Main.Instance.InventoryCache.CreateNewInventoryFolder(this, baseFolder);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -156,7 +156,7 @@ namespace OpenSim
|
|||
break;
|
||||
|
||||
case "regenerate":
|
||||
OpenSim_Main.local_world.RegenerateTerrain();
|
||||
OpenSim_Main.Instance.LocalWorld.RegenerateTerrain();
|
||||
break;
|
||||
|
||||
case "shutdown":
|
||||
|
@ -170,16 +170,16 @@ namespace OpenSim
|
|||
public override void ShowCommands(string ShowWhat) {
|
||||
switch(ShowWhat) {
|
||||
case "uptime":
|
||||
this.WriteLine("OpenSim has been running since " + OpenSim_Main.sim.startuptime.ToString());
|
||||
this.WriteLine("That is " + (DateTime.Now-OpenSim_Main.sim.startuptime).ToString());
|
||||
this.WriteLine("OpenSim has been running since " + OpenSim_Main.Instance.startuptime.ToString());
|
||||
this.WriteLine("That is " + (DateTime.Now-OpenSim_Main.Instance.startuptime).ToString());
|
||||
break;
|
||||
case "users":
|
||||
OpenSim.world.Avatar TempAv;
|
||||
this.WriteLine(String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16}{5,-16}","Firstname", "Lastname","Agent ID", "Session ID", "Circuit", "IP"));
|
||||
foreach (libsecondlife.LLUUID UUID in OpenSim_Main.local_world.Entities.Keys) {
|
||||
if(OpenSim_Main.local_world.Entities[UUID].ToString()== "OpenSim.world.Avatar")
|
||||
foreach (libsecondlife.LLUUID UUID in OpenSim_Main.Instance.LocalWorld.Entities.Keys) {
|
||||
if(OpenSim_Main.Instance.LocalWorld.Entities[UUID].ToString()== "OpenSim.world.Avatar")
|
||||
{
|
||||
TempAv=(OpenSim.world.Avatar)OpenSim_Main.local_world.Entities[UUID];
|
||||
TempAv=(OpenSim.world.Avatar)OpenSim_Main.Instance.LocalWorld.Entities[UUID];
|
||||
this.WriteLine(String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16},{5,-16}",TempAv.firstname, TempAv.lastname,UUID, TempAv.ControllingClient.SessionID, TempAv.ControllingClient.CircuitCode, TempAv.ControllingClient.userEP.ToString()));
|
||||
}
|
||||
}
|
||||
|
@ -190,7 +190,7 @@ namespace OpenSim
|
|||
// Displays a prompt to the user and then runs the command they entered
|
||||
public override void MainConsolePrompt() {
|
||||
string[] tempstrarray;
|
||||
string tempstr = this.CmdPrompt("OpenSim-" + OpenSim_Main.cfg.RegionHandle.ToString() + " # ");
|
||||
string tempstr = this.CmdPrompt("OpenSim-" + OpenSim_Main.Instance.Cfg.RegionHandle.ToString() + " # ");
|
||||
tempstrarray = tempstr.Split(' ');
|
||||
string cmd=tempstrarray[0];
|
||||
Array.Reverse(tempstrarray);
|
||||
|
|
|
@ -57,7 +57,7 @@
|
|||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Assets\InventoryManager.cs" />
|
||||
<Compile Include="Config.cs" />
|
||||
<Compile Include="Grid.cs" />
|
||||
<Compile Include="GridServers\LocalUserProfileManager.cs" />
|
||||
<Compile Include="Main.cs" />
|
||||
<Compile Include="OpenSimClient.cs" />
|
||||
|
@ -73,20 +73,11 @@
|
|||
<Compile Include="GridServers\LoginServer.cs" />
|
||||
<Compile Include="Assets\AssetCache.cs" />
|
||||
<Compile Include="OpenSimConsole.cs" />
|
||||
<Compile Include="HeightMapGenHills.cs" />
|
||||
<Compile Include="VersionInfo.cs" />
|
||||
<Compile Include="CAPS\SimHttp.cs">
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="LocalServers\LocalGridServers\LocalGridServers.csproj">
|
||||
<Project>{D7F0395B-FADC-4936-80A0-D95AACE92F62}</Project>
|
||||
<Name>LocalGridServers</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="LocalStorage\Db4LocalStorage\Db4LocalStorage.csproj">
|
||||
<Project>{74784F23-B0FD-484C-82C1-96C0215733DC}</Project>
|
||||
<Name>Db4LocalStorage</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\OpenSim.FrameWork\OpenSim.Framework.csproj">
|
||||
<Project>{2E46A825-3168-492F-93BC-637126B5B72B}</Project>
|
||||
<Name>OpenSim.Framework</Name>
|
||||
|
@ -95,10 +86,6 @@
|
|||
<Project>{3C86A846-7977-4EE7-A8DC-DD487FA5DC2B}</Project>
|
||||
<Name>PhysicsManager</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="RemoteServers\RemoteGridServers\RemoteGridServers.csproj">
|
||||
<Project>{CF0E7E62-34F4-4AB2-BDBD-AFC63224A7E5}</Project>
|
||||
<Name>RemoteGridServers</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="ServerConsole\ServerConsole\ServerConsole.csproj">
|
||||
<Project>{C9A6026D-8E0C-4FE4-8691-FB2A566AA245}</Project>
|
||||
<Name>ServerConsole</Name>
|
||||
|
|
88
src/Util.cs
88
src/Util.cs
|
@ -1,88 +0,0 @@
|
|||
/*
|
||||
Copyright (c) OpenSim project, http://osgrid.org/
|
||||
|
||||
* Copyright (c) <year>, <copyright holder>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the <organization> nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using libsecondlife;
|
||||
using libsecondlife.Packets;
|
||||
|
||||
namespace OpenSim
|
||||
{
|
||||
/// <summary>
|
||||
/// </summary>
|
||||
///
|
||||
public class Util
|
||||
{
|
||||
public static ulong UIntsToLong(uint X, uint Y)
|
||||
{
|
||||
return Helpers.UIntsToLong(X, Y);
|
||||
}
|
||||
public Util()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public class QueItem
|
||||
{
|
||||
public QueItem()
|
||||
{
|
||||
}
|
||||
|
||||
public Packet Packet;
|
||||
public bool Incoming;
|
||||
}
|
||||
|
||||
public class BlockingQueue<T>
|
||||
{
|
||||
private Queue<T> _queue = new Queue<T>();
|
||||
private object _queueSync = new object();
|
||||
|
||||
public void Enqueue(T value)
|
||||
{
|
||||
lock (_queueSync)
|
||||
{
|
||||
_queue.Enqueue(value);
|
||||
Monitor.Pulse(_queueSync);
|
||||
}
|
||||
}
|
||||
|
||||
public T Dequeue()
|
||||
{
|
||||
lock (_queueSync)
|
||||
{
|
||||
if (_queue.Count < 1)
|
||||
Monitor.Wait(_queueSync);
|
||||
|
||||
return _queue.Dequeue();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -27,9 +27,9 @@ namespace OpenSim.world
|
|||
{
|
||||
ServerConsole.MainConsole.Instance.WriteLine("Avatar.cs - Loading details from grid (DUMMY)");
|
||||
ControllingClient = TheClient;
|
||||
localid = 8880000 + (OpenSim_Main.local_world._localNumber++);
|
||||
localid = 8880000 + (OpenSim_Main.Instance.LocalWorld._localNumber++);
|
||||
position = new LLVector3(100.0f, 100.0f, 30.0f);
|
||||
position.Z = OpenSim_Main.local_world.LandMap[(int)position.Y * 256 + (int)position.X] + 1;
|
||||
position.Z = OpenSim_Main.Instance.LocalWorld.LandMap[(int)position.Y * 256 + (int)position.X] + 1;
|
||||
}
|
||||
|
||||
public PhysicsActor PhysActor
|
||||
|
@ -73,11 +73,11 @@ namespace OpenSim.world
|
|||
//use CreateTerseBlock()
|
||||
ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock = CreateTerseBlock();
|
||||
ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket();
|
||||
terse.RegionData.RegionHandle = OpenSim_Main.cfg.RegionHandle; // FIXME
|
||||
terse.RegionData.RegionHandle = OpenSim_Main.Instance.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)
|
||||
foreach (OpenSimClient client in OpenSim_Main.Instance.ClientThreads.Values)
|
||||
{
|
||||
client.OutPacket(terse);
|
||||
}
|
||||
|
@ -95,11 +95,11 @@ namespace OpenSim.world
|
|||
//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.RegionHandle = OpenSim_Main.Instance.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)
|
||||
foreach (OpenSimClient client in OpenSim_Main.Instance.ClientThreads.Values)
|
||||
{
|
||||
client.OutPacket(terse);
|
||||
}
|
||||
|
@ -141,7 +141,7 @@ namespace OpenSim.world
|
|||
AgentMovementCompletePacket mov = new AgentMovementCompletePacket();
|
||||
mov.AgentData.SessionID = this.ControllingClient.SessionID;
|
||||
mov.AgentData.AgentID = this.ControllingClient.AgentID;
|
||||
mov.Data.RegionHandle = OpenSim_Main.cfg.RegionHandle;
|
||||
mov.Data.RegionHandle = OpenSim_Main.Instance.Cfg.RegionHandle;
|
||||
// TODO - dynamicalise this stuff
|
||||
mov.Data.Timestamp = 1172750370;
|
||||
mov.Data.Position = new LLVector3(100f, 100f, 23f);
|
||||
|
@ -156,7 +156,7 @@ namespace OpenSim.world
|
|||
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.RegionHandle = OpenSim_Main.Instance.Cfg.RegionHandle;
|
||||
objupdate.RegionData.TimeDilation = 64096;
|
||||
objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1];
|
||||
|
||||
|
@ -171,9 +171,9 @@ namespace OpenSim.world
|
|||
byte[] pb = pos2.GetBytes();
|
||||
|
||||
Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 16, pb.Length);
|
||||
OpenSim_Main.local_world._localNumber++;
|
||||
OpenSim_Main.Instance.LocalWorld._localNumber++;
|
||||
|
||||
foreach (OpenSimClient client in OpenSim_Main.sim.ClientThreads.Values)
|
||||
foreach (OpenSimClient client in OpenSim_Main.Instance.ClientThreads.Values)
|
||||
{
|
||||
client.OutPacket(objupdate);
|
||||
if (client.AgentID != ControllingClient.AgentID)
|
||||
|
@ -215,7 +215,7 @@ namespace OpenSim.world
|
|||
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.RegionHandle = OpenSim_Main.Instance.Cfg.RegionHandle;
|
||||
objupdate.RegionData.TimeDilation = 64096;
|
||||
objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1];
|
||||
|
||||
|
@ -394,7 +394,7 @@ namespace OpenSim.world
|
|||
handshake.RegionInfo.SimAccess = 13;
|
||||
handshake.RegionInfo.WaterHeight = 20;
|
||||
handshake.RegionInfo.RegionFlags = 72458694;
|
||||
handshake.RegionInfo.SimName = _enc.GetBytes(OpenSim_Main.cfg.RegionName + "\0");
|
||||
handshake.RegionInfo.SimName = _enc.GetBytes(OpenSim_Main.Instance.Cfg.RegionName + "\0");
|
||||
handshake.RegionInfo.SimOwner = new LLUUID("00000000-0000-0000-0000-000000000000");
|
||||
handshake.RegionInfo.TerrainBase0 = new LLUUID("b8d3965a-ad78-bf43-699b-bff8eca6c975");
|
||||
handshake.RegionInfo.TerrainBase1 = new LLUUID("abb783e6-3e93-26c0-248a-247666855da3");
|
||||
|
|
|
@ -99,7 +99,7 @@ namespace OpenSim.world
|
|||
{
|
||||
if (this.newPrimFlag)
|
||||
{
|
||||
foreach (OpenSimClient client in OpenSim_Main.sim.ClientThreads.Values)
|
||||
foreach (OpenSimClient client in OpenSim_Main.Instance.ClientThreads.Values)
|
||||
{
|
||||
client.OutPacket(OurPacket);
|
||||
}
|
||||
|
@ -108,11 +108,11 @@ namespace OpenSim.world
|
|||
else if (this.updateFlag)
|
||||
{
|
||||
ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket();
|
||||
terse.RegionData.RegionHandle = OpenSim_Main.cfg.RegionHandle; // FIXME
|
||||
terse.RegionData.RegionHandle = OpenSim_Main.Instance.Cfg.RegionHandle; // FIXME
|
||||
terse.RegionData.TimeDilation = 64096;
|
||||
terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1];
|
||||
terse.ObjectData[0] = this.CreateImprovedBlock();
|
||||
foreach (OpenSimClient client in OpenSim_Main.sim.ClientThreads.Values)
|
||||
foreach (OpenSimClient client in OpenSim_Main.Instance.ClientThreads.Values)
|
||||
{
|
||||
client.OutPacket(terse);
|
||||
}
|
||||
|
@ -120,7 +120,7 @@ namespace OpenSim.world
|
|||
}
|
||||
else if (this.dirtyFlag)
|
||||
{
|
||||
foreach (OpenSimClient client in OpenSim_Main.sim.ClientThreads.Values)
|
||||
foreach (OpenSimClient client in OpenSim_Main.Instance.ClientThreads.Values)
|
||||
{
|
||||
UpdateClient(client);
|
||||
}
|
||||
|
@ -131,11 +131,11 @@ namespace OpenSim.world
|
|||
if (this._physActor != null && this.physicsEnabled)
|
||||
{
|
||||
ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket();
|
||||
terse.RegionData.RegionHandle = OpenSim_Main.cfg.RegionHandle; // FIXME
|
||||
terse.RegionData.RegionHandle = OpenSim_Main.Instance.Cfg.RegionHandle; // FIXME
|
||||
terse.RegionData.TimeDilation = 64096;
|
||||
terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1];
|
||||
terse.ObjectData[0] = this.CreateImprovedBlock();
|
||||
foreach (OpenSimClient client in OpenSim_Main.sim.ClientThreads.Values)
|
||||
foreach (OpenSimClient client in OpenSim_Main.Instance.ClientThreads.Values)
|
||||
{
|
||||
client.OutPacket(terse);
|
||||
}
|
||||
|
@ -254,7 +254,7 @@ namespace OpenSim.world
|
|||
public void CreateFromPacket(ObjectAddPacket addPacket, LLUUID agentID, uint localID)
|
||||
{
|
||||
ObjectUpdatePacket objupdate = new ObjectUpdatePacket();
|
||||
objupdate.RegionData.RegionHandle = OpenSim_Main.cfg.RegionHandle;
|
||||
objupdate.RegionData.RegionHandle = OpenSim_Main.Instance.Cfg.RegionHandle;
|
||||
objupdate.RegionData.TimeDilation = 64096;
|
||||
|
||||
objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1];
|
||||
|
@ -301,8 +301,6 @@ namespace OpenSim.world
|
|||
PData.PathTwist = objupdate.ObjectData[0].PathTwist = addPacket.ObjectData.PathTwist;
|
||||
PData.PathTwistBegin = objupdate.ObjectData[0].PathTwistBegin = addPacket.ObjectData.PathTwistBegin;
|
||||
|
||||
//finish off copying rest of shape data
|
||||
|
||||
objupdate.ObjectData[0].ID = (uint)(localID);
|
||||
objupdate.ObjectData[0].FullID = new LLUUID("edba7151-5857-acc5-b30b-f01efef" + (localID - 702000).ToString("00000"));
|
||||
objupdate.ObjectData[0].ObjectData = new byte[60];
|
||||
|
@ -324,7 +322,7 @@ namespace OpenSim.world
|
|||
{
|
||||
//need to clean this up as it shares a lot of code with CreateFromPacket()
|
||||
ObjectUpdatePacket objupdate = new ObjectUpdatePacket();
|
||||
objupdate.RegionData.RegionHandle = OpenSim_Main.cfg.RegionHandle;
|
||||
objupdate.RegionData.RegionHandle = OpenSim_Main.Instance.Cfg.RegionHandle;
|
||||
objupdate.RegionData.TimeDilation = 64096;
|
||||
objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1];
|
||||
|
||||
|
@ -476,12 +474,11 @@ namespace OpenSim.world
|
|||
|
||||
public override void BackUp()
|
||||
{
|
||||
|
||||
this.primData.FullID = this.uuid;
|
||||
this.primData.LocalID = this.localid;
|
||||
this.primData.Position = this.position;
|
||||
this.primData.Rotation = new LLQuaternion(this.rotation.x, this.rotation.y, this.rotation.z, this.rotation.w);
|
||||
OpenSim_Main.local_world.localStorage.StorePrim(this.primData);
|
||||
OpenSim_Main.Instance.LocalWorld.localStorage.StorePrim(this.primData);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@ using System.IO;
|
|||
using PhysicsSystem;
|
||||
using OpenSim.Framework.Interfaces;
|
||||
using OpenSim.Framework.Assets;
|
||||
using OpenSim.Framework.Terrain;
|
||||
|
||||
namespace OpenSim.world
|
||||
{
|
||||
|
@ -113,9 +114,9 @@ namespace OpenSim.world
|
|||
HeightmapGenHills hills = new HeightmapGenHills();
|
||||
this.LandMap = hills.GenerateHeightmap(200, 4.0f, 80.0f, false);
|
||||
this.phyScene.SetTerrain(this.LandMap);
|
||||
OpenSim_Main.cfg.SaveMap();
|
||||
OpenSim_Main.Instance.Cfg.SaveMap(this.LandMap);
|
||||
|
||||
foreach(OpenSimClient client in OpenSim_Main.sim.ClientThreads.Values) {
|
||||
foreach(OpenSimClient client in OpenSim_Main.Instance.ClientThreads.Values) {
|
||||
this.SendLayerData(client);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue