diff options
author | Teravus Ovares | 2008-05-06 02:47:14 +0000 |
---|---|---|
committer | Teravus Ovares | 2008-05-06 02:47:14 +0000 |
commit | add13276a98e572bf4f83e79cfe1fa4d3f4411df (patch) | |
tree | 063b5b062eae428b635ce12ccbd7c46fcf63a5bc /OpenSim/Region/Environment/Scenes | |
parent | * If you llApplyImpulse on an attachment, it applies impulse on the avatar, n... (diff) | |
download | opensim-SC-add13276a98e572bf4f83e79cfe1fa4d3f4411df.zip opensim-SC-add13276a98e572bf4f83e79cfe1fa4d3f4411df.tar.gz opensim-SC-add13276a98e572bf4f83e79cfe1fa4d3f4411df.tar.bz2 opensim-SC-add13276a98e572bf4f83e79cfe1fa4d3f4411df.tar.xz |
* Committing a bunch of work for control snatching. Not done yet. No visible features.
Diffstat (limited to 'OpenSim/Region/Environment/Scenes')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/ScenePresence.cs | 125 |
1 files changed, 125 insertions, 0 deletions
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index aefecd0..2e6fe3d 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs | |||
@@ -40,6 +40,29 @@ using OpenSim.Region.Physics.Manager; | |||
40 | 40 | ||
41 | namespace OpenSim.Region.Environment.Scenes | 41 | namespace OpenSim.Region.Environment.Scenes |
42 | { | 42 | { |
43 | enum ScriptControlled : int | ||
44 | { | ||
45 | CONTROL_ZERO = 0, | ||
46 | CONTROL_FWD = 1, | ||
47 | CONTROL_BACK = 2, | ||
48 | CONTROL_LEFT = 4, | ||
49 | CONTROL_RIGHT = 8, | ||
50 | CONTROL_UP = 16, | ||
51 | CONTROL_DOWN = 32, | ||
52 | CONTROL_ROT_LEFT = 256, | ||
53 | CONTROL_ROT_RIGHT = 512, | ||
54 | CONTROL_LBUTTON = 268435456, | ||
55 | CONTROL_ML_LBUTTON = 1073741824 | ||
56 | } | ||
57 | |||
58 | struct ScriptControllers | ||
59 | { | ||
60 | public LLUUID itemID; | ||
61 | public uint objID; | ||
62 | public ScriptControlled ignoreControls; | ||
63 | public ScriptControlled eventControls; | ||
64 | } | ||
65 | |||
43 | [Serializable] | 66 | [Serializable] |
44 | public class ScenePresence : EntityBase, ISerializable | 67 | public class ScenePresence : EntityBase, ISerializable |
45 | { | 68 | { |
@@ -56,6 +79,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
56 | public LLUUID currentParcelUUID = LLUUID.Zero; | 79 | public LLUUID currentParcelUUID = LLUUID.Zero; |
57 | private List<LLUUID> m_animations = new List<LLUUID>(); | 80 | private List<LLUUID> m_animations = new List<LLUUID>(); |
58 | private List<int> m_animationSeqs = new List<int>(); | 81 | private List<int> m_animationSeqs = new List<int>(); |
82 | private Dictionary<LLUUID, ScriptControllers> scriptedcontrols = new Dictionary<LLUUID, ScriptControllers>(); | ||
83 | private ScriptControlled IgnoredControls = ScriptControlled.CONTROL_ZERO; | ||
84 | |||
59 | public Vector3 lastKnownAllowedPosition = new Vector3(); | 85 | public Vector3 lastKnownAllowedPosition = new Vector3(); |
60 | public bool sentMessageAboutRestrictedParcelFlyingDown = false; | 86 | public bool sentMessageAboutRestrictedParcelFlyingDown = false; |
61 | 87 | ||
@@ -787,6 +813,17 @@ namespace OpenSim.Region.Environment.Scenes | |||
787 | // m_AgentControlFlags = flags; | 813 | // m_AgentControlFlags = flags; |
788 | // m_headrotation = agentData.AgentData.HeadRotation; | 814 | // m_headrotation = agentData.AgentData.HeadRotation; |
789 | // m_state = agentData.AgentData.State; | 815 | // m_state = agentData.AgentData.State; |
816 | |||
817 | |||
818 | lock (scriptedcontrols) | ||
819 | { | ||
820 | if (scriptedcontrols.Count > 0) | ||
821 | { | ||
822 | flags = this.RemoveIgnoredControls(flags, IgnoredControls); | ||
823 | |||
824 | } | ||
825 | } | ||
826 | |||
790 | 827 | ||
791 | if (m_allowMovement) | 828 | if (m_allowMovement) |
792 | { | 829 | { |
@@ -2397,5 +2434,93 @@ namespace OpenSim.Region.Environment.Scenes | |||
2397 | PhysicsActor.AddForce(impulse,true); | 2434 | PhysicsActor.AddForce(impulse,true); |
2398 | } | 2435 | } |
2399 | } | 2436 | } |
2437 | |||
2438 | public void SendMovementEventsToScript(int controls, int accept, int pass_on, uint Obj_localID, LLUUID Script_item_LLUUID) | ||
2439 | { | ||
2440 | |||
2441 | ScriptControllers obj = new ScriptControllers(); | ||
2442 | obj.ignoreControls = ScriptControlled.CONTROL_ZERO; | ||
2443 | obj.eventControls = ScriptControlled.CONTROL_ZERO; | ||
2444 | |||
2445 | obj.itemID = Script_item_LLUUID; | ||
2446 | obj.objID = Obj_localID; | ||
2447 | if (pass_on == 0 && accept == 0) | ||
2448 | { | ||
2449 | IgnoredControls |= (ScriptControlled)controls; | ||
2450 | obj.ignoreControls = (ScriptControlled)controls; | ||
2451 | } | ||
2452 | |||
2453 | if (pass_on == 0 && accept == 1) | ||
2454 | { | ||
2455 | IgnoredControls |= (ScriptControlled)controls; | ||
2456 | obj.ignoreControls = (ScriptControlled)controls; | ||
2457 | obj.eventControls = (ScriptControlled)controls; | ||
2458 | } | ||
2459 | if (pass_on == 1 && accept == 1) | ||
2460 | { | ||
2461 | IgnoredControls = ScriptControlled.CONTROL_ZERO; | ||
2462 | obj.eventControls = (ScriptControlled)controls; | ||
2463 | obj.ignoreControls = ScriptControlled.CONTROL_ZERO; | ||
2464 | } | ||
2465 | |||
2466 | lock (scriptedcontrols) | ||
2467 | { | ||
2468 | if (pass_on == 1 && accept == 0) | ||
2469 | { | ||
2470 | IgnoredControls &= ~(ScriptControlled)controls; | ||
2471 | if (scriptedcontrols.ContainsKey(Script_item_LLUUID)) | ||
2472 | scriptedcontrols.Remove(Script_item_LLUUID); | ||
2473 | |||
2474 | } | ||
2475 | else | ||
2476 | { | ||
2477 | |||
2478 | if (scriptedcontrols.ContainsKey(Script_item_LLUUID)) | ||
2479 | { | ||
2480 | scriptedcontrols[Script_item_LLUUID] = obj; | ||
2481 | } | ||
2482 | else | ||
2483 | { | ||
2484 | scriptedcontrols.Add(Script_item_LLUUID, obj); | ||
2485 | } | ||
2486 | } | ||
2487 | } | ||
2488 | ControllingClient.SendTakeControls(controls, pass_on == 1 ? true : false, true); | ||
2489 | |||
2490 | |||
2491 | } | ||
2492 | internal uint RemoveIgnoredControls(uint flags, ScriptControlled Ignored) | ||
2493 | { | ||
2494 | if (Ignored == ScriptControlled.CONTROL_ZERO) | ||
2495 | return flags; | ||
2496 | if ((Ignored & ScriptControlled.CONTROL_BACK) != 0) | ||
2497 | flags &= ~((uint)AgentManager.ControlFlags.AGENT_CONTROL_AT_NEG | (uint)AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_NEG); | ||
2498 | if ((Ignored & ScriptControlled.CONTROL_FWD) != 0) | ||
2499 | flags &= ~((uint)AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_POS | (uint)AgentManager.ControlFlags.AGENT_CONTROL_AT_POS); | ||
2500 | if ((Ignored & ScriptControlled.CONTROL_DOWN) != 0) | ||
2501 | flags &= ~((uint)AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG | (uint)AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_NEG); | ||
2502 | if ((Ignored & ScriptControlled.CONTROL_UP) != 0) | ||
2503 | flags &= ~((uint)AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_POS | (uint)AgentManager.ControlFlags.AGENT_CONTROL_UP_POS); | ||
2504 | if ((Ignored & ScriptControlled.CONTROL_LEFT) != 0) | ||
2505 | flags &= ~((uint)AgentManager.ControlFlags.AGENT_CONTROL_LEFT_POS | (uint)AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_LEFT_POS); | ||
2506 | if ((Ignored & ScriptControlled.CONTROL_RIGHT) != 0) | ||
2507 | flags &= ~((uint)AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_LEFT_NEG | (uint)AgentManager.ControlFlags.AGENT_CONTROL_LEFT_NEG); | ||
2508 | if ((Ignored & ScriptControlled.CONTROL_ROT_LEFT) != 0) | ||
2509 | flags &= ~((uint)AgentManager.ControlFlags.AGENT_CONTROL_YAW_NEG); | ||
2510 | if ((Ignored & ScriptControlled.CONTROL_ROT_RIGHT) != 0) | ||
2511 | flags &= ~((uint)AgentManager.ControlFlags.AGENT_CONTROL_YAW_POS); | ||
2512 | if ((Ignored & ScriptControlled.CONTROL_ML_LBUTTON) != 0) | ||
2513 | flags &= ~((uint)AgentManager.ControlFlags.AGENT_CONTROL_ML_LBUTTON_DOWN); | ||
2514 | if ((Ignored & ScriptControlled.CONTROL_LBUTTON) != 0) | ||
2515 | flags &= ~((uint)AgentManager.ControlFlags.AGENT_CONTROL_LBUTTON_UP | (uint)AgentManager.ControlFlags.AGENT_CONTROL_LBUTTON_DOWN); | ||
2516 | //DIR_CONTROL_FLAG_FORWARD = AgentManager.ControlFlags.AGENT_CONTROL_AT_POS, | ||
2517 | //DIR_CONTROL_FLAG_BACK = AgentManager.ControlFlags.AGENT_CONTROL_AT_NEG, | ||
2518 | //DIR_CONTROL_FLAG_LEFT = AgentManager.ControlFlags.AGENT_CONTROL_LEFT_POS, | ||
2519 | //DIR_CONTROL_FLAG_RIGHT = AgentManager.ControlFlags.AGENT_CONTROL_LEFT_NEG, | ||
2520 | //DIR_CONTROL_FLAG_UP = AgentManager.ControlFlags.AGENT_CONTROL_UP_POS, | ||
2521 | //DIR_CONTROL_FLAG_DOWN = AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG, | ||
2522 | //DIR_CONTROL_FLAG_DOWN_NUDGE = AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_NEG | ||
2523 | return flags; | ||
2524 | } | ||
2400 | } | 2525 | } |
2401 | } | 2526 | } |