aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
diff options
context:
space:
mode:
authorMelanie2012-01-06 22:35:06 +0000
committerMelanie2012-01-06 22:35:06 +0000
commit7518b075b76fea062971a9e5fb716118130ebe43 (patch)
treedf4449fdfe02de0b706cac6024603e4ebabdb256 /OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
parenteliminate a few tabs from OpenSimDefaults.ini (diff)
downloadopensim-SC_OLD-7518b075b76fea062971a9e5fb716118130ebe43.zip
opensim-SC_OLD-7518b075b76fea062971a9e5fb716118130ebe43.tar.gz
opensim-SC_OLD-7518b075b76fea062971a9e5fb716118130ebe43.tar.bz2
opensim-SC_OLD-7518b075b76fea062971a9e5fb716118130ebe43.tar.xz
Add osNpcCreateOwned to create an owned NPC. Those can be sensed only by the owner, can be destroyed only by the owner and only the owner can save their appearance. Added "NPC" as a flag to llSensor to sense NPCs and exclude them from "AGENT" results.
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs25
1 files changed, 21 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 bb0ba3d..c1a700a 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -2067,10 +2067,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2067 return retVal; 2067 return retVal;
2068 } 2068 }
2069 2069
2070 public LSL_Key osNpcCreateOwned(string firstname, string lastname, LSL_Vector position, string notecard)
2071 {
2072 CheckThreatLevel(ThreatLevel.High, "osNpcCreateOwned");
2073 return NpcCreate(firstname, lastname, position, notecard, true);
2074 }
2075
2070 public LSL_Key osNpcCreate(string firstname, string lastname, LSL_Vector position, string notecard) 2076 public LSL_Key osNpcCreate(string firstname, string lastname, LSL_Vector position, string notecard)
2071 { 2077 {
2072 CheckThreatLevel(ThreatLevel.High, "osNpcCreate"); 2078 CheckThreatLevel(ThreatLevel.High, "osNpcCreated");
2079 return NpcCreate(firstname, lastname, position, notecard, false);
2080 }
2073 2081
2082 private LSL_Key NpcCreate(string firstname, string lastname, LSL_Vector position, string notecard, bool owned)
2083 {
2074 INPCModule module = World.RequestModuleInterface<INPCModule>(); 2084 INPCModule module = World.RequestModuleInterface<INPCModule>();
2075 if (module != null) 2085 if (module != null)
2076 { 2086 {
@@ -2099,11 +2109,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2099 if (appearance == null) 2109 if (appearance == null)
2100 return new LSL_Key(UUID.Zero.ToString()); 2110 return new LSL_Key(UUID.Zero.ToString());
2101 2111
2112 UUID ownerID = UUID.Zero;
2113 if (owned)
2114 ownerID = m_host.OwnerID;
2102 UUID x = module.CreateNPC(firstname, 2115 UUID x = module.CreateNPC(firstname,
2103 lastname, 2116 lastname,
2104 new Vector3((float) position.x, (float) position.y, (float) position.z), 2117 new Vector3((float) position.x, (float) position.y, (float) position.z),
2105 World, 2118 ownerID,
2106 appearance); 2119 World,appearance);
2107 2120
2108 return new LSL_Key(x.ToString()); 2121 return new LSL_Key(x.ToString());
2109 } 2122 }
@@ -2132,6 +2145,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2132 if (!npcModule.IsNPC(npcId, m_host.ParentGroup.Scene)) 2145 if (!npcModule.IsNPC(npcId, m_host.ParentGroup.Scene))
2133 return new LSL_Key(UUID.Zero.ToString()); 2146 return new LSL_Key(UUID.Zero.ToString());
2134 2147
2148 UUID ownerID = npcModule.GetOwner(npcId);
2149 if (ownerID != UUID.Zero && ownerID != m_host.OwnerID)
2150 return new LSL_Key(UUID.Zero.ToString());
2151
2135 return SaveAppearanceToNotecard(npcId, notecard); 2152 return SaveAppearanceToNotecard(npcId, notecard);
2136 } 2153 }
2137 2154
@@ -2311,7 +2328,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2311 INPCModule module = World.RequestModuleInterface<INPCModule>(); 2328 INPCModule module = World.RequestModuleInterface<INPCModule>();
2312 if (module != null) 2329 if (module != null)
2313 { 2330 {
2314 module.DeleteNPC(new UUID(npc.m_string), World); 2331 module.DeleteNPC(new UUID(npc.m_string), m_host.OwnerID, World);
2315 } 2332 }
2316 } 2333 }
2317 2334