Set up parcel manager and the master avatar in SimpleApp.
parent
0bb2b7f18d
commit
5a909a2054
|
@ -8,13 +8,12 @@ using OpenSim.Framework.Types;
|
||||||
using OpenSim.Region.Caches;
|
using OpenSim.Region.Caches;
|
||||||
using OpenSim.Region.Environment.Scenes;
|
using OpenSim.Region.Environment.Scenes;
|
||||||
using OpenSim.Region.Terrain;
|
using OpenSim.Region.Terrain;
|
||||||
using Avatar=OpenSim.Region.Environment.Scenes.ScenePresence;
|
using Avatar = OpenSim.Region.Environment.Scenes.ScenePresence;
|
||||||
|
|
||||||
namespace SimpleApp
|
namespace SimpleApp
|
||||||
{
|
{
|
||||||
public class MyWorld : Scene
|
public class MyWorld : Scene
|
||||||
{
|
{
|
||||||
private bool firstlogin = true;
|
|
||||||
private List<ScenePresence> m_avatars;
|
private List<ScenePresence> m_avatars;
|
||||||
|
|
||||||
public MyWorld(ClientManager clientManager, RegionInfo regionInfo, AuthenticateSessionsBase authen, CommunicationsManager commsMan, AssetCache assetCach, BaseHttpServer httpServer)
|
public MyWorld(ClientManager clientManager, RegionInfo regionInfo, AuthenticateSessionsBase authen, CommunicationsManager commsMan, AssetCache assetCach, BaseHttpServer httpServer)
|
||||||
|
@ -58,53 +57,46 @@ namespace SimpleApp
|
||||||
#region IWorld Members
|
#region IWorld Members
|
||||||
|
|
||||||
override public void AddNewClient(IClientAPI client, bool child)
|
override public void AddNewClient(IClientAPI client, bool child)
|
||||||
|
|
||||||
{
|
{
|
||||||
NewLoggin();
|
|
||||||
|
|
||||||
LLVector3 pos = new LLVector3(128, 128, 128);
|
LLVector3 pos = new LLVector3(128, 128, 128);
|
||||||
|
|
||||||
client.OnRegionHandShakeReply += SendLayerData;
|
client.OnRegionHandShakeReply += SendLayerData;
|
||||||
client.OnChatFromViewer +=
|
client.OnChatFromViewer +=
|
||||||
delegate(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID)
|
delegate(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID)
|
||||||
{
|
{
|
||||||
// Echo it (so you know what you typed)
|
// Echo it (so you know what you typed)
|
||||||
client.SendChatMessage(message, type, fromPos, fromName, fromAgentID);
|
client.SendChatMessage(message, type, fromPos, fromName, fromAgentID);
|
||||||
client.SendChatMessage("Ready.", 1, pos, "System", LLUUID.Zero );
|
client.SendChatMessage("Ready.", 1, pos, "System", LLUUID.Zero);
|
||||||
};
|
};
|
||||||
|
|
||||||
client.OnAddPrim += AddNewPrim;
|
client.OnAddPrim += AddNewPrim;
|
||||||
client.OnUpdatePrimGroupPosition += this.UpdatePrimPosition;
|
client.OnUpdatePrimGroupPosition += this.UpdatePrimPosition;
|
||||||
client.OnRequestMapBlocks += this.RequestMapBlocks;
|
client.OnRequestMapBlocks += this.RequestMapBlocks;
|
||||||
client.OnTeleportLocationRequest += this.RequestTeleportLocation;
|
client.OnTeleportLocationRequest += this.RequestTeleportLocation;
|
||||||
client.OnGrapUpdate += this.MoveObject;
|
client.OnGrapUpdate += this.MoveObject;
|
||||||
client.OnNameFromUUIDRequest += this.commsManager.HandleUUIDNameRequest;
|
client.OnNameFromUUIDRequest += this.commsManager.HandleUUIDNameRequest;
|
||||||
|
|
||||||
client.OnCompleteMovementToRegion += delegate()
|
client.OnCompleteMovementToRegion += delegate()
|
||||||
{
|
{
|
||||||
client.SendChatMessage("Welcome to My World.", 1, pos, "System", LLUUID.Zero );
|
client.SendChatMessage("Welcome to My World.", 1, pos, "System", LLUUID.Zero);
|
||||||
};
|
};
|
||||||
|
|
||||||
client.SendRegionHandshake(m_regInfo);
|
client.SendRegionHandshake(m_regInfo);
|
||||||
|
|
||||||
ScenePresence avatar =CreateAndAddScenePresence(client);
|
ScenePresence avatar = CreateAndAddScenePresence(client);
|
||||||
avatar.Pos = new LLVector3(128, 128, 26);
|
avatar.Pos = new LLVector3(128, 128, 26);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void NewLoggin()
|
public void CustomStartup()
|
||||||
{
|
{
|
||||||
if (firstlogin)
|
this.StartTimer();
|
||||||
{
|
|
||||||
this.StartTimer();
|
|
||||||
|
|
||||||
ScriptManager.AddPreCompiledScript(new PulseScript());
|
ScriptManager.AddPreCompiledScript(new PulseScript());
|
||||||
|
|
||||||
PrimitiveBaseShape shape = PrimitiveBaseShape.DefaultBox();
|
PrimitiveBaseShape shape = PrimitiveBaseShape.DefaultBox();
|
||||||
shape.Scale = new LLVector3(0.5f, 0.5f, 0.5f);
|
shape.Scale = new LLVector3(0.5f, 0.5f, 0.5f);
|
||||||
LLVector3 pos1 = new LLVector3(129, 129, 27);
|
LLVector3 pos1 = new LLVector3(129, 129, 27);
|
||||||
AddNewPrim(LLUUID.Random(), pos1, shape);
|
AddNewPrim(LLUUID.Random(), pos1, shape);
|
||||||
firstlogin = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Update()
|
public override void Update()
|
||||||
|
|
|
@ -13,6 +13,7 @@ using OpenSim.Region.Capabilities;
|
||||||
using OpenSim.Region.ClientStack;
|
using OpenSim.Region.ClientStack;
|
||||||
using OpenSim.Region.Communications.Local;
|
using OpenSim.Region.Communications.Local;
|
||||||
using OpenSim.Region.GridInterfaces.Local;
|
using OpenSim.Region.GridInterfaces.Local;
|
||||||
|
using OpenSim.Framework.Data;
|
||||||
|
|
||||||
namespace SimpleApp
|
namespace SimpleApp
|
||||||
{
|
{
|
||||||
|
@ -48,7 +49,7 @@ namespace SimpleApp
|
||||||
|
|
||||||
UDPServer udpServer = new UDPServer( internalEndPoint.Port, assetCache, inventoryCache, m_log, m_circuitManager );
|
UDPServer udpServer = new UDPServer( internalEndPoint.Port, assetCache, inventoryCache, m_log, m_circuitManager );
|
||||||
PacketServer packetServer = new PacketServer(udpServer);
|
PacketServer packetServer = new PacketServer(udpServer);
|
||||||
udpServer.ServerListener();
|
|
||||||
|
|
||||||
ClientView.TerrainManager = new TerrainManager(new SecondLife());
|
ClientView.TerrainManager = new TerrainManager(new SecondLife());
|
||||||
BaseHttpServer httpServer = new BaseHttpServer(internalEndPoint.Port);
|
BaseHttpServer httpServer = new BaseHttpServer(internalEndPoint.Port);
|
||||||
|
@ -62,26 +63,23 @@ namespace SimpleApp
|
||||||
world.PhysScene = physManager.GetPhysicsScene("basicphysics"); //PhysicsScene.Null;
|
world.PhysScene = physManager.GetPhysicsScene("basicphysics"); //PhysicsScene.Null;
|
||||||
|
|
||||||
world.LoadWorldMap();
|
world.LoadWorldMap();
|
||||||
world.ParcelManager.NoParcelDataFromStorage();
|
|
||||||
|
|
||||||
udpServer.LocalWorld = world;
|
udpServer.LocalWorld = world;
|
||||||
|
|
||||||
httpServer.Start();
|
httpServer.Start();
|
||||||
|
udpServer.ServerListener();
|
||||||
|
|
||||||
|
UserProfileData masterAvatar = communicationsManager.UserServer.SetupMasterUser("Test", "User", "test");
|
||||||
|
if (masterAvatar != null)
|
||||||
|
{
|
||||||
|
world.RegionInfo.MasterAvatarAssignedUUID = masterAvatar.UUID;
|
||||||
|
world.ParcelManager.NoParcelDataFromStorage();
|
||||||
|
}
|
||||||
|
|
||||||
|
world.CustomStartup();
|
||||||
m_log.WriteLine( LogPriority.NORMAL, "Press enter to quit.");
|
m_log.WriteLine( LogPriority.NORMAL, "Press enter to quit.");
|
||||||
m_log.ReadLine();
|
m_log.ReadLine();
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
PrimitiveBaseShape shape = PrimitiveBaseShape.DefaultBox();
|
|
||||||
|
|
||||||
shape.Scale = new LLVector3(0.5f, 0.5f, 0.5f);
|
|
||||||
|
|
||||||
LLVector3 pos = new LLVector3(129,130,25);
|
|
||||||
|
|
||||||
world.AddNewPrim( LLUUID.Random(), pos, shape );
|
|
||||||
*/
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool AddNewSessionHandler(ulong regionHandle, Login loginData)
|
private bool AddNewSessionHandler(ulong regionHandle, Login loginData)
|
||||||
|
@ -136,8 +134,7 @@ namespace SimpleApp
|
||||||
{
|
{
|
||||||
Program app = new Program();
|
Program app = new Program();
|
||||||
|
|
||||||
app.Run();
|
app.Run();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,48 +5,48 @@ using OpenSim.Region.Scripting;
|
||||||
using OpenSim.Region.Environment.Scenes;
|
using OpenSim.Region.Environment.Scenes;
|
||||||
namespace SimpleApp
|
namespace SimpleApp
|
||||||
{
|
{
|
||||||
public class PulseScript :IScript
|
public class PulseScript : IScript
|
||||||
{
|
{
|
||||||
ScriptInfo script;
|
ScriptInfo script;
|
||||||
|
|
||||||
private libsecondlife.LLVector3 pulse = new libsecondlife.LLVector3(0.1f, 0.1f, 0.1f);
|
private libsecondlife.LLVector3 pulse = new libsecondlife.LLVector3(0.1f, 0.1f, 0.1f);
|
||||||
public string getName()
|
public string getName()
|
||||||
{
|
{
|
||||||
return "pulseScript 0.1";
|
return "pulseScript 0.1";
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Initialise(ScriptInfo scriptInfo)
|
public void Initialise(ScriptInfo scriptInfo)
|
||||||
{
|
{
|
||||||
script = scriptInfo;
|
script = scriptInfo;
|
||||||
script.events.OnFrame += new EventManager.OnFrameDelegate(events_OnFrame);
|
script.events.OnFrame += new EventManager.OnFrameDelegate(events_OnFrame);
|
||||||
script.events.OnNewPresence += new EventManager.OnNewPresenceDelegate(events_OnNewPresence);
|
script.events.OnNewPresence += new EventManager.OnNewPresenceDelegate(events_OnNewPresence);
|
||||||
}
|
}
|
||||||
|
|
||||||
void events_OnNewPresence(ScenePresence presence)
|
void events_OnNewPresence(ScenePresence presence)
|
||||||
{
|
{
|
||||||
script.logger.Verbose("Hello " + presence.firstname.ToString() + "!");
|
script.logger.Verbose("Hello " + presence.firstname.ToString() + "!");
|
||||||
}
|
}
|
||||||
|
|
||||||
void events_OnFrame()
|
void events_OnFrame()
|
||||||
|
{
|
||||||
|
foreach (EntityBase ent in this.script.world.Entities.Values)
|
||||||
{
|
{
|
||||||
foreach(EntityBase ent in this.script.world.Entities.Values)
|
if (ent is SceneObject)
|
||||||
{
|
{
|
||||||
if (ent is SceneObject)
|
SceneObject prim = (SceneObject)ent;
|
||||||
{
|
if ((prim.rootPrimitive.Scale.X > 1) && (prim.rootPrimitive.Scale.Y > 1) && (prim.rootPrimitive.Scale.Z > 1))
|
||||||
SceneObject prim = (SceneObject)ent;
|
{
|
||||||
if ((prim.rootPrimitive.Scale.X > 1) && (prim.rootPrimitive.Scale.Y > 1) && (prim.rootPrimitive.Scale.Z > 1))
|
this.pulse = new libsecondlife.LLVector3(-0.1f, -0.1f, -0.1f);
|
||||||
{
|
}
|
||||||
this.pulse = new libsecondlife.LLVector3(-0.1f, -0.1f, -0.1f);
|
else if ((prim.rootPrimitive.Scale.X < 0.2f) && (prim.rootPrimitive.Scale.Y < 0.2f) && (prim.rootPrimitive.Scale.Z < 0.2f))
|
||||||
}
|
{
|
||||||
else if ((prim.rootPrimitive.Scale.X < 0.2f) && (prim.rootPrimitive.Scale.Y < 0.2f) && (prim.rootPrimitive.Scale.Z < 0.2f))
|
pulse = new libsecondlife.LLVector3(0.1f, 0.1f, 0.1f);
|
||||||
{
|
}
|
||||||
pulse = new libsecondlife.LLVector3(0.1f, 0.1f, 0.1f);
|
|
||||||
}
|
|
||||||
|
|
||||||
prim.rootPrimitive.ResizeGoup( prim.rootPrimitive.Scale + pulse);
|
prim.rootPrimitive.ResizeGoup(prim.rootPrimitive.Scale + pulse);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -716,6 +716,7 @@
|
||||||
<Reference name="OpenSim.Framework.Console"/>
|
<Reference name="OpenSim.Framework.Console"/>
|
||||||
<Reference name="OpenSim.Framework"/>
|
<Reference name="OpenSim.Framework"/>
|
||||||
<Reference name="OpenSim.Framework.UserManagement"/>
|
<Reference name="OpenSim.Framework.UserManagement"/>
|
||||||
|
<Reference name="OpenSim.Framework.Data"/>
|
||||||
<Reference name="OpenSim.Region.Physics.Manager"/>
|
<Reference name="OpenSim.Region.Physics.Manager"/>
|
||||||
<Reference name="OpenSim.Region.Capabilities"/>
|
<Reference name="OpenSim.Region.Capabilities"/>
|
||||||
<Reference name="XMLRPC.dll"/>
|
<Reference name="XMLRPC.dll"/>
|
||||||
|
|
Loading…
Reference in New Issue