29 using System.Collections.Generic;
31 using System.Reflection;
33 using System.Text.RegularExpressions;
39 using OpenSim.Framework;
40 using OpenSim.Framework.Console;
41 using OpenSim.Region.Framework.Interfaces;
42 using OpenSim.Region.Framework.Scenes;
49 [Extension(Path =
"/OpenSim/RegionModules", NodeName =
"RegionModule", Id =
"AnimationsCommandModule")]
54 private Scene m_scene;
56 public string Name {
get {
return "SitStand Command Module"; } }
58 public Type ReplaceableInterface {
get {
return null; } }
92 "Users",
this,
"sit user name",
93 "sit user name [--regex] <first-name> <last-name>",
94 "Sit the named user on an unoccupied object with a sit target.",
95 "If there are no such objects then nothing happens.\n"
96 +
"If --regex is specified then the names are treated as regular expressions.",
97 HandleSitUserNameCommand);
100 "Users",
this,
"stand user name",
101 "stand user name [--regex] <first-name> <last-name>",
102 "Stand the named user.",
103 "If --regex is specified then the names are treated as regular expressions.",
104 HandleStandUserNameCommand);
107 private void HandleSitUserNameCommand(
string module,
string[] cmd)
114 MainConsole.Instance.Output(
"Usage: sit user name [--regex] <first-name> <last-name>");
118 List<ScenePresence> scenePresences = GetScenePresences(cmd);
126 List<SceneObjectGroup> sceneObjects = m_scene.GetSceneObjectGroups();
145 MainConsole.Instance.OutputFormat(
146 "Sitting {0} on {1} {2} in {3}",
147 sp.Name, sitPart.ParentGroup.Name, sitPart.ParentGroup.UUID, m_scene.Name);
149 sp.HandleAgentRequestSit(sp.ControllingClient, sp.UUID, sitPart.UUID, Vector3.Zero);
150 sp.HandleAgentSit(sp.ControllingClient, sp.UUID);
154 MainConsole.Instance.OutputFormat(
155 "Could not find any unoccupied set seat on which to sit {0} in {1}. Aborting",
156 sp.Name, m_scene.Name);
163 private void HandleStandUserNameCommand(
string module,
string[] cmd)
170 MainConsole.Instance.Output(
"Usage: stand user name [--regex] <first-name> <last-name>");
174 List<ScenePresence> scenePresences = GetScenePresences(cmd);
180 MainConsole.Instance.OutputFormat(
"Standing {0} in {1}", sp.Name, m_scene.Name);
186 private List<ScenePresence> GetScenePresences(
string[] cmdParams)
188 bool useRegex =
false;
189 OptionSet
options =
new OptionSet().Add(
"regex", v=> useRegex = v != null );
191 List<string> mainParams = options.Parse(cmdParams);
193 string firstName = mainParams[3];
194 string lastName = mainParams[4];
196 List<ScenePresence> scenePresencesMatched =
new List<ScenePresence>();
200 Regex nameRegex =
new Regex(
string.Format(
"{0} {1}", firstName, lastName));
201 List<ScenePresence> scenePresences = m_scene.GetScenePresences();
206 scenePresencesMatched.Add(sp);
211 ScenePresence sp = m_scene.GetScenePresence(firstName, lastName);
214 scenePresencesMatched.Add(sp);
217 return scenePresencesMatched;
UUID SitTargetAvatar
ID of the avatar that is sat on us if we have a sit target. If there is no such avatar then is UUID...
void Initialise(IConfigSource source)
This is called to initialize the region module. For shared modules, this is called exactly once...
A scene object group is conceptually an object in the scene. The object is constituted of SceneObject...
A module that just holds commands for changing avatar sitting and standing states.
bool SitGround
Are we sitting on the ground?
void RegionLoaded(Scene scene)
This will be called once for every scene loaded. In a shared module this will be multiple times in on...
static ICommandConsole Instance
Interactive OpenSim region server
bool IsSatOnObject
Are we sitting on an object?
bool IsSitTargetSet
Is an explicit sit target set for this part?
void AddRegion(Scene scene)
This is called whenever a Scene is added. For shared modules, this can happen several times...
virtual string Name
The name of this entity
void Close()
This is the inverse to Initialise. After a Close(), this instance won't be usable anymore...
void RemoveRegion(Scene scene)
This is called whenever a Scene is removed. For shared modules, this can happen several times...
bool IsAttachment
Is this scene object acting as an attachment?