only accept npc UUIDs to osNpc* functions, not names (except for create)

bulletsim
Justin Clark-Casey (justincc) 2011-08-11 02:19:13 +01:00
parent cace6eaa8a
commit ee22569c92
3 changed files with 21 additions and 25 deletions

View File

@ -2153,7 +2153,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
/// <param name="avatar"></param>
/// <param name="notecardName">The name of the notecard to which to save the appearance.</param>
/// <returns>The asset ID of the notecard saved.</returns>
public LSL_Key osNpcSaveAppearance(string avatar, string notecardName)
public LSL_Key osNpcSaveAppearance(LSL_Key npc, string notecardName)
{
CheckThreatLevel(ThreatLevel.High, "osNpcSaveAppearance");
@ -2161,20 +2161,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (npcModule != null)
{
UUID avatarId = UUID.Zero;
if (!UUID.TryParse(avatar, out avatarId))
UUID npcId = new UUID(npc.m_string);
if (!npcModule.IsNPC(npcId, m_host.ParentGroup.Scene))
return new LSL_Key(UUID.Zero.ToString());
if (!npcModule.IsNPC(avatarId, m_host.ParentGroup.Scene))
return new LSL_Key(UUID.Zero.ToString());
return SaveAppearanceToNotecard(avatarId, notecardName);
return SaveAppearanceToNotecard(npcId, notecardName);
}
return new LSL_Key(UUID.Zero.ToString());
}
public void osNpcLoadAppearance(string avatar, string notecardNameOrUuid)
public void osNpcLoadAppearance(LSL_Key npc, string notecardNameOrUuid)
{
CheckThreatLevel(ThreatLevel.High, "osNpcLoadAppearance");
@ -2182,11 +2180,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (npcModule != null)
{
UUID avatarId = UUID.Zero;
if (!UUID.TryParse(avatar, out avatarId))
return;
UUID npcId = new UUID(npc.m_string);
if (!npcModule.IsNPC(avatarId, m_host.ParentGroup.Scene))
if (!npcModule.IsNPC(npcId, m_host.ParentGroup.Scene))
return;
string appearanceSerialized = LoadNotecard(notecardNameOrUuid);
@ -2197,7 +2193,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
AvatarAppearance appearance = new AvatarAppearance();
appearance.Unpack(appearanceOsd);
npcModule.SetNPCAppearance(avatarId, appearance, m_host.ParentGroup.Scene);
npcModule.SetNPCAppearance(npcId, appearance, m_host.ParentGroup.Scene);
}
}
@ -2213,7 +2209,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
}
public void osNpcMoveToTarget(LSL_Key npc, LSL_Vector position, int moveParams)
public void osNpcMoveToTarget(LSL_Key npc, LSL_Vector position, int options)
{
CheckThreatLevel(ThreatLevel.High, "osNpcMoveToTarget");
@ -2225,8 +2221,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
new UUID(npc.m_string),
World,
pos,
(moveParams & ScriptBaseClass.OS_NPC_NO_FLY) != 0,
(moveParams & ScriptBaseClass.OS_NPC_LAND_AT_TARGET) != 0);
(options & ScriptBaseClass.OS_NPC_NO_FLY) != 0,
(options & ScriptBaseClass.OS_NPC_LAND_AT_TARGET) != 0);
}
}

View File

@ -170,10 +170,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
key osNpcCreate(string user, string name, vector position, key cloneFrom);
LSL_Key osNpcSaveAppearance(string avatar, string notecardName);
void osNpcLoadAppearance(string avatar, string notecardNameOrUuid);
LSL_Key osNpcSaveAppearance(key npc, string notecardName);
void osNpcLoadAppearance(key npc, string notecardNameOrUuid);
void osNpcMoveTo(key npc, vector position);
void osNpcMoveToTarget(key npc, vector position, int noFly);
void osNpcMoveToTarget(key npc, vector position, int options);
void osNpcStopMoveTo(LSL_Key npc);
void osNpcSay(key npc, string message);
void osNpcRemove(key npc);

View File

@ -483,14 +483,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
return m_OSSL_Functions.osNpcCreate(user, name, position, cloneFrom);
}
public key osNpcSaveAppearance(string avatar, string notecardName)
public key osNpcSaveAppearance(key npc, string notecardName)
{
return m_OSSL_Functions.osNpcSaveAppearance(avatar, notecardName);
return m_OSSL_Functions.osNpcSaveAppearance(npc, notecardName);
}
public void osNpcLoadAppearance(string avatar, string notecardNameOrUuid)
public void osNpcLoadAppearance(key npc, string notecardNameOrUuid)
{
m_OSSL_Functions.osNpcLoadAppearance(avatar, notecardNameOrUuid);
m_OSSL_Functions.osNpcLoadAppearance(npc, notecardNameOrUuid);
}
public void osNpcMoveTo(key npc, vector position)
@ -498,9 +498,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
m_OSSL_Functions.osNpcMoveTo(npc, position);
}
public void osNpcMoveToTarget(key npc, vector position, int noFly)
public void osNpcMoveToTarget(key npc, vector position, int options)
{
m_OSSL_Functions.osNpcMoveToTarget(npc, position, noFly);
m_OSSL_Functions.osNpcMoveToTarget(npc, position, options);
}
public void osNpcStopMoveTo(LSL_Key npc)