aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs
diff options
context:
space:
mode:
authormingchen2008-05-07 18:06:55 +0000
committermingchen2008-05-07 18:06:55 +0000
commit1b2415325ae9cc5a6de576a7e8aad10974bf62db (patch)
treee845a4c3041c8177229daafdda6e10e09f879f74 /OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs
parentif we are aborting the client loop we should tell someone (diff)
downloadopensim-SC_OLD-1b2415325ae9cc5a6de576a7e8aad10974bf62db.zip
opensim-SC_OLD-1b2415325ae9cc5a6de576a7e8aad10974bf62db.tar.gz
opensim-SC_OLD-1b2415325ae9cc5a6de576a7e8aad10974bf62db.tar.bz2
opensim-SC_OLD-1b2415325ae9cc5a6de576a7e8aad10974bf62db.tar.xz
*Fixed Missing SceneExternalChecks.cs
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs')
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs104
1 files changed, 104 insertions, 0 deletions
diff --git a/OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs b/OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs
new file mode 100644
index 0000000..2d3e8e4
--- /dev/null
+++ b/OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs
@@ -0,0 +1,104 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
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
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
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.Text;
31using libsecondlife;
32using OpenSim.Framework;
33
34namespace OpenSim.Region.Environment.Scenes
35{
36 public class SceneExternalChecks
37 {
38 private Scene m_scene;
39
40 public SceneExternalChecks(Scene scene)
41 {
42 m_scene = scene;
43 }
44
45 #region REZ OBJECT
46 public delegate bool CanRezObject(int objectCount, LLUUID owner, IScene scene, LLVector3 objectPosition);
47 private List<CanRezObject> CanRezObjectCheckFunctions = new List<CanRezObject>();
48
49 public void addCheckRezObject(CanRezObject delegateFunc)
50 {
51 if(!CanRezObjectCheckFunctions.Contains(delegateFunc))
52 CanRezObjectCheckFunctions.Add(delegateFunc);
53 }
54 public void removeCheckRezObject(CanRezObject delegateFunc)
55 {
56 if (CanRezObjectCheckFunctions.Contains(delegateFunc))
57 CanRezObjectCheckFunctions.Remove(delegateFunc);
58 }
59
60 public bool ExternalChecksCanRezObject(int objectCount, LLUUID owner, LLVector3 objectPosition)
61 {
62 foreach (CanRezObject check in CanRezObjectCheckFunctions)
63 {
64 if (check(objectCount, owner, m_scene, objectPosition) == false)
65 {
66 return false;
67 }
68 }
69 return true;
70 }
71
72 #endregion
73
74 #region RUN SCRIPT
75 public delegate bool CanRunScript(LLUUID script, LLUUID owner, IScene scene);
76 private List<CanRunScript> CanRunScriptCheckFunctions = new List<CanRunScript>();
77
78 public void addCheckRunScript(CanRunScript delegateFunc)
79 {
80 if (!CanRunScriptCheckFunctions.Contains(delegateFunc))
81 CanRunScriptCheckFunctions.Add(delegateFunc);
82 }
83 public void removeCheckRunScript(CanRunScript delegateFunc)
84 {
85 if (CanRunScriptCheckFunctions.Contains(delegateFunc))
86 CanRunScriptCheckFunctions.Remove(delegateFunc);
87 }
88
89 public bool ExternalChecksCanRunScript(LLUUID script, LLUUID owner)
90 {
91 foreach (CanRunScript check in CanRunScriptCheckFunctions)
92 {
93 if (check(script,owner,m_scene) == false)
94 {
95 return false;
96 }
97 }
98 return true;
99 }
100
101 #endregion
102
103 }
104}