some cleanup

0.9.1.0-post-fixes
UbitUmarov 2018-11-18 22:39:08 +00:00
parent 5b2fab99a6
commit 01b84ef46b
3 changed files with 392 additions and 398 deletions

View File

@ -12963,12 +12963,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_host.SetForceMouselook(mouselook != 0);
}
public LSL_Float llGetObjectMass(string id)
public LSL_Float llGetObjectMass(LSL_Key id)
{
m_host.AddScriptLPS(1);
UUID key = new UUID();
if (UUID.TryParse(id, out key))
{
if (!UUID.TryParse(id, out key))
return 0;
// return total object mass
SceneObjectPart part = World.GetSceneObjectPart(key);
if (part != null)
@ -12986,10 +12987,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
else
{
return (double)avatar.GetMass();
}
return avatar.GetMass();
}
}
return 0;
}
@ -14197,19 +14198,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return ret;
}
public LSL_Integer llGetObjectPrimCount(string object_id)
public LSL_Integer llGetObjectPrimCount(LSL_Key object_id)
{
m_host.AddScriptLPS(1);
SceneObjectPart part = World.GetSceneObjectPart(new UUID(object_id));
if (part == null)
{
UUID id;
if(!UUID.TryParse(object_id, out id))
return 0;
}
else
{
SceneObjectPart part = World.GetSceneObjectPart(id);
if (part == null)
return 0;
return part.ParentGroup.PrimCount;
}
}
public LSL_Integer llGetParcelMaxPrims(LSL_Vector pos, int sim_wide)
{
@ -14265,27 +14266,24 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return ret;
}
public LSL_String llStringTrim(string src, int type)
public LSL_String llStringTrim(LSL_String src, LSL_Integer type)
{
m_host.AddScriptLPS(1);
if (type == (int)ScriptBaseClass.STRING_TRIM_HEAD) { return src.TrimStart(); }
if (type == (int)ScriptBaseClass.STRING_TRIM_TAIL) { return src.TrimEnd(); }
if (type == (int)ScriptBaseClass.STRING_TRIM) { return src.Trim(); }
if (type == (int)ScriptBaseClass.STRING_TRIM_HEAD) { return ((string)src).TrimStart(); }
if (type == (int)ScriptBaseClass.STRING_TRIM_TAIL) { return ((string)src).TrimEnd(); }
if (type == (int)ScriptBaseClass.STRING_TRIM) { return ((string)src).Trim(); }
return src;
}
public LSL_List llGetObjectDetails(string id, LSL_List args)
public LSL_List llGetObjectDetails(LSL_Key id, LSL_List args)
{
m_host.AddScriptLPS(1);
LSL_List ret = new LSL_List();
UUID key = new UUID();
if (!UUID.TryParse(id, out key))
return ret;
if (UUID.TryParse(id, out key))
{
ScenePresence av = World.GetScenePresence(key);
if (av != null)
{
foreach (object o in args.Data)
@ -14329,13 +14327,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
ret.Add(new LSL_Vector((double)avvel.X, (double)avvel.Y, (double)avvel.Z));
break;
case ScriptBaseClass.OBJECT_OWNER:
ret.Add(new LSL_String(id));
ret.Add(new LSL_Key((string)id));
break;
case ScriptBaseClass.OBJECT_GROUP:
ret.Add(new LSL_String(UUID.Zero.ToString()));
break;
case ScriptBaseClass.OBJECT_CREATOR:
ret.Add(new LSL_String(UUID.Zero.ToString()));
ret.Add(new LSL_Key(UUID.Zero.ToString()));
break;
// For the following 8 see the Object version below
case ScriptBaseClass.OBJECT_RUNNING_SCRIPT_COUNT:
@ -14373,7 +14371,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
else
{
ret.Add(new LSL_String(id));
ret.Add(new LSL_Key((string)id));
}
break;
case ScriptBaseClass.OBJECT_ATTACHED_POINT:
@ -14440,7 +14438,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
ret.Add(new LSL_Integer(invcount));
break;
case ScriptBaseClass.OBJECT_REZZER_KEY:
ret.Add(new LSL_Key(id));
ret.Add(new LSL_Key((string)id));
break;
case ScriptBaseClass.OBJECT_GROUP_TAG:
ret.Add(new LSL_String(av.Grouptitle));
@ -14454,7 +14452,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
break;
}
}
return ret;
}
@ -14659,13 +14656,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
break;
}
}
}
return ret;
}
}
return new LSL_List();
}
internal UUID GetScriptByName(string name)
{

View File

@ -169,11 +169,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
LSL_Integer llGetNumberOfPrims();
LSL_Integer llGetNumberOfSides();
LSL_String llGetObjectDesc();
LSL_List llGetObjectDetails(string id, LSL_List args);
LSL_Float llGetObjectMass(string id);
LSL_List llGetObjectDetails(LSL_Key objectId, LSL_List args);
LSL_Float llGetObjectMass(LSL_Key objectId);
LSL_String llGetObjectName();
LSL_Integer llGetObjectPermMask(int mask);
LSL_Integer llGetObjectPrimCount(string object_id);
LSL_Integer llGetObjectPrimCount(LSL_Key objectId);
LSL_Vector llGetOmega();
LSL_Key llGetOwner();
LSL_Key llGetOwnerKey(string id);
@ -416,7 +416,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
void llStopSound();
LSL_Integer llStringLength(string str);
LSL_String llStringToBase64(string str);
LSL_String llStringTrim(string src, int type);
LSL_String llStringTrim(LSL_String src, LSL_Integer type);
LSL_Integer llSubStringIndex(string source, string pattern);
void llTakeCamera(string avatar);
void llTakeControls(int controls, int accept, int pass_on);

View File

@ -641,7 +641,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
return m_LSL_Functions.llGetObjectDesc();
}
public LSL_List llGetObjectDetails(string id, LSL_List args)
public LSL_List llGetObjectDetails(LSL_Key id, LSL_List args)
{
return m_LSL_Functions.llGetObjectDetails(id, args);
}
@ -661,7 +661,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
return m_LSL_Functions.llGetObjectPermMask(mask);
}
public LSL_Integer llGetObjectPrimCount(string object_id)
public LSL_Integer llGetObjectPrimCount(LSL_Key object_id)
{
return m_LSL_Functions.llGetObjectPrimCount(object_id);
}
@ -1871,7 +1871,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
return m_LSL_Functions.llStringToBase64(str);
}
public LSL_String llStringTrim(string src, int type)
public LSL_String llStringTrim(LSL_String src, LSL_Integer type)
{
return m_LSL_Functions.llStringTrim(src, type);
}