diff options
author | Adam Frisby | 2009-08-21 08:51:43 +1000 |
---|---|---|
committer | Adam Frisby | 2009-08-21 08:51:43 +1000 |
commit | e83b00a3dfc5410f5ca6bd2eed3d8565ebbffecf (patch) | |
tree | 00eb1152ab62a6dd263eb5b72705ce577c25793d /OpenSim/Region/OptionalModules/World | |
parent | Remove the AssetInventory server from core. It has fallen behind both (diff) | |
download | opensim-SC_OLD-e83b00a3dfc5410f5ca6bd2eed3d8565ebbffecf.zip opensim-SC_OLD-e83b00a3dfc5410f5ca6bd2eed3d8565ebbffecf.tar.gz opensim-SC_OLD-e83b00a3dfc5410f5ca6bd2eed3d8565ebbffecf.tar.bz2 opensim-SC_OLD-e83b00a3dfc5410f5ca6bd2eed3d8565ebbffecf.tar.xz |
* Implements a bunch of stuff in NPCModule
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs | 64 |
1 files changed, 56 insertions, 8 deletions
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs index 8c9717c..a3cefc9 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs | |||
@@ -25,26 +25,74 @@ | |||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System.Collections.Generic; | ||
28 | using OpenMetaverse; | 29 | using OpenMetaverse; |
29 | using Nini.Config; | 30 | using Nini.Config; |
30 | using OpenSim.Region.Framework.Interfaces; | 31 | using OpenSim.Region.Framework.Interfaces; |
31 | using OpenSim.Region.Framework.Scenes; | 32 | using OpenSim.Region.Framework.Scenes; |
33 | using OpenSim.Framework; | ||
32 | 34 | ||
33 | namespace OpenSim.Region.OptionalModules.World.NPC | 35 | namespace OpenSim.Region.OptionalModules.World.NPC |
34 | { | 36 | { |
35 | public class NPCModule : IRegionModule | 37 | public interface INPCModule |
38 | { | ||
39 | UUID CreateNPC(string firstname, string lastname,Vector3 position, Scene scene, UUID cloneAppearanceFrom); | ||
40 | void Autopilot(UUID agentID, Scene scene, Vector3 pos); | ||
41 | void Say(UUID agentID, Scene scene, string text); | ||
42 | void DeleteNPC(UUID agentID, Scene scene); | ||
43 | } | ||
44 | |||
45 | public class NPCModule : IRegionModule, INPCModule | ||
36 | { | 46 | { |
37 | // private const bool m_enabled = false; | 47 | // private const bool m_enabled = false; |
38 | 48 | ||
49 | private Dictionary<UUID,NPCAvatar> m_avatars = new Dictionary<UUID, NPCAvatar>(); | ||
50 | |||
51 | public UUID CreateNPC(string firstname, string lastname,Vector3 position, Scene scene, UUID cloneAppearanceFrom) | ||
52 | { | ||
53 | NPCAvatar npcAvatar = new NPCAvatar(firstname, lastname, position, scene); | ||
54 | scene.AddNewClient(npcAvatar); | ||
55 | |||
56 | ScenePresence sp; | ||
57 | if(scene.TryGetAvatar(npcAvatar.AgentId, out sp)) | ||
58 | { | ||
59 | AvatarAppearance x = scene.CommsManager.AvatarService.GetUserAppearance(cloneAppearanceFrom); | ||
60 | |||
61 | List<byte> wearbyte = new List<byte>(); | ||
62 | for (int i = 0; i < x.VisualParams.Length; i++) | ||
63 | { | ||
64 | wearbyte.Add(x.VisualParams[i]); | ||
65 | } | ||
66 | |||
67 | sp.SetAppearance(x.Texture.GetBytes(), wearbyte); | ||
68 | } | ||
69 | |||
70 | m_avatars.Add(npcAvatar.AgentId, npcAvatar); | ||
71 | |||
72 | return npcAvatar.AgentId; | ||
73 | } | ||
74 | |||
75 | public void Autopilot(UUID agentID, Scene scene, Vector3 pos) | ||
76 | { | ||
77 | ScenePresence sp; | ||
78 | scene.TryGetAvatar(agentID, out sp); | ||
79 | sp.DoAutoPilot(0,pos,m_avatars[agentID]); | ||
80 | } | ||
81 | |||
82 | public void Say(UUID agentID, Scene scene, string text) | ||
83 | { | ||
84 | m_avatars[agentID].Say(text); | ||
85 | } | ||
86 | |||
87 | public void DeleteNPC(UUID agentID, Scene scene) | ||
88 | { | ||
89 | scene.RemoveClient(agentID); | ||
90 | } | ||
91 | |||
92 | |||
39 | public void Initialise(Scene scene, IConfigSource source) | 93 | public void Initialise(Scene scene, IConfigSource source) |
40 | { | 94 | { |
41 | // if (m_enabled) | 95 | scene.RegisterModuleInterface<INPCModule>(this); |
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); | ||
46 | // scene.AddNewClient(testAvatar2); | ||
47 | // } | ||
48 | } | 96 | } |
49 | 97 | ||
50 | public void PostInitialise() | 98 | public void PostInitialise() |