Make script asset fetches synchronous. Script instantiation synchronization

will not work if the instance is not created when the method returns.
slimupdates
Melanie 2010-04-19 15:29:35 +01:00
parent a89208b465
commit 3e63ce6d9d
1 changed files with 24 additions and 28 deletions

View File

@ -282,36 +282,32 @@ namespace OpenSim.Region.Framework.Scenes
return; return;
} }
m_part.ParentGroup.Scene.AssetService.Get( AssetBase asset = m_part.ParentGroup.Scene.AssetService.Get(item.AssetID.ToString());
item.AssetID.ToString(), this, delegate(string id, object sender, AssetBase asset) if (null == asset)
{ {
if (null == asset) m_log.ErrorFormat(
{ "[PRIM INVENTORY]: " +
m_log.ErrorFormat( "Couldn't start script {0}, {1} at {2} in {3} since asset ID {4} could not be found",
"[PRIM INVENTORY]: " + item.Name, item.ItemID, m_part.AbsolutePosition,
"Couldn't start script {0}, {1} at {2} in {3} since asset ID {4} could not be found", m_part.ParentGroup.Scene.RegionInfo.RegionName, item.AssetID);
item.Name, item.ItemID, m_part.AbsolutePosition, }
m_part.ParentGroup.Scene.RegionInfo.RegionName, item.AssetID); else
} {
else if (m_part.ParentGroup.m_savedScriptState != null)
{ RestoreSavedScriptState(item.OldItemID, item.ItemID);
if (m_part.ParentGroup.m_savedScriptState != null)
RestoreSavedScriptState(item.OldItemID, item.ItemID);
lock (m_items) lock (m_items)
{ {
m_items[item.ItemID].PermsMask = 0; m_items[item.ItemID].PermsMask = 0;
m_items[item.ItemID].PermsGranter = UUID.Zero; m_items[item.ItemID].PermsGranter = UUID.Zero;
}
string script = Utils.BytesToString(asset.Data);
m_part.ParentGroup.Scene.EventManager.TriggerRezScript(
m_part.LocalId, item.ItemID, script, startParam, postOnRez, engine, stateSource);
m_part.ParentGroup.AddActiveScriptCount(1);
m_part.ScheduleFullUpdate();
}
} }
);
string script = Utils.BytesToString(asset.Data);
m_part.ParentGroup.Scene.EventManager.TriggerRezScript(
m_part.LocalId, item.ItemID, script, startParam, postOnRez, engine, stateSource);
m_part.ParentGroup.AddActiveScriptCount(1);
m_part.ScheduleFullUpdate();
}
} }
} }