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.
/// </returns>
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);
/// <summary>

View File

@ -157,14 +157,14 @@ namespace OpenSim.Region.OptionalModules.World.NPC
}
public UUID CreateNPC(string firstname, string lastname,
Vector3 position, UUID owner, bool senseAsAgent, Scene scene,
Vector3 position, UUID owner, bool senseAsAgent, Scene scene,
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,
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)
{
NPCAvatar npcAvatar = null;
@ -222,8 +222,9 @@ namespace OpenSim.Region.OptionalModules.World.NPC
ScenePresence sp;
if (scene.TryGetScenePresence(npcAvatar.AgentId, out sp))
{
npcAvatar.ActiveGroupId = groupID;
sp.CompleteMovement(npcAvatar, false);
sp.Grouptitle = groupTitle;
m_avatars.Add(npcAvatar.AgentId, npcAvatar);
// 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,
lastname,
position,
UUID.Random(),
ownerID,
groupTitle,
groupID,
senseAsAgent,
World,
appearance);
@ -2756,9 +2759,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
ScenePresence sp;
if (World.TryGetScenePresence(x, out sp))
{
sp.Grouptitle = groupTitle;
((INPC)(sp.ControllingClient)).ActiveGroupId = groupID;
sp.SendAvatarDataToAllAgents();
}
return new LSL_Key(x.ToString());