fix osDie harakiri for Yengine

0.9.1.0-post-fixes
UbitUmarov 2018-09-13 12:32:55 +01:00
parent 4652f8b84f
commit 075ebf3524
1 changed files with 20 additions and 17 deletions

View File

@ -134,7 +134,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public const string GridInfoServiceConfigSectionName = "GridInfoService"; public const string GridInfoServiceConfigSectionName = "GridInfoService";
internal IScriptEngine m_ScriptEngine; internal IScriptEngine m_ScriptEngine;
internal ILSL_Api m_LSL_Api = null; // get a reference to the LSL API so we can call methods housed there internal LSL_Api m_LSL_Api = null; // get a reference to the LSL API so we can call methods housed there
internal SceneObjectPart m_host; internal SceneObjectPart m_host;
internal TaskInventoryItem m_item; internal TaskInventoryItem m_item;
internal bool m_OSFunctionsEnabled = false; internal bool m_OSFunctionsEnabled = false;
@ -249,7 +249,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (m_LSL_Api != null) if (m_LSL_Api != null)
return; return;
m_LSL_Api = (ILSL_Api)m_ScriptEngine.GetApi(m_item.ItemID, "LSL"); m_LSL_Api = (LSL_Api)m_ScriptEngine.GetApi(m_item.ItemID, "LSL");
} }
// //
@ -2104,11 +2104,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return; return;
} }
InitLSL();
// harakiri check // harakiri check
if(objUUID == UUID.Zero) if(objUUID == UUID.Zero)
{ {
if (!m_host.ParentGroup.IsAttachment) if (!m_host.ParentGroup.IsAttachment)
throw new SelfDeleteException(); m_LSL_Api.llDie();
return; return;
} }
@ -2125,7 +2126,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// harakiri check // harakiri check
if(sceneOG.UUID == m_host.ParentGroup.UUID) if(sceneOG.UUID == m_host.ParentGroup.UUID)
throw new SelfDeleteException(); {
m_LSL_Api.llDie();
return;
}
// restrict to objects rezzed by host // restrict to objects rezzed by host
if(sceneOG.RezzerID == m_host.ParentGroup.UUID) if(sceneOG.RezzerID == m_host.ParentGroup.UUID)
@ -2806,23 +2810,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
InitLSL(); InitLSL();
// One needs to cast m_LSL_Api because we're using functions not // One needs to cast m_LSL_Api because we're using functions not
// on the ILSL_Api interface. // on the ILSL_Api interface.
LSL_Api LSL_Api = (LSL_Api)m_LSL_Api;
LSL_List retVal = new LSL_List(); LSL_List retVal = new LSL_List();
LSL_List remaining = new LSL_List(); LSL_List remaining = new LSL_List();
List<SceneObjectPart> parts = LSL_Api.GetLinkParts(linknumber); List<SceneObjectPart> parts = m_LSL_Api.GetLinkParts(linknumber);
foreach (SceneObjectPart part in parts) foreach (SceneObjectPart part in parts)
{ {
remaining = LSL_Api.GetPrimParams(part, rules, ref retVal); remaining = m_LSL_Api.GetPrimParams(part, rules, ref retVal);
} }
while (remaining.Length > 2) while (remaining.Length > 2)
{ {
linknumber = remaining.GetLSLIntegerItem(0); linknumber = remaining.GetLSLIntegerItem(0);
rules = remaining.GetSublist(1, -1); rules = remaining.GetSublist(1, -1);
parts = LSL_Api.GetLinkParts(linknumber); parts = m_LSL_Api.GetLinkParts(linknumber);
foreach (SceneObjectPart part in parts) foreach (SceneObjectPart part in parts)
remaining = LSL_Api.GetPrimParams(part, rules, ref retVal); remaining = m_LSL_Api.GetPrimParams(part, rules, ref retVal);
} }
return retVal; return retVal;
} }
@ -2832,7 +2835,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
CheckThreatLevel(ThreatLevel.VeryLow, "osForceCreateLink"); CheckThreatLevel(ThreatLevel.VeryLow, "osForceCreateLink");
InitLSL(); InitLSL();
((LSL_Api)m_LSL_Api).CreateLink(target, parent); m_LSL_Api.CreateLink(target, parent);
} }
public void osForceBreakLink(int linknum) public void osForceBreakLink(int linknum)
@ -2840,7 +2843,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
CheckThreatLevel(ThreatLevel.VeryLow, "osForceBreakLink"); CheckThreatLevel(ThreatLevel.VeryLow, "osForceBreakLink");
InitLSL(); InitLSL();
((LSL_Api)m_LSL_Api).BreakLink(linknum); m_LSL_Api.BreakLink(linknum);
} }
public void osForceBreakAllLinks() public void osForceBreakAllLinks()
@ -2848,7 +2851,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
CheckThreatLevel(ThreatLevel.VeryLow, "osForceBreakAllLinks"); CheckThreatLevel(ThreatLevel.VeryLow, "osForceBreakAllLinks");
InitLSL(); InitLSL();
((LSL_Api)m_LSL_Api).BreakAllLinks(); m_LSL_Api.BreakAllLinks();
} }
public LSL_Integer osIsNpc(LSL_Key npc) public LSL_Integer osIsNpc(LSL_Key npc)
@ -4029,7 +4032,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
CheckThreatLevel(ThreatLevel.High, "osForceAttachToAvatar"); CheckThreatLevel(ThreatLevel.High, "osForceAttachToAvatar");
InitLSL(); InitLSL();
((LSL_Api)m_LSL_Api).AttachToAvatar(attachmentPoint); m_LSL_Api.AttachToAvatar(attachmentPoint);
} }
public void osForceAttachToAvatarFromInventory(string itemName, int attachmentPoint) public void osForceAttachToAvatarFromInventory(string itemName, int attachmentPoint)
@ -4064,7 +4067,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (item == null) if (item == null)
{ {
((LSL_Api)m_LSL_Api).llSay(0, string.Format("Could not find object '{0}'", itemName)); m_LSL_Api.llSay(0, string.Format("Could not find object '{0}'", itemName));
throw new Exception(String.Format("The inventory item '{0}' could not be found", itemName)); throw new Exception(String.Format("The inventory item '{0}' could not be found", itemName));
} }
@ -4073,7 +4076,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// FIXME: Temporary null check for regression tests since they dont' have the infrastructure to set // FIXME: Temporary null check for regression tests since they dont' have the infrastructure to set
// up the api reference. // up the api reference.
if (m_LSL_Api != null) if (m_LSL_Api != null)
((LSL_Api)m_LSL_Api).llSay(0, string.Format("Unable to attach, item '{0}' is not an object.", itemName)); m_LSL_Api.llSay(0, string.Format("Unable to attach, item '{0}' is not an object.", itemName));
throw new Exception(String.Format("The inventory item '{0}' is not an object", itemName)); throw new Exception(String.Format("The inventory item '{0}' is not an object", itemName));
} }
@ -4091,7 +4094,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_log.ErrorFormat( m_log.ErrorFormat(
"[OSSL API]: Could not create user inventory item {0} for {1}, attach point {2} in {3}: {4}", "[OSSL API]: Could not create user inventory item {0} for {1}, attach point {2} in {3}: {4}",
itemName, m_host.Name, attachmentPoint, World.Name, message); itemName, m_host.Name, attachmentPoint, World.Name, message);
((LSL_Api)m_LSL_Api).llSay(0, message); m_LSL_Api.llSay(0, message);
return; return;
} }
@ -4103,7 +4106,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
CheckThreatLevel(ThreatLevel.High, "osForceDetachFromAvatar"); CheckThreatLevel(ThreatLevel.High, "osForceDetachFromAvatar");
InitLSL(); InitLSL();
((LSL_Api)m_LSL_Api).DetachFromAvatar(); m_LSL_Api.DetachFromAvatar();
} }
public LSL_List osGetNumberOfAttachments(LSL_Key avatar, LSL_List attachmentPoints) public LSL_List osGetNumberOfAttachments(LSL_Key avatar, LSL_List attachmentPoints)