diff options
author | Teravus Ovares | 2008-02-05 05:26:18 +0000 |
---|---|---|
committer | Teravus Ovares | 2008-02-05 05:26:18 +0000 |
commit | ca5aadfbff63e03b7ca081e753204d8da040c9bb (patch) | |
tree | e2d19e01678c27cff57bc26257cec7385c3df274 /OpenSim/Region/Environment/Scenes | |
parent | Added copyright statements. (diff) | |
download | opensim-SC_OLD-ca5aadfbff63e03b7ca081e753204d8da040c9bb.zip opensim-SC_OLD-ca5aadfbff63e03b7ca081e753204d8da040c9bb.tar.gz opensim-SC_OLD-ca5aadfbff63e03b7ca081e753204d8da040c9bb.tar.bz2 opensim-SC_OLD-ca5aadfbff63e03b7ca081e753204d8da040c9bb.tar.xz |
* Refactored the sound calls to SceneObjectPart
* Fixed a few bugs
* Wrote an example module to make certain event systems more mature.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneEvents.cs | 12 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | 78 |
3 files changed, 92 insertions, 0 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 89fd5ea..a80426b 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -1315,6 +1315,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
1315 | avatar.AbsolutePosition.Z); | 1315 | avatar.AbsolutePosition.Z); |
1316 | m_sceneGridService.SendCloseChildAgentConnections(avatar); | 1316 | m_sceneGridService.SendCloseChildAgentConnections(avatar); |
1317 | } | 1317 | } |
1318 | |||
1319 | m_eventManager.TriggerClientClosed(agentID); | ||
1318 | } | 1320 | } |
1319 | catch (NullReferenceException) | 1321 | catch (NullReferenceException) |
1320 | { | 1322 | { |
diff --git a/OpenSim/Region/Environment/Scenes/SceneEvents.cs b/OpenSim/Region/Environment/Scenes/SceneEvents.cs index 51d1b32..cada991 100644 --- a/OpenSim/Region/Environment/Scenes/SceneEvents.cs +++ b/OpenSim/Region/Environment/Scenes/SceneEvents.cs | |||
@@ -125,6 +125,10 @@ namespace OpenSim.Region.Environment.Scenes | |||
125 | 125 | ||
126 | public event NewGridInstantMessage OnGridInstantMessageToGroupsModule; | 126 | public event NewGridInstantMessage OnGridInstantMessageToGroupsModule; |
127 | 127 | ||
128 | public delegate void ClientClosed(LLUUID clientID); | ||
129 | |||
130 | public event ClientClosed OnClientClosed; | ||
131 | |||
128 | public delegate void ScriptChangedEvent(uint localID, uint change); | 132 | public delegate void ScriptChangedEvent(uint localID, uint change); |
129 | 133 | ||
130 | public event ScriptChangedEvent OnScriptChangedEvent; | 134 | public event ScriptChangedEvent OnScriptChangedEvent; |
@@ -338,6 +342,14 @@ namespace OpenSim.Region.Environment.Scenes | |||
338 | 342 | ||
339 | } | 343 | } |
340 | } | 344 | } |
345 | |||
346 | public void TriggerClientClosed(LLUUID ClientID) | ||
347 | { | ||
348 | if (OnClientClosed != null) | ||
349 | { | ||
350 | OnClientClosed(ClientID); | ||
351 | } | ||
352 | } | ||
341 | 353 | ||
342 | } | 354 | } |
343 | } \ No newline at end of file | 355 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs index 159eaf1..0ba64f2 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | |||
@@ -1457,6 +1457,84 @@ namespace OpenSim.Region.Environment.Scenes | |||
1457 | 1457 | ||
1458 | #endregion | 1458 | #endregion |
1459 | 1459 | ||
1460 | #region Sound | ||
1461 | public void PreloadSound(string sound) | ||
1462 | { | ||
1463 | LLUUID ownerID = OwnerID; | ||
1464 | LLUUID objectID = UUID; | ||
1465 | LLUUID soundID = LLUUID.Zero; | ||
1466 | |||
1467 | if (!LLUUID.TryParse(sound, out soundID)) | ||
1468 | { | ||
1469 | //Trys to fetch sound id from prim's inventory. | ||
1470 | //Prim's inventory doesn't support non script items yet | ||
1471 | SceneObjectPart op = this; | ||
1472 | foreach (KeyValuePair<LLUUID, TaskInventoryItem> item in op.TaskInventory) | ||
1473 | { | ||
1474 | if (item.Value.Name == sound) | ||
1475 | { | ||
1476 | soundID = item.Value.ItemID; | ||
1477 | break; | ||
1478 | } | ||
1479 | } | ||
1480 | } | ||
1481 | |||
1482 | List<ScenePresence> avatarts = m_parentGroup.Scene.GetAvatars(); | ||
1483 | foreach (ScenePresence p in avatarts) | ||
1484 | { | ||
1485 | // TODO: some filtering by distance of avatar | ||
1486 | |||
1487 | p.ControllingClient.SendPreLoadSound(objectID, objectID, soundID); | ||
1488 | } | ||
1489 | } | ||
1490 | |||
1491 | public void SendSound(string sound, double volume, bool triggered) | ||
1492 | { | ||
1493 | if (volume > 1) | ||
1494 | volume = 1; | ||
1495 | if (volume < 0) | ||
1496 | volume = 0; | ||
1497 | |||
1498 | LLUUID ownerID = OwnerID; | ||
1499 | LLUUID objectID = UUID; | ||
1500 | LLUUID parentID = GetRootPartUUID(); | ||
1501 | LLUUID soundID = LLUUID.Zero; | ||
1502 | LLVector3 position = AbsolutePosition; // region local | ||
1503 | ulong regionHandle = m_parentGroup.Scene.RegionInfo.RegionHandle; | ||
1504 | |||
1505 | byte flags = 0; | ||
1506 | |||
1507 | if (!LLUUID.TryParse(sound, out soundID)) | ||
1508 | { | ||
1509 | // search sound file from inventory | ||
1510 | SceneObjectPart op = this; | ||
1511 | foreach (KeyValuePair<LLUUID, TaskInventoryItem> item in op.TaskInventory) | ||
1512 | { | ||
1513 | if (item.Value.Name == sound) | ||
1514 | { | ||
1515 | soundID = item.Value.ItemID; | ||
1516 | break; | ||
1517 | } | ||
1518 | } | ||
1519 | } | ||
1520 | |||
1521 | List<ScenePresence> avatarts = m_parentGroup.Scene.GetAvatars(); | ||
1522 | foreach (ScenePresence p in avatarts) | ||
1523 | { | ||
1524 | // TODO: some filtering by distance of avatar | ||
1525 | if (triggered) | ||
1526 | { | ||
1527 | p.ControllingClient.SendTriggeredSound(soundID, ownerID, objectID, parentID, regionHandle, position, (float)volume); | ||
1528 | } | ||
1529 | else | ||
1530 | { | ||
1531 | p.ControllingClient.SendPlayAttachedSound(soundID, objectID, ownerID, (float)volume, flags); | ||
1532 | } | ||
1533 | } | ||
1534 | } | ||
1535 | |||
1536 | #endregion | ||
1537 | |||
1460 | #region Resizing/Scale | 1538 | #region Resizing/Scale |
1461 | 1539 | ||
1462 | /// <summary> | 1540 | /// <summary> |