aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared/Api
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs28
1 files changed, 24 insertions, 4 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index b1066b5..90c4636 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -2130,20 +2130,40 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2130 public LSL_Key osNpcCreate(string firstname, string lastname, LSL_Vector position, LSL_Key cloneFrom) 2130 public LSL_Key osNpcCreate(string firstname, string lastname, LSL_Vector position, LSL_Key cloneFrom)
2131 { 2131 {
2132 CheckThreatLevel(ThreatLevel.High, "osNpcCreate"); 2132 CheckThreatLevel(ThreatLevel.High, "osNpcCreate");
2133 //QueueUserWorkItem
2134 2133
2135 INPCModule module = World.RequestModuleInterface<INPCModule>(); 2134 INPCModule module = World.RequestModuleInterface<INPCModule>();
2136 if (module != null) 2135 if (module != null)
2137 { 2136 {
2138 ScenePresence clonePresence = World.GetScenePresence(new UUID(cloneFrom.m_string)); 2137 AvatarAppearance appearance = null;
2139 if (clonePresence == null) 2138
2139 UUID cloneId;
2140 if (UUID.TryParse(cloneFrom, out cloneId))
2141 {
2142 ScenePresence clonePresence = World.GetScenePresence(new UUID(cloneFrom.m_string));
2143 if (clonePresence != null)
2144 appearance = clonePresence.Appearance;
2145 }
2146
2147 if (appearance == null)
2148 {
2149 string appearanceSerialized = LoadNotecard(cloneFrom.m_string);
2150
2151 if (appearanceSerialized != null)
2152 {
2153 OSDMap appearanceOsd = (OSDMap)OSDParser.DeserializeLLSDXml(appearanceSerialized);
2154 appearance = new AvatarAppearance();
2155 appearance.Unpack(appearanceOsd);
2156 }
2157 }
2158
2159 if (appearance == null)
2140 return new LSL_Key(UUID.Zero.ToString()); 2160 return new LSL_Key(UUID.Zero.ToString());
2141 2161
2142 UUID x = module.CreateNPC(firstname, 2162 UUID x = module.CreateNPC(firstname,
2143 lastname, 2163 lastname,
2144 new Vector3((float) position.x, (float) position.y, (float) position.z), 2164 new Vector3((float) position.x, (float) position.y, (float) position.z),
2145 World, 2165 World,
2146 clonePresence.Appearance); 2166 appearance);
2147 2167
2148 return new LSL_Key(x.ToString()); 2168 return new LSL_Key(x.ToString());
2149 } 2169 }