aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/XEngine/ExecutorBase.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ScriptEngine/XEngine/ExecutorBase.cs')
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/ExecutorBase.cs183
1 files changed, 0 insertions, 183 deletions
diff --git a/OpenSim/Region/ScriptEngine/XEngine/ExecutorBase.cs b/OpenSim/Region/ScriptEngine/XEngine/ExecutorBase.cs
deleted file mode 100644
index 79c3cc9..0000000
--- a/OpenSim/Region/ScriptEngine/XEngine/ExecutorBase.cs
+++ /dev/null
@@ -1,183 +0,0 @@
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.Runtime.Remoting.Lifetime;
31using OpenSim.Region.ScriptEngine.Shared;
32using OpenSim.Region.ScriptEngine.Shared.ScriptBase;
33using OpenSim.Region.ScriptEngine.Interfaces;
34
35namespace OpenSim.Region.ScriptEngine.XEngine
36{
37 public abstract class ExecutorBase : MarshalByRefObject
38 {
39 /// <summary>
40 /// Contains the script to execute functions in.
41 /// </summary>
42 protected IScript m_Script;
43
44 protected Dictionary<string, scriptEvents> m_eventFlagsMap = new Dictionary<string, scriptEvents>();
45
46 [Flags]
47 public enum scriptEvents : int
48 {
49 None = 0,
50 attach = 1,
51 collision = 16,
52 collision_end = 32,
53 collision_start = 64,
54 control = 128,
55 dataserver = 256,
56 email = 512,
57 http_response = 1024,
58 land_collision = 2048,
59 land_collision_end = 4096,
60 land_collision_start = 8192,
61 at_target = 16384,
62 listen = 32768,
63 money = 65536,
64 moving_end = 131072,
65 moving_start = 262144,
66 not_at_rot_target = 524288,
67 not_at_target = 1048576,
68 remote_data = 8388608,
69 run_time_permissions = 268435456,
70 state_entry = 1073741824,
71 state_exit = 2,
72 timer = 4,
73 touch = 8,
74 touch_end = 536870912,
75 touch_start = 2097152,
76 object_rez = 4194304
77 }
78
79 /// <summary>
80 /// Create a new instance of ExecutorBase
81 /// </summary>
82 /// <param name="Script"></param>
83 public ExecutorBase(IScript Script)
84 {
85 m_Script = Script;
86 initEventFlags();
87 }
88
89 /// <summary>
90 /// Make sure our object does not timeout when in AppDomain. (Called by ILease base class)
91 /// </summary>
92 /// <returns></returns>
93 public override Object InitializeLifetimeService()
94 {
95 //Console.WriteLine("Executor: InitializeLifetimeService()");
96 // return null;
97 ILease lease = (ILease)base.InitializeLifetimeService();
98
99 if (lease.CurrentState == LeaseState.Initial)
100 {
101 lease.InitialLeaseTime = TimeSpan.Zero; // TimeSpan.FromMinutes(1);
102 // lease.SponsorshipTimeout = TimeSpan.FromMinutes(2);
103 // lease.RenewOnCallTime = TimeSpan.FromSeconds(2);
104 }
105 return lease;
106 }
107
108 /// <summary>
109 /// Get current AppDomain
110 /// </summary>
111 /// <returns>Current AppDomain</returns>
112 public AppDomain GetAppDomain()
113 {
114 return AppDomain.CurrentDomain;
115 }
116
117 /// <summary>
118 /// Execute a specific function/event in script.
119 /// </summary>
120 /// <param name="FunctionName">Name of function to execute</param>
121 /// <param name="args">Arguments to pass to function</param>
122 public void ExecuteEvent(string state, string FunctionName, object[] args)
123 {
124 DoExecuteEvent(state, FunctionName, args);
125 }
126
127 protected abstract void DoExecuteEvent(string state, string FunctionName, object[] args);
128
129 /// <summary>
130 /// Compute the events handled by the current state of the script
131 /// </summary>
132 /// <returns>state mask</returns>
133 public scriptEvents GetStateEventFlags(string state)
134 {
135 return DoGetStateEventFlags(state);
136 }
137
138 protected abstract scriptEvents DoGetStateEventFlags(string state);
139
140 protected void initEventFlags()
141 {
142 // Initialize the table if it hasn't already been done
143 if (m_eventFlagsMap.Count > 0)
144 {
145 return;
146 }
147
148 m_eventFlagsMap.Add("attach", scriptEvents.attach);
149 // m_eventFlagsMap.Add("at_rot_target",(long)scriptEvents.at_rot_target);
150 m_eventFlagsMap.Add("at_target", scriptEvents.at_target);
151 // m_eventFlagsMap.Add("changed",(long)scriptEvents.changed);
152 m_eventFlagsMap.Add("collision", scriptEvents.collision);
153 m_eventFlagsMap.Add("collision_end", scriptEvents.collision_end);
154 m_eventFlagsMap.Add("collision_start", scriptEvents.collision_start);
155 m_eventFlagsMap.Add("control", scriptEvents.control);
156 m_eventFlagsMap.Add("dataserver", scriptEvents.dataserver);
157 m_eventFlagsMap.Add("email", scriptEvents.email);
158 m_eventFlagsMap.Add("http_response", scriptEvents.http_response);
159 m_eventFlagsMap.Add("land_collision", scriptEvents.land_collision);
160 m_eventFlagsMap.Add("land_collision_end", scriptEvents.land_collision_end);
161 m_eventFlagsMap.Add("land_collision_start", scriptEvents.land_collision_start);
162 // m_eventFlagsMap.Add("link_message",scriptEvents.link_message);
163 m_eventFlagsMap.Add("listen", scriptEvents.listen);
164 m_eventFlagsMap.Add("money", scriptEvents.money);
165 m_eventFlagsMap.Add("moving_end", scriptEvents.moving_end);
166 m_eventFlagsMap.Add("moving_start", scriptEvents.moving_start);
167 m_eventFlagsMap.Add("not_at_rot_target", scriptEvents.not_at_rot_target);
168 m_eventFlagsMap.Add("not_at_target", scriptEvents.not_at_target);
169 // m_eventFlagsMap.Add("no_sensor",(long)scriptEvents.no_sensor);
170 // m_eventFlagsMap.Add("on_rez",(long)scriptEvents.on_rez);
171 m_eventFlagsMap.Add("remote_data", scriptEvents.remote_data);
172 m_eventFlagsMap.Add("run_time_permissions", scriptEvents.run_time_permissions);
173 // m_eventFlagsMap.Add("sensor",(long)scriptEvents.sensor);
174 m_eventFlagsMap.Add("state_entry", scriptEvents.state_entry);
175 m_eventFlagsMap.Add("state_exit", scriptEvents.state_exit);
176 m_eventFlagsMap.Add("timer", scriptEvents.timer);
177 m_eventFlagsMap.Add("touch", scriptEvents.touch);
178 m_eventFlagsMap.Add("touch_end", scriptEvents.touch_end);
179 m_eventFlagsMap.Add("touch_start", scriptEvents.touch_start);
180 m_eventFlagsMap.Add("object_rez", scriptEvents.object_rez);
181 }
182 }
183}