From 7daa3955bc3a1918e40962851f9e8d38597a245e Mon Sep 17 00:00:00 2001 From: gareth Date: Thu, 22 Mar 2007 10:11:15 +0000 Subject: brought zircon branch into trunk --- src/world/Avatar.cs | 487 ----------------------------------------- src/world/Entity.cs | 67 ------ src/world/Primitive.cs | 429 ------------------------------------ src/world/ScriptEngine.cs | 18 -- src/world/SurfacePatch.cs | 22 -- src/world/World.cs | 208 ------------------ src/world/scripting/IScript.cs | 16 -- 7 files changed, 1247 deletions(-) delete mode 100644 src/world/Avatar.cs delete mode 100644 src/world/Entity.cs delete mode 100644 src/world/Primitive.cs delete mode 100644 src/world/ScriptEngine.cs delete mode 100644 src/world/SurfacePatch.cs delete mode 100644 src/world/World.cs delete mode 100644 src/world/scripting/IScript.cs (limited to 'src/world') diff --git a/src/world/Avatar.cs b/src/world/Avatar.cs deleted file mode 100644 index facfeee..0000000 --- a/src/world/Avatar.cs +++ /dev/null @@ -1,487 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Text; -using libsecondlife; -using libsecondlife.Packets; -using PhysicsSystem; -using Axiom.MathLib; - -namespace OpenSim.world -{ - public class Avatar : Entity - { - public static bool PhysicsEngineFlying; - public string firstname; - public string lastname; - public OpenSimClient ControllingClient; - private PhysicsActor _physActor; - private static libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock AvatarTemplate; - private bool updateflag; - private byte movementflag; - private List forcesList = new List(); - private short _updateCount; - private Axiom.MathLib.Quaternion bodyRot; - - public Avatar(OpenSimClient TheClient) { - ServerConsole.MainConsole.Instance.WriteLine("Avatar.cs - Loading details from grid (DUMMY)"); - ControllingClient=TheClient; - 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 - { - set - { - this._physActor = value; - } - } - public override void addForces() - { - lock(this.forcesList) - { - if(this.forcesList.Count>0) - { - for(int i=0 ; i < this.forcesList.Count; i++) - { - NewForce force = this.forcesList[i]; - PhysicsVector phyVector = new PhysicsVector(force.X, force.Y, force.Z); - this._physActor.Velocity = phyVector; - this.updateflag = true; - this.velocity = new LLVector3(force.X, force.Y, force.Z); //shouldn't really be doing this - // but as we are setting the velocity (rather than using real forces) at the moment it is okay. - } - for(int i=0 ; i < this.forcesList.Count; i++) - { - this.forcesList.RemoveAt(0); - } - } - } - } - - public override void update() - { - - if(this.updateflag) - { - //need to send movement info - //so create the improvedterseobjectupdate packet - //use CreateTerseBlock() - 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); - } - - updateflag =false; - //this._updateCount = 0; - } - else - { - //if((movementflag & 1) !=0) - //{ - _updateCount++; - if(( (!PhysicsEngineFlying) && (_updateCount>3)) || (_updateCount>0)) - { - //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; - } - //} - } - } - - public static void SetupTemplate(string name) - { - int i = 0; - FileInfo fInfo = new FileInfo(name); - long numBytes = fInfo.Length; - FileStream fStream = new FileStream(name, FileMode.Open, FileAccess.Read); - BinaryReader br = new BinaryReader(fStream); - byte [] data1 = br.ReadBytes((int)numBytes); - br.Close(); - fStream.Close(); - - libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock objdata = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock(data1, ref i); - - System.Text.Encoding enc = System.Text.Encoding.ASCII; - libsecondlife.LLVector3 pos = new LLVector3(objdata.ObjectData, 16); - pos.X = 100f; - objdata.ID = 8880000; - objdata.NameValue = enc.GetBytes("FirstName STRING RW SV Test \nLastName STRING RW SV User \0"); - libsecondlife.LLVector3 pos2 = new LLVector3(100f,100f,23f); - //objdata.FullID=user.AgentID; - byte[] pb = pos.GetBytes(); - Array.Copy(pb, 0, objdata.ObjectData, 16, pb.Length); - - Avatar.AvatarTemplate = objdata; - } - - public void CompleteMovement(World RegionInfo) { - ServerConsole.MainConsole.Instance.WriteLine("Avatar.cs:CompleteMovement() - Constructing AgentMovementComplete packet"); - AgentMovementCompletePacket mov = new AgentMovementCompletePacket(); - mov.AgentData.SessionID = this.ControllingClient.SessionID; - mov.AgentData.AgentID = this.ControllingClient.AgentID; - mov.Data.RegionHandle = OpenSim_Main.cfg.RegionHandle; - // TODO - dynamicalise this stuff - mov.Data.Timestamp = 1172750370; - mov.Data.Position = new LLVector3(100f, 100f, 23f); - mov.Data.LookAt = new LLVector3(0.99f, 0.042f, 0); - - ControllingClient.OutPacket(mov); - } - - public void SendInitialPosition() { - - System.Text.Encoding _enc = System.Text.Encoding.ASCII; - //send a objectupdate packet with information about the clients avatar - ObjectUpdatePacket objupdate = new ObjectUpdatePacket(); - objupdate.RegionData.RegionHandle = OpenSim_Main.cfg.RegionHandle; - objupdate.RegionData.TimeDilation = 64096; - objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1]; - - objupdate.ObjectData[0] = AvatarTemplate; - //give this avatar object a local id and assign the user a name - objupdate.ObjectData[0].ID = this.localid; - objupdate.ObjectData[0].FullID = ControllingClient.AgentID; - objupdate.ObjectData[0].NameValue = _enc.GetBytes("FirstName STRING RW SV " + firstname + "\nLastName STRING RW SV " + lastname + " \0"); - - libsecondlife.LLVector3 pos2 = new LLVector3((float)this.position.X, (float)this.position.Y, (float)this.position.Z); - - byte[] pb = pos2.GetBytes(); - - Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 16, pb.Length); - OpenSim_Main.local_world._localNumber++; - - foreach(OpenSimClient client in OpenSim_Main.sim.ClientThreads.Values) - { - client.OutPacket(objupdate); - if(client.AgentID != ControllingClient.AgentID) - { - SendAppearanceToOtherAgent(client); - } - } - //this.ControllingClient.OutPacket(objupdate); - } - - public void SendInitialAppearance() { - AgentWearablesUpdatePacket aw = new AgentWearablesUpdatePacket(); - aw.AgentData.AgentID = this.ControllingClient.AgentID; - aw.AgentData.SerialNum = 0; - aw.AgentData.SessionID = ControllingClient.SessionID; - - aw.WearableData = new AgentWearablesUpdatePacket.WearableDataBlock[13]; - AgentWearablesUpdatePacket.WearableDataBlock awb = new AgentWearablesUpdatePacket.WearableDataBlock(); - awb.WearableType = (byte)0; - awb.AssetID = new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73"); - awb.ItemID = LLUUID.Random(); - aw.WearableData[0] = awb; - - for(int i=1; i<13; i++) - { - awb = new AgentWearablesUpdatePacket.WearableDataBlock(); - awb.WearableType = (byte)i; - awb.AssetID = new LLUUID("00000000-0000-0000-0000-000000000000"); - awb.ItemID = new LLUUID("00000000-0000-0000-0000-000000000000"); - aw.WearableData[i] = awb; - } - - ControllingClient.OutPacket(aw); - } - - public ObjectUpdatePacket CreateUpdatePacket() - { - System.Text.Encoding _enc = System.Text.Encoding.ASCII; - //send a objectupdate packet with information about the clients avatar - ObjectUpdatePacket objupdate = new ObjectUpdatePacket(); - objupdate.RegionData.RegionHandle = OpenSim_Main.cfg.RegionHandle; - objupdate.RegionData.TimeDilation = 64096; - objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1]; - - objupdate.ObjectData[0] = AvatarTemplate; - //give this avatar object a local id and assign the user a name - objupdate.ObjectData[0].ID = this.localid; - objupdate.ObjectData[0].FullID = ControllingClient.AgentID; - objupdate.ObjectData[0].NameValue = _enc.GetBytes("FirstName STRING RW SV " + firstname + "\nLastName STRING RW SV " + lastname + " \0"); - - libsecondlife.LLVector3 pos2 = new LLVector3((float)this._physActor.Position.X, (float)this._physActor.Position.Y, (float)this._physActor.Position.Z); - - byte[] pb = pos2.GetBytes(); - - Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 16, pb.Length); - return objupdate; - } - - public void SendAppearanceToOtherAgent(OpenSimClient userInfo) - { - AvatarAppearancePacket avp = new AvatarAppearancePacket(); - - - avp.VisualParam = new AvatarAppearancePacket.VisualParamBlock[218]; - //avp.ObjectData.TextureEntry=this.avatar_template.TextureEntry;// br.ReadBytes((int)numBytes); - - LLObject.TextureEntry ntex = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-0000-000000000005")); - avp.ObjectData.TextureEntry = ntex.ToBytes(); - - AvatarAppearancePacket.VisualParamBlock avblock = null; - for(int i = 0; i < 218; i++) - { - avblock = new AvatarAppearancePacket.VisualParamBlock(); - avblock.ParamValue = (byte)100; - avp.VisualParam[i] = avblock; - } - - avp.Sender.IsTrial = false; - avp.Sender.ID = ControllingClient.AgentID; - userInfo.OutPacket(avp); - - } - - public void HandleUpdate(AgentUpdatePacket pack) { - if(((uint)pack.AgentData.ControlFlags & (uint)MainAvatar.AgentUpdateFlags.AGENT_CONTROL_FLY) !=0) - { - this._physActor.Flying = true; - } - else - { - this._physActor.Flying = false; - } - if(((uint)pack.AgentData.ControlFlags & (uint)MainAvatar.AgentUpdateFlags.AGENT_CONTROL_AT_POS) !=0) { - Axiom.MathLib.Quaternion q = new Axiom.MathLib.Quaternion(pack.AgentData.BodyRotation.W, pack.AgentData.BodyRotation.X, pack.AgentData.BodyRotation.Y, pack.AgentData.BodyRotation.Z); - if(((movementflag & 1) ==0) || (q!= this.bodyRot)) - { - //we should add a new force to the list - // but for now we will deal with velocities - NewForce newVelocity = new NewForce(); - Axiom.MathLib.Vector3 v3 = new Axiom.MathLib.Vector3(1, 0, 0); - Axiom.MathLib.Vector3 direc = q * v3; - direc.Normalize(); - - //work out velocity for sim physics system - direc = direc * ((0.03f) * 128f); - if(this._physActor.Flying) - direc *=2; - - newVelocity.X = direc.x; - newVelocity.Y = direc.y; - newVelocity.Z = direc.z; - this.forcesList.Add(newVelocity); - movementflag = 1; - this.bodyRot = q; - } - } - else if((((uint)pack.AgentData.ControlFlags & (uint)MainAvatar.AgentUpdateFlags.AGENT_CONTROL_UP_POS) !=0) &&(PhysicsEngineFlying)) { - if(((movementflag & 2) ==0) && this._physActor.Flying) - { - //we should add a new force to the list - // but for now we will deal with velocities - NewForce newVelocity = new NewForce(); - Axiom.MathLib.Vector3 v3 = new Axiom.MathLib.Vector3(0, 0, 1); - Axiom.MathLib.Vector3 direc = v3; - direc.Normalize(); - - //work out velocity for sim physics system - direc = direc * ((0.03f) * 128f *2); - newVelocity.X = direc.x; - newVelocity.Y = direc.y; - newVelocity.Z = direc.z; - this.forcesList.Add(newVelocity); - movementflag = 2; - } - } - else if((((uint)pack.AgentData.ControlFlags & (uint)MainAvatar.AgentUpdateFlags.AGENT_CONTROL_UP_NEG) !=0) && (PhysicsEngineFlying)) { - if(((movementflag & 4) ==0) && this._physActor.Flying) - { - //we should add a new force to the list - // but for now we will deal with velocities - NewForce newVelocity = new NewForce(); - Axiom.MathLib.Vector3 v3 = new Axiom.MathLib.Vector3(0, 0, -1); - //Axiom.MathLib.Quaternion q = new Axiom.MathLib.Quaternion(pack.AgentData.BodyRotation.W, pack.AgentData.BodyRotation.X, pack.AgentData.BodyRotation.Y, pack.AgentData.BodyRotation.Z); - Axiom.MathLib.Vector3 direc = v3; - direc.Normalize(); - - //work out velocity for sim physics system - direc = direc * ((0.03f) * 128f *2); - newVelocity.X = direc.x; - newVelocity.Y = direc.y; - newVelocity.Z = direc.z; - this.forcesList.Add(newVelocity); - movementflag = 4; - } - } - else if(((uint)pack.AgentData.ControlFlags & (uint)MainAvatar.AgentUpdateFlags.AGENT_CONTROL_AT_NEG) !=0) { - Axiom.MathLib.Quaternion q = new Axiom.MathLib.Quaternion(pack.AgentData.BodyRotation.W, pack.AgentData.BodyRotation.X, pack.AgentData.BodyRotation.Y, pack.AgentData.BodyRotation.Z); - if(((movementflag & 8) ==0) || (q!= this.bodyRot)) - { - //we should add a new force to the list - // but for now we will deal with velocities - NewForce newVelocity = new NewForce(); - Axiom.MathLib.Vector3 v3 = new Axiom.MathLib.Vector3(-1, 0, 0); - Axiom.MathLib.Vector3 direc = q * v3; - direc.Normalize(); - - //work out velocity for sim physics system - direc = direc * ((0.03f) * 128f); - if(this._physActor.Flying) - direc *=2; - - newVelocity.X = direc.x; - newVelocity.Y = direc.y; - newVelocity.Z = direc.z; - this.forcesList.Add(newVelocity); - movementflag = 8; - this.bodyRot = q; - } - } - else - { - if((movementflag) !=0) - { - NewForce newVelocity = new NewForce(); - newVelocity.X = 0; - newVelocity.Y = 0; - newVelocity.Z = 0; - this.forcesList.Add(newVelocity); - movementflag = 0; - } - } - } - - //should be moved somewhere else - public void SendRegionHandshake(World RegionInfo) { - ServerConsole.MainConsole.Instance.WriteLine("Avatar.cs:SendRegionHandshake() - Creating empty RegionHandshake packet"); - System.Text.Encoding _enc = System.Text.Encoding.ASCII; - RegionHandshakePacket handshake = new RegionHandshakePacket(); - - ServerConsole.MainConsole.Instance.WriteLine("Avatar.cs:SendRegionhandshake() - Filling in RegionHandshake details"); - handshake.RegionInfo.BillableFactor = 0; - handshake.RegionInfo.IsEstateManager = false; - handshake.RegionInfo.TerrainHeightRange00 = 60; - handshake.RegionInfo.TerrainHeightRange01 = 60; - handshake.RegionInfo.TerrainHeightRange10 = 60; - handshake.RegionInfo.TerrainHeightRange11 = 60; - handshake.RegionInfo.TerrainStartHeight00 = 10; - handshake.RegionInfo.TerrainStartHeight01 = 10; - handshake.RegionInfo.TerrainStartHeight10 = 10; - handshake.RegionInfo.TerrainStartHeight11 = 10; - handshake.RegionInfo.SimAccess = 13; - handshake.RegionInfo.WaterHeight = 20; - handshake.RegionInfo.RegionFlags = 72458694; - handshake.RegionInfo.SimName = _enc.GetBytes(OpenSim_Main.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"); - handshake.RegionInfo.TerrainBase2 = new LLUUID("179cdabd-398a-9b6b-1391-4dc333ba321f"); - handshake.RegionInfo.TerrainBase3 = new LLUUID("beb169c7-11ea-fff2-efe5-0f24dc881df2"); - handshake.RegionInfo.TerrainDetail0 = new LLUUID("00000000-0000-0000-0000-000000000000"); - handshake.RegionInfo.TerrainDetail1 = new LLUUID("00000000-0000-0000-0000-000000000000"); - handshake.RegionInfo.TerrainDetail2 = new LLUUID("00000000-0000-0000-0000-000000000000"); - handshake.RegionInfo.TerrainDetail3 = new LLUUID("00000000-0000-0000-0000-000000000000"); - handshake.RegionInfo.CacheID = new LLUUID("545ec0a5-5751-1026-8a0b-216e38a7ab37"); - - ServerConsole.MainConsole.Instance.WriteLine("Avatar.cs:SendRegionHandshake() - Sending RegionHandshake packet"); - this.ControllingClient.OutPacket(handshake); - } - - public ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreateTerseBlock() - { - byte[] bytes = new byte[60]; - int i=0; - ImprovedTerseObjectUpdatePacket.ObjectDataBlock dat = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock(); - - dat.TextureEntry = AvatarTemplate.TextureEntry; - libsecondlife.LLVector3 pos2 = new LLVector3(this._physActor.Position.X, this._physActor.Position.Y, this._physActor.Position.Z); - - uint ID = this.localid; - - bytes[i++] = (byte)(ID % 256); - bytes[i++] = (byte)((ID >> 8) % 256); - bytes[i++] = (byte)((ID >> 16) % 256); - bytes[i++] = (byte)((ID >> 24) % 256); - bytes[i++] = 0; - bytes[i++] = 1; - i += 14; - bytes[i++] = 128; - bytes[i++] = 63; - - byte[] pb = pos2.GetBytes(); - Array.Copy(pb, 0, bytes, i, pb.Length); - i += 12; - ushort InternVelocityX; - ushort InternVelocityY; - ushort InternVelocityZ; - - Axiom.MathLib.Vector3 internDirec = new Axiom.MathLib.Vector3(this._physActor.Velocity.X, this._physActor.Velocity.Y, this._physActor.Velocity.Z); - internDirec = internDirec /128.0f; - internDirec.x += 1; - internDirec.y += 1; - internDirec.z += 1; - - InternVelocityX = (ushort)(32768 * internDirec.x); - InternVelocityY = (ushort)(32768 * internDirec.y); - InternVelocityZ = (ushort)(32768 * internDirec.z); - - ushort ac = 32767; - bytes[i++] = (byte)(InternVelocityX % 256); - bytes[i++] = (byte)((InternVelocityX >> 8) % 256); - bytes[i++] = (byte)(InternVelocityY % 256); - bytes[i++] = (byte)((InternVelocityY>> 8) % 256); - bytes[i++] = (byte)(InternVelocityZ % 256); - bytes[i++] = (byte)((InternVelocityZ >> 8) % 256); - - //accel - bytes[i++] = (byte)(ac % 256); - bytes[i++] = (byte)((ac >> 8) % 256); - bytes[i++] = (byte)(ac % 256); - bytes[i++] = (byte)((ac >> 8) % 256); - bytes[i++] = (byte)(ac % 256); - bytes[i++] = (byte)((ac >> 8) % 256); - - //rot - bytes[i++] = (byte)(ac % 256); - bytes[i++] = (byte)((ac >> 8) % 256); - bytes[i++] = (byte)(ac % 256); - bytes[i++] = (byte)((ac >> 8) % 256); - bytes[i++] = (byte)(ac % 256); - bytes[i++] = (byte)((ac >> 8) % 256); - bytes[i++] = (byte)(ac % 256); - bytes[i++] = (byte)((ac >> 8) % 256); - - //rotation vel - bytes[i++] = (byte)(ac % 256); - bytes[i++] = (byte)((ac >> 8) % 256); - bytes[i++] = (byte)(ac % 256); - bytes[i++] = (byte)((ac >> 8) % 256); - bytes[i++] = (byte)(ac % 256); - bytes[i++] = (byte)((ac >> 8) % 256); - - dat.Data=bytes; - return(dat); - } - } - - public class NewForce - { - public float X; - public float Y; - public float Z; - - public NewForce() - { - - } - } -} diff --git a/src/world/Entity.cs b/src/world/Entity.cs deleted file mode 100644 index ee4b2e4..0000000 --- a/src/world/Entity.cs +++ /dev/null @@ -1,67 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using Axiom.MathLib; -using OpenSim.types; -using libsecondlife; - -namespace OpenSim.world -{ - public class Entity - { - public libsecondlife.LLUUID uuid; - public uint localid; - public LLVector3 position; - public LLVector3 velocity; - public Quaternion rotation; - protected string name; - protected List children; - - public Entity() - { - uuid = new libsecondlife.LLUUID(); - localid = 8880000 + (OpenSim_Main.local_world._localNumber++); // FIXME - race condition! - position = new LLVector3(); - velocity = new LLVector3(); - rotation = new Quaternion(); - name = "(basic entity)"; - children = new List(); - } - public virtual void addForces() - { - foreach (Entity child in children) - { - child.addForces(); - } - } - public virtual void update() { - // Do any per-frame updates needed that are applicable to every type of entity - foreach (Entity child in children) - { - child.update(); - } - } - - public virtual string getName() - { - return name; - } - - public virtual Mesh getMesh() - { - Mesh mesh = new Mesh(); - - foreach (Entity child in children) - { - mesh += child.getMesh(); - } - - return mesh; - } - - public virtual void BackUp() - { - - } - } -} diff --git a/src/world/Primitive.cs b/src/world/Primitive.cs deleted file mode 100644 index 6be33ef..0000000 --- a/src/world/Primitive.cs +++ /dev/null @@ -1,429 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using OpenSim.types; -using libsecondlife; -using libsecondlife.Packets; -using GridInterfaces; -using PhysicsSystem; - -namespace OpenSim.world -{ - public class Primitive : Entity - { - protected float mesh_cutbegin; - protected float mesh_cutend; - protected PrimData primData; - protected bool newPrimFlag; - protected bool updateFlag; - protected bool dirtyFlag; - private ObjectUpdatePacket OurPacket; - private PhysicsActor _physActor; - private bool physicsEnabled; - - public bool PhysicsEnabled - { - get - { - return physicsEnabled; - } - set - { - physicsEnabled = value; - } - } - public bool UpdateFlag - { - get - { - return updateFlag; - } - set - { - updateFlag = value; - } - } - public LLVector3 Scale - { - set - { - this.primData.Scale = value; - this.dirtyFlag = true; - } - get - { - return this.primData.Scale; - } - } - public PhysicsActor PhysActor - { - set - { - this._physActor = value; - } - } - - public Primitive() - { - mesh_cutbegin = 0.0f; - mesh_cutend = 1.0f; - } - - public override Mesh getMesh() - { - Mesh mesh = new Mesh(); - Triangle tri = new Triangle( - new Axiom.MathLib.Vector3(0.0f, 1.0f, 1.0f), - new Axiom.MathLib.Vector3(1.0f, 0.0f, 1.0f), - new Axiom.MathLib.Vector3(1.0f, 1.0f, 0.0f)); - - mesh.AddTri(tri); - mesh += base.getMesh(); - - return mesh; - } - - public void UpdatePosition( LLVector3 pos) - { - this.position = pos; - if(this._physActor != null && this.physicsEnabled) - { - this._physActor.Position = new PhysicsVector(pos.X, pos.Y, pos.Z); - } - this.updateFlag = true; - } - - public override void update() - { - if(this.newPrimFlag) - { - foreach(OpenSimClient client in OpenSim_Main.sim.ClientThreads.Values) { - client.OutPacket(OurPacket); - } - this.newPrimFlag = false; - } - else if(this.updateFlag) - { - 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] = this.CreateImprovedBlock(); - foreach(OpenSimClient client in OpenSim_Main.sim.ClientThreads.Values) { - client.OutPacket(terse); - } - this.updateFlag = false; - } - else if(this.dirtyFlag) - { - foreach(OpenSimClient client in OpenSim_Main.sim.ClientThreads.Values) { - UpdateClient(client); - } - this.dirtyFlag = false; - } - else - { - if(this._physActor != null && this.physicsEnabled) - { - 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] = this.CreateImprovedBlock(); - foreach(OpenSimClient client in OpenSim_Main.sim.ClientThreads.Values) { - client.OutPacket(terse); - } - } - } - } - - public void UpdateClient(OpenSimClient RemoteClient) - { - - LLVector3 lPos; - if( this._physActor != null && this.physicsEnabled) - { - PhysicsVector pPos = this._physActor.Position; - lPos = new LLVector3( pPos.X, pPos.Y, pPos.Z); - } - else - { - lPos = this.position; - } - byte[] pb = lPos.GetBytes(); - Array.Copy(pb, 0, OurPacket.ObjectData[0].ObjectData, 0, pb.Length); - - // OurPacket should be update with the follwing in updateShape() rather than having to do it here - OurPacket.ObjectData[0].OwnerID = this.primData.OwnerID; - OurPacket.ObjectData[0].PCode = this.primData.PCode; - OurPacket.ObjectData[0].PathBegin = this.primData.PathBegin; - OurPacket.ObjectData[0].PathEnd = this.primData.PathEnd; - OurPacket.ObjectData[0].PathScaleX = this.primData.PathScaleX; - OurPacket.ObjectData[0].PathScaleY = this.primData.PathScaleY; - OurPacket.ObjectData[0].PathShearX = this.primData.PathShearX; - OurPacket.ObjectData[0].PathShearY = this.primData.PathShearY; - OurPacket.ObjectData[0].PathSkew = this.primData.PathSkew; - OurPacket.ObjectData[0].ProfileBegin = this.primData.ProfileBegin; - OurPacket.ObjectData[0].ProfileEnd = this.primData.ProfileEnd; - OurPacket.ObjectData[0].Scale = this.primData.Scale; - OurPacket.ObjectData[0].PathCurve = this.primData.PathCurve; - OurPacket.ObjectData[0].ProfileCurve = this.primData.ProfileCurve; - OurPacket.ObjectData[0].ParentID = 0; - OurPacket.ObjectData[0].ProfileHollow = this.primData.ProfileHollow; - //finish off copying rest of shape data - OurPacket.ObjectData[0].PathRadiusOffset = this.primData.PathRadiusOffset; - OurPacket.ObjectData[0].PathRevolutions = this.primData.PathRevolutions; - OurPacket.ObjectData[0].PathTaperX = this.primData.PathTaperX; - OurPacket.ObjectData[0].PathTaperY = this.primData.PathTaperY; - OurPacket.ObjectData[0].PathTwist = this.primData.PathTwist; - OurPacket.ObjectData[0].PathTwistBegin= this.primData.PathTwistBegin; - - RemoteClient.OutPacket(OurPacket); - } - - public void UpdateShape(ObjectShapePacket.ObjectDataBlock addPacket) - { - this.primData.PathBegin = addPacket.PathBegin; - this.primData.PathEnd = addPacket.PathEnd; - this.primData.PathScaleX = addPacket.PathScaleX; - this.primData.PathScaleY = addPacket.PathScaleY; - this.primData.PathShearX = addPacket.PathShearX; - this.primData.PathShearY = addPacket.PathShearY; - this.primData.PathSkew = addPacket.PathSkew; - this.primData.ProfileBegin = addPacket.ProfileBegin; - this.primData.ProfileEnd = addPacket.ProfileEnd; - this.primData.PathCurve = addPacket.PathCurve; - this.primData.ProfileCurve = addPacket.ProfileCurve; - this.primData.ProfileHollow = addPacket.ProfileHollow; - this.primData.PathRadiusOffset = addPacket.PathRadiusOffset; - this.primData.PathRevolutions = addPacket.PathRevolutions; - this.primData.PathTaperX = addPacket.PathTaperX; - this.primData.PathTaperY = addPacket.PathTaperY; - this.primData.PathTwist = addPacket.PathTwist; - this.primData.PathTwistBegin =addPacket.PathTwistBegin; - this.dirtyFlag = true; - } - - 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(); - 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].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].UpdateFlags=32+65536+131072+256+4+8+2048+524288+268435456; - 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; - - PData.PathRadiusOffset = objupdate.ObjectData[0].PathRadiusOffset = addPacket.ObjectData.PathRadiusOffset; - PData.PathRevolutions = objupdate.ObjectData[0].PathRevolutions = addPacket.ObjectData.PathRevolutions; - PData.PathTaperX = objupdate.ObjectData[0].PathTaperX = addPacket.ObjectData.PathTaperX; - PData.PathTaperY = objupdate.ObjectData[0].PathTaperY = addPacket.ObjectData.PathTaperY; - 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]; - 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 void CreateFromStorage(PrimData store) - { - //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.TimeDilation = 64096; - objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1]; - - this.primData = store; - objupdate.ObjectData[0] = new ObjectUpdatePacket.ObjectDataBlock(); - 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].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].UpdateFlags=32+65536+131072+256+4+8+2048+524288+268435456; - 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]; - objupdate.ObjectData[0].OwnerID = this.primData.OwnerID; - objupdate.ObjectData[0].PCode = this.primData.PCode; - objupdate.ObjectData[0].PathBegin = this.primData.PathBegin; - objupdate.ObjectData[0].PathEnd = this.primData.PathEnd; - objupdate.ObjectData[0].PathScaleX = this.primData.PathScaleX; - objupdate.ObjectData[0].PathScaleY = this.primData.PathScaleY; - objupdate.ObjectData[0].PathShearX = this.primData.PathShearX; - objupdate.ObjectData[0].PathShearY = this.primData.PathShearY; - objupdate.ObjectData[0].PathSkew = this.primData.PathSkew; - objupdate.ObjectData[0].ProfileBegin = this.primData.ProfileBegin; - objupdate.ObjectData[0].ProfileEnd = this.primData.ProfileEnd; - objupdate.ObjectData[0].Scale = this.primData.Scale; - objupdate.ObjectData[0].PathCurve = this.primData.PathCurve; - objupdate.ObjectData[0].ProfileCurve = this.primData.ProfileCurve; - objupdate.ObjectData[0].ParentID = 0; - objupdate.ObjectData[0].ProfileHollow = this.primData.ProfileHollow; - //finish off copying rest of shape data - objupdate.ObjectData[0].PathRadiusOffset = this.primData.PathRadiusOffset; - objupdate.ObjectData[0].PathRevolutions = this.primData.PathRevolutions; - objupdate.ObjectData[0].PathTaperX = this.primData.PathTaperX; - objupdate.ObjectData[0].PathTaperY = this.primData.PathTaperY; - objupdate.ObjectData[0].PathTwist = this.primData.PathTwist; - objupdate.ObjectData[0].PathTwistBegin= this.primData.PathTwistBegin; - - objupdate.ObjectData[0].ID = (uint)store.LocalID; - objupdate.ObjectData[0].FullID = store.FullID; - - objupdate.ObjectData[0].ObjectData = new byte[60]; - objupdate.ObjectData[0].ObjectData[46] = 128; - objupdate.ObjectData[0].ObjectData[47] = 63; - LLVector3 pos1= store.Position; - //update position - byte[] pb = pos1.GetBytes(); - Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 0, pb.Length); - - this.uuid = objupdate.ObjectData[0].FullID; - this.localid = objupdate.ObjectData[0].ID; - this.position = pos1; - this.OurPacket = objupdate; - - } - public ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreateImprovedBlock() - { - uint ID = this.localid; - byte[] bytes = new byte[60]; - - int i = 0; - ImprovedTerseObjectUpdatePacket.ObjectDataBlock dat = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock(); - dat.TextureEntry = this.OurPacket.ObjectData[0].TextureEntry; - - bytes[i++] = (byte)(ID % 256); - bytes[i++] = (byte)((ID >> 8) % 256); - bytes[i++] = (byte)((ID >> 16) % 256); - bytes[i++] = (byte)((ID >> 24) % 256); - bytes[i++]= 0; - bytes[i++]= 0; - - LLVector3 lPos; - if( this._physActor != null && this.physicsEnabled) - { - PhysicsVector pPos = this._physActor.Position; - lPos = new LLVector3( pPos.X, pPos.Y, pPos.Z); - } - else - { - lPos = this.position; - } - byte[] pb = lPos.GetBytes(); - Array.Copy(pb, 0, bytes, i, pb.Length); - i += 12; - ushort ac = 32767; - - //vel - bytes[i++] = (byte)(ac % 256); - bytes[i++] = (byte)((ac >> 8) % 256); - bytes[i++] = (byte)(ac % 256); - bytes[i++] = (byte)((ac >> 8) % 256); - bytes[i++] = (byte)(ac % 256); - bytes[i++] = (byte)((ac >> 8) % 256); - - //accel - bytes[i++] = (byte)(ac % 256); - bytes[i++] = (byte)((ac >> 8) % 256); - bytes[i++] = (byte)(ac % 256); - bytes[i++] = (byte)((ac >> 8) % 256); - bytes[i++] = (byte)(ac % 256); - bytes[i++] = (byte)((ac >> 8) % 256); - - ushort rw, rx,ry,rz; - rw = (ushort)(32768 * (this.rotation.w+1)); - rx = (ushort)(32768 * (this.rotation.x+1)); - ry = (ushort)(32768 * (this.rotation.y+1)); - rz = (ushort)(32768 * (this.rotation.z+1)); - - //rot - bytes[i++] = (byte)(rx % 256); - bytes[i++] = (byte)((rx >> 8) % 256); - bytes[i++] = (byte)(ry % 256); - bytes[i++] = (byte)((ry >> 8) % 256); - bytes[i++] = (byte)(rz % 256); - bytes[i++] = (byte)((rz >> 8) % 256); - bytes[i++] = (byte)(rw % 256); - bytes[i++] = (byte)((rw >> 8) % 256); - - //rotation vel - bytes[i++] = (byte)(ac % 256); - bytes[i++] = (byte)((ac >> 8) % 256); - bytes[i++] = (byte)(ac % 256); - bytes[i++] = (byte)((ac >> 8) % 256); - bytes[i++] = (byte)(ac % 256); - bytes[i++] = (byte)((ac >> 8) % 256); - - dat.Data=bytes; - return dat; - } - - 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); - } - } - -} diff --git a/src/world/ScriptEngine.cs b/src/world/ScriptEngine.cs deleted file mode 100644 index f20a08e..0000000 --- a/src/world/ScriptEngine.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace OpenSim.world -{ - public class ScriptEngine - { - public ScriptEngine(World env) - { - } - - public void LoadScript() - { - - } - } -} diff --git a/src/world/SurfacePatch.cs b/src/world/SurfacePatch.cs deleted file mode 100644 index 71e4116..0000000 --- a/src/world/SurfacePatch.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace OpenSim.world -{ - public class SurfacePatch - { - public float[] HeightMap; - - public SurfacePatch() { - HeightMap = new float[16*16]; - - int xinc; - int yinc; - for(xinc=0; xinc<16; xinc++) for(yinc=0; yinc<16; yinc++) { - HeightMap[xinc+(yinc*16)]=100.0f; - } - - } - } -} diff --git a/src/world/World.cs b/src/world/World.cs deleted file mode 100644 index e1c84bc..0000000 --- a/src/world/World.cs +++ /dev/null @@ -1,208 +0,0 @@ -using System; -using libsecondlife; -using libsecondlife.Packets; -using System.Collections.Generic; -using System.Text; -using System.Reflection; -using System.IO; -using PhysicsSystem; -using GridInterfaces; - -namespace OpenSim.world -{ - public class World : ILocalStorageReceiver - { - public Dictionary Entities; - public float[] LandMap; - public ScriptEngine Scripts; - public uint _localNumber=0; - private PhysicsScene phyScene; - private float timeStep= 0.1f; - private libsecondlife.TerrainManager TerrainManager; - public ILocalStorage localStorage; - private Random Rand = new Random(); - private uint _primCount = 702000; - private int storageCount; - - public World() - { - ServerConsole.MainConsole.Instance.WriteLine("World.cs - creating new entitities instance"); - Entities = new Dictionary(); - - ServerConsole.MainConsole.Instance.WriteLine("World.cs - creating LandMap"); - TerrainManager = new TerrainManager(new SecondLife()); - Avatar.SetupTemplate("avatar-template.dat"); - // ServerConsole.MainConsole.Instance.WriteLine("World.cs - Creating script engine instance"); - // Initialise this only after the world has loaded - // Scripts = new ScriptEngine(this); - } - - public PhysicsScene PhysScene - { - set - { - this.phyScene = value; - } - get - { - return(this.phyScene); - } - } - - public void Update() - { - if(this.phyScene.IsThreaded) - { - this.phyScene.GetResults(); - - } - - foreach (libsecondlife.LLUUID UUID in Entities.Keys) - { - Entities[UUID].addForces(); - } - - this.phyScene.Simulate(timeStep); - - foreach (libsecondlife.LLUUID UUID in Entities.Keys) - { - Entities[UUID].update(); - } - - //backup world data - this.storageCount++; - if(storageCount> 300) //set to how often you want to backup - { - this.Backup(); - storageCount =0; - } - } - - public bool LoadStorageDLL(string dllName) - { - Assembly pluginAssembly = Assembly.LoadFrom(dllName); - ILocalStorage store = null; - - foreach (Type pluginType in pluginAssembly.GetTypes()) - { - if (pluginType.IsPublic) - { - if (!pluginType.IsAbstract) - { - Type typeInterface = pluginType.GetInterface("ILocalStorage", true); - - if (typeInterface != null) - { - ILocalStorage plug = (ILocalStorage)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); - store = plug; - break; - } - - typeInterface = null; - } - } - } - pluginAssembly = null; - this.localStorage = store; - return(store == null); - } - - public void RegenerateTerrain() - { - HeightmapGenHills hills = new HeightmapGenHills(); - this.LandMap = hills.GenerateHeightmap(200, 4.0f, 80.0f, false); - this.phyScene.SetTerrain(this.LandMap); - OpenSim_Main.cfg.SaveMap(); - - foreach(OpenSimClient client in OpenSim_Main.sim.ClientThreads.Values) { - this.SendLayerData(client); - } - } - public void LoadPrimsFromStorage() - { - ServerConsole.MainConsole.Instance.WriteLine("World.cs: LoadPrimsFromStorage() - Loading primitives"); - this.localStorage.LoadPrimitives(this); - } - - public void PrimFromStorage(PrimData prim) - { - if(prim.LocalID >= this._primCount) - { - _primCount = prim.LocalID + 1; - } - ServerConsole.MainConsole.Instance.WriteLine("World.cs: PrimFromStorage() - Reloading prim (localId "+ prim.LocalID+ " ) from storage"); - Primitive nPrim = new Primitive(); - nPrim.CreateFromStorage(prim); - this.Entities.Add(nPrim.uuid, nPrim); - } - - public void Close() - { - this.localStorage.ShutDown(); - } - - public void SendLayerData(OpenSimClient RemoteClient) { - int[] patches = new int[4]; - - for (int y = 0; y < 16; y++) - { - for (int x = 0; x < 16; x = x + 4) - { - patches[0] = x + 0 + y * 16; - patches[1] = x + 1 + y * 16; - patches[2] = x + 2 + y * 16; - patches[3] = x + 3 + y * 16; - - Packet layerpack = TerrainManager.CreateLandPacket(LandMap, patches); - RemoteClient.OutPacket(layerpack); - } - } - } - - public void GetInitialPrims(OpenSimClient RemoteClient) - { - foreach (libsecondlife.LLUUID UUID in Entities.Keys) - { - if(Entities[UUID].ToString()== "OpenSim.world.Primitive") - { - ((OpenSim.world.Primitive)Entities[UUID]).UpdateClient(RemoteClient); - } - } - } - - public void AddViewerAgent(OpenSimClient AgentClient) { - ServerConsole.MainConsole.Instance.WriteLine("World.cs:AddViewerAgent() - Creating new avatar for remote viewer agent"); - Avatar NewAvatar = new Avatar(AgentClient); - ServerConsole.MainConsole.Instance.WriteLine("World.cs:AddViewerAgent() - Adding new avatar to world"); - ServerConsole.MainConsole.Instance.WriteLine("World.cs:AddViewerAgent() - Starting RegionHandshake "); - NewAvatar.SendRegionHandshake(this); - PhysicsVector pVec = new PhysicsVector(NewAvatar.position.X, NewAvatar.position.Y, NewAvatar.position.Z); - NewAvatar.PhysActor = this.phyScene.AddAvatar(pVec); - 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); - PhysicsVector pVec = new PhysicsVector(prim.position.X, prim.position.Y, prim.position.Z); - PhysicsVector pSize = new PhysicsVector( 0.25f, 0.25f, 0.25f); - //prim.PhysActor = this.phyScene.AddPrim(pVec, pSize ); - //prim.PhysicsEnabled = true; - this.Entities.Add(prim.uuid, prim); - this._primCount++; - } - - public bool Backup() { - /* TODO: Save the current world entities state. */ - ServerConsole.MainConsole.Instance.WriteLine("World.cs: Backup() - Backing up Primitives"); - foreach (libsecondlife.LLUUID UUID in Entities.Keys) - { - Entities[UUID].BackUp(); - } - return true; - } - - } -} diff --git a/src/world/scripting/IScript.cs b/src/world/scripting/IScript.cs deleted file mode 100644 index 550594d..0000000 --- a/src/world/scripting/IScript.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace OpenSim.world.scripting -{ - public interface IScriptHost { - bool Register(IScript iscript); - } - public interface IScript - { - string Name{get;set;} - IScriptHost Host{get;set;} - void Show(); - } -} -- cgit v1.1