New OSSL function: osNpcSetProfileImage(LSL_Key npc, string image); This patch gives possibility to set image in created NPC's profile. You can use UUID of the texture or name of texture included in prim's inventory.

Signed-off-by: Mandarinka Tasty <mandarinka.tasty@gmail.com>
Signed-off-by: UbitUmarov <ajlduarte@sapo.pt>
melanie
Mandarinka Tasty 2016-12-14 01:14:23 +01:00 committed by UbitUmarov
parent 69776aa70c
commit ec883d0f15
6 changed files with 45 additions and 1 deletions

View File

@ -1011,7 +1011,7 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
{
remoteClient.SendAvatarProperties(avatarID, ((INPC)(p.ControllingClient)).profileAbout, ((INPC)(p.ControllingClient)).Born,
Utils.StringToBytes("Non Player Character (NPC)"), "NPCs have no life", 16,
UUID.Zero, UUID.Zero, "", UUID.Zero);
UUID.Zero, ((INPC)(p.ControllingClient)).profileImage, "", UUID.Zero);
remoteClient.SendAvatarInterestsReply(avatarID, 0, "",
0, "Getting into trouble", "Droidspeak");
return;

View File

@ -59,6 +59,7 @@ namespace OpenSim.Region.Framework.Interfaces
UUID ActiveGroupId { get; set; }
UUID Owner { get; }
string profileAbout { get; set; }
UUID profileImage { get; set; }
string Born { get; set; }
}

View File

@ -70,6 +70,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
private readonly UUID m_ownerID;
private UUID m_hostGroupID;
private string m_profileAbout = "";
private UUID m_profileImage = UUID.Zero;
private string m_born;
public List<uint> SelectedObjects {get; private set;}
@ -110,6 +111,13 @@ namespace OpenSim.Region.OptionalModules.World.NPC
m_profileAbout = value;
}
}
public UUID profileImage
{
get { return m_profileImage; }
set { m_profileImage = value; }
}
public IScene Scene
{
get { return m_scene; }

View File

@ -3018,6 +3018,35 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
}
public void osNpcSetProfileImage(LSL_Key npc, string image)
{
CheckThreatLevel(ThreatLevel.High, "osNpcCreate");
m_host.AddScriptLPS(1);
INPCModule module = World.RequestModuleInterface<INPCModule>();
if (module != null)
{
UUID npcId = new UUID(npc.m_string);
if (!module.CheckPermissions(npcId, m_host.OwnerID))
return;
UUID ImageID = new UUID();
ImageID = ScriptUtils.GetAssetIdFromItemName(m_host, image, (int)AssetType.Texture);
if (ImageID == null || ImageID == UUID.Zero)
{
if (!UUID.TryParse(image, out ImageID))
return;
}
ScenePresence sp = World.GetScenePresence(npcId);
if (sp != null)
((INPC)(sp.ControllingClient)).profileImage = ImageID;
}
}
public void osNpcSay(LSL_Key npc, string message)
{
osNpcSay(npc, 0, message);

View File

@ -344,6 +344,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
void osNpcSetRot(LSL_Key npc, rotation rot);
void osNpcStopMoveToTarget(LSL_Key npc);
void osNpcSetProfileAbout(LSL_Key npc, string about);
void osNpcSetProfileImage(LSL_Key npc, string image);
void osNpcSay(key npc, string message);
void osNpcSay(key npc, int channel, string message);
void osNpcShout(key npc, int channel, string message);

View File

@ -642,6 +642,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
m_OSSL_Functions.osNpcSetProfileAbout(npc, about);
}
public void osNpcSetProfileImage(LSL_Key npc, string image)
{
m_OSSL_Functions.osNpcSetProfileImage(npc, image);
}
public void osNpcSay(key npc, string message)
{
m_OSSL_Functions.osNpcSay(npc, message);