diff options
author | lbsa71 | 2007-08-16 17:08:03 +0000 |
---|---|---|
committer | lbsa71 | 2007-08-16 17:08:03 +0000 |
commit | 25fd8d02738e61e81f93ac784b02ab84697ee528 (patch) | |
tree | db1dda71b3aa86770fa90ae84d4ac361a6fd84c7 | |
parent | Deleted old inventoryCache.cs (diff) | |
download | opensim-SC-25fd8d02738e61e81f93ac784b02ab84697ee528.zip opensim-SC-25fd8d02738e61e81f93ac784b02ab84697ee528.tar.gz opensim-SC-25fd8d02738e61e81f93ac784b02ab84697ee528.tar.bz2 opensim-SC-25fd8d02738e61e81f93ac784b02ab84697ee528.tar.xz |
* Introduced IScriptHost as an interface to fetching object data from scripts.
* This meant introducing AbsolutePosition on all objects (since SimChat wants that)
21 files changed, 148 insertions, 78 deletions
diff --git a/OpenSim/Region/Environment/LandManagement/Land.cs b/OpenSim/Region/Environment/LandManagement/Land.cs index e9f5248..a1d8885 100644 --- a/OpenSim/Region/Environment/LandManagement/Land.cs +++ b/OpenSim/Region/Environment/LandManagement/Land.cs | |||
@@ -186,7 +186,7 @@ namespace OpenSim.Region.Environment.LandManagement | |||
186 | List<ScenePresence> avatars = m_scene.RequestAvatarList(); | 186 | List<ScenePresence> avatars = m_scene.RequestAvatarList(); |
187 | for (int i = 0; i < avatars.Count; i++) | 187 | for (int i = 0; i < avatars.Count; i++) |
188 | { | 188 | { |
189 | Land over = m_scene.LandManager.getLandObject((int)Math.Round(avatars[i].Pos.X), (int)Math.Round(avatars[i].Pos.Y)); | 189 | Land over = m_scene.LandManager.getLandObject((int)Math.Round(avatars[i].AbsolutePosition.X), (int)Math.Round(avatars[i].AbsolutePosition.Y)); |
190 | if (over.landData.localID == this.landData.localID) | 190 | if (over.landData.localID == this.landData.localID) |
191 | { | 191 | { |
192 | sendLandProperties(0, false, 0, avatars[i].ControllingClient); | 192 | sendLandProperties(0, false, 0, avatars[i].ControllingClient); |
diff --git a/OpenSim/Region/Environment/LandManagement/LandManager.cs b/OpenSim/Region/Environment/LandManagement/LandManager.cs index 1d82fa9..1ed0642 100644 --- a/OpenSim/Region/Environment/LandManagement/LandManager.cs +++ b/OpenSim/Region/Environment/LandManagement/LandManager.cs | |||
@@ -532,7 +532,7 @@ namespace OpenSim.Region.Environment.LandManagement | |||
532 | ScenePresence clientAvatar = m_scene.RequestAvatar(remote_client.AgentId); | 532 | ScenePresence clientAvatar = m_scene.RequestAvatar(remote_client.AgentId); |
533 | if (clientAvatar != null) | 533 | if (clientAvatar != null) |
534 | { | 534 | { |
535 | Land over = getLandObject(clientAvatar.Pos.X,clientAvatar.Pos.Y); | 535 | Land over = getLandObject(clientAvatar.AbsolutePosition.X,clientAvatar.AbsolutePosition.Y); |
536 | if (over != null) | 536 | if (over != null) |
537 | { | 537 | { |
538 | over.sendLandProperties(0, false, 0, remote_client); | 538 | over.sendLandProperties(0, false, 0, remote_client); |
@@ -554,7 +554,7 @@ namespace OpenSim.Region.Environment.LandManagement | |||
554 | 554 | ||
555 | public void addPrimToLandPrimCounts(SceneObjectGroup obj) | 555 | public void addPrimToLandPrimCounts(SceneObjectGroup obj) |
556 | { | 556 | { |
557 | LLVector3 position = obj.Pos; | 557 | LLVector3 position = obj.AbsolutePosition; |
558 | Land landUnderPrim = getLandObject(position.X, position.Y); | 558 | Land landUnderPrim = getLandObject(position.X, position.Y); |
559 | if (landUnderPrim != null) | 559 | if (landUnderPrim != null) |
560 | { | 560 | { |
diff --git a/OpenSim/Region/Environment/PermissionManager.cs b/OpenSim/Region/Environment/PermissionManager.cs index 1daf5c3..55660c5 100644 --- a/OpenSim/Region/Environment/PermissionManager.cs +++ b/OpenSim/Region/Environment/PermissionManager.cs | |||
@@ -115,7 +115,7 @@ namespace OpenSim.Region.Environment | |||
115 | permission = true; | 115 | permission = true; |
116 | 116 | ||
117 | // Users should be able to edit what is over their land. | 117 | // Users should be able to edit what is over their land. |
118 | if (m_scene.LandManager.getLandObject(task.Pos.X, task.Pos.Y).landData.ownerID == user) | 118 | if (m_scene.LandManager.getLandObject(task.AbsolutePosition.X, task.AbsolutePosition.Y).landData.ownerID == user) |
119 | permission = true; | 119 | permission = true; |
120 | 120 | ||
121 | // Estate users should be able to edit anything in the sim | 121 | // Estate users should be able to edit anything in the sim |
diff --git a/OpenSim/Region/Environment/Scenes/Entity.cs b/OpenSim/Region/Environment/Scenes/Entity.cs index 204b68f..d9f41e3 100644 --- a/OpenSim/Region/Environment/Scenes/Entity.cs +++ b/OpenSim/Region/Environment/Scenes/Entity.cs | |||
@@ -38,7 +38,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
38 | /// <summary> | 38 | /// <summary> |
39 | /// | 39 | /// |
40 | /// </summary> | 40 | /// </summary> |
41 | public override LLVector3 Pos | 41 | public override LLVector3 AbsolutePosition |
42 | { | 42 | { |
43 | get | 43 | get |
44 | { | 44 | { |
diff --git a/OpenSim/Region/Environment/Scenes/EntityBase.cs b/OpenSim/Region/Environment/Scenes/EntityBase.cs index 5f2634d..a4d9ac5 100644 --- a/OpenSim/Region/Environment/Scenes/EntityBase.cs +++ b/OpenSim/Region/Environment/Scenes/EntityBase.cs | |||
@@ -1,10 +1,11 @@ | |||
1 | using System.Collections.Generic; | 1 | using System.Collections.Generic; |
2 | using Axiom.Math; | 2 | using Axiom.Math; |
3 | using libsecondlife; | 3 | using libsecondlife; |
4 | using OpenSim.Region.Environment.Scenes.Scripting; | ||
4 | 5 | ||
5 | namespace OpenSim.Region.Environment.Scenes | 6 | namespace OpenSim.Region.Environment.Scenes |
6 | { | 7 | { |
7 | public abstract class EntityBase | 8 | public abstract class EntityBase : IScriptHost |
8 | { | 9 | { |
9 | protected List<EntityBase> m_children; | 10 | protected List<EntityBase> m_children; |
10 | 11 | ||
@@ -37,7 +38,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
37 | /// <summary> | 38 | /// <summary> |
38 | /// | 39 | /// |
39 | /// </summary> | 40 | /// </summary> |
40 | public virtual LLVector3 Pos | 41 | public virtual LLVector3 AbsolutePosition |
41 | { | 42 | { |
42 | get { return m_pos; } | 43 | get { return m_pos; } |
43 | set { m_pos = value; } | 44 | set { m_pos = value; } |
diff --git a/OpenSim/Region/Environment/Scenes/Primitive(Old).cs b/OpenSim/Region/Environment/Scenes/Primitive(Old).cs index 64976a8..2f51ab3 100644 --- a/OpenSim/Region/Environment/Scenes/Primitive(Old).cs +++ b/OpenSim/Region/Environment/Scenes/Primitive(Old).cs | |||
@@ -57,14 +57,14 @@ namespace OpenSim.Region.Environment.Scenes | |||
57 | /// If rootprim, will return world position | 57 | /// If rootprim, will return world position |
58 | /// otherwise will return local offset from rootprim | 58 | /// otherwise will return local offset from rootprim |
59 | /// </summary> | 59 | /// </summary> |
60 | public override LLVector3 Pos | 60 | public override LLVector3 AbsolutePosition |
61 | { | 61 | { |
62 | get | 62 | get |
63 | { | 63 | { |
64 | if (m_isRootPrim) | 64 | if (m_isRootPrim) |
65 | { | 65 | { |
66 | //if we are rootprim then our offset should be zero | 66 | //if we are rootprim then our offset should be zero |
67 | return m_pos + m_Parent.Pos; | 67 | return m_pos + m_Parent.AbsolutePosition; |
68 | } | 68 | } |
69 | else | 69 | else |
70 | { | 70 | { |
@@ -75,9 +75,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
75 | { | 75 | { |
76 | if (m_isRootPrim) | 76 | if (m_isRootPrim) |
77 | { | 77 | { |
78 | m_Parent.Pos = value; | 78 | m_Parent.AbsolutePosition = value; |
79 | } | 79 | } |
80 | m_pos = value - m_Parent.Pos; | 80 | m_pos = value - m_Parent.AbsolutePosition; |
81 | } | 81 | } |
82 | } | 82 | } |
83 | 83 | ||
@@ -99,7 +99,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
99 | } | 99 | } |
100 | else | 100 | else |
101 | { | 101 | { |
102 | return Pos; | 102 | return AbsolutePosition; |
103 | } | 103 | } |
104 | } | 104 | } |
105 | } | 105 | } |
@@ -284,7 +284,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
284 | OwnerID = ownerID; | 284 | OwnerID = ownerID; |
285 | CreatorID = OwnerID; | 285 | CreatorID = OwnerID; |
286 | LastOwnerID = LLUUID.Zero; | 286 | LastOwnerID = LLUUID.Zero; |
287 | Pos = pos; | 287 | AbsolutePosition = pos; |
288 | m_uuid = LLUUID.Random(); | 288 | m_uuid = LLUUID.Random(); |
289 | m_localId = (uint)(localID); | 289 | m_localId = (uint)(localID); |
290 | 290 | ||
@@ -335,13 +335,13 @@ namespace OpenSim.Region.Environment.Scenes | |||
335 | /// <param name="rootParent"></param> | 335 | /// <param name="rootParent"></param> |
336 | public void SetNewParent(Primitive newParent, SceneObjectOLD rootParent) | 336 | public void SetNewParent(Primitive newParent, SceneObjectOLD rootParent) |
337 | { | 337 | { |
338 | LLVector3 oldPos = new LLVector3(Pos.X, Pos.Y, Pos.Z); | 338 | LLVector3 oldPos = new LLVector3(AbsolutePosition.X, AbsolutePosition.Y, AbsolutePosition.Z); |
339 | m_isRootPrim = false; | 339 | m_isRootPrim = false; |
340 | m_Parent = newParent; | 340 | m_Parent = newParent; |
341 | ParentID = newParent.LocalId; | 341 | ParentID = newParent.LocalId; |
342 | m_RootParent = rootParent; | 342 | m_RootParent = rootParent; |
343 | m_RootParent.AddChildToList(this); | 343 | m_RootParent.AddChildToList(this); |
344 | Pos = oldPos; | 344 | AbsolutePosition = oldPos; |
345 | Vector3 axPos = new Vector3(m_pos.X, m_pos.Y, m_pos.Z); | 345 | Vector3 axPos = new Vector3(m_pos.X, m_pos.Y, m_pos.Z); |
346 | axPos = m_Parent.Rotation.Inverse() * axPos; | 346 | axPos = m_Parent.Rotation.Inverse() * axPos; |
347 | m_pos = new LLVector3(axPos.x, axPos.y, axPos.z); | 347 | m_pos = new LLVector3(axPos.x, axPos.y, axPos.z); |
@@ -366,7 +366,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
366 | public void SetRootParent(SceneObjectOLD newRoot, Primitive newParent, LLVector3 oldParentPosition, | 366 | public void SetRootParent(SceneObjectOLD newRoot, Primitive newParent, LLVector3 oldParentPosition, |
367 | Quaternion oldParentRotation) | 367 | Quaternion oldParentRotation) |
368 | { | 368 | { |
369 | LLVector3 oldPos = new LLVector3(Pos.X, Pos.Y, Pos.Z); | 369 | LLVector3 oldPos = new LLVector3(AbsolutePosition.X, AbsolutePosition.Y, AbsolutePosition.Z); |
370 | Vector3 axOldPos = new Vector3(oldPos.X, oldPos.Y, oldPos.Z); | 370 | Vector3 axOldPos = new Vector3(oldPos.X, oldPos.Y, oldPos.Z); |
371 | axOldPos = oldParentRotation * axOldPos; | 371 | axOldPos = oldParentRotation * axOldPos; |
372 | oldPos = new LLVector3(axOldPos.x, axOldPos.y, axOldPos.z); | 372 | oldPos = new LLVector3(axOldPos.x, axOldPos.y, axOldPos.z); |
@@ -379,7 +379,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
379 | 379 | ||
380 | m_RootParent = newRoot; | 380 | m_RootParent = newRoot; |
381 | m_RootParent.AddChildToList(this); | 381 | m_RootParent.AddChildToList(this); |
382 | Pos = oldPos; | 382 | AbsolutePosition = oldPos; |
383 | Vector3 axPos = new Vector3(m_pos.X, m_pos.Y, m_pos.Z); | 383 | Vector3 axPos = new Vector3(m_pos.X, m_pos.Y, m_pos.Z); |
384 | axPos = m_Parent.Rotation.Inverse() * axPos; | 384 | axPos = m_Parent.Rotation.Inverse() * axPos; |
385 | m_pos = new LLVector3(axPos.x, axPos.y, axPos.z); | 385 | m_pos = new LLVector3(axPos.x, axPos.y, axPos.z); |
@@ -445,7 +445,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
445 | { | 445 | { |
446 | LLVector3 newPos = new LLVector3(pos.X, pos.Y, pos.Z); | 446 | LLVector3 newPos = new LLVector3(pos.X, pos.Y, pos.Z); |
447 | 447 | ||
448 | Pos = newPos; | 448 | AbsolutePosition = newPos; |
449 | ScheduleTerseUpdate(); | 449 | ScheduleTerseUpdate(); |
450 | 450 | ||
451 | OnPrimCountTainted(); | 451 | OnPrimCountTainted(); |
@@ -461,14 +461,14 @@ namespace OpenSim.Region.Environment.Scenes | |||
461 | if (m_isRootPrim) | 461 | if (m_isRootPrim) |
462 | { | 462 | { |
463 | LLVector3 newPos = new LLVector3(pos.X, pos.Y, pos.Z); | 463 | LLVector3 newPos = new LLVector3(pos.X, pos.Y, pos.Z); |
464 | LLVector3 oldPos = new LLVector3(Pos.X, Pos.Y, Pos.Z); | 464 | LLVector3 oldPos = new LLVector3(AbsolutePosition.X, AbsolutePosition.Y, AbsolutePosition.Z); |
465 | LLVector3 diff = oldPos - newPos; | 465 | LLVector3 diff = oldPos - newPos; |
466 | Vector3 axDiff = new Vector3(diff.X, diff.Y, diff.Z); | 466 | Vector3 axDiff = new Vector3(diff.X, diff.Y, diff.Z); |
467 | axDiff = Rotation.Inverse() * axDiff; | 467 | axDiff = Rotation.Inverse() * axDiff; |
468 | diff.X = axDiff.x; | 468 | diff.X = axDiff.x; |
469 | diff.Y = axDiff.y; | 469 | diff.Y = axDiff.y; |
470 | diff.Z = axDiff.z; | 470 | diff.Z = axDiff.z; |
471 | Pos = newPos; | 471 | AbsolutePosition = newPos; |
472 | 472 | ||
473 | foreach (Primitive prim in m_children) | 473 | foreach (Primitive prim in m_children) |
474 | { | 474 | { |
@@ -507,7 +507,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
507 | public void UpdateGroupMouseRotation(LLVector3 pos, LLQuaternion rot) | 507 | public void UpdateGroupMouseRotation(LLVector3 pos, LLQuaternion rot) |
508 | { | 508 | { |
509 | Rotation = new Quaternion(rot.W, rot.X, rot.Y, rot.Z); | 509 | Rotation = new Quaternion(rot.W, rot.X, rot.Y, rot.Z); |
510 | Pos = pos; | 510 | AbsolutePosition = pos; |
511 | ScheduleTerseUpdate(); | 511 | ScheduleTerseUpdate(); |
512 | } | 512 | } |
513 | 513 | ||
@@ -644,7 +644,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
644 | public void SendFullUpdateToClient(IClientAPI remoteClient) | 644 | public void SendFullUpdateToClient(IClientAPI remoteClient) |
645 | { | 645 | { |
646 | LLVector3 lPos; | 646 | LLVector3 lPos; |
647 | lPos = Pos; | 647 | lPos = AbsolutePosition; |
648 | LLQuaternion lRot; | 648 | LLQuaternion lRot; |
649 | lRot = new LLQuaternion(Rotation.x, Rotation.y, Rotation.z, Rotation.w); | 649 | lRot = new LLQuaternion(Rotation.x, Rotation.y, Rotation.z, Rotation.w); |
650 | 650 | ||
@@ -690,7 +690,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
690 | LLVector3 lPos; | 690 | LLVector3 lPos; |
691 | Quaternion lRot; | 691 | Quaternion lRot; |
692 | 692 | ||
693 | lPos = Pos; | 693 | lPos = AbsolutePosition; |
694 | lRot = Rotation; | 694 | lRot = Rotation; |
695 | 695 | ||
696 | LLQuaternion mRot = new LLQuaternion(lRot.x, lRot.y, lRot.z, lRot.w); | 696 | LLQuaternion mRot = new LLQuaternion(lRot.x, lRot.y, lRot.z, lRot.w); |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs index b901d23..3f90723 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs | |||
@@ -159,7 +159,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
159 | if (this.Avatars.ContainsKey(fromAgentID)) | 159 | if (this.Avatars.ContainsKey(fromAgentID)) |
160 | { | 160 | { |
161 | avatar = this.Avatars[fromAgentID]; | 161 | avatar = this.Avatars[fromAgentID]; |
162 | fromPos = avatar.Pos; | 162 | fromPos = avatar.AbsolutePosition; |
163 | fromName = avatar.Firstname + " " + avatar.Lastname; | 163 | fromName = avatar.Firstname + " " + avatar.Lastname; |
164 | avatar = null; | 164 | avatar = null; |
165 | } | 165 | } |
@@ -170,7 +170,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
170 | if (this.Avatars.ContainsKey(presence.ControllingClient.AgentId)) | 170 | if (this.Avatars.ContainsKey(presence.ControllingClient.AgentId)) |
171 | { | 171 | { |
172 | avatar = this.Avatars[presence.ControllingClient.AgentId]; | 172 | avatar = this.Avatars[presence.ControllingClient.AgentId]; |
173 | dis = (int)avatar.Pos.GetDistanceTo(fromPos); | 173 | dis = (int)avatar.AbsolutePosition.GetDistanceTo(fromPos); |
174 | } | 174 | } |
175 | 175 | ||
176 | switch (type) | 176 | switch (type) |
@@ -354,7 +354,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
354 | if (originPrim != null) | 354 | if (originPrim != null) |
355 | { | 355 | { |
356 | SceneObjectGroup copy = originPrim.Copy(); | 356 | SceneObjectGroup copy = originPrim.Copy(); |
357 | copy.Pos = copy.Pos + offset; | 357 | copy.AbsolutePosition = copy.AbsolutePosition + offset; |
358 | this.Entities.Add(copy.UUID, copy); | 358 | this.Entities.Add(copy.UUID, copy); |
359 | 359 | ||
360 | copy.ScheduleGroupForFullUpdate(); | 360 | copy.ScheduleGroupForFullUpdate(); |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 96bb97a..7b2d0c5 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -645,7 +645,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
645 | MainLog.Instance.Verbose("World.cs:AddViewerAgent() - Adding new avatar to world"); | 645 | MainLog.Instance.Verbose("World.cs:AddViewerAgent() - Adding new avatar to world"); |
646 | MainLog.Instance.Verbose("World.cs:AddViewerAgent() - Starting RegionHandshake "); | 646 | MainLog.Instance.Verbose("World.cs:AddViewerAgent() - Starting RegionHandshake "); |
647 | 647 | ||
648 | PhysicsVector pVec = new PhysicsVector(newAvatar.Pos.X, newAvatar.Pos.Y, newAvatar.Pos.Z); | 648 | PhysicsVector pVec = new PhysicsVector(newAvatar.AbsolutePosition.X, newAvatar.AbsolutePosition.Y, newAvatar.AbsolutePosition.Z); |
649 | lock (m_syncRoot) | 649 | lock (m_syncRoot) |
650 | { | 650 | { |
651 | newAvatar.PhysActor = phyScene.AddAvatar(pVec); | 651 | newAvatar.PhysActor = phyScene.AddAvatar(pVec); |
diff --git a/OpenSim/Region/Environment/Scenes/SceneObject(Old).cs b/OpenSim/Region/Environment/Scenes/SceneObject(Old).cs index 882b72e..f32c952 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObject(Old).cs +++ b/OpenSim/Region/Environment/Scenes/SceneObject(Old).cs | |||
@@ -92,7 +92,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
92 | m_scene = world; | 92 | m_scene = world; |
93 | m_eventManager = eventManager; | 93 | m_eventManager = eventManager; |
94 | 94 | ||
95 | this.Pos = pos; | 95 | this.AbsolutePosition = pos; |
96 | this.CreateRootFromShape(ownerID, localID, shape, pos); | 96 | this.CreateRootFromShape(ownerID, localID, shape, pos); |
97 | 97 | ||
98 | registerEvents(); | 98 | registerEvents(); |
@@ -176,7 +176,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
176 | dupe.rootPrimitive = newRoot; | 176 | dupe.rootPrimitive = newRoot; |
177 | 177 | ||
178 | dupe.m_children.Add(dupe.rootPrimitive); | 178 | dupe.m_children.Add(dupe.rootPrimitive); |
179 | dupe.rootPrimitive.Pos = this.Pos; | 179 | dupe.rootPrimitive.AbsolutePosition = this.AbsolutePosition; |
180 | dupe.Rotation = this.Rotation; | 180 | dupe.Rotation = this.Rotation; |
181 | dupe.LocalId = m_scene.PrimIDAllocate(); | 181 | dupe.LocalId = m_scene.PrimIDAllocate(); |
182 | 182 | ||
@@ -274,7 +274,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
274 | /// <param name="remoteClient"></param> | 274 | /// <param name="remoteClient"></param> |
275 | public void GrapMovement(LLVector3 offset, LLVector3 pos, IClientAPI remoteClient) | 275 | public void GrapMovement(LLVector3 offset, LLVector3 pos, IClientAPI remoteClient) |
276 | { | 276 | { |
277 | this.rootPrimitive.Pos = pos; | 277 | this.rootPrimitive.AbsolutePosition = pos; |
278 | this.rootPrimitive.SendTerseUpdateForAllChildren(remoteClient); | 278 | this.rootPrimitive.SendTerseUpdateForAllChildren(remoteClient); |
279 | } | 279 | } |
280 | 280 | ||
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs index 73f199e..a5ad2e6 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs | |||
@@ -76,7 +76,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
76 | } | 76 | } |
77 | } | 77 | } |
78 | 78 | ||
79 | public override LLVector3 Pos | 79 | public override LLVector3 AbsolutePosition |
80 | { | 80 | { |
81 | get { return m_rootPart.GroupPosition; } | 81 | get { return m_rootPart.GroupPosition; } |
82 | set | 82 | set |
@@ -248,7 +248,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
248 | { | 248 | { |
249 | SceneObjectGroup dupe = (SceneObjectGroup)this.MemberwiseClone(); | 249 | SceneObjectGroup dupe = (SceneObjectGroup)this.MemberwiseClone(); |
250 | dupe.m_parts.Clear(); | 250 | dupe.m_parts.Clear(); |
251 | dupe.Pos = new LLVector3(Pos.X, Pos.Y, Pos.Z); | 251 | dupe.AbsolutePosition = new LLVector3(AbsolutePosition.X, AbsolutePosition.Y, AbsolutePosition.Z); |
252 | dupe.m_scene = m_scene; | 252 | dupe.m_scene = m_scene; |
253 | dupe.m_regionHandle = this.m_regionHandle; | 253 | dupe.m_regionHandle = this.m_regionHandle; |
254 | 254 | ||
@@ -427,8 +427,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
427 | public void LinkToGroup(SceneObjectGroup objectGroup) | 427 | public void LinkToGroup(SceneObjectGroup objectGroup) |
428 | { | 428 | { |
429 | SceneObjectPart linkPart = objectGroup.m_rootPart; | 429 | SceneObjectPart linkPart = objectGroup.m_rootPart; |
430 | linkPart.OffsetPosition = linkPart.GroupPosition - this.Pos; | 430 | linkPart.OffsetPosition = linkPart.GroupPosition - this.AbsolutePosition; |
431 | linkPart.GroupPosition = this.Pos; | 431 | linkPart.GroupPosition = this.AbsolutePosition; |
432 | 432 | ||
433 | Vector3 axPos = new Vector3(linkPart.OffsetPosition.X, linkPart.OffsetPosition.Y, linkPart.OffsetPosition.Z); | 433 | Vector3 axPos = new Vector3(linkPart.OffsetPosition.X, linkPart.OffsetPosition.Y, linkPart.OffsetPosition.Z); |
434 | Quaternion parentRot = new Quaternion(this.m_rootPart.RotationOffset.W, this.m_rootPart.RotationOffset.X, this.m_rootPart.RotationOffset.Y, this.m_rootPart.RotationOffset.Z); | 434 | Quaternion parentRot = new Quaternion(this.m_rootPart.RotationOffset.W, this.m_rootPart.RotationOffset.X, this.m_rootPart.RotationOffset.Y, this.m_rootPart.RotationOffset.Z); |
@@ -456,7 +456,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
456 | /// <param name="remoteClient"></param> | 456 | /// <param name="remoteClient"></param> |
457 | public void GrabMovement(LLVector3 offset, LLVector3 pos, IClientAPI remoteClient) | 457 | public void GrabMovement(LLVector3 offset, LLVector3 pos, IClientAPI remoteClient) |
458 | { | 458 | { |
459 | this.Pos = pos; | 459 | this.AbsolutePosition = pos; |
460 | this.m_rootPart.SendTerseUpdateToAllClients(); | 460 | this.m_rootPart.SendTerseUpdateToAllClients(); |
461 | } | 461 | } |
462 | 462 | ||
@@ -482,7 +482,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
482 | proper.ObjectData[0].TouchName = enc.GetBytes(this.m_rootPart.TouchName + "\0"); | 482 | proper.ObjectData[0].TouchName = enc.GetBytes(this.m_rootPart.TouchName + "\0"); |
483 | proper.ObjectData[0].TextureID = new byte[0]; | 483 | proper.ObjectData[0].TextureID = new byte[0]; |
484 | proper.ObjectData[0].SitName = enc.GetBytes(this.m_rootPart.SitName + "\0"); | 484 | proper.ObjectData[0].SitName = enc.GetBytes(this.m_rootPart.SitName + "\0"); |
485 | proper.ObjectData[0].Name = enc.GetBytes(this.m_rootPart.PartName + "\0"); | 485 | proper.ObjectData[0].Name = enc.GetBytes(this.m_rootPart.Name + "\0"); |
486 | proper.ObjectData[0].Description = enc.GetBytes(this.m_rootPart.Description + "\0"); | 486 | proper.ObjectData[0].Description = enc.GetBytes(this.m_rootPart.Description + "\0"); |
487 | proper.ObjectData[0].OwnerMask = this.m_rootPart.OwnerMask; | 487 | proper.ObjectData[0].OwnerMask = this.m_rootPart.OwnerMask; |
488 | proper.ObjectData[0].NextOwnerMask = this.m_rootPart.NextOwnerMask; | 488 | proper.ObjectData[0].NextOwnerMask = this.m_rootPart.NextOwnerMask; |
@@ -502,7 +502,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
502 | SceneObjectPart part = this.GetChildPrim(localID); | 502 | SceneObjectPart part = this.GetChildPrim(localID); |
503 | if (part != null) | 503 | if (part != null) |
504 | { | 504 | { |
505 | part.PartName = name; | 505 | part.Name = name; |
506 | } | 506 | } |
507 | } | 507 | } |
508 | 508 | ||
@@ -636,7 +636,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
636 | /// <param name="pos"></param> | 636 | /// <param name="pos"></param> |
637 | public void UpdateGroupPosition(LLVector3 pos) | 637 | public void UpdateGroupPosition(LLVector3 pos) |
638 | { | 638 | { |
639 | this.Pos = pos; | 639 | this.AbsolutePosition = pos; |
640 | } | 640 | } |
641 | 641 | ||
642 | /// <summary> | 642 | /// <summary> |
@@ -667,7 +667,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
667 | private void UpdateRootPosition(LLVector3 pos) | 667 | private void UpdateRootPosition(LLVector3 pos) |
668 | { | 668 | { |
669 | LLVector3 newPos = new LLVector3(pos.X, pos.Y, pos.Z); | 669 | LLVector3 newPos = new LLVector3(pos.X, pos.Y, pos.Z); |
670 | LLVector3 oldPos = new LLVector3(this.Pos.X + this.m_rootPart.OffsetPosition.X, this.Pos.Y + this.m_rootPart.OffsetPosition.Y, this.Pos.Z + this.m_rootPart.OffsetPosition.Z); | 670 | LLVector3 oldPos = new LLVector3(this.AbsolutePosition.X + this.m_rootPart.OffsetPosition.X, this.AbsolutePosition.Y + this.m_rootPart.OffsetPosition.Y, this.AbsolutePosition.Z + this.m_rootPart.OffsetPosition.Z); |
671 | LLVector3 diff = oldPos - newPos; | 671 | LLVector3 diff = oldPos - newPos; |
672 | Axiom.Math.Vector3 axDiff = new Vector3(diff.X, diff.Y, diff.Z); | 672 | Axiom.Math.Vector3 axDiff = new Vector3(diff.X, diff.Y, diff.Z); |
673 | Axiom.Math.Quaternion partRotation = new Quaternion(this.m_rootPart.RotationOffset.W, this.m_rootPart.RotationOffset.X, this.m_rootPart.RotationOffset.Y, this.m_rootPart.RotationOffset.Z); | 673 | Axiom.Math.Quaternion partRotation = new Quaternion(this.m_rootPart.RotationOffset.W, this.m_rootPart.RotationOffset.X, this.m_rootPart.RotationOffset.Y, this.m_rootPart.RotationOffset.Z); |
@@ -683,7 +683,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
683 | obPart.OffsetPosition = obPart.OffsetPosition + diff; | 683 | obPart.OffsetPosition = obPart.OffsetPosition + diff; |
684 | } | 684 | } |
685 | } | 685 | } |
686 | this.Pos = newPos; | 686 | this.AbsolutePosition = newPos; |
687 | pos.X = newPos.X; | 687 | pos.X = newPos.X; |
688 | pos.Y = newPos.Y; | 688 | pos.Y = newPos.Y; |
689 | pos.Z = newPos.Z; | 689 | pos.Z = newPos.Z; |
@@ -708,7 +708,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
708 | public void UpdateGroupRotation(LLVector3 pos, LLQuaternion rot) | 708 | public void UpdateGroupRotation(LLVector3 pos, LLQuaternion rot) |
709 | { | 709 | { |
710 | this.m_rootPart.UpdateRotation(rot); | 710 | this.m_rootPart.UpdateRotation(rot); |
711 | this.Pos = pos; | 711 | this.AbsolutePosition = pos; |
712 | } | 712 | } |
713 | 713 | ||
714 | /// <summary> | 714 | /// <summary> |
@@ -828,7 +828,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
828 | { | 828 | { |
829 | if (m_rootPart == part) | 829 | if (m_rootPart == part) |
830 | { | 830 | { |
831 | part.SendFullUpdateToClient(remoteClient, Pos); | 831 | part.SendFullUpdateToClient(remoteClient, AbsolutePosition); |
832 | } | 832 | } |
833 | else | 833 | else |
834 | { | 834 | { |
@@ -845,7 +845,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
845 | { | 845 | { |
846 | if (m_rootPart == part) | 846 | if (m_rootPart == part) |
847 | { | 847 | { |
848 | part.SendTerseUpdateToClient(remoteClient, Pos); | 848 | part.SendTerseUpdateToClient(remoteClient, AbsolutePosition); |
849 | } | 849 | } |
850 | else | 850 | else |
851 | { | 851 | { |
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs index 8e570d4..54bb5e6 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | |||
@@ -9,11 +9,12 @@ using libsecondlife; | |||
9 | using libsecondlife.Packets; | 9 | using libsecondlife.Packets; |
10 | using OpenSim.Framework.Interfaces; | 10 | using OpenSim.Framework.Interfaces; |
11 | using OpenSim.Framework.Types; | 11 | using OpenSim.Framework.Types; |
12 | using OpenSim.Region.Environment.Scenes.Scripting; | ||
12 | 13 | ||
13 | namespace OpenSim.Region.Environment.Scenes | 14 | namespace OpenSim.Region.Environment.Scenes |
14 | { | 15 | { |
15 | 16 | ||
16 | public class SceneObjectPart | 17 | public class SceneObjectPart : IScriptHost |
17 | { | 18 | { |
18 | private const uint FULL_MASK_PERMISSIONS = 2147483647; | 19 | private const uint FULL_MASK_PERMISSIONS = 2147483647; |
19 | 20 | ||
@@ -55,11 +56,11 @@ namespace OpenSim.Region.Environment.Scenes | |||
55 | set { m_localID = value; } | 56 | set { m_localID = value; } |
56 | } | 57 | } |
57 | 58 | ||
58 | protected string m_partName; | 59 | protected string m_name; |
59 | public virtual string PartName | 60 | public virtual string Name |
60 | { | 61 | { |
61 | get { return m_partName; } | 62 | get { return m_name; } |
62 | set { m_partName = value; } | 63 | set { m_name = value; } |
63 | } | 64 | } |
64 | 65 | ||
65 | protected LLObject.ObjectFlags m_flags = (LLObject.ObjectFlags)32 + 65536 + 131072 + 256 + 4 + 8 + 2048 + 524288 + 268435456 + 128; | 66 | protected LLObject.ObjectFlags m_flags = (LLObject.ObjectFlags)32 + 65536 + 131072 + 256 + 4 + 8 + 2048 + 524288 + 268435456 + 128; |
@@ -91,11 +92,16 @@ namespace OpenSim.Region.Environment.Scenes | |||
91 | set { m_groupPosition = value; } | 92 | set { m_groupPosition = value; } |
92 | } | 93 | } |
93 | 94 | ||
94 | protected LLVector3 m_offset; | 95 | protected LLVector3 m_offsetPosition; |
95 | public LLVector3 OffsetPosition | 96 | public LLVector3 OffsetPosition |
96 | { | 97 | { |
97 | get { return m_offset; } | 98 | get { return m_offsetPosition; } |
98 | set { m_offset = value; } | 99 | set { m_offsetPosition = value; } |
100 | } | ||
101 | |||
102 | public LLVector3 AbsolutePosition | ||
103 | { | ||
104 | get { return m_offsetPosition + m_groupPosition; } | ||
99 | } | 105 | } |
100 | 106 | ||
101 | protected LLQuaternion m_rotationOffset; | 107 | protected LLQuaternion m_rotationOffset; |
@@ -195,7 +201,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
195 | /// <param name="position"></param> | 201 | /// <param name="position"></param> |
196 | public SceneObjectPart(ulong regionHandle, SceneObjectGroup parent, LLUUID ownerID, uint localID, PrimitiveBaseShape shape, LLVector3 groupPosition, LLVector3 offsetPosition) | 202 | public SceneObjectPart(ulong regionHandle, SceneObjectGroup parent, LLUUID ownerID, uint localID, PrimitiveBaseShape shape, LLVector3 groupPosition, LLVector3 offsetPosition) |
197 | { | 203 | { |
198 | this.m_partName = "Primitive"; | 204 | this.m_name = "Primitive"; |
199 | this.m_regionHandle = regionHandle; | 205 | this.m_regionHandle = regionHandle; |
200 | this.m_parentGroup = parent; | 206 | this.m_parentGroup = parent; |
201 | 207 | ||
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index 6e4fcda..5dbf643 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs | |||
@@ -156,7 +156,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
156 | this.m_firstname = ControllingClient.FirstName; | 156 | this.m_firstname = ControllingClient.FirstName; |
157 | this.m_lastname = ControllingClient.LastName; | 157 | this.m_lastname = ControllingClient.LastName; |
158 | m_localId = m_scene.NextLocalId; | 158 | m_localId = m_scene.NextLocalId; |
159 | Pos = ControllingClient.StartPos; | 159 | AbsolutePosition = ControllingClient.StartPos; |
160 | 160 | ||
161 | visualParams = new byte[218]; | 161 | visualParams = new byte[218]; |
162 | for (int i = 0; i < 218; i++) | 162 | for (int i = 0; i < 218; i++) |
@@ -205,7 +205,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
205 | if (this.childAgent == true) | 205 | if (this.childAgent == true) |
206 | { | 206 | { |
207 | this.Velocity = new LLVector3(0, 0, 0); | 207 | this.Velocity = new LLVector3(0, 0, 0); |
208 | this.Pos = new LLVector3(128, 128, 70); | 208 | this.AbsolutePosition = new LLVector3(128, 128, 70); |
209 | 209 | ||
210 | } | 210 | } |
211 | } | 211 | } |
@@ -217,7 +217,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
217 | public void MakeAvatar(LLVector3 pos, bool isFlying) | 217 | public void MakeAvatar(LLVector3 pos, bool isFlying) |
218 | { | 218 | { |
219 | //this.childAvatar = false; | 219 | //this.childAvatar = false; |
220 | this.Pos = pos; | 220 | this.AbsolutePosition = pos; |
221 | this._physActor.Flying = isFlying; | 221 | this._physActor.Flying = isFlying; |
222 | this.newAvatar = true; | 222 | this.newAvatar = true; |
223 | this.childAgent = false; | 223 | this.childAgent = false; |
@@ -236,7 +236,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
236 | /// <param name="pos"></param> | 236 | /// <param name="pos"></param> |
237 | public void Teleport(LLVector3 pos) | 237 | public void Teleport(LLVector3 pos) |
238 | { | 238 | { |
239 | this.Pos = pos; | 239 | this.AbsolutePosition = pos; |
240 | this.SendTerseUpdateToALLClients(); | 240 | this.SendTerseUpdateToALLClients(); |
241 | } | 241 | } |
242 | 242 | ||
@@ -278,7 +278,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
278 | { | 278 | { |
279 | look = new LLVector3(0.99f, 0.042f, 0); | 279 | look = new LLVector3(0.99f, 0.042f, 0); |
280 | } | 280 | } |
281 | this.ControllingClient.MoveAgentIntoRegion(m_regionInfo, Pos, look); | 281 | this.ControllingClient.MoveAgentIntoRegion(m_regionInfo, AbsolutePosition, look); |
282 | if (this.childAgent) | 282 | if (this.childAgent) |
283 | { | 283 | { |
284 | this.childAgent = false; | 284 | this.childAgent = false; |
@@ -427,7 +427,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
427 | /// <param name="RemoteClient"></param> | 427 | /// <param name="RemoteClient"></param> |
428 | public void SendTerseUpdateToClient(IClientAPI RemoteClient) | 428 | public void SendTerseUpdateToClient(IClientAPI RemoteClient) |
429 | { | 429 | { |
430 | LLVector3 pos = this.Pos; | 430 | LLVector3 pos = this.AbsolutePosition; |
431 | LLVector3 vel = this.Velocity; | 431 | LLVector3 vel = this.Velocity; |
432 | RemoteClient.SendAvatarTerseUpdate(this.m_regionHandle, 64096, this.LocalId, new LLVector3(pos.X, pos.Y, pos.Z), new LLVector3(vel.X, vel.Y, vel.Z)); | 432 | RemoteClient.SendAvatarTerseUpdate(this.m_regionHandle, 64096, this.LocalId, new LLVector3(pos.X, pos.Y, pos.Z), new LLVector3(vel.X, vel.Y, vel.Z)); |
433 | } | 433 | } |
@@ -450,7 +450,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
450 | /// <param name="remoteAvatar"></param> | 450 | /// <param name="remoteAvatar"></param> |
451 | public void SendFullUpdateToOtherClient(ScenePresence remoteAvatar) | 451 | public void SendFullUpdateToOtherClient(ScenePresence remoteAvatar) |
452 | { | 452 | { |
453 | remoteAvatar.ControllingClient.SendAvatarData(m_regionInfo.RegionHandle, this.m_firstname, this.m_lastname, this.m_uuid, this.LocalId, this.Pos, this.m_textureEntry.ToBytes()); | 453 | remoteAvatar.ControllingClient.SendAvatarData(m_regionInfo.RegionHandle, this.m_firstname, this.m_lastname, this.m_uuid, this.LocalId, this.AbsolutePosition, this.m_textureEntry.ToBytes()); |
454 | } | 454 | } |
455 | 455 | ||
456 | public void SendFullUpdateToALLClients() | 456 | public void SendFullUpdateToALLClients() |
@@ -472,7 +472,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
472 | /// </summary> | 472 | /// </summary> |
473 | public void SendInitialData() | 473 | public void SendInitialData() |
474 | { | 474 | { |
475 | this.ControllingClient.SendAvatarData(m_regionInfo.RegionHandle, this.m_firstname, this.m_lastname, this.m_uuid, this.LocalId, this.Pos, this.m_textureEntry.ToBytes()); | 475 | this.ControllingClient.SendAvatarData(m_regionInfo.RegionHandle, this.m_firstname, this.m_lastname, this.m_uuid, this.LocalId, this.AbsolutePosition, this.m_textureEntry.ToBytes()); |
476 | if (!this.childAgent) | 476 | if (!this.childAgent) |
477 | { | 477 | { |
478 | this.m_scene.InformClientOfNeighbours(this.ControllingClient); | 478 | this.m_scene.InformClientOfNeighbours(this.ControllingClient); |
@@ -547,9 +547,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
547 | 547 | ||
548 | protected void CheckForSignificantMovement() | 548 | protected void CheckForSignificantMovement() |
549 | { | 549 | { |
550 | if (libsecondlife.Helpers.VecDist(this.Pos, this.posLastSignificantMove) > 2.0) | 550 | if (libsecondlife.Helpers.VecDist(this.AbsolutePosition, this.posLastSignificantMove) > 2.0) |
551 | { | 551 | { |
552 | this.posLastSignificantMove = this.Pos; | 552 | this.posLastSignificantMove = this.AbsolutePosition; |
553 | if (OnSignificantClientMovement != null) | 553 | if (OnSignificantClientMovement != null) |
554 | { | 554 | { |
555 | OnSignificantClientMovement(this.ControllingClient); | 555 | OnSignificantClientMovement(this.ControllingClient); |
@@ -564,7 +564,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
564 | /// </summary> | 564 | /// </summary> |
565 | protected void CheckForBorderCrossing() | 565 | protected void CheckForBorderCrossing() |
566 | { | 566 | { |
567 | LLVector3 pos2 = this.Pos; | 567 | LLVector3 pos2 = this.AbsolutePosition; |
568 | LLVector3 vel = this.Velocity; | 568 | LLVector3 vel = this.Velocity; |
569 | 569 | ||
570 | float timeStep = 0.1f; | 570 | float timeStep = 0.1f; |
@@ -588,7 +588,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
588 | /// </summary> | 588 | /// </summary> |
589 | protected void CrossToNewRegion() | 589 | protected void CrossToNewRegion() |
590 | { | 590 | { |
591 | LLVector3 pos = this.Pos; | 591 | LLVector3 pos = this.AbsolutePosition; |
592 | LLVector3 newpos = new LLVector3(pos.X, pos.Y, pos.Z); | 592 | LLVector3 newpos = new LLVector3(pos.X, pos.Y, pos.Z); |
593 | uint neighbourx = this.m_regionInfo.RegionLocX; | 593 | uint neighbourx = this.m_regionInfo.RegionLocX; |
594 | uint neighboury = this.m_regionInfo.RegionLocY; | 594 | uint neighboury = this.m_regionInfo.RegionLocY; |
diff --git a/OpenSim/Region/Environment/Scenes/Scripting/IScriptHost.cs b/OpenSim/Region/Environment/Scenes/Scripting/IScriptHost.cs new file mode 100644 index 0000000..1c14264 --- /dev/null +++ b/OpenSim/Region/Environment/Scenes/Scripting/IScriptHost.cs | |||
@@ -0,0 +1,14 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using libsecondlife; | ||
5 | |||
6 | namespace OpenSim.Region.Environment.Scenes.Scripting | ||
7 | { | ||
8 | public interface IScriptHost | ||
9 | { | ||
10 | string Name { get; } | ||
11 | LLUUID UUID { get; } | ||
12 | LLVector3 AbsolutePosition { get; } | ||
13 | } | ||
14 | } | ||
diff --git a/OpenSim/Region/Environment/Scenes/Scripting/NullScriptHost.cs b/OpenSim/Region/Environment/Scenes/Scripting/NullScriptHost.cs new file mode 100644 index 0000000..a55c87e --- /dev/null +++ b/OpenSim/Region/Environment/Scenes/Scripting/NullScriptHost.cs | |||
@@ -0,0 +1,26 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using libsecondlife; | ||
5 | |||
6 | namespace OpenSim.Region.Environment.Scenes.Scripting | ||
7 | { | ||
8 | public class NullScriptHost : IScriptHost | ||
9 | { | ||
10 | LLVector3 m_pos = new LLVector3( 128, 128, 30 ); | ||
11 | public string Name | ||
12 | { | ||
13 | get { return "Object"; } | ||
14 | } | ||
15 | |||
16 | public LLUUID UUID | ||
17 | { | ||
18 | get { return LLUUID.Zero; } | ||
19 | } | ||
20 | |||
21 | public LLVector3 AbsolutePosition | ||
22 | { | ||
23 | get { return m_pos; } | ||
24 | } | ||
25 | } | ||
26 | } | ||
diff --git a/OpenSim/Region/Environment/Scenes/Scripting/ScriptInterpretedAPI.cs b/OpenSim/Region/Environment/Scenes/Scripting/ScriptInterpretedAPI.cs index a5898b7..4617feb 100644 --- a/OpenSim/Region/Environment/Scenes/Scripting/ScriptInterpretedAPI.cs +++ b/OpenSim/Region/Environment/Scenes/Scripting/ScriptInterpretedAPI.cs | |||
@@ -74,7 +74,7 @@ namespace OpenSim.Region.Scripting | |||
74 | [Obsolete("Unimplemented")] | 74 | [Obsolete("Unimplemented")] |
75 | public void osAddToLandPassList(Key avatar, float hours) | 75 | public void osAddToLandPassList(Key avatar, float hours) |
76 | { | 76 | { |
77 | Vector myPosition = Task.Pos; | 77 | Vector myPosition = Task.AbsolutePosition; |
78 | Land myParcel = Scene.LandManager.getLandObject(myPosition.X, myPosition.Y); | 78 | Land myParcel = Scene.LandManager.getLandObject(myPosition.X, myPosition.Y); |
79 | 79 | ||
80 | OpenSim.Framework.Console.MainLog.Instance.Warn("script", "Unimplemented function called by script: osAddToLandPassList(Key avatar, float hours)"); | 80 | OpenSim.Framework.Console.MainLog.Instance.Warn("script", "Unimplemented function called by script: osAddToLandPassList(Key avatar, float hours)"); |
diff --git a/OpenSim/Region/Examples/SimpleApp/ComplexObject.cs b/OpenSim/Region/Examples/SimpleApp/ComplexObject.cs index 5821b9f..9276212 100644 --- a/OpenSim/Region/Examples/SimpleApp/ComplexObject.cs +++ b/OpenSim/Region/Examples/SimpleApp/ComplexObject.cs | |||
@@ -60,7 +60,7 @@ namespace SimpleApp | |||
60 | m_parts.Remove(part.UUID); | 60 | m_parts.Remove(part.UUID); |
61 | remoteClient.SendKillObject(m_regionHandle, part.LocalID); | 61 | remoteClient.SendKillObject(m_regionHandle, part.LocalID); |
62 | remoteClient.AddMoney(1); | 62 | remoteClient.AddMoney(1); |
63 | remoteClient.SendChatMessage("Poof!", 1, Pos, "Party Party", LLUUID.Zero); | 63 | remoteClient.SendChatMessage("Poof!", 1, this.AbsolutePosition, "Party Party", LLUUID.Zero); |
64 | } | 64 | } |
65 | 65 | ||
66 | public override void OnGrabGroup( LLVector3 offsetPos, IClientAPI remoteClient) | 66 | public override void OnGrabGroup( LLVector3 offsetPos, IClientAPI remoteClient) |
@@ -71,7 +71,7 @@ namespace SimpleApp | |||
71 | m_scene.RemoveEntity(this); | 71 | m_scene.RemoveEntity(this); |
72 | remoteClient.SendKillObject(m_regionHandle, m_rootPart.LocalID); | 72 | remoteClient.SendKillObject(m_regionHandle, m_rootPart.LocalID); |
73 | remoteClient.AddMoney(50); | 73 | remoteClient.AddMoney(50); |
74 | remoteClient.SendChatMessage("KABLAM!!!", 1, Pos, "Groupie Groupie", LLUUID.Zero); | 74 | remoteClient.SendChatMessage("KABLAM!!!", 1, AbsolutePosition, "Groupie Groupie", LLUUID.Zero); |
75 | } | 75 | } |
76 | } | 76 | } |
77 | } | 77 | } |
diff --git a/OpenSim/Region/Examples/SimpleApp/MyWorld.cs b/OpenSim/Region/Examples/SimpleApp/MyWorld.cs index 6cf8974..a84af49 100644 --- a/OpenSim/Region/Examples/SimpleApp/MyWorld.cs +++ b/OpenSim/Region/Examples/SimpleApp/MyWorld.cs | |||
@@ -67,7 +67,7 @@ namespace SimpleApp | |||
67 | SubscribeToClientEvents(client); | 67 | SubscribeToClientEvents(client); |
68 | 68 | ||
69 | ScenePresence avatar = CreateAndAddScenePresence(client); | 69 | ScenePresence avatar = CreateAndAddScenePresence(client); |
70 | avatar.Pos = new LLVector3(128, 128, 26); | 70 | avatar.AbsolutePosition = new LLVector3(128, 128, 26); |
71 | 71 | ||
72 | LLVector3 pos = new LLVector3(128, 128, 128); | 72 | LLVector3 pos = new LLVector3(128, 128, 128); |
73 | 73 | ||
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs index 13e3f2e..eea2094 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs | |||
@@ -229,6 +229,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL | |||
229 | // Add namespace, class name and inheritance | 229 | // Add namespace, class name and inheritance |
230 | Return = "namespace SecondLife {\r\n"; | 230 | Return = "namespace SecondLife {\r\n"; |
231 | Return += "public class Script : OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass {\r\n"; | 231 | Return += "public class Script : OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass {\r\n"; |
232 | Return += "public Script( OpenSim.Region.Environment.Scenes.Scripting.IScriptHost host ) : base( host ) { }\r\n"; | ||
232 | Return += Script; | 233 | Return += Script; |
233 | Return += "} }\r\n"; | 234 | Return += "} }\r\n"; |
234 | 235 | ||
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs index 062060f..565bfb7 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs | |||
@@ -2,6 +2,10 @@ using System; | |||
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Text; | 3 | using System.Text; |
4 | using OpenSim.Region.ScriptEngine.DotNetEngine.Compiler; | 4 | using OpenSim.Region.ScriptEngine.DotNetEngine.Compiler; |
5 | using libsecondlife; | ||
6 | using OpenSim.Region.Environment.Scenes; | ||
7 | using OpenSim.Region.Environment.Scenes.Scripting; | ||
8 | using OpenSim.Framework.Console; | ||
5 | 9 | ||
6 | namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL | 10 | namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL |
7 | { | 11 | { |
@@ -11,11 +15,17 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL | |||
11 | internal OpenSim.Region.Environment.Scenes.Scene World; | 15 | internal OpenSim.Region.Environment.Scenes.Scene World; |
12 | private System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding(); | 16 | private System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding(); |
13 | 17 | ||
14 | 18 | IScriptHost m_host; | |
19 | |||
20 | public LSL_BaseClass( IScriptHost host ) | ||
21 | { | ||
22 | m_host = host; | ||
23 | } | ||
24 | |||
15 | public void Start(OpenSim.Region.Environment.Scenes.Scene _World, string FullScriptID) | 25 | public void Start(OpenSim.Region.Environment.Scenes.Scene _World, string FullScriptID) |
16 | { | 26 | { |
17 | World = _World; | 27 | World = _World; |
18 | Console.WriteLine("ScriptEngine", "LSL_BaseClass.Start() called. FullScriptID: " + FullScriptID); | 28 | MainLog.Instance.Notice( "ScriptEngine", "LSL_BaseClass.Start() called. FullScriptID: " + FullScriptID + ": Hosted by [" + m_host.Name + ":" + m_host.UUID + "@"+m_host.AbsolutePosition +"]"); |
19 | 29 | ||
20 | return; | 30 | return; |
21 | } | 31 | } |
@@ -59,8 +69,14 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL | |||
59 | //Common.SendToDebug("INTERNAL FUNCTION llSay(" + (int)channelID + ", \"" + (string)text + "\");"); | 69 | //Common.SendToDebug("INTERNAL FUNCTION llSay(" + (int)channelID + ", \"" + (string)text + "\");"); |
60 | Console.WriteLine("llSay Channel " + channelID + ", Text: \"" + text + "\""); | 70 | Console.WriteLine("llSay Channel " + channelID + ", Text: \"" + text + "\""); |
61 | //type for say is 1 | 71 | //type for say is 1 |
62 | //World.SimChat(enc.GetBytes(text), 1, World.Objects[World.ConvertLocalIDToFullID(MY_OBJECT_ID)], MY_OBJECT_NAME, World.Objects[World.ConvertLocalIDToFullID(MY_OBJECT_ID)]); | 72 | |
73 | LLVector3 fromPos = m_host.AbsolutePosition; // Position of parent | ||
74 | string fromName = m_host.Name; // Name of script parent | ||
75 | LLUUID fromUUID = m_host.UUID; // UUID of parent | ||
76 | |||
77 | World.SimChat( Helpers.StringToField( text ), 1, fromPos, fromName, fromUUID ); | ||
63 | } | 78 | } |
79 | |||
64 | public void llShout(int channelID, string text) | 80 | public void llShout(int channelID, string text) |
65 | { | 81 | { |
66 | Console.WriteLine("llShout Channel " + channelID + ", Text: \"" + text + "\""); | 82 | Console.WriteLine("llShout Channel " + channelID + ", Text: \"" + text + "\""); |
@@ -68,6 +84,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL | |||
68 | //World.SimChat(enc.GetBytes(text), 2, World.Objects[World.ConvertLocalIDToFullID(MY_OBJECT_ID)], MY_OBJECT_NAME, World.Objects[World.ConvertLocalIDToFullID(MY_OBJECT_ID)]); | 84 | //World.SimChat(enc.GetBytes(text), 2, World.Objects[World.ConvertLocalIDToFullID(MY_OBJECT_ID)], MY_OBJECT_NAME, World.Objects[World.ConvertLocalIDToFullID(MY_OBJECT_ID)]); |
69 | 85 | ||
70 | } | 86 | } |
87 | |||
71 | public int llListen(int channelID, string name, string ID, string msg) { return 0; } | 88 | public int llListen(int channelID, string name, string ID, string msg) { return 0; } |
72 | public void llListenControl(int number, int active) { return; } | 89 | public void llListenControl(int number, int active) { return; } |
73 | public void llListenRemove(int number) { return; } | 90 | public void llListenRemove(int number) { return; } |
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs index 2de4e62..8b5e3e3 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs | |||
@@ -31,6 +31,7 @@ using System.Collections.Generic; | |||
31 | using System.Text; | 31 | using System.Text; |
32 | using System.Threading; | 32 | using System.Threading; |
33 | using System.Reflection; | 33 | using System.Reflection; |
34 | using OpenSim.Region.Environment.Scenes.Scripting; | ||
34 | 35 | ||
35 | namespace OpenSim.Region.ScriptEngine.DotNetEngine | 36 | namespace OpenSim.Region.ScriptEngine.DotNetEngine |
36 | { | 37 | { |
@@ -148,10 +149,11 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
148 | // * Find next available AppDomain to put it in | 149 | // * Find next available AppDomain to put it in |
149 | AppDomain FreeAppDomain = GetFreeAppDomain(); | 150 | AppDomain FreeAppDomain = GetFreeAppDomain(); |
150 | 151 | ||
151 | // * Load and start script | 152 | // * Load and start script, for now with dummy host |
153 | |||
152 | //OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO.LSL_BaseClass Script = LoadAndInitAssembly(FreeAppDomain, FileName); | 154 | //OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO.LSL_BaseClass Script = LoadAndInitAssembly(FreeAppDomain, FileName); |
153 | OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass Script = LoadAndInitAssembly(FreeAppDomain, FileName); | 155 | OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass Script = LoadAndInitAssembly(FreeAppDomain, FileName, new NullScriptHost() ); |
154 | string FullScriptID = ScriptID + "." + ObjectID; | 156 | string FullScriptID = ScriptID + "." + ObjectID; |
155 | // Add it to our temporary active script keeper | 157 | // Add it to our temporary active script keeper |
156 | //Scripts.Add(FullScriptID, Script); | 158 | //Scripts.Add(FullScriptID, Script); |
157 | SetScript(ObjectID, ScriptID, Script); | 159 | SetScript(ObjectID, ScriptID, Script); |
@@ -161,6 +163,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
161 | 163 | ||
162 | // Start the script - giving it BuiltIns | 164 | // Start the script - giving it BuiltIns |
163 | //myScriptEngine.m_logger.Verbose("ScriptEngine", "ScriptManager initializing script, handing over private builtin command interface"); | 165 | //myScriptEngine.m_logger.Verbose("ScriptEngine", "ScriptManager initializing script, handing over private builtin command interface"); |
166 | |||
164 | Script.Start(myScriptEngine.World, ScriptID); | 167 | Script.Start(myScriptEngine.World, ScriptID); |
165 | 168 | ||
166 | } | 169 | } |
@@ -189,7 +192,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
189 | /// <param name="FreeAppDomain">AppDomain to load script into</param> | 192 | /// <param name="FreeAppDomain">AppDomain to load script into</param> |
190 | /// <param name="FileName">FileName of script assembly (.dll)</param> | 193 | /// <param name="FileName">FileName of script assembly (.dll)</param> |
191 | /// <returns></returns> | 194 | /// <returns></returns> |
192 | private OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass LoadAndInitAssembly(AppDomain FreeAppDomain, string FileName) | 195 | private OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass LoadAndInitAssembly(AppDomain FreeAppDomain, string FileName, IScriptHost host) |
193 | { | 196 | { |
194 | //myScriptEngine.m_logger.Verbose("ScriptEngine", "ScriptManager Loading Assembly " + FileName); | 197 | //myScriptEngine.m_logger.Verbose("ScriptEngine", "ScriptManager Loading Assembly " + FileName); |
195 | // Load .Net Assembly (.dll) | 198 | // Load .Net Assembly (.dll) |
@@ -228,7 +231,9 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
228 | //{ | 231 | //{ |
229 | //} | 232 | //} |
230 | 233 | ||
231 | return (OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass)Activator.CreateInstance(t); | 234 | object[] args = new object[] { host }; |
235 | |||
236 | return (OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass)Activator.CreateInstance(t, args ); | ||
232 | 237 | ||
233 | 238 | ||
234 | } | 239 | } |
diff --git a/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs b/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs index dede5ea..b5e9e1c 100644 --- a/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs +++ b/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs | |||
@@ -253,7 +253,7 @@ namespace OpenSim.DataStore.MonoSqliteStorage | |||
253 | // of sucks. No idea if there is a shortcut here or not. | 253 | // of sucks. No idea if there is a shortcut here or not. |
254 | prim.ParentID = Convert.ToUInt32(row["ParentID"]); | 254 | prim.ParentID = Convert.ToUInt32(row["ParentID"]); |
255 | prim.CreationDate = Convert.ToInt32(row["CreationDate"]); | 255 | prim.CreationDate = Convert.ToInt32(row["CreationDate"]); |
256 | prim.PartName = (String)row["Name"]; | 256 | prim.Name = (String)row["Name"]; |
257 | // various text fields | 257 | // various text fields |
258 | prim.Text = (String)row["Text"]; | 258 | prim.Text = (String)row["Text"]; |
259 | prim.Description = (String)row["Description"]; | 259 | prim.Description = (String)row["Description"]; |
@@ -311,7 +311,7 @@ namespace OpenSim.DataStore.MonoSqliteStorage | |||
311 | row["UUID"] = prim.UUID; | 311 | row["UUID"] = prim.UUID; |
312 | row["ParentID"] = prim.ParentID; | 312 | row["ParentID"] = prim.ParentID; |
313 | row["CreationDate"] = prim.CreationDate; | 313 | row["CreationDate"] = prim.CreationDate; |
314 | row["Name"] = prim.PartName; | 314 | row["Name"] = prim.Name; |
315 | row["SceneGroupID"] = sceneGroupID; // the UUID of the root part for this SceneObjectGroup | 315 | row["SceneGroupID"] = sceneGroupID; // the UUID of the root part for this SceneObjectGroup |
316 | // various text fields | 316 | // various text fields |
317 | row["Text"] = prim.Text; | 317 | row["Text"] = prim.Text; |