From 06387d0344b8fa84b790a9dd910fda8a0a1128bb Mon Sep 17 00:00:00 2001 From: MW Date: Sat, 26 May 2007 14:55:17 +0000 Subject: Goodbye World --- .../OpenSim.RegionServer.csproj | 57 +- .../OpenSim.RegionServer.csproj.user | 2 +- OpenSim/OpenSim.RegionServer/types/Mesh.cs | 28 - OpenSim/OpenSim.RegionServer/types/Triangle.cs | 28 - .../OpenSim.RegionServer/world/Avatar.Client.cs | 33 -- .../OpenSim.RegionServer/world/Avatar.Update.cs | 76 --- OpenSim/OpenSim.RegionServer/world/Avatar.cs | 157 ----- .../OpenSim.RegionServer/world/AvatarAnimations.cs | 163 ----- OpenSim/OpenSim.RegionServer/world/Entity.cs | 124 ---- OpenSim/OpenSim.RegionServer/world/Primitive.cs | 17 - OpenSim/OpenSim.RegionServer/world/Primitive2.cs | 491 --------------- OpenSim/OpenSim.RegionServer/world/SceneObject.cs | 77 --- .../world/World.PacketHandlers.cs | 261 -------- .../OpenSim.RegionServer/world/World.Scripting.cs | 124 ---- OpenSim/OpenSim.RegionServer/world/World.cs | 658 --------------------- OpenSim/OpenSim.RegionServer/world/WorldBase.cs | 176 ------ .../world/scripting/IScriptContext.cs | 13 - .../world/scripting/IScriptEntity.cs | 19 - .../world/scripting/IScriptHandler.cs | 98 --- .../OpenSim.RegionServer/world/scripting/Script.cs | 26 - .../world/scripting/ScriptFactory.cs | 8 - .../world/scripting/Scripts/FollowRandomAvatar.cs | 37 -- 22 files changed, 28 insertions(+), 2645 deletions(-) delete mode 100644 OpenSim/OpenSim.RegionServer/types/Mesh.cs delete mode 100644 OpenSim/OpenSim.RegionServer/types/Triangle.cs delete mode 100644 OpenSim/OpenSim.RegionServer/world/Avatar.Client.cs delete mode 100644 OpenSim/OpenSim.RegionServer/world/Avatar.Update.cs delete mode 100644 OpenSim/OpenSim.RegionServer/world/Avatar.cs delete mode 100644 OpenSim/OpenSim.RegionServer/world/AvatarAnimations.cs delete mode 100644 OpenSim/OpenSim.RegionServer/world/Entity.cs delete mode 100644 OpenSim/OpenSim.RegionServer/world/Primitive.cs delete mode 100644 OpenSim/OpenSim.RegionServer/world/Primitive2.cs delete mode 100644 OpenSim/OpenSim.RegionServer/world/SceneObject.cs delete mode 100644 OpenSim/OpenSim.RegionServer/world/World.PacketHandlers.cs delete mode 100644 OpenSim/OpenSim.RegionServer/world/World.Scripting.cs delete mode 100644 OpenSim/OpenSim.RegionServer/world/World.cs delete mode 100644 OpenSim/OpenSim.RegionServer/world/WorldBase.cs delete mode 100644 OpenSim/OpenSim.RegionServer/world/scripting/IScriptContext.cs delete mode 100644 OpenSim/OpenSim.RegionServer/world/scripting/IScriptEntity.cs delete mode 100644 OpenSim/OpenSim.RegionServer/world/scripting/IScriptHandler.cs delete mode 100644 OpenSim/OpenSim.RegionServer/world/scripting/Script.cs delete mode 100644 OpenSim/OpenSim.RegionServer/world/scripting/ScriptFactory.cs delete mode 100644 OpenSim/OpenSim.RegionServer/world/scripting/Scripts/FollowRandomAvatar.cs (limited to 'OpenSim/OpenSim.RegionServer') diff --git a/OpenSim/OpenSim.RegionServer/OpenSim.RegionServer.csproj b/OpenSim/OpenSim.RegionServer/OpenSim.RegionServer.csproj index 08a9e4c..a6bc5ae 100644 --- a/OpenSim/OpenSim.RegionServer/OpenSim.RegionServer.csproj +++ b/OpenSim/OpenSim.RegionServer/OpenSim.RegionServer.csproj @@ -1,4 +1,4 @@ - + Local 8.0.50727 @@ -6,8 +6,7 @@ {632E1BFD-0000-0000-0000-000000000000} Debug AnyCPU - - + OpenSim.RegionServer @@ -16,11 +15,9 @@ IE50 false Library - - + OpenSim.RegionServer - - + @@ -31,8 +28,7 @@ TRACE;DEBUG - - + True 4096 False @@ -41,8 +37,7 @@ False False 4 - - + False @@ -51,8 +46,7 @@ TRACE - - + False 4096 True @@ -61,28 +55,26 @@ False False 4 - - + - + System.dll False - - + System.Xml.dll False - + ..\..\bin\libsecondlife.dll False - + ..\..\bin\Axiom.MathLib.dll False - + ..\..\bin\Db4objects.Db4o.dll False @@ -92,43 +84,43 @@ OpenSim.Terrain.BasicTerrain {2270B8FE-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Framework {8ACA2445-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Framework.Console {A7CD0630-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.GenericConfig.Xml {E88EF749-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Physics.Manager {8BE16150-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Servers {8BB20F0A-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False XMLRPC {8E81D43C-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False @@ -144,7 +136,9 @@ Code - + + Code + Code @@ -160,6 +154,9 @@ Code + + Code + Code @@ -264,4 +261,4 @@ - \ No newline at end of file + diff --git a/OpenSim/OpenSim.RegionServer/OpenSim.RegionServer.csproj.user b/OpenSim/OpenSim.RegionServer/OpenSim.RegionServer.csproj.user index d47d65d..9bfaf67 100644 --- a/OpenSim/OpenSim.RegionServer/OpenSim.RegionServer.csproj.user +++ b/OpenSim/OpenSim.RegionServer/OpenSim.RegionServer.csproj.user @@ -2,7 +2,7 @@ Debug AnyCPU - C:\New Folder\second-life-viewer\opensim-dailys2\opensim15-07\bin\ + C:\New Folder\second-life-viewer\opensim-dailys2\opensim26-05\branches\Sugilite\bin\ 8.0.50727 ProjectFiles 0 diff --git a/OpenSim/OpenSim.RegionServer/types/Mesh.cs b/OpenSim/OpenSim.RegionServer/types/Mesh.cs deleted file mode 100644 index 3e00c91..0000000 --- a/OpenSim/OpenSim.RegionServer/types/Mesh.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace OpenSim.types -{ - // TODO: This will need some performance tuning no doubt. - public class Mesh - { - public List mesh; - - public Mesh() - { - mesh = new List(); - } - - public void AddTri(Triangle tri) - { - mesh.Add(tri); - } - - public static Mesh operator +(Mesh a, Mesh b) - { - a.mesh.AddRange(b.mesh); - return a; - } - } -} diff --git a/OpenSim/OpenSim.RegionServer/types/Triangle.cs b/OpenSim/OpenSim.RegionServer/types/Triangle.cs deleted file mode 100644 index 8dfea6e..0000000 --- a/OpenSim/OpenSim.RegionServer/types/Triangle.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using Axiom.MathLib; - -namespace OpenSim.types -{ - public class Triangle - { - Vector3 a; - Vector3 b; - Vector3 c; - - public Triangle() - { - a = new Vector3(); - b = new Vector3(); - c = new Vector3(); - } - - public Triangle(Vector3 A, Vector3 B, Vector3 C) - { - a = A; - b = B; - c = C; - } - } -} diff --git a/OpenSim/OpenSim.RegionServer/world/Avatar.Client.cs b/OpenSim/OpenSim.RegionServer/world/Avatar.Client.cs deleted file mode 100644 index 7656a89..0000000 --- a/OpenSim/OpenSim.RegionServer/world/Avatar.Client.cs +++ /dev/null @@ -1,33 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using libsecondlife.Packets; - -namespace OpenSim.world -{ - partial class Avatar - { - private List updateList = new List(); - private List interestList = new List(); - - public void SendPacketToViewer(Packet packet) - { - this.ControllingClient.OutPacket(packet); - } - - public void AddTerseUpdateToViewersList(ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock) - { - - } - - public void SendUpdateListToViewer() - { - - } - - private void UpdateInterestList() - { - - } - } -} diff --git a/OpenSim/OpenSim.RegionServer/world/Avatar.Update.cs b/OpenSim/OpenSim.RegionServer/world/Avatar.Update.cs deleted file mode 100644 index 33132cf..0000000 --- a/OpenSim/OpenSim.RegionServer/world/Avatar.Update.cs +++ /dev/null @@ -1,76 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using libsecondlife; -using libsecondlife.Packets; -using OpenSim.Physics.Manager; - -namespace OpenSim.world -{ - partial class Avatar - { - public override void update() - { - - - } - - public void SendUpdateToOtherClient(Avatar remoteAvatar) - { - - } - - public ObjectUpdatePacket CreateUpdatePacket() - { - - } - - public void SendInitialPosition() - { - - } - - public void SendOurAppearance() - { - - } - - public void SendOurAppearance(ClientView OurClient) - { - - } - - public void SendAppearanceToOtherAgent(Avatar avatarInfo) - { - - } - - public void SetAppearance(byte[] texture, AgentSetAppearancePacket.VisualParamBlock[] visualParam) - { - - } - - public void StopMovement() - { - - } - - public ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreateTerseBlock() - { - - } - - // Sends animation update - public void SendAnimPack(LLUUID animID, int seq) - { - - - } - - public void SendAnimPack() - { - - } - - } -} diff --git a/OpenSim/OpenSim.RegionServer/world/Avatar.cs b/OpenSim/OpenSim.RegionServer/world/Avatar.cs deleted file mode 100644 index cca266b..0000000 --- a/OpenSim/OpenSim.RegionServer/world/Avatar.cs +++ /dev/null @@ -1,157 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Text; -using libsecondlife; -using libsecondlife.Packets; -using OpenSim.Physics.Manager; -using OpenSim.Framework.Inventory; -using OpenSim.Framework.Interfaces; -using Axiom.MathLib; - -namespace OpenSim.world -{ - public partial class Avatar : Entity - { - public static bool PhysicsEngineFlying = false; - public static AvatarAnimations Animations; - public string firstname; - public string lastname; - public ClientView ControllingClient; - public LLUUID current_anim; - public int anim_seq; - private static libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock AvatarTemplate; - private bool updateflag = false; - private byte movementflag = 0; - private List forcesList = new List(); - private short _updateCount = 0; - private Axiom.MathLib.Quaternion bodyRot; - private LLObject.TextureEntry avatarAppearanceTexture = null; - private byte[] visualParams; - private AvatarWearable[] Wearables; - private LLVector3 positionLastFrame = new LLVector3(0, 0, 0); - private ulong m_regionHandle; - //private Dictionary m_clientThreads; - private string m_regionName; - private ushort m_regionWaterHeight; - private bool m_regionTerraform; - private bool childAvatar = false; - - public Avatar(ClientView TheClient, World world, string regionName, Dictionary clientThreads, ulong regionHandle, bool regionTerraform, ushort regionWater) - { - m_world = world; - // m_clientThreads = clientThreads; - m_regionName = regionName; - m_regionHandle = regionHandle; - m_regionTerraform = regionTerraform; - m_regionWaterHeight = regionWater; - - OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Avatar.cs - Loading details from grid (DUMMY)"); - ControllingClient = TheClient; - localid = 8880000 + (this.m_world._localNumber++); - Pos = ControllingClient.startpos; - visualParams = new byte[218]; - for (int i = 0; i < 218; i++) - { - visualParams[i] = 100; - } - Wearables = new AvatarWearable[13]; //should be 13 of these - for (int i = 0; i < 13; i++) - { - Wearables[i] = new AvatarWearable(); - } - this.Wearables[0].AssetID = new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73"); - this.Wearables[0].ItemID = LLUUID.Random(); - - this.avatarAppearanceTexture = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-5005-000000000005")); - - //register for events - ControllingClient.OnRequestWearables += new ClientView.GenericCall(this.SendOurAppearance); - ControllingClient.OnSetAppearance += new SetAppearance(this.SetAppearance); - ControllingClient.OnCompleteMovementToRegion += new ClientView.GenericCall2(this.CompleteMovement); - ControllingClient.OnCompleteMovementToRegion += new ClientView.GenericCall2(this.SendInitialPosition); - ControllingClient.OnAgentUpdate += new ClientView.GenericCall3(this.HandleAgentUpdate); - ControllingClient.OnStartAnim += new StartAnim(this.SendAnimPack); - ControllingClient.OnChildAgentStatus += new ClientView.StatusChange(this.ChildStatusChange); - ControllingClient.OnStopMovement += new ClientView.GenericCall2(this.StopMovement); - } - - public PhysicsActor PhysActor - { - set - { - this._physActor = value; - } - get - { - return _physActor; - } - } - - public void ChildStatusChange(bool status) - { - - } - - public override void addForces() - { - - } - - public static void SetupTemplate(string name) - { - - } - - protected static void SetDefaultPacketValues(ObjectUpdatePacket.ObjectDataBlock objdata) - { - - - - } - - public void CompleteMovement() - { - - } - - public void HandleAgentUpdate(Packet pack) - { - this.HandleUpdate((AgentUpdatePacket)pack); - } - - public void HandleUpdate(AgentUpdatePacket pack) - { - - } - - //really really should be moved somewhere else (RegionInfo.cs ?) - public void SendRegionHandshake(World regionInfo) - { - - } - - public static void LoadAnims() - { - - } - - public override void LandRenegerated() - { - - } - } - - public class NewForce - { - public float X; - public float Y; - public float Z; - - public NewForce() - { - - } - } - -} diff --git a/OpenSim/OpenSim.RegionServer/world/AvatarAnimations.cs b/OpenSim/OpenSim.RegionServer/world/AvatarAnimations.cs deleted file mode 100644 index b554af8..0000000 --- a/OpenSim/OpenSim.RegionServer/world/AvatarAnimations.cs +++ /dev/null @@ -1,163 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using libsecondlife; - -namespace OpenSim.world -{ - public class AvatarAnimations - { - - public Dictionary AnimsLLUUID = new Dictionary(); - public Dictionary AnimsNames = new Dictionary(); - - public AvatarAnimations() - { - } - - public void LoadAnims() - { - OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Avatar.cs:LoadAnims() - Loading avatar animations"); - AnimsLLUUID.Add("ANIM_AGENT_AFRAID", new LLUUID("6b61c8e8-4747-0d75-12d7-e49ff207a4ca")); - AnimsLLUUID.Add("ANIM_AGENT_AIM_BAZOOKA_R", new LLUUID("b5b4a67d-0aee-30d2-72cd-77b333e932ef")); - AnimsLLUUID.Add("ANIM_AGENT_AIM_BOW_L", new LLUUID("46bb4359-de38-4ed8-6a22-f1f52fe8f506")); - AnimsLLUUID.Add("ANIM_AGENT_AIM_HANDGUN_R", new LLUUID("3147d815-6338-b932-f011-16b56d9ac18b")); - AnimsLLUUID.Add("ANIM_AGENT_AIM_RIFLE_R", new LLUUID("ea633413-8006-180a-c3ba-96dd1d756720")); - AnimsLLUUID.Add("ANIM_AGENT_ANGRY", new LLUUID("5747a48e-073e-c331-f6f3-7c2149613d3e")); - AnimsLLUUID.Add("ANIM_AGENT_AWAY", new LLUUID("fd037134-85d4-f241-72c6-4f42164fedee")); - AnimsLLUUID.Add("ANIM_AGENT_BACKFLIP", new LLUUID("c4ca6188-9127-4f31-0158-23c4e2f93304")); - AnimsLLUUID.Add("ANIM_AGENT_BELLY_LAUGH", new LLUUID("18b3a4b5-b463-bd48-e4b6-71eaac76c515")); - AnimsLLUUID.Add("ANIM_AGENT_BLOW_KISS", new LLUUID("db84829b-462c-ee83-1e27-9bbee66bd624")); - AnimsLLUUID.Add("ANIM_AGENT_BORED", new LLUUID("b906c4ba-703b-1940-32a3-0c7f7d791510")); - AnimsLLUUID.Add("ANIM_AGENT_BOW", new LLUUID("82e99230-c906-1403-4d9c-3889dd98daba")); - AnimsLLUUID.Add("ANIM_AGENT_BRUSH", new LLUUID("349a3801-54f9-bf2c-3bd0-1ac89772af01")); - AnimsLLUUID.Add("ANIM_AGENT_BUSY", new LLUUID("efcf670c-2d18-8128-973a-034ebc806b67")); - AnimsLLUUID.Add("ANIM_AGENT_CLAP", new LLUUID("9b0c1c4e-8ac7-7969-1494-28c874c4f668")); - AnimsLLUUID.Add("ANIM_AGENT_COURTBOW", new LLUUID("9ba1c942-08be-e43a-fb29-16ad440efc50")); - AnimsLLUUID.Add("ANIM_AGENT_CROUCH", new LLUUID("201f3fdf-cb1f-dbec-201f-7333e328ae7c")); - AnimsLLUUID.Add("ANIM_AGENT_CROUCHWALK", new LLUUID("47f5f6fb-22e5-ae44-f871-73aaaf4a6022")); - AnimsLLUUID.Add("ANIM_AGENT_CRY", new LLUUID("92624d3e-1068-f1aa-a5ec-8244585193ed")); - AnimsLLUUID.Add("ANIM_AGENT_CUSTOMIZE", new LLUUID("038fcec9-5ebd-8a8e-0e2e-6e71a0a1ac53")); - AnimsLLUUID.Add("ANIM_AGENT_CUSTOMIZE_DONE", new LLUUID("6883a61a-b27b-5914-a61e-dda118a9ee2c")); - AnimsLLUUID.Add("ANIM_AGENT_DANCE1", new LLUUID("b68a3d7c-de9e-fc87-eec8-543d787e5b0d")); - AnimsLLUUID.Add("ANIM_AGENT_DANCE2", new LLUUID("928cae18-e31d-76fd-9cc9-2f55160ff818")); - AnimsLLUUID.Add("ANIM_AGENT_DANCE3", new LLUUID("30047778-10ea-1af7-6881-4db7a3a5a114")); - AnimsLLUUID.Add("ANIM_AGENT_DANCE4", new LLUUID("951469f4-c7b2-c818-9dee-ad7eea8c30b7")); - AnimsLLUUID.Add("ANIM_AGENT_DANCE5", new LLUUID("4bd69a1d-1114-a0b4-625f-84e0a5237155")); - AnimsLLUUID.Add("ANIM_AGENT_DANCE6", new LLUUID("cd28b69b-9c95-bb78-3f94-8d605ff1bb12")); - AnimsLLUUID.Add("ANIM_AGENT_DANCE7", new LLUUID("a54d8ee2-28bb-80a9-7f0c-7afbbe24a5d6")); - AnimsLLUUID.Add("ANIM_AGENT_DANCE8", new LLUUID("b0dc417c-1f11-af36-2e80-7e7489fa7cdc")); - AnimsLLUUID.Add("ANIM_AGENT_DEAD", new LLUUID("57abaae6-1d17-7b1b-5f98-6d11a6411276")); - AnimsLLUUID.Add("ANIM_AGENT_DRINK", new LLUUID("0f86e355-dd31-a61c-fdb0-3a96b9aad05f")); - AnimsLLUUID.Add("ANIM_AGENT_EMBARRASSED", new LLUUID("514af488-9051-044a-b3fc-d4dbf76377c6")); - AnimsLLUUID.Add("ANIM_AGENT_EXPRESS_AFRAID", new LLUUID("aa2df84d-cf8f-7218-527b-424a52de766e")); - AnimsLLUUID.Add("ANIM_AGENT_EXPRESS_ANGER", new LLUUID("1a03b575-9634-b62a-5767-3a679e81f4de")); - AnimsLLUUID.Add("ANIM_AGENT_EXPRESS_BORED", new LLUUID("214aa6c1-ba6a-4578-f27c-ce7688f61d0d")); - AnimsLLUUID.Add("ANIM_AGENT_EXPRESS_CRY", new LLUUID("d535471b-85bf-3b4d-a542-93bea4f59d33")); - AnimsLLUUID.Add("ANIM_AGENT_EXPRESS_DISDAIN", new LLUUID("d4416ff1-09d3-300f-4183-1b68a19b9fc1")); - AnimsLLUUID.Add("ANIM_AGENT_EXPRESS_EMBARRASSED", new LLUUID("0b8c8211-d78c-33e8-fa28-c51a9594e424")); - AnimsLLUUID.Add("ANIM_AGENT_EXPRESS_FROWN", new LLUUID("fee3df48-fa3d-1015-1e26-a205810e3001")); - AnimsLLUUID.Add("ANIM_AGENT_EXPRESS_KISS", new LLUUID("1e8d90cc-a84e-e135-884c-7c82c8b03a14")); - AnimsLLUUID.Add("ANIM_AGENT_EXPRESS_LAUGH", new LLUUID("62570842-0950-96f8-341c-809e65110823")); - AnimsLLUUID.Add("ANIM_AGENT_EXPRESS_OPEN_MOUTH", new LLUUID("d63bc1f9-fc81-9625-a0c6-007176d82eb7")); - AnimsLLUUID.Add("ANIM_AGENT_EXPRESS_REPULSED", new LLUUID("f76cda94-41d4-a229-2872-e0296e58afe1")); - AnimsLLUUID.Add("ANIM_AGENT_EXPRESS_SAD", new LLUUID("eb6ebfb2-a4b3-a19c-d388-4dd5c03823f7")); - AnimsLLUUID.Add("ANIM_AGENT_EXPRESS_SHRUG", new LLUUID("a351b1bc-cc94-aac2-7bea-a7e6ebad15ef")); - AnimsLLUUID.Add("ANIM_AGENT_EXPRESS_SMILE", new LLUUID("b7c7c833-e3d3-c4e3-9fc0-131237446312")); - AnimsLLUUID.Add("ANIM_AGENT_EXPRESS_SURPRISE", new LLUUID("728646d9-cc79-08b2-32d6-937f0a835c24")); - AnimsLLUUID.Add("ANIM_AGENT_EXPRESS_TONGUE_OUT", new LLUUID("835965c6-7f2f-bda2-5deb-2478737f91bf")); - AnimsLLUUID.Add("ANIM_AGENT_EXPRESS_TOOTHSMILE", new LLUUID("b92ec1a5-e7ce-a76b-2b05-bcdb9311417e")); - AnimsLLUUID.Add("ANIM_AGENT_EXPRESS_WINK", new LLUUID("da020525-4d94-59d6-23d7-81fdebf33148")); - AnimsLLUUID.Add("ANIM_AGENT_EXPRESS_WORRY", new LLUUID("9c05e5c7-6f07-6ca4-ed5a-b230390c3950")); - AnimsLLUUID.Add("ANIM_AGENT_FALLDOWN", new LLUUID("666307d9-a860-572d-6fd4-c3ab8865c094")); - AnimsLLUUID.Add("ANIM_AGENT_FEMALE_WALK", new LLUUID("f5fc7433-043d-e819-8298-f519a119b688")); - AnimsLLUUID.Add("ANIM_AGENT_FINGER_WAG", new LLUUID("c1bc7f36-3ba0-d844-f93c-93be945d644f")); - AnimsLLUUID.Add("ANIM_AGENT_FIST_PUMP", new LLUUID("7db00ccd-f380-f3ee-439d-61968ec69c8a")); - AnimsLLUUID.Add("ANIM_AGENT_FLY", new LLUUID("aec4610c-757f-bc4e-c092-c6e9caf18daf")); - AnimsLLUUID.Add("ANIM_AGENT_FLYSLOW", new LLUUID("2b5a38b2-5e00-3a97-a495-4c826bc443e6")); - AnimsLLUUID.Add("ANIM_AGENT_HELLO", new LLUUID("9b29cd61-c45b-5689-ded2-91756b8d76a9")); - AnimsLLUUID.Add("ANIM_AGENT_HOLD_BAZOOKA_R", new LLUUID("ef62d355-c815-4816-2474-b1acc21094a6")); - AnimsLLUUID.Add("ANIM_AGENT_HOLD_BOW_L", new LLUUID("8b102617-bcba-037b-86c1-b76219f90c88")); - AnimsLLUUID.Add("ANIM_AGENT_HOLD_HANDGUN_R", new LLUUID("efdc1727-8b8a-c800-4077-975fc27ee2f2")); - AnimsLLUUID.Add("ANIM_AGENT_HOLD_RIFLE_R", new LLUUID("3d94bad0-c55b-7dcc-8763-033c59405d33")); - AnimsLLUUID.Add("ANIM_AGENT_HOLD_THROW_R", new LLUUID("7570c7b5-1f22-56dd-56ef-a9168241bbb6")); - AnimsLLUUID.Add("ANIM_AGENT_HOVER", new LLUUID("4ae8016b-31b9-03bb-c401-b1ea941db41d")); - AnimsLLUUID.Add("ANIM_AGENT_HOVER_DOWN", new LLUUID("20f063ea-8306-2562-0b07-5c853b37b31e")); - AnimsLLUUID.Add("ANIM_AGENT_HOVER_UP", new LLUUID("62c5de58-cb33-5743-3d07-9e4cd4352864")); - AnimsLLUUID.Add("ANIM_AGENT_IMPATIENT", new LLUUID("5ea3991f-c293-392e-6860-91dfa01278a3")); - AnimsLLUUID.Add("ANIM_AGENT_JUMP", new LLUUID("2305bd75-1ca9-b03b-1faa-b176b8a8c49e")); - AnimsLLUUID.Add("ANIM_AGENT_JUMP_FOR_JOY", new LLUUID("709ea28e-1573-c023-8bf8-520c8bc637fa")); - AnimsLLUUID.Add("ANIM_AGENT_KISS_MY_BUTT", new LLUUID("19999406-3a3a-d58c-a2ac-d72e555dcf51")); - AnimsLLUUID.Add("ANIM_AGENT_LAND", new LLUUID("7a17b059-12b2-41b1-570a-186368b6aa6f")); - AnimsLLUUID.Add("ANIM_AGENT_LAUGH_SHORT", new LLUUID("ca5b3f14-3194-7a2b-c894-aa699b718d1f")); - AnimsLLUUID.Add("ANIM_AGENT_MEDIUM_LAND", new LLUUID("f4f00d6e-b9fe-9292-f4cb-0ae06ea58d57")); - AnimsLLUUID.Add("ANIM_AGENT_MOTORCYCLE_SIT", new LLUUID("08464f78-3a8e-2944-cba5-0c94aff3af29")); - AnimsLLUUID.Add("ANIM_AGENT_MUSCLE_BEACH", new LLUUID("315c3a41-a5f3-0ba4-27da-f893f769e69b")); - AnimsLLUUID.Add("ANIM_AGENT_NO", new LLUUID("5a977ed9-7f72-44e9-4c4c-6e913df8ae74")); - AnimsLLUUID.Add("ANIM_AGENT_NO_UNHAPPY", new LLUUID("d83fa0e5-97ed-7eb2-e798-7bd006215cb4")); - AnimsLLUUID.Add("ANIM_AGENT_NYAH_NYAH", new LLUUID("f061723d-0a18-754f-66ee-29a44795a32f")); - AnimsLLUUID.Add("ANIM_AGENT_ONETWO_PUNCH", new LLUUID("eefc79be-daae-a239-8c04-890f5d23654a")); - AnimsLLUUID.Add("ANIM_AGENT_PEACE", new LLUUID("b312b10e-65ab-a0a4-8b3c-1326ea8e3ed9")); - AnimsLLUUID.Add("ANIM_AGENT_POINT_ME", new LLUUID("17c024cc-eef2-f6a0-3527-9869876d7752")); - AnimsLLUUID.Add("ANIM_AGENT_POINT_YOU", new LLUUID("ec952cca-61ef-aa3b-2789-4d1344f016de")); - AnimsLLUUID.Add("ANIM_AGENT_PRE_JUMP", new LLUUID("7a4e87fe-de39-6fcb-6223-024b00893244")); - AnimsLLUUID.Add("ANIM_AGENT_PUNCH_LEFT", new LLUUID("f3300ad9-3462-1d07-2044-0fef80062da0")); - AnimsLLUUID.Add("ANIM_AGENT_PUNCH_RIGHT", new LLUUID("c8e42d32-7310-6906-c903-cab5d4a34656")); - AnimsLLUUID.Add("ANIM_AGENT_REPULSED", new LLUUID("36f81a92-f076-5893-dc4b-7c3795e487cf")); - AnimsLLUUID.Add("ANIM_AGENT_ROUNDHOUSE_KICK", new LLUUID("49aea43b-5ac3-8a44-b595-96100af0beda")); - AnimsLLUUID.Add("ANIM_AGENT_RPS_COUNTDOWN", new LLUUID("35db4f7e-28c2-6679-cea9-3ee108f7fc7f")); - AnimsLLUUID.Add("ANIM_AGENT_RPS_PAPER", new LLUUID("0836b67f-7f7b-f37b-c00a-460dc1521f5a")); - AnimsLLUUID.Add("ANIM_AGENT_RPS_ROCK", new LLUUID("42dd95d5-0bc6-6392-f650-777304946c0f")); - AnimsLLUUID.Add("ANIM_AGENT_RPS_SCISSORS", new LLUUID("16803a9f-5140-e042-4d7b-d28ba247c325")); - AnimsLLUUID.Add("ANIM_AGENT_RUN", new LLUUID("05ddbff8-aaa9-92a1-2b74-8fe77a29b445")); - AnimsLLUUID.Add("ANIM_AGENT_SAD", new LLUUID("0eb702e2-cc5a-9a88-56a5-661a55c0676a")); - AnimsLLUUID.Add("ANIM_AGENT_SALUTE", new LLUUID("cd7668a6-7011-d7e2-ead8-fc69eff1a104")); - AnimsLLUUID.Add("ANIM_AGENT_SHOOT_BOW_L", new LLUUID("e04d450d-fdb5-0432-fd68-818aaf5935f8")); - AnimsLLUUID.Add("ANIM_AGENT_SHOUT", new LLUUID("6bd01860-4ebd-127a-bb3d-d1427e8e0c42")); - AnimsLLUUID.Add("ANIM_AGENT_SHRUG", new LLUUID("70ea714f-3a97-d742-1b01-590a8fcd1db5")); - AnimsLLUUID.Add("ANIM_AGENT_SIT", new LLUUID("1a5fe8ac-a804-8a5d-7cbd-56bd83184568")); - AnimsLLUUID.Add("ANIM_AGENT_SIT_FEMALE", new LLUUID("b1709c8d-ecd3-54a1-4f28-d55ac0840782")); - AnimsLLUUID.Add("ANIM_AGENT_SIT_GENERIC", new LLUUID("245f3c54-f1c0-bf2e-811f-46d8eeb386e7")); - AnimsLLUUID.Add("ANIM_AGENT_SIT_GROUND", new LLUUID("1c7600d6-661f-b87b-efe2-d7421eb93c86")); - AnimsLLUUID.Add("ANIM_AGENT_SIT_GROUND_CONSTRAINED", new LLUUID("1a2bd58e-87ff-0df8-0b4c-53e047b0bb6e")); - AnimsLLUUID.Add("ANIM_AGENT_SIT_TO_STAND", new LLUUID("a8dee56f-2eae-9e7a-05a2-6fb92b97e21e")); - AnimsLLUUID.Add("ANIM_AGENT_SLEEP", new LLUUID("f2bed5f9-9d44-39af-b0cd-257b2a17fe40")); - AnimsLLUUID.Add("ANIM_AGENT_SMOKE_IDLE", new LLUUID("d2f2ee58-8ad1-06c9-d8d3-3827ba31567a")); - AnimsLLUUID.Add("ANIM_AGENT_SMOKE_INHALE", new LLUUID("6802d553-49da-0778-9f85-1599a2266526")); - AnimsLLUUID.Add("ANIM_AGENT_SMOKE_THROW_DOWN", new LLUUID("0a9fb970-8b44-9114-d3a9-bf69cfe804d6")); - AnimsLLUUID.Add("ANIM_AGENT_SNAPSHOT", new LLUUID("eae8905b-271a-99e2-4c0e-31106afd100c")); - AnimsLLUUID.Add("ANIM_AGENT_STAND", new LLUUID("2408fe9e-df1d-1d7d-f4ff-1384fa7b350f")); - AnimsLLUUID.Add("ANIM_AGENT_STANDUP", new LLUUID("3da1d753-028a-5446-24f3-9c9b856d9422")); - AnimsLLUUID.Add("ANIM_AGENT_STAND_1", new LLUUID("15468e00-3400-bb66-cecc-646d7c14458e")); - AnimsLLUUID.Add("ANIM_AGENT_STAND_2", new LLUUID("370f3a20-6ca6-9971-848c-9a01bc42ae3c")); - AnimsLLUUID.Add("ANIM_AGENT_STAND_3", new LLUUID("42b46214-4b44-79ae-deb8-0df61424ff4b")); - AnimsLLUUID.Add("ANIM_AGENT_STAND_4", new LLUUID("f22fed8b-a5ed-2c93-64d5-bdd8b93c889f")); - AnimsLLUUID.Add("ANIM_AGENT_STRETCH", new LLUUID("80700431-74ec-a008-14f8-77575e73693f")); - AnimsLLUUID.Add("ANIM_AGENT_STRIDE", new LLUUID("1cb562b0-ba21-2202-efb3-30f82cdf9595")); - AnimsLLUUID.Add("ANIM_AGENT_SURF", new LLUUID("41426836-7437-7e89-025d-0aa4d10f1d69")); - AnimsLLUUID.Add("ANIM_AGENT_SURPRISE", new LLUUID("313b9881-4302-73c0-c7d0-0e7a36b6c224")); - AnimsLLUUID.Add("ANIM_AGENT_SWORD_STRIKE", new LLUUID("85428680-6bf9-3e64-b489-6f81087c24bd")); - AnimsLLUUID.Add("ANIM_AGENT_TALK", new LLUUID("5c682a95-6da4-a463-0bf6-0f5b7be129d1")); - AnimsLLUUID.Add("ANIM_AGENT_TANTRUM", new LLUUID("11000694-3f41-adc2-606b-eee1d66f3724")); - AnimsLLUUID.Add("ANIM_AGENT_THROW_R", new LLUUID("aa134404-7dac-7aca-2cba-435f9db875ca")); - AnimsLLUUID.Add("ANIM_AGENT_TRYON_SHIRT", new LLUUID("83ff59fe-2346-f236-9009-4e3608af64c1")); - AnimsLLUUID.Add("ANIM_AGENT_TURNLEFT", new LLUUID("56e0ba0d-4a9f-7f27-6117-32f2ebbf6135")); - AnimsLLUUID.Add("ANIM_AGENT_TURNRIGHT", new LLUUID("2d6daa51-3192-6794-8e2e-a15f8338ec30")); - AnimsLLUUID.Add("ANIM_AGENT_TYPE", new LLUUID("c541c47f-e0c0-058b-ad1a-d6ae3a4584d9")); - AnimsLLUUID.Add("ANIM_AGENT_WALK", new LLUUID("6ed24bd8-91aa-4b12-ccc7-c97c857ab4e0")); - AnimsLLUUID.Add("ANIM_AGENT_WHISPER", new LLUUID("7693f268-06c7-ea71-fa21-2b30d6533f8f")); - AnimsLLUUID.Add("ANIM_AGENT_WHISTLE", new LLUUID("b1ed7982-c68e-a982-7561-52a88a5298c0")); - AnimsLLUUID.Add("ANIM_AGENT_WINK", new LLUUID("869ecdad-a44b-671e-3266-56aef2e3ac2e")); - AnimsLLUUID.Add("ANIM_AGENT_WINK_HOLLYWOOD", new LLUUID("c0c4030f-c02b-49de-24ba-2331f43fe41c")); - AnimsLLUUID.Add("ANIM_AGENT_WORRY", new LLUUID("9f496bd2-589a-709f-16cc-69bf7df1d36c")); - AnimsLLUUID.Add("ANIM_AGENT_YES", new LLUUID("15dd911d-be82-2856-26db-27659b142875")); - AnimsLLUUID.Add("ANIM_AGENT_YES_HAPPY", new LLUUID("b8c8b2a3-9008-1771-3bfc-90924955ab2d")); - AnimsLLUUID.Add("ANIM_AGENT_YOGA_FLOAT", new LLUUID("42ecd00b-9947-a97c-400a-bbc9174c7aeb")); - - foreach (KeyValuePair kp in OpenSim.world.Avatar.Animations.AnimsLLUUID) - { - AnimsNames.Add(kp.Value, kp.Key); - } - } - } -} diff --git a/OpenSim/OpenSim.RegionServer/world/Entity.cs b/OpenSim/OpenSim.RegionServer/world/Entity.cs deleted file mode 100644 index 96e039a..0000000 --- a/OpenSim/OpenSim.RegionServer/world/Entity.cs +++ /dev/null @@ -1,124 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using Axiom.MathLib; -using OpenSim.Physics.Manager; -using OpenSim.types; -using libsecondlife; -using OpenSim.RegionServer.world.scripting; - -namespace OpenSim.world -{ - public abstract class Entity : IScriptReadonlyEntity - { - public libsecondlife.LLUUID uuid; - public uint localid; - public LLVector3 velocity; - public Quaternion rotation; - protected List children; - - protected string m_name; - public virtual string Name - { - get { return m_name; } - } - - protected LLVector3 m_pos; - protected PhysicsActor _physActor; - protected World m_world; - - public virtual LLVector3 Pos - { - get - { - if (this._physActor != null) - { - m_pos.X = _physActor.Position.X; - m_pos.Y = _physActor.Position.Y; - m_pos.Z = _physActor.Position.Z; - } - - return m_pos; - } - set - { - if (this._physActor != null) - { - try - { - lock (this.m_world.LockPhysicsEngine) - { - - this._physActor.Position = new PhysicsVector(value.X, value.Y, value.Z); - } - } - catch (Exception e) - { - Console.WriteLine(e.Message); - } - } - - m_pos = value; - } - } - - /// - /// Creates a new Entity (should not occur on it's own) - /// - public Entity() - { - uuid = new libsecondlife.LLUUID(); - localid = 0; - m_pos = new LLVector3(); - velocity = new LLVector3(); - rotation = new Quaternion(); - m_name = "(basic entity)"; - children = new List(); - } - - public virtual void addForces() - { - foreach (Entity child in children) - { - child.addForces(); - } - } - - /// - /// Performs any updates that need to be done at each frame. This function is overridable from it's children. - /// - 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(); - } - } - - /// - /// Returns a mesh for this object and any dependents - /// - /// The mesh of this entity tree - public virtual Mesh getMesh() - { - Mesh mesh = new Mesh(); - - foreach (Entity child in children) - { - mesh += child.getMesh(); - } - - return mesh; - } - - public virtual void BackUp() - { - - } - - public virtual void LandRenegerated() - { - - } - } -} diff --git a/OpenSim/OpenSim.RegionServer/world/Primitive.cs b/OpenSim/OpenSim.RegionServer/world/Primitive.cs deleted file mode 100644 index 433ea9e..0000000 --- a/OpenSim/OpenSim.RegionServer/world/Primitive.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using OpenSim.types; -using libsecondlife; -using libsecondlife.Packets; -using OpenSim.Framework.Interfaces; -using OpenSim.Physics.Manager; -using OpenSim.Framework.Types; - -namespace OpenSim.world -{ - public class Primitive : Entity - { - - } -} diff --git a/OpenSim/OpenSim.RegionServer/world/Primitive2.cs b/OpenSim/OpenSim.RegionServer/world/Primitive2.cs deleted file mode 100644 index 6d071d4..0000000 --- a/OpenSim/OpenSim.RegionServer/world/Primitive2.cs +++ /dev/null @@ -1,491 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using OpenSim.types; -using libsecondlife; -using libsecondlife.Packets; -using OpenSim.Framework.Interfaces; -using OpenSim.Physics.Manager; -using OpenSim.Framework.Types; -using OpenSim.Framework.Inventory; - -namespace OpenSim.world -{ - public class Primitive2 : Entity - { - protected PrimData primData; - //private ObjectUpdatePacket OurPacket; - private LLVector3 positionLastFrame = new LLVector3(0, 0, 0); - private Dictionary m_clientThreads; - private ulong m_regionHandle; - private const uint FULL_MASK_PERMISSIONS = 2147483647; - private bool physicsEnabled = false; - - private Dictionary inventoryItems; - - #region Properties - - public LLVector3 Scale - { - set - { - this.primData.Scale = value; - //this.dirtyFlag = true; - } - get - { - return this.primData.Scale; - } - } - - public PhysicsActor PhysActor - { - set - { - this._physActor = value; - } - } - public override LLVector3 Pos - { - get - { - return base.Pos; - } - set - { - base.Pos = value; - } - } - #endregion - - public Primitive2(Dictionary clientThreads, ulong regionHandle, World world) - { - m_clientThreads = clientThreads; - m_regionHandle = regionHandle; - m_world = world; - inventoryItems = new Dictionary(); - } - - public Primitive2(Dictionary clientThreads, ulong regionHandle, World world, LLUUID owner) - { - m_clientThreads = clientThreads; - m_regionHandle = regionHandle; - m_world = world; - inventoryItems = new Dictionary(); - this.primData = new PrimData(); - this.primData.CreationDate = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; - this.primData.OwnerID = owner; - } - - public byte[] GetByteArray() - { - byte[] result = null; - List dataArrays = new List(); - dataArrays.Add(primData.ToBytes()); - foreach (Entity child in children) - { - if (child is OpenSim.world.Primitive2) - { - dataArrays.Add(((OpenSim.world.Primitive2)child).GetByteArray()); - } - } - byte[] primstart = Helpers.StringToField(""); - byte[] primend = Helpers.StringToField(""); - int totalLength = primstart.Length + primend.Length; - for (int i = 0; i < dataArrays.Count; i++) - { - totalLength += dataArrays[i].Length; - } - - result = new byte[totalLength]; - int arraypos = 0; - Array.Copy(primstart, 0, result, 0, primstart.Length); - arraypos += primstart.Length; - for (int i = 0; i < dataArrays.Count; i++) - { - Array.Copy(dataArrays[i], 0, result, arraypos, dataArrays[i].Length); - arraypos += dataArrays[i].Length; - } - Array.Copy(primend, 0, result, arraypos, primend.Length); - - return result; - } - - #region Overridden Methods - - public override void update() - { - LLVector3 pos2 = new LLVector3(0, 0, 0); - } - - public override void BackUp() - { - - } - - #endregion - - #region Packet handlers - - public void UpdatePosition(LLVector3 pos) - { - - } - - 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; - } - - public void UpdateTexture(byte[] tex) - { - this.primData.Texture = tex; - //this.dirtyFlag = true; - } - - public void UpdateObjectFlags(ObjectFlagUpdatePacket pack) - { - - } - - public void AssignToParent(Primitive prim) - { - - } - - public void GetProperites(ClientView client) - { - ObjectPropertiesPacket proper = new ObjectPropertiesPacket(); - proper.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[1]; - proper.ObjectData[0] = new ObjectPropertiesPacket.ObjectDataBlock(); - proper.ObjectData[0].ItemID = LLUUID.Zero; - proper.ObjectData[0].CreationDate = (ulong)this.primData.CreationDate; - proper.ObjectData[0].CreatorID = this.primData.OwnerID; - proper.ObjectData[0].FolderID = LLUUID.Zero; - proper.ObjectData[0].FromTaskID = LLUUID.Zero; - proper.ObjectData[0].GroupID = LLUUID.Zero; - proper.ObjectData[0].InventorySerial = 0; - proper.ObjectData[0].LastOwnerID = LLUUID.Zero; - proper.ObjectData[0].ObjectID = this.uuid; - proper.ObjectData[0].OwnerID = primData.OwnerID; - proper.ObjectData[0].TouchName = new byte[0]; - proper.ObjectData[0].TextureID = new byte[0]; - proper.ObjectData[0].SitName = new byte[0]; - proper.ObjectData[0].Name = new byte[0]; - proper.ObjectData[0].Description = new byte[0]; - proper.ObjectData[0].OwnerMask = this.primData.OwnerMask; - proper.ObjectData[0].NextOwnerMask = this.primData.NextOwnerMask; - proper.ObjectData[0].GroupMask = this.primData.GroupMask; - proper.ObjectData[0].EveryoneMask = this.primData.EveryoneMask; - proper.ObjectData[0].BaseMask = this.primData.BaseMask; - - client.OutPacket(proper); - } - - #endregion - - # region Inventory Methods - - public bool AddToInventory(InventoryItem item) - { - return false; - } - - public InventoryItem RemoveFromInventory(LLUUID itemID) - { - return null; - } - - public void RequestInventoryInfo(ClientView simClient, RequestTaskInventoryPacket packet) - { - - } - - public void RequestXferInventory(ClientView simClient, ulong xferID) - { - //will only currently work if the total size of the inventory data array is under about 1000 bytes - SendXferPacketPacket send = new SendXferPacketPacket(); - - send.XferID.ID = xferID; - send.XferID.Packet = 1 + 2147483648; - send.DataPacket.Data = this.ConvertInventoryToBytes(); - - simClient.OutPacket(send); - } - - public byte[] ConvertInventoryToBytes() - { - System.Text.Encoding enc = System.Text.Encoding.ASCII; - byte[] result = new byte[0]; - List inventoryData = new List(); - int totallength = 0; - foreach (InventoryItem invItem in inventoryItems.Values) - { - byte[] data = enc.GetBytes(invItem.ExportString()); - inventoryData.Add(data); - totallength += data.Length; - } - //TODO: copy arrays into the single result array - - return result; - } - - public void CreateInventoryFromBytes(byte[] data) - { - - } - - #endregion - - #region Update viewers Methods - - //should change these mehtods, so that outgoing packets are sent through the avatar class - public void SendFullUpdateToClient(ClientView 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.Pos; - } - - ObjectUpdatePacket outPacket = new ObjectUpdatePacket(); - outPacket.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1]; - outPacket.ObjectData[0] = this.CreateUpdateBlock(); - byte[] pb = lPos.GetBytes(); - Array.Copy(pb, 0, outPacket.ObjectData[0].ObjectData, 0, pb.Length); - - remoteClient.OutPacket(outPacket); - } - - public void SendFullUpdateToAllClients() - { - - } - - public void SendTerseUpdateToClient(ClientView RemoteClient) - { - - } - - public void SendTerseUpdateToALLClients() - { - - } - - #endregion - - #region Create Methods - - public void CreateFromPacket(ObjectAddPacket addPacket, LLUUID ownerID, uint localID) - { - PrimData PData = new PrimData(); - this.primData = PData; - this.primData.CreationDate = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; - - PData.OwnerID = ownerID; - PData.PCode = addPacket.ObjectData.PCode; - PData.PathBegin = addPacket.ObjectData.PathBegin; - PData.PathEnd = addPacket.ObjectData.PathEnd; - PData.PathScaleX = addPacket.ObjectData.PathScaleX; - PData.PathScaleY = addPacket.ObjectData.PathScaleY; - PData.PathShearX = addPacket.ObjectData.PathShearX; - PData.PathShearY = addPacket.ObjectData.PathShearY; - PData.PathSkew = addPacket.ObjectData.PathSkew; - PData.ProfileBegin = addPacket.ObjectData.ProfileBegin; - PData.ProfileEnd = addPacket.ObjectData.ProfileEnd; - PData.Scale = addPacket.ObjectData.Scale; - PData.PathCurve = addPacket.ObjectData.PathCurve; - PData.ProfileCurve = addPacket.ObjectData.ProfileCurve; - PData.ParentID = 0; - PData.ProfileHollow = addPacket.ObjectData.ProfileHollow; - PData.PathRadiusOffset = addPacket.ObjectData.PathRadiusOffset; - PData.PathRevolutions = addPacket.ObjectData.PathRevolutions; - PData.PathTaperX = addPacket.ObjectData.PathTaperX; - PData.PathTaperY = addPacket.ObjectData.PathTaperY; - PData.PathTwist = addPacket.ObjectData.PathTwist; - PData.PathTwistBegin = addPacket.ObjectData.PathTwistBegin; - LLVector3 pos1 = addPacket.ObjectData.RayEnd; - this.primData.FullID = this.uuid = LLUUID.Random(); - this.localid = (uint)(localID); - this.primData.Position = this.Pos = pos1; - } - - public void CreateFromBytes(byte[] data) - { - - } - - public void CreateFromPrimData(PrimData primData) - { - this.CreateFromPrimData(primData, primData.Position, primData.LocalID, false); - } - - public void CreateFromPrimData(PrimData primData, LLVector3 posi, uint localID, bool newprim) - { - - } - - #endregion - - #region Packet Update Methods - protected void SetDefaultPacketValues(ObjectUpdatePacket.ObjectDataBlock objdata) - { - objdata.PSBlock = new byte[0]; - objdata.ExtraParams = new byte[1]; - objdata.MediaURL = new byte[0]; - objdata.NameValue = new byte[0]; - objdata.Text = new byte[0]; - objdata.TextColor = new byte[4]; - objdata.JointAxisOrAnchor = new LLVector3(0, 0, 0); - objdata.JointPivot = new LLVector3(0, 0, 0); - objdata.Material = 3; - objdata.TextureAnim = new byte[0]; - objdata.Sound = LLUUID.Zero; - LLObject.TextureEntry ntex = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-5005-000000000005")); - this.primData.Texture = objdata.TextureEntry = ntex.ToBytes(); - objdata.State = 0; - objdata.Data = new byte[0]; - - objdata.ObjectData = new byte[60]; - objdata.ObjectData[46] = 128; - objdata.ObjectData[47] = 63; - } - - protected void SetPacketShapeData(ObjectUpdatePacket.ObjectDataBlock objectData) - { - objectData.OwnerID = this.primData.OwnerID; - objectData.PCode = this.primData.PCode; - objectData.PathBegin = this.primData.PathBegin; - objectData.PathEnd = this.primData.PathEnd; - objectData.PathScaleX = this.primData.PathScaleX; - objectData.PathScaleY = this.primData.PathScaleY; - objectData.PathShearX = this.primData.PathShearX; - objectData.PathShearY = this.primData.PathShearY; - objectData.PathSkew = this.primData.PathSkew; - objectData.ProfileBegin = this.primData.ProfileBegin; - objectData.ProfileEnd = this.primData.ProfileEnd; - objectData.Scale = this.primData.Scale; - objectData.PathCurve = this.primData.PathCurve; - objectData.ProfileCurve = this.primData.ProfileCurve; - objectData.ParentID = this.primData.ParentID; - objectData.ProfileHollow = this.primData.ProfileHollow; - objectData.PathRadiusOffset = this.primData.PathRadiusOffset; - objectData.PathRevolutions = this.primData.PathRevolutions; - objectData.PathTaperX = this.primData.PathTaperX; - objectData.PathTaperY = this.primData.PathTaperY; - objectData.PathTwist = this.primData.PathTwist; - objectData.PathTwistBegin = this.primData.PathTwistBegin; - } - - #endregion - protected ObjectUpdatePacket.ObjectDataBlock CreateUpdateBlock() - { - ObjectUpdatePacket.ObjectDataBlock objupdate = new ObjectUpdatePacket.ObjectDataBlock(); - this.SetDefaultPacketValues(objupdate); - objupdate.UpdateFlags = 32 + 65536 + 131072 + 256 + 4 + 8 + 2048 + 524288 + 268435456; - this.SetPacketShapeData(objupdate); - byte[] pb = this.Pos.GetBytes(); - Array.Copy(pb, 0, objupdate.ObjectData, 0, pb.Length); - return objupdate; - } - - protected ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreateImprovedBlock() - { - uint ID = this.localid; - byte[] bytes = new byte[60]; - - int i = 0; - ImprovedTerseObjectUpdatePacket.ObjectDataBlock dat = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock(); - dat.TextureEntry = new byte[0]; - 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; - Axiom.MathLib.Quaternion lRot; - if (this._physActor != null && this.physicsEnabled) - { - PhysicsVector pPos = this._physActor.Position; - lPos = new LLVector3(pPos.X, pPos.Y, pPos.Z); - lRot = this._physActor.Orientation; - } - else - { - lPos = this.Pos; - lRot = this.rotation; - } - 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 * (lRot.w + 1)); - rx = (ushort)(32768 * (lRot.x + 1)); - ry = (ushort)(32768 * (lRot.y + 1)); - rz = (ushort)(32768 * (lRot.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; - } - } -} diff --git a/OpenSim/OpenSim.RegionServer/world/SceneObject.cs b/OpenSim/OpenSim.RegionServer/world/SceneObject.cs deleted file mode 100644 index a846fb5..0000000 --- a/OpenSim/OpenSim.RegionServer/world/SceneObject.cs +++ /dev/null @@ -1,77 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using OpenSim.types; -using libsecondlife; -using libsecondlife.Packets; -using OpenSim.Framework.Interfaces; -using OpenSim.Physics.Manager; -using OpenSim.Framework.Types; -using OpenSim.Framework.Inventory; - -namespace OpenSim.world -{ - public class SceneObject : Entity - { - private LLUUID rootUUID; - private Dictionary ChildPrimitives = new Dictionary(); - private Dictionary m_clientThreads; - private World m_world; - - public SceneObject() - { - - } - - public void CreateFromPacket(ObjectAddPacket addPacket, LLUUID agentID, uint localID) - { - } - - public void CreateFromBytes(byte[] data) - { - - } - - public override void update() - { - - } - - public override void BackUp() - { - - } - - public void GetProperites(ClientView client) - { - /* - ObjectPropertiesPacket proper = new ObjectPropertiesPacket(); - proper.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[1]; - proper.ObjectData[0] = new ObjectPropertiesPacket.ObjectDataBlock(); - proper.ObjectData[0].ItemID = LLUUID.Zero; - proper.ObjectData[0].CreationDate = (ulong)this.primData.CreationDate; - proper.ObjectData[0].CreatorID = this.primData.OwnerID; - proper.ObjectData[0].FolderID = LLUUID.Zero; - proper.ObjectData[0].FromTaskID = LLUUID.Zero; - proper.ObjectData[0].GroupID = LLUUID.Zero; - proper.ObjectData[0].InventorySerial = 0; - proper.ObjectData[0].LastOwnerID = LLUUID.Zero; - proper.ObjectData[0].ObjectID = this.uuid; - proper.ObjectData[0].OwnerID = primData.OwnerID; - proper.ObjectData[0].TouchName = new byte[0]; - proper.ObjectData[0].TextureID = new byte[0]; - proper.ObjectData[0].SitName = new byte[0]; - proper.ObjectData[0].Name = new byte[0]; - proper.ObjectData[0].Description = new byte[0]; - proper.ObjectData[0].OwnerMask = this.primData.OwnerMask; - proper.ObjectData[0].NextOwnerMask = this.primData.NextOwnerMask; - proper.ObjectData[0].GroupMask = this.primData.GroupMask; - proper.ObjectData[0].EveryoneMask = this.primData.EveryoneMask; - proper.ObjectData[0].BaseMask = this.primData.BaseMask; - - client.OutPacket(proper); - * */ - } - - } -} diff --git a/OpenSim/OpenSim.RegionServer/world/World.PacketHandlers.cs b/OpenSim/OpenSim.RegionServer/world/World.PacketHandlers.cs deleted file mode 100644 index ee5a23a..0000000 --- a/OpenSim/OpenSim.RegionServer/world/World.PacketHandlers.cs +++ /dev/null @@ -1,261 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using libsecondlife; -using libsecondlife.Packets; -using OpenSim.Physics.Manager; -using OpenSim.Framework.Interfaces; -using OpenSim.Framework.Types; -using OpenSim.Framework.Terrain; -using OpenSim.Framework.Inventory; -using OpenSim.Framework.Utilities; -using OpenSim.Assets; - -namespace OpenSim.world -{ - public partial class World - { - public void ModifyTerrain(byte action, float north, float west) - { - switch (action) - { - case 1: - // raise terrain - Terrain.raise(north, west, 10.0, 0.001); - RegenerateTerrain(true, (int)north, (int)west); - break; - case 2: - //lower terrain - Terrain.lower(north, west, 10.0, 0.001); - RegenerateTerrain(true, (int)north, (int)west); - break; - } - return; - } - - public void SimChat(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID) - { - foreach (ClientView client in m_clientThreads.Values) - { - // int dis = Util.fast_distance2d((int)(client.ClientAvatar.Pos.X - simClient.ClientAvatar.Pos.X), (int)(client.ClientAvatar.Pos.Y - simClient.ClientAvatar.Pos.Y)); - int dis = (int)client.ClientAvatar.Pos.GetDistanceTo(fromPos); - - switch (type) - { - case 0: // Whisper - if ((dis < 10) && (dis > -10)) - { - //should change so the message is sent through the avatar rather than direct to the ClientView - client.SendChatMessage(message, type, fromPos, fromName, fromAgentID); - } - break; - case 1: // Say - if ((dis < 30) && (dis > -30)) - { - client.SendChatMessage(message, type, fromPos, fromName, fromAgentID); - } - break; - case 2: // Shout - if ((dis < 100) && (dis > -100)) - { - client.SendChatMessage(message, type, fromPos, fromName, fromAgentID); - } - break; - - case 0xff: // Broadcast - client.SendChatMessage(message, type, fromPos, fromName, fromAgentID); - break; - } - - } - } - - public void RezObject(AssetBase primAsset, LLVector3 pos) - { - PrimData primd = new PrimData(primAsset.Data); - Primitive nPrim = new Primitive(m_clientThreads, m_regionHandle, this); - nPrim.CreateFromStorage(primd, pos, this._primCount, true); - this.Entities.Add(nPrim.uuid, nPrim); - this._primCount++; - } - - public void DeRezObject(Packet packet, ClientView simClient) - { - DeRezObjectPacket DeRezPacket = (DeRezObjectPacket)packet; - - //Needs to delete object from physics at a later date - if (DeRezPacket.AgentBlock.DestinationID == LLUUID.Zero) - { - //currently following code not used (or don't know of any case of destination being zero - - } - else - { - foreach (DeRezObjectPacket.ObjectDataBlock Data in DeRezPacket.ObjectData) - { - Entity selectedEnt = null; - //OpenSim.Framework.Console.MainConsole.Instance.WriteLine("LocalID:" + Data.ObjectLocalID.ToString()); - foreach (Entity ent in this.Entities.Values) - { - if (ent.localid == Data.ObjectLocalID) - { - AssetBase primAsset = new AssetBase(); - primAsset.FullID = LLUUID.Random();//DeRezPacket.AgentBlock.TransactionID.Combine(LLUUID.Zero); //should be combining with securesessionid - primAsset.InvType = 6; - primAsset.Type = 6; - primAsset.Name = "Prim"; - primAsset.Description = ""; - primAsset.Data = ((Primitive)ent).GetByteArray(); - this._assetCache.AddAsset(primAsset); - this._inventoryCache.AddNewInventoryItem(simClient, DeRezPacket.AgentBlock.DestinationID, primAsset); - selectedEnt = ent; - break; - } - } - if (selectedEnt != null) - { - this.localStorage.RemovePrim(selectedEnt.uuid); - KillObjectPacket kill = new KillObjectPacket(); - kill.ObjectData = new KillObjectPacket.ObjectDataBlock[1]; - kill.ObjectData[0] = new KillObjectPacket.ObjectDataBlock(); - kill.ObjectData[0].ID = selectedEnt.localid; - foreach (ClientView client in m_clientThreads.Values) - { - client.OutPacket(kill); - } - lock (Entities) - { - Entities.Remove(selectedEnt.uuid); - } - } - } - } - - } - - public void SendAvatarsToClient(ClientView remoteClient) - { - foreach (ClientView client in m_clientThreads.Values) - { - if (client.AgentID != remoteClient.AgentID) - { - // ObjectUpdatePacket objupdate = client.ClientAvatar.CreateUpdatePacket(); - // RemoteClient.OutPacket(objupdate); - client.ClientAvatar.SendUpdateToOtherClient(remoteClient.ClientAvatar); - client.ClientAvatar.SendAppearanceToOtherAgent(remoteClient.ClientAvatar); - } - } - } - - public void LinkObjects(uint parentPrim, List childPrims) - { - Primitive parentprim = null; - foreach (Entity ent in Entities.Values) - { - if (ent.localid == parentPrim) - { - parentprim = (OpenSim.world.Primitive)ent; - - } - } - - for (int i = 0; i < childPrims.Count; i++) - { - uint childId = childPrims[i]; - foreach (Entity ent in Entities.Values) - { - if (ent.localid == childId) - { - ((OpenSim.world.Primitive)ent).MakeParent(parentprim); - } - } - } - - } - - public void UpdatePrimShape(uint primLocalID, ObjectShapePacket.ObjectDataBlock shapeBlock) - { - foreach (Entity ent in Entities.Values) - { - if (ent.localid == primLocalID) - { - ((OpenSim.world.Primitive)ent).UpdateShape(shapeBlock); - break; - } - } - } - - public void SelectPrim(uint primLocalID, ClientView remoteClient) - { - foreach (Entity ent in Entities.Values) - { - if (ent.localid == primLocalID) - { - ((OpenSim.world.Primitive)ent).GetProperites(remoteClient); - break; - } - } - } - - public void UpdatePrimFlags(uint localID, Packet packet, ClientView remoteClient) - { - foreach (Entity ent in Entities.Values) - { - if (ent.localid == localID) - { - ((OpenSim.world.Primitive)ent).UpdateObjectFlags((ObjectFlagUpdatePacket) packet); - break; - } - } - } - - public void UpdatePrimTexture(uint localID, byte[] texture, ClientView remoteClient) - { - foreach (Entity ent in Entities.Values) - { - if (ent.localid == localID) - { - ((OpenSim.world.Primitive)ent).UpdateTexture(texture); - break; - } - } - } - - public void UpdatePrimPosition(uint localID, LLVector3 pos, ClientView remoteClient) - { - foreach (Entity ent in Entities.Values) - { - if (ent.localid == localID) - { - ((OpenSim.world.Primitive)ent).UpdatePosition(pos); - break; - } - } - } - - public void UpdatePrimRotation(uint localID, LLQuaternion rot, ClientView remoteClient) - { - foreach (Entity ent in Entities.Values) - { - if (ent.localid == localID) - { - ent.rotation = new Axiom.MathLib.Quaternion(rot.W, rot.X, rot.Y, rot.Z); - ((OpenSim.world.Primitive)ent).UpdateFlag = true; - break; - } - } - } - - public void UpdatePrimScale(uint localID, LLVector3 scale, ClientView remoteClient) - { - foreach (Entity ent in Entities.Values) - { - if (ent.localid == localID) - { - ((OpenSim.world.Primitive)ent).Scale = scale; - break; - } - } - } - } -} diff --git a/OpenSim/OpenSim.RegionServer/world/World.Scripting.cs b/OpenSim/OpenSim.RegionServer/world/World.Scripting.cs deleted file mode 100644 index 44ef05a..0000000 --- a/OpenSim/OpenSim.RegionServer/world/World.Scripting.cs +++ /dev/null @@ -1,124 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Reflection; -using OpenSim.Framework; -using OpenSim.Framework.Interfaces; -using OpenSim.Framework.Types; -using libsecondlife; - -namespace OpenSim.world -{ - public partial class World - { - private Dictionary scriptEngines = new Dictionary(); - - private void LoadScriptEngines() - { - this.LoadScriptPlugins(); - } - - public void LoadScriptPlugins() - { - string path = Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "ScriptEngines"); - string[] pluginFiles = Directory.GetFiles(path, "*.dll"); - - - for (int i = 0; i < pluginFiles.Length; i++) - { - this.AddPlugin(pluginFiles[i]); - } - } - - private void AddPlugin(string FileName) - { - Assembly pluginAssembly = Assembly.LoadFrom(FileName); - - foreach (Type pluginType in pluginAssembly.GetTypes()) - { - if (pluginType.IsPublic) - { - if (!pluginType.IsAbstract) - { - Type typeInterface = pluginType.GetInterface("IScriptEngine", true); - - if (typeInterface != null) - { - IScriptEngine plug = (IScriptEngine)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); - plug.Init(this); - this.scriptEngines.Add(plug.GetName(), plug); - - } - - typeInterface = null; - } - } - } - - pluginAssembly = null; - } - - public void LoadScript(string scriptType, string scriptName, string script, Entity ent) - { - if(this.scriptEngines.ContainsKey(scriptType)) - { - this.scriptEngines[scriptType].LoadScript(script, scriptName, ent.localid); - } - } - - #region IScriptAPI Methods - - public OSVector3 GetEntityPosition(uint localID) - { - OSVector3 res = new OSVector3(); - // Console.WriteLine("script- getting entity " + localID + " position"); - foreach (Entity entity in this.Entities.Values) - { - if (entity.localid == localID) - { - res.X = entity.Pos.X; - res.Y = entity.Pos.Y; - res.Z = entity.Pos.Z; - } - } - return res; - } - - public void SetEntityPosition(uint localID, float x , float y, float z) - { - foreach (Entity entity in this.Entities.Values) - { - if (entity.localid == localID && entity is Primitive) - { - LLVector3 pos = entity.Pos; - pos.X = x; - pos.Y = y; - Primitive prim = entity as Primitive; - // Of course, we really should have asked the physEngine if this is possible, and if not, returned false. - prim.UpdatePosition(pos); - // Console.WriteLine("script- setting entity " + localID + " positon"); - } - } - - } - - public uint GetRandomAvatarID() - { - //Console.WriteLine("script- getting random avatar id"); - uint res = 0; - foreach (Entity entity in this.Entities.Values) - { - if (entity is Avatar) - { - res = entity.localid; - } - } - return res; - } - - #endregion - - - } -} diff --git a/OpenSim/OpenSim.RegionServer/world/World.cs b/OpenSim/OpenSim.RegionServer/world/World.cs deleted file mode 100644 index ec9bbc9..0000000 --- a/OpenSim/OpenSim.RegionServer/world/World.cs +++ /dev/null @@ -1,658 +0,0 @@ -using System; -using libsecondlife; -using libsecondlife.Packets; -using System.Collections.Generic; -using System.Text; -using System.Reflection; -using System.IO; -using System.Threading; -using OpenSim.Physics.Manager; -using OpenSim.Framework.Interfaces; -using OpenSim.Framework.Types; -using OpenSim.Framework.Terrain; -using OpenSim.Framework.Inventory; -using OpenSim.Assets; -//using OpenSim.world.scripting; -using OpenSim.RegionServer.world.scripting; -using OpenSim.Terrain; - -namespace OpenSim.world -{ - public partial class World : WorldBase, ILocalStorageReceiver, IScriptAPI - { - public object LockPhysicsEngine = new object(); - public Dictionary Avatars; - public Dictionary Prims; - //public ScriptEngine Scripts; - public uint _localNumber = 0; - private PhysicsScene phyScene; - private float timeStep = 0.1f; - public ILocalStorage localStorage; - private Random Rand = new Random(); - private uint _primCount = 702000; - private int storageCount; - private Dictionary m_scriptHandlers; - private Dictionary m_scripts; - private Mutex updateLock; - public string m_datastore; - - #region Properties - public PhysicsScene PhysScene - { - set - { - this.phyScene = value; - } - get - { - return (this.phyScene); - } - } - #endregion - - #region Constructors - /// - /// Creates a new World class, and a region to go with it. - /// - /// Dictionary to contain client threads - /// Region Handle for this region - /// Region Name for this region - public World(Dictionary clientThreads, RegionInfo regInfo, ulong regionHandle, string regionName) - { - try - { - updateLock = new Mutex(false); - m_clientThreads = clientThreads; - m_regionHandle = regionHandle; - m_regionName = regionName; - m_regInfo = regInfo; - - m_scriptHandlers = new Dictionary(); - m_scripts = new Dictionary(); - - OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "World.cs - creating new entitities instance"); - Entities = new Dictionary(); - Avatars = new Dictionary(); - Prims = new Dictionary(); - - OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "World.cs - creating LandMap"); - TerrainManager = new TerrainManager(new SecondLife()); - Terrain = new TerrainEngine(); - Avatar.SetupTemplate("avatar-texture.dat"); - // MainConsole.Instance.WriteLine("World.cs - Creating script engine instance"); - // Initialise this only after the world has loaded - // Scripts = new ScriptEngine(this); - Avatar.LoadAnims(); - this.SetDefaultScripts(); - this.LoadScriptEngines(); - } - catch (Exception e) - { - OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.CRITICAL, "World.cs: Constructor failed with exception " + e.ToString()); - } - } - #endregion - - #region Script Methods - /// - /// Loads a new script into the specified entity - /// - /// Entity to be scripted - /// The script to load - public void AddScript(Entity entity, Script script) - { - try - { - ScriptHandler scriptHandler = new ScriptHandler(script, entity, this); - m_scriptHandlers.Add(scriptHandler.ScriptId, scriptHandler); - } - catch (Exception e) - { - OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM, "World.cs: AddScript() - Failed with exception " + e.ToString()); - } - } - - /// - /// Loads a new script into the specified entity, using a script loaded from a string. - /// - /// The entity to be scripted - /// The string containing the script - public void AddScript(Entity entity, string scriptData) - { - try - { - int scriptstart = 0; - int scriptend = 0; - string substring; - scriptstart = scriptData.LastIndexOf(""); - substring = scriptData.Substring(scriptstart + 8, scriptend - scriptstart - 8); - substring = substring.Trim(); - //Console.WriteLine("searching for script to add: " + substring); - - ScriptFactory scriptFactory; - //Console.WriteLine("script string is " + substring); - if (substring.StartsWith("'); - string sName = substring1.Substring(0, end); - //Console.WriteLine(" script info : " + sEngine + " , " + sName); - int startscript = substring.IndexOf('>'); - script = substring.Remove(0, startscript + 1); - // Console.WriteLine("script data is " + script); - if (this.scriptEngines.ContainsKey(sEngine)) - { - this.scriptEngines[sEngine].LoadScript(script, sName, entity.localid); - } - } - else if (this.m_scripts.TryGetValue(substring, out scriptFactory)) - { - //Console.WriteLine("added script"); - this.AddScript(entity, scriptFactory()); - } - } - catch (Exception e) - { - OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM, "World.cs: AddScript() - Failed with exception " + e.ToString()); - } - } - - #endregion - - #region Update Methods - /// - /// Performs per-frame updates on the world, this should be the central world loop - /// - public override void Update() - { - updateLock.WaitOne(); - try - { - if (this.phyScene.IsThreaded) - { - this.phyScene.GetResults(); - - } - - foreach (libsecondlife.LLUUID UUID in Entities.Keys) - { - Entities[UUID].addForces(); - } - - lock (this.LockPhysicsEngine) - { - this.phyScene.Simulate(timeStep); - } - - foreach (libsecondlife.LLUUID UUID in Entities.Keys) - { - Entities[UUID].update(); - } - - foreach (ScriptHandler scriptHandler in m_scriptHandlers.Values) - { - scriptHandler.OnFrame(); - } - foreach (IScriptEngine scripteng in this.scriptEngines.Values) - { - scripteng.OnFrame(); - } - //backup world data - this.storageCount++; - if (storageCount > 1200) //set to how often you want to backup - { - this.Backup(); - storageCount = 0; - } - } - catch (Exception e) - { - OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM, "World.cs: Update() - Failed with exception " + e.ToString()); - } - updateLock.ReleaseMutex(); - } - - public bool Backup() - { - try - { - // Terrain backup routines - if (Terrain.tainted > 0) - { - Terrain.tainted = 0; - OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "World.cs: Backup() - Terrain tainted, saving."); - localStorage.SaveMap(Terrain.getHeights1D()); - OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "World.cs: Backup() - Terrain saved, informing Physics."); - lock (this.LockPhysicsEngine) - { - phyScene.SetTerrain(Terrain.getHeights1D()); - } - } - - // Primitive backup routines - OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "World.cs: Backup() - Backing up Primitives"); - foreach (libsecondlife.LLUUID UUID in Entities.Keys) - { - Entities[UUID].BackUp(); - } - - // Backup successful - return true; - } - catch (Exception e) - { - // Backup failed - OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH, "World.cs: Backup() - Backup Failed with exception " + e.ToString()); - return false; - } - } - #endregion - - #region Setup Methods - /// - /// Loads a new storage subsystem from a named library - /// - /// Storage Library - /// Successful or not - public bool LoadStorageDLL(string dllName) - { - try - { - 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; - - store.Initialise(this.m_datastore); - break; - } - - typeInterface = null; - } - } - } - pluginAssembly = null; - this.localStorage = store; - return (store == null); - } - catch (Exception e) - { - OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM, "World.cs: LoadStorageDLL() - Failed with exception " + e.ToString()); - return false; - } - } - - public void SetDefaultScripts() - { - this.m_scripts.Add("FollowRandomAvatar", delegate() - { - return new OpenSim.RegionServer.world.scripting.FollowRandomAvatar(); - }); - } - - #endregion - - #region Regenerate Terrain - - /// - /// Rebuilds the terrain using a procedural algorithm - /// - public void RegenerateTerrain() - { - try - { - Terrain.hills(); - - lock (this.LockPhysicsEngine) - { - this.phyScene.SetTerrain(Terrain.getHeights1D()); - } - this.localStorage.SaveMap(this.Terrain.getHeights1D()); - - foreach (ClientView client in m_clientThreads.Values) - { - this.SendLayerData(client); - } - - foreach (libsecondlife.LLUUID UUID in Entities.Keys) - { - Entities[UUID].LandRenegerated(); - } - } - catch (Exception e) - { - OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM, "World.cs: RegenerateTerrain() - Failed with exception " + e.ToString()); - } - } - - /// - /// Rebuilds the terrain using a 2D float array - /// - /// 256,256 float array containing heights - public void RegenerateTerrain(float[,] newMap) - { - try - { - this.Terrain.setHeights2D(newMap); - lock (this.LockPhysicsEngine) - { - this.phyScene.SetTerrain(this.Terrain.getHeights1D()); - } - this.localStorage.SaveMap(this.Terrain.getHeights1D()); - - foreach (ClientView client in m_clientThreads.Values) - { - this.SendLayerData(client); - } - - foreach (libsecondlife.LLUUID UUID in Entities.Keys) - { - Entities[UUID].LandRenegerated(); - } - } - catch (Exception e) - { - OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM, "World.cs: RegenerateTerrain() - Failed with exception " + e.ToString()); - } - } - - /// - /// Rebuilds the terrain assuming changes occured at a specified point[?] - /// - /// ??? - /// ??? - /// ??? - public void RegenerateTerrain(bool changes, int pointx, int pointy) - { - try - { - if (changes) - { - /* Dont save here, rely on tainting system instead */ - - foreach (ClientView client in m_clientThreads.Values) - { - this.SendLayerData(pointx, pointy, client); - } - } - } - catch (Exception e) - { - OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM, "World.cs: RegenerateTerrain() - Failed with exception " + e.ToString()); - } - } - - #endregion - - #region Load Terrain - /// - /// Loads the World heightmap - /// - public override void LoadWorldMap() - { - try - { - float[] map = this.localStorage.LoadWorld(); - if (map == null) - { - Console.WriteLine("creating new terrain"); - this.Terrain.hills(); - - this.localStorage.SaveMap(this.Terrain.getHeights1D()); - } - else - { - this.Terrain.setHeights1D(map); - } - } - catch (Exception e) - { - OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM, "World.cs: LoadWorldMap() - Failed with exception " + e.ToString()); - } - } - #endregion - - #region Primitives Methods - - /// - /// Sends prims to a client - /// - /// Client to send to - public void GetInitialPrims(ClientView RemoteClient) - { - try - { - foreach (libsecondlife.LLUUID UUID in Entities.Keys) - { - if (Entities[UUID] is Primitive) - { - Primitive primitive = Entities[UUID] as Primitive; - primitive.UpdateClient(RemoteClient); - } - } - } - catch (Exception e) - { - OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM, "World.cs: GetInitialPrims() - Failed with exception " + e.ToString()); - } - } - - /// - /// Loads the World's objects - /// - public void LoadPrimsFromStorage() - { - try - { - OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "World.cs: LoadPrimsFromStorage() - Loading primitives"); - this.localStorage.LoadPrimitives(this); - } - catch (Exception e) - { - OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM, "World.cs: LoadPrimsFromStorage() - Failed with exception " + e.ToString()); - } - } - - /// - /// Loads a specific object from storage - /// - /// The object to load - public void PrimFromStorage(PrimData prim) - { - try - { - if (prim.LocalID >= this._primCount) - { - _primCount = prim.LocalID + 1; - } - OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "World.cs: PrimFromStorage() - Reloading prim (localId " + prim.LocalID + " ) from storage"); - Primitive nPrim = new Primitive(m_clientThreads, m_regionHandle, this); - nPrim.CreateFromStorage(prim); - this.Entities.Add(nPrim.uuid, nPrim); - } - catch (Exception e) - { - OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM, "World.cs: PrimFromStorage() - Failed with exception " + e.ToString()); - } - } - - public void AddNewPrim(Packet addPacket, ClientView agentClient) - { - AddNewPrim((ObjectAddPacket)addPacket, agentClient.AgentID); - } - - public void AddNewPrim(ObjectAddPacket addPacket, LLUUID ownerID) - { - try - { - OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "World.cs: AddNewPrim() - Creating new prim"); - Primitive prim = new Primitive(m_clientThreads, m_regionHandle, this); - prim.CreateFromPacket(addPacket, ownerID, this._primCount); - PhysicsVector pVec = new PhysicsVector(prim.Pos.X, prim.Pos.Y, prim.Pos.Z); - PhysicsVector pSize = new PhysicsVector(0.255f, 0.255f, 0.255f); - if (OpenSim.world.Avatar.PhysicsEngineFlying) - { - lock (this.LockPhysicsEngine) - { - prim.PhysActor = this.phyScene.AddPrim(pVec, pSize); - } - } - - this.Entities.Add(prim.uuid, prim); - this._primCount++; - } - catch (Exception e) - { - OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM, "World.cs: AddNewPrim() - Failed with exception " + e.ToString()); - } - } - - #endregion - - #region Add/Remove Avatar Methods - - public override Avatar AddViewerAgent(ClientView agentClient) - { - //register for events - agentClient.OnChatFromViewer += new ChatFromViewer(this.SimChat); - agentClient.OnRezObject += new RezObject(this.RezObject); - agentClient.OnModifyTerrain += new ModifyTerrain(this.ModifyTerrain); - agentClient.OnRegionHandShakeReply += new ClientView.GenericCall(this.SendLayerData); - agentClient.OnRequestWearables += new ClientView.GenericCall(this.GetInitialPrims); - agentClient.OnRequestAvatarsData += new ClientView.GenericCall(this.SendAvatarsToClient); - agentClient.OnLinkObjects += new LinkObjects(this.LinkObjects); - agentClient.OnAddPrim += new ClientView.GenericCall4(this.AddNewPrim); - agentClient.OnUpdatePrimShape += new ClientView.UpdateShape(this.UpdatePrimShape); - agentClient.OnObjectSelect += new ClientView.ObjectSelect(this.SelectPrim); - agentClient.OnUpdatePrimFlags += new ClientView.UpdatePrimFlags(this.UpdatePrimFlags); - agentClient.OnUpdatePrimTexture += new ClientView.UpdatePrimTexture(this.UpdatePrimTexture); - agentClient.OnUpdatePrimPosition += new ClientView.UpdatePrimVector(this.UpdatePrimPosition); - agentClient.OnUpdatePrimRotation += new ClientView.UpdatePrimRotation(this.UpdatePrimRotation); - agentClient.OnUpdatePrimScale += new ClientView.UpdatePrimVector(this.UpdatePrimScale); - agentClient.OnDeRezObject += new ClientView.GenericCall4(this.DeRezObject); - - Avatar newAvatar = null; - try - { - OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "World.cs:AddViewerAgent() - Creating new avatar for remote viewer agent"); - newAvatar = new Avatar(agentClient, this, m_regionName, m_clientThreads, m_regionHandle, true, 20); - OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "World.cs:AddViewerAgent() - Adding new avatar to world"); - OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "World.cs:AddViewerAgent() - Starting RegionHandshake "); - newAvatar.SendRegionHandshake(this); - //if (!agentClient.m_child) - //{ - - PhysicsVector pVec = new PhysicsVector(newAvatar.Pos.X, newAvatar.Pos.Y, newAvatar.Pos.Z); - lock (this.LockPhysicsEngine) - { - newAvatar.PhysActor = this.phyScene.AddAvatar(pVec); - } - // } - lock (Entities) - { - if (!Entities.ContainsKey(agentClient.AgentID)) - { - this.Entities.Add(agentClient.AgentID, newAvatar); - } - else - { - Entities[agentClient.AgentID] = newAvatar; - } - } - lock (Avatars) - { - if (Avatars.ContainsKey(agentClient.AgentID)) - { - Avatars[agentClient.AgentID] = newAvatar; - } - else - { - this.Avatars.Add(agentClient.AgentID, newAvatar); - } - } - } - catch (Exception e) - { - OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM, "World.cs: AddViewerAgent() - Failed with exception " + e.ToString()); - } - return newAvatar; - } - - public override void RemoveViewerAgent(ClientView agentClient) - { - try - { - lock (Entities) - { - Entities.Remove(agentClient.AgentID); - } - lock (Avatars) - { - Avatars.Remove(agentClient.AgentID); - } - if (agentClient.ClientAvatar.PhysActor != null) - { - this.phyScene.RemoveAvatar(agentClient.ClientAvatar.PhysActor); - } - } - catch (Exception e) - { - OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM, "World.cs: RemoveViewerAgent() - Failed with exception " + e.ToString()); - } - } - #endregion - - #region Request Avatars List Methods - //The idea is to have a group of method that return a list of avatars meeting some requirement - // ie it could be all Avatars within a certain range of the calling prim/avatar. - - public List RequestAvatarList() - { - List result = new List(); - - foreach (Avatar avatar in Avatars.Values) - { - result.Add(avatar); - } - - return result; - } - #endregion - - #region ShutDown - /// - /// Tidy before shutdown - /// - public override void Close() - { - try - { - this.localStorage.ShutDown(); - } - catch (Exception e) - { - OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH, "World.cs: Close() - Failed with exception " + e.ToString()); - } - } - #endregion - - } -} diff --git a/OpenSim/OpenSim.RegionServer/world/WorldBase.cs b/OpenSim/OpenSim.RegionServer/world/WorldBase.cs deleted file mode 100644 index ea71411..0000000 --- a/OpenSim/OpenSim.RegionServer/world/WorldBase.cs +++ /dev/null @@ -1,176 +0,0 @@ -using System; -using libsecondlife; -using libsecondlife.Packets; -using System.Collections.Generic; -using System.Text; -using System.Reflection; -using System.IO; -using System.Threading; -using OpenSim.Physics.Manager; -using OpenSim.Framework.Interfaces; -using OpenSim.Framework.Types; -using OpenSim.Framework.Terrain; -using OpenSim.Framework.Inventory; -using OpenSim.Assets; -using OpenSim.RegionServer.world.scripting; -using OpenSim.Terrain; - -namespace OpenSim.world -{ - public class WorldBase - { - public Dictionary Entities; - protected Dictionary m_clientThreads; - protected ulong m_regionHandle; - protected string m_regionName; - protected InventoryCache _inventoryCache; - protected AssetCache _assetCache; - protected RegionInfo m_regInfo; - - public TerrainEngine Terrain; //TODO: Replace TerrainManager with this. - protected libsecondlife.TerrainManager TerrainManager; // To be referenced via TerrainEngine - - #region Properties - public InventoryCache InventoryCache - { - set - { - this._inventoryCache = value; - } - } - - public AssetCache AssetCache - { - set - { - this._assetCache = value; - } - } - #endregion - - #region Constructors - public WorldBase() - { - - } - #endregion - - #region Setup Methods - /// - /// Register Packet handler Methods with the packet server (which will register them with the SimClient) - /// - /// - public virtual void RegisterPacketHandlers(PacketServer packetServer) - { - - } - #endregion - - #region Update Methods - /// - /// Normally called once every frame/tick to let the world preform anything required (like running the physics simulation) - /// - public virtual void Update() - { - - } - #endregion - - #region Terrain Methods - - /// - /// Loads the World heightmap - /// - public virtual void LoadWorldMap() - { - - } - - /// - /// Send the region heightmap to the client - /// - /// Client to send to - public virtual void SendLayerData(ClientView RemoteClient) - { - try - { - 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(Terrain.getHeights1D(), patches); - RemoteClient.OutPacket(layerpack); - } - } - } - catch (Exception e) - { - OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM, "World.cs: SendLayerData() - Failed with exception " + e.ToString()); - } - } - - /// - /// Sends a specified patch to a client - /// - /// Patch coordinate (x) 0..16 - /// Patch coordinate (y) 0..16 - /// The client to send to - public void SendLayerData(int px, int py, ClientView RemoteClient) - { - try - { - int[] patches = new int[1]; - int patchx, patchy; - patchx = px / 16; - patchy = py / 16; - - patches[0] = patchx + 0 + patchy * 16; - - Packet layerpack = TerrainManager.CreateLandPacket(Terrain.getHeights1D(), patches); - RemoteClient.OutPacket(layerpack); - } - catch (Exception e) - { - OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM, "World.cs: SendLayerData() - Failed with exception " + e.ToString()); - } - } - #endregion - - #region Add/Remove Agent/Avatar - /// - /// Add a new Agent's avatar - /// - /// - public virtual Avatar AddViewerAgent(ClientView agentClient) - { - return null; - } - - /// - /// Remove a Agent's avatar - /// - /// - public virtual void RemoveViewerAgent(ClientView agentClient) - { - - } - #endregion - - #region Shutdown - /// - /// Tidy before shutdown - /// - public virtual void Close() - { - - } - #endregion - } -} diff --git a/OpenSim/OpenSim.RegionServer/world/scripting/IScriptContext.cs b/OpenSim/OpenSim.RegionServer/world/scripting/IScriptContext.cs deleted file mode 100644 index 465c23b..0000000 --- a/OpenSim/OpenSim.RegionServer/world/scripting/IScriptContext.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using libsecondlife; - -namespace OpenSim.RegionServer.world.scripting -{ - public interface IScriptContext - { - IScriptEntity Entity { get; } - bool TryGetRandomAvatar(out IScriptReadonlyEntity avatar); - } -} diff --git a/OpenSim/OpenSim.RegionServer/world/scripting/IScriptEntity.cs b/OpenSim/OpenSim.RegionServer/world/scripting/IScriptEntity.cs deleted file mode 100644 index 2ef16a4..0000000 --- a/OpenSim/OpenSim.RegionServer/world/scripting/IScriptEntity.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using libsecondlife; - -namespace OpenSim.RegionServer.world.scripting -{ - public interface IScriptReadonlyEntity - { - LLVector3 Pos { get; } - string Name { get; } - } - - public interface IScriptEntity - { - LLVector3 Pos { get; set; } - string Name { get; } - } -} diff --git a/OpenSim/OpenSim.RegionServer/world/scripting/IScriptHandler.cs b/OpenSim/OpenSim.RegionServer/world/scripting/IScriptHandler.cs deleted file mode 100644 index 15efc49..0000000 --- a/OpenSim/OpenSim.RegionServer/world/scripting/IScriptHandler.cs +++ /dev/null @@ -1,98 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using libsecondlife; -using OpenSim.Physics.Manager; -using OpenSim.world; -using Avatar=OpenSim.world.Avatar; -using Primitive = OpenSim.world.Primitive; - -namespace OpenSim.RegionServer.world.scripting -{ - public delegate void ScriptEventHandler(IScriptContext context); - - public class ScriptHandler : IScriptContext, IScriptEntity, IScriptReadonlyEntity - { - private World m_world; - private Script m_script; - private Entity m_entity; - - public LLUUID ScriptId - { - get - { - return m_script.ScriptId; - } - } - - public void OnFrame() - { - m_script.OnFrame(this); - } - - public ScriptHandler(Script script, Entity entity, World world) - { - m_script = script; - m_entity = entity; - m_world = world; - } - - #region IScriptContext Members - - IScriptEntity IScriptContext.Entity - { - get - { - return this; - } - } - - bool IScriptContext.TryGetRandomAvatar(out IScriptReadonlyEntity avatar) - { - foreach (Entity entity in m_world.Entities.Values ) - { - if( entity is Avatar ) - { - avatar = entity; - return true; - } - } - - avatar = null; - return false; - } - - #endregion - - #region IScriptEntity and IScriptReadonlyEntity Members - - public string Name - { - get - { - return m_entity.Name; - } - } - - public LLVector3 Pos - { - get - { - return m_entity.Pos; - } - - set - { - if (m_entity is Primitive) - { - Primitive prim = m_entity as Primitive; - // Of course, we really should have asked the physEngine if this is possible, and if not, returned false. - prim.UpdatePosition( value ); - } - } - } - - #endregion - } - -} diff --git a/OpenSim/OpenSim.RegionServer/world/scripting/Script.cs b/OpenSim/OpenSim.RegionServer/world/scripting/Script.cs deleted file mode 100644 index 48c18ff..0000000 --- a/OpenSim/OpenSim.RegionServer/world/scripting/Script.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using libsecondlife; - -namespace OpenSim.RegionServer.world.scripting -{ - public class Script - { - private LLUUID m_scriptId; - public virtual LLUUID ScriptId - { - get - { - return m_scriptId; - } - } - - public Script( LLUUID scriptId ) - { - m_scriptId = scriptId; - } - - public ScriptEventHandler OnFrame; - } -} diff --git a/OpenSim/OpenSim.RegionServer/world/scripting/ScriptFactory.cs b/OpenSim/OpenSim.RegionServer/world/scripting/ScriptFactory.cs deleted file mode 100644 index 4c6d373..0000000 --- a/OpenSim/OpenSim.RegionServer/world/scripting/ScriptFactory.cs +++ /dev/null @@ -1,8 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace OpenSim.RegionServer.world.scripting -{ - public delegate Script ScriptFactory(); -} diff --git a/OpenSim/OpenSim.RegionServer/world/scripting/Scripts/FollowRandomAvatar.cs b/OpenSim/OpenSim.RegionServer/world/scripting/Scripts/FollowRandomAvatar.cs deleted file mode 100644 index 6a689ab..0000000 --- a/OpenSim/OpenSim.RegionServer/world/scripting/Scripts/FollowRandomAvatar.cs +++ /dev/null @@ -1,37 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using libsecondlife; - -namespace OpenSim.RegionServer.world.scripting -{ - public class FollowRandomAvatar : Script - { - public FollowRandomAvatar() - : base(LLUUID.Random()) - { - OnFrame += MyOnFrame; - } - - private void MyOnFrame(IScriptContext context) - { - LLVector3 pos = context.Entity.Pos; - - IScriptReadonlyEntity avatar; - - if (context.TryGetRandomAvatar(out avatar)) - { - LLVector3 avatarPos = avatar.Pos; - - float x = pos.X + ((float)avatarPos.X.CompareTo(pos.X)) / 2; - float y = pos.Y + ((float)avatarPos.Y.CompareTo(pos.Y)) / 2; - - LLVector3 newPos = new LLVector3(x, y, pos.Z); - - context.Entity.Pos = newPos; - } - } - } - - -} -- cgit v1.1