fix NPCs OS_NPC_OBJECT_GROUP option. group ID needs to be set during creation, before scenepresence.CompleteMovement, set tittle just after it.

LSLKeyTest
UbitUmarov 2016-06-28 18:14:30 +01:00
parent 5143bbc9d6
commit a08c354a07
3 changed files with 9 additions and 8 deletions

View File

@ -107,7 +107,7 @@ namespace OpenSim.Region.Framework.Interfaces
/// failure. /// failure.
/// </returns> /// </returns>
UUID CreateNPC(string firstname, string lastname, UUID CreateNPC(string firstname, string lastname,
Vector3 position, UUID agentID, UUID owner, bool senseAsAgent, Scene scene, Vector3 position, UUID agentID, UUID owner, string groupTitle, UUID groupID, bool senseAsAgent, Scene scene,
AvatarAppearance appearance); AvatarAppearance appearance);
/// <summary> /// <summary>

View File

@ -160,11 +160,11 @@ namespace OpenSim.Region.OptionalModules.World.NPC
Vector3 position, UUID owner, bool senseAsAgent, Scene scene, Vector3 position, UUID owner, bool senseAsAgent, Scene scene,
AvatarAppearance appearance) AvatarAppearance appearance)
{ {
return CreateNPC(firstname, lastname, position, UUID.Zero, owner, senseAsAgent, scene, appearance); return CreateNPC(firstname, lastname, position, UUID.Zero, owner, "", UUID.Zero, senseAsAgent, scene, appearance);
} }
public UUID CreateNPC(string firstname, string lastname, public UUID CreateNPC(string firstname, string lastname,
Vector3 position, UUID agentID, UUID owner, bool senseAsAgent, Scene scene, Vector3 position, UUID agentID, UUID owner, string groupTitle, UUID groupID, bool senseAsAgent, Scene scene,
AvatarAppearance appearance) AvatarAppearance appearance)
{ {
NPCAvatar npcAvatar = null; NPCAvatar npcAvatar = null;
@ -222,8 +222,9 @@ namespace OpenSim.Region.OptionalModules.World.NPC
ScenePresence sp; ScenePresence sp;
if (scene.TryGetScenePresence(npcAvatar.AgentId, out sp)) if (scene.TryGetScenePresence(npcAvatar.AgentId, out sp))
{ {
npcAvatar.ActiveGroupId = groupID;
sp.CompleteMovement(npcAvatar, false); sp.CompleteMovement(npcAvatar, false);
sp.Grouptitle = groupTitle;
m_avatars.Add(npcAvatar.AgentId, npcAvatar); m_avatars.Add(npcAvatar.AgentId, npcAvatar);
// m_log.DebugFormat("[NPC MODULE]: Created NPC {0} {1}", npcAvatar.AgentId, sp.Name); // m_log.DebugFormat("[NPC MODULE]: Created NPC {0} {1}", npcAvatar.AgentId, sp.Name);
} }

View File

@ -2748,7 +2748,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
UUID x = module.CreateNPC(firstname, UUID x = module.CreateNPC(firstname,
lastname, lastname,
position, position,
UUID.Random(),
ownerID, ownerID,
groupTitle,
groupID,
senseAsAgent, senseAsAgent,
World, World,
appearance); appearance);
@ -2756,9 +2759,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
ScenePresence sp; ScenePresence sp;
if (World.TryGetScenePresence(x, out sp)) if (World.TryGetScenePresence(x, out sp))
{ {
sp.Grouptitle = groupTitle;
((INPC)(sp.ControllingClient)).ActiveGroupId = groupID;
sp.SendAvatarDataToAllAgents(); sp.SendAvatarDataToAllAgents();
} }
return new LSL_Key(x.ToString()); return new LSL_Key(x.ToString());