diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Framework/General/NpcClientBase.cs | 125 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs | 3 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.cs | 4 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/ScenePresence.cs | 7 | ||||
-rw-r--r-- | OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs | 174 | ||||
-rw-r--r-- | OpenSim/Region/Examples/SimpleApp/MyWorld.cs | 27 | ||||
-rw-r--r-- | OpenSim/Region/Examples/SimpleApp/Program.cs | 25 |
7 files changed, 350 insertions, 15 deletions
diff --git a/OpenSim/Framework/General/NpcClientBase.cs b/OpenSim/Framework/General/NpcClientBase.cs new file mode 100644 index 0000000..2fe3eed --- /dev/null +++ b/OpenSim/Framework/General/NpcClientBase.cs | |||
@@ -0,0 +1,125 @@ | |||
1 | using System.Collections.Generic; | ||
2 | using System.Net; | ||
3 | using OpenSim.Framework.Interfaces; | ||
4 | using OpenSim.Framework.Types; | ||
5 | using OpenSim.Framework.Data; | ||
6 | using libsecondlife; | ||
7 | using libsecondlife.Packets; | ||
8 | |||
9 | |||
10 | namespace OpenSim.Framework | ||
11 | { | ||
12 | public class NpcClientBase :IClientAPI | ||
13 | { | ||
14 | public event ImprovedInstantMessage OnInstantMessage; | ||
15 | public event ChatFromViewer OnChatFromViewer; | ||
16 | public event RezObject OnRezObject; | ||
17 | public event ModifyTerrain OnModifyTerrain; | ||
18 | public event SetAppearance OnSetAppearance; | ||
19 | public event StartAnim OnStartAnim; | ||
20 | public event LinkObjects OnLinkObjects; | ||
21 | public event RequestMapBlocks OnRequestMapBlocks; | ||
22 | public event TeleportLocationRequest OnTeleportLocationRequest; | ||
23 | |||
24 | public event GenericCall4 OnDeRezObject; | ||
25 | public event GenericCall OnRegionHandShakeReply; | ||
26 | public event GenericCall OnRequestWearables; | ||
27 | public event GenericCall2 OnCompleteMovementToRegion; | ||
28 | public event UpdateAgent OnAgentUpdate; | ||
29 | public event GenericCall OnRequestAvatarsData; | ||
30 | public event AddNewPrim OnAddPrim; | ||
31 | public event ObjectDuplicate OnObjectDuplicate; | ||
32 | public event UpdateVector OnGrapObject; | ||
33 | public event ObjectSelect OnDeGrapObject; | ||
34 | public event MoveObject OnGrapUpdate; | ||
35 | |||
36 | public event UpdateShape OnUpdatePrimShape; | ||
37 | public event ObjectSelect OnObjectSelect; | ||
38 | public event GenericCall7 OnObjectDescription; | ||
39 | public event GenericCall7 OnObjectName; | ||
40 | public event UpdatePrimFlags OnUpdatePrimFlags; | ||
41 | public event UpdatePrimTexture OnUpdatePrimTexture; | ||
42 | public event UpdateVector OnUpdatePrimGroupPosition; | ||
43 | public event UpdateVector OnUpdatePrimSinglePosition; | ||
44 | public event UpdatePrimRotation OnUpdatePrimGroupRotation; | ||
45 | public event UpdatePrimSingleRotation OnUpdatePrimSingleRotation; | ||
46 | public event UpdatePrimGroupRotation OnUpdatePrimGroupMouseRotation; | ||
47 | public event UpdateVector OnUpdatePrimScale; | ||
48 | public event StatusChange OnChildAgentStatus; | ||
49 | public event GenericCall2 OnStopMovement; | ||
50 | public event NewAvatar OnNewAvatar; | ||
51 | public event GenericCall6 OnRemoveAvatar; | ||
52 | |||
53 | public event UUIDNameRequest OnNameFromUUIDRequest; | ||
54 | |||
55 | public event ParcelPropertiesRequest OnParcelPropertiesRequest; | ||
56 | public event ParcelDivideRequest OnParcelDivideRequest; | ||
57 | public event ParcelJoinRequest OnParcelJoinRequest; | ||
58 | public event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest; | ||
59 | public event ParcelSelectObjects OnParcelSelectObjects; | ||
60 | |||
61 | |||
62 | public event EstateOwnerMessageRequest OnEstateOwnerMessage; | ||
63 | |||
64 | public virtual LLVector3 StartPos | ||
65 | { | ||
66 | get { return new LLVector3(); } | ||
67 | set { } | ||
68 | } | ||
69 | |||
70 | public virtual LLUUID AgentId | ||
71 | { | ||
72 | get { return LLUUID.Random(); } | ||
73 | } | ||
74 | |||
75 | public virtual string FirstName | ||
76 | { | ||
77 | get { return ""; } | ||
78 | } | ||
79 | |||
80 | public virtual string LastName | ||
81 | { | ||
82 | get { return ""; } | ||
83 | } | ||
84 | |||
85 | public NpcClientBase() | ||
86 | { | ||
87 | } | ||
88 | |||
89 | public virtual void OutPacket(Packet newPack){} | ||
90 | public virtual void SendWearables(AvatarWearable[] wearables){} | ||
91 | public virtual void SendStartPingCheck(byte seq){} | ||
92 | public virtual void SendKillObject(ulong regionHandle, uint avatarLocalID){} | ||
93 | public virtual void SendAnimation(LLUUID animID, int seq, LLUUID sourceAgentId){} | ||
94 | public virtual void SendRegionHandshake(RegionInfo regionInfo){} | ||
95 | public virtual void SendChatMessage(string message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID){} | ||
96 | public virtual void SendChatMessage(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID){} | ||
97 | public virtual void SendInstantMessage(string message, LLUUID target, string fromName){} | ||
98 | public virtual void SendLayerData(float[] map){} | ||
99 | public virtual void SendLayerData(int px, int py, float[] map){} | ||
100 | public virtual void MoveAgentIntoRegion(RegionInfo regInfo, LLVector3 pos, LLVector3 look){} | ||
101 | public virtual void InformClientOfNeighbour(ulong neighbourHandle, IPEndPoint neighbourExternalEndPoint){} | ||
102 | public virtual AgentCircuitData RequestClientInfo() { return new AgentCircuitData(); } | ||
103 | public virtual void CrossRegion(ulong newRegionHandle, LLVector3 pos, LLVector3 lookAt, IPEndPoint newRegionExternalEndPoint){} | ||
104 | public virtual void SendMapBlock(List<MapBlockData> mapBlocks){} | ||
105 | public virtual void SendLocalTeleport(LLVector3 position, LLVector3 lookAt, uint flags){} | ||
106 | public virtual void SendRegionTeleport(ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint, uint locationID, uint flags){} | ||
107 | public virtual void SendTeleportCancel(){} | ||
108 | public virtual void SendTeleportLocationStart(){} | ||
109 | public virtual void SendMoneyBalance(LLUUID transaction, bool success, byte[] description, int balance){} | ||
110 | |||
111 | public virtual void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID, uint avatarLocalID, LLVector3 Pos, byte[] textureEntry){} | ||
112 | public virtual void SendAvatarTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLVector3 velocity){} | ||
113 | |||
114 | public virtual void AttachObject(uint localID, LLQuaternion rotation, byte attachPoint){} | ||
115 | public virtual void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimData primData, LLVector3 pos, LLQuaternion rotation, LLUUID textureID, uint flags){} | ||
116 | public virtual void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimData primData, LLVector3 pos, LLUUID textureID, uint flags){} | ||
117 | public virtual void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, LLVector3 pos, LLQuaternion rotation, uint flags, LLUUID objectID, LLUUID ownerID, string text, uint parentID){} | ||
118 | public virtual void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, LLVector3 pos, uint flags, LLUUID objectID, LLUUID ownerID, string text, uint parentID){} | ||
119 | public virtual void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLQuaternion rotation){} | ||
120 | |||
121 | public virtual void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List<InventoryItemBase> items){} | ||
122 | public virtual void SendInventoryItemDetails(LLUUID ownerID, LLUUID folderID, InventoryItemBase item){} | ||
123 | public virtual void SendNameReply(LLUUID profileId, string firstname, string lastname){} | ||
124 | } | ||
125 | } | ||
diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs index 1445edf..6431bc7 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs | |||
@@ -139,8 +139,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
139 | /// <param name="fromAgentID"></param> | 139 | /// <param name="fromAgentID"></param> |
140 | public void SimChat(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID) | 140 | public void SimChat(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID) |
141 | { | 141 | { |
142 | // Console.WriteLine("Chat message"); | 142 | ScenePresence avatar = null; |
143 | ScenePresence avatar = null; | ||
144 | if (this.Avatars.ContainsKey(fromAgentID)) | 143 | if (this.Avatars.ContainsKey(fromAgentID)) |
145 | { | 144 | { |
146 | avatar = this.Avatars[fromAgentID]; | 145 | avatar = this.Avatars[fromAgentID]; |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index a06679a..bb9fa61 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -55,8 +55,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
55 | protected Timer m_heartbeatTimer = new Timer(); | 55 | protected Timer m_heartbeatTimer = new Timer(); |
56 | protected Dictionary<LLUUID, ScenePresence> Avatars; | 56 | protected Dictionary<LLUUID, ScenePresence> Avatars; |
57 | protected Dictionary<LLUUID, SceneObject> Prims; | 57 | protected Dictionary<LLUUID, SceneObject> Prims; |
58 | private PhysicsScene phyScene; | 58 | protected PhysicsScene phyScene; |
59 | private float timeStep = 0.1f; | 59 | protected float timeStep = 0.1f; |
60 | private Random Rand = new Random(); | 60 | private Random Rand = new Random(); |
61 | private uint _primCount = 702000; | 61 | private uint _primCount = 702000; |
62 | private System.Threading.Mutex _primAllocateMutex = new Mutex(false); | 62 | private System.Threading.Mutex _primAllocateMutex = new Mutex(false); |
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index 6966989..3558ca3 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs | |||
@@ -57,7 +57,10 @@ namespace OpenSim.Region.Environment.Scenes | |||
57 | private byte[] visualParams; | 57 | private byte[] visualParams; |
58 | private AvatarWearable[] Wearables; | 58 | private AvatarWearable[] Wearables; |
59 | private ulong m_regionHandle; | 59 | private ulong m_regionHandle; |
60 | private bool childAgent = false; | 60 | |
61 | public bool childAgent = false; | ||
62 | public bool IsRestrictedToRegion = false; | ||
63 | |||
61 | private bool newForce = false; | 64 | private bool newForce = false; |
62 | private bool newAvatar = false; | 65 | private bool newAvatar = false; |
63 | private IScenePresenceBody m_body; | 66 | private IScenePresenceBody m_body; |
@@ -72,7 +75,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
72 | DIR_CONTROL_FLAG_LEFT = MainAvatar.ControlFlags.AGENT_CONTROL_LEFT_POS, | 75 | DIR_CONTROL_FLAG_LEFT = MainAvatar.ControlFlags.AGENT_CONTROL_LEFT_POS, |
73 | DIR_CONTROL_FLAG_RIGHT = MainAvatar.ControlFlags.AGENT_CONTROL_LEFT_NEG, | 76 | DIR_CONTROL_FLAG_RIGHT = MainAvatar.ControlFlags.AGENT_CONTROL_LEFT_NEG, |
74 | DIR_CONTROL_FLAG_UP = MainAvatar.ControlFlags.AGENT_CONTROL_UP_POS, | 77 | DIR_CONTROL_FLAG_UP = MainAvatar.ControlFlags.AGENT_CONTROL_UP_POS, |
75 | DIR_CONTROL_FLAG_DOWN = MainAvatar.ControlFlags.AGENT_CONTROL_UP_NEG | 78 | DIR_CONTROL_FLAG_DOWN = MainAvatar.ControlFlags.AGENT_CONTROL_AT_NEG |
76 | } | 79 | } |
77 | /// <summary> | 80 | /// <summary> |
78 | /// Position at which a significant movement was made | 81 | /// Position at which a significant movement was made |
diff --git a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs new file mode 100644 index 0000000..1c267c6 --- /dev/null +++ b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs | |||
@@ -0,0 +1,174 @@ | |||
1 | using System.Collections.Generic; | ||
2 | using System.Net; | ||
3 | using System.Timers; | ||
4 | using System; | ||
5 | using System.Text; | ||
6 | |||
7 | using libsecondlife; | ||
8 | using libsecondlife.Packets; | ||
9 | |||
10 | using OpenSim.Framework; | ||
11 | using OpenSim.Framework.Interfaces; | ||
12 | using OpenSim.Framework.Types; | ||
13 | using OpenSim.Framework.Data; | ||
14 | using OpenSim.Framework.Utilities; | ||
15 | |||
16 | namespace SimpleApp | ||
17 | { | ||
18 | public class MyNpcCharacter : IClientAPI | ||
19 | { | ||
20 | private uint movementDirection = 0; | ||
21 | private bool fly = true; | ||
22 | private LLQuaternion bodyDirection = LLQuaternion.Identity; | ||
23 | |||
24 | public event ImprovedInstantMessage OnInstantMessage; | ||
25 | public event ChatFromViewer OnChatFromViewer; | ||
26 | public event RezObject OnRezObject; | ||
27 | public event ModifyTerrain OnModifyTerrain; | ||
28 | public event SetAppearance OnSetAppearance; | ||
29 | public event StartAnim OnStartAnim; | ||
30 | public event LinkObjects OnLinkObjects; | ||
31 | public event RequestMapBlocks OnRequestMapBlocks; | ||
32 | public event TeleportLocationRequest OnTeleportLocationRequest; | ||
33 | |||
34 | public event GenericCall4 OnDeRezObject; | ||
35 | public event GenericCall OnRegionHandShakeReply; | ||
36 | public event GenericCall OnRequestWearables; | ||
37 | public event GenericCall2 OnCompleteMovementToRegion; | ||
38 | public event UpdateAgent OnAgentUpdate; | ||
39 | public event GenericCall OnRequestAvatarsData; | ||
40 | public event AddNewPrim OnAddPrim; | ||
41 | public event ObjectDuplicate OnObjectDuplicate; | ||
42 | public event UpdateVector OnGrapObject; | ||
43 | public event ObjectSelect OnDeGrapObject; | ||
44 | public event MoveObject OnGrapUpdate; | ||
45 | |||
46 | public event UpdateShape OnUpdatePrimShape; | ||
47 | public event ObjectSelect OnObjectSelect; | ||
48 | public event GenericCall7 OnObjectDescription; | ||
49 | public event GenericCall7 OnObjectName; | ||
50 | public event UpdatePrimFlags OnUpdatePrimFlags; | ||
51 | public event UpdatePrimTexture OnUpdatePrimTexture; | ||
52 | public event UpdateVector OnUpdatePrimGroupPosition; | ||
53 | public event UpdateVector OnUpdatePrimSinglePosition; | ||
54 | public event UpdatePrimRotation OnUpdatePrimGroupRotation; | ||
55 | public event UpdatePrimSingleRotation OnUpdatePrimSingleRotation; | ||
56 | public event UpdatePrimGroupRotation OnUpdatePrimGroupMouseRotation; | ||
57 | public event UpdateVector OnUpdatePrimScale; | ||
58 | public event StatusChange OnChildAgentStatus; | ||
59 | public event GenericCall2 OnStopMovement; | ||
60 | public event NewAvatar OnNewAvatar; | ||
61 | public event GenericCall6 OnRemoveAvatar; | ||
62 | |||
63 | public event UUIDNameRequest OnNameFromUUIDRequest; | ||
64 | |||
65 | public event ParcelPropertiesRequest OnParcelPropertiesRequest; | ||
66 | public event ParcelDivideRequest OnParcelDivideRequest; | ||
67 | public event ParcelJoinRequest OnParcelJoinRequest; | ||
68 | public event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest; | ||
69 | |||
70 | public event ParcelSelectObjects OnParcelSelectObjects; | ||
71 | |||
72 | public event EstateOwnerMessageRequest OnEstateOwnerMessage; | ||
73 | |||
74 | private LLUUID myID = LLUUID.Random(); | ||
75 | public MyNpcCharacter() | ||
76 | { | ||
77 | |||
78 | } | ||
79 | |||
80 | public virtual LLVector3 StartPos | ||
81 | { | ||
82 | get { return new LLVector3(128, 100, 2); } | ||
83 | set { } | ||
84 | } | ||
85 | |||
86 | public virtual LLUUID AgentId | ||
87 | { | ||
88 | get { return myID; } | ||
89 | } | ||
90 | |||
91 | public virtual string FirstName | ||
92 | { | ||
93 | get { return "Annoying"; } | ||
94 | } | ||
95 | |||
96 | public virtual string LastName | ||
97 | { | ||
98 | get { return "NPC"; } | ||
99 | } | ||
100 | |||
101 | public virtual void OutPacket(Packet newPack) { } | ||
102 | public virtual void SendWearables(AvatarWearable[] wearables) { } | ||
103 | public virtual void SendStartPingCheck(byte seq) { } | ||
104 | public virtual void SendKillObject(ulong regionHandle, uint avatarLocalID) { } | ||
105 | public virtual void SendAnimation(LLUUID animID, int seq, LLUUID sourceAgentId) { } | ||
106 | public virtual void SendChatMessage(string message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID) { } | ||
107 | public virtual void SendChatMessage(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID) { } | ||
108 | public virtual void SendInstantMessage(string message, LLUUID target, string fromName) { } | ||
109 | public virtual void SendLayerData(float[] map) { } | ||
110 | public virtual void SendLayerData(int px, int py, float[] map) { } | ||
111 | public virtual void MoveAgentIntoRegion(RegionInfo regInfo, LLVector3 pos, LLVector3 look) { } | ||
112 | public virtual void InformClientOfNeighbour(ulong neighbourHandle, IPEndPoint neighbourExternalEndPoint) { } | ||
113 | public virtual AgentCircuitData RequestClientInfo() { return new AgentCircuitData(); } | ||
114 | public virtual void CrossRegion(ulong newRegionHandle, LLVector3 pos, LLVector3 lookAt, IPEndPoint newRegionExternalEndPoint) { } | ||
115 | public virtual void SendMapBlock(List<MapBlockData> mapBlocks) { } | ||
116 | public virtual void SendLocalTeleport(LLVector3 position, LLVector3 lookAt, uint flags) { } | ||
117 | public virtual void SendRegionTeleport(ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint, uint locationID, uint flags) { } | ||
118 | public virtual void SendTeleportCancel() { } | ||
119 | public virtual void SendTeleportLocationStart() { } | ||
120 | public virtual void SendMoneyBalance(LLUUID transaction, bool success, byte[] description, int balance) { } | ||
121 | |||
122 | public virtual void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID, uint avatarLocalID, LLVector3 Pos, byte[] textureEntry) { } | ||
123 | public virtual void SendAvatarTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLVector3 velocity) { } | ||
124 | |||
125 | public virtual void AttachObject(uint localID, LLQuaternion rotation, byte attachPoint) { } | ||
126 | public virtual void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimData primData, LLVector3 pos, LLQuaternion rotation, LLUUID textureID, uint flags) { } | ||
127 | public virtual void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimData primData, LLVector3 pos, LLUUID textureID, uint flags) { } | ||
128 | public virtual void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, LLVector3 pos, LLQuaternion rotation, uint flags, LLUUID objectID, LLUUID ownerID, string text, uint parentID) { } | ||
129 | public virtual void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, LLVector3 pos, uint flags, LLUUID objectID, LLUUID ownerID, string text, uint parentID) { } | ||
130 | public virtual void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLQuaternion rotation) { } | ||
131 | |||
132 | public virtual void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List<InventoryItemBase> items) { } | ||
133 | public virtual void SendInventoryItemDetails(LLUUID ownerID, LLUUID folderID, InventoryItemBase item) { } | ||
134 | public virtual void SendNameReply(LLUUID profileId, string firstname, string lastname) { } | ||
135 | |||
136 | public virtual void SendRegionHandshake(RegionInfo regionInfo) | ||
137 | { | ||
138 | this.OnRegionHandShakeReply(this); | ||
139 | this.OnCompleteMovementToRegion(); | ||
140 | this.StartMovement(); | ||
141 | } | ||
142 | |||
143 | public void StartMovement() | ||
144 | { | ||
145 | Timer timer = new Timer(); | ||
146 | timer.Enabled = true; | ||
147 | timer.Interval = 10000; | ||
148 | timer.Elapsed += new ElapsedEventHandler(this.Heartbeat); | ||
149 | } | ||
150 | |||
151 | public void Heartbeat(object sender, EventArgs e) | ||
152 | { | ||
153 | |||
154 | Encoding enc = Encoding.ASCII; | ||
155 | |||
156 | this.OnAgentUpdate(this, movementDirection, bodyDirection); | ||
157 | |||
158 | if (this.fly) | ||
159 | { | ||
160 | movementDirection = (uint)MainAvatar.ControlFlags.AGENT_CONTROL_FLY | (uint)MainAvatar.ControlFlags.AGENT_CONTROL_UP_NEG; | ||
161 | fly = false; | ||
162 | } | ||
163 | else | ||
164 | { | ||
165 | movementDirection = (uint)MainAvatar.ControlFlags.AGENT_CONTROL_FLY | (uint)MainAvatar.ControlFlags.AGENT_CONTROL_UP_POS; | ||
166 | fly = true; | ||
167 | } | ||
168 | |||
169 | this.OnChatFromViewer(enc.GetBytes("Kind of quiet around here isn't it! \0"), 2, new LLVector3(128, 128, 26), this.FirstName + " " + this.LastName, this.AgentId); | ||
170 | |||
171 | |||
172 | } | ||
173 | } | ||
174 | } | ||
diff --git a/OpenSim/Region/Examples/SimpleApp/MyWorld.cs b/OpenSim/Region/Examples/SimpleApp/MyWorld.cs index 777d4ae..29b255b 100644 --- a/OpenSim/Region/Examples/SimpleApp/MyWorld.cs +++ b/OpenSim/Region/Examples/SimpleApp/MyWorld.cs | |||
@@ -47,14 +47,15 @@ namespace SimpleApp | |||
47 | LLVector3 pos = new LLVector3(128, 128, 128); | 47 | LLVector3 pos = new LLVector3(128, 128, 128); |
48 | 48 | ||
49 | client.OnRegionHandShakeReply += SendLayerData; | 49 | client.OnRegionHandShakeReply += SendLayerData; |
50 | client.OnChatFromViewer += | 50 | /*client.OnChatFromViewer += |
51 | delegate(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID) | 51 | delegate(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID) |
52 | { | 52 | { |
53 | // Echo it (so you know what you typed) | 53 | // Echo it (so you know what you typed) |
54 | client.SendChatMessage(message, type, fromPos, fromName, fromAgentID); | 54 | client.SendChatMessage(message, type, fromPos, fromName, fromAgentID); |
55 | client.SendChatMessage("Ready.", 1, pos, "System", LLUUID.Zero ); | 55 | client.SendChatMessage("Ready.", 1, pos, "System", LLUUID.Zero ); |
56 | }; | 56 | }; |
57 | 57 | */ | |
58 | client.OnChatFromViewer += this.SimChat; | ||
58 | client.OnAddPrim += AddNewPrim; | 59 | client.OnAddPrim += AddNewPrim; |
59 | client.OnUpdatePrimGroupPosition += this.UpdatePrimPosition; | 60 | client.OnUpdatePrimGroupPosition += this.UpdatePrimPosition; |
60 | client.OnRequestMapBlocks += this.RequestMapBlocks; | 61 | client.OnRequestMapBlocks += this.RequestMapBlocks; |
@@ -70,9 +71,27 @@ namespace SimpleApp | |||
70 | client.SendRegionHandshake(m_regInfo); | 71 | client.SendRegionHandshake(m_regInfo); |
71 | 72 | ||
72 | ScenePresence avatar = CreateAndAddScenePresence(client); | 73 | ScenePresence avatar = CreateAndAddScenePresence(client); |
73 | avatar.Pos = new LLVector3(128, 128, 26); | 74 | avatar.Pos = new LLVector3(128, 128, 26); |
74 | } | 75 | } |
75 | 76 | ||
77 | public override void Update() | ||
78 | { | ||
79 | foreach (LLUUID UUID in Entities.Keys) | ||
80 | { | ||
81 | Entities[UUID].updateMovement(); | ||
82 | } | ||
83 | |||
84 | lock (this.m_syncRoot) | ||
85 | { | ||
86 | this.phyScene.Simulate(timeStep); | ||
87 | } | ||
88 | |||
89 | foreach (LLUUID UUID in Entities.Keys) | ||
90 | { | ||
91 | Entities[UUID].update(); | ||
92 | } | ||
93 | } | ||
94 | |||
76 | #endregion | 95 | #endregion |
77 | } | 96 | } |
78 | } | 97 | } |
diff --git a/OpenSim/Region/Examples/SimpleApp/Program.cs b/OpenSim/Region/Examples/SimpleApp/Program.cs index 82a62a3..0c688ba 100644 --- a/OpenSim/Region/Examples/SimpleApp/Program.cs +++ b/OpenSim/Region/Examples/SimpleApp/Program.cs | |||
@@ -15,6 +15,7 @@ using OpenSim.Region.Communications.Local; | |||
15 | using OpenSim.Region.GridInterfaces.Local; | 15 | using OpenSim.Region.GridInterfaces.Local; |
16 | using System.Timers; | 16 | using System.Timers; |
17 | using OpenSim.Region.Environment.Scenes; | 17 | using OpenSim.Region.Environment.Scenes; |
18 | using OpenSim.Framework.Data; | ||
18 | 19 | ||
19 | namespace SimpleApp | 20 | namespace SimpleApp |
20 | { | 21 | { |
@@ -25,6 +26,7 @@ namespace SimpleApp | |||
25 | uint m_localId; | 26 | uint m_localId; |
26 | public MyWorld world; | 27 | public MyWorld world; |
27 | private SceneObject m_sceneObject; | 28 | private SceneObject m_sceneObject; |
29 | public MyNpcCharacter m_character; | ||
28 | 30 | ||
29 | private void Run() | 31 | private void Run() |
30 | { | 32 | { |
@@ -65,22 +67,35 @@ namespace SimpleApp | |||
65 | world.PhysScene = physManager.GetPhysicsScene("basicphysics"); //PhysicsScene.Null; | 67 | world.PhysScene = physManager.GetPhysicsScene("basicphysics"); //PhysicsScene.Null; |
66 | 68 | ||
67 | world.LoadWorldMap(); | 69 | world.LoadWorldMap(); |
68 | world.ParcelManager.NoParcelDataFromStorage(); | 70 | world.PhysScene.SetTerrain(world.Terrain.getHeights1D()); |
69 | 71 | ||
70 | udpServer.LocalWorld = world; | 72 | udpServer.LocalWorld = world; |
71 | 73 | ||
72 | httpServer.Start(); | 74 | httpServer.Start(); |
73 | udpServer.ServerListener(); | 75 | udpServer.ServerListener(); |
74 | 76 | ||
77 | UserProfileData masterAvatar = communicationsManager.UserServer.SetupMasterUser("Test", "User", "test"); | ||
78 | if (masterAvatar != null) | ||
79 | { | ||
80 | world.RegionInfo.MasterAvatarAssignedUUID = masterAvatar.UUID; | ||
81 | world.ParcelManager.NoParcelDataFromStorage(); | ||
82 | } | ||
83 | |||
75 | PrimitiveBaseShape shape = PrimitiveBaseShape.DefaultBox(); | 84 | PrimitiveBaseShape shape = PrimitiveBaseShape.DefaultBox(); |
76 | shape.Scale = new LLVector3(0.5f, 0.5f, 0.5f); | 85 | shape.Scale = new LLVector3(0.5f, 0.5f, 0.5f); |
77 | LLVector3 pos = new LLVector3(129, 129, 27); | 86 | LLVector3 pos = new LLVector3(138, 129, 27); |
87 | |||
88 | m_sceneObject = new MySceneObject(world, world.EventManager, LLUUID.Zero, world.PrimIDAllocate(), pos, shape); | ||
89 | world.AddNewEntity(m_sceneObject); | ||
90 | |||
91 | m_character = new MyNpcCharacter(); | ||
92 | world.AddNewClient(m_character, false); | ||
93 | |||
94 | world.StartTimer(); | ||
78 | 95 | ||
79 | m_sceneObject = new MySceneObject(world,world.EventManager, LLUUID.Zero, world.PrimIDAllocate(), pos, shape); | ||
80 | world.AddNewEntity(m_sceneObject); | ||
81 | |||
82 | m_log.WriteLine(LogPriority.NORMAL, "Press enter to quit."); | 96 | m_log.WriteLine(LogPriority.NORMAL, "Press enter to quit."); |
83 | m_log.ReadLine(); | 97 | m_log.ReadLine(); |
98 | |||
84 | } | 99 | } |
85 | 100 | ||
86 | #region conscmd_callback Members | 101 | #region conscmd_callback Members |