diff options
author | Sean Dague | 2007-10-05 15:45:45 +0000 |
---|---|---|
committer | Sean Dague | 2007-10-05 15:45:45 +0000 |
commit | c3d8f1f4253f72484100394940e62f2912cbc4ff (patch) | |
tree | 8a9f237ed3c1140b4059ec121e0d4ede82eae416 /OpenSim/Region | |
parent | * So, ok, maybe renaming serialized fields on a friday wasn't the smartest of... (diff) | |
download | opensim-SC_OLD-c3d8f1f4253f72484100394940e62f2912cbc4ff.zip opensim-SC_OLD-c3d8f1f4253f72484100394940e62f2912cbc4ff.tar.gz opensim-SC_OLD-c3d8f1f4253f72484100394940e62f2912cbc4ff.tar.bz2 opensim-SC_OLD-c3d8f1f4253f72484100394940e62f2912cbc4ff.tar.xz |
getting all our line endings consistant again
Diffstat (limited to 'OpenSim/Region')
30 files changed, 2465 insertions, 2465 deletions
diff --git a/OpenSim/Region/Communications/Local/LocalInventoryService.cs b/OpenSim/Region/Communications/Local/LocalInventoryService.cs index dc91663..1f5b298 100644 --- a/OpenSim/Region/Communications/Local/LocalInventoryService.cs +++ b/OpenSim/Region/Communications/Local/LocalInventoryService.cs | |||
@@ -1,67 +1,67 @@ | |||
1 | using System.Collections.Generic; | 1 | using System.Collections.Generic; |
2 | using libsecondlife; | 2 | using libsecondlife; |
3 | using OpenSim.Framework.Communications; | 3 | using OpenSim.Framework.Communications; |
4 | using OpenSim.Framework.Types; | 4 | using OpenSim.Framework.Types; |
5 | using InventoryFolder=OpenSim.Framework.Communications.Caches.InventoryFolder; | 5 | using InventoryFolder=OpenSim.Framework.Communications.Caches.InventoryFolder; |
6 | 6 | ||
7 | namespace OpenSim.Region.Communications.Local | 7 | namespace OpenSim.Region.Communications.Local |
8 | { | 8 | { |
9 | public class LocalInventoryService : InventoryServiceBase | 9 | public class LocalInventoryService : InventoryServiceBase |
10 | { | 10 | { |
11 | 11 | ||
12 | public LocalInventoryService() | 12 | public LocalInventoryService() |
13 | { | 13 | { |
14 | 14 | ||
15 | } | 15 | } |
16 | 16 | ||
17 | public override void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, InventoryItemInfo itemCallBack) | 17 | public override void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, InventoryItemInfo itemCallBack) |
18 | { | 18 | { |
19 | List<InventoryFolderBase> folders = this.RequestFirstLevelFolders(userID); | 19 | List<InventoryFolderBase> folders = this.RequestFirstLevelFolders(userID); |
20 | InventoryFolder rootFolder = null; | 20 | InventoryFolder rootFolder = null; |
21 | 21 | ||
22 | //need to make sure we send root folder first | 22 | //need to make sure we send root folder first |
23 | foreach (InventoryFolderBase folder in folders) | 23 | foreach (InventoryFolderBase folder in folders) |
24 | { | 24 | { |
25 | if (folder.parentID == libsecondlife.LLUUID.Zero) | 25 | if (folder.parentID == libsecondlife.LLUUID.Zero) |
26 | { | 26 | { |
27 | InventoryFolder newfolder = new InventoryFolder(folder); | 27 | InventoryFolder newfolder = new InventoryFolder(folder); |
28 | rootFolder = newfolder; | 28 | rootFolder = newfolder; |
29 | folderCallBack(userID, newfolder); | 29 | folderCallBack(userID, newfolder); |
30 | } | 30 | } |
31 | } | 31 | } |
32 | 32 | ||
33 | if (rootFolder != null) | 33 | if (rootFolder != null) |
34 | { | 34 | { |
35 | foreach (InventoryFolderBase folder in folders) | 35 | foreach (InventoryFolderBase folder in folders) |
36 | { | 36 | { |
37 | if (folder.folderID != rootFolder.folderID) | 37 | if (folder.folderID != rootFolder.folderID) |
38 | { | 38 | { |
39 | InventoryFolder newfolder = new InventoryFolder(folder); | 39 | InventoryFolder newfolder = new InventoryFolder(folder); |
40 | folderCallBack(userID, newfolder); | 40 | folderCallBack(userID, newfolder); |
41 | 41 | ||
42 | List<InventoryItemBase> items = this.RequestFolderItems(newfolder.folderID); | 42 | List<InventoryItemBase> items = this.RequestFolderItems(newfolder.folderID); |
43 | foreach (InventoryItemBase item in items) | 43 | foreach (InventoryItemBase item in items) |
44 | { | 44 | { |
45 | itemCallBack(userID, item); | 45 | itemCallBack(userID, item); |
46 | } | 46 | } |
47 | } | 47 | } |
48 | } | 48 | } |
49 | } | 49 | } |
50 | } | 50 | } |
51 | 51 | ||
52 | public override void AddNewInventoryFolder(LLUUID userID, InventoryFolder folder) | 52 | public override void AddNewInventoryFolder(LLUUID userID, InventoryFolder folder) |
53 | { | 53 | { |
54 | this.AddFolder(folder); | 54 | this.AddFolder(folder); |
55 | } | 55 | } |
56 | 56 | ||
57 | public override void AddNewInventoryItem(LLUUID userID, InventoryItemBase item) | 57 | public override void AddNewInventoryItem(LLUUID userID, InventoryItemBase item) |
58 | { | 58 | { |
59 | this.AddItem(item); | 59 | this.AddItem(item); |
60 | } | 60 | } |
61 | 61 | ||
62 | public override void DeleteInventoryItem(LLUUID userID, InventoryItemBase item) | 62 | public override void DeleteInventoryItem(LLUUID userID, InventoryItemBase item) |
63 | { | 63 | { |
64 | this.deleteItem(item); | 64 | this.deleteItem(item); |
65 | } | 65 | } |
66 | } | 66 | } |
67 | } | 67 | } |
diff --git a/OpenSim/Region/Communications/Local/LocalLoginService.cs b/OpenSim/Region/Communications/Local/LocalLoginService.cs index 6829598..6ad39b0 100644 --- a/OpenSim/Region/Communications/Local/LocalLoginService.cs +++ b/OpenSim/Region/Communications/Local/LocalLoginService.cs | |||
@@ -1,173 +1,173 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections; | 2 | using System.Collections; |
3 | using System.Collections.Generic; | 3 | using System.Collections.Generic; |
4 | using libsecondlife; | 4 | using libsecondlife; |
5 | using OpenSim.Framework.Communications; | 5 | using OpenSim.Framework.Communications; |
6 | using OpenSim.Framework.Types; | 6 | using OpenSim.Framework.Types; |
7 | using OpenSim.Framework.UserManagement; | 7 | using OpenSim.Framework.UserManagement; |
8 | using OpenSim.Framework.Utilities; | 8 | using OpenSim.Framework.Utilities; |
9 | using OpenSim.Framework.Inventory; | 9 | using OpenSim.Framework.Inventory; |
10 | 10 | ||
11 | namespace OpenSim.Region.Communications.Local | 11 | namespace OpenSim.Region.Communications.Local |
12 | { | 12 | { |
13 | public delegate void LoginToRegionEvent(ulong regionHandle, Login login); | 13 | public delegate void LoginToRegionEvent(ulong regionHandle, Login login); |
14 | 14 | ||
15 | public class LocalLoginService : LoginService | 15 | public class LocalLoginService : LoginService |
16 | { | 16 | { |
17 | private CommunicationsLocal m_Parent; | 17 | private CommunicationsLocal m_Parent; |
18 | 18 | ||
19 | private NetworkServersInfo serversInfo; | 19 | private NetworkServersInfo serversInfo; |
20 | private uint defaultHomeX; | 20 | private uint defaultHomeX; |
21 | private uint defaultHomeY; | 21 | private uint defaultHomeY; |
22 | private bool authUsers = false; | 22 | private bool authUsers = false; |
23 | 23 | ||
24 | public event LoginToRegionEvent OnLoginToRegion; | 24 | public event LoginToRegionEvent OnLoginToRegion; |
25 | 25 | ||
26 | public LocalLoginService(UserManagerBase userManager, string welcomeMess, CommunicationsLocal parent, NetworkServersInfo serversInfo, bool authenticate) | 26 | public LocalLoginService(UserManagerBase userManager, string welcomeMess, CommunicationsLocal parent, NetworkServersInfo serversInfo, bool authenticate) |
27 | : base(userManager, welcomeMess) | 27 | : base(userManager, welcomeMess) |
28 | { | 28 | { |
29 | m_Parent = parent; | 29 | m_Parent = parent; |
30 | this.serversInfo = serversInfo; | 30 | this.serversInfo = serversInfo; |
31 | defaultHomeX = this.serversInfo.DefaultHomeLocX; | 31 | defaultHomeX = this.serversInfo.DefaultHomeLocX; |
32 | defaultHomeY = this.serversInfo.DefaultHomeLocY; | 32 | defaultHomeY = this.serversInfo.DefaultHomeLocY; |
33 | this.authUsers = authenticate; | 33 | this.authUsers = authenticate; |
34 | } | 34 | } |
35 | 35 | ||
36 | 36 | ||
37 | public override UserProfileData GetTheUser(string firstname, string lastname) | 37 | public override UserProfileData GetTheUser(string firstname, string lastname) |
38 | { | 38 | { |
39 | UserProfileData profile = this.m_userManager.GetUserProfile(firstname, lastname); | 39 | UserProfileData profile = this.m_userManager.GetUserProfile(firstname, lastname); |
40 | if (profile != null) | 40 | if (profile != null) |
41 | { | 41 | { |
42 | 42 | ||
43 | return profile; | 43 | return profile; |
44 | } | 44 | } |
45 | 45 | ||
46 | if (!authUsers) | 46 | if (!authUsers) |
47 | { | 47 | { |
48 | //no current user account so make one | 48 | //no current user account so make one |
49 | Console.WriteLine("No User account found so creating a new one "); | 49 | Console.WriteLine("No User account found so creating a new one "); |
50 | this.m_userManager.AddUserProfile(firstname, lastname, "test", defaultHomeX, defaultHomeY); | 50 | this.m_userManager.AddUserProfile(firstname, lastname, "test", defaultHomeX, defaultHomeY); |
51 | 51 | ||
52 | profile = this.m_userManager.GetUserProfile(firstname, lastname); | 52 | profile = this.m_userManager.GetUserProfile(firstname, lastname); |
53 | if (profile != null) | 53 | if (profile != null) |
54 | { | 54 | { |
55 | m_Parent.InventoryService.CreateNewUserInventory(profile.UUID); | 55 | m_Parent.InventoryService.CreateNewUserInventory(profile.UUID); |
56 | } | 56 | } |
57 | 57 | ||
58 | return profile; | 58 | return profile; |
59 | } | 59 | } |
60 | return null; | 60 | return null; |
61 | } | 61 | } |
62 | 62 | ||
63 | public override bool AuthenticateUser(UserProfileData profile, string password) | 63 | public override bool AuthenticateUser(UserProfileData profile, string password) |
64 | { | 64 | { |
65 | if (!authUsers) | 65 | if (!authUsers) |
66 | { | 66 | { |
67 | //for now we will accept any password in sandbox mode | 67 | //for now we will accept any password in sandbox mode |
68 | Console.WriteLine("authorising user"); | 68 | Console.WriteLine("authorising user"); |
69 | return true; | 69 | return true; |
70 | } | 70 | } |
71 | else | 71 | else |
72 | { | 72 | { |
73 | Console.WriteLine("Authenticating " + profile.username + " " + profile.surname); | 73 | Console.WriteLine("Authenticating " + profile.username + " " + profile.surname); |
74 | 74 | ||
75 | password = password.Remove(0, 3); //remove $1$ | 75 | password = password.Remove(0, 3); //remove $1$ |
76 | 76 | ||
77 | string s = Util.Md5Hash(password + ":" + profile.passwordSalt); | 77 | string s = Util.Md5Hash(password + ":" + profile.passwordSalt); |
78 | 78 | ||
79 | return profile.passwordHash.Equals(s.ToString(), StringComparison.InvariantCultureIgnoreCase); | 79 | return profile.passwordHash.Equals(s.ToString(), StringComparison.InvariantCultureIgnoreCase); |
80 | } | 80 | } |
81 | } | 81 | } |
82 | 82 | ||
83 | public override void CustomiseResponse(LoginResponse response, UserProfileData theUser) | 83 | public override void CustomiseResponse(LoginResponse response, UserProfileData theUser) |
84 | { | 84 | { |
85 | ulong currentRegion = theUser.currentAgent.currentHandle; | 85 | ulong currentRegion = theUser.currentAgent.currentHandle; |
86 | RegionInfo reg = m_Parent.GridService.RequestNeighbourInfo(currentRegion); | 86 | RegionInfo reg = m_Parent.GridService.RequestNeighbourInfo(currentRegion); |
87 | 87 | ||
88 | if (reg != null) | 88 | if (reg != null) |
89 | { | 89 | { |
90 | response.Home = "{'region_handle':[r" + (reg.RegionLocX * 256).ToString() + ",r" + (reg.RegionLocY * 256).ToString() + "], " + | 90 | response.Home = "{'region_handle':[r" + (reg.RegionLocX * 256).ToString() + ",r" + (reg.RegionLocY * 256).ToString() + "], " + |
91 | "'position':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "], " + | 91 | "'position':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "], " + |
92 | "'look_at':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "]}"; | 92 | "'look_at':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "]}"; |
93 | string capsPath = Util.GetRandomCapsPath(); | 93 | string capsPath = Util.GetRandomCapsPath(); |
94 | response.SimAddress = reg.ExternalEndPoint.Address.ToString(); | 94 | response.SimAddress = reg.ExternalEndPoint.Address.ToString(); |
95 | response.SimPort = (Int32)reg.ExternalEndPoint.Port; | 95 | response.SimPort = (Int32)reg.ExternalEndPoint.Port; |
96 | response.RegionX = reg.RegionLocX; | 96 | response.RegionX = reg.RegionLocX; |
97 | response.RegionY = reg.RegionLocY; | 97 | response.RegionY = reg.RegionLocY; |
98 | 98 | ||
99 | 99 | ||
100 | response.SeedCapability = "http://" + reg.ExternalHostName + ":" + this.serversInfo.HttpListenerPort.ToString() + "/CAPS/" + capsPath + "0000/"; | 100 | response.SeedCapability = "http://" + reg.ExternalHostName + ":" + this.serversInfo.HttpListenerPort.ToString() + "/CAPS/" + capsPath + "0000/"; |
101 | // response.SeedCapability = "http://" + reg.ExternalHostName + ":" + this.serversInfo.HttpListenerPort.ToString() + "/CapsSeed/" + capsPath + "0000/"; | 101 | // response.SeedCapability = "http://" + reg.ExternalHostName + ":" + this.serversInfo.HttpListenerPort.ToString() + "/CapsSeed/" + capsPath + "0000/"; |
102 | theUser.currentAgent.currentRegion = reg.SimUUID; | 102 | theUser.currentAgent.currentRegion = reg.SimUUID; |
103 | theUser.currentAgent.currentHandle = reg.RegionHandle; | 103 | theUser.currentAgent.currentHandle = reg.RegionHandle; |
104 | 104 | ||
105 | Login _login = new Login(); | 105 | Login _login = new Login(); |
106 | //copy data to login object | 106 | //copy data to login object |
107 | _login.First = response.Firstname; | 107 | _login.First = response.Firstname; |
108 | _login.Last = response.Lastname; | 108 | _login.Last = response.Lastname; |
109 | _login.Agent = response.AgentID; | 109 | _login.Agent = response.AgentID; |
110 | _login.Session = response.SessionID; | 110 | _login.Session = response.SessionID; |
111 | _login.SecureSession = response.SecureSessionID; | 111 | _login.SecureSession = response.SecureSessionID; |
112 | _login.CircuitCode = (uint)response.CircuitCode; | 112 | _login.CircuitCode = (uint)response.CircuitCode; |
113 | _login.CapsPath = capsPath; | 113 | _login.CapsPath = capsPath; |
114 | 114 | ||
115 | if( OnLoginToRegion != null ) | 115 | if( OnLoginToRegion != null ) |
116 | { | 116 | { |
117 | OnLoginToRegion(currentRegion, _login); | 117 | OnLoginToRegion(currentRegion, _login); |
118 | } | 118 | } |
119 | } | 119 | } |
120 | else | 120 | else |
121 | { | 121 | { |
122 | Console.WriteLine("not found region " + currentRegion); | 122 | Console.WriteLine("not found region " + currentRegion); |
123 | } | 123 | } |
124 | 124 | ||
125 | } | 125 | } |
126 | 126 | ||
127 | protected override InventoryData CreateInventoryData(LLUUID userID) | 127 | protected override InventoryData CreateInventoryData(LLUUID userID) |
128 | { | 128 | { |
129 | List<InventoryFolderBase> folders = m_Parent.InventoryService.RequestFirstLevelFolders(userID); | 129 | List<InventoryFolderBase> folders = m_Parent.InventoryService.RequestFirstLevelFolders(userID); |
130 | if (folders.Count > 0) | 130 | if (folders.Count > 0) |
131 | { | 131 | { |
132 | LLUUID rootID = LLUUID.Zero; | 132 | LLUUID rootID = LLUUID.Zero; |
133 | ArrayList AgentInventoryArray = new ArrayList(); | 133 | ArrayList AgentInventoryArray = new ArrayList(); |
134 | Hashtable TempHash; | 134 | Hashtable TempHash; |
135 | foreach (InventoryFolderBase InvFolder in folders) | 135 | foreach (InventoryFolderBase InvFolder in folders) |
136 | { | 136 | { |
137 | if (InvFolder.parentID == LLUUID.Zero) | 137 | if (InvFolder.parentID == LLUUID.Zero) |
138 | { | 138 | { |
139 | rootID = InvFolder.folderID; | 139 | rootID = InvFolder.folderID; |
140 | } | 140 | } |
141 | TempHash = new Hashtable(); | 141 | TempHash = new Hashtable(); |
142 | TempHash["name"] = InvFolder.name; | 142 | TempHash["name"] = InvFolder.name; |
143 | TempHash["parent_id"] = InvFolder.parentID.ToStringHyphenated(); | 143 | TempHash["parent_id"] = InvFolder.parentID.ToStringHyphenated(); |
144 | TempHash["version"] = (Int32)InvFolder.version; | 144 | TempHash["version"] = (Int32)InvFolder.version; |
145 | TempHash["type_default"] = (Int32)InvFolder.type; | 145 | TempHash["type_default"] = (Int32)InvFolder.type; |
146 | TempHash["folder_id"] = InvFolder.folderID.ToStringHyphenated(); | 146 | TempHash["folder_id"] = InvFolder.folderID.ToStringHyphenated(); |
147 | AgentInventoryArray.Add(TempHash); | 147 | AgentInventoryArray.Add(TempHash); |
148 | } | 148 | } |
149 | return new InventoryData(AgentInventoryArray, rootID); | 149 | return new InventoryData(AgentInventoryArray, rootID); |
150 | } | 150 | } |
151 | else | 151 | else |
152 | { | 152 | { |
153 | AgentInventory userInventory = new AgentInventory(); | 153 | AgentInventory userInventory = new AgentInventory(); |
154 | userInventory.CreateRootFolder(userID, false); | 154 | userInventory.CreateRootFolder(userID, false); |
155 | 155 | ||
156 | ArrayList AgentInventoryArray = new ArrayList(); | 156 | ArrayList AgentInventoryArray = new ArrayList(); |
157 | Hashtable TempHash; | 157 | Hashtable TempHash; |
158 | foreach (OpenSim.Framework.Inventory.InventoryFolder InvFolder in userInventory.InventoryFolders.Values) | 158 | foreach (OpenSim.Framework.Inventory.InventoryFolder InvFolder in userInventory.InventoryFolders.Values) |
159 | { | 159 | { |
160 | TempHash = new Hashtable(); | 160 | TempHash = new Hashtable(); |
161 | TempHash["name"] = InvFolder.FolderName; | 161 | TempHash["name"] = InvFolder.FolderName; |
162 | TempHash["parent_id"] = InvFolder.ParentID.ToStringHyphenated(); | 162 | TempHash["parent_id"] = InvFolder.ParentID.ToStringHyphenated(); |
163 | TempHash["version"] = (Int32)InvFolder.Version; | 163 | TempHash["version"] = (Int32)InvFolder.Version; |
164 | TempHash["type_default"] = (Int32)InvFolder.DefaultType; | 164 | TempHash["type_default"] = (Int32)InvFolder.DefaultType; |
165 | TempHash["folder_id"] = InvFolder.FolderID.ToStringHyphenated(); | 165 | TempHash["folder_id"] = InvFolder.FolderID.ToStringHyphenated(); |
166 | AgentInventoryArray.Add(TempHash); | 166 | AgentInventoryArray.Add(TempHash); |
167 | } | 167 | } |
168 | 168 | ||
169 | return new InventoryData(AgentInventoryArray, userInventory.InventoryRoot.FolderID); | 169 | return new InventoryData(AgentInventoryArray, userInventory.InventoryRoot.FolderID); |
170 | } | 170 | } |
171 | } | 171 | } |
172 | } | 172 | } |
173 | } | 173 | } |
diff --git a/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs b/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs index f364771..56e1740 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs | |||
@@ -1,52 +1,52 @@ | |||
1 | using System.Collections.Generic; | 1 | using System.Collections.Generic; |
2 | using libsecondlife; | 2 | using libsecondlife; |
3 | using OpenSim.Framework.Communications; | 3 | using OpenSim.Framework.Communications; |
4 | using OpenSim.Framework.Types; | 4 | using OpenSim.Framework.Types; |
5 | using InventoryFolder = OpenSim.Framework.Communications.Caches.InventoryFolder; | 5 | using InventoryFolder = OpenSim.Framework.Communications.Caches.InventoryFolder; |
6 | 6 | ||
7 | 7 | ||
8 | namespace OpenSim.Region.Communications.OGS1 | 8 | namespace OpenSim.Region.Communications.OGS1 |
9 | { | 9 | { |
10 | public class OGS1InventoryService : IInventoryServices | 10 | public class OGS1InventoryService : IInventoryServices |
11 | { | 11 | { |
12 | 12 | ||
13 | public OGS1InventoryService() | 13 | public OGS1InventoryService() |
14 | { | 14 | { |
15 | 15 | ||
16 | } | 16 | } |
17 | 17 | ||
18 | #region IInventoryServices Members | 18 | #region IInventoryServices Members |
19 | 19 | ||
20 | public void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, InventoryItemInfo itemCallBack) | 20 | public void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, InventoryItemInfo itemCallBack) |
21 | { | 21 | { |
22 | 22 | ||
23 | } | 23 | } |
24 | 24 | ||
25 | public void AddNewInventoryFolder(LLUUID userID, InventoryFolder folder) | 25 | public void AddNewInventoryFolder(LLUUID userID, InventoryFolder folder) |
26 | { | 26 | { |
27 | 27 | ||
28 | } | 28 | } |
29 | 29 | ||
30 | public void AddNewInventoryItem(LLUUID userID, InventoryItemBase item) | 30 | public void AddNewInventoryItem(LLUUID userID, InventoryItemBase item) |
31 | { | 31 | { |
32 | 32 | ||
33 | } | 33 | } |
34 | 34 | ||
35 | public void DeleteInventoryItem(LLUUID userID, InventoryItemBase item) | 35 | public void DeleteInventoryItem(LLUUID userID, InventoryItemBase item) |
36 | { | 36 | { |
37 | 37 | ||
38 | } | 38 | } |
39 | 39 | ||
40 | public void CreateNewUserInventory(LLUUID user) | 40 | public void CreateNewUserInventory(LLUUID user) |
41 | { | 41 | { |
42 | 42 | ||
43 | } | 43 | } |
44 | 44 | ||
45 | public List<InventoryFolderBase> RequestFirstLevelFolders(LLUUID userID) | 45 | public List<InventoryFolderBase> RequestFirstLevelFolders(LLUUID userID) |
46 | { | 46 | { |
47 | return new List<InventoryFolderBase>(); | 47 | return new List<InventoryFolderBase>(); |
48 | } | 48 | } |
49 | 49 | ||
50 | #endregion | 50 | #endregion |
51 | } | 51 | } |
52 | } | 52 | } |
diff --git a/OpenSim/Region/Environment/Interfaces/IDynamicTextureManager.cs b/OpenSim/Region/Environment/Interfaces/IDynamicTextureManager.cs index 05cecf8..e91240a 100644 --- a/OpenSim/Region/Environment/Interfaces/IDynamicTextureManager.cs +++ b/OpenSim/Region/Environment/Interfaces/IDynamicTextureManager.cs | |||
@@ -1,17 +1,17 @@ | |||
1 | using System.IO; | 1 | using System.IO; |
2 | using libsecondlife; | 2 | using libsecondlife; |
3 | 3 | ||
4 | namespace OpenSim.Region.Environment.Interfaces | 4 | namespace OpenSim.Region.Environment.Interfaces |
5 | { | 5 | { |
6 | public interface IDynamicTextureManager | 6 | public interface IDynamicTextureManager |
7 | { | 7 | { |
8 | void RegisterRender(string handleType, IDynamicTextureRender render); | 8 | void RegisterRender(string handleType, IDynamicTextureRender render); |
9 | void ReturnData(LLUUID id, byte[] data); | 9 | void ReturnData(LLUUID id, byte[] data); |
10 | 10 | ||
11 | LLUUID AddDynamicTextureURL(LLUUID simID, LLUUID primID, string contentType, string url, string extraParams, | 11 | LLUUID AddDynamicTextureURL(LLUUID simID, LLUUID primID, string contentType, string url, string extraParams, |
12 | int updateTimer); | 12 | int updateTimer); |
13 | 13 | ||
14 | LLUUID AddDynamicTextureData(LLUUID simID, LLUUID primID, string contentType, string data, string extraParams, | 14 | LLUUID AddDynamicTextureData(LLUUID simID, LLUUID primID, string contentType, string data, string extraParams, |
15 | int updateTimer); | 15 | int updateTimer); |
16 | } | 16 | } |
17 | 17 | ||
diff --git a/OpenSim/Region/Environment/Interfaces/IHttpRequests.cs b/OpenSim/Region/Environment/Interfaces/IHttpRequests.cs index cb00b48..49b96d0 100644 --- a/OpenSim/Region/Environment/Interfaces/IHttpRequests.cs +++ b/OpenSim/Region/Environment/Interfaces/IHttpRequests.cs | |||
@@ -1,5 +1,5 @@ | |||
1 | using libsecondlife; | 1 | using libsecondlife; |
2 | 2 | ||
3 | namespace OpenSim.Region.Environment.Interfaces | 3 | namespace OpenSim.Region.Environment.Interfaces |
4 | { | 4 | { |
5 | public interface IHttpRequests | 5 | public interface IHttpRequests |
diff --git a/OpenSim/Region/Environment/Interfaces/IRegionModule.cs b/OpenSim/Region/Environment/Interfaces/IRegionModule.cs index 981b73f..2c7c742 100644 --- a/OpenSim/Region/Environment/Interfaces/IRegionModule.cs +++ b/OpenSim/Region/Environment/Interfaces/IRegionModule.cs | |||
@@ -1,5 +1,5 @@ | |||
1 | using OpenSim.Region.Environment.Scenes; | 1 | using OpenSim.Region.Environment.Scenes; |
2 | 2 | ||
3 | namespace OpenSim.Region.Environment.Interfaces | 3 | namespace OpenSim.Region.Environment.Interfaces |
4 | { | 4 | { |
5 | public interface IRegionModule | 5 | public interface IRegionModule |
diff --git a/OpenSim/Region/Environment/Interfaces/ISimChat.cs b/OpenSim/Region/Environment/Interfaces/ISimChat.cs index 5aa78ab..36ff1ad 100644 --- a/OpenSim/Region/Environment/Interfaces/ISimChat.cs +++ b/OpenSim/Region/Environment/Interfaces/ISimChat.cs | |||
@@ -1,5 +1,5 @@ | |||
1 | using libsecondlife; | 1 | using libsecondlife; |
2 | 2 | ||
3 | namespace OpenSim.Region.Environment.Interfaces | 3 | namespace OpenSim.Region.Environment.Interfaces |
4 | { | 4 | { |
5 | public interface ISimChat | 5 | public interface ISimChat |
diff --git a/OpenSim/Region/Environment/Interfaces/ITerrain.cs b/OpenSim/Region/Environment/Interfaces/ITerrain.cs index f9ff71a..3d0169a 100644 --- a/OpenSim/Region/Environment/Interfaces/ITerrain.cs +++ b/OpenSim/Region/Environment/Interfaces/ITerrain.cs | |||
@@ -1,16 +1,16 @@ | |||
1 | using OpenSim.Framework.Interfaces; | 1 | using OpenSim.Framework.Interfaces; |
2 | 2 | ||
3 | namespace OpenSim.Region.Environment.Interfaces | 3 | namespace OpenSim.Region.Environment.Interfaces |
4 | { | 4 | { |
5 | public interface ITerrain | 5 | public interface ITerrain |
6 | { | 6 | { |
7 | bool Tainted(); | 7 | bool Tainted(); |
8 | bool Tainted(int x, int y); | 8 | bool Tainted(int x, int y); |
9 | void ResetTaint(); | 9 | void ResetTaint(); |
10 | 10 | ||
11 | void ModifyTerrain(float height, float seconds, byte brushsize, byte action, float north, float west, | 11 | void ModifyTerrain(float height, float seconds, byte brushsize, byte action, float north, float west, |
12 | IClientAPI remoteUser); | 12 | IClientAPI remoteUser); |
13 | 13 | ||
14 | void CheckHeightValues(); | 14 | void CheckHeightValues(); |
15 | float[] GetHeights1D(); | 15 | float[] GetHeights1D(); |
16 | float[,] GetHeights2D(); | 16 | float[,] GetHeights2D(); |
diff --git a/OpenSim/Region/Environment/ModuleLoader.cs b/OpenSim/Region/Environment/ModuleLoader.cs index 2b18949..ce2a843 100644 --- a/OpenSim/Region/Environment/ModuleLoader.cs +++ b/OpenSim/Region/Environment/ModuleLoader.cs | |||
@@ -1,156 +1,156 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.IO; | 3 | using System.IO; |
4 | using System.Reflection; | 4 | using System.Reflection; |
5 | using OpenSim.Region.Environment.Interfaces; | 5 | using OpenSim.Region.Environment.Interfaces; |
6 | using OpenSim.Region.Environment.Modules; | 6 | using OpenSim.Region.Environment.Modules; |
7 | using OpenSim.Region.Environment.Scenes; | 7 | using OpenSim.Region.Environment.Scenes; |
8 | 8 | ||
9 | namespace OpenSim.Region.Environment | 9 | namespace OpenSim.Region.Environment |
10 | { | 10 | { |
11 | public class ModuleLoader | 11 | public class ModuleLoader |
12 | { | 12 | { |
13 | public Dictionary<string, Assembly> LoadedAssemblys = new Dictionary<string, Assembly>(); | 13 | public Dictionary<string, Assembly> LoadedAssemblys = new Dictionary<string, Assembly>(); |
14 | 14 | ||
15 | public List<IRegionModule> LoadedModules = new List<IRegionModule>(); | 15 | public List<IRegionModule> LoadedModules = new List<IRegionModule>(); |
16 | public Dictionary<string, IRegionModule> LoadedSharedModules = new Dictionary<string, IRegionModule>(); | 16 | public Dictionary<string, IRegionModule> LoadedSharedModules = new Dictionary<string, IRegionModule>(); |
17 | 17 | ||
18 | public ModuleLoader() | 18 | public ModuleLoader() |
19 | { | 19 | { |
20 | } | 20 | } |
21 | 21 | ||
22 | /// <summary> | 22 | /// <summary> |
23 | /// Should have a module factory? | 23 | /// Should have a module factory? |
24 | /// </summary> | 24 | /// </summary> |
25 | /// <param name="scene"></param> | 25 | /// <param name="scene"></param> |
26 | public void CreateDefaultModules(Scene scene, string exceptModules) | 26 | public void CreateDefaultModules(Scene scene, string exceptModules) |
27 | { | 27 | { |
28 | IRegionModule module = new XferModule(); | 28 | IRegionModule module = new XferModule(); |
29 | InitialiseModule(module, scene); | 29 | InitialiseModule(module, scene); |
30 | 30 | ||
31 | module = new ChatModule(); | 31 | module = new ChatModule(); |
32 | InitialiseModule(module, scene); | 32 | InitialiseModule(module, scene); |
33 | 33 | ||
34 | module = new AvatarProfilesModule(); | 34 | module = new AvatarProfilesModule(); |
35 | InitialiseModule(module, scene); | 35 | InitialiseModule(module, scene); |
36 | 36 | ||
37 | LoadRegionModule("OpenSim.Region.ExtensionsScriptModule.dll", "ExtensionsScriptingModule", scene); | 37 | LoadRegionModule("OpenSim.Region.ExtensionsScriptModule.dll", "ExtensionsScriptingModule", scene); |
38 | 38 | ||
39 | string lslPath = Path.Combine("ScriptEngines", "OpenSim.Region.ScriptEngine.DotNetEngine.dll"); | 39 | string lslPath = Path.Combine("ScriptEngines", "OpenSim.Region.ScriptEngine.DotNetEngine.dll"); |
40 | LoadRegionModule(lslPath, "LSLScriptingModule", scene); | 40 | LoadRegionModule(lslPath, "LSLScriptingModule", scene); |
41 | } | 41 | } |
42 | 42 | ||
43 | 43 | ||
44 | public void LoadDefaultSharedModules(string exceptModules) | 44 | public void LoadDefaultSharedModules(string exceptModules) |
45 | { | 45 | { |
46 | DynamicTextureModule dynamicModule = new DynamicTextureModule(); | 46 | DynamicTextureModule dynamicModule = new DynamicTextureModule(); |
47 | LoadedSharedModules.Add(dynamicModule.GetName(), dynamicModule); | 47 | LoadedSharedModules.Add(dynamicModule.GetName(), dynamicModule); |
48 | } | 48 | } |
49 | 49 | ||
50 | public void InitialiseSharedModules(Scene scene) | 50 | public void InitialiseSharedModules(Scene scene) |
51 | { | 51 | { |
52 | foreach (IRegionModule module in LoadedSharedModules.Values) | 52 | foreach (IRegionModule module in LoadedSharedModules.Values) |
53 | { | 53 | { |
54 | module.Initialise(scene); | 54 | module.Initialise(scene); |
55 | scene.AddModule(module.GetName(), module); //should be doing this? | 55 | scene.AddModule(module.GetName(), module); //should be doing this? |
56 | } | 56 | } |
57 | } | 57 | } |
58 | 58 | ||
59 | private void InitialiseModule(IRegionModule module, Scene scene) | 59 | private void InitialiseModule(IRegionModule module, Scene scene) |
60 | { | 60 | { |
61 | module.Initialise(scene); | 61 | module.Initialise(scene); |
62 | scene.AddModule(module.GetName(), module); | 62 | scene.AddModule(module.GetName(), module); |
63 | LoadedModules.Add(module); | 63 | LoadedModules.Add(module); |
64 | } | 64 | } |
65 | 65 | ||
66 | /// <summary> | 66 | /// <summary> |
67 | /// Loads/initialises a Module instance that can be used by mutliple Regions | 67 | /// Loads/initialises a Module instance that can be used by mutliple Regions |
68 | /// </summary> | 68 | /// </summary> |
69 | /// <param name="dllName"></param> | 69 | /// <param name="dllName"></param> |
70 | /// <param name="moduleName"></param> | 70 | /// <param name="moduleName"></param> |
71 | /// <param name="scene"></param> | 71 | /// <param name="scene"></param> |
72 | public void LoadSharedModule(string dllName, string moduleName) | 72 | public void LoadSharedModule(string dllName, string moduleName) |
73 | { | 73 | { |
74 | IRegionModule module = LoadModule(dllName, moduleName); | 74 | IRegionModule module = LoadModule(dllName, moduleName); |
75 | if (module != null) | 75 | if (module != null) |
76 | { | 76 | { |
77 | LoadedSharedModules.Add(module.GetName(), module); | 77 | LoadedSharedModules.Add(module.GetName(), module); |
78 | } | 78 | } |
79 | } | 79 | } |
80 | 80 | ||
81 | public void LoadRegionModule(string dllName, string moduleName, Scene scene) | 81 | public void LoadRegionModule(string dllName, string moduleName, Scene scene) |
82 | { | 82 | { |
83 | IRegionModule module = LoadModule(dllName, moduleName); | 83 | IRegionModule module = LoadModule(dllName, moduleName); |
84 | if (module != null) | 84 | if (module != null) |
85 | { | 85 | { |
86 | InitialiseModule(module, scene); | 86 | InitialiseModule(module, scene); |
87 | } | 87 | } |
88 | } | 88 | } |
89 | 89 | ||
90 | /// <summary> | 90 | /// <summary> |
91 | /// Loads a external Module (if not already loaded) and creates a new instance of it. | 91 | /// Loads a external Module (if not already loaded) and creates a new instance of it. |
92 | /// </summary> | 92 | /// </summary> |
93 | /// <param name="dllName"></param> | 93 | /// <param name="dllName"></param> |
94 | /// <param name="moduleName"></param> | 94 | /// <param name="moduleName"></param> |
95 | /// <param name="scene"></param> | 95 | /// <param name="scene"></param> |
96 | public IRegionModule LoadModule(string dllName, string moduleName) | 96 | public IRegionModule LoadModule(string dllName, string moduleName) |
97 | { | 97 | { |
98 | Assembly pluginAssembly = null; | 98 | Assembly pluginAssembly = null; |
99 | if (LoadedAssemblys.ContainsKey(dllName)) | 99 | if (LoadedAssemblys.ContainsKey(dllName)) |
100 | { | 100 | { |
101 | pluginAssembly = LoadedAssemblys[dllName]; | 101 | pluginAssembly = LoadedAssemblys[dllName]; |
102 | } | 102 | } |
103 | else | 103 | else |
104 | { | 104 | { |
105 | pluginAssembly = Assembly.LoadFrom(dllName); | 105 | pluginAssembly = Assembly.LoadFrom(dllName); |
106 | LoadedAssemblys.Add(dllName, pluginAssembly); | 106 | LoadedAssemblys.Add(dllName, pluginAssembly); |
107 | } | 107 | } |
108 | 108 | ||
109 | IRegionModule module = null; | 109 | IRegionModule module = null; |
110 | foreach (Type pluginType in pluginAssembly.GetTypes()) | 110 | foreach (Type pluginType in pluginAssembly.GetTypes()) |
111 | { | 111 | { |
112 | if (pluginType.IsPublic) | 112 | if (pluginType.IsPublic) |
113 | { | 113 | { |
114 | if (!pluginType.IsAbstract) | 114 | if (!pluginType.IsAbstract) |
115 | { | 115 | { |
116 | Type typeInterface = pluginType.GetInterface("IRegionModule", true); | 116 | Type typeInterface = pluginType.GetInterface("IRegionModule", true); |
117 | 117 | ||
118 | if (typeInterface != null) | 118 | if (typeInterface != null) |
119 | { | 119 | { |
120 | module = | 120 | module = |
121 | (IRegionModule) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); | 121 | (IRegionModule) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); |
122 | break; | 122 | break; |
123 | } | 123 | } |
124 | typeInterface = null; | 124 | typeInterface = null; |
125 | } | 125 | } |
126 | } | 126 | } |
127 | } | 127 | } |
128 | pluginAssembly = null; | 128 | pluginAssembly = null; |
129 | 129 | ||
130 | if ((module != null) || (module.GetName() == moduleName)) | 130 | if ((module != null) || (module.GetName() == moduleName)) |
131 | { | 131 | { |
132 | return module; | 132 | return module; |
133 | } | 133 | } |
134 | 134 | ||
135 | return null; | 135 | return null; |
136 | } | 136 | } |
137 | 137 | ||
138 | public void PostInitialise() | 138 | public void PostInitialise() |
139 | { | 139 | { |
140 | foreach (IRegionModule module in LoadedSharedModules.Values) | 140 | foreach (IRegionModule module in LoadedSharedModules.Values) |
141 | { | 141 | { |
142 | module.PostInitialise(); | 142 | module.PostInitialise(); |
143 | } | 143 | } |
144 | 144 | ||
145 | foreach (IRegionModule module in LoadedModules) | 145 | foreach (IRegionModule module in LoadedModules) |
146 | { | 146 | { |
147 | module.PostInitialise(); | 147 | module.PostInitialise(); |
148 | } | 148 | } |
149 | } | 149 | } |
150 | 150 | ||
151 | public void ClearCache() | 151 | public void ClearCache() |
152 | { | 152 | { |
153 | LoadedAssemblys.Clear(); | 153 | LoadedAssemblys.Clear(); |
154 | } | 154 | } |
155 | } | 155 | } |
156 | } \ No newline at end of file | 156 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Environment/Modules/AssetDownloadModule.cs b/OpenSim/Region/Environment/Modules/AssetDownloadModule.cs index 511b5f6..7d789f9 100644 --- a/OpenSim/Region/Environment/Modules/AssetDownloadModule.cs +++ b/OpenSim/Region/Environment/Modules/AssetDownloadModule.cs | |||
@@ -1,7 +1,7 @@ | |||
1 | using OpenSim.Framework.Interfaces; | 1 | using OpenSim.Framework.Interfaces; |
2 | using OpenSim.Region.Environment.Interfaces; | 2 | using OpenSim.Region.Environment.Interfaces; |
3 | using OpenSim.Region.Environment.Scenes; | 3 | using OpenSim.Region.Environment.Scenes; |
4 | 4 | ||
5 | namespace OpenSim.Region.Environment.Modules | 5 | namespace OpenSim.Region.Environment.Modules |
6 | { | 6 | { |
7 | public class AssetDownloadModule : IRegionModule | 7 | public class AssetDownloadModule : IRegionModule |
@@ -9,7 +9,7 @@ namespace OpenSim.Region.Environment.Modules | |||
9 | private Scene m_scene; | 9 | private Scene m_scene; |
10 | 10 | ||
11 | public AssetDownloadModule() | 11 | public AssetDownloadModule() |
12 | { | 12 | { |
13 | } | 13 | } |
14 | 14 | ||
15 | public void Initialise(Scene scene) | 15 | public void Initialise(Scene scene) |
@@ -19,7 +19,7 @@ namespace OpenSim.Region.Environment.Modules | |||
19 | } | 19 | } |
20 | 20 | ||
21 | public void PostInitialise() | 21 | public void PostInitialise() |
22 | { | 22 | { |
23 | } | 23 | } |
24 | 24 | ||
25 | public void CloseDown() | 25 | public void CloseDown() |
diff --git a/OpenSim/Region/Environment/Modules/AvatarProfilesModule.cs b/OpenSim/Region/Environment/Modules/AvatarProfilesModule.cs index ea5f787..aaa9261 100644 --- a/OpenSim/Region/Environment/Modules/AvatarProfilesModule.cs +++ b/OpenSim/Region/Environment/Modules/AvatarProfilesModule.cs | |||
@@ -1,16 +1,16 @@ | |||
1 | using libsecondlife; | 1 | using libsecondlife; |
2 | using OpenSim.Framework.Interfaces; | 2 | using OpenSim.Framework.Interfaces; |
3 | using OpenSim.Region.Environment.Interfaces; | 3 | using OpenSim.Region.Environment.Interfaces; |
4 | using OpenSim.Region.Environment.Scenes; | 4 | using OpenSim.Region.Environment.Scenes; |
5 | 5 | ||
6 | namespace OpenSim.Region.Environment.Modules | 6 | namespace OpenSim.Region.Environment.Modules |
7 | { | 7 | { |
8 | public class AvatarProfilesModule : IRegionModule | 8 | public class AvatarProfilesModule : IRegionModule |
9 | { | 9 | { |
10 | private Scene m_scene; | 10 | private Scene m_scene; |
11 | 11 | ||
12 | public AvatarProfilesModule() | 12 | public AvatarProfilesModule() |
13 | { | 13 | { |
14 | } | 14 | } |
15 | 15 | ||
16 | public void Initialise(Scene scene) | 16 | public void Initialise(Scene scene) |
@@ -20,11 +20,11 @@ namespace OpenSim.Region.Environment.Modules | |||
20 | } | 20 | } |
21 | 21 | ||
22 | public void PostInitialise() | 22 | public void PostInitialise() |
23 | { | 23 | { |
24 | } | 24 | } |
25 | 25 | ||
26 | public void CloseDown() | 26 | public void CloseDown() |
27 | { | 27 | { |
28 | } | 28 | } |
29 | 29 | ||
30 | public string GetName() | 30 | public string GetName() |
@@ -58,7 +58,7 @@ namespace OpenSim.Region.Environment.Modules | |||
58 | string bornOn = "Before now"; | 58 | string bornOn = "Before now"; |
59 | string flAbout = "First life? What is one of those? OpenSim is my life!"; | 59 | string flAbout = "First life? What is one of those? OpenSim is my life!"; |
60 | LLUUID partner = new LLUUID("11111111-1111-0000-0000-000100bba000"); | 60 | LLUUID partner = new LLUUID("11111111-1111-0000-0000-000100bba000"); |
61 | remoteClient.SendAvatarProperties(avatarID, about, bornOn, "", flAbout, 0, LLUUID.Zero, LLUUID.Zero, "", | 61 | remoteClient.SendAvatarProperties(avatarID, about, bornOn, "", flAbout, 0, LLUUID.Zero, LLUUID.Zero, "", |
62 | partner); | 62 | partner); |
63 | } | 63 | } |
64 | } | 64 | } |
diff --git a/OpenSim/Region/Environment/Modules/ChatModule.cs b/OpenSim/Region/Environment/Modules/ChatModule.cs index 1c7b806..2eac7d6 100644 --- a/OpenSim/Region/Environment/Modules/ChatModule.cs +++ b/OpenSim/Region/Environment/Modules/ChatModule.cs | |||
@@ -1,214 +1,214 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.IO; | 2 | using System.IO; |
3 | using System.Net.Sockets; | 3 | using System.Net.Sockets; |
4 | using System.Threading; | 4 | using System.Threading; |
5 | using libsecondlife; | 5 | using libsecondlife; |
6 | using OpenSim.Framework.Interfaces; | 6 | using OpenSim.Framework.Interfaces; |
7 | using OpenSim.Framework.Utilities; | 7 | using OpenSim.Framework.Utilities; |
8 | using OpenSim.Region.Environment.Interfaces; | 8 | using OpenSim.Region.Environment.Interfaces; |
9 | using OpenSim.Region.Environment.Scenes; | 9 | using OpenSim.Region.Environment.Scenes; |
10 | 10 | ||
11 | namespace OpenSim.Region.Environment.Modules | 11 | namespace OpenSim.Region.Environment.Modules |
12 | { | 12 | { |
13 | public class ChatModule : IRegionModule, ISimChat | 13 | public class ChatModule : IRegionModule, ISimChat |
14 | { | 14 | { |
15 | private Scene m_scene; | 15 | private Scene m_scene; |
16 | 16 | ||
17 | private string m_server = "irc2.choopa.net"; | 17 | private string m_server = "irc2.choopa.net"; |
18 | 18 | ||
19 | // private int m_port = 6668; | 19 | // private int m_port = 6668; |
20 | //private string m_user = "USER OpenSimBot 8 * :I'm a OpenSim to irc bot"; | 20 | //private string m_user = "USER OpenSimBot 8 * :I'm a OpenSim to irc bot"; |
21 | private string m_nick = "OSimBot"; | 21 | private string m_nick = "OSimBot"; |
22 | private string m_channel = "#opensim"; | 22 | private string m_channel = "#opensim"; |
23 | 23 | ||
24 | // private NetworkStream m_stream; | 24 | // private NetworkStream m_stream; |
25 | private TcpClient m_irc; | 25 | private TcpClient m_irc; |
26 | private StreamWriter m_ircWriter; | 26 | private StreamWriter m_ircWriter; |
27 | private StreamReader m_ircReader; | 27 | private StreamReader m_ircReader; |
28 | 28 | ||
29 | // private Thread pingSender; | 29 | // private Thread pingSender; |
30 | // private Thread listener; | 30 | // private Thread listener; |
31 | 31 | ||
32 | private bool connected = false; | 32 | private bool connected = false; |
33 | 33 | ||
34 | public ChatModule() | 34 | public ChatModule() |
35 | { | 35 | { |
36 | m_nick = "OSimBot" + Util.RandomClass.Next(1, 99); | 36 | m_nick = "OSimBot" + Util.RandomClass.Next(1, 99); |
37 | m_irc = null; | 37 | m_irc = null; |
38 | m_ircWriter = null; | 38 | m_ircWriter = null; |
39 | m_ircReader = null; | 39 | m_ircReader = null; |
40 | } | 40 | } |
41 | 41 | ||
42 | public void Initialise(Scene scene) | 42 | public void Initialise(Scene scene) |
43 | { | 43 | { |
44 | m_scene = scene; | 44 | m_scene = scene; |
45 | m_scene.EventManager.OnNewClient += NewClient; | 45 | m_scene.EventManager.OnNewClient += NewClient; |
46 | 46 | ||
47 | m_scene.RegisterModuleInterface<ISimChat>(this); | 47 | m_scene.RegisterModuleInterface<ISimChat>(this); |
48 | } | 48 | } |
49 | 49 | ||
50 | public void PostInitialise() | 50 | public void PostInitialise() |
51 | { | 51 | { |
52 | /* | 52 | /* |
53 | try | 53 | try |
54 | { | 54 | { |
55 | m_irc = new TcpClient(m_server, m_port); | 55 | m_irc = new TcpClient(m_server, m_port); |
56 | m_stream = m_irc.GetStream(); | 56 | m_stream = m_irc.GetStream(); |
57 | m_ircReader = new StreamReader(m_stream); | 57 | m_ircReader = new StreamReader(m_stream); |
58 | m_ircWriter = new StreamWriter(m_stream); | 58 | m_ircWriter = new StreamWriter(m_stream); |
59 | 59 | ||
60 | pingSender = new Thread(new ThreadStart(this.PingRun)); | 60 | pingSender = new Thread(new ThreadStart(this.PingRun)); |
61 | pingSender.Start(); | 61 | pingSender.Start(); |
62 | 62 | ||
63 | listener = new Thread(new ThreadStart(this.ListenerRun)); | 63 | listener = new Thread(new ThreadStart(this.ListenerRun)); |
64 | listener.Start(); | 64 | listener.Start(); |
65 | 65 | ||
66 | m_ircWriter.WriteLine(m_user); | 66 | m_ircWriter.WriteLine(m_user); |
67 | m_ircWriter.Flush(); | 67 | m_ircWriter.Flush(); |
68 | m_ircWriter.WriteLine("NICK " + m_nick); | 68 | m_ircWriter.WriteLine("NICK " + m_nick); |
69 | m_ircWriter.Flush(); | 69 | m_ircWriter.Flush(); |
70 | m_ircWriter.WriteLine("JOIN " + m_channel); | 70 | m_ircWriter.WriteLine("JOIN " + m_channel); |
71 | m_ircWriter.Flush(); | 71 | m_ircWriter.Flush(); |
72 | connected = true; | 72 | connected = true; |
73 | } | 73 | } |
74 | catch (Exception e) | 74 | catch (Exception e) |
75 | { | 75 | { |
76 | Console.WriteLine(e.ToString()); | 76 | Console.WriteLine(e.ToString()); |
77 | } | 77 | } |
78 | */ | 78 | */ |
79 | } | 79 | } |
80 | 80 | ||
81 | public void CloseDown() | 81 | public void CloseDown() |
82 | { | 82 | { |
83 | m_ircWriter.Close(); | 83 | m_ircWriter.Close(); |
84 | m_ircReader.Close(); | 84 | m_ircReader.Close(); |
85 | m_irc.Close(); | 85 | m_irc.Close(); |
86 | } | 86 | } |
87 | 87 | ||
88 | public string GetName() | 88 | public string GetName() |
89 | { | 89 | { |
90 | return "ChatModule"; | 90 | return "ChatModule"; |
91 | } | 91 | } |
92 | 92 | ||
93 | public bool IsSharedModule() | 93 | public bool IsSharedModule() |
94 | { | 94 | { |
95 | return false; | 95 | return false; |
96 | } | 96 | } |
97 | 97 | ||
98 | public void NewClient(IClientAPI client) | 98 | public void NewClient(IClientAPI client) |
99 | { | 99 | { |
100 | client.OnChatFromViewer += SimChat; | 100 | client.OnChatFromViewer += SimChat; |
101 | } | 101 | } |
102 | 102 | ||
103 | public void PingRun() | 103 | public void PingRun() |
104 | { | 104 | { |
105 | while (true) | 105 | while (true) |
106 | { | 106 | { |
107 | m_ircWriter.WriteLine("PING :" + m_server); | 107 | m_ircWriter.WriteLine("PING :" + m_server); |
108 | m_ircWriter.Flush(); | 108 | m_ircWriter.Flush(); |
109 | Thread.Sleep(15000); | 109 | Thread.Sleep(15000); |
110 | } | 110 | } |
111 | } | 111 | } |
112 | 112 | ||
113 | public void ListenerRun() | 113 | public void ListenerRun() |
114 | { | 114 | { |
115 | string inputLine; | 115 | string inputLine; |
116 | LLVector3 pos = new LLVector3(128, 128, 20); | 116 | LLVector3 pos = new LLVector3(128, 128, 20); |
117 | while (true) | 117 | while (true) |
118 | { | 118 | { |
119 | while ((inputLine = m_ircReader.ReadLine()) != null) | 119 | while ((inputLine = m_ircReader.ReadLine()) != null) |
120 | { | 120 | { |
121 | Console.WriteLine(inputLine); | 121 | Console.WriteLine(inputLine); |
122 | if (inputLine.Contains(m_channel)) | 122 | if (inputLine.Contains(m_channel)) |
123 | { | 123 | { |
124 | string mess = inputLine.Substring(inputLine.IndexOf(m_channel)); | 124 | string mess = inputLine.Substring(inputLine.IndexOf(m_channel)); |
125 | m_scene.Broadcast(delegate(IClientAPI client) | 125 | m_scene.Broadcast(delegate(IClientAPI client) |
126 | { | 126 | { |
127 | client.SendChatMessage( | 127 | client.SendChatMessage( |
128 | Helpers.StringToField(mess), 255, pos, "IRC:", | 128 | Helpers.StringToField(mess), 255, pos, "IRC:", |
129 | LLUUID.Zero); | 129 | LLUUID.Zero); |
130 | }); | 130 | }); |
131 | } | 131 | } |
132 | } | 132 | } |
133 | } | 133 | } |
134 | } | 134 | } |
135 | 135 | ||
136 | public void SimChat(byte[] message, byte type, int channel, LLVector3 fromPos, string fromName, | 136 | public void SimChat(byte[] message, byte type, int channel, LLVector3 fromPos, string fromName, |
137 | LLUUID fromAgentID) | 137 | LLUUID fromAgentID) |
138 | { | 138 | { |
139 | ScenePresence avatar = null; | 139 | ScenePresence avatar = null; |
140 | avatar = m_scene.GetScenePresence(fromAgentID); | 140 | avatar = m_scene.GetScenePresence(fromAgentID); |
141 | if (avatar != null) | 141 | if (avatar != null) |
142 | { | 142 | { |
143 | fromPos = avatar.AbsolutePosition; | 143 | fromPos = avatar.AbsolutePosition; |
144 | fromName = avatar.Firstname + " " + avatar.Lastname; | 144 | fromName = avatar.Firstname + " " + avatar.Lastname; |
145 | avatar = null; | 145 | avatar = null; |
146 | } | 146 | } |
147 | 147 | ||
148 | if (connected) | 148 | if (connected) |
149 | { | 149 | { |
150 | m_ircWriter.WriteLine("PRIVMSG " + m_channel + " :" + "<" + fromName + ">: " + | 150 | m_ircWriter.WriteLine("PRIVMSG " + m_channel + " :" + "<" + fromName + ">: " + |
151 | Util.FieldToString(message)); | 151 | Util.FieldToString(message)); |
152 | m_ircWriter.Flush(); | 152 | m_ircWriter.Flush(); |
153 | } | 153 | } |
154 | 154 | ||
155 | if (channel == 0) | 155 | if (channel == 0) |
156 | { | 156 | { |
157 | m_scene.ForEachScenePresence(delegate(ScenePresence presence) | 157 | m_scene.ForEachScenePresence(delegate(ScenePresence presence) |
158 | { | 158 | { |
159 | int dis = -1000; | 159 | int dis = -1000; |
160 | 160 | ||
161 | //err ??? the following code seems to be request a scenePresence when it already has a ref to it | 161 | //err ??? the following code seems to be request a scenePresence when it already has a ref to it |
162 | avatar = m_scene.GetScenePresence(presence.ControllingClient.AgentId); | 162 | avatar = m_scene.GetScenePresence(presence.ControllingClient.AgentId); |
163 | if (avatar != null) | 163 | if (avatar != null) |
164 | { | 164 | { |
165 | dis = (int) avatar.AbsolutePosition.GetDistanceTo(fromPos); | 165 | dis = (int) avatar.AbsolutePosition.GetDistanceTo(fromPos); |
166 | } | 166 | } |
167 | 167 | ||
168 | switch (type) | 168 | switch (type) |
169 | { | 169 | { |
170 | case 0: // Whisper | 170 | case 0: // Whisper |
171 | if ((dis < 10) && (dis > -10)) | 171 | if ((dis < 10) && (dis > -10)) |
172 | { | 172 | { |
173 | //should change so the message is sent through the avatar rather than direct to the ClientView | 173 | //should change so the message is sent through the avatar rather than direct to the ClientView |
174 | presence.ControllingClient.SendChatMessage(message, | 174 | presence.ControllingClient.SendChatMessage(message, |
175 | type, | 175 | type, |
176 | fromPos, | 176 | fromPos, |
177 | fromName, | 177 | fromName, |
178 | fromAgentID); | 178 | fromAgentID); |
179 | } | 179 | } |
180 | break; | 180 | break; |
181 | case 1: // Say | 181 | case 1: // Say |
182 | if ((dis < 30) && (dis > -30)) | 182 | if ((dis < 30) && (dis > -30)) |
183 | { | 183 | { |
184 | //Console.WriteLine("sending chat"); | 184 | //Console.WriteLine("sending chat"); |
185 | presence.ControllingClient.SendChatMessage(message, | 185 | presence.ControllingClient.SendChatMessage(message, |
186 | type, | 186 | type, |
187 | fromPos, | 187 | fromPos, |
188 | fromName, | 188 | fromName, |
189 | fromAgentID); | 189 | fromAgentID); |
190 | } | 190 | } |
191 | break; | 191 | break; |
192 | case 2: // Shout | 192 | case 2: // Shout |
193 | if ((dis < 100) && (dis > -100)) | 193 | if ((dis < 100) && (dis > -100)) |
194 | { | 194 | { |
195 | presence.ControllingClient.SendChatMessage(message, | 195 | presence.ControllingClient.SendChatMessage(message, |
196 | type, | 196 | type, |
197 | fromPos, | 197 | fromPos, |
198 | fromName, | 198 | fromName, |
199 | fromAgentID); | 199 | fromAgentID); |
200 | } | 200 | } |
201 | break; | 201 | break; |
202 | 202 | ||
203 | case 0xff: // Broadcast | 203 | case 0xff: // Broadcast |
204 | presence.ControllingClient.SendChatMessage(message, type, | 204 | presence.ControllingClient.SendChatMessage(message, type, |
205 | fromPos, | 205 | fromPos, |
206 | fromName, | 206 | fromName, |
207 | fromAgentID); | 207 | fromAgentID); |
208 | break; | 208 | break; |
209 | } | 209 | } |
210 | }); | 210 | }); |
211 | } | 211 | } |
212 | } | 212 | } |
213 | } | 213 | } |
214 | } \ No newline at end of file | 214 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Environment/Modules/DynamicTextureModule.cs b/OpenSim/Region/Environment/Modules/DynamicTextureModule.cs index 0fd03d3..5f8824c 100644 --- a/OpenSim/Region/Environment/Modules/DynamicTextureModule.cs +++ b/OpenSim/Region/Environment/Modules/DynamicTextureModule.cs | |||
@@ -1,157 +1,157 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using libsecondlife; | 3 | using libsecondlife; |
4 | using OpenSim.Framework.Types; | 4 | using OpenSim.Framework.Types; |
5 | using OpenSim.Framework.Utilities; | 5 | using OpenSim.Framework.Utilities; |
6 | using OpenSim.Region.Environment.Interfaces; | 6 | using OpenSim.Region.Environment.Interfaces; |
7 | using OpenSim.Region.Environment.Scenes; | 7 | using OpenSim.Region.Environment.Scenes; |
8 | 8 | ||
9 | namespace OpenSim.Region.Environment.Modules | 9 | namespace OpenSim.Region.Environment.Modules |
10 | { | 10 | { |
11 | public class DynamicTextureModule : IRegionModule, IDynamicTextureManager | 11 | public class DynamicTextureModule : IRegionModule, IDynamicTextureManager |
12 | { | 12 | { |
13 | private Dictionary<LLUUID, Scene> RegisteredScenes = new Dictionary<LLUUID, Scene>(); | 13 | private Dictionary<LLUUID, Scene> RegisteredScenes = new Dictionary<LLUUID, Scene>(); |
14 | 14 | ||
15 | private Dictionary<string, IDynamicTextureRender> RenderPlugins = | 15 | private Dictionary<string, IDynamicTextureRender> RenderPlugins = |
16 | new Dictionary<string, IDynamicTextureRender>(); | 16 | new Dictionary<string, IDynamicTextureRender>(); |
17 | 17 | ||
18 | private Dictionary<LLUUID, DynamicTextureUpdater> Updaters = new Dictionary<LLUUID, DynamicTextureUpdater>(); | 18 | private Dictionary<LLUUID, DynamicTextureUpdater> Updaters = new Dictionary<LLUUID, DynamicTextureUpdater>(); |
19 | 19 | ||
20 | public void Initialise(Scene scene) | 20 | public void Initialise(Scene scene) |
21 | { | 21 | { |
22 | if (!RegisteredScenes.ContainsKey(scene.RegionInfo.SimUUID)) | 22 | if (!RegisteredScenes.ContainsKey(scene.RegionInfo.SimUUID)) |
23 | { | 23 | { |
24 | RegisteredScenes.Add(scene.RegionInfo.SimUUID, scene); | 24 | RegisteredScenes.Add(scene.RegionInfo.SimUUID, scene); |
25 | scene.RegisterModuleInterface<IDynamicTextureManager>(this); | 25 | scene.RegisterModuleInterface<IDynamicTextureManager>(this); |
26 | } | 26 | } |
27 | } | 27 | } |
28 | 28 | ||
29 | public void PostInitialise() | 29 | public void PostInitialise() |
30 | { | 30 | { |
31 | } | 31 | } |
32 | 32 | ||
33 | public void CloseDown() | 33 | public void CloseDown() |
34 | { | 34 | { |
35 | } | 35 | } |
36 | 36 | ||
37 | public string GetName() | 37 | public string GetName() |
38 | { | 38 | { |
39 | return "DynamicTextureModule"; | 39 | return "DynamicTextureModule"; |
40 | } | 40 | } |
41 | 41 | ||
42 | public bool IsSharedModule() | 42 | public bool IsSharedModule() |
43 | { | 43 | { |
44 | return true; | 44 | return true; |
45 | } | 45 | } |
46 | 46 | ||
47 | public void RegisterRender(string handleType, IDynamicTextureRender render) | 47 | public void RegisterRender(string handleType, IDynamicTextureRender render) |
48 | { | 48 | { |
49 | if (!RenderPlugins.ContainsKey(handleType)) | 49 | if (!RenderPlugins.ContainsKey(handleType)) |
50 | { | 50 | { |
51 | RenderPlugins.Add(handleType, render); | 51 | RenderPlugins.Add(handleType, render); |
52 | } | 52 | } |
53 | } | 53 | } |
54 | 54 | ||
55 | public void ReturnData(LLUUID id, byte[] data) | 55 | public void ReturnData(LLUUID id, byte[] data) |
56 | { | 56 | { |
57 | if (Updaters.ContainsKey(id)) | 57 | if (Updaters.ContainsKey(id)) |
58 | { | 58 | { |
59 | DynamicTextureUpdater updater = Updaters[id]; | 59 | DynamicTextureUpdater updater = Updaters[id]; |
60 | if (RegisteredScenes.ContainsKey(updater.SimUUID)) | 60 | if (RegisteredScenes.ContainsKey(updater.SimUUID)) |
61 | { | 61 | { |
62 | Scene scene = RegisteredScenes[updater.SimUUID]; | 62 | Scene scene = RegisteredScenes[updater.SimUUID]; |
63 | updater.DataReceived(data, scene); | 63 | updater.DataReceived(data, scene); |
64 | } | 64 | } |
65 | } | 65 | } |
66 | } | 66 | } |
67 | 67 | ||
68 | public LLUUID AddDynamicTextureURL(LLUUID simID, LLUUID primID, string contentType, string url, | 68 | public LLUUID AddDynamicTextureURL(LLUUID simID, LLUUID primID, string contentType, string url, |
69 | string extraParams, int updateTimer) | 69 | string extraParams, int updateTimer) |
70 | { | 70 | { |
71 | Console.WriteLine("dynamic texture being created: " + url + " of type " + contentType); | 71 | Console.WriteLine("dynamic texture being created: " + url + " of type " + contentType); |
72 | if (RenderPlugins.ContainsKey(contentType)) | 72 | if (RenderPlugins.ContainsKey(contentType)) |
73 | { | 73 | { |
74 | DynamicTextureUpdater updater = new DynamicTextureUpdater(); | 74 | DynamicTextureUpdater updater = new DynamicTextureUpdater(); |
75 | updater.SimUUID = simID; | 75 | updater.SimUUID = simID; |
76 | updater.PrimID = primID; | 76 | updater.PrimID = primID; |
77 | updater.ContentType = contentType; | 77 | updater.ContentType = contentType; |
78 | updater.Url = url; | 78 | updater.Url = url; |
79 | updater.UpdateTimer = updateTimer; | 79 | updater.UpdateTimer = updateTimer; |
80 | updater.UpdaterID = LLUUID.Random(); | 80 | updater.UpdaterID = LLUUID.Random(); |
81 | updater.Params = extraParams; | 81 | updater.Params = extraParams; |
82 | 82 | ||
83 | if (!Updaters.ContainsKey(updater.UpdaterID)) | 83 | if (!Updaters.ContainsKey(updater.UpdaterID)) |
84 | { | 84 | { |
85 | Updaters.Add(updater.UpdaterID, updater); | 85 | Updaters.Add(updater.UpdaterID, updater); |
86 | } | 86 | } |
87 | 87 | ||
88 | RenderPlugins[contentType].AsyncConvertUrl(updater.UpdaterID, url, extraParams); | 88 | RenderPlugins[contentType].AsyncConvertUrl(updater.UpdaterID, url, extraParams); |
89 | return updater.UpdaterID; | 89 | return updater.UpdaterID; |
90 | } | 90 | } |
91 | return LLUUID.Zero; | 91 | return LLUUID.Zero; |
92 | } | 92 | } |
93 | 93 | ||
94 | public LLUUID AddDynamicTextureData(LLUUID simID, LLUUID primID, string contentType, string data, | 94 | public LLUUID AddDynamicTextureData(LLUUID simID, LLUUID primID, string contentType, string data, |
95 | string extraParams, int updateTimer) | 95 | string extraParams, int updateTimer) |
96 | { | 96 | { |
97 | if (RenderPlugins.ContainsKey(contentType)) | 97 | if (RenderPlugins.ContainsKey(contentType)) |
98 | { | 98 | { |
99 | DynamicTextureUpdater updater = new DynamicTextureUpdater(); | 99 | DynamicTextureUpdater updater = new DynamicTextureUpdater(); |
100 | updater.SimUUID = simID; | 100 | updater.SimUUID = simID; |
101 | updater.PrimID = primID; | 101 | updater.PrimID = primID; |
102 | updater.ContentType = contentType; | 102 | updater.ContentType = contentType; |
103 | updater.BodyData = data; | 103 | updater.BodyData = data; |
104 | updater.UpdateTimer = updateTimer; | 104 | updater.UpdateTimer = updateTimer; |
105 | updater.UpdaterID = LLUUID.Random(); | 105 | updater.UpdaterID = LLUUID.Random(); |
106 | updater.Params = extraParams; | 106 | updater.Params = extraParams; |
107 | 107 | ||
108 | if (!Updaters.ContainsKey(updater.UpdaterID)) | 108 | if (!Updaters.ContainsKey(updater.UpdaterID)) |
109 | { | 109 | { |
110 | Updaters.Add(updater.UpdaterID, updater); | 110 | Updaters.Add(updater.UpdaterID, updater); |
111 | } | 111 | } |
112 | 112 | ||
113 | RenderPlugins[contentType].AsyncConvertData(updater.UpdaterID, data, extraParams); | 113 | RenderPlugins[contentType].AsyncConvertData(updater.UpdaterID, data, extraParams); |
114 | return updater.UpdaterID; | 114 | return updater.UpdaterID; |
115 | } | 115 | } |
116 | return LLUUID.Zero; | 116 | return LLUUID.Zero; |
117 | } | 117 | } |
118 | 118 | ||
119 | public class DynamicTextureUpdater | 119 | public class DynamicTextureUpdater |
120 | { | 120 | { |
121 | public LLUUID SimUUID; | 121 | public LLUUID SimUUID; |
122 | public LLUUID UpdaterID; | 122 | public LLUUID UpdaterID; |
123 | public string ContentType; | 123 | public string ContentType; |
124 | public string Url; | 124 | public string Url; |
125 | public string BodyData; | 125 | public string BodyData; |
126 | public LLUUID PrimID; | 126 | public LLUUID PrimID; |
127 | public int UpdateTimer; | 127 | public int UpdateTimer; |
128 | public LLUUID LastAssetID; | 128 | public LLUUID LastAssetID; |
129 | public string Params; | 129 | public string Params; |
130 | 130 | ||
131 | public DynamicTextureUpdater() | 131 | public DynamicTextureUpdater() |
132 | { | 132 | { |
133 | LastAssetID = LLUUID.Zero; | 133 | LastAssetID = LLUUID.Zero; |
134 | UpdateTimer = 0; | 134 | UpdateTimer = 0; |
135 | BodyData = null; | 135 | BodyData = null; |
136 | } | 136 | } |
137 | 137 | ||
138 | public void DataReceived(byte[] data, Scene scene) | 138 | public void DataReceived(byte[] data, Scene scene) |
139 | { | 139 | { |
140 | //TODO delete the last asset(data), if it was a dynamic texture | 140 | //TODO delete the last asset(data), if it was a dynamic texture |
141 | 141 | ||
142 | AssetBase asset = new AssetBase(); | 142 | AssetBase asset = new AssetBase(); |
143 | asset.FullID = LLUUID.Random(); | 143 | asset.FullID = LLUUID.Random(); |
144 | asset.Data = data; | 144 | asset.Data = data; |
145 | asset.Name = "DynamicImage" + Util.RandomClass.Next(1, 10000); | 145 | asset.Name = "DynamicImage" + Util.RandomClass.Next(1, 10000); |
146 | asset.Type = 0; | 146 | asset.Type = 0; |
147 | scene.commsManager.AssetCache.AddAsset(asset); | 147 | scene.commsManager.AssetCache.AddAsset(asset); |
148 | 148 | ||
149 | LastAssetID = asset.FullID; | 149 | LastAssetID = asset.FullID; |
150 | 150 | ||
151 | SceneObjectPart part = scene.GetSceneObjectPart(PrimID); | 151 | SceneObjectPart part = scene.GetSceneObjectPart(PrimID); |
152 | part.Shape.TextureEntry = new LLObject.TextureEntry(asset.FullID).ToBytes(); | 152 | part.Shape.TextureEntry = new LLObject.TextureEntry(asset.FullID).ToBytes(); |
153 | part.ScheduleFullUpdate(); | 153 | part.ScheduleFullUpdate(); |
154 | } | 154 | } |
155 | } | 155 | } |
156 | } | 156 | } |
157 | } \ No newline at end of file | 157 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Environment/Modules/FriendsModule.cs b/OpenSim/Region/Environment/Modules/FriendsModule.cs index c2a7291..767b4b0 100644 --- a/OpenSim/Region/Environment/Modules/FriendsModule.cs +++ b/OpenSim/Region/Environment/Modules/FriendsModule.cs | |||
@@ -1,6 +1,6 @@ | |||
1 | using OpenSim.Region.Environment.Interfaces; | 1 | using OpenSim.Region.Environment.Interfaces; |
2 | using OpenSim.Region.Environment.Scenes; | 2 | using OpenSim.Region.Environment.Scenes; |
3 | 3 | ||
4 | namespace OpenSim.Region.Environment.Modules | 4 | namespace OpenSim.Region.Environment.Modules |
5 | { | 5 | { |
6 | public class FriendsModule : IRegionModule | 6 | public class FriendsModule : IRegionModule |
@@ -13,7 +13,7 @@ namespace OpenSim.Region.Environment.Modules | |||
13 | } | 13 | } |
14 | 14 | ||
15 | public void PostInitialise() | 15 | public void PostInitialise() |
16 | { | 16 | { |
17 | } | 17 | } |
18 | 18 | ||
19 | public void CloseDown() | 19 | public void CloseDown() |
diff --git a/OpenSim/Region/Environment/Modules/GroupsModule.cs b/OpenSim/Region/Environment/Modules/GroupsModule.cs index dcef2c5..fa5804e 100644 --- a/OpenSim/Region/Environment/Modules/GroupsModule.cs +++ b/OpenSim/Region/Environment/Modules/GroupsModule.cs | |||
@@ -1,6 +1,6 @@ | |||
1 | using OpenSim.Region.Environment.Interfaces; | 1 | using OpenSim.Region.Environment.Interfaces; |
2 | using OpenSim.Region.Environment.Scenes; | 2 | using OpenSim.Region.Environment.Scenes; |
3 | 3 | ||
4 | namespace OpenSim.Region.Environment.Modules | 4 | namespace OpenSim.Region.Environment.Modules |
5 | { | 5 | { |
6 | public class GroupsModule : IRegionModule | 6 | public class GroupsModule : IRegionModule |
@@ -13,7 +13,7 @@ namespace OpenSim.Region.Environment.Modules | |||
13 | } | 13 | } |
14 | 14 | ||
15 | public void PostInitialise() | 15 | public void PostInitialise() |
16 | { | 16 | { |
17 | } | 17 | } |
18 | 18 | ||
19 | public void CloseDown() | 19 | public void CloseDown() |
diff --git a/OpenSim/Region/Environment/Modules/InstantMessageModule.cs b/OpenSim/Region/Environment/Modules/InstantMessageModule.cs index 14f2b65..44cb3d5 100644 --- a/OpenSim/Region/Environment/Modules/InstantMessageModule.cs +++ b/OpenSim/Region/Environment/Modules/InstantMessageModule.cs | |||
@@ -1,6 +1,6 @@ | |||
1 | using OpenSim.Region.Environment.Interfaces; | 1 | using OpenSim.Region.Environment.Interfaces; |
2 | using OpenSim.Region.Environment.Scenes; | 2 | using OpenSim.Region.Environment.Scenes; |
3 | 3 | ||
4 | namespace OpenSim.Region.Environment.Modules | 4 | namespace OpenSim.Region.Environment.Modules |
5 | { | 5 | { |
6 | public class InstantMessageModule : IRegionModule | 6 | public class InstantMessageModule : IRegionModule |
@@ -13,7 +13,7 @@ namespace OpenSim.Region.Environment.Modules | |||
13 | } | 13 | } |
14 | 14 | ||
15 | public void PostInitialise() | 15 | public void PostInitialise() |
16 | { | 16 | { |
17 | } | 17 | } |
18 | 18 | ||
19 | public void CloseDown() | 19 | public void CloseDown() |
diff --git a/OpenSim/Region/Environment/Modules/InventoryModule.cs b/OpenSim/Region/Environment/Modules/InventoryModule.cs index 40bd37e..527731d 100644 --- a/OpenSim/Region/Environment/Modules/InventoryModule.cs +++ b/OpenSim/Region/Environment/Modules/InventoryModule.cs | |||
@@ -1,6 +1,6 @@ | |||
1 | using OpenSim.Region.Environment.Interfaces; | 1 | using OpenSim.Region.Environment.Interfaces; |
2 | using OpenSim.Region.Environment.Scenes; | 2 | using OpenSim.Region.Environment.Scenes; |
3 | 3 | ||
4 | namespace OpenSim.Region.Environment.Modules | 4 | namespace OpenSim.Region.Environment.Modules |
5 | { | 5 | { |
6 | public class InventoryModule : IRegionModule | 6 | public class InventoryModule : IRegionModule |
@@ -13,7 +13,7 @@ namespace OpenSim.Region.Environment.Modules | |||
13 | } | 13 | } |
14 | 14 | ||
15 | public void PostInitialise() | 15 | public void PostInitialise() |
16 | { | 16 | { |
17 | } | 17 | } |
18 | 18 | ||
19 | public void CloseDown() | 19 | public void CloseDown() |
diff --git a/OpenSim/Region/Environment/Modules/TextureDownloadModule.cs b/OpenSim/Region/Environment/Modules/TextureDownloadModule.cs index f107d77..38c7d9b 100644 --- a/OpenSim/Region/Environment/Modules/TextureDownloadModule.cs +++ b/OpenSim/Region/Environment/Modules/TextureDownloadModule.cs | |||
@@ -1,8 +1,8 @@ | |||
1 | using libsecondlife; | 1 | using libsecondlife; |
2 | using OpenSim.Framework.Interfaces; | 2 | using OpenSim.Framework.Interfaces; |
3 | using OpenSim.Region.Environment.Interfaces; | 3 | using OpenSim.Region.Environment.Interfaces; |
4 | using OpenSim.Region.Environment.Scenes; | 4 | using OpenSim.Region.Environment.Scenes; |
5 | 5 | ||
6 | namespace OpenSim.Region.Environment.Modules | 6 | namespace OpenSim.Region.Environment.Modules |
7 | { | 7 | { |
8 | public class TextureDownloadModule : IRegionModule | 8 | public class TextureDownloadModule : IRegionModule |
@@ -10,7 +10,7 @@ namespace OpenSim.Region.Environment.Modules | |||
10 | private Scene m_scene; | 10 | private Scene m_scene; |
11 | 11 | ||
12 | public TextureDownloadModule() | 12 | public TextureDownloadModule() |
13 | { | 13 | { |
14 | } | 14 | } |
15 | 15 | ||
16 | public void Initialise(Scene scene) | 16 | public void Initialise(Scene scene) |
@@ -20,7 +20,7 @@ namespace OpenSim.Region.Environment.Modules | |||
20 | } | 20 | } |
21 | 21 | ||
22 | public void PostInitialise() | 22 | public void PostInitialise() |
23 | { | 23 | { |
24 | } | 24 | } |
25 | 25 | ||
26 | public void CloseDown() | 26 | public void CloseDown() |
@@ -42,7 +42,7 @@ namespace OpenSim.Region.Environment.Modules | |||
42 | } | 42 | } |
43 | 43 | ||
44 | public void TextureAssetCallback(LLUUID texture, byte[] data) | 44 | public void TextureAssetCallback(LLUUID texture, byte[] data) |
45 | { | 45 | { |
46 | } | 46 | } |
47 | } | 47 | } |
48 | } \ No newline at end of file | 48 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Environment/Modules/XferModule.cs b/OpenSim/Region/Environment/Modules/XferModule.cs index 7f8c5c1..9f93c1e 100644 --- a/OpenSim/Region/Environment/Modules/XferModule.cs +++ b/OpenSim/Region/Environment/Modules/XferModule.cs | |||
@@ -1,10 +1,10 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using libsecondlife; | 3 | using libsecondlife; |
4 | using OpenSim.Framework.Interfaces; | 4 | using OpenSim.Framework.Interfaces; |
5 | using OpenSim.Region.Environment.Interfaces; | 5 | using OpenSim.Region.Environment.Interfaces; |
6 | using OpenSim.Region.Environment.Scenes; | 6 | using OpenSim.Region.Environment.Scenes; |
7 | 7 | ||
8 | namespace OpenSim.Region.Environment.Modules | 8 | namespace OpenSim.Region.Environment.Modules |
9 | { | 9 | { |
10 | public class XferModule : IRegionModule, IXfer | 10 | public class XferModule : IRegionModule, IXfer |
@@ -15,7 +15,7 @@ namespace OpenSim.Region.Environment.Modules | |||
15 | private Scene m_scene; | 15 | private Scene m_scene; |
16 | 16 | ||
17 | public XferModule() | 17 | public XferModule() |
18 | { | 18 | { |
19 | } | 19 | } |
20 | 20 | ||
21 | public void Initialise(Scene scene) | 21 | public void Initialise(Scene scene) |
@@ -27,11 +27,11 @@ namespace OpenSim.Region.Environment.Modules | |||
27 | } | 27 | } |
28 | 28 | ||
29 | public void PostInitialise() | 29 | public void PostInitialise() |
30 | { | 30 | { |
31 | } | 31 | } |
32 | 32 | ||
33 | public void CloseDown() | 33 | public void CloseDown() |
34 | { | 34 | { |
35 | } | 35 | } |
36 | 36 | ||
37 | public string GetName() | 37 | public string GetName() |
@@ -119,7 +119,7 @@ namespace OpenSim.Region.Environment.Modules | |||
119 | } | 119 | } |
120 | 120 | ||
121 | public XferDownLoad() | 121 | public XferDownLoad() |
122 | { | 122 | { |
123 | } | 123 | } |
124 | 124 | ||
125 | public void StartSend() | 125 | public void StartSend() |
diff --git a/OpenSim/Region/Environment/PermissionManager.cs b/OpenSim/Region/Environment/PermissionManager.cs index 0a33380..4c02a6c 100644 --- a/OpenSim/Region/Environment/PermissionManager.cs +++ b/OpenSim/Region/Environment/PermissionManager.cs | |||
@@ -1,7 +1,7 @@ | |||
1 | using libsecondlife; | 1 | using libsecondlife; |
2 | using OpenSim.Region.Environment.LandManagement; | 2 | using OpenSim.Region.Environment.LandManagement; |
3 | using OpenSim.Region.Environment.Scenes; | 3 | using OpenSim.Region.Environment.Scenes; |
4 | 4 | ||
5 | namespace OpenSim.Region.Environment | 5 | namespace OpenSim.Region.Environment |
6 | { | 6 | { |
7 | public class PermissionManager | 7 | public class PermissionManager |
@@ -12,8 +12,8 @@ namespace OpenSim.Region.Environment | |||
12 | // disable in any production environment | 12 | // disable in any production environment |
13 | // TODO: Change this to false when permissions are a desired default | 13 | // TODO: Change this to false when permissions are a desired default |
14 | // TODO: Move to configuration option. | 14 | // TODO: Move to configuration option. |
15 | private bool m_bypassPermissions = true; | 15 | private bool m_bypassPermissions = true; |
16 | 16 | ||
17 | public bool BypassPermissions | 17 | public bool BypassPermissions |
18 | { | 18 | { |
19 | get { return m_bypassPermissions; } | 19 | get { return m_bypassPermissions; } |
@@ -117,7 +117,7 @@ namespace OpenSim.Region.Environment | |||
117 | permission = true; | 117 | permission = true; |
118 | 118 | ||
119 | // Users should be able to edit what is over their land. | 119 | // Users should be able to edit what is over their land. |
120 | if (m_scene.LandManager.getLandObject(task.AbsolutePosition.X, task.AbsolutePosition.Y).landData.ownerID == | 120 | if (m_scene.LandManager.getLandObject(task.AbsolutePosition.X, task.AbsolutePosition.Y).landData.ownerID == |
121 | user) | 121 | user) |
122 | permission = true; | 122 | permission = true; |
123 | 123 | ||
@@ -294,6 +294,6 @@ namespace OpenSim.Region.Environment | |||
294 | return GenericParcelPermission(user, parcel); | 294 | return GenericParcelPermission(user, parcel); |
295 | } | 295 | } |
296 | 296 | ||
297 | #endregion | 297 | #endregion |
298 | } | 298 | } |
299 | } \ No newline at end of file | 299 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs index b7f5bad..24f1a86 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs | |||
@@ -1,445 +1,445 @@ | |||
1 | using Axiom.Math; | 1 | using Axiom.Math; |
2 | using libsecondlife; | 2 | using libsecondlife; |
3 | using libsecondlife.Packets; | 3 | using libsecondlife.Packets; |
4 | using OpenSim.Framework.Communications.Cache; | 4 | using OpenSim.Framework.Communications.Cache; |
5 | using OpenSim.Framework.Communications.Caches; | 5 | using OpenSim.Framework.Communications.Caches; |
6 | using OpenSim.Framework.Interfaces; | 6 | using OpenSim.Framework.Interfaces; |
7 | using OpenSim.Framework.Types; | 7 | using OpenSim.Framework.Types; |
8 | using OpenSim.Framework.Utilities; | 8 | using OpenSim.Framework.Utilities; |
9 | using OpenSim.Region.Physics.Manager; | 9 | using OpenSim.Region.Physics.Manager; |
10 | 10 | ||
11 | namespace OpenSim.Region.Environment.Scenes | 11 | namespace OpenSim.Region.Environment.Scenes |
12 | { | 12 | { |
13 | public partial class Scene | 13 | public partial class Scene |
14 | { | 14 | { |
15 | //split these method into this partial as a lot of these (hopefully) are only temporary and won't be needed once Caps is more complete | 15 | //split these method into this partial as a lot of these (hopefully) are only temporary and won't be needed once Caps is more complete |
16 | // or at least some of they can be moved somewhere else | 16 | // or at least some of they can be moved somewhere else |
17 | 17 | ||
18 | public void AddInventoryItem(LLUUID avatarId, InventoryItemBase item) | 18 | public void AddInventoryItem(LLUUID avatarId, InventoryItemBase item) |
19 | { | 19 | { |
20 | ScenePresence avatar; | 20 | ScenePresence avatar; |
21 | 21 | ||
22 | if ( TryGetAvatar( avatarId, out avatar )) | 22 | if ( TryGetAvatar( avatarId, out avatar )) |
23 | { | 23 | { |
24 | AddInventoryItem(avatar.ControllingClient, item); | 24 | AddInventoryItem(avatar.ControllingClient, item); |
25 | } | 25 | } |
26 | } | 26 | } |
27 | 27 | ||
28 | public void AddInventoryItem(IClientAPI remoteClient, InventoryItemBase item) | 28 | public void AddInventoryItem(IClientAPI remoteClient, InventoryItemBase item) |
29 | { | 29 | { |
30 | CachedUserInfo userInfo = commsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId); | 30 | CachedUserInfo userInfo = commsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId); |
31 | if (userInfo != null) | 31 | if (userInfo != null) |
32 | { | 32 | { |
33 | userInfo.AddItem(remoteClient.AgentId, item); | 33 | userInfo.AddItem(remoteClient.AgentId, item); |
34 | remoteClient.SendInventoryItemUpdate(item); | 34 | remoteClient.SendInventoryItemUpdate(item); |
35 | } | 35 | } |
36 | } | 36 | } |
37 | 37 | ||
38 | public LLUUID CapsUpdateInventoryItemAsset(LLUUID avatarId, LLUUID itemID, byte[] data) | 38 | public LLUUID CapsUpdateInventoryItemAsset(LLUUID avatarId, LLUUID itemID, byte[] data) |
39 | { | 39 | { |
40 | ScenePresence avatar; | 40 | ScenePresence avatar; |
41 | 41 | ||
42 | if (TryGetAvatar(avatarId, out avatar)) | 42 | if (TryGetAvatar(avatarId, out avatar)) |
43 | { | 43 | { |
44 | return CapsUpdateInventoryItemAsset(avatar.ControllingClient, itemID, data); | 44 | return CapsUpdateInventoryItemAsset(avatar.ControllingClient, itemID, data); |
45 | } | 45 | } |
46 | 46 | ||
47 | return LLUUID.Zero; | 47 | return LLUUID.Zero; |
48 | } | 48 | } |
49 | 49 | ||
50 | public LLUUID CapsUpdateInventoryItemAsset(IClientAPI remoteClient, LLUUID itemID, byte[] data) | 50 | public LLUUID CapsUpdateInventoryItemAsset(IClientAPI remoteClient, LLUUID itemID, byte[] data) |
51 | { | 51 | { |
52 | CachedUserInfo userInfo = commsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId); | 52 | CachedUserInfo userInfo = commsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId); |
53 | if (userInfo != null) | 53 | if (userInfo != null) |
54 | { | 54 | { |
55 | if (userInfo.RootFolder != null) | 55 | if (userInfo.RootFolder != null) |
56 | { | 56 | { |
57 | InventoryItemBase item = userInfo.RootFolder.HasItem(itemID); | 57 | InventoryItemBase item = userInfo.RootFolder.HasItem(itemID); |
58 | if (item != null) | 58 | if (item != null) |
59 | { | 59 | { |
60 | AssetBase asset; | 60 | AssetBase asset; |
61 | asset = new AssetBase(); | 61 | asset = new AssetBase(); |
62 | asset.FullID = LLUUID.Random(); | 62 | asset.FullID = LLUUID.Random(); |
63 | asset.Type = (sbyte) item.assetType; | 63 | asset.Type = (sbyte) item.assetType; |
64 | asset.InvType = (sbyte) item.invType; | 64 | asset.InvType = (sbyte) item.invType; |
65 | asset.Name = item.inventoryName; | 65 | asset.Name = item.inventoryName; |
66 | asset.Data = data; | 66 | asset.Data = data; |
67 | commsManager.AssetCache.AddAsset(asset); | 67 | commsManager.AssetCache.AddAsset(asset); |
68 | 68 | ||
69 | item.assetID = asset.FullID; | 69 | item.assetID = asset.FullID; |
70 | userInfo.UpdateItem(remoteClient.AgentId, item); | 70 | userInfo.UpdateItem(remoteClient.AgentId, item); |
71 | 71 | ||
72 | // remoteClient.SendInventoryItemUpdate(item); | 72 | // remoteClient.SendInventoryItemUpdate(item); |
73 | if (item.invType == 7) | 73 | if (item.invType == 7) |
74 | { | 74 | { |
75 | //do we want to know about updated note cards? | 75 | //do we want to know about updated note cards? |
76 | } | 76 | } |
77 | else if (item.invType == 10) | 77 | else if (item.invType == 10) |
78 | { | 78 | { |
79 | // do we want to know about updated scripts | 79 | // do we want to know about updated scripts |
80 | } | 80 | } |
81 | 81 | ||
82 | return (asset.FullID); | 82 | return (asset.FullID); |
83 | } | 83 | } |
84 | } | 84 | } |
85 | } | 85 | } |
86 | return LLUUID.Zero; | 86 | return LLUUID.Zero; |
87 | } | 87 | } |
88 | 88 | ||
89 | public void UDPUpdateInventoryItemAsset(IClientAPI remoteClient, LLUUID transactionID, LLUUID assetID, | 89 | public void UDPUpdateInventoryItemAsset(IClientAPI remoteClient, LLUUID transactionID, LLUUID assetID, |
90 | LLUUID itemID) | 90 | LLUUID itemID) |
91 | { | 91 | { |
92 | CachedUserInfo userInfo = commsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId); | 92 | CachedUserInfo userInfo = commsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId); |
93 | if (userInfo != null) | 93 | if (userInfo != null) |
94 | { | 94 | { |
95 | if (userInfo.RootFolder != null) | 95 | if (userInfo.RootFolder != null) |
96 | { | 96 | { |
97 | InventoryItemBase item = userInfo.RootFolder.HasItem(itemID); | 97 | InventoryItemBase item = userInfo.RootFolder.HasItem(itemID); |
98 | if (item != null) | 98 | if (item != null) |
99 | { | 99 | { |
100 | AgentAssetTransactions transactions = | 100 | AgentAssetTransactions transactions = |
101 | commsManager.TransactionsManager.GetUserTransActions(remoteClient.AgentId); | 101 | commsManager.TransactionsManager.GetUserTransActions(remoteClient.AgentId); |
102 | if (transactions != null) | 102 | if (transactions != null) |
103 | { | 103 | { |
104 | AssetBase asset = null; | 104 | AssetBase asset = null; |
105 | bool addToCache = false; | 105 | bool addToCache = false; |
106 | 106 | ||
107 | asset = commsManager.AssetCache.GetAsset(assetID); | 107 | asset = commsManager.AssetCache.GetAsset(assetID); |
108 | if (asset == null) | 108 | if (asset == null) |
109 | { | 109 | { |
110 | asset = transactions.GetTransactionAsset(transactionID); | 110 | asset = transactions.GetTransactionAsset(transactionID); |
111 | addToCache = true; | 111 | addToCache = true; |
112 | } | 112 | } |
113 | 113 | ||
114 | if (asset != null) | 114 | if (asset != null) |
115 | { | 115 | { |
116 | if (asset.FullID == assetID) | 116 | if (asset.FullID == assetID) |
117 | { | 117 | { |
118 | asset.Name = item.inventoryName; | 118 | asset.Name = item.inventoryName; |
119 | asset.Description = item.inventoryDescription; | 119 | asset.Description = item.inventoryDescription; |
120 | asset.InvType = (sbyte) item.invType; | 120 | asset.InvType = (sbyte) item.invType; |
121 | asset.Type = (sbyte) item.assetType; | 121 | asset.Type = (sbyte) item.assetType; |
122 | item.assetID = asset.FullID; | 122 | item.assetID = asset.FullID; |
123 | 123 | ||
124 | if (addToCache) | 124 | if (addToCache) |
125 | { | 125 | { |
126 | commsManager.AssetCache.AddAsset(asset); | 126 | commsManager.AssetCache.AddAsset(asset); |
127 | } | 127 | } |
128 | 128 | ||
129 | userInfo.UpdateItem(remoteClient.AgentId, item); | 129 | userInfo.UpdateItem(remoteClient.AgentId, item); |
130 | } | 130 | } |
131 | } | 131 | } |
132 | } | 132 | } |
133 | } | 133 | } |
134 | } | 134 | } |
135 | } | 135 | } |
136 | } | 136 | } |
137 | 137 | ||
138 | /// <summary> | 138 | /// <summary> |
139 | /// temporary method to test out creating new inventory items | 139 | /// temporary method to test out creating new inventory items |
140 | /// </summary> | 140 | /// </summary> |
141 | /// <param name="remoteClient"></param> | 141 | /// <param name="remoteClient"></param> |
142 | /// <param name="transActionID"></param> | 142 | /// <param name="transActionID"></param> |
143 | /// <param name="folderID"></param> | 143 | /// <param name="folderID"></param> |
144 | /// <param name="callbackID"></param> | 144 | /// <param name="callbackID"></param> |
145 | /// <param name="description"></param> | 145 | /// <param name="description"></param> |
146 | /// <param name="name"></param> | 146 | /// <param name="name"></param> |
147 | /// <param name="invType"></param> | 147 | /// <param name="invType"></param> |
148 | /// <param name="type"></param> | 148 | /// <param name="type"></param> |
149 | /// <param name="wearableType"></param> | 149 | /// <param name="wearableType"></param> |
150 | /// <param name="nextOwnerMask"></param> | 150 | /// <param name="nextOwnerMask"></param> |
151 | public void CreateNewInventoryItem(IClientAPI remoteClient, LLUUID transActionID, LLUUID folderID, | 151 | public void CreateNewInventoryItem(IClientAPI remoteClient, LLUUID transActionID, LLUUID folderID, |
152 | uint callbackID, string description, string name, sbyte invType, sbyte type, | 152 | uint callbackID, string description, string name, sbyte invType, sbyte type, |
153 | byte wearableType, uint nextOwnerMask) | 153 | byte wearableType, uint nextOwnerMask) |
154 | { | 154 | { |
155 | if (transActionID == LLUUID.Zero) | 155 | if (transActionID == LLUUID.Zero) |
156 | { | 156 | { |
157 | CachedUserInfo userInfo = commsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId); | 157 | CachedUserInfo userInfo = commsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId); |
158 | if (userInfo != null) | 158 | if (userInfo != null) |
159 | { | 159 | { |
160 | AssetBase asset = new AssetBase(); | 160 | AssetBase asset = new AssetBase(); |
161 | asset.Name = name; | 161 | asset.Name = name; |
162 | asset.Description = description; | 162 | asset.Description = description; |
163 | asset.InvType = invType; | 163 | asset.InvType = invType; |
164 | asset.Type = type; | 164 | asset.Type = type; |
165 | asset.FullID = LLUUID.Random(); | 165 | asset.FullID = LLUUID.Random(); |
166 | asset.Data = new byte[1]; | 166 | asset.Data = new byte[1]; |
167 | commsManager.AssetCache.AddAsset(asset); | 167 | commsManager.AssetCache.AddAsset(asset); |
168 | 168 | ||
169 | InventoryItemBase item = new InventoryItemBase(); | 169 | InventoryItemBase item = new InventoryItemBase(); |
170 | item.avatarID = remoteClient.AgentId; | 170 | item.avatarID = remoteClient.AgentId; |
171 | item.creatorsID = remoteClient.AgentId; | 171 | item.creatorsID = remoteClient.AgentId; |
172 | item.inventoryID = LLUUID.Random(); | 172 | item.inventoryID = LLUUID.Random(); |
173 | item.assetID = asset.FullID; | 173 | item.assetID = asset.FullID; |
174 | item.inventoryDescription = description; | 174 | item.inventoryDescription = description; |
175 | item.inventoryName = name; | 175 | item.inventoryName = name; |
176 | item.assetType = invType; | 176 | item.assetType = invType; |
177 | item.invType = invType; | 177 | item.invType = invType; |
178 | item.parentFolderID = folderID; | 178 | item.parentFolderID = folderID; |
179 | item.inventoryCurrentPermissions = 2147483647; | 179 | item.inventoryCurrentPermissions = 2147483647; |
180 | item.inventoryNextPermissions = nextOwnerMask; | 180 | item.inventoryNextPermissions = nextOwnerMask; |
181 | 181 | ||
182 | userInfo.AddItem(remoteClient.AgentId, item); | 182 | userInfo.AddItem(remoteClient.AgentId, item); |
183 | remoteClient.SendInventoryItemUpdate(item); | 183 | remoteClient.SendInventoryItemUpdate(item); |
184 | } | 184 | } |
185 | } | 185 | } |
186 | else | 186 | else |
187 | { | 187 | { |
188 | commsManager.TransactionsManager.HandleInventoryFromTransaction(remoteClient, transActionID, folderID, | 188 | commsManager.TransactionsManager.HandleInventoryFromTransaction(remoteClient, transActionID, folderID, |
189 | callbackID, description, name, invType, | 189 | callbackID, description, name, invType, |
190 | type, wearableType, nextOwnerMask); | 190 | type, wearableType, nextOwnerMask); |
191 | //System.Console.WriteLine("request to create inventory item from transaction " + transActionID); | 191 | //System.Console.WriteLine("request to create inventory item from transaction " + transActionID); |
192 | } | 192 | } |
193 | } | 193 | } |
194 | 194 | ||
195 | /// <summary> | 195 | /// <summary> |
196 | /// | 196 | /// |
197 | /// </summary> | 197 | /// </summary> |
198 | /// <param name="remoteClient"></param> | 198 | /// <param name="remoteClient"></param> |
199 | /// <param name="primLocalID"></param> | 199 | /// <param name="primLocalID"></param> |
200 | public void RequestTaskInventory(IClientAPI remoteClient, uint primLocalID) | 200 | public void RequestTaskInventory(IClientAPI remoteClient, uint primLocalID) |
201 | { | 201 | { |
202 | bool hasPrim = false; | 202 | bool hasPrim = false; |
203 | foreach (EntityBase ent in Entities.Values) | 203 | foreach (EntityBase ent in Entities.Values) |
204 | { | 204 | { |
205 | if (ent is SceneObjectGroup) | 205 | if (ent is SceneObjectGroup) |
206 | { | 206 | { |
207 | hasPrim = ((SceneObjectGroup) ent).HasChildPrim(primLocalID); | 207 | hasPrim = ((SceneObjectGroup) ent).HasChildPrim(primLocalID); |
208 | if (hasPrim != false) | 208 | if (hasPrim != false) |
209 | { | 209 | { |
210 | bool fileChange = ((SceneObjectGroup) ent).GetPartInventoryFileName(remoteClient, primLocalID); | 210 | bool fileChange = ((SceneObjectGroup) ent).GetPartInventoryFileName(remoteClient, primLocalID); |
211 | if (fileChange) | 211 | if (fileChange) |
212 | { | 212 | { |
213 | if (XferManager != null) | 213 | if (XferManager != null) |
214 | { | 214 | { |
215 | ((SceneObjectGroup) ent).RequestInventoryFile(primLocalID, XferManager); | 215 | ((SceneObjectGroup) ent).RequestInventoryFile(primLocalID, XferManager); |
216 | } | 216 | } |
217 | } | 217 | } |
218 | break; | 218 | break; |
219 | } | 219 | } |
220 | } | 220 | } |
221 | } | 221 | } |
222 | } | 222 | } |
223 | 223 | ||
224 | public void RemoveTaskInventory(IClientAPI remoteClient, LLUUID itemID, uint localID) | 224 | public void RemoveTaskInventory(IClientAPI remoteClient, LLUUID itemID, uint localID) |
225 | { | 225 | { |
226 | bool hasPrim = false; | 226 | bool hasPrim = false; |
227 | foreach (EntityBase ent in Entities.Values) | 227 | foreach (EntityBase ent in Entities.Values) |
228 | { | 228 | { |
229 | if (ent is SceneObjectGroup) | 229 | if (ent is SceneObjectGroup) |
230 | { | 230 | { |
231 | hasPrim = ((SceneObjectGroup) ent).HasChildPrim(localID); | 231 | hasPrim = ((SceneObjectGroup) ent).HasChildPrim(localID); |
232 | if (hasPrim != false) | 232 | if (hasPrim != false) |
233 | { | 233 | { |
234 | int type = ((SceneObjectGroup) ent).RemoveInventoryItem(remoteClient, localID, itemID); | 234 | int type = ((SceneObjectGroup) ent).RemoveInventoryItem(remoteClient, localID, itemID); |
235 | ((SceneObjectGroup) ent).GetProperites(remoteClient); | 235 | ((SceneObjectGroup) ent).GetProperites(remoteClient); |
236 | if (type == 10) | 236 | if (type == 10) |
237 | { | 237 | { |
238 | EventManager.TriggerRemoveScript(localID, itemID); | 238 | EventManager.TriggerRemoveScript(localID, itemID); |
239 | } | 239 | } |
240 | } | 240 | } |
241 | } | 241 | } |
242 | } | 242 | } |
243 | } | 243 | } |
244 | 244 | ||
245 | public void RezScript(IClientAPI remoteClient, LLUUID itemID, uint localID) | 245 | public void RezScript(IClientAPI remoteClient, LLUUID itemID, uint localID) |
246 | { | 246 | { |
247 | CachedUserInfo userInfo = commsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId); | 247 | CachedUserInfo userInfo = commsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId); |
248 | LLUUID copyID = LLUUID.Random(); | 248 | LLUUID copyID = LLUUID.Random(); |
249 | if (userInfo != null) | 249 | if (userInfo != null) |
250 | { | 250 | { |
251 | if (userInfo.RootFolder != null) | 251 | if (userInfo.RootFolder != null) |
252 | { | 252 | { |
253 | InventoryItemBase item = userInfo.RootFolder.HasItem(itemID); | 253 | InventoryItemBase item = userInfo.RootFolder.HasItem(itemID); |
254 | if (item != null) | 254 | if (item != null) |
255 | { | 255 | { |
256 | bool isTexture = false; | 256 | bool isTexture = false; |
257 | bool rezzed = false; | 257 | bool rezzed = false; |
258 | if (item.invType == 0) | 258 | if (item.invType == 0) |
259 | { | 259 | { |
260 | isTexture = true; | 260 | isTexture = true; |
261 | } | 261 | } |
262 | AssetBase rezAsset = commsManager.AssetCache.GetAsset(item.assetID, isTexture); | 262 | AssetBase rezAsset = commsManager.AssetCache.GetAsset(item.assetID, isTexture); |
263 | if (rezAsset != null) | 263 | if (rezAsset != null) |
264 | { | 264 | { |
265 | string script = Util.FieldToString(rezAsset.Data); | 265 | string script = Util.FieldToString(rezAsset.Data); |
266 | //Console.WriteLine("rez script "+script); | 266 | //Console.WriteLine("rez script "+script); |
267 | EventManager.TriggerRezScript(localID, copyID, script); | 267 | EventManager.TriggerRezScript(localID, copyID, script); |
268 | rezzed = true; | 268 | rezzed = true; |
269 | } | 269 | } |
270 | else | 270 | else |
271 | { | 271 | { |
272 | //lets try once more incase the asset cache is being slow getting the asset from server | 272 | //lets try once more incase the asset cache is being slow getting the asset from server |
273 | rezAsset = commsManager.AssetCache.GetAsset(item.assetID, isTexture); | 273 | rezAsset = commsManager.AssetCache.GetAsset(item.assetID, isTexture); |
274 | if (rezAsset != null) | 274 | if (rezAsset != null) |
275 | { | 275 | { |
276 | string script = Util.FieldToString(rezAsset.Data); | 276 | string script = Util.FieldToString(rezAsset.Data); |
277 | // Console.WriteLine("rez script " + script); | 277 | // Console.WriteLine("rez script " + script); |
278 | EventManager.TriggerRezScript(localID, copyID, script); | 278 | EventManager.TriggerRezScript(localID, copyID, script); |
279 | rezzed = true; | 279 | rezzed = true; |
280 | } | 280 | } |
281 | } | 281 | } |
282 | 282 | ||
283 | if (rezzed) | 283 | if (rezzed) |
284 | { | 284 | { |
285 | bool hasPrim = false; | 285 | bool hasPrim = false; |
286 | foreach (EntityBase ent in Entities.Values) | 286 | foreach (EntityBase ent in Entities.Values) |
287 | { | 287 | { |
288 | if (ent is SceneObjectGroup) | 288 | if (ent is SceneObjectGroup) |
289 | { | 289 | { |
290 | hasPrim = ((SceneObjectGroup) ent).HasChildPrim(localID); | 290 | hasPrim = ((SceneObjectGroup) ent).HasChildPrim(localID); |
291 | if (hasPrim != false) | 291 | if (hasPrim != false) |
292 | { | 292 | { |
293 | bool added = | 293 | bool added = |
294 | ((SceneObjectGroup) ent).AddInventoryItem(remoteClient, localID, item, | 294 | ((SceneObjectGroup) ent).AddInventoryItem(remoteClient, localID, item, |
295 | copyID); | 295 | copyID); |
296 | ((SceneObjectGroup) ent).GetProperites(remoteClient); | 296 | ((SceneObjectGroup) ent).GetProperites(remoteClient); |
297 | } | 297 | } |
298 | } | 298 | } |
299 | } | 299 | } |
300 | } | 300 | } |
301 | } | 301 | } |
302 | } | 302 | } |
303 | } | 303 | } |
304 | } | 304 | } |
305 | 305 | ||
306 | /// <summary> | 306 | /// <summary> |
307 | /// | 307 | /// |
308 | /// </summary> | 308 | /// </summary> |
309 | /// <param name="packet"></param> | 309 | /// <param name="packet"></param> |
310 | /// <param name="simClient"></param> | 310 | /// <param name="simClient"></param> |
311 | public void DeRezObject(Packet packet, IClientAPI remoteClient) | 311 | public void DeRezObject(Packet packet, IClientAPI remoteClient) |
312 | { | 312 | { |
313 | DeRezObjectPacket DeRezPacket = (DeRezObjectPacket) packet; | 313 | DeRezObjectPacket DeRezPacket = (DeRezObjectPacket) packet; |
314 | 314 | ||
315 | if (DeRezPacket.AgentBlock.DestinationID == LLUUID.Zero) | 315 | if (DeRezPacket.AgentBlock.DestinationID == LLUUID.Zero) |
316 | { | 316 | { |
317 | //currently following code not used (or don't know of any case of destination being zero | 317 | //currently following code not used (or don't know of any case of destination being zero |
318 | } | 318 | } |
319 | else | 319 | else |
320 | { | 320 | { |
321 | foreach (DeRezObjectPacket.ObjectDataBlock Data in DeRezPacket.ObjectData) | 321 | foreach (DeRezObjectPacket.ObjectDataBlock Data in DeRezPacket.ObjectData) |
322 | { | 322 | { |
323 | EntityBase selectedEnt = null; | 323 | EntityBase selectedEnt = null; |
324 | //OpenSim.Framework.Console.MainConsole.Instance.WriteLine("LocalID:" + Data.ObjectLocalID.ToString()); | 324 | //OpenSim.Framework.Console.MainConsole.Instance.WriteLine("LocalID:" + Data.ObjectLocalID.ToString()); |
325 | foreach (EntityBase ent in Entities.Values) | 325 | foreach (EntityBase ent in Entities.Values) |
326 | { | 326 | { |
327 | if (ent.LocalId == Data.ObjectLocalID) | 327 | if (ent.LocalId == Data.ObjectLocalID) |
328 | { | 328 | { |
329 | selectedEnt = ent; | 329 | selectedEnt = ent; |
330 | break; | 330 | break; |
331 | } | 331 | } |
332 | } | 332 | } |
333 | if (selectedEnt != null) | 333 | if (selectedEnt != null) |
334 | { | 334 | { |
335 | if (PermissionsMngr.CanDeRezObject(remoteClient.AgentId, ((SceneObjectGroup) selectedEnt).UUID)) | 335 | if (PermissionsMngr.CanDeRezObject(remoteClient.AgentId, ((SceneObjectGroup) selectedEnt).UUID)) |
336 | { | 336 | { |
337 | string sceneObjectXml = ((SceneObjectGroup) selectedEnt).ToXmlString(); | 337 | string sceneObjectXml = ((SceneObjectGroup) selectedEnt).ToXmlString(); |
338 | CachedUserInfo userInfo = commsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId); | 338 | CachedUserInfo userInfo = commsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId); |
339 | if (userInfo != null) | 339 | if (userInfo != null) |
340 | { | 340 | { |
341 | AssetBase asset = new AssetBase(); | 341 | AssetBase asset = new AssetBase(); |
342 | asset.Name = ((SceneObjectGroup) selectedEnt).GetPartName(selectedEnt.LocalId); | 342 | asset.Name = ((SceneObjectGroup) selectedEnt).GetPartName(selectedEnt.LocalId); |
343 | asset.Description = | 343 | asset.Description = |
344 | ((SceneObjectGroup) selectedEnt).GetPartDescription(selectedEnt.LocalId); | 344 | ((SceneObjectGroup) selectedEnt).GetPartDescription(selectedEnt.LocalId); |
345 | asset.InvType = 6; | 345 | asset.InvType = 6; |
346 | asset.Type = 6; | 346 | asset.Type = 6; |
347 | asset.FullID = LLUUID.Random(); | 347 | asset.FullID = LLUUID.Random(); |
348 | asset.Data = Helpers.StringToField(sceneObjectXml); | 348 | asset.Data = Helpers.StringToField(sceneObjectXml); |
349 | commsManager.AssetCache.AddAsset(asset); | 349 | commsManager.AssetCache.AddAsset(asset); |
350 | 350 | ||
351 | 351 | ||
352 | InventoryItemBase item = new InventoryItemBase(); | 352 | InventoryItemBase item = new InventoryItemBase(); |
353 | item.avatarID = remoteClient.AgentId; | 353 | item.avatarID = remoteClient.AgentId; |
354 | item.creatorsID = remoteClient.AgentId; | 354 | item.creatorsID = remoteClient.AgentId; |
355 | item.inventoryID = LLUUID.Random(); | 355 | item.inventoryID = LLUUID.Random(); |
356 | item.assetID = asset.FullID; | 356 | item.assetID = asset.FullID; |
357 | item.inventoryDescription = asset.Description; | 357 | item.inventoryDescription = asset.Description; |
358 | item.inventoryName = asset.Name; | 358 | item.inventoryName = asset.Name; |
359 | item.assetType = asset.Type; | 359 | item.assetType = asset.Type; |
360 | item.invType = asset.InvType; | 360 | item.invType = asset.InvType; |
361 | item.parentFolderID = DeRezPacket.AgentBlock.DestinationID; | 361 | item.parentFolderID = DeRezPacket.AgentBlock.DestinationID; |
362 | item.inventoryCurrentPermissions = 2147483647; | 362 | item.inventoryCurrentPermissions = 2147483647; |
363 | item.inventoryNextPermissions = 2147483647; | 363 | item.inventoryNextPermissions = 2147483647; |
364 | 364 | ||
365 | userInfo.AddItem(remoteClient.AgentId, item); | 365 | userInfo.AddItem(remoteClient.AgentId, item); |
366 | remoteClient.SendInventoryItemUpdate(item); | 366 | remoteClient.SendInventoryItemUpdate(item); |
367 | } | 367 | } |
368 | 368 | ||
369 | SceneObjectPart rootPart = | 369 | SceneObjectPart rootPart = |
370 | ((SceneObjectGroup) selectedEnt).GetChildPart(((SceneObjectGroup) selectedEnt).UUID); | 370 | ((SceneObjectGroup) selectedEnt).GetChildPart(((SceneObjectGroup) selectedEnt).UUID); |
371 | if (rootPart.PhysActor != null) | 371 | if (rootPart.PhysActor != null) |
372 | { | 372 | { |
373 | phyScene.RemovePrim(rootPart.PhysActor); | 373 | phyScene.RemovePrim(rootPart.PhysActor); |
374 | rootPart.PhysActor = null; | 374 | rootPart.PhysActor = null; |
375 | } | 375 | } |
376 | 376 | ||
377 | storageManager.DataStore.RemoveObject(((SceneObjectGroup) selectedEnt).UUID, | 377 | storageManager.DataStore.RemoveObject(((SceneObjectGroup) selectedEnt).UUID, |
378 | m_regInfo.SimUUID); | 378 | m_regInfo.SimUUID); |
379 | ((SceneObjectGroup) selectedEnt).DeleteGroup(); | 379 | ((SceneObjectGroup) selectedEnt).DeleteGroup(); |
380 | 380 | ||
381 | lock (Entities) | 381 | lock (Entities) |
382 | { | 382 | { |
383 | Entities.Remove(((SceneObjectGroup) selectedEnt).UUID); | 383 | Entities.Remove(((SceneObjectGroup) selectedEnt).UUID); |
384 | } | 384 | } |
385 | ((SceneObjectGroup) selectedEnt).DeleteParts(); | 385 | ((SceneObjectGroup) selectedEnt).DeleteParts(); |
386 | } | 386 | } |
387 | } | 387 | } |
388 | } | 388 | } |
389 | } | 389 | } |
390 | } | 390 | } |
391 | 391 | ||
392 | public void RezObject(IClientAPI remoteClient, LLUUID itemID, LLVector3 pos) | 392 | public void RezObject(IClientAPI remoteClient, LLUUID itemID, LLVector3 pos) |
393 | { | 393 | { |
394 | CachedUserInfo userInfo = commsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId); | 394 | CachedUserInfo userInfo = commsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId); |
395 | if (userInfo != null) | 395 | if (userInfo != null) |
396 | { | 396 | { |
397 | if (userInfo.RootFolder != null) | 397 | if (userInfo.RootFolder != null) |
398 | { | 398 | { |
399 | InventoryItemBase item = userInfo.RootFolder.HasItem(itemID); | 399 | InventoryItemBase item = userInfo.RootFolder.HasItem(itemID); |
400 | if (item != null) | 400 | if (item != null) |
401 | { | 401 | { |
402 | AssetBase rezAsset = commsManager.AssetCache.GetAsset(item.assetID, false); | 402 | AssetBase rezAsset = commsManager.AssetCache.GetAsset(item.assetID, false); |
403 | if (rezAsset != null) | 403 | if (rezAsset != null) |
404 | { | 404 | { |
405 | AddRezObject(Util.FieldToString(rezAsset.Data), pos); | 405 | AddRezObject(Util.FieldToString(rezAsset.Data), pos); |
406 | userInfo.DeleteItem(remoteClient.AgentId, item); | 406 | userInfo.DeleteItem(remoteClient.AgentId, item); |
407 | remoteClient.SendRemoveInventoryItem(itemID); | 407 | remoteClient.SendRemoveInventoryItem(itemID); |
408 | } | 408 | } |
409 | else | 409 | else |
410 | { | 410 | { |
411 | //lets try once more incase the asset cache is being slow getting the asset from server | 411 | //lets try once more incase the asset cache is being slow getting the asset from server |
412 | rezAsset = commsManager.AssetCache.GetAsset(item.assetID, false); | 412 | rezAsset = commsManager.AssetCache.GetAsset(item.assetID, false); |
413 | if (rezAsset != null) | 413 | if (rezAsset != null) |
414 | { | 414 | { |
415 | AddRezObject(Util.FieldToString(rezAsset.Data), pos); | 415 | AddRezObject(Util.FieldToString(rezAsset.Data), pos); |
416 | userInfo.DeleteItem(remoteClient.AgentId, item); | 416 | userInfo.DeleteItem(remoteClient.AgentId, item); |
417 | remoteClient.SendRemoveInventoryItem(itemID); | 417 | remoteClient.SendRemoveInventoryItem(itemID); |
418 | } | 418 | } |
419 | } | 419 | } |
420 | } | 420 | } |
421 | } | 421 | } |
422 | } | 422 | } |
423 | } | 423 | } |
424 | 424 | ||
425 | private void AddRezObject(string xmlData, LLVector3 pos) | 425 | private void AddRezObject(string xmlData, LLVector3 pos) |
426 | { | 426 | { |
427 | SceneObjectGroup group = new SceneObjectGroup(this, m_regionHandle, xmlData); | 427 | SceneObjectGroup group = new SceneObjectGroup(this, m_regionHandle, xmlData); |
428 | AddEntity(group); | 428 | AddEntity(group); |
429 | group.AbsolutePosition = pos; | 429 | group.AbsolutePosition = pos; |
430 | SceneObjectPart rootPart = group.GetChildPart(group.UUID); | 430 | SceneObjectPart rootPart = group.GetChildPart(group.UUID); |
431 | if ((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Phantom) == 0) | 431 | if ((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Phantom) == 0) |
432 | { | 432 | { |
433 | PrimitiveBaseShape pbs = rootPart.Shape; | 433 | PrimitiveBaseShape pbs = rootPart.Shape; |
434 | rootPart.PhysActor = phyScene.AddPrimShape( | 434 | rootPart.PhysActor = phyScene.AddPrimShape( |
435 | rootPart.Name, | 435 | rootPart.Name, |
436 | pbs, | 436 | pbs, |
437 | new PhysicsVector(rootPart.AbsolutePosition.X, rootPart.AbsolutePosition.Y, | 437 | new PhysicsVector(rootPart.AbsolutePosition.X, rootPart.AbsolutePosition.Y, |
438 | rootPart.AbsolutePosition.Z), | 438 | rootPart.AbsolutePosition.Z), |
439 | new PhysicsVector(rootPart.Scale.X, rootPart.Scale.Y, rootPart.Scale.Z), | 439 | new PhysicsVector(rootPart.Scale.X, rootPart.Scale.Y, rootPart.Scale.Z), |
440 | new Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X, | 440 | new Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X, |
441 | rootPart.RotationOffset.Y, rootPart.RotationOffset.Z)); | 441 | rootPart.RotationOffset.Y, rootPart.RotationOffset.Z)); |
442 | } | 442 | } |
443 | } | 443 | } |
444 | } | 444 | } |
445 | } | 445 | } |
diff --git a/OpenSim/Region/Environment/Scenes/SceneManager.cs b/OpenSim/Region/Environment/Scenes/SceneManager.cs index 0049282..89f60d1 100644 --- a/OpenSim/Region/Environment/Scenes/SceneManager.cs +++ b/OpenSim/Region/Environment/Scenes/SceneManager.cs | |||
@@ -1,251 +1,251 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using OpenSim.Framework.Console; | 3 | using OpenSim.Framework.Console; |
4 | using OpenSim.Framework.Types; | 4 | using OpenSim.Framework.Types; |
5 | using libsecondlife; | 5 | using libsecondlife; |
6 | 6 | ||
7 | namespace OpenSim.Region.Environment.Scenes | 7 | namespace OpenSim.Region.Environment.Scenes |
8 | { | 8 | { |
9 | public class SceneManager | 9 | public class SceneManager |
10 | { | 10 | { |
11 | private readonly List<Scene> m_localScenes; | 11 | private readonly List<Scene> m_localScenes; |
12 | private Scene m_currentScene = null; | 12 | private Scene m_currentScene = null; |
13 | 13 | ||
14 | public Scene CurrentScene | 14 | public Scene CurrentScene |
15 | { | 15 | { |
16 | get { return m_currentScene; } | 16 | get { return m_currentScene; } |
17 | } | 17 | } |
18 | 18 | ||
19 | public Scene CurrentOrFirstScene | 19 | public Scene CurrentOrFirstScene |
20 | { | 20 | { |
21 | get | 21 | get |
22 | { | 22 | { |
23 | if (m_currentScene == null) | 23 | if (m_currentScene == null) |
24 | { | 24 | { |
25 | return m_localScenes[0]; | 25 | return m_localScenes[0]; |
26 | } | 26 | } |
27 | else | 27 | else |
28 | { | 28 | { |
29 | return m_currentScene; | 29 | return m_currentScene; |
30 | } | 30 | } |
31 | } | 31 | } |
32 | } | 32 | } |
33 | 33 | ||
34 | public SceneManager() | 34 | public SceneManager() |
35 | { | 35 | { |
36 | m_localScenes = new List<Scene>(); | 36 | m_localScenes = new List<Scene>(); |
37 | } | 37 | } |
38 | 38 | ||
39 | public void Close() | 39 | public void Close() |
40 | { | 40 | { |
41 | for (int i = 0; i < m_localScenes.Count; i++) | 41 | for (int i = 0; i < m_localScenes.Count; i++) |
42 | { | 42 | { |
43 | m_localScenes[i].Close(); | 43 | m_localScenes[i].Close(); |
44 | } | 44 | } |
45 | } | 45 | } |
46 | 46 | ||
47 | public void Add(Scene scene) | 47 | public void Add(Scene scene) |
48 | { | 48 | { |
49 | m_localScenes.Add(scene); | 49 | m_localScenes.Add(scene); |
50 | } | 50 | } |
51 | 51 | ||
52 | public void SaveCurrentSceneToXml(string filename) | 52 | public void SaveCurrentSceneToXml(string filename) |
53 | { | 53 | { |
54 | CurrentOrFirstScene.SavePrimsToXml(filename); | 54 | CurrentOrFirstScene.SavePrimsToXml(filename); |
55 | } | 55 | } |
56 | 56 | ||
57 | public void LoadCurrentSceneFromXml(string filename) | 57 | public void LoadCurrentSceneFromXml(string filename) |
58 | { | 58 | { |
59 | CurrentOrFirstScene.LoadPrimsFromXml(filename); | 59 | CurrentOrFirstScene.LoadPrimsFromXml(filename); |
60 | } | 60 | } |
61 | 61 | ||
62 | public bool RunTerrainCmdOnCurrentScene(string[] cmdparams, ref string result) | 62 | public bool RunTerrainCmdOnCurrentScene(string[] cmdparams, ref string result) |
63 | { | 63 | { |
64 | if (m_currentScene == null) | 64 | if (m_currentScene == null) |
65 | { | 65 | { |
66 | bool success = true; | 66 | bool success = true; |
67 | foreach (Scene scene in m_localScenes) | 67 | foreach (Scene scene in m_localScenes) |
68 | { | 68 | { |
69 | if (!scene.Terrain.RunTerrainCmd(cmdparams, ref result, scene.RegionInfo.RegionName)) | 69 | if (!scene.Terrain.RunTerrainCmd(cmdparams, ref result, scene.RegionInfo.RegionName)) |
70 | { | 70 | { |
71 | success = false; | 71 | success = false; |
72 | } | 72 | } |
73 | } | 73 | } |
74 | 74 | ||
75 | return success; | 75 | return success; |
76 | } | 76 | } |
77 | else | 77 | else |
78 | { | 78 | { |
79 | return m_currentScene.Terrain.RunTerrainCmd(cmdparams, ref result, m_currentScene.RegionInfo.RegionName); | 79 | return m_currentScene.Terrain.RunTerrainCmd(cmdparams, ref result, m_currentScene.RegionInfo.RegionName); |
80 | } | 80 | } |
81 | } | 81 | } |
82 | 82 | ||
83 | public void SendCommandToCurrentSceneScripts(string[] cmdparams) | 83 | public void SendCommandToCurrentSceneScripts(string[] cmdparams) |
84 | { | 84 | { |
85 | ForEachCurrentScene(delegate(Scene scene) { scene.SendCommandToPlugins(cmdparams); }); | 85 | ForEachCurrentScene(delegate(Scene scene) { scene.SendCommandToPlugins(cmdparams); }); |
86 | } | 86 | } |
87 | 87 | ||
88 | public void SetBypassPermissionsOnCurrentScene(bool bypassPermissions) | 88 | public void SetBypassPermissionsOnCurrentScene(bool bypassPermissions) |
89 | { | 89 | { |
90 | ForEachCurrentScene(delegate(Scene scene) { scene.PermissionsMngr.BypassPermissions = bypassPermissions; }); | 90 | ForEachCurrentScene(delegate(Scene scene) { scene.PermissionsMngr.BypassPermissions = bypassPermissions; }); |
91 | } | 91 | } |
92 | 92 | ||
93 | private void ForEachCurrentScene(Action<Scene> func) | 93 | private void ForEachCurrentScene(Action<Scene> func) |
94 | { | 94 | { |
95 | if (m_currentScene == null) | 95 | if (m_currentScene == null) |
96 | { | 96 | { |
97 | m_localScenes.ForEach(func); | 97 | m_localScenes.ForEach(func); |
98 | } | 98 | } |
99 | else | 99 | else |
100 | { | 100 | { |
101 | func(m_currentScene); | 101 | func(m_currentScene); |
102 | } | 102 | } |
103 | } | 103 | } |
104 | 104 | ||
105 | public void BackupCurrentScene() | 105 | public void BackupCurrentScene() |
106 | { | 106 | { |
107 | ForEachCurrentScene(delegate(Scene scene) { scene.Backup(); }); | 107 | ForEachCurrentScene(delegate(Scene scene) { scene.Backup(); }); |
108 | } | 108 | } |
109 | 109 | ||
110 | public void HandleAlertCommandOnCurrentScene(string[] cmdparams) | 110 | public void HandleAlertCommandOnCurrentScene(string[] cmdparams) |
111 | { | 111 | { |
112 | ForEachCurrentScene(delegate(Scene scene) { scene.HandleAlertCommand(cmdparams); }); | 112 | ForEachCurrentScene(delegate(Scene scene) { scene.HandleAlertCommand(cmdparams); }); |
113 | } | 113 | } |
114 | 114 | ||
115 | public bool TrySetCurrentScene(string regionName) | 115 | public bool TrySetCurrentScene(string regionName) |
116 | { | 116 | { |
117 | if ((String.Compare(regionName, "root") == 0) || (String.Compare(regionName, "..") == 0)) | 117 | if ((String.Compare(regionName, "root") == 0) || (String.Compare(regionName, "..") == 0)) |
118 | { | 118 | { |
119 | m_currentScene = null; | 119 | m_currentScene = null; |
120 | return true; | 120 | return true; |
121 | } | 121 | } |
122 | else | 122 | else |
123 | { | 123 | { |
124 | Console.WriteLine("Searching for Region: '" + regionName + "'"); | 124 | Console.WriteLine("Searching for Region: '" + regionName + "'"); |
125 | 125 | ||
126 | foreach (Scene scene in m_localScenes) | 126 | foreach (Scene scene in m_localScenes) |
127 | { | 127 | { |
128 | if (String.Compare(scene.RegionInfo.RegionName, regionName, true) == 0) | 128 | if (String.Compare(scene.RegionInfo.RegionName, regionName, true) == 0) |
129 | { | 129 | { |
130 | m_currentScene = scene; | 130 | m_currentScene = scene; |
131 | return true; | 131 | return true; |
132 | } | 132 | } |
133 | } | 133 | } |
134 | 134 | ||
135 | return false; | 135 | return false; |
136 | } | 136 | } |
137 | } | 137 | } |
138 | 138 | ||
139 | public void SetDebugPacketOnCurrentScene(LogBase log, int newDebug) | 139 | public void SetDebugPacketOnCurrentScene(LogBase log, int newDebug) |
140 | { | 140 | { |
141 | ForEachCurrentScene(delegate(Scene scene) | 141 | ForEachCurrentScene(delegate(Scene scene) |
142 | { | 142 | { |
143 | foreach (EntityBase entity in scene.Entities.Values) | 143 | foreach (EntityBase entity in scene.Entities.Values) |
144 | { | 144 | { |
145 | if (entity is ScenePresence) | 145 | if (entity is ScenePresence) |
146 | { | 146 | { |
147 | ScenePresence scenePrescence = entity as ScenePresence; | 147 | ScenePresence scenePrescence = entity as ScenePresence; |
148 | if (!scenePrescence.IsChildAgent) | 148 | if (!scenePrescence.IsChildAgent) |
149 | { | 149 | { |
150 | log.Error(String.Format("Packet debug for {0} {1} set to {2}", | 150 | log.Error(String.Format("Packet debug for {0} {1} set to {2}", |
151 | scenePrescence.Firstname, scenePrescence.Lastname, | 151 | scenePrescence.Firstname, scenePrescence.Lastname, |
152 | newDebug)); | 152 | newDebug)); |
153 | 153 | ||
154 | scenePrescence.ControllingClient.SetDebug(newDebug); | 154 | scenePrescence.ControllingClient.SetDebug(newDebug); |
155 | } | 155 | } |
156 | } | 156 | } |
157 | } | 157 | } |
158 | }); | 158 | }); |
159 | } | 159 | } |
160 | 160 | ||
161 | public List<ScenePresence> GetCurrentSceneAvatars() | 161 | public List<ScenePresence> GetCurrentSceneAvatars() |
162 | { | 162 | { |
163 | List<ScenePresence> avatars = new List<ScenePresence>(); | 163 | List<ScenePresence> avatars = new List<ScenePresence>(); |
164 | 164 | ||
165 | ForEachCurrentScene(delegate(Scene scene) | 165 | ForEachCurrentScene(delegate(Scene scene) |
166 | { | 166 | { |
167 | foreach (EntityBase entity in scene.Entities.Values) | 167 | foreach (EntityBase entity in scene.Entities.Values) |
168 | { | 168 | { |
169 | if (entity is ScenePresence) | 169 | if (entity is ScenePresence) |
170 | { | 170 | { |
171 | ScenePresence scenePrescence = entity as ScenePresence; | 171 | ScenePresence scenePrescence = entity as ScenePresence; |
172 | if (!scenePrescence.IsChildAgent) | 172 | if (!scenePrescence.IsChildAgent) |
173 | { | 173 | { |
174 | avatars.Add(scenePrescence); | 174 | avatars.Add(scenePrescence); |
175 | } | 175 | } |
176 | } | 176 | } |
177 | } | 177 | } |
178 | }); | 178 | }); |
179 | 179 | ||
180 | return avatars; | 180 | return avatars; |
181 | } | 181 | } |
182 | 182 | ||
183 | public RegionInfo GetRegionInfo(ulong regionHandle) | 183 | public RegionInfo GetRegionInfo(ulong regionHandle) |
184 | { | 184 | { |
185 | foreach (Scene scene in m_localScenes) | 185 | foreach (Scene scene in m_localScenes) |
186 | { | 186 | { |
187 | if (scene.RegionInfo.RegionHandle == regionHandle) | 187 | if (scene.RegionInfo.RegionHandle == regionHandle) |
188 | { | 188 | { |
189 | return scene.RegionInfo; | 189 | return scene.RegionInfo; |
190 | } | 190 | } |
191 | } | 191 | } |
192 | 192 | ||
193 | return null; | 193 | return null; |
194 | } | 194 | } |
195 | 195 | ||
196 | public void SetCurrentSceneTimePhase(int timePhase) | 196 | public void SetCurrentSceneTimePhase(int timePhase) |
197 | { | 197 | { |
198 | ForEachCurrentScene(delegate(Scene scene) | 198 | ForEachCurrentScene(delegate(Scene scene) |
199 | { | 199 | { |
200 | scene.SetTimePhase( | 200 | scene.SetTimePhase( |
201 | timePhase) | 201 | timePhase) |
202 | ; | 202 | ; |
203 | }); | 203 | }); |
204 | } | 204 | } |
205 | 205 | ||
206 | 206 | ||
207 | public void ForceCurrentSceneClientUpdate() | 207 | public void ForceCurrentSceneClientUpdate() |
208 | { | 208 | { |
209 | ForEachCurrentScene(delegate(Scene scene) { scene.ForceClientUpdate(); }); | 209 | ForEachCurrentScene(delegate(Scene scene) { scene.ForceClientUpdate(); }); |
210 | } | 210 | } |
211 | 211 | ||
212 | public void HandleEditCommandOnCurrentScene(string[] cmdparams) | 212 | public void HandleEditCommandOnCurrentScene(string[] cmdparams) |
213 | { | 213 | { |
214 | ForEachCurrentScene(delegate(Scene scene) { scene.HandleEditCommand(cmdparams); }); | 214 | ForEachCurrentScene(delegate(Scene scene) { scene.HandleEditCommand(cmdparams); }); |
215 | } | 215 | } |
216 | 216 | ||
217 | public bool TryGetAvatar( LLUUID avatarId, out ScenePresence avatar ) | 217 | public bool TryGetAvatar( LLUUID avatarId, out ScenePresence avatar ) |
218 | { | 218 | { |
219 | foreach (Scene scene in m_localScenes) | 219 | foreach (Scene scene in m_localScenes) |
220 | { | 220 | { |
221 | if( scene.TryGetAvatar( avatarId, out avatar )) | 221 | if( scene.TryGetAvatar( avatarId, out avatar )) |
222 | { | 222 | { |
223 | return true; | 223 | return true; |
224 | } | 224 | } |
225 | } | 225 | } |
226 | 226 | ||
227 | avatar = null; | 227 | avatar = null; |
228 | return false; | 228 | return false; |
229 | } | 229 | } |
230 | 230 | ||
231 | public void CloseScene(Scene scene) | 231 | public void CloseScene(Scene scene) |
232 | { | 232 | { |
233 | m_localScenes.Remove(scene); | 233 | m_localScenes.Remove(scene); |
234 | scene.Close(); | 234 | scene.Close(); |
235 | } | 235 | } |
236 | 236 | ||
237 | public bool TryGetAvatarByName(string avatarName, out ScenePresence avatar) | 237 | public bool TryGetAvatarByName(string avatarName, out ScenePresence avatar) |
238 | { | 238 | { |
239 | foreach (Scene scene in m_localScenes) | 239 | foreach (Scene scene in m_localScenes) |
240 | { | 240 | { |
241 | if (scene.TryGetAvatarByName(avatarName, out avatar)) | 241 | if (scene.TryGetAvatarByName(avatarName, out avatar)) |
242 | { | 242 | { |
243 | return true; | 243 | return true; |
244 | } | 244 | } |
245 | } | 245 | } |
246 | 246 | ||
247 | avatar = null; | 247 | avatar = null; |
248 | return false; | 248 | return false; |
249 | } | 249 | } |
250 | } | 250 | } |
251 | } \ No newline at end of file | 251 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Environment/Scenes/Scripting/IScriptHost.cs b/OpenSim/Region/Environment/Scenes/Scripting/IScriptHost.cs index dbd43be..baaeb86 100644 --- a/OpenSim/Region/Environment/Scenes/Scripting/IScriptHost.cs +++ b/OpenSim/Region/Environment/Scenes/Scripting/IScriptHost.cs | |||
@@ -1,6 +1,6 @@ | |||
1 | using Axiom.Math; | 1 | using Axiom.Math; |
2 | using libsecondlife; | 2 | using libsecondlife; |
3 | 3 | ||
4 | namespace OpenSim.Region.Environment.Scenes.Scripting | 4 | namespace OpenSim.Region.Environment.Scenes.Scripting |
5 | { | 5 | { |
6 | public interface IScriptHost | 6 | public interface IScriptHost |
diff --git a/OpenSim/Region/Environment/Scenes/Scripting/NullScriptHost.cs b/OpenSim/Region/Environment/Scenes/Scripting/NullScriptHost.cs index 6876cfb..2337aba 100644 --- a/OpenSim/Region/Environment/Scenes/Scripting/NullScriptHost.cs +++ b/OpenSim/Region/Environment/Scenes/Scripting/NullScriptHost.cs | |||
@@ -1,13 +1,13 @@ | |||
1 | using System; | 1 | using System; |
2 | using Axiom.Math; | 2 | using Axiom.Math; |
3 | using libsecondlife; | 3 | using libsecondlife; |
4 | 4 | ||
5 | namespace OpenSim.Region.Environment.Scenes.Scripting | 5 | namespace OpenSim.Region.Environment.Scenes.Scripting |
6 | { | 6 | { |
7 | public class NullScriptHost : IScriptHost | 7 | public class NullScriptHost : IScriptHost |
8 | { | 8 | { |
9 | private LLVector3 m_pos = new LLVector3(128, 128, 30); | 9 | private LLVector3 m_pos = new LLVector3(128, 128, 30); |
10 | 10 | ||
11 | public string Name | 11 | public string Name |
12 | { | 12 | { |
13 | get { return "Object"; } | 13 | get { return "Object"; } |
@@ -38,13 +38,13 @@ namespace OpenSim.Region.Environment.Scenes.Scripting | |||
38 | } | 38 | } |
39 | 39 | ||
40 | public LLUUID ObjectOwner | 40 | public LLUUID ObjectOwner |
41 | { | 41 | { |
42 | get { return LLUUID.Zero; } | 42 | get { return LLUUID.Zero; } |
43 | } | 43 | } |
44 | 44 | ||
45 | public LLUUID ObjectCreator | 45 | public LLUUID ObjectCreator |
46 | { | 46 | { |
47 | get { return LLUUID.Zero; } | 47 | get { return LLUUID.Zero; } |
48 | } | 48 | } |
49 | 49 | ||
50 | public LLVector3 AbsolutePosition | 50 | public LLVector3 AbsolutePosition |
diff --git a/OpenSim/Region/Environment/Types/BasicQuadTreeNode.cs b/OpenSim/Region/Environment/Types/BasicQuadTreeNode.cs index 0b815ba..2b8d92e 100644 --- a/OpenSim/Region/Environment/Types/BasicQuadTreeNode.cs +++ b/OpenSim/Region/Environment/Types/BasicQuadTreeNode.cs | |||
@@ -1,6 +1,6 @@ | |||
1 | using System.Collections.Generic; | 1 | using System.Collections.Generic; |
2 | using OpenSim.Region.Environment.Scenes; | 2 | using OpenSim.Region.Environment.Scenes; |
3 | 3 | ||
4 | namespace OpenSim.Region.Environment.Types | 4 | namespace OpenSim.Region.Environment.Types |
5 | { | 5 | { |
6 | public class BasicQuadTreeNode | 6 | public class BasicQuadTreeNode |
@@ -64,16 +64,16 @@ namespace OpenSim.Region.Environment.Types | |||
64 | if (m_childNodes == null) | 64 | if (m_childNodes == null) |
65 | { | 65 | { |
66 | m_childNodes = new BasicQuadTreeNode[4]; | 66 | m_childNodes = new BasicQuadTreeNode[4]; |
67 | m_childNodes[0] = | 67 | m_childNodes[0] = |
68 | new BasicQuadTreeNode(this, m_leftX, m_leftY, (short) (m_width/2), (short) (m_height/2)); | 68 | new BasicQuadTreeNode(this, m_leftX, m_leftY, (short) (m_width/2), (short) (m_height/2)); |
69 | m_childNodes[1] = | 69 | m_childNodes[1] = |
70 | new BasicQuadTreeNode(this, (short) (m_leftX + (m_width/2)), m_leftY, (short) (m_width/2), | 70 | new BasicQuadTreeNode(this, (short) (m_leftX + (m_width/2)), m_leftY, (short) (m_width/2), |
71 | (short) (m_height/2)); | 71 | (short) (m_height/2)); |
72 | m_childNodes[2] = | 72 | m_childNodes[2] = |
73 | new BasicQuadTreeNode(this, m_leftX, (short) (m_leftY + (m_height/2)), (short) (m_width/2), | 73 | new BasicQuadTreeNode(this, m_leftX, (short) (m_leftY + (m_height/2)), (short) (m_width/2), |
74 | (short) (m_height/2)); | 74 | (short) (m_height/2)); |
75 | m_childNodes[3] = | 75 | m_childNodes[3] = |
76 | new BasicQuadTreeNode(this, (short) (m_leftX + (m_width/2)), (short) (m_height + (m_height/2)), | 76 | new BasicQuadTreeNode(this, (short) (m_leftX + (m_width/2)), (short) (m_height + (m_height/2)), |
77 | (short) (m_width/2), (short) (m_height/2)); | 77 | (short) (m_width/2), (short) (m_height/2)); |
78 | } | 78 | } |
79 | else | 79 | else |
@@ -132,7 +132,7 @@ namespace OpenSim.Region.Environment.Types | |||
132 | List<SceneObjectGroup> outBounds = new List<SceneObjectGroup>(); | 132 | List<SceneObjectGroup> outBounds = new List<SceneObjectGroup>(); |
133 | foreach (SceneObjectGroup group in m_objects) | 133 | foreach (SceneObjectGroup group in m_objects) |
134 | { | 134 | { |
135 | if (((group.AbsolutePosition.X > m_leftX) && (group.AbsolutePosition.X < (m_leftX + m_width))) && | 135 | if (((group.AbsolutePosition.X > m_leftX) && (group.AbsolutePosition.X < (m_leftX + m_width))) && |
136 | ((group.AbsolutePosition.Y > m_leftY) && (group.AbsolutePosition.Y < (m_leftY + m_height)))) | 136 | ((group.AbsolutePosition.Y > m_leftY) && (group.AbsolutePosition.Y < (m_leftY + m_height)))) |
137 | { | 137 | { |
138 | //still in bounds | 138 | //still in bounds |
@@ -157,7 +157,7 @@ namespace OpenSim.Region.Environment.Types | |||
157 | 157 | ||
158 | public void PassUp(SceneObjectGroup group) | 158 | public void PassUp(SceneObjectGroup group) |
159 | { | 159 | { |
160 | if (((group.AbsolutePosition.X > m_leftX) && (group.AbsolutePosition.X < (m_leftX + m_width))) && | 160 | if (((group.AbsolutePosition.X > m_leftX) && (group.AbsolutePosition.X < (m_leftX + m_width))) && |
161 | ((group.AbsolutePosition.Y > m_leftY) && (group.AbsolutePosition.Y < (m_leftY + m_height)))) | 161 | ((group.AbsolutePosition.Y > m_leftY) && (group.AbsolutePosition.Y < (m_leftY + m_height)))) |
162 | { | 162 | { |
163 | AddObject(group); | 163 | AddObject(group); |
diff --git a/OpenSim/Region/Environment/Types/UpdateQueue.cs b/OpenSim/Region/Environment/Types/UpdateQueue.cs index 6e26aaf..c1fb161 100644 --- a/OpenSim/Region/Environment/Types/UpdateQueue.cs +++ b/OpenSim/Region/Environment/Types/UpdateQueue.cs | |||
@@ -1,7 +1,7 @@ | |||
1 | using System.Collections.Generic; | 1 | using System.Collections.Generic; |
2 | using libsecondlife; | 2 | using libsecondlife; |
3 | using OpenSim.Region.Environment.Scenes; | 3 | using OpenSim.Region.Environment.Scenes; |
4 | 4 | ||
5 | namespace OpenSim.Region.Environment.Types | 5 | namespace OpenSim.Region.Environment.Types |
6 | { | 6 | { |
7 | public class UpdateQueue | 7 | public class UpdateQueue |
@@ -46,6 +46,6 @@ namespace OpenSim.Region.Environment.Types | |||
46 | } | 46 | } |
47 | 47 | ||
48 | return part; | 48 | return part; |
49 | } | 49 | } |
50 | } | 50 | } |
51 | } \ No newline at end of file | 51 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ExtensionsScriptModule/ScriptManager.cs b/OpenSim/Region/ExtensionsScriptModule/ScriptManager.cs index d2bf919..61e9114 100644 --- a/OpenSim/Region/ExtensionsScriptModule/ScriptManager.cs +++ b/OpenSim/Region/ExtensionsScriptModule/ScriptManager.cs | |||
@@ -1,148 +1,148 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | using System.Collections.Generic; | 28 | using System.Collections.Generic; |
29 | using OpenSim.Framework.Console; | 29 | using OpenSim.Framework.Console; |
30 | using OpenSim.Region.Environment.Interfaces; | 30 | using OpenSim.Region.Environment.Interfaces; |
31 | using OpenSim.Region.Environment.Scenes; | 31 | using OpenSim.Region.Environment.Scenes; |
32 | using OpenSim.Region.ExtensionsScriptModule.CSharp; | 32 | using OpenSim.Region.ExtensionsScriptModule.CSharp; |
33 | using OpenSim.Region.ExtensionsScriptModule.JScript; | 33 | using OpenSim.Region.ExtensionsScriptModule.JScript; |
34 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine; | 34 | using OpenSim.Region.ExtensionsScriptModule.JVMEngine; |
35 | 35 | ||
36 | namespace OpenSim.Region.ExtensionsScriptModule | 36 | namespace OpenSim.Region.ExtensionsScriptModule |
37 | { | 37 | { |
38 | public class ScriptManager : IRegionModule, IExtensionScriptModule | 38 | public class ScriptManager : IRegionModule, IExtensionScriptModule |
39 | { | 39 | { |
40 | readonly List<IScript> scripts = new List<IScript>(); | 40 | readonly List<IScript> scripts = new List<IScript>(); |
41 | Scene m_scene; | 41 | Scene m_scene; |
42 | readonly Dictionary<string, IScriptCompiler> compilers = new Dictionary<string, IScriptCompiler>(); | 42 | readonly Dictionary<string, IScriptCompiler> compilers = new Dictionary<string, IScriptCompiler>(); |
43 | 43 | ||
44 | private void LoadFromCompiler(Dictionary<string, IScript> compiledscripts) | 44 | private void LoadFromCompiler(Dictionary<string, IScript> compiledscripts) |
45 | { | 45 | { |
46 | foreach (KeyValuePair<string, IScript> script in compiledscripts) | 46 | foreach (KeyValuePair<string, IScript> script in compiledscripts) |
47 | { | 47 | { |
48 | ScriptInfo scriptInfo = new ScriptInfo(m_scene); // Since each script could potentially corrupt their access with a stray assignment, making a new one for each script. | 48 | ScriptInfo scriptInfo = new ScriptInfo(m_scene); // Since each script could potentially corrupt their access with a stray assignment, making a new one for each script. |
49 | MainLog.Instance.Verbose("Loading " + script.Key); | 49 | MainLog.Instance.Verbose("Loading " + script.Key); |
50 | script.Value.Initialise(scriptInfo); | 50 | script.Value.Initialise(scriptInfo); |
51 | scripts.Add(script.Value); | 51 | scripts.Add(script.Value); |
52 | } | 52 | } |
53 | 53 | ||
54 | MainLog.Instance.Verbose(string.Format("Finished loading {0} script(s)", compiledscripts.Count)); | 54 | MainLog.Instance.Verbose(string.Format("Finished loading {0} script(s)", compiledscripts.Count)); |
55 | } | 55 | } |
56 | 56 | ||
57 | public ScriptManager() | 57 | public ScriptManager() |
58 | { | 58 | { |
59 | // Default Engines | 59 | // Default Engines |
60 | CSharpScriptEngine csharpCompiler = new CSharpScriptEngine(); | 60 | CSharpScriptEngine csharpCompiler = new CSharpScriptEngine(); |
61 | compilers.Add(csharpCompiler.FileExt(), csharpCompiler); | 61 | compilers.Add(csharpCompiler.FileExt(), csharpCompiler); |
62 | 62 | ||
63 | JScriptEngine jscriptCompiler = new JScriptEngine(); | 63 | JScriptEngine jscriptCompiler = new JScriptEngine(); |
64 | compilers.Add(jscriptCompiler.FileExt(), jscriptCompiler); | 64 | compilers.Add(jscriptCompiler.FileExt(), jscriptCompiler); |
65 | 65 | ||
66 | JavaEngine javaCompiler = new JavaEngine(); | 66 | JavaEngine javaCompiler = new JavaEngine(); |
67 | compilers.Add(javaCompiler.FileExt(), javaCompiler); | 67 | compilers.Add(javaCompiler.FileExt(), javaCompiler); |
68 | } | 68 | } |
69 | 69 | ||
70 | public void Initialise(Scene scene) | 70 | public void Initialise(Scene scene) |
71 | { | 71 | { |
72 | System.Console.WriteLine("Initialising Extensions Scripting Module"); | 72 | System.Console.WriteLine("Initialising Extensions Scripting Module"); |
73 | m_scene = scene; | 73 | m_scene = scene; |
74 | 74 | ||
75 | m_scene.RegisterModuleInterface<IExtensionScriptModule>(this); | 75 | m_scene.RegisterModuleInterface<IExtensionScriptModule>(this); |
76 | } | 76 | } |
77 | 77 | ||
78 | public void PostInitialise() | 78 | public void PostInitialise() |
79 | { | 79 | { |
80 | 80 | ||
81 | } | 81 | } |
82 | 82 | ||
83 | public void CloseDown() | 83 | public void CloseDown() |
84 | { | 84 | { |
85 | 85 | ||
86 | } | 86 | } |
87 | 87 | ||
88 | public string GetName() | 88 | public string GetName() |
89 | { | 89 | { |
90 | return "ExtensionsScriptingModule"; | 90 | return "ExtensionsScriptingModule"; |
91 | } | 91 | } |
92 | 92 | ||
93 | public bool IsSharedModule() | 93 | public bool IsSharedModule() |
94 | { | 94 | { |
95 | return false; | 95 | return false; |
96 | } | 96 | } |
97 | 97 | ||
98 | public bool Compile(string filename) | 98 | public bool Compile(string filename) |
99 | { | 99 | { |
100 | foreach (KeyValuePair<string, IScriptCompiler> compiler in compilers) | 100 | foreach (KeyValuePair<string, IScriptCompiler> compiler in compilers) |
101 | { | 101 | { |
102 | if (filename.EndsWith(compiler.Key)) | 102 | if (filename.EndsWith(compiler.Key)) |
103 | { | 103 | { |
104 | LoadFromCompiler(compiler.Value.compile(filename)); | 104 | LoadFromCompiler(compiler.Value.compile(filename)); |
105 | break; | 105 | break; |
106 | } | 106 | } |
107 | } | 107 | } |
108 | 108 | ||
109 | return true; | 109 | return true; |
110 | } | 110 | } |
111 | 111 | ||
112 | public void RunScriptCmd(string[] args) | 112 | public void RunScriptCmd(string[] args) |
113 | { | 113 | { |
114 | switch (args[0]) | 114 | switch (args[0]) |
115 | { | 115 | { |
116 | case "load": | 116 | case "load": |
117 | Compile(args[1]); | 117 | Compile(args[1]); |
118 | break; | 118 | break; |
119 | 119 | ||
120 | default: | 120 | default: |
121 | MainLog.Instance.Error("Unknown script command"); | 121 | MainLog.Instance.Error("Unknown script command"); |
122 | break; | 122 | break; |
123 | } | 123 | } |
124 | } | 124 | } |
125 | 125 | ||
126 | public bool AddPreCompiledScript(IScript script) | 126 | public bool AddPreCompiledScript(IScript script) |
127 | { | 127 | { |
128 | MainLog.Instance.Verbose("Loading script " + script.Name); | 128 | MainLog.Instance.Verbose("Loading script " + script.Name); |
129 | ScriptInfo scriptInfo = new ScriptInfo(m_scene); // Since each script could potentially corrupt their access with a stray assignment, making a new one for each script. | 129 | ScriptInfo scriptInfo = new ScriptInfo(m_scene); // Since each script could potentially corrupt their access with a stray assignment, making a new one for each script. |
130 | script.Initialise(scriptInfo); | 130 | script.Initialise(scriptInfo); |
131 | scripts.Add(script); | 131 | scripts.Add(script); |
132 | 132 | ||
133 | return true; | 133 | return true; |
134 | } | 134 | } |
135 | } | 135 | } |
136 | 136 | ||
137 | public interface IExtensionScriptModule | 137 | public interface IExtensionScriptModule |
138 | { | 138 | { |
139 | bool Compile(string filename); | 139 | bool Compile(string filename); |
140 | bool AddPreCompiledScript(IScript script); | 140 | bool AddPreCompiledScript(IScript script); |
141 | } | 141 | } |
142 | 142 | ||
143 | interface IScriptCompiler | 143 | interface IScriptCompiler |
144 | { | 144 | { |
145 | Dictionary<string, IScript> compile(string filename); | 145 | Dictionary<string, IScript> compile(string filename); |
146 | string FileExt(); | 146 | string FileExt(); |
147 | } | 147 | } |
148 | } | 148 | } |
diff --git a/OpenSim/Region/Physics/OdePlugin/Meshing/Meshmerizer.cs b/OpenSim/Region/Physics/OdePlugin/Meshing/Meshmerizer.cs index 28dca41..ce3ba5c 100644 --- a/OpenSim/Region/Physics/OdePlugin/Meshing/Meshmerizer.cs +++ b/OpenSim/Region/Physics/OdePlugin/Meshing/Meshmerizer.cs | |||
@@ -1,560 +1,560 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Globalization; | 2 | using System.Globalization; |
3 | using System.Diagnostics; | 3 | using System.Diagnostics; |
4 | using System.Collections.Generic; | 4 | using System.Collections.Generic; |
5 | using System.Text; | 5 | using System.Text; |
6 | using System.Runtime.InteropServices; | 6 | using System.Runtime.InteropServices; |
7 | 7 | ||
8 | using OpenSim.Framework.Types; | 8 | using OpenSim.Framework.Types; |
9 | using OpenSim.Region.Physics.Manager; | 9 | using OpenSim.Region.Physics.Manager; |
10 | 10 | ||
11 | namespace OpenSim.Region.Physics.OdePlugin | 11 | namespace OpenSim.Region.Physics.OdePlugin |
12 | { | 12 | { |
13 | public class Mesh | 13 | public class Mesh |
14 | { | 14 | { |
15 | public List<Vertex> vertices; | 15 | public List<Vertex> vertices; |
16 | public List<Triangle> triangles; | 16 | public List<Triangle> triangles; |
17 | 17 | ||
18 | public float[] normals; | 18 | public float[] normals; |
19 | 19 | ||
20 | public Mesh() | 20 | public Mesh() |
21 | { | 21 | { |
22 | vertices = new List<Vertex>(); | 22 | vertices = new List<Vertex>(); |
23 | triangles = new List<Triangle>(); | 23 | triangles = new List<Triangle>(); |
24 | } | 24 | } |
25 | 25 | ||
26 | public void Add(Triangle triangle) | 26 | public void Add(Triangle triangle) |
27 | { | 27 | { |
28 | int i; | 28 | int i; |
29 | i = vertices.IndexOf(triangle.v1); | 29 | i = vertices.IndexOf(triangle.v1); |
30 | if (i < 0) | 30 | if (i < 0) |
31 | throw new ArgumentException("Vertex v1 not known to mesh"); | 31 | throw new ArgumentException("Vertex v1 not known to mesh"); |
32 | i = vertices.IndexOf(triangle.v2); | 32 | i = vertices.IndexOf(triangle.v2); |
33 | if (i < 0) | 33 | if (i < 0) |
34 | throw new ArgumentException("Vertex v2 not known to mesh"); | 34 | throw new ArgumentException("Vertex v2 not known to mesh"); |
35 | i = vertices.IndexOf(triangle.v3); | 35 | i = vertices.IndexOf(triangle.v3); |
36 | if (i < 0) | 36 | if (i < 0) |
37 | throw new ArgumentException("Vertex v3 not known to mesh"); | 37 | throw new ArgumentException("Vertex v3 not known to mesh"); |
38 | 38 | ||
39 | triangles.Add(triangle); | 39 | triangles.Add(triangle); |
40 | } | 40 | } |
41 | 41 | ||
42 | public void Add(Vertex v) | 42 | public void Add(Vertex v) |
43 | { | 43 | { |
44 | vertices.Add(v); | 44 | vertices.Add(v); |
45 | } | 45 | } |
46 | 46 | ||
47 | 47 | ||
48 | public float[] getVertexListAsFloat() | 48 | public float[] getVertexListAsFloat() |
49 | { | 49 | { |
50 | float[] result = new float[vertices.Count * 3]; | 50 | float[] result = new float[vertices.Count * 3]; |
51 | for (int i = 0; i < vertices.Count; i++) | 51 | for (int i = 0; i < vertices.Count; i++) |
52 | { | 52 | { |
53 | Vertex v = vertices[i]; | 53 | Vertex v = vertices[i]; |
54 | PhysicsVector point = v.point; | 54 | PhysicsVector point = v.point; |
55 | result[3 * i + 0] = point.X; | 55 | result[3 * i + 0] = point.X; |
56 | result[3 * i + 1] = point.Y; | 56 | result[3 * i + 1] = point.Y; |
57 | result[3 * i + 2] = point.Z; | 57 | result[3 * i + 2] = point.Z; |
58 | } | 58 | } |
59 | GCHandle.Alloc(result, GCHandleType.Pinned); | 59 | GCHandle.Alloc(result, GCHandleType.Pinned); |
60 | return result; | 60 | return result; |
61 | } | 61 | } |
62 | 62 | ||
63 | public int[] getIndexListAsInt() | 63 | public int[] getIndexListAsInt() |
64 | { | 64 | { |
65 | int[] result = new int[triangles.Count * 3]; | 65 | int[] result = new int[triangles.Count * 3]; |
66 | for (int i = 0; i < triangles.Count; i++) | 66 | for (int i = 0; i < triangles.Count; i++) |
67 | { | 67 | { |
68 | Triangle t = triangles[i]; | 68 | Triangle t = triangles[i]; |
69 | result[3 * i + 0] = vertices.IndexOf(t.v1); | 69 | result[3 * i + 0] = vertices.IndexOf(t.v1); |
70 | result[3 * i + 1] = vertices.IndexOf(t.v2); | 70 | result[3 * i + 1] = vertices.IndexOf(t.v2); |
71 | result[3 * i + 2] = vertices.IndexOf(t.v3); | 71 | result[3 * i + 2] = vertices.IndexOf(t.v3); |
72 | } | 72 | } |
73 | GCHandle.Alloc(result, GCHandleType.Pinned); | 73 | GCHandle.Alloc(result, GCHandleType.Pinned); |
74 | return result; | 74 | return result; |
75 | } | 75 | } |
76 | 76 | ||
77 | 77 | ||
78 | public void Append(Mesh newMesh) | 78 | public void Append(Mesh newMesh) |
79 | { | 79 | { |
80 | foreach (Vertex v in newMesh.vertices) | 80 | foreach (Vertex v in newMesh.vertices) |
81 | vertices.Add(v); | 81 | vertices.Add(v); |
82 | 82 | ||
83 | foreach (Triangle t in newMesh.triangles) | 83 | foreach (Triangle t in newMesh.triangles) |
84 | Add(t); | 84 | Add(t); |
85 | 85 | ||
86 | } | 86 | } |
87 | } | 87 | } |
88 | 88 | ||
89 | 89 | ||
90 | 90 | ||
91 | public class Meshmerizer | 91 | public class Meshmerizer |
92 | { | 92 | { |
93 | 93 | ||
94 | static List<Triangle> FindInfluencedTriangles(List<Triangle> triangles, Vertex v) | 94 | static List<Triangle> FindInfluencedTriangles(List<Triangle> triangles, Vertex v) |
95 | { | 95 | { |
96 | List<Triangle> influenced = new List<Triangle>(); | 96 | List<Triangle> influenced = new List<Triangle>(); |
97 | foreach (Triangle t in triangles) | 97 | foreach (Triangle t in triangles) |
98 | { | 98 | { |
99 | float dx, dy; | 99 | float dx, dy; |
100 | 100 | ||
101 | if (t.isInCircle(v.point.X, v.point.Y)) | 101 | if (t.isInCircle(v.point.X, v.point.Y)) |
102 | { | 102 | { |
103 | influenced.Add(t); | 103 | influenced.Add(t); |
104 | } | 104 | } |
105 | } | 105 | } |
106 | return influenced; | 106 | return influenced; |
107 | } | 107 | } |
108 | 108 | ||
109 | 109 | ||
110 | static void InsertVertices(List<Vertex> vertices, int usedForSeed, List<Triangle> triangles, List<int> innerBorders) | 110 | static void InsertVertices(List<Vertex> vertices, int usedForSeed, List<Triangle> triangles, List<int> innerBorders) |
111 | { | 111 | { |
112 | // This is a variant of the delaunay algorithm | 112 | // This is a variant of the delaunay algorithm |
113 | // each time a new vertex is inserted, all triangles that are influenced by it are deleted | 113 | // each time a new vertex is inserted, all triangles that are influenced by it are deleted |
114 | // and replaced by new ones including the new vertex | 114 | // and replaced by new ones including the new vertex |
115 | // It is not very time efficient but easy to implement. | 115 | // It is not very time efficient but easy to implement. |
116 | 116 | ||
117 | int iCurrentVertex; | 117 | int iCurrentVertex; |
118 | int iMaxVertex=vertices.Count; | 118 | int iMaxVertex=vertices.Count; |
119 | for (iCurrentVertex = usedForSeed; iCurrentVertex < iMaxVertex; iCurrentVertex++) | 119 | for (iCurrentVertex = usedForSeed; iCurrentVertex < iMaxVertex; iCurrentVertex++) |
120 | { | 120 | { |
121 | // Background: A triangle mesh fulfills the delaunay condition if (iff!) | 121 | // Background: A triangle mesh fulfills the delaunay condition if (iff!) |
122 | // each circumlocutory circle (i.e. the circle that touches all three corners) | 122 | // each circumlocutory circle (i.e. the circle that touches all three corners) |
123 | // of each triangle is empty of other vertices. | 123 | // of each triangle is empty of other vertices. |
124 | // Obviously a single (seeding) triangle fulfills this condition. | 124 | // Obviously a single (seeding) triangle fulfills this condition. |
125 | // If we now add one vertex, we need to reconstruct all triangles, that | 125 | // If we now add one vertex, we need to reconstruct all triangles, that |
126 | // do not fulfill this condition with respect to the new triangle | 126 | // do not fulfill this condition with respect to the new triangle |
127 | 127 | ||
128 | // Find the triangles that are influenced by the new vertex | 128 | // Find the triangles that are influenced by the new vertex |
129 | Vertex v=vertices[iCurrentVertex]; | 129 | Vertex v=vertices[iCurrentVertex]; |
130 | List<Triangle> influencedTriangles=FindInfluencedTriangles(triangles, v); | 130 | List<Triangle> influencedTriangles=FindInfluencedTriangles(triangles, v); |
131 | 131 | ||
132 | List<Simplex> simplices = new List<Simplex>(); | 132 | List<Simplex> simplices = new List<Simplex>(); |
133 | 133 | ||
134 | // Reconstruction phase. First step, dissolve each triangle into it's simplices, | 134 | // Reconstruction phase. First step, dissolve each triangle into it's simplices, |
135 | // i.e. it's "border lines" | 135 | // i.e. it's "border lines" |
136 | // Goal is to find "inner" borders and delete them, while the hull gets conserved. | 136 | // Goal is to find "inner" borders and delete them, while the hull gets conserved. |
137 | // Inner borders are special in the way that they always come twice, which is how we detect them | 137 | // Inner borders are special in the way that they always come twice, which is how we detect them |
138 | foreach (Triangle t in influencedTriangles) | 138 | foreach (Triangle t in influencedTriangles) |
139 | { | 139 | { |
140 | List<Simplex> newSimplices = t.GetSimplices(); | 140 | List<Simplex> newSimplices = t.GetSimplices(); |
141 | simplices.AddRange(newSimplices); | 141 | simplices.AddRange(newSimplices); |
142 | triangles.Remove(t); | 142 | triangles.Remove(t); |
143 | } | 143 | } |
144 | // Now sort the simplices. That will make identical ones side by side in the list | 144 | // Now sort the simplices. That will make identical ones side by side in the list |
145 | simplices.Sort(); | 145 | simplices.Sort(); |
146 | 146 | ||
147 | // Look for duplicate simplices here. | 147 | // Look for duplicate simplices here. |
148 | // Remember, they are directly side by side in the list right now | 148 | // Remember, they are directly side by side in the list right now |
149 | int iSimplex; | 149 | int iSimplex; |
150 | List<Simplex> innerSimplices=new List<Simplex>(); | 150 | List<Simplex> innerSimplices=new List<Simplex>(); |
151 | for (iSimplex = 1; iSimplex < simplices.Count; iSimplex++) // Startindex=1, so we can refer backwards | 151 | for (iSimplex = 1; iSimplex < simplices.Count; iSimplex++) // Startindex=1, so we can refer backwards |
152 | { | 152 | { |
153 | if (simplices[iSimplex - 1].CompareTo(simplices[iSimplex])==0) | 153 | if (simplices[iSimplex - 1].CompareTo(simplices[iSimplex])==0) |
154 | { | 154 | { |
155 | innerSimplices.Add(simplices[iSimplex - 1]); | 155 | innerSimplices.Add(simplices[iSimplex - 1]); |
156 | innerSimplices.Add(simplices[iSimplex]); | 156 | innerSimplices.Add(simplices[iSimplex]); |
157 | } | 157 | } |
158 | } | 158 | } |
159 | 159 | ||
160 | foreach (Simplex s in innerSimplices) | 160 | foreach (Simplex s in innerSimplices) |
161 | { | 161 | { |
162 | simplices.Remove(s); | 162 | simplices.Remove(s); |
163 | } | 163 | } |
164 | 164 | ||
165 | // each simplex still in the list belongs to the hull of the region in question | 165 | // each simplex still in the list belongs to the hull of the region in question |
166 | // The new vertex (yes, we still deal with verices here :-) ) forms a triangle | 166 | // The new vertex (yes, we still deal with verices here :-) ) forms a triangle |
167 | // With each of these simplices. Build the new triangles and add them to the list | 167 | // With each of these simplices. Build the new triangles and add them to the list |
168 | foreach (Simplex s in simplices) | 168 | foreach (Simplex s in simplices) |
169 | { | 169 | { |
170 | Triangle t = new Triangle(s.v1, s.v2, vertices[iCurrentVertex]); | 170 | Triangle t = new Triangle(s.v1, s.v2, vertices[iCurrentVertex]); |
171 | triangles.Add(t); | 171 | triangles.Add(t); |
172 | } | 172 | } |
173 | } | 173 | } |
174 | 174 | ||
175 | // At this point all vertices should be inserted into the mesh | 175 | // At this point all vertices should be inserted into the mesh |
176 | // But the areas, that should be kept free still are filled with triangles | 176 | // But the areas, that should be kept free still are filled with triangles |
177 | // We have to remove them. For this we have a list of indices to vertices. | 177 | // We have to remove them. For this we have a list of indices to vertices. |
178 | // Each triangle that solemnly constists of vertices from the inner border | 178 | // Each triangle that solemnly constists of vertices from the inner border |
179 | // are deleted | 179 | // are deleted |
180 | 180 | ||
181 | List<Triangle> innerTriangles = new List<Triangle>(); | 181 | List<Triangle> innerTriangles = new List<Triangle>(); |
182 | foreach (Triangle t in triangles) | 182 | foreach (Triangle t in triangles) |
183 | { | 183 | { |
184 | if ( | 184 | if ( |
185 | innerBorders.Contains(vertices.IndexOf(t.v1)) | 185 | innerBorders.Contains(vertices.IndexOf(t.v1)) |
186 | && innerBorders.Contains(vertices.IndexOf(t.v2)) | 186 | && innerBorders.Contains(vertices.IndexOf(t.v2)) |
187 | && innerBorders.Contains(vertices.IndexOf(t.v3)) | 187 | && innerBorders.Contains(vertices.IndexOf(t.v3)) |
188 | ) | 188 | ) |
189 | innerTriangles.Add(t); | 189 | innerTriangles.Add(t); |
190 | } | 190 | } |
191 | foreach (Triangle t in innerTriangles) | 191 | foreach (Triangle t in innerTriangles) |
192 | { | 192 | { |
193 | triangles.Remove(t); | 193 | triangles.Remove(t); |
194 | } | 194 | } |
195 | } | 195 | } |
196 | 196 | ||
197 | 197 | ||
198 | static Mesh CreateBoxMeshX(PrimitiveBaseShape primShape, PhysicsVector size) | 198 | static Mesh CreateBoxMeshX(PrimitiveBaseShape primShape, PhysicsVector size) |
199 | // Builds the x (+ and -) surfaces of a box shaped prim | 199 | // Builds the x (+ and -) surfaces of a box shaped prim |
200 | { | 200 | { |
201 | UInt16 hollowFactor = primShape.ProfileHollow; | 201 | UInt16 hollowFactor = primShape.ProfileHollow; |
202 | Mesh meshMX = new Mesh(); | 202 | Mesh meshMX = new Mesh(); |
203 | 203 | ||
204 | 204 | ||
205 | // Surface 0, -X | 205 | // Surface 0, -X |
206 | meshMX.Add(new Vertex("-X-Y-Z", -size.X / 2.0f, -size.Y / 2.0f, -size.Z / 2.0f)); | 206 | meshMX.Add(new Vertex("-X-Y-Z", -size.X / 2.0f, -size.Y / 2.0f, -size.Z / 2.0f)); |
207 | meshMX.Add(new Vertex("-X+Y-Z", -size.X / 2.0f, +size.Y / 2.0f, -size.Z / 2.0f)); | 207 | meshMX.Add(new Vertex("-X+Y-Z", -size.X / 2.0f, +size.Y / 2.0f, -size.Z / 2.0f)); |
208 | meshMX.Add(new Vertex("-X-Y+Z", -size.X / 2.0f, -size.Y / 2.0f, +size.Z / 2.0f)); | 208 | meshMX.Add(new Vertex("-X-Y+Z", -size.X / 2.0f, -size.Y / 2.0f, +size.Z / 2.0f)); |
209 | meshMX.Add(new Vertex("-X+Y+Z", -size.X / 2.0f, +size.Y / 2.0f, +size.Z / 2.0f)); | 209 | meshMX.Add(new Vertex("-X+Y+Z", -size.X / 2.0f, +size.Y / 2.0f, +size.Z / 2.0f)); |
210 | 210 | ||
211 | meshMX.Add(new Triangle(meshMX.vertices[0], meshMX.vertices[2], meshMX.vertices[1])); | 211 | meshMX.Add(new Triangle(meshMX.vertices[0], meshMX.vertices[2], meshMX.vertices[1])); |
212 | meshMX.Add(new Triangle(meshMX.vertices[1], meshMX.vertices[2], meshMX.vertices[3])); | 212 | meshMX.Add(new Triangle(meshMX.vertices[1], meshMX.vertices[2], meshMX.vertices[3])); |
213 | 213 | ||
214 | 214 | ||
215 | Mesh meshPX = new Mesh(); | 215 | Mesh meshPX = new Mesh(); |
216 | // Surface 1, +X | 216 | // Surface 1, +X |
217 | meshPX.Add(new Vertex("+X-Y-Z", +size.X / 2.0f, -size.Y / 2.0f, -size.Z / 2.0f)); | 217 | meshPX.Add(new Vertex("+X-Y-Z", +size.X / 2.0f, -size.Y / 2.0f, -size.Z / 2.0f)); |
218 | meshPX.Add(new Vertex("+X+Y-Z", +size.X / 2.0f, +size.Y / 2.0f, -size.Z / 2.0f)); | 218 | meshPX.Add(new Vertex("+X+Y-Z", +size.X / 2.0f, +size.Y / 2.0f, -size.Z / 2.0f)); |
219 | meshPX.Add(new Vertex("+X-Y+Z", +size.X / 2.0f, -size.Y / 2.0f, +size.Z / 2.0f)); | 219 | meshPX.Add(new Vertex("+X-Y+Z", +size.X / 2.0f, -size.Y / 2.0f, +size.Z / 2.0f)); |
220 | meshPX.Add(new Vertex("+X+Y+Z", +size.X / 2.0f, +size.Y / 2.0f, +size.Z / 2.0f)); | 220 | meshPX.Add(new Vertex("+X+Y+Z", +size.X / 2.0f, +size.Y / 2.0f, +size.Z / 2.0f)); |
221 | 221 | ||
222 | 222 | ||
223 | meshPX.Add(new Triangle(meshPX.vertices[0], meshPX.vertices[1], meshPX.vertices[2])); | 223 | meshPX.Add(new Triangle(meshPX.vertices[0], meshPX.vertices[1], meshPX.vertices[2])); |
224 | meshPX.Add(new Triangle(meshPX.vertices[2], meshPX.vertices[1], meshPX.vertices[3])); | 224 | meshPX.Add(new Triangle(meshPX.vertices[2], meshPX.vertices[1], meshPX.vertices[3])); |
225 | 225 | ||
226 | 226 | ||
227 | if (hollowFactor > 0) | 227 | if (hollowFactor > 0) |
228 | { | 228 | { |
229 | float hollowFactorF = (float)hollowFactor / (float)50000; | 229 | float hollowFactorF = (float)hollowFactor / (float)50000; |
230 | 230 | ||
231 | Vertex IPP; | 231 | Vertex IPP; |
232 | Vertex IPM; | 232 | Vertex IPM; |
233 | Vertex IMP; | 233 | Vertex IMP; |
234 | Vertex IMM; | 234 | Vertex IMM; |
235 | 235 | ||
236 | IPP = new Vertex("Inner-X+Y+Z", -size.X * hollowFactorF / 2.0f, +size.Y * hollowFactorF / 2.0f, +size.Z / 2.0f); | 236 | IPP = new Vertex("Inner-X+Y+Z", -size.X * hollowFactorF / 2.0f, +size.Y * hollowFactorF / 2.0f, +size.Z / 2.0f); |
237 | IPM = new Vertex("Inner-X+Y-Z", -size.X * hollowFactorF / 2.0f, +size.Y * hollowFactorF / 2.0f, -size.Z / 2.0f); | 237 | IPM = new Vertex("Inner-X+Y-Z", -size.X * hollowFactorF / 2.0f, +size.Y * hollowFactorF / 2.0f, -size.Z / 2.0f); |
238 | IMP = new Vertex("Inner-X-Y+Z", -size.X * hollowFactorF / 2.0f, -size.Y * hollowFactorF / 2.0f, +size.Z / 2.0f); | 238 | IMP = new Vertex("Inner-X-Y+Z", -size.X * hollowFactorF / 2.0f, -size.Y * hollowFactorF / 2.0f, +size.Z / 2.0f); |
239 | IMM = new Vertex("Inner-X-Y-Z", -size.X * hollowFactorF / 2.0f, -size.Y * hollowFactorF / 2.0f, -size.Z / 2.0f); | 239 | IMM = new Vertex("Inner-X-Y-Z", -size.X * hollowFactorF / 2.0f, -size.Y * hollowFactorF / 2.0f, -size.Z / 2.0f); |
240 | 240 | ||
241 | meshMX.Add(IPP); | 241 | meshMX.Add(IPP); |
242 | meshMX.Add(IPM); | 242 | meshMX.Add(IPM); |
243 | meshMX.Add(IMP); | 243 | meshMX.Add(IMP); |
244 | meshMX.Add(IMM); | 244 | meshMX.Add(IMM); |
245 | 245 | ||
246 | meshMX.Add(new Triangle(IPP, IMP, IPM)); | 246 | meshMX.Add(new Triangle(IPP, IMP, IPM)); |
247 | meshMX.Add(new Triangle(IPM, IMP, IMM)); | 247 | meshMX.Add(new Triangle(IPM, IMP, IMM)); |
248 | 248 | ||
249 | foreach (Triangle t in meshMX.triangles) | 249 | foreach (Triangle t in meshMX.triangles) |
250 | { | 250 | { |
251 | PhysicsVector n = t.getNormal(); | 251 | PhysicsVector n = t.getNormal(); |
252 | } | 252 | } |
253 | 253 | ||
254 | 254 | ||
255 | 255 | ||
256 | IPP = new Vertex("Inner+X+Y+Z", +size.X * hollowFactorF / 2.0f, +size.Y * hollowFactorF / 2.0f, +size.Z / 2.0f); | 256 | IPP = new Vertex("Inner+X+Y+Z", +size.X * hollowFactorF / 2.0f, +size.Y * hollowFactorF / 2.0f, +size.Z / 2.0f); |
257 | IPM = new Vertex("Inner+X+Y-Z", +size.X * hollowFactorF / 2.0f, +size.Y * hollowFactorF / 2.0f, -size.Z / 2.0f); | 257 | IPM = new Vertex("Inner+X+Y-Z", +size.X * hollowFactorF / 2.0f, +size.Y * hollowFactorF / 2.0f, -size.Z / 2.0f); |
258 | IMP = new Vertex("Inner+X-Y+Z", +size.X * hollowFactorF / 2.0f, -size.Y * hollowFactorF / 2.0f, +size.Z / 2.0f); | 258 | IMP = new Vertex("Inner+X-Y+Z", +size.X * hollowFactorF / 2.0f, -size.Y * hollowFactorF / 2.0f, +size.Z / 2.0f); |
259 | IMM = new Vertex("Inner+X-Y-Z", +size.X * hollowFactorF / 2.0f, -size.Y * hollowFactorF / 2.0f, -size.Z / 2.0f); | 259 | IMM = new Vertex("Inner+X-Y-Z", +size.X * hollowFactorF / 2.0f, -size.Y * hollowFactorF / 2.0f, -size.Z / 2.0f); |
260 | 260 | ||
261 | meshPX.Add(IPP); | 261 | meshPX.Add(IPP); |
262 | meshPX.Add(IPM); | 262 | meshPX.Add(IPM); |
263 | meshPX.Add(IMP); | 263 | meshPX.Add(IMP); |
264 | meshPX.Add(IMM); | 264 | meshPX.Add(IMM); |
265 | 265 | ||
266 | meshPX.Add(new Triangle(IPP, IPM, IMP)); | 266 | meshPX.Add(new Triangle(IPP, IPM, IMP)); |
267 | meshPX.Add(new Triangle(IMP, IPM, IMM)); | 267 | meshPX.Add(new Triangle(IMP, IPM, IMM)); |
268 | 268 | ||
269 | foreach (Triangle t in meshPX.triangles) | 269 | foreach (Triangle t in meshPX.triangles) |
270 | { | 270 | { |
271 | PhysicsVector n = t.getNormal(); | 271 | PhysicsVector n = t.getNormal(); |
272 | } | 272 | } |
273 | } | 273 | } |
274 | 274 | ||
275 | Mesh result = new Mesh(); | 275 | Mesh result = new Mesh(); |
276 | result.Append(meshMX); | 276 | result.Append(meshMX); |
277 | result.Append(meshPX); | 277 | result.Append(meshPX); |
278 | 278 | ||
279 | return result; | 279 | return result; |
280 | } | 280 | } |
281 | 281 | ||
282 | 282 | ||
283 | 283 | ||
284 | static Mesh CreateBoxMeshY(PrimitiveBaseShape primShape, PhysicsVector size) | 284 | static Mesh CreateBoxMeshY(PrimitiveBaseShape primShape, PhysicsVector size) |
285 | // Builds the y (+ and -) surfaces of a box shaped prim | 285 | // Builds the y (+ and -) surfaces of a box shaped prim |
286 | { | 286 | { |
287 | UInt16 hollowFactor = primShape.ProfileHollow; | 287 | UInt16 hollowFactor = primShape.ProfileHollow; |
288 | 288 | ||
289 | // (M)inus Y | 289 | // (M)inus Y |
290 | Mesh MeshMY = new Mesh(); | 290 | Mesh MeshMY = new Mesh(); |
291 | MeshMY.Add(new Vertex("-X-Y-Z", -size.X / 2.0f, -size.Y / 2.0f, -size.Z / 2.0f)); | 291 | MeshMY.Add(new Vertex("-X-Y-Z", -size.X / 2.0f, -size.Y / 2.0f, -size.Z / 2.0f)); |
292 | MeshMY.Add(new Vertex("+X-Y-Z", +size.X / 2.0f, -size.Y / 2.0f, -size.Z / 2.0f)); | 292 | MeshMY.Add(new Vertex("+X-Y-Z", +size.X / 2.0f, -size.Y / 2.0f, -size.Z / 2.0f)); |
293 | MeshMY.Add(new Vertex("-X-Y+Z", -size.X / 2.0f, -size.Y / 2.0f, +size.Z / 2.0f)); | 293 | MeshMY.Add(new Vertex("-X-Y+Z", -size.X / 2.0f, -size.Y / 2.0f, +size.Z / 2.0f)); |
294 | MeshMY.Add(new Vertex("+X-Y+Z", +size.X / 2.0f, -size.Y / 2.0f, +size.Z / 2.0f)); | 294 | MeshMY.Add(new Vertex("+X-Y+Z", +size.X / 2.0f, -size.Y / 2.0f, +size.Z / 2.0f)); |
295 | 295 | ||
296 | MeshMY.Add(new Triangle(MeshMY.vertices[0], MeshMY.vertices[1], MeshMY.vertices[2])); | 296 | MeshMY.Add(new Triangle(MeshMY.vertices[0], MeshMY.vertices[1], MeshMY.vertices[2])); |
297 | MeshMY.Add(new Triangle(MeshMY.vertices[2], MeshMY.vertices[1], MeshMY.vertices[3])); | 297 | MeshMY.Add(new Triangle(MeshMY.vertices[2], MeshMY.vertices[1], MeshMY.vertices[3])); |
298 | 298 | ||
299 | // (P)lus Y | 299 | // (P)lus Y |
300 | Mesh MeshPY = new Mesh(); | 300 | Mesh MeshPY = new Mesh(); |
301 | 301 | ||
302 | MeshPY.Add(new Vertex("-X+Y-Z", -size.X / 2.0f, +size.Y / 2.0f, -size.Z / 2.0f)); | 302 | MeshPY.Add(new Vertex("-X+Y-Z", -size.X / 2.0f, +size.Y / 2.0f, -size.Z / 2.0f)); |
303 | MeshPY.Add(new Vertex("+X+Y-Z", +size.X / 2.0f, +size.Y / 2.0f, -size.Z / 2.0f)); | 303 | MeshPY.Add(new Vertex("+X+Y-Z", +size.X / 2.0f, +size.Y / 2.0f, -size.Z / 2.0f)); |
304 | MeshPY.Add(new Vertex("-X+Y+Z", -size.X / 2.0f, +size.Y / 2.0f, +size.Z / 2.0f)); | 304 | MeshPY.Add(new Vertex("-X+Y+Z", -size.X / 2.0f, +size.Y / 2.0f, +size.Z / 2.0f)); |
305 | MeshPY.Add(new Vertex("+X+Y+Z", +size.X / 2.0f, +size.Y / 2.0f, +size.Z / 2.0f)); | 305 | MeshPY.Add(new Vertex("+X+Y+Z", +size.X / 2.0f, +size.Y / 2.0f, +size.Z / 2.0f)); |
306 | 306 | ||
307 | MeshPY.Add(new Triangle(MeshPY.vertices[1], MeshPY.vertices[0], MeshPY.vertices[2])); | 307 | MeshPY.Add(new Triangle(MeshPY.vertices[1], MeshPY.vertices[0], MeshPY.vertices[2])); |
308 | MeshPY.Add(new Triangle(MeshPY.vertices[1], MeshPY.vertices[2], MeshPY.vertices[3])); | 308 | MeshPY.Add(new Triangle(MeshPY.vertices[1], MeshPY.vertices[2], MeshPY.vertices[3])); |
309 | 309 | ||
310 | if (hollowFactor > 0) | 310 | if (hollowFactor > 0) |
311 | { | 311 | { |
312 | float hollowFactorF = (float)hollowFactor / (float)50000; | 312 | float hollowFactorF = (float)hollowFactor / (float)50000; |
313 | 313 | ||
314 | Vertex IPP; | 314 | Vertex IPP; |
315 | Vertex IPM; | 315 | Vertex IPM; |
316 | Vertex IMP; | 316 | Vertex IMP; |
317 | Vertex IMM; | 317 | Vertex IMM; |
318 | 318 | ||
319 | IPP = new Vertex("Inner+X-Y+Z", +size.X * hollowFactorF / 2.0f, -size.Y * hollowFactorF / 2.0f, +size.Z / 2.0f); | 319 | IPP = new Vertex("Inner+X-Y+Z", +size.X * hollowFactorF / 2.0f, -size.Y * hollowFactorF / 2.0f, +size.Z / 2.0f); |
320 | IPM = new Vertex("Inner+X-Y-Z", +size.X * hollowFactorF / 2.0f, -size.Y * hollowFactorF / 2.0f, -size.Z / 2.0f); | 320 | IPM = new Vertex("Inner+X-Y-Z", +size.X * hollowFactorF / 2.0f, -size.Y * hollowFactorF / 2.0f, -size.Z / 2.0f); |
321 | IMP = new Vertex("Inner-X-Y+Z", -size.X * hollowFactorF / 2.0f, -size.Y * hollowFactorF / 2.0f, +size.Z / 2.0f); | 321 | IMP = new Vertex("Inner-X-Y+Z", -size.X * hollowFactorF / 2.0f, -size.Y * hollowFactorF / 2.0f, +size.Z / 2.0f); |
322 | IMM = new Vertex("Inner-X-Y-Z", -size.X * hollowFactorF / 2.0f, -size.Y * hollowFactorF / 2.0f, -size.Z / 2.0f); | 322 | IMM = new Vertex("Inner-X-Y-Z", -size.X * hollowFactorF / 2.0f, -size.Y * hollowFactorF / 2.0f, -size.Z / 2.0f); |
323 | 323 | ||
324 | MeshMY.Add(IPP); | 324 | MeshMY.Add(IPP); |
325 | MeshMY.Add(IPM); | 325 | MeshMY.Add(IPM); |
326 | MeshMY.Add(IMP); | 326 | MeshMY.Add(IMP); |
327 | MeshMY.Add(IMM); | 327 | MeshMY.Add(IMM); |
328 | 328 | ||
329 | MeshMY.Add(new Triangle(IPP, IPM, IMP)); | 329 | MeshMY.Add(new Triangle(IPP, IPM, IMP)); |
330 | MeshMY.Add(new Triangle(IMP, IPM, IMM)); | 330 | MeshMY.Add(new Triangle(IMP, IPM, IMM)); |
331 | 331 | ||
332 | foreach (Triangle t in MeshMY.triangles) | 332 | foreach (Triangle t in MeshMY.triangles) |
333 | { | 333 | { |
334 | PhysicsVector n = t.getNormal(); | 334 | PhysicsVector n = t.getNormal(); |
335 | } | 335 | } |
336 | 336 | ||
337 | 337 | ||
338 | 338 | ||
339 | IPP = new Vertex("Inner+X+Y+Z", +size.X * hollowFactorF / 2.0f, +size.Y * hollowFactorF / 2.0f, +size.Z / 2.0f); | 339 | IPP = new Vertex("Inner+X+Y+Z", +size.X * hollowFactorF / 2.0f, +size.Y * hollowFactorF / 2.0f, +size.Z / 2.0f); |
340 | IPM=new Vertex("Inner+X+Y-Z", +size.X * hollowFactorF / 2.0f, +size.Y * hollowFactorF / 2.0f, -size.Z / 2.0f); | 340 | IPM=new Vertex("Inner+X+Y-Z", +size.X * hollowFactorF / 2.0f, +size.Y * hollowFactorF / 2.0f, -size.Z / 2.0f); |
341 | IMP=new Vertex("Inner-X+Y+Z", -size.X * hollowFactorF / 2.0f, +size.Y * hollowFactorF / 2.0f, +size.Z / 2.0f); | 341 | IMP=new Vertex("Inner-X+Y+Z", -size.X * hollowFactorF / 2.0f, +size.Y * hollowFactorF / 2.0f, +size.Z / 2.0f); |
342 | IMM=new Vertex("Inner-X+Y-Z", -size.X * hollowFactorF / 2.0f, +size.Y * hollowFactorF / 2.0f, -size.Z / 2.0f); | 342 | IMM=new Vertex("Inner-X+Y-Z", -size.X * hollowFactorF / 2.0f, +size.Y * hollowFactorF / 2.0f, -size.Z / 2.0f); |
343 | 343 | ||
344 | MeshPY.Add(IPP); | 344 | MeshPY.Add(IPP); |
345 | MeshPY.Add(IPM); | 345 | MeshPY.Add(IPM); |
346 | MeshPY.Add(IMP); | 346 | MeshPY.Add(IMP); |
347 | MeshPY.Add(IMM); | 347 | MeshPY.Add(IMM); |
348 | 348 | ||
349 | MeshPY.Add(new Triangle(IPM, IPP, IMP)); | 349 | MeshPY.Add(new Triangle(IPM, IPP, IMP)); |
350 | MeshPY.Add(new Triangle(IMP, IMM, IPM)); | 350 | MeshPY.Add(new Triangle(IMP, IMM, IPM)); |
351 | 351 | ||
352 | foreach (Triangle t in MeshPY.triangles) | 352 | foreach (Triangle t in MeshPY.triangles) |
353 | { | 353 | { |
354 | PhysicsVector n = t.getNormal(); | 354 | PhysicsVector n = t.getNormal(); |
355 | } | 355 | } |
356 | 356 | ||
357 | 357 | ||
358 | 358 | ||
359 | } | 359 | } |
360 | 360 | ||
361 | 361 | ||
362 | Mesh result = new Mesh(); | 362 | Mesh result = new Mesh(); |
363 | result.Append(MeshMY); | 363 | result.Append(MeshMY); |
364 | result.Append(MeshPY); | 364 | result.Append(MeshPY); |
365 | 365 | ||
366 | return result; | 366 | return result; |
367 | } | 367 | } |
368 | 368 | ||
369 | static Mesh CreateBoxMeshZ(PrimitiveBaseShape primShape, PhysicsVector size) | 369 | static Mesh CreateBoxMeshZ(PrimitiveBaseShape primShape, PhysicsVector size) |
370 | // Builds the z (+ and -) surfaces of a box shaped prim | 370 | // Builds the z (+ and -) surfaces of a box shaped prim |
371 | { | 371 | { |
372 | UInt16 hollowFactor = primShape.ProfileHollow; | 372 | UInt16 hollowFactor = primShape.ProfileHollow; |
373 | 373 | ||
374 | // Base, i.e. outer shape | 374 | // Base, i.e. outer shape |
375 | // (M)inus Z | 375 | // (M)inus Z |
376 | Mesh MZ = new Mesh(); | 376 | Mesh MZ = new Mesh(); |
377 | 377 | ||
378 | MZ.Add(new Vertex("-X-Y-Z", -size.X / 2.0f, -size.Y / 2.0f, -size.Z / 2.0f)); | 378 | MZ.Add(new Vertex("-X-Y-Z", -size.X / 2.0f, -size.Y / 2.0f, -size.Z / 2.0f)); |
379 | MZ.Add(new Vertex("+X-Y-Z", +size.X / 2.0f, -size.Y / 2.0f, -size.Z / 2.0f)); | 379 | MZ.Add(new Vertex("+X-Y-Z", +size.X / 2.0f, -size.Y / 2.0f, -size.Z / 2.0f)); |
380 | MZ.Add(new Vertex("-X+Y-Z", -size.X / 2.0f, +size.Y / 2.0f, -size.Z / 2.0f)); | 380 | MZ.Add(new Vertex("-X+Y-Z", -size.X / 2.0f, +size.Y / 2.0f, -size.Z / 2.0f)); |
381 | MZ.Add(new Vertex("+X+Y-Z", +size.X / 2.0f, +size.Y / 2.0f, -size.Z / 2.0f)); | 381 | MZ.Add(new Vertex("+X+Y-Z", +size.X / 2.0f, +size.Y / 2.0f, -size.Z / 2.0f)); |
382 | 382 | ||
383 | 383 | ||
384 | MZ.Add(new Triangle(MZ.vertices[1], MZ.vertices[0], MZ.vertices[2])); | 384 | MZ.Add(new Triangle(MZ.vertices[1], MZ.vertices[0], MZ.vertices[2])); |
385 | MZ.Add(new Triangle(MZ.vertices[1], MZ.vertices[2], MZ.vertices[3])); | 385 | MZ.Add(new Triangle(MZ.vertices[1], MZ.vertices[2], MZ.vertices[3])); |
386 | 386 | ||
387 | // (P)lus Z | 387 | // (P)lus Z |
388 | Mesh PZ = new Mesh(); | 388 | Mesh PZ = new Mesh(); |
389 | 389 | ||
390 | PZ.Add(new Vertex("-X-Y+Z", -size.X / 2.0f, -size.Y / 2.0f, 0.0f)); | 390 | PZ.Add(new Vertex("-X-Y+Z", -size.X / 2.0f, -size.Y / 2.0f, 0.0f)); |
391 | PZ.Add(new Vertex("+X-Y+Z", +size.X / 2.0f, -size.Y / 2.0f, 0.0f)); | 391 | PZ.Add(new Vertex("+X-Y+Z", +size.X / 2.0f, -size.Y / 2.0f, 0.0f)); |
392 | PZ.Add(new Vertex("-X+Y+Z", -size.X / 2.0f, +size.Y / 2.0f, 0.0f)); | 392 | PZ.Add(new Vertex("-X+Y+Z", -size.X / 2.0f, +size.Y / 2.0f, 0.0f)); |
393 | PZ.Add(new Vertex("+X+Y+Z", +size.X / 2.0f, +size.Y / 2.0f, 0.0f)); | 393 | PZ.Add(new Vertex("+X+Y+Z", +size.X / 2.0f, +size.Y / 2.0f, 0.0f)); |
394 | 394 | ||
395 | // Surface 5, +Z | 395 | // Surface 5, +Z |
396 | PZ.Add(new Triangle(PZ.vertices[0], PZ.vertices[1], PZ.vertices[2])); | 396 | PZ.Add(new Triangle(PZ.vertices[0], PZ.vertices[1], PZ.vertices[2])); |
397 | PZ.Add(new Triangle(PZ.vertices[2], PZ.vertices[1], PZ.vertices[3])); | 397 | PZ.Add(new Triangle(PZ.vertices[2], PZ.vertices[1], PZ.vertices[3])); |
398 | 398 | ||
399 | if (hollowFactor > 0) | 399 | if (hollowFactor > 0) |
400 | { | 400 | { |
401 | float hollowFactorF = (float)hollowFactor / (float)50000; | 401 | float hollowFactorF = (float)hollowFactor / (float)50000; |
402 | 402 | ||
403 | MZ.Add(new Vertex("-X-Y-Z", -size.X * hollowFactorF / 2.0f, -size.Y * hollowFactorF / 2.0f, 0.0f)); | 403 | MZ.Add(new Vertex("-X-Y-Z", -size.X * hollowFactorF / 2.0f, -size.Y * hollowFactorF / 2.0f, 0.0f)); |
404 | MZ.Add(new Vertex("-X+Y-Z", +size.X * hollowFactorF / 2.0f, -size.Y * hollowFactorF / 2.0f, 0.0f)); | 404 | MZ.Add(new Vertex("-X+Y-Z", +size.X * hollowFactorF / 2.0f, -size.Y * hollowFactorF / 2.0f, 0.0f)); |
405 | MZ.Add(new Vertex("-X-Y+Z", -size.X * hollowFactorF / 2.0f, +size.Y * hollowFactorF / 2.0f, 0.0f)); | 405 | MZ.Add(new Vertex("-X-Y+Z", -size.X * hollowFactorF / 2.0f, +size.Y * hollowFactorF / 2.0f, 0.0f)); |
406 | MZ.Add(new Vertex("-X+Y+Z", +size.X * hollowFactorF / 2.0f, +size.Y * hollowFactorF / 2.0f, 0.0f)); | 406 | MZ.Add(new Vertex("-X+Y+Z", +size.X * hollowFactorF / 2.0f, +size.Y * hollowFactorF / 2.0f, 0.0f)); |
407 | 407 | ||
408 | List<int> innerBorders = new List<int>(); | 408 | List<int> innerBorders = new List<int>(); |
409 | innerBorders.Add(4); | 409 | innerBorders.Add(4); |
410 | innerBorders.Add(5); | 410 | innerBorders.Add(5); |
411 | innerBorders.Add(6); | 411 | innerBorders.Add(6); |
412 | innerBorders.Add(7); | 412 | innerBorders.Add(7); |
413 | 413 | ||
414 | InsertVertices(MZ.vertices, 4, MZ.triangles, innerBorders); | 414 | InsertVertices(MZ.vertices, 4, MZ.triangles, innerBorders); |
415 | 415 | ||
416 | PZ.Add(new Vertex("-X-Y-Z", -size.X * hollowFactorF / 2.0f, -size.Y * hollowFactorF / 2.0f, 0.0f)); | 416 | PZ.Add(new Vertex("-X-Y-Z", -size.X * hollowFactorF / 2.0f, -size.Y * hollowFactorF / 2.0f, 0.0f)); |
417 | PZ.Add(new Vertex("-X+Y-Z", +size.X * hollowFactorF / 2.0f, -size.Y * hollowFactorF / 2.0f, 0.0f)); | 417 | PZ.Add(new Vertex("-X+Y-Z", +size.X * hollowFactorF / 2.0f, -size.Y * hollowFactorF / 2.0f, 0.0f)); |
418 | PZ.Add(new Vertex("-X-Y+Z", -size.X * hollowFactorF / 2.0f, +size.Y * hollowFactorF / 2.0f, 0.0f)); | 418 | PZ.Add(new Vertex("-X-Y+Z", -size.X * hollowFactorF / 2.0f, +size.Y * hollowFactorF / 2.0f, 0.0f)); |
419 | PZ.Add(new Vertex("-X+Y+Z", +size.X * hollowFactorF / 2.0f, +size.Y * hollowFactorF / 2.0f, 0.0f)); | 419 | PZ.Add(new Vertex("-X+Y+Z", +size.X * hollowFactorF / 2.0f, +size.Y * hollowFactorF / 2.0f, 0.0f)); |
420 | 420 | ||
421 | innerBorders = new List<int>(); | 421 | innerBorders = new List<int>(); |
422 | innerBorders.Add(4); | 422 | innerBorders.Add(4); |
423 | innerBorders.Add(5); | 423 | innerBorders.Add(5); |
424 | innerBorders.Add(6); | 424 | innerBorders.Add(6); |
425 | innerBorders.Add(7); | 425 | innerBorders.Add(7); |
426 | 426 | ||
427 | InsertVertices(PZ.vertices, 4, PZ.triangles, innerBorders); | 427 | InsertVertices(PZ.vertices, 4, PZ.triangles, innerBorders); |
428 | 428 | ||
429 | } | 429 | } |
430 | 430 | ||
431 | foreach (Vertex v in PZ.vertices) | 431 | foreach (Vertex v in PZ.vertices) |
432 | { | 432 | { |
433 | v.point.Z = size.Z / 2.0f; | 433 | v.point.Z = size.Z / 2.0f; |
434 | } | 434 | } |
435 | foreach (Vertex v in MZ.vertices) | 435 | foreach (Vertex v in MZ.vertices) |
436 | { | 436 | { |
437 | v.point.Z = -size.Z / 2.0f; | 437 | v.point.Z = -size.Z / 2.0f; |
438 | } | 438 | } |
439 | 439 | ||
440 | foreach (Triangle t in MZ.triangles) | 440 | foreach (Triangle t in MZ.triangles) |
441 | { | 441 | { |
442 | PhysicsVector n = t.getNormal(); | 442 | PhysicsVector n = t.getNormal(); |
443 | if (n.Z > 0.0) | 443 | if (n.Z > 0.0) |
444 | t.invertNormal(); | 444 | t.invertNormal(); |
445 | } | 445 | } |
446 | 446 | ||
447 | foreach (Triangle t in PZ.triangles) | 447 | foreach (Triangle t in PZ.triangles) |
448 | { | 448 | { |
449 | PhysicsVector n = t.getNormal(); | 449 | PhysicsVector n = t.getNormal(); |
450 | if (n.Z < 0.0) | 450 | if (n.Z < 0.0) |
451 | t.invertNormal(); | 451 | t.invertNormal(); |
452 | } | 452 | } |
453 | 453 | ||
454 | Mesh result = new Mesh(); | 454 | Mesh result = new Mesh(); |
455 | result.Append(MZ); | 455 | result.Append(MZ); |
456 | result.Append(PZ); | 456 | result.Append(PZ); |
457 | 457 | ||
458 | return result; | 458 | return result; |
459 | } | 459 | } |
460 | 460 | ||
461 | static Mesh CreateBoxMesh(PrimitiveBaseShape primShape, PhysicsVector size) | 461 | static Mesh CreateBoxMesh(PrimitiveBaseShape primShape, PhysicsVector size) |
462 | { | 462 | { |
463 | Mesh result = new Mesh(); | 463 | Mesh result = new Mesh(); |
464 | 464 | ||
465 | 465 | ||
466 | 466 | ||
467 | Mesh MeshX = Meshmerizer.CreateBoxMeshX(primShape, size); | 467 | Mesh MeshX = Meshmerizer.CreateBoxMeshX(primShape, size); |
468 | Mesh MeshY = Meshmerizer.CreateBoxMeshY(primShape, size); | 468 | Mesh MeshY = Meshmerizer.CreateBoxMeshY(primShape, size); |
469 | Mesh MeshZ = Meshmerizer.CreateBoxMeshZ(primShape, size); | 469 | Mesh MeshZ = Meshmerizer.CreateBoxMeshZ(primShape, size); |
470 | 470 | ||
471 | result.Append(MeshX); | 471 | result.Append(MeshX); |
472 | result.Append(MeshY); | 472 | result.Append(MeshY); |
473 | result.Append(MeshZ); | 473 | result.Append(MeshZ); |
474 | 474 | ||
475 | return result; | 475 | return result; |
476 | } | 476 | } |
477 | 477 | ||
478 | 478 | ||
479 | public static void CalcNormals(Mesh mesh) | 479 | public static void CalcNormals(Mesh mesh) |
480 | { | 480 | { |
481 | int iTriangles = mesh.triangles.Count; | 481 | int iTriangles = mesh.triangles.Count; |
482 | 482 | ||
483 | mesh.normals = new float[iTriangles*3]; | 483 | mesh.normals = new float[iTriangles*3]; |
484 | 484 | ||
485 | int i=0; | 485 | int i=0; |
486 | foreach (Triangle t in mesh.triangles) | 486 | foreach (Triangle t in mesh.triangles) |
487 | { | 487 | { |
488 | 488 | ||
489 | float ux, uy, uz; | 489 | float ux, uy, uz; |
490 | float vx, vy, vz; | 490 | float vx, vy, vz; |
491 | float wx, wy, wz; | 491 | float wx, wy, wz; |
492 | 492 | ||
493 | ux = t.v1.point.X; | 493 | ux = t.v1.point.X; |
494 | uy = t.v1.point.Y; | 494 | uy = t.v1.point.Y; |
495 | uz = t.v1.point.Z; | 495 | uz = t.v1.point.Z; |
496 | 496 | ||
497 | vx = t.v2.point.X; | 497 | vx = t.v2.point.X; |
498 | vy = t.v2.point.Y; | 498 | vy = t.v2.point.Y; |
499 | vz = t.v2.point.Z; | 499 | vz = t.v2.point.Z; |
500 | 500 | ||
501 | wx = t.v3.point.X; | 501 | wx = t.v3.point.X; |
502 | wy = t.v3.point.Y; | 502 | wy = t.v3.point.Y; |
503 | wz = t.v3.point.Z; | 503 | wz = t.v3.point.Z; |
504 | 504 | ||
505 | // Vectors for edges | 505 | // Vectors for edges |
506 | float e1x, e1y, e1z; | 506 | float e1x, e1y, e1z; |
507 | float e2x, e2y, e2z; | 507 | float e2x, e2y, e2z; |
508 | 508 | ||
509 | e1x = ux - vx; | 509 | e1x = ux - vx; |
510 | e1y = uy - vy; | 510 | e1y = uy - vy; |
511 | e1z = uz - vz; | 511 | e1z = uz - vz; |
512 | 512 | ||
513 | e2x = ux - wx; | 513 | e2x = ux - wx; |
514 | e2y = uy - wy; | 514 | e2y = uy - wy; |
515 | e2z = uz - wz; | 515 | e2z = uz - wz; |
516 | 516 | ||
517 | 517 | ||
518 | // Cross product for normal | 518 | // Cross product for normal |
519 | float nx, ny, nz; | 519 | float nx, ny, nz; |
520 | nx = e1y * e2z - e1z * e2y; | 520 | nx = e1y * e2z - e1z * e2y; |
521 | ny = e1z * e2x - e1x * e2z; | 521 | ny = e1z * e2x - e1x * e2z; |
522 | nz = e1x * e2y - e1y * e2x; | 522 | nz = e1x * e2y - e1y * e2x; |
523 | 523 | ||
524 | // Length | 524 | // Length |
525 | float l = (float)Math.Sqrt(nx * nx + ny * ny + nz * nz); | 525 | float l = (float)Math.Sqrt(nx * nx + ny * ny + nz * nz); |
526 | 526 | ||
527 | // Normalized "normal" | 527 | // Normalized "normal" |
528 | nx /= l; | 528 | nx /= l; |
529 | ny /= l; | 529 | ny /= l; |
530 | nz /= l; | 530 | nz /= l; |
531 | 531 | ||
532 | mesh.normals[i] = nx; | 532 | mesh.normals[i] = nx; |
533 | mesh.normals[i + 1] = ny; | 533 | mesh.normals[i + 1] = ny; |
534 | mesh.normals[i + 2] = nz; | 534 | mesh.normals[i + 2] = nz; |
535 | 535 | ||
536 | i+=3; | 536 | i+=3; |
537 | } | 537 | } |
538 | } | 538 | } |
539 | 539 | ||
540 | public static Mesh CreateMesh(PrimitiveBaseShape primShape, PhysicsVector size) | 540 | public static Mesh CreateMesh(PrimitiveBaseShape primShape, PhysicsVector size) |
541 | { | 541 | { |
542 | Mesh mesh = null; | 542 | Mesh mesh = null; |
543 | 543 | ||
544 | switch (primShape.ProfileShape) | 544 | switch (primShape.ProfileShape) |
545 | { | 545 | { |
546 | case ProfileShape.Square: | 546 | case ProfileShape.Square: |
547 | mesh=CreateBoxMesh(primShape, size); | 547 | mesh=CreateBoxMesh(primShape, size); |
548 | CalcNormals(mesh); | 548 | CalcNormals(mesh); |
549 | break; | 549 | break; |
550 | default: | 550 | default: |
551 | mesh=null; | 551 | mesh=null; |
552 | break; | 552 | break; |
553 | } | 553 | } |
554 | 554 | ||
555 | return mesh; | 555 | return mesh; |
556 | 556 | ||
557 | } | 557 | } |
558 | } | 558 | } |
559 | } | 559 | } |
560 | 560 | ||
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs index caa068d..6838f47 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs | |||
@@ -760,138 +760,138 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler | |||
760 | } | 760 | } |
761 | 761 | ||
762 | public double llGetRegionTimeDilation() { return 1.0f; } | 762 | public double llGetRegionTimeDilation() { return 1.0f; } |
763 | public double llGetRegionFPS() { return 10.0f; } | 763 | public double llGetRegionFPS() { return 10.0f; } |
764 | 764 | ||
765 | /* particle system rules should be coming into this routine as doubles, that is | 765 | /* particle system rules should be coming into this routine as doubles, that is |
766 | rule[0] should be an integer from this list and rule[1] should be the arg | 766 | rule[0] should be an integer from this list and rule[1] should be the arg |
767 | for the same integer. wiki.secondlife.com has most of this mapping, but some | 767 | for the same integer. wiki.secondlife.com has most of this mapping, but some |
768 | came from http://www.caligari-designs.com/p4u2 | 768 | came from http://www.caligari-designs.com/p4u2 |
769 | 769 | ||
770 | We iterate through the list for 'Count' elements, incrementing by two for each | 770 | We iterate through the list for 'Count' elements, incrementing by two for each |
771 | iteration and set the members of Primitive.ParticleSystem, one at a time. | 771 | iteration and set the members of Primitive.ParticleSystem, one at a time. |
772 | */ | 772 | */ |
773 | public enum PrimitiveRule : int | 773 | public enum PrimitiveRule : int |
774 | { | 774 | { |
775 | PSYS_PART_FLAGS = 0, | 775 | PSYS_PART_FLAGS = 0, |
776 | PSYS_PART_START_COLOR = 1, | 776 | PSYS_PART_START_COLOR = 1, |
777 | PSYS_PART_START_ALPHA = 2, | 777 | PSYS_PART_START_ALPHA = 2, |
778 | PSYS_PART_END_COLOR = 3, | 778 | PSYS_PART_END_COLOR = 3, |
779 | PSYS_PART_END_ALPHA = 4, | 779 | PSYS_PART_END_ALPHA = 4, |
780 | PSYS_PART_START_SCALE = 5, | 780 | PSYS_PART_START_SCALE = 5, |
781 | PSYS_PART_END_SCALE = 6, | 781 | PSYS_PART_END_SCALE = 6, |
782 | PSYS_PART_MAX_AGE = 7, | 782 | PSYS_PART_MAX_AGE = 7, |
783 | PSYS_SRC_ACCEL = 8, | 783 | PSYS_SRC_ACCEL = 8, |
784 | PSYS_SRC_PATTERN = 9, | 784 | PSYS_SRC_PATTERN = 9, |
785 | PSYS_SRC_TEXTURE = 12, | 785 | PSYS_SRC_TEXTURE = 12, |
786 | PSYS_SRC_BURST_RATE = 13, | 786 | PSYS_SRC_BURST_RATE = 13, |
787 | PSYS_SRC_BURST_PART_COUNT = 15, | 787 | PSYS_SRC_BURST_PART_COUNT = 15, |
788 | PSYS_SRC_BURST_RADIUS = 16, | 788 | PSYS_SRC_BURST_RADIUS = 16, |
789 | PSYS_SRC_BURST_SPEED_MIN = 17, | 789 | PSYS_SRC_BURST_SPEED_MIN = 17, |
790 | PSYS_SRC_BURST_SPEED_MAX = 18, | 790 | PSYS_SRC_BURST_SPEED_MAX = 18, |
791 | PSYS_SRC_MAX_AGE = 19, | 791 | PSYS_SRC_MAX_AGE = 19, |
792 | PSYS_SRC_TARGET_KEY = 20, | 792 | PSYS_SRC_TARGET_KEY = 20, |
793 | PSYS_SRC_OMEGA = 21, | 793 | PSYS_SRC_OMEGA = 21, |
794 | PSYS_SRC_ANGLE_BEGIN = 22, | 794 | PSYS_SRC_ANGLE_BEGIN = 22, |
795 | PSYS_SRC_ANGLE_END = 23 | 795 | PSYS_SRC_ANGLE_END = 23 |
796 | } | 796 | } |
797 | 797 | ||
798 | public void llParticleSystem(List<Object> rules) | 798 | public void llParticleSystem(List<Object> rules) |
799 | { | 799 | { |
800 | Primitive.ParticleSystem prules = new Primitive.ParticleSystem(); | 800 | Primitive.ParticleSystem prules = new Primitive.ParticleSystem(); |
801 | for (int i = 0; i < rules.Count; i += 2) | 801 | for (int i = 0; i < rules.Count; i += 2) |
802 | { | 802 | { |
803 | switch ((int)rules[i]) | 803 | switch ((int)rules[i]) |
804 | { | 804 | { |
805 | case (int)PrimitiveRule.PSYS_PART_FLAGS: | 805 | case (int)PrimitiveRule.PSYS_PART_FLAGS: |
806 | prules.PartFlags = (uint)rules[i + 1]; | 806 | prules.PartFlags = (uint)rules[i + 1]; |
807 | break; | 807 | break; |
808 | 808 | ||
809 | case (int)PrimitiveRule.PSYS_PART_START_COLOR: | 809 | case (int)PrimitiveRule.PSYS_PART_START_COLOR: |
810 | prules.PartStartColor = (LLColor)rules[i + 1]; | 810 | prules.PartStartColor = (LLColor)rules[i + 1]; |
811 | break; | 811 | break; |
812 | 812 | ||
813 | case (int)PrimitiveRule.PSYS_PART_START_ALPHA: | 813 | case (int)PrimitiveRule.PSYS_PART_START_ALPHA: |
814 | //what is the cast? prules.PartStartColor = (LLColor)rules[i + 1]; | 814 | //what is the cast? prules.PartStartColor = (LLColor)rules[i + 1]; |
815 | break; | 815 | break; |
816 | 816 | ||
817 | case (int)PrimitiveRule.PSYS_PART_END_COLOR: | 817 | case (int)PrimitiveRule.PSYS_PART_END_COLOR: |
818 | prules.PartEndColor = (LLColor)rules[i + 1]; | 818 | prules.PartEndColor = (LLColor)rules[i + 1]; |
819 | break; | 819 | break; |
820 | 820 | ||
821 | case (int)PrimitiveRule.PSYS_PART_END_ALPHA: | 821 | case (int)PrimitiveRule.PSYS_PART_END_ALPHA: |
822 | //what is the cast? prules.PartStartColor = (LLColor)rules[i + 1]; | 822 | //what is the cast? prules.PartStartColor = (LLColor)rules[i + 1]; |
823 | break; | 823 | break; |
824 | 824 | ||
825 | case (int)PrimitiveRule.PSYS_PART_START_SCALE: | 825 | case (int)PrimitiveRule.PSYS_PART_START_SCALE: |
826 | //what is the cast? prules.PartStartColor = (LLColor)rules[i + 1]; | 826 | //what is the cast? prules.PartStartColor = (LLColor)rules[i + 1]; |
827 | break; | 827 | break; |
828 | 828 | ||
829 | case (int)PrimitiveRule.PSYS_PART_END_SCALE: | 829 | case (int)PrimitiveRule.PSYS_PART_END_SCALE: |
830 | //what is the cast? prules.PartStartColor = (LLColor)rules[i + 1]; | 830 | //what is the cast? prules.PartStartColor = (LLColor)rules[i + 1]; |
831 | break; | 831 | break; |
832 | 832 | ||
833 | case (int)PrimitiveRule.PSYS_PART_MAX_AGE: | 833 | case (int)PrimitiveRule.PSYS_PART_MAX_AGE: |
834 | prules.MaxAge = (float)rules[i + 1]; | 834 | prules.MaxAge = (float)rules[i + 1]; |
835 | break; | 835 | break; |
836 | 836 | ||
837 | case (int)PrimitiveRule.PSYS_SRC_ACCEL: | 837 | case (int)PrimitiveRule.PSYS_SRC_ACCEL: |
838 | //what is the cast? prules.PartStartColor = (LLColor)rules[i + 1]; | 838 | //what is the cast? prules.PartStartColor = (LLColor)rules[i + 1]; |
839 | break; | 839 | break; |
840 | 840 | ||
841 | case (int)PrimitiveRule.PSYS_SRC_PATTERN: | 841 | case (int)PrimitiveRule.PSYS_SRC_PATTERN: |
842 | //what is the cast? prules.PartStartColor = (LLColor)rules[i + 1]; | 842 | //what is the cast? prules.PartStartColor = (LLColor)rules[i + 1]; |
843 | break; | 843 | break; |
844 | 844 | ||
845 | case (int)PrimitiveRule.PSYS_SRC_TEXTURE: | 845 | case (int)PrimitiveRule.PSYS_SRC_TEXTURE: |
846 | prules.Texture = (LLUUID)rules[i + 1]; | 846 | prules.Texture = (LLUUID)rules[i + 1]; |
847 | break; | 847 | break; |
848 | 848 | ||
849 | case (int)PrimitiveRule.PSYS_SRC_BURST_RATE: | 849 | case (int)PrimitiveRule.PSYS_SRC_BURST_RATE: |
850 | prules.BurstRate = (float)rules[i + 1]; | 850 | prules.BurstRate = (float)rules[i + 1]; |
851 | break; | 851 | break; |
852 | 852 | ||
853 | case (int)PrimitiveRule.PSYS_SRC_BURST_PART_COUNT: | 853 | case (int)PrimitiveRule.PSYS_SRC_BURST_PART_COUNT: |
854 | prules.BurstPartCount = (byte)rules[i + 1]; | 854 | prules.BurstPartCount = (byte)rules[i + 1]; |
855 | break; | 855 | break; |
856 | 856 | ||
857 | case (int)PrimitiveRule.PSYS_SRC_BURST_RADIUS: | 857 | case (int)PrimitiveRule.PSYS_SRC_BURST_RADIUS: |
858 | prules.BurstRadius = (float)rules[i + 1]; | 858 | prules.BurstRadius = (float)rules[i + 1]; |
859 | break; | 859 | break; |
860 | 860 | ||
861 | case (int)PrimitiveRule.PSYS_SRC_BURST_SPEED_MIN: | 861 | case (int)PrimitiveRule.PSYS_SRC_BURST_SPEED_MIN: |
862 | prules.BurstSpeedMin = (float)rules[i + 1]; | 862 | prules.BurstSpeedMin = (float)rules[i + 1]; |
863 | break; | 863 | break; |
864 | 864 | ||
865 | case (int)PrimitiveRule.PSYS_SRC_BURST_SPEED_MAX: | 865 | case (int)PrimitiveRule.PSYS_SRC_BURST_SPEED_MAX: |
866 | prules.BurstSpeedMax = (float)rules[i + 1]; | 866 | prules.BurstSpeedMax = (float)rules[i + 1]; |
867 | break; | 867 | break; |
868 | 868 | ||
869 | case (int)PrimitiveRule.PSYS_SRC_MAX_AGE: | 869 | case (int)PrimitiveRule.PSYS_SRC_MAX_AGE: |
870 | prules.MaxAge = (float)rules[i + 1]; | 870 | prules.MaxAge = (float)rules[i + 1]; |
871 | break; | 871 | break; |
872 | 872 | ||
873 | case (int)PrimitiveRule.PSYS_SRC_TARGET_KEY: | 873 | case (int)PrimitiveRule.PSYS_SRC_TARGET_KEY: |
874 | prules.Target = (LLUUID)rules[i + 1]; | 874 | prules.Target = (LLUUID)rules[i + 1]; |
875 | break; | 875 | break; |
876 | 876 | ||
877 | case (int)PrimitiveRule.PSYS_SRC_OMEGA: | 877 | case (int)PrimitiveRule.PSYS_SRC_OMEGA: |
878 | //cast?? prules.MaxAge = (float)rules[i + 1]; | 878 | //cast?? prules.MaxAge = (float)rules[i + 1]; |
879 | break; | 879 | break; |
880 | 880 | ||
881 | case (int)PrimitiveRule.PSYS_SRC_ANGLE_BEGIN: | 881 | case (int)PrimitiveRule.PSYS_SRC_ANGLE_BEGIN: |
882 | prules.InnerAngle = (float)rules[i + 1]; | 882 | prules.InnerAngle = (float)rules[i + 1]; |
883 | break; | 883 | break; |
884 | 884 | ||
885 | case (int)PrimitiveRule.PSYS_SRC_ANGLE_END: | 885 | case (int)PrimitiveRule.PSYS_SRC_ANGLE_END: |
886 | prules.OuterAngle = (float)rules[i + 1]; | 886 | prules.OuterAngle = (float)rules[i + 1]; |
887 | break; | 887 | break; |
888 | 888 | ||
889 | } | 889 | } |
890 | } | 890 | } |
891 | 891 | ||
892 | m_host.AddNewParticleSystem(prules); | 892 | m_host.AddNewParticleSystem(prules); |
893 | } | 893 | } |
894 | 894 | ||
895 | public void llGroundRepel(double height, int water, double tau) { NotImplemented("llGroundRepel"); } | 895 | public void llGroundRepel(double height, int water, double tau) { NotImplemented("llGroundRepel"); } |
896 | public void llGiveInventoryList() { NotImplemented("llGiveInventoryList"); } | 896 | public void llGiveInventoryList() { NotImplemented("llGiveInventoryList"); } |
897 | public void llSetVehicleType(int type) { NotImplemented("llSetVehicleType"); } | 897 | public void llSetVehicleType(int type) { NotImplemented("llSetVehicleType"); } |
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs index 197eb72..381fd8c 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs | |||
@@ -285,7 +285,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
285 | before = GC.GetTotalMemory(true); | 285 | before = GC.GetTotalMemory(true); |
286 | #endif | 286 | #endif |
287 | 287 | ||
288 | LSL_BaseClass CompiledScript; | 288 | LSL_BaseClass CompiledScript; |
289 | CompiledScript = m_scriptEngine.m_AppDomainManager.LoadScript(ScriptSource); | 289 | CompiledScript = m_scriptEngine.m_AppDomainManager.LoadScript(ScriptSource); |
290 | 290 | ||
291 | #if DEBUG | 291 | #if DEBUG |