aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorMelanie2011-04-08 03:50:27 +0200
committerMelanie2011-04-08 03:50:27 +0200
commit33dd74e410bcd95364d8029a3f2a21b522c9f9d2 (patch)
tree06d8a6e482ad1dd464a8f4cd292275a9878f133d
parentMerge branch 'master' into careminster-presence-refactor (diff)
downloadopensim-SC_OLD-33dd74e410bcd95364d8029a3f2a21b522c9f9d2.zip
opensim-SC_OLD-33dd74e410bcd95364d8029a3f2a21b522c9f9d2.tar.gz
opensim-SC_OLD-33dd74e410bcd95364d8029a3f2a21b522c9f9d2.tar.bz2
opensim-SC_OLD-33dd74e410bcd95364d8029a3f2a21b522c9f9d2.tar.xz
Add support for the new display name related functions in LSL. This does not
implement the display names functionality as such, but it allows scripts that are display name aware to function as if the display name were implemented and set to the avatar name.
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs1
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs12
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs49
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs26
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs4
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs20
7 files changed, 103 insertions, 11 deletions
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
index fae4f90..9905a53 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
@@ -1264,7 +1264,6 @@ namespace OpenSim.Region.CoreModules.World.Land
1264 { 1264 {
1265 land.DeedToGroup(groupID); 1265 land.DeedToGroup(groupID);
1266 } 1266 }
1267 EventManagerOnParcelPrimCountTainted();
1268 } 1267 }
1269 1268
1270 #region Land Object From Storage Functions 1269 #region Land Object From Storage Functions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 2e82e1f..0e3cffb 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -1337,12 +1337,12 @@ namespace OpenSim.Region.Framework.Scenes
1337 terrainMS = Util.EnvironmentTickCountSubtract(terMS); 1337 terrainMS = Util.EnvironmentTickCountSubtract(terMS);
1338 } 1338 }
1339 1339
1340 if (Frame % m_update_land == 0) 1340 // if (Frame % m_update_land == 0)
1341 { 1341 // {
1342 int ldMS = Util.EnvironmentTickCount(); 1342 // int ldMS = Util.EnvironmentTickCount();
1343 UpdateLand(); 1343 // UpdateLand();
1344 landMS = Util.EnvironmentTickCountSubtract(ldMS); 1344 // landMS = Util.EnvironmentTickCountSubtract(ldMS);
1345 } 1345 // }
1346 1346
1347 frameMS = Util.EnvironmentTickCountSubtract(tmpFrameMS); 1347 frameMS = Util.EnvironmentTickCountSubtract(tmpFrameMS);
1348 otherMS = tempOnRezMS + eventMS + backupMS + terrainMS + landMS; 1348 otherMS = tempOnRezMS + eventMS + backupMS + terrainMS + landMS;
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index c0b490a..8ceb814 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -10909,6 +10909,55 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10909 10909
10910 return GetNumberOfSides(parts[0]); 10910 return GetNumberOfSides(parts[0]);
10911 } 10911 }
10912
10913 private string Name2Username(string name)
10914 {
10915 string[] parts = name.Split(new char[] {' '});
10916 if (parts.Length < 2)
10917 return name.ToLower();
10918 if (parts[1] == "Resident")
10919 return parts[0].ToLower();
10920
10921 return name.Replace(" ", ".").ToLower();
10922 }
10923
10924 public LSL_String llGetUsername(string id)
10925 {
10926 return Name2Username(llKey2Name(id));
10927 }
10928
10929 public LSL_String llRequestUsername(string id)
10930 {
10931 UUID rq = UUID.Random();
10932
10933 UUID tid = AsyncCommands.
10934 DataserverPlugin.RegisterRequest(m_localID,
10935 m_itemID, rq.ToString());
10936
10937 AsyncCommands.
10938 DataserverPlugin.DataserverReply(rq.ToString(), Name2Username(llKey2Name(id)));
10939
10940 return rq.ToString();
10941 }
10942
10943 public LSL_String llGetDisplayName(string id)
10944 {
10945 return llKey2Name(id);
10946 }
10947
10948 public LSL_String llRequestDisplayName(string id)
10949 {
10950 UUID rq = UUID.Random();
10951
10952 UUID tid = AsyncCommands.
10953 DataserverPlugin.RegisterRequest(m_localID,
10954 m_itemID, rq.ToString());
10955
10956 AsyncCommands.
10957 DataserverPlugin.DataserverReply(rq.ToString(), llKey2Name(id));
10958
10959 return rq.ToString();
10960 }
10912 } 10961 }
10913 10962
10914 public class NotecardCache 10963 public class NotecardCache
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
index c4f90d2..3afedc7 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
@@ -50,6 +50,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
50 private Object SenseLock = new Object(); 50 private Object SenseLock = new Object();
51 51
52 private const int AGENT = 1; 52 private const int AGENT = 1;
53 private const int AGENT_BY_USERNAME = 0x10;
53 private const int ACTIVE = 2; 54 private const int ACTIVE = 2;
54 private const int PASSIVE = 4; 55 private const int PASSIVE = 4;
55 private const int SCRIPTED = 8; 56 private const int SCRIPTED = 8;
@@ -202,7 +203,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
202 List<SensedEntity> sensedEntities = new List<SensedEntity>(); 203 List<SensedEntity> sensedEntities = new List<SensedEntity>();
203 204
204 // Is the sensor type is AGENT and not SCRIPTED then include agents 205 // Is the sensor type is AGENT and not SCRIPTED then include agents
205 if ((ts.type & AGENT) != 0 && (ts.type & SCRIPTED) == 0) 206 if ((ts.type & (AGENT | AGENT_BY_USERNAME)) != 0 && (ts.type & SCRIPTED) == 0)
206 { 207 {
207 sensedEntities.AddRange(doAgentSensor(ts)); 208 sensedEntities.AddRange(doAgentSensor(ts));
208 } 209 }
@@ -505,9 +506,26 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
505 { 506 {
506 ScenePresence sp; 507 ScenePresence sp;
507 // Try lookup by name will return if/when found 508 // Try lookup by name will return if/when found
508 if (!m_CmdManager.m_ScriptEngine.World.TryGetAvatarByName(ts.name, out sp)) 509 if (((ts.type & AGENT) != 0) && m_CmdManager.m_ScriptEngine.World.TryGetAvatarByName(ts.name, out sp))
509 return sensedEntities; 510 senseEntity(sp);
510 senseEntity(sp); 511 if ((ts.type & AGENT_BY_USERNAME) != 0)
512 {
513 m_CmdManager.m_ScriptEngine.World.ForEachScenePresence(
514 delegate (ScenePresence ssp)
515 {
516 if (ssp.Lastname == "Resident")
517 {
518 if (ssp.Firstname.ToLower() == ts.name)
519 senseEntity(ssp);
520 return;
521 }
522 if (ssp.Name.Replace(" ", ".").ToLower() == ts.name)
523 senseEntity(ssp);
524 }
525 );
526 }
527
528 return sensedEntities;
511 } 529 }
512 else 530 else
513 { 531 {
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs
index bae7d4b..0ae2388 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs
@@ -209,6 +209,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
209 void llInstantMessage(string user, string message); 209 void llInstantMessage(string user, string message);
210 LSL_String llIntegerToBase64(int number); 210 LSL_String llIntegerToBase64(int number);
211 LSL_String llKey2Name(string id); 211 LSL_String llKey2Name(string id);
212 LSL_String llGetUsername(string id);
213 LSL_String llRequestUsername(string id);
214 LSL_String llGetDisplayName(string id);
215 LSL_String llRequestDisplayName(string id);
212 void llLinkParticleSystem(int linknum, LSL_List rules); 216 void llLinkParticleSystem(int linknum, LSL_List rules);
213 LSL_String llList2CSV(LSL_List src); 217 LSL_String llList2CSV(LSL_List src);
214 LSL_Float llList2Float(LSL_List src, int index); 218 LSL_Float llList2Float(LSL_List src, int index);
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
index c31e5d3..5f94ff5 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
@@ -50,6 +50,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
50 public const int STATUS_CAST_SHADOWS = 512; 50 public const int STATUS_CAST_SHADOWS = 512;
51 51
52 public const int AGENT = 1; 52 public const int AGENT = 1;
53 public const int AGENT_BY_LEGACY_NAME = 1;
54 public const int AGENT_BY_USERNAME = 0x10;
53 public const int ACTIVE = 2; 55 public const int ACTIVE = 2;
54 public const int PASSIVE = 4; 56 public const int PASSIVE = 4;
55 public const int SCRIPTED = 8; 57 public const int SCRIPTED = 8;
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs
index 7c26824..63cac9a 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs
@@ -896,6 +896,26 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
896 return m_LSL_Functions.llKey2Name(id); 896 return m_LSL_Functions.llKey2Name(id);
897 } 897 }
898 898
899 public LSL_String llGetUsername(string id)
900 {
901 return m_LSL_Functions.llGetUsername(id);
902 }
903
904 public LSL_String llRequestUsername(string id)
905 {
906 return m_LSL_Functions.llRequestUsername(id);
907 }
908
909 public LSL_String llGetDisplayName(string id)
910 {
911 return m_LSL_Functions.llGetDisplayName(id);
912 }
913
914 public LSL_String llRequestDisplayName(string id)
915 {
916 return m_LSL_Functions.llRequestDisplayName(id);
917 }
918
899 public void llLinkParticleSystem(int linknum, LSL_List rules) 919 public void llLinkParticleSystem(int linknum, LSL_List rules)
900 { 920 {
901 m_LSL_Functions.llLinkParticleSystem(linknum, rules); 921 m_LSL_Functions.llLinkParticleSystem(linknum, rules);