mirror of
https://github.com/opensim/opensim.git
synced 2026-08-08 02:05:34 +08:00
Added AddPreCompiledScript method to ScriptManager.
Done some work on lbsa71's simpleApp(hope he doesn't mind): now have the avatar showing up and the terrain and his pulsating box (well except its not a box, as there seems to be something wrong with our PrimitiveBaseShape..DefaultBox() settings). Also noticed a few other problems that I had to work around, so these need looking into.
This commit is contained in:
@@ -7,12 +7,14 @@ using OpenSim.Framework.Servers;
|
||||
using OpenSim.Framework.Types;
|
||||
using OpenSim.Region.Caches;
|
||||
using OpenSim.Region.Environment.Scenes;
|
||||
using OpenSim.Region.Terrain;
|
||||
using Avatar=OpenSim.Region.Environment.Scenes.ScenePresence;
|
||||
|
||||
namespace SimpleApp
|
||||
{
|
||||
public class MyWorld : Scene
|
||||
{
|
||||
private bool firstlogin = true;
|
||||
private List<ScenePresence> m_avatars;
|
||||
|
||||
public MyWorld(ClientManager clientManager, RegionInfo regionInfo, AuthenticateSessionsBase authen, CommunicationsManager commsMan, AssetCache assetCach, BaseHttpServer httpServer)
|
||||
@@ -21,6 +23,7 @@ namespace SimpleApp
|
||||
m_avatars = new List<Avatar>();
|
||||
}
|
||||
|
||||
/*
|
||||
public override void SendLayerData(IClientAPI remoteClient)
|
||||
{
|
||||
float[] map = new float[65536];
|
||||
@@ -34,6 +37,22 @@ namespace SimpleApp
|
||||
}
|
||||
|
||||
remoteClient.SendLayerData(map);
|
||||
}*/
|
||||
|
||||
public override void LoadWorldMap()
|
||||
{
|
||||
float[] map = new float[65536];
|
||||
|
||||
for (int i = 0; i < 65536; i++)
|
||||
{
|
||||
int x = i % 256;
|
||||
int y = i / 256;
|
||||
|
||||
map[i] = 25f;
|
||||
}
|
||||
|
||||
this.Terrain.setHeights1D(map);
|
||||
this.CreateTerrainTexture();
|
||||
}
|
||||
|
||||
#region IWorld Members
|
||||
@@ -41,6 +60,8 @@ namespace SimpleApp
|
||||
override public void AddNewClient(IClientAPI client, bool child)
|
||||
|
||||
{
|
||||
NewLoggin();
|
||||
|
||||
LLVector3 pos = new LLVector3(128, 128, 128);
|
||||
|
||||
client.OnRegionHandShakeReply += SendLayerData;
|
||||
@@ -66,8 +87,33 @@ namespace SimpleApp
|
||||
|
||||
client.SendRegionHandshake(m_regInfo);
|
||||
|
||||
CreateAndAddScenePresence(client);
|
||||
|
||||
ScenePresence avatar =CreateAndAddScenePresence(client);
|
||||
avatar.Pos = new LLVector3(128, 128, 26);
|
||||
}
|
||||
|
||||
public void NewLoggin()
|
||||
{
|
||||
if (firstlogin)
|
||||
{
|
||||
this.StartTimer();
|
||||
|
||||
scriptManager.AddPreCompiledScript(new PulseScript());
|
||||
|
||||
PrimitiveBaseShape shape = PrimitiveBaseShape.DefaultBox();
|
||||
shape.Scale = new LLVector3(0.5f, 0.5f, 0.5f);
|
||||
LLVector3 pos1 = new LLVector3(129, 129, 27);
|
||||
AddNewPrim(LLUUID.Random(), pos1, shape);
|
||||
firstlogin = false;
|
||||
}
|
||||
}
|
||||
|
||||
public override void Update()
|
||||
{
|
||||
foreach (LLUUID UUID in Entities.Keys)
|
||||
{
|
||||
Entities[UUID].update();
|
||||
}
|
||||
eventManager.TriggerOnFrame();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
Reference in New Issue
Block a user