aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes
diff options
context:
space:
mode:
authorTeravus Ovares2008-05-07 18:23:46 +0000
committerTeravus Ovares2008-05-07 18:23:46 +0000
commitab5556055e6104d3e5c18faf7f6f9e44b518839f (patch)
tree470dfe3c97a2cae75e85853a898f59a8d96548bd /OpenSim/Region/Environment/Scenes
parentwhile I'm not convinced this is causing my current run away (diff)
downloadopensim-SC_OLD-ab5556055e6104d3e5c18faf7f6f9e44b518839f.zip
opensim-SC_OLD-ab5556055e6104d3e5c18faf7f6f9e44b518839f.tar.gz
opensim-SC_OLD-ab5556055e6104d3e5c18faf7f6f9e44b518839f.tar.bz2
opensim-SC_OLD-ab5556055e6104d3e5c18faf7f6f9e44b518839f.tar.xz
* Theoretically, everything is in place for scripted take controls... Theoretically.
* I've still got to test, it's still theoretical code :D. Good thing it isn't enabled by default!
Diffstat (limited to 'OpenSim/Region/Environment/Scenes')
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneEvents.cs5
-rw-r--r--OpenSim/Region/Environment/Scenes/ScenePresence.cs104
2 files changed, 108 insertions, 1 deletions
diff --git a/OpenSim/Region/Environment/Scenes/SceneEvents.cs b/OpenSim/Region/Environment/Scenes/SceneEvents.cs
index 2feed78..d409f4e 100644
--- a/OpenSim/Region/Environment/Scenes/SceneEvents.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneEvents.cs
@@ -602,5 +602,10 @@ namespace OpenSim.Region.Environment.Scenes
602 handlerAvatarKill(KillerObjectLocalID, DeadAvatar); 602 handlerAvatarKill(KillerObjectLocalID, DeadAvatar);
603 } 603 }
604 } 604 }
605
606 internal void TriggerControlEvent(uint p, LLUUID scriptUUID, uint p_3, uint p_4)
607 {
608 throw new Exception("The method or operation is not implemented.");
609 }
605 } 610 }
606} 611}
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
index 66363b7..fdafd7f 100644
--- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
@@ -81,6 +81,7 @@ namespace OpenSim.Region.Environment.Scenes
81 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>(); 82 private Dictionary<LLUUID, ScriptControllers> scriptedcontrols = new Dictionary<LLUUID, ScriptControllers>();
83 private ScriptControlled IgnoredControls = ScriptControlled.CONTROL_ZERO; 83 private ScriptControlled IgnoredControls = ScriptControlled.CONTROL_ZERO;
84 private ScriptControlled LastCommands = ScriptControlled.CONTROL_ZERO;
84 85
85 public Vector3 lastKnownAllowedPosition = new Vector3(); 86 public Vector3 lastKnownAllowedPosition = new Vector3();
86 public bool sentMessageAboutRestrictedParcelFlyingDown = false; 87 public bool sentMessageAboutRestrictedParcelFlyingDown = false;
@@ -819,6 +820,7 @@ namespace OpenSim.Region.Environment.Scenes
819 { 820 {
820 if (scriptedcontrols.Count > 0) 821 if (scriptedcontrols.Count > 0)
821 { 822 {
823 SendControlToScripts(flags, LastCommands);
822 flags = this.RemoveIgnoredControls(flags, IgnoredControls); 824 flags = this.RemoveIgnoredControls(flags, IgnoredControls);
823 825
824 } 826 }
@@ -2435,7 +2437,7 @@ namespace OpenSim.Region.Environment.Scenes
2435 } 2437 }
2436 } 2438 }
2437 2439
2438 public void SendMovementEventsToScript(int controls, int accept, int pass_on, uint Obj_localID, LLUUID Script_item_LLUUID) 2440 public void RegisterControlEventsToScript(int controls, int accept, int pass_on, uint Obj_localID, LLUUID Script_item_LLUUID)
2439 { 2441 {
2440 2442
2441 ScriptControllers obj = new ScriptControllers(); 2443 ScriptControllers obj = new ScriptControllers();
@@ -2489,6 +2491,106 @@ namespace OpenSim.Region.Environment.Scenes
2489 2491
2490 2492
2491 } 2493 }
2494
2495 public void UnRegisterControlEventsToScript(uint Obj_localID, LLUUID Script_item_LLUUID)
2496 {
2497 lock (scriptedcontrols)
2498 {
2499 if (scriptedcontrols.ContainsKey(Script_item_LLUUID))
2500 {
2501 scriptedcontrols.Remove(Script_item_LLUUID);
2502 IgnoredControls = ScriptControlled.CONTROL_ZERO;
2503 foreach (ScriptControllers scData in scriptedcontrols.Values)
2504 {
2505 IgnoredControls |= scData.ignoreControls;
2506 }
2507 }
2508 }
2509 }
2510
2511 internal void SendControlToScripts(uint flags, ScriptControlled lastFlags)
2512 {
2513
2514 ScriptControlled allflags = ScriptControlled.CONTROL_ZERO;
2515 if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_AT_POS) != 0 || (flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_POS) != 0)
2516 {
2517 allflags |= ScriptControlled.CONTROL_FWD;
2518 }
2519 if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_AT_NEG) != 0 || (flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_NEG) != 0)
2520 {
2521 allflags |= ScriptControlled.CONTROL_BACK;
2522 }
2523 if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_UP_POS) != 0 || (flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_POS) != 0)
2524 {
2525 allflags |= ScriptControlled.CONTROL_UP;
2526 }
2527 if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0 || (flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_NEG) != 0)
2528 {
2529 allflags |= ScriptControlled.CONTROL_DOWN;
2530 }
2531 if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_LEFT_POS) != 0 || (flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_LEFT_POS) != 0)
2532 {
2533 allflags |= ScriptControlled.CONTROL_LEFT;
2534 }
2535 if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_LEFT_NEG) != 0 || (flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_LEFT_NEG) != 0)
2536 {
2537 allflags |= ScriptControlled.CONTROL_RIGHT;
2538 }
2539 if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_YAW_POS) != 0)
2540 {
2541 allflags |= ScriptControlled.CONTROL_ROT_RIGHT;
2542 }
2543 if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_YAW_NEG) != 0)
2544 {
2545 allflags |= ScriptControlled.CONTROL_ROT_LEFT;
2546 }
2547 if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_ML_LBUTTON_DOWN) != 0)
2548 {
2549 allflags |= ScriptControlled.CONTROL_ML_LBUTTON;
2550 }
2551 if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_LBUTTON_UP) != 0 || (flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_LBUTTON_DOWN) != 0)
2552 {
2553 allflags |= ScriptControlled.CONTROL_LBUTTON;
2554 }
2555 ScriptControlled held = ScriptControlled.CONTROL_ZERO;
2556 ScriptControlled change = ScriptControlled.CONTROL_ZERO;
2557
2558 foreach (ScriptControlled DCF in Enum.GetValues(typeof (ScriptControlled)))
2559 {
2560 // Held
2561 if ((lastFlags & DCF) != 0 && (allflags & DCF) != 0)
2562 {
2563 held |= DCF;
2564 continue;
2565 }
2566 // Not held recently
2567 if ((lastFlags & DCF) != 0 && (allflags & DCF) == 0)
2568 {
2569 change |= DCF;
2570 continue;
2571 }
2572 // Newly pressed.
2573 if ((lastFlags & DCF) == 0 && (allflags & DCF) != 0)
2574 {
2575 change |= DCF;
2576 continue;
2577 }
2578
2579 }
2580
2581 lock (scriptedcontrols)
2582 {
2583 foreach (LLUUID scriptUUID in scriptedcontrols.Keys)
2584 {
2585 ScriptControllers scriptControlData = scriptedcontrols[scriptUUID];
2586 ScriptControlled localHeld = held & scriptControlData.eventControls;
2587 ScriptControlled localChange = change & scriptControlData.eventControls;
2588 m_scene.EventManager.TriggerControlEvent(scriptControlData.objID, scriptUUID, (uint)localHeld, (uint)localChange);
2589 }
2590 }
2591 LastCommands = allflags;
2592 //foreach (Dir_ControlFlags DCF in Enum.GetValues(typeof (Dir_ControlFlags)))
2593 }
2492 internal uint RemoveIgnoredControls(uint flags, ScriptControlled Ignored) 2594 internal uint RemoveIgnoredControls(uint flags, ScriptControlled Ignored)
2493 { 2595 {
2494 if (Ignored == ScriptControlled.CONTROL_ZERO) 2596 if (Ignored == ScriptControlled.CONTROL_ZERO)