aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/OptionalModules/World
diff options
context:
space:
mode:
authorDr Scofield2009-02-10 13:10:57 +0000
committerDr Scofield2009-02-10 13:10:57 +0000
commit180be7de07014aa33bc6066f12a0819b731c1c9d (patch)
tree3aa13af3cda4b808fa9453655875327699b61311 /OpenSim/Region/OptionalModules/World
parentStopgap measure: To use gridlaunch, or GUI, start opensim with (diff)
downloadopensim-SC_OLD-180be7de07014aa33bc6066f12a0819b731c1c9d.zip
opensim-SC_OLD-180be7de07014aa33bc6066f12a0819b731c1c9d.tar.gz
opensim-SC_OLD-180be7de07014aa33bc6066f12a0819b731c1c9d.tar.bz2
opensim-SC_OLD-180be7de07014aa33bc6066f12a0819b731c1c9d.tar.xz
this is step 2 of 2 of the OpenSim.Region.Environment refactor.
NOTHING has been deleted or moved off to forge at this point. what has happened is that OpenSim.Region.Environment.Modules has been split in two: - OpenSim.Region.CoreModules: all those modules that are either directly or indirectly referenced from other OpenSim packages, or that provide functionality that the OpenSim developer community considers core functionality: CoreModules/Agent/AssetTransaction CoreModules/Agent/Capabilities CoreModules/Agent/TextureDownload CoreModules/Agent/TextureSender CoreModules/Agent/TextureSender/Tests CoreModules/Agent/Xfer CoreModules/Avatar/AvatarFactory CoreModules/Avatar/Chat/ChatModule CoreModules/Avatar/Combat CoreModules/Avatar/Currency/SampleMoney CoreModules/Avatar/Dialog CoreModules/Avatar/Friends CoreModules/Avatar/Gestures CoreModules/Avatar/Groups CoreModules/Avatar/InstantMessage CoreModules/Avatar/Inventory CoreModules/Avatar/Inventory/Archiver CoreModules/Avatar/Inventory/Transfer CoreModules/Avatar/Lure CoreModules/Avatar/ObjectCaps CoreModules/Avatar/Profiles CoreModules/Communications/Local CoreModules/Communications/REST CoreModules/Framework/EventQueue CoreModules/Framework/InterfaceCommander CoreModules/Hypergrid CoreModules/InterGrid CoreModules/Scripting/DynamicTexture CoreModules/Scripting/EMailModules CoreModules/Scripting/HttpRequest CoreModules/Scripting/LoadImageURL CoreModules/Scripting/VectorRender CoreModules/Scripting/WorldComm CoreModules/Scripting/XMLRPC CoreModules/World/Archiver CoreModules/World/Archiver/Tests CoreModules/World/Estate CoreModules/World/Land CoreModules/World/Permissions CoreModules/World/Serialiser CoreModules/World/Sound CoreModules/World/Sun CoreModules/World/Terrain CoreModules/World/Terrain/DefaultEffects CoreModules/World/Terrain/DefaultEffects/bin CoreModules/World/Terrain/DefaultEffects/bin/Debug CoreModules/World/Terrain/Effects CoreModules/World/Terrain/FileLoaders CoreModules/World/Terrain/FloodBrushes CoreModules/World/Terrain/PaintBrushes CoreModules/World/Terrain/Tests CoreModules/World/Vegetation CoreModules/World/Wind CoreModules/World/WorldMap - OpenSim.Region.OptionalModules: all those modules that are not core modules: OptionalModules/Avatar/Chat/IRC-stuff OptionalModules/Avatar/Concierge OptionalModules/Avatar/Voice/AsterixVoice OptionalModules/Avatar/Voice/SIPVoice OptionalModules/ContentManagementSystem OptionalModules/Grid/Interregion OptionalModules/Python OptionalModules/SvnSerialiser OptionalModules/World/NPC OptionalModules/World/TreePopulator
Diffstat (limited to 'OpenSim/Region/OptionalModules/World')
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs1060
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs68
-rw-r--r--OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs304
3 files changed, 1432 insertions, 0 deletions
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
new file mode 100644
index 0000000..3ba8a97
--- /dev/null
+++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
@@ -0,0 +1,1060 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.Net;
31using OpenMetaverse;
32using OpenMetaverse.Packets;
33using OpenSim.Framework;
34using OpenSim.Region.Framework.Scenes;
35
36namespace OpenSim.Region.OptionalModules.World.NPC
37{
38 public class NPCAvatar : IClientAPI
39 {
40 private readonly string m_firstname;
41 private readonly string m_lastname;
42 private readonly Vector3 m_startPos;
43 private readonly UUID m_uuid = UUID.Random();
44 private readonly Scene m_scene;
45
46
47 public NPCAvatar(string firstname, string lastname, Vector3 position, Scene scene)
48 {
49 m_firstname = firstname;
50 m_lastname = lastname;
51 m_startPos = position;
52 m_scene = scene;
53 }
54
55 public IScene Scene
56 {
57 get { return m_scene; }
58 }
59
60 public void Say(string message)
61 {
62 SendOnChatFromClient(message, ChatTypeEnum.Say);
63 }
64
65 public void Shout(string message)
66 {
67 SendOnChatFromClient(message, ChatTypeEnum.Shout);
68 }
69
70 public void Whisper(string message)
71 {
72 SendOnChatFromClient(message, ChatTypeEnum.Whisper);
73 }
74
75 public void Broadcast(string message)
76 {
77 SendOnChatFromClient(message, ChatTypeEnum.Broadcast);
78 }
79
80 public void GiveMoney(UUID target, int amount)
81 {
82 OnMoneyTransferRequest(m_uuid, target, amount, 1, "Payment");
83 }
84
85 public void InstantMessage(UUID target, string message)
86 {
87 OnInstantMessage(this, new GridInstantMessage(m_scene,
88 m_uuid, m_firstname + " " + m_lastname,
89 target, 0, false, message,
90 UUID.Zero, false, Position, new byte[0]));
91 }
92
93 public void SendAgentOffline(UUID[] agentIDs)
94 {
95
96 }
97
98 public void SendAgentOnline(UUID[] agentIDs)
99 {
100
101 }
102 public void SendSitResponse(UUID TargetID, Vector3 OffsetPos, Quaternion SitOrientation, bool autopilot,
103 Vector3 CameraAtOffset, Vector3 CameraEyeOffset, bool ForceMouseLook)
104 {
105
106 }
107
108 public void SendAdminResponse(UUID Token, uint AdminLevel)
109 {
110
111 }
112
113 public void SendGroupMembership(GroupMembershipData[] GroupMembership)
114 {
115
116 }
117
118 public UUID GetDefaultAnimation(string name)
119 {
120 return UUID.Zero;
121 }
122
123 public Vector3 Position
124 {
125 get { return m_scene.Entities[m_uuid].AbsolutePosition; }
126 set { m_scene.Entities[m_uuid].AbsolutePosition = value; }
127 }
128
129 public bool SendLogoutPacketWhenClosing
130 {
131 set { }
132 }
133
134 #region Internal Functions
135
136 private void SendOnChatFromClient(string message, ChatTypeEnum chatType)
137 {
138 OSChatMessage chatFromClient = new OSChatMessage();
139 chatFromClient.Channel = 0;
140 chatFromClient.From = Name;
141 chatFromClient.Message = message;
142 chatFromClient.Position = StartPos;
143 chatFromClient.Scene = m_scene;
144 chatFromClient.Sender = this;
145 chatFromClient.SenderUUID = AgentId;
146 chatFromClient.Type = chatType;
147
148 OnChatFromClient(this, chatFromClient);
149 }
150
151 #endregion
152
153 #region Event Definitions IGNORE
154
155// disable warning: public events constituting public API
156#pragma warning disable 67
157 public event Action<IClientAPI> OnLogout;
158 public event ObjectPermissions OnObjectPermissions;
159
160 public event MoneyTransferRequest OnMoneyTransferRequest;
161 public event ParcelBuy OnParcelBuy;
162 public event Action<IClientAPI> OnConnectionClosed;
163 public event GenericMessage OnGenericMessage;
164 public event ImprovedInstantMessage OnInstantMessage;
165 public event ChatMessage OnChatFromClient;
166 public event TextureRequest OnRequestTexture;
167 public event RezObject OnRezObject;
168 public event ModifyTerrain OnModifyTerrain;
169 public event SetAppearance OnSetAppearance;
170 public event AvatarNowWearing OnAvatarNowWearing;
171 public event RezSingleAttachmentFromInv OnRezSingleAttachmentFromInv;
172 public event UUIDNameRequest OnDetachAttachmentIntoInv;
173 public event ObjectAttach OnObjectAttach;
174 public event ObjectDeselect OnObjectDetach;
175 public event ObjectDrop OnObjectDrop;
176 public event StartAnim OnStartAnim;
177 public event StopAnim OnStopAnim;
178 public event LinkObjects OnLinkObjects;
179 public event DelinkObjects OnDelinkObjects;
180 public event RequestMapBlocks OnRequestMapBlocks;
181 public event RequestMapName OnMapNameRequest;
182 public event TeleportLocationRequest OnTeleportLocationRequest;
183 public event TeleportLandmarkRequest OnTeleportLandmarkRequest;
184 public event DisconnectUser OnDisconnectUser;
185 public event RequestAvatarProperties OnRequestAvatarProperties;
186 public event SetAlwaysRun OnSetAlwaysRun;
187
188 public event DeRezObject OnDeRezObject;
189 public event Action<IClientAPI> OnRegionHandShakeReply;
190 public event GenericCall2 OnRequestWearables;
191 public event GenericCall2 OnCompleteMovementToRegion;
192 public event UpdateAgent OnAgentUpdate;
193 public event AgentRequestSit OnAgentRequestSit;
194 public event AgentSit OnAgentSit;
195 public event AvatarPickerRequest OnAvatarPickerRequest;
196 public event Action<IClientAPI> OnRequestAvatarsData;
197 public event AddNewPrim OnAddPrim;
198 public event RequestGodlikePowers OnRequestGodlikePowers;
199 public event GodKickUser OnGodKickUser;
200 public event ObjectDuplicate OnObjectDuplicate;
201 public event GrabObject OnGrabObject;
202 public event ObjectSelect OnDeGrabObject;
203 public event MoveObject OnGrabUpdate;
204 public event ViewerEffectEventHandler OnViewerEffect;
205
206 public event FetchInventory OnAgentDataUpdateRequest;
207 public event TeleportLocationRequest OnSetStartLocationRequest;
208
209 public event UpdateShape OnUpdatePrimShape;
210 public event ObjectExtraParams OnUpdateExtraParams;
211 public event RequestObjectPropertiesFamily OnRequestObjectPropertiesFamily;
212 public event ObjectSelect OnObjectSelect;
213 public event GenericCall7 OnObjectDescription;
214 public event GenericCall7 OnObjectName;
215 public event GenericCall7 OnObjectClickAction;
216 public event GenericCall7 OnObjectMaterial;
217 public event UpdatePrimFlags OnUpdatePrimFlags;
218 public event UpdatePrimTexture OnUpdatePrimTexture;
219 public event UpdateVector OnUpdatePrimGroupPosition;
220 public event UpdateVector OnUpdatePrimSinglePosition;
221 public event UpdatePrimRotation OnUpdatePrimGroupRotation;
222 public event UpdatePrimSingleRotation OnUpdatePrimSingleRotation;
223 public event UpdatePrimGroupRotation OnUpdatePrimGroupMouseRotation;
224 public event UpdateVector OnUpdatePrimScale;
225 public event UpdateVector OnUpdatePrimGroupScale;
226 public event StatusChange OnChildAgentStatus;
227 public event GenericCall2 OnStopMovement;
228 public event Action<UUID> OnRemoveAvatar;
229
230 public event CreateNewInventoryItem OnCreateNewInventoryItem;
231 public event CreateInventoryFolder OnCreateNewInventoryFolder;
232 public event UpdateInventoryFolder OnUpdateInventoryFolder;
233 public event MoveInventoryFolder OnMoveInventoryFolder;
234 public event RemoveInventoryFolder OnRemoveInventoryFolder;
235 public event RemoveInventoryItem OnRemoveInventoryItem;
236 public event FetchInventoryDescendents OnFetchInventoryDescendents;
237 public event PurgeInventoryDescendents OnPurgeInventoryDescendents;
238 public event FetchInventory OnFetchInventory;
239 public event RequestTaskInventory OnRequestTaskInventory;
240 public event UpdateInventoryItem OnUpdateInventoryItem;
241 public event CopyInventoryItem OnCopyInventoryItem;
242 public event MoveInventoryItem OnMoveInventoryItem;
243 public event UDPAssetUploadRequest OnAssetUploadRequest;
244 public event XferReceive OnXferReceive;
245 public event RequestXfer OnRequestXfer;
246 public event AbortXfer OnAbortXfer;
247 public event ConfirmXfer OnConfirmXfer;
248 public event RezScript OnRezScript;
249 public event UpdateTaskInventory OnUpdateTaskInventory;
250 public event MoveTaskInventory OnMoveTaskItem;
251 public event RemoveTaskInventory OnRemoveTaskItem;
252 public event RequestAsset OnRequestAsset;
253
254 public event UUIDNameRequest OnNameFromUUIDRequest;
255 public event UUIDNameRequest OnUUIDGroupNameRequest;
256
257 public event ParcelPropertiesRequest OnParcelPropertiesRequest;
258 public event ParcelDivideRequest OnParcelDivideRequest;
259 public event ParcelJoinRequest OnParcelJoinRequest;
260 public event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest;
261 public event ParcelAbandonRequest OnParcelAbandonRequest;
262 public event ParcelGodForceOwner OnParcelGodForceOwner;
263 public event ParcelReclaim OnParcelReclaim;
264 public event ParcelReturnObjectsRequest OnParcelReturnObjectsRequest;
265 public event ParcelAccessListRequest OnParcelAccessListRequest;
266 public event ParcelAccessListUpdateRequest OnParcelAccessListUpdateRequest;
267 public event ParcelSelectObjects OnParcelSelectObjects;
268 public event ParcelObjectOwnerRequest OnParcelObjectOwnerRequest;
269 public event ObjectDeselect OnObjectDeselect;
270 public event RegionInfoRequest OnRegionInfoRequest;
271 public event EstateCovenantRequest OnEstateCovenantRequest;
272 public event RequestTerrain OnRequestTerrain;
273 public event RequestTerrain OnUploadTerrain;
274 public event ObjectDuplicateOnRay OnObjectDuplicateOnRay;
275
276 public event FriendActionDelegate OnApproveFriendRequest;
277 public event FriendActionDelegate OnDenyFriendRequest;
278 public event FriendshipTermination OnTerminateFriendship;
279
280 public event EconomyDataRequest OnEconomyDataRequest;
281 public event MoneyBalanceRequest OnMoneyBalanceRequest;
282 public event UpdateAvatarProperties OnUpdateAvatarProperties;
283
284 public event ObjectIncludeInSearch OnObjectIncludeInSearch;
285 public event UUIDNameRequest OnTeleportHomeRequest;
286
287 public event ScriptAnswer OnScriptAnswer;
288 public event RequestPayPrice OnRequestPayPrice;
289 public event ObjectSaleInfo OnObjectSaleInfo;
290 public event ObjectBuy OnObjectBuy;
291 public event BuyObjectInventory OnBuyObjectInventory;
292 public event AgentSit OnUndo;
293
294 public event ForceReleaseControls OnForceReleaseControls;
295 public event GodLandStatRequest OnLandStatRequest;
296 public event RequestObjectPropertiesFamily OnObjectGroupRequest;
297
298 public event DetailedEstateDataRequest OnDetailedEstateDataRequest;
299 public event SetEstateFlagsRequest OnSetEstateFlagsRequest;
300 public event SetEstateTerrainBaseTexture OnSetEstateTerrainBaseTexture;
301 public event SetEstateTerrainDetailTexture OnSetEstateTerrainDetailTexture;
302 public event SetEstateTerrainTextureHeights OnSetEstateTerrainTextureHeights;
303 public event CommitEstateTerrainTextureRequest OnCommitEstateTerrainTextureRequest;
304 public event SetRegionTerrainSettings OnSetRegionTerrainSettings;
305 public event BakeTerrain OnBakeTerrain;
306 public event EstateRestartSimRequest OnEstateRestartSimRequest;
307 public event EstateChangeCovenantRequest OnEstateChangeCovenantRequest;
308 public event UpdateEstateAccessDeltaRequest OnUpdateEstateAccessDeltaRequest;
309 public event SimulatorBlueBoxMessageRequest OnSimulatorBlueBoxMessageRequest;
310 public event EstateBlueBoxMessageRequest OnEstateBlueBoxMessageRequest;
311 public event EstateDebugRegionRequest OnEstateDebugRegionRequest;
312 public event EstateTeleportOneUserHomeRequest OnEstateTeleportOneUserHomeRequest;
313 public event EstateTeleportAllUsersHomeRequest OnEstateTeleportAllUsersHomeRequest;
314 public event EstateChangeInfo OnEstateChangeInfo;
315 public event ScriptReset OnScriptReset;
316 public event GetScriptRunning OnGetScriptRunning;
317 public event SetScriptRunning OnSetScriptRunning;
318 public event UpdateVector OnAutoPilotGo;
319
320 public event TerrainUnacked OnUnackedTerrain;
321
322 public event RegionHandleRequest OnRegionHandleRequest;
323 public event ParcelInfoRequest OnParcelInfoRequest;
324
325 public event ActivateGesture OnActivateGesture;
326 public event DeactivateGesture OnDeactivateGesture;
327 public event ObjectOwner OnObjectOwner;
328
329 public event DirPlacesQuery OnDirPlacesQuery;
330 public event DirFindQuery OnDirFindQuery;
331 public event DirLandQuery OnDirLandQuery;
332 public event DirPopularQuery OnDirPopularQuery;
333 public event DirClassifiedQuery OnDirClassifiedQuery;
334 public event EventInfoRequest OnEventInfoRequest;
335 public event ParcelSetOtherCleanTime OnParcelSetOtherCleanTime;
336
337 public event MapItemRequest OnMapItemRequest;
338
339 public event OfferCallingCard OnOfferCallingCard;
340 public event AcceptCallingCard OnAcceptCallingCard;
341 public event DeclineCallingCard OnDeclineCallingCard;
342 public event SoundTrigger OnSoundTrigger;
343
344 public event StartLure OnStartLure;
345 public event TeleportLureRequest OnTeleportLureRequest;
346 public event NetworkStats OnNetworkStatsUpdate;
347
348 public event ClassifiedInfoRequest OnClassifiedInfoRequest;
349 public event ClassifiedInfoUpdate OnClassifiedInfoUpdate;
350 public event ClassifiedDelete OnClassifiedDelete;
351 public event ClassifiedDelete OnClassifiedGodDelete;
352
353 public event EventNotificationAddRequest OnEventNotificationAddRequest;
354 public event EventNotificationRemoveRequest OnEventNotificationRemoveRequest;
355 public event EventGodDelete OnEventGodDelete;
356
357 public event ParcelDwellRequest OnParcelDwellRequest;
358
359 public event UserInfoRequest OnUserInfoRequest;
360 public event UpdateUserInfo OnUpdateUserInfo;
361
362#pragma warning restore 67
363
364 #endregion
365
366 public void ActivateGesture(UUID assetId, UUID gestureId)
367 {
368 }
369 public void DeactivateGesture(UUID assetId, UUID gestureId)
370 {
371 }
372
373 #region Overrriden Methods IGNORE
374
375 public virtual Vector3 StartPos
376 {
377 get { return m_startPos; }
378 set { }
379 }
380
381 public virtual UUID AgentId
382 {
383 get { return m_uuid; }
384 }
385
386 public UUID SessionId
387 {
388 get { return UUID.Zero; }
389 }
390
391 public UUID SecureSessionId
392 {
393 get { return UUID.Zero; }
394 }
395
396 public virtual string FirstName
397 {
398 get { return m_firstname; }
399 }
400
401 public virtual string LastName
402 {
403 get { return m_lastname; }
404 }
405
406 public virtual String Name
407 {
408 get { return FirstName + " " + LastName; }
409 }
410
411 public bool IsActive
412 {
413 get { return true; }
414 set { }
415 }
416
417 public UUID ActiveGroupId
418 {
419 get { return UUID.Zero; }
420 }
421
422 public string ActiveGroupName
423 {
424 get { return String.Empty; }
425 }
426
427 public ulong ActiveGroupPowers
428 {
429 get { return 0; }
430 }
431
432 public bool IsGroupMember(UUID groupID)
433 {
434 return false;
435 }
436
437 public ulong GetGroupPowers(UUID groupID)
438 {
439 return 0;
440 }
441
442 public virtual int NextAnimationSequenceNumber
443 {
444 get { return 1; }
445 }
446
447 public virtual void SendWearables(AvatarWearable[] wearables, int serial)
448 {
449 }
450
451 public virtual void SendAppearance(UUID agentID, byte[] visualParams, byte[] textureEntry)
452 {
453 }
454
455 public virtual void Kick(string message)
456 {
457 }
458
459 public virtual void SendStartPingCheck(byte seq)
460 {
461 }
462
463 public virtual void SendAvatarPickerReply(AvatarPickerReplyAgentDataArgs AgentData, List<AvatarPickerReplyDataArgs> Data)
464 {
465 }
466
467 public virtual void SendAgentDataUpdate(UUID agentid, UUID activegroupid, string firstname, string lastname, ulong grouppowers, string groupname, string grouptitle)
468 {
469
470 }
471
472 public virtual void SendKillObject(ulong regionHandle, uint localID)
473 {
474 }
475
476 public virtual void SetChildAgentThrottle(byte[] throttle)
477 {
478 }
479 public byte[] GetThrottlesPacked(float multiplier)
480 {
481 return new byte[0];
482 }
483
484
485 public virtual void SendAnimations(UUID[] animations, int[] seqs, UUID sourceAgentId)
486 {
487 }
488
489 public virtual void SendChatMessage(string message, byte type, Vector3 fromPos, string fromName,
490 UUID fromAgentID, byte source, byte audible)
491 {
492 }
493
494 public virtual void SendChatMessage(byte[] message, byte type, Vector3 fromPos, string fromName,
495 UUID fromAgentID, byte source, byte audible)
496 {
497 }
498
499 public void SendInstantMessage(UUID fromAgent, string message, UUID toAgent, string fromName, byte dialog, uint timeStamp)
500 {
501
502 }
503
504 public void SendInstantMessage(UUID fromAgent, string message, UUID toAgent, string fromName, byte dialog, uint timeStamp, UUID transationID, bool fromGroup, byte[] binaryBucket)
505 {
506
507 }
508
509 public void SendGenericMessage(string method, List<string> message)
510 {
511
512 }
513
514 public virtual void SendLayerData(float[] map)
515 {
516 }
517
518 public virtual void SendLayerData(int px, int py, float[] map)
519 {
520 }
521 public virtual void SendLayerData(int px, int py, float[] map, bool track)
522 {
523 }
524
525 public virtual void SendWindData(Vector2[] windSpeeds) { }
526
527 public virtual void MoveAgentIntoRegion(RegionInfo regInfo, Vector3 pos, Vector3 look)
528 {
529 }
530
531 public virtual void InformClientOfNeighbour(ulong neighbourHandle, IPEndPoint neighbourExternalEndPoint)
532 {
533 }
534
535 public virtual AgentCircuitData RequestClientInfo()
536 {
537 return new AgentCircuitData();
538 }
539
540 public virtual void CrossRegion(ulong newRegionHandle, Vector3 pos, Vector3 lookAt,
541 IPEndPoint newRegionExternalEndPoint, string capsURL)
542 {
543 }
544
545 public virtual void SendMapBlock(List<MapBlockData> mapBlocks, uint flag)
546 {
547 }
548
549 public virtual void SendLocalTeleport(Vector3 position, Vector3 lookAt, uint flags)
550 {
551 }
552
553 public virtual void SendRegionTeleport(ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint,
554 uint locationID, uint flags, string capsURL)
555 {
556 }
557
558 public virtual void SendTeleportFailed(string reason)
559 {
560 }
561
562 public virtual void SendTeleportLocationStart()
563 {
564 }
565
566 public virtual void SendMoneyBalance(UUID transaction, bool success, byte[] description, int balance)
567 {
568 }
569
570 public virtual void SendPayPrice(UUID objectID, int[] payPrice)
571 {
572 }
573
574 public virtual void SendAvatarData(ulong regionHandle, string firstName, string lastName, string grouptitle, UUID avatarID,
575 uint avatarLocalID, Vector3 Pos, byte[] textureEntry, uint parentID, Quaternion rotation)
576 {
577 }
578
579 public virtual void SendAvatarTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID,
580 Vector3 position, Vector3 velocity, Quaternion rotation)
581 {
582 }
583
584 public virtual void SendCoarseLocationUpdate(List<Vector3> CoarseLocations)
585 {
586 }
587
588 public virtual void AttachObject(uint localID, Quaternion rotation, byte attachPoint, UUID ownerID)
589 {
590 }
591
592 public virtual void SendDialog(string objectname, UUID objectID, UUID ownerID, string msg, UUID textureID, int ch, string[] buttonlabels)
593 {
594 }
595
596 public virtual void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID,
597 PrimitiveBaseShape primShape, Vector3 pos, Vector3 vel,
598 Vector3 acc, Quaternion rotation, Vector3 rvel, uint flags,
599 UUID objectID, UUID ownerID, string text, byte[] color,
600 uint parentID,
601 byte[] particleSystem, byte clickAction, byte material)
602 {
603 }
604 public virtual void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID,
605 PrimitiveBaseShape primShape, Vector3 pos, Vector3 vel,
606 Vector3 acc, Quaternion rotation, Vector3 rvel, uint flags,
607 UUID objectID, UUID ownerID, string text, byte[] color,
608 uint parentID,
609 byte[] particleSystem, byte clickAction, byte material, byte[] textureanimation,
610 bool attachment, uint AttachmentPoint, UUID AssetId, UUID SoundId, double SoundVolume, byte SoundFlags, double SoundRadius)
611 {
612 }
613 public virtual void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID,
614 Vector3 position, Quaternion rotation, Vector3 velocity,
615 Vector3 rotationalvelocity, byte state, UUID AssetId, UUID ownerID, int attachPoint)
616 {
617 }
618
619 public virtual void SendInventoryFolderDetails(UUID ownerID, UUID folderID,
620 List<InventoryItemBase> items,
621 List<InventoryFolderBase> folders,
622 bool fetchFolders,
623 bool fetchItems)
624 {
625 }
626
627 public virtual void SendInventoryItemDetails(UUID ownerID, InventoryItemBase item)
628 {
629 }
630
631 public virtual void SendInventoryItemCreateUpdate(InventoryItemBase Item)
632 {
633 }
634
635 public virtual void SendRemoveInventoryItem(UUID itemID)
636 {
637 }
638
639 /// <see>IClientAPI.SendBulkUpdateInventory(InventoryItemBase)</see>
640 public virtual void SendBulkUpdateInventory(InventoryItemBase item)
641 {
642 }
643
644 public virtual void SendBulkUpdateInventory(InventoryFolderBase folderBase)
645 {}
646
647 public void SendTakeControls(int controls, bool passToAgent, bool TakeControls)
648 {
649 }
650
651 public virtual void SendTaskInventory(UUID taskID, short serial, byte[] fileName)
652 {
653 }
654
655 public virtual void SendXferPacket(ulong xferID, uint packet, byte[] data)
656 {
657 }
658
659 public virtual void SendEconomyData(float EnergyEfficiency, int ObjectCapacity, int ObjectCount, int PriceEnergyUnit,
660 int PriceGroupCreate, int PriceObjectClaim, float PriceObjectRent, float PriceObjectScaleFactor,
661 int PriceParcelClaim, float PriceParcelClaimFactor, int PriceParcelRent, int PricePublicObjectDecay,
662 int PricePublicObjectDelete, int PriceRentLight, int PriceUpload, int TeleportMinPrice, float TeleportPriceExponent)
663 {
664
665 }
666 public virtual void SendNameReply(UUID profileId, string firstname, string lastname)
667 {
668 }
669
670 public virtual void SendPreLoadSound(UUID objectID, UUID ownerID, UUID soundID)
671 {
672 }
673
674 public virtual void SendPlayAttachedSound(UUID soundID, UUID objectID, UUID ownerID, float gain,
675 byte flags)
676 {
677 }
678
679 public void SendTriggeredSound(UUID soundID, UUID ownerID, UUID objectID, UUID parentID, ulong handle, Vector3 position, float gain)
680 {
681 }
682
683 public void SendAttachedSoundGainChange(UUID objectID, float gain)
684 {
685
686 }
687
688 public void SendAlertMessage(string message)
689 {
690 }
691
692 public void SendAgentAlertMessage(string message, bool modal)
693 {
694 }
695
696 public void SendSystemAlertMessage(string message)
697 {
698 }
699
700 public void SendLoadURL(string objectname, UUID objectID, UUID ownerID, bool groupOwned, string message,
701 string url)
702 {
703 }
704
705 public virtual void SendRegionHandshake(RegionInfo regionInfo, RegionHandshakeArgs args)
706 {
707 if (OnRegionHandShakeReply != null)
708 {
709 OnRegionHandShakeReply(this);
710 }
711
712 if (OnCompleteMovementToRegion != null)
713 {
714 OnCompleteMovementToRegion();
715 }
716 }
717 public void SendAssetUploadCompleteMessage(sbyte AssetType, bool Success, UUID AssetFullID)
718 {
719 }
720
721 public void SendConfirmXfer(ulong xferID, uint PacketID)
722 {
723 }
724
725 public void SendXferRequest(ulong XferID, short AssetType, UUID vFileID, byte FilePath, byte[] FileName)
726 {
727 }
728
729 public void SendInitiateDownload(string simFileName, string clientFileName)
730 {
731 }
732
733 public void SendImageFirstPart(ushort numParts, UUID ImageUUID, uint ImageSize, byte[] ImageData, byte imageCodec)
734 {
735 }
736
737 public void SendImageNotFound(UUID imageid)
738 {
739 }
740
741 public void SendImageNextPart(ushort partNumber, UUID imageUuid, byte[] imageData)
742 {
743 }
744
745 public void SendShutdownConnectionNotice()
746 {
747 }
748
749 public void SendSimStats(SimStats stats)
750 {
751 }
752
753 public void SendObjectPropertiesFamilyData(uint RequestFlags, UUID ObjectUUID, UUID OwnerID, UUID GroupID,
754 uint BaseMask, uint OwnerMask, uint GroupMask, uint EveryoneMask,
755 uint NextOwnerMask, int OwnershipCost, byte SaleType, int SalePrice, uint Category,
756 UUID LastOwnerID, string ObjectName, string Description)
757 {
758 }
759
760 public void SendObjectPropertiesReply(UUID ItemID, ulong CreationDate, UUID CreatorUUID, UUID FolderUUID, UUID FromTaskUUID,
761 UUID GroupUUID, short InventorySerial, UUID LastOwnerUUID, UUID ObjectUUID,
762 UUID OwnerUUID, string TouchTitle, byte[] TextureID, string SitTitle, string ItemName,
763 string ItemDescription, uint OwnerMask, uint NextOwnerMask, uint GroupMask, uint EveryoneMask,
764 uint BaseMask, byte saleType, int salePrice)
765 {
766 }
767
768 public bool AddMoney(int debit)
769 {
770 return false;
771 }
772
773 public void SendSunPos(Vector3 sunPos, Vector3 sunVel, ulong time, uint dlen, uint ylen, float phase)
774 {
775 }
776
777 public void SendViewerEffect(ViewerEffectPacket.EffectBlock[] effectBlocks)
778 {
779 }
780
781 public void SendViewerTime(int phase)
782 {
783 }
784
785 public void SendAvatarProperties(UUID avatarID, string aboutText, string bornOn, Byte[] charterMember,
786 string flAbout, uint flags, UUID flImageID, UUID imageID, string profileURL,
787 UUID partnerID)
788 {
789 }
790
791 public void SendAsset(AssetRequestToClient req)
792 {
793 }
794
795 public void SendTexture(AssetBase TextureAsset)
796 {
797 }
798
799 public void SetDebugPacketLevel(int newDebug)
800 {
801 }
802
803 public void InPacket(object NewPack)
804 {
805 }
806
807 public void ProcessInPacket(Packet NewPack)
808 {
809 }
810
811 public void Close(bool ShutdownCircuit)
812 {
813 }
814
815 public void Start()
816 {
817 }
818
819 public void Stop()
820 {
821 }
822
823 private uint m_circuitCode;
824
825 public uint CircuitCode
826 {
827 get { return m_circuitCode; }
828 set { m_circuitCode = value; }
829 }
830
831 public void SendBlueBoxMessage(UUID FromAvatarID, String FromAvatarName, String Message)
832 {
833
834 }
835 public void SendLogoutPacket()
836 {
837 }
838
839 public void Terminate()
840 {
841 }
842
843 public ClientInfo GetClientInfo()
844 {
845 return null;
846 }
847
848 public void SetClientInfo(ClientInfo info)
849 {
850 }
851
852 public void SendScriptQuestion(UUID objectID, string taskName, string ownerName, UUID itemID, int question)
853 {
854 }
855 public void SendHealth(float health)
856 {
857 }
858
859 public void SendEstateManagersList(UUID invoice, UUID[] EstateManagers, uint estateID)
860 {
861 }
862
863 public void SendBannedUserList(UUID invoice, EstateBan[] banlist, uint estateID)
864 {
865 }
866
867 public void SendRegionInfoToEstateMenu(RegionInfoForEstateMenuArgs args)
868 {
869 }
870 public void SendEstateCovenantInformation(UUID covenant)
871 {
872 }
873 public void SendDetailedEstateData(UUID invoice, string estateName, uint estateID, uint parentEstate, uint estateFlags, uint sunPosition, UUID covenant, string abuseEmail, UUID estateOwner)
874 {
875 }
876
877 public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, LandData landData, float simObjectBonusFactor,int parcelObjectCapacity, int simObjectCapacity, uint regionFlags)
878 {
879 }
880 public void SendLandAccessListData(List<UUID> avatars, uint accessFlag, int localLandID)
881 {
882 }
883 public void SendForceClientSelectObjects(List<uint> objectIDs)
884 {
885 }
886 public void SendLandObjectOwners(Dictionary<UUID, int> ownersAndCount)
887 {
888 }
889 public void SendLandParcelOverlay(byte[] data, int sequence_id)
890 {
891 }
892
893 public void SendGroupNameReply(UUID groupLLUID, string GroupName)
894 {
895 }
896
897 public void SendScriptRunningReply(UUID objectID, UUID itemID, bool running)
898 {
899 }
900
901 public void SendLandStatReply(uint reportType, uint requestFlags, uint resultCount, LandStatReportItem[] lsrpia)
902 {
903 }
904 #endregion
905
906
907 public void SendParcelMediaCommand(uint flags, ParcelMediaCommandEnum command, float time)
908 {
909 }
910
911 public void SendParcelMediaUpdate(string mediaUrl, UUID mediaTextureID,
912 byte autoScale, string mediaType, string mediaDesc, int mediaWidth, int mediaHeight,
913 byte mediaLoop)
914 {
915 }
916
917 public void SendSetFollowCamProperties (UUID objectID, SortedDictionary<int, float> parameters)
918 {
919 }
920
921 public void SendClearFollowCamProperties (UUID objectID)
922 {
923 }
924
925 public void SendRegionHandle (UUID regoinID, ulong handle)
926 {
927 }
928
929 public void SendParcelInfo (RegionInfo info, LandData land, UUID parcelID, uint x, uint y)
930 {
931 }
932
933 public void SetClientOption(string option, string value)
934 {
935 }
936
937 public string GetClientOption(string option)
938 {
939 return string.Empty;
940 }
941
942 public void SendScriptTeleportRequest (string objName, string simName, Vector3 pos, Vector3 lookAt)
943 {
944 }
945
946 public void SendDirPlacesReply(UUID queryID, DirPlacesReplyData[] data)
947 {
948 }
949
950 public void SendDirPeopleReply(UUID queryID, DirPeopleReplyData[] data)
951 {
952 }
953
954 public void SendDirEventsReply(UUID queryID, DirEventsReplyData[] data)
955 {
956 }
957
958 public void SendDirGroupsReply(UUID queryID, DirGroupsReplyData[] data)
959 {
960 }
961
962 public void SendDirClassifiedReply(UUID queryID, DirClassifiedReplyData[] data)
963 {
964 }
965
966 public void SendDirLandReply(UUID queryID, DirLandReplyData[] data)
967 {
968 }
969
970 public void SendDirPopularReply(UUID queryID, DirPopularReplyData[] data)
971 {
972 }
973
974 public void SendMapItemReply(mapItemReply[] replies, uint mapitemtype, uint flags)
975 {
976 }
977
978 public void KillEndDone()
979 {
980 }
981
982 public void SendEventInfoReply (EventData info)
983 {
984 }
985
986 public void SendOfferCallingCard (UUID destID, UUID transactionID)
987 {
988 }
989
990 public void SendAcceptCallingCard (UUID transactionID)
991 {
992 }
993
994 public void SendDeclineCallingCard (UUID transactionID)
995 {
996 }
997
998 public void SendJoinGroupReply(UUID groupID, bool success)
999 {
1000 }
1001
1002 public void SendEjectGroupMemberReply(UUID agentID, UUID groupID, bool success)
1003 {
1004 }
1005
1006 public void SendLeaveGroupReply(UUID groupID, bool success)
1007 {
1008 }
1009
1010 public void SendAvatarGroupsReply(UUID avatarID, GroupMembershipData[] data)
1011 {
1012 }
1013
1014 public void SendTerminateFriend(UUID exFriendID)
1015 {
1016 }
1017
1018 #region IClientAPI Members
1019
1020
1021 public bool AddGenericPacketHandler(string MethodName, GenericMessage handler)
1022 {
1023 throw new NotImplementedException();
1024 }
1025
1026 public void SendAvatarClassifiedReply(UUID targetID, UUID[] classifiedID, string[] name)
1027 {
1028 }
1029
1030 public void SendClassifiedInfoReply(UUID classifiedID, UUID creatorID, uint creationDate, uint expirationDate, uint category, string name, string description, UUID parcelID, uint parentEstate, UUID snapshotID, string simName, Vector3 globalPos, string parcelName, byte classifiedFlags, int price)
1031 {
1032 }
1033
1034 public void SendAgentDropGroup(UUID groupID)
1035 {
1036 }
1037
1038 public void SendAvatarNotesReply(UUID targetID, string text)
1039 {
1040 }
1041
1042 public void SendAvatarPicksReply(UUID targetID, Dictionary<UUID, string> picks)
1043 {
1044 }
1045
1046 public void SendAvatarClassifiedReply(UUID targetID, Dictionary<UUID, string> classifieds)
1047 {
1048 }
1049
1050 public void SendParcelDwellReply(int localID, UUID parcelID, float dwell)
1051 {
1052 }
1053
1054 public void SendUserInfoReply(bool imViaEmail, bool visible, string email)
1055 {
1056 }
1057
1058 #endregion
1059 }
1060}
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
new file mode 100644
index 0000000..9dace33
--- /dev/null
+++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
@@ -0,0 +1,68 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using OpenMetaverse;
29using Nini.Config;
30using OpenSim.Region.Framework.Interfaces;
31using OpenSim.Region.Framework.Scenes;
32
33namespace OpenSim.Region.OptionalModules.World.NPC
34{
35 public class NPCModule : IRegionModule
36 {
37 // private const bool m_enabled = false;
38
39 public void Initialise(Scene scene, IConfigSource source)
40 {
41 // if (m_enabled)
42 // {
43 // NPCAvatar testAvatar = new NPCAvatar("Jack", "NPC", new Vector3(128, 128, 40), scene);
44 // NPCAvatar testAvatar2 = new NPCAvatar("Jill", "NPC", new Vector3(136, 128, 40), scene);
45 // scene.AddNewClient(testAvatar, false);
46 // scene.AddNewClient(testAvatar2, false);
47 // }
48 }
49
50 public void PostInitialise()
51 {
52 }
53
54 public void Close()
55 {
56 }
57
58 public string Name
59 {
60 get { return "NPCModule"; }
61 }
62
63 public bool IsSharedModule
64 {
65 get { return true; }
66 }
67 }
68}
diff --git a/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs b/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs
new file mode 100644
index 0000000..94ebcac
--- /dev/null
+++ b/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs
@@ -0,0 +1,304 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.Reflection;
31using System.Timers;
32using OpenMetaverse;
33using log4net;
34using Nini.Config;
35using OpenSim.Framework;
36using OpenSim.Region.Framework.Interfaces;
37using OpenSim.Region.Framework.Scenes;
38
39namespace OpenSim.Region.OptionalModules.World.TreePopulator
40{
41 /// <summary>
42 /// Version 2.0 - Very hacky compared to the original. Will fix original and release as 0.3 later.
43 /// </summary>
44 public class TreePopulatorModule : IRegionModule
45 {
46 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
47 private Scene m_scene;
48
49 public double m_tree_density = 50.0; // Aim for this many per region
50 public double m_tree_updates = 1000.0; // MS between updates
51 private bool m_active_trees = false;
52 private List<UUID> m_trees;
53 Timer CalculateTrees;
54
55 #region IRegionModule Members
56
57 public void Initialise(Scene scene, IConfigSource config)
58 {
59 try
60 {
61 m_tree_density = config.Configs["Trees"].GetDouble("tree_density", m_tree_density);
62 m_active_trees = config.Configs["Trees"].GetBoolean("active_trees", m_active_trees);
63 }
64 catch (Exception)
65 {
66 }
67
68 m_trees = new List<UUID>();
69 m_scene = scene;
70
71 m_scene.EventManager.OnPluginConsole += EventManager_OnPluginConsole;
72
73 if (m_active_trees)
74 activeizeTreeze(true);
75
76 m_log.Debug("[TREES]: Initialised tree module");
77 }
78
79 public void PostInitialise()
80 {
81 }
82
83 public void Close()
84 {
85 }
86
87 public string Name
88 {
89 get { return "TreePopulatorModule"; }
90 }
91
92 public bool IsSharedModule
93 {
94 get { return false; }
95 }
96
97 #endregion
98
99 private void EventManager_OnPluginConsole(string[] args)
100 {
101 if (args.Length == 1)
102 {
103 if (args[0] == "tree")
104 {
105 UUID uuid = m_scene.RegionInfo.EstateSettings.EstateOwner;
106 if (uuid == UUID.Zero)
107 uuid = m_scene.RegionInfo.MasterAvatarAssignedUUID;
108 m_log.Debug("[TREES]: New tree planting");
109 CreateTree(uuid, new Vector3(128.0f, 128.0f, 0.0f));
110
111 }
112 }
113
114 if (args.Length == 2 || args.Length == 3)
115 {
116 if (args[1] == "active")
117 {
118 if (args.Length >= 3)
119 {
120 if (args[2] == "true" && !m_active_trees)
121 {
122 m_active_trees = true;
123 activeizeTreeze(m_active_trees);
124 m_log.Info("[TREES]: Activizing Trees");
125 }
126 if (args[2] == "false" && m_active_trees)
127 {
128 m_active_trees = false;
129 activeizeTreeze(m_active_trees);
130 m_log.Info("[TREES]: Trees no longer Active, for now...");
131 }
132 }
133 else
134 {
135 m_log.Info("[TREES]: When setting the tree module active via the console, you must specify true or false");
136 }
137 }
138 }
139
140 }
141
142 private void activeizeTreeze(bool activeYN)
143 {
144 if (activeYN)
145 {
146 CalculateTrees = new Timer(m_tree_updates);
147 CalculateTrees.Elapsed += CalculateTrees_Elapsed;
148 CalculateTrees.Start();
149 }
150 else
151 {
152 CalculateTrees.Stop();
153 }
154 }
155
156 private void growTrees()
157 {
158 foreach (UUID tree in m_trees)
159 {
160 if (m_scene.Entities.ContainsKey(tree))
161 {
162 SceneObjectPart s_tree = ((SceneObjectGroup) m_scene.Entities[tree]).RootPart;
163
164 // 100 seconds to grow 1m
165 s_tree.Scale += new Vector3(0.1f, 0.1f, 0.1f);
166 s_tree.SendFullUpdateToAllClients();
167 //s_tree.ScheduleTerseUpdate();
168 }
169 else
170 {
171 m_trees.Remove(tree);
172 }
173 }
174 }
175
176 private void seedTrees()
177 {
178 foreach (UUID tree in m_trees)
179 {
180 if (m_scene.Entities.ContainsKey(tree))
181 {
182 SceneObjectPart s_tree = ((SceneObjectGroup) m_scene.Entities[tree]).RootPart;
183
184 if (s_tree.Scale.X > 0.5)
185 {
186 if (Util.RandomClass.NextDouble() > 0.75)
187 {
188 SpawnChild(s_tree);
189 }
190 }
191 }
192 else
193 {
194 m_trees.Remove(tree);
195 }
196 }
197 }
198
199 private void killTrees()
200 {
201 foreach (UUID tree in m_trees)
202 {
203 double killLikelyhood = 0.0;
204
205 if (m_scene.Entities.ContainsKey(tree))
206 {
207 SceneObjectPart selectedTree = ((SceneObjectGroup) m_scene.Entities[tree]).RootPart;
208 double selectedTreeScale = Math.Sqrt(Math.Pow(selectedTree.Scale.X, 2) +
209 Math.Pow(selectedTree.Scale.Y, 2) +
210 Math.Pow(selectedTree.Scale.Z, 2));
211
212 foreach (UUID picktree in m_trees)
213 {
214 if (picktree != tree)
215 {
216 SceneObjectPart pickedTree = ((SceneObjectGroup) m_scene.Entities[picktree]).RootPart;
217
218 double pickedTreeScale = Math.Sqrt(Math.Pow(pickedTree.Scale.X, 2) +
219 Math.Pow(pickedTree.Scale.Y, 2) +
220 Math.Pow(pickedTree.Scale.Z, 2));
221
222 double pickedTreeDistance = Math.Sqrt(Math.Pow(Math.Abs(pickedTree.AbsolutePosition.X - selectedTree.AbsolutePosition.X), 2) +
223 Math.Pow(Math.Abs(pickedTree.AbsolutePosition.Y - selectedTree.AbsolutePosition.Y), 2) +
224 Math.Pow(Math.Abs(pickedTree.AbsolutePosition.Z - selectedTree.AbsolutePosition.Z), 2));
225
226 killLikelyhood += (selectedTreeScale / (pickedTreeScale * pickedTreeDistance)) * 0.1;
227 }
228 }
229
230 if (Util.RandomClass.NextDouble() < killLikelyhood)
231 {
232 m_scene.DeleteSceneObject(selectedTree.ParentGroup, false);
233 m_trees.Remove(selectedTree.ParentGroup.UUID);
234
235 m_scene.ForEachClient(delegate(IClientAPI controller)
236 {
237 controller.SendKillObject(m_scene.RegionInfo.RegionHandle,
238 selectedTree.LocalId);
239 });
240
241 break;
242 }
243 selectedTree.SetText(killLikelyhood.ToString(), new Vector3(1.0f, 1.0f, 1.0f), 1.0);
244 }
245 else
246 {
247 m_trees.Remove(tree);
248 }
249 }
250 }
251
252 private void SpawnChild(SceneObjectPart s_tree)
253 {
254 Vector3 position = new Vector3();
255
256 position.X = s_tree.AbsolutePosition.X + (1 * (-1 * Util.RandomClass.Next(1)));
257 if (position.X > 255)
258 position.X = 255;
259 if (position.X < 0)
260 position.X = 0;
261 position.Y = s_tree.AbsolutePosition.Y + (1 * (-1 * Util.RandomClass.Next(1)));
262 if (position.Y > 255)
263 position.Y = 255;
264 if (position.Y < 0)
265 position.Y = 0;
266
267 double randX = ((Util.RandomClass.NextDouble() * 2.0) - 1.0) * (s_tree.Scale.X * 3);
268 double randY = ((Util.RandomClass.NextDouble() * 2.0) - 1.0) * (s_tree.Scale.X * 3);
269
270 position.X += (float) randX;
271 position.Y += (float) randY;
272
273 UUID uuid = m_scene.RegionInfo.EstateSettings.EstateOwner;
274 if (uuid == UUID.Zero)
275 uuid = m_scene.RegionInfo.MasterAvatarAssignedUUID;
276
277 CreateTree(uuid, position);
278 }
279
280 private void CreateTree(UUID uuid, Vector3 position)
281 {
282 position.Z = (float) m_scene.Heightmap[(int) position.X, (int) position.Y];
283
284 IVegetationModule module = m_scene.RequestModuleInterface<IVegetationModule>();
285
286 if (null == module)
287 return;
288
289 SceneObjectGroup tree
290 = module.AddTree(
291 uuid, UUID.Zero, new Vector3(0.1f, 0.1f, 0.1f), Quaternion.Identity, position, Tree.Cypress1, false);
292
293 m_trees.Add(tree.UUID);
294 tree.SendGroupFullUpdate();
295 }
296
297 private void CalculateTrees_Elapsed(object sender, ElapsedEventArgs e)
298 {
299 growTrees();
300 seedTrees();
301 killTrees();
302 }
303 }
304}