diff options
author | Justin Clark-Casey (justincc) | 2011-08-11 02:19:13 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2011-08-11 02:19:13 +0100 |
commit | ee22569c9262277467df9a4b15674a1472fa0b71 (patch) | |
tree | 7488dfd04814435041d98ec5e8ef73708dedca80 | |
parent | comment out some of the currently less useful debug log messages (diff) | |
download | opensim-SC_OLD-ee22569c9262277467df9a4b15674a1472fa0b71.zip opensim-SC_OLD-ee22569c9262277467df9a4b15674a1472fa0b71.tar.gz opensim-SC_OLD-ee22569c9262277467df9a4b15674a1472fa0b71.tar.bz2 opensim-SC_OLD-ee22569c9262277467df9a4b15674a1472fa0b71.tar.xz |
only accept npc UUIDs to osNpc* functions, not names (except for create)
3 files changed, 20 insertions, 24 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 71fc15f..91ac3b7 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -2153,7 +2153,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2153 | /// <param name="avatar"></param> | 2153 | /// <param name="avatar"></param> |
2154 | /// <param name="notecardName">The name of the notecard to which to save the appearance.</param> | 2154 | /// <param name="notecardName">The name of the notecard to which to save the appearance.</param> |
2155 | /// <returns>The asset ID of the notecard saved.</returns> | 2155 | /// <returns>The asset ID of the notecard saved.</returns> |
2156 | public LSL_Key osNpcSaveAppearance(string avatar, string notecardName) | 2156 | public LSL_Key osNpcSaveAppearance(LSL_Key npc, string notecardName) |
2157 | { | 2157 | { |
2158 | CheckThreatLevel(ThreatLevel.High, "osNpcSaveAppearance"); | 2158 | CheckThreatLevel(ThreatLevel.High, "osNpcSaveAppearance"); |
2159 | 2159 | ||
@@ -2161,20 +2161,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2161 | 2161 | ||
2162 | if (npcModule != null) | 2162 | if (npcModule != null) |
2163 | { | 2163 | { |
2164 | UUID avatarId = UUID.Zero; | 2164 | UUID npcId = new UUID(npc.m_string); |
2165 | if (!UUID.TryParse(avatar, out avatarId)) | ||
2166 | return new LSL_Key(UUID.Zero.ToString()); | ||
2167 | 2165 | ||
2168 | if (!npcModule.IsNPC(avatarId, m_host.ParentGroup.Scene)) | 2166 | if (!npcModule.IsNPC(npcId, m_host.ParentGroup.Scene)) |
2169 | return new LSL_Key(UUID.Zero.ToString()); | 2167 | return new LSL_Key(UUID.Zero.ToString()); |
2170 | 2168 | ||
2171 | return SaveAppearanceToNotecard(avatarId, notecardName); | 2169 | return SaveAppearanceToNotecard(npcId, notecardName); |
2172 | } | 2170 | } |
2173 | 2171 | ||
2174 | return new LSL_Key(UUID.Zero.ToString()); | 2172 | return new LSL_Key(UUID.Zero.ToString()); |
2175 | } | 2173 | } |
2176 | 2174 | ||
2177 | public void osNpcLoadAppearance(string avatar, string notecardNameOrUuid) | 2175 | public void osNpcLoadAppearance(LSL_Key npc, string notecardNameOrUuid) |
2178 | { | 2176 | { |
2179 | CheckThreatLevel(ThreatLevel.High, "osNpcLoadAppearance"); | 2177 | CheckThreatLevel(ThreatLevel.High, "osNpcLoadAppearance"); |
2180 | 2178 | ||
@@ -2182,11 +2180,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2182 | 2180 | ||
2183 | if (npcModule != null) | 2181 | if (npcModule != null) |
2184 | { | 2182 | { |
2185 | UUID avatarId = UUID.Zero; | 2183 | UUID npcId = new UUID(npc.m_string); |
2186 | if (!UUID.TryParse(avatar, out avatarId)) | ||
2187 | return; | ||
2188 | 2184 | ||
2189 | if (!npcModule.IsNPC(avatarId, m_host.ParentGroup.Scene)) | 2185 | if (!npcModule.IsNPC(npcId, m_host.ParentGroup.Scene)) |
2190 | return; | 2186 | return; |
2191 | 2187 | ||
2192 | string appearanceSerialized = LoadNotecard(notecardNameOrUuid); | 2188 | string appearanceSerialized = LoadNotecard(notecardNameOrUuid); |
@@ -2197,7 +2193,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2197 | AvatarAppearance appearance = new AvatarAppearance(); | 2193 | AvatarAppearance appearance = new AvatarAppearance(); |
2198 | appearance.Unpack(appearanceOsd); | 2194 | appearance.Unpack(appearanceOsd); |
2199 | 2195 | ||
2200 | npcModule.SetNPCAppearance(avatarId, appearance, m_host.ParentGroup.Scene); | 2196 | npcModule.SetNPCAppearance(npcId, appearance, m_host.ParentGroup.Scene); |
2201 | } | 2197 | } |
2202 | } | 2198 | } |
2203 | 2199 | ||
@@ -2213,7 +2209,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2213 | } | 2209 | } |
2214 | } | 2210 | } |
2215 | 2211 | ||
2216 | public void osNpcMoveToTarget(LSL_Key npc, LSL_Vector position, int moveParams) | 2212 | public void osNpcMoveToTarget(LSL_Key npc, LSL_Vector position, int options) |
2217 | { | 2213 | { |
2218 | CheckThreatLevel(ThreatLevel.High, "osNpcMoveToTarget"); | 2214 | CheckThreatLevel(ThreatLevel.High, "osNpcMoveToTarget"); |
2219 | 2215 | ||
@@ -2225,8 +2221,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2225 | new UUID(npc.m_string), | 2221 | new UUID(npc.m_string), |
2226 | World, | 2222 | World, |
2227 | pos, | 2223 | pos, |
2228 | (moveParams & ScriptBaseClass.OS_NPC_NO_FLY) != 0, | 2224 | (options & ScriptBaseClass.OS_NPC_NO_FLY) != 0, |
2229 | (moveParams & ScriptBaseClass.OS_NPC_LAND_AT_TARGET) != 0); | 2225 | (options & ScriptBaseClass.OS_NPC_LAND_AT_TARGET) != 0); |
2230 | } | 2226 | } |
2231 | } | 2227 | } |
2232 | 2228 | ||
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index 56be9d9..f4a618b 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | |||
@@ -170,10 +170,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
170 | 170 | ||
171 | 171 | ||
172 | key osNpcCreate(string user, string name, vector position, key cloneFrom); | 172 | key osNpcCreate(string user, string name, vector position, key cloneFrom); |
173 | LSL_Key osNpcSaveAppearance(string avatar, string notecardName); | 173 | LSL_Key osNpcSaveAppearance(key npc, string notecardName); |
174 | void osNpcLoadAppearance(string avatar, string notecardNameOrUuid); | 174 | void osNpcLoadAppearance(key npc, string notecardNameOrUuid); |
175 | void osNpcMoveTo(key npc, vector position); | 175 | void osNpcMoveTo(key npc, vector position); |
176 | void osNpcMoveToTarget(key npc, vector position, int noFly); | 176 | void osNpcMoveToTarget(key npc, vector position, int options); |
177 | void osNpcStopMoveTo(LSL_Key npc); | 177 | void osNpcStopMoveTo(LSL_Key npc); |
178 | void osNpcSay(key npc, string message); | 178 | void osNpcSay(key npc, string message); |
179 | void osNpcRemove(key npc); | 179 | void osNpcRemove(key npc); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index c745e5c..84d61f4 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | |||
@@ -483,14 +483,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
483 | return m_OSSL_Functions.osNpcCreate(user, name, position, cloneFrom); | 483 | return m_OSSL_Functions.osNpcCreate(user, name, position, cloneFrom); |
484 | } | 484 | } |
485 | 485 | ||
486 | public key osNpcSaveAppearance(string avatar, string notecardName) | 486 | public key osNpcSaveAppearance(key npc, string notecardName) |
487 | { | 487 | { |
488 | return m_OSSL_Functions.osNpcSaveAppearance(avatar, notecardName); | 488 | return m_OSSL_Functions.osNpcSaveAppearance(npc, notecardName); |
489 | } | 489 | } |
490 | 490 | ||
491 | public void osNpcLoadAppearance(string avatar, string notecardNameOrUuid) | 491 | public void osNpcLoadAppearance(key npc, string notecardNameOrUuid) |
492 | { | 492 | { |
493 | m_OSSL_Functions.osNpcLoadAppearance(avatar, notecardNameOrUuid); | 493 | m_OSSL_Functions.osNpcLoadAppearance(npc, notecardNameOrUuid); |
494 | } | 494 | } |
495 | 495 | ||
496 | public void osNpcMoveTo(key npc, vector position) | 496 | public void osNpcMoveTo(key npc, vector position) |
@@ -498,9 +498,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
498 | m_OSSL_Functions.osNpcMoveTo(npc, position); | 498 | m_OSSL_Functions.osNpcMoveTo(npc, position); |
499 | } | 499 | } |
500 | 500 | ||
501 | public void osNpcMoveToTarget(key npc, vector position, int noFly) | 501 | public void osNpcMoveToTarget(key npc, vector position, int options) |
502 | { | 502 | { |
503 | m_OSSL_Functions.osNpcMoveToTarget(npc, position, noFly); | 503 | m_OSSL_Functions.osNpcMoveToTarget(npc, position, options); |
504 | } | 504 | } |
505 | 505 | ||
506 | public void osNpcStopMoveTo(LSL_Key npc) | 506 | public void osNpcStopMoveTo(LSL_Key npc) |