diff options
Diffstat (limited to 'OpenSim/Region/ScriptEngine')
4 files changed, 128 insertions, 14 deletions
diff --git a/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs b/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs index f49aea8..ae148a9 100644 --- a/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs +++ b/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs | |||
@@ -96,7 +96,6 @@ namespace OpenSim.Region.ScriptEngine.Interfaces | |||
96 | UUID GetDetectID(int idx); | 96 | UUID GetDetectID(int idx); |
97 | void SaveState(string assembly); | 97 | void SaveState(string assembly); |
98 | void DestroyScriptInstance(); | 98 | void DestroyScriptInstance(); |
99 | bool CanBeDeleted(); | ||
100 | 99 | ||
101 | IScriptApi GetApi(string name); | 100 | IScriptApi GetApi(string name); |
102 | 101 | ||
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index a94cd46..6e5436a 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -2002,6 +2002,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2002 | 2002 | ||
2003 | //KF: Do NOT use this next line if using ODE physics engine. This need a switch based on .ini Phys Engine type | 2003 | //KF: Do NOT use this next line if using ODE physics engine. This need a switch based on .ini Phys Engine type |
2004 | // part.ParentGroup.AbsolutePosition = part.ParentGroup.AbsolutePosition; | 2004 | // part.ParentGroup.AbsolutePosition = part.ParentGroup.AbsolutePosition; |
2005 | |||
2006 | // So, after thinking about this for a bit, the issue with the part.ParentGroup.AbsolutePosition = part.ParentGroup.AbsolutePosition line | ||
2007 | // is it isn't compatible with vehicles because it causes the vehicle body to have to be broken down and rebuilt | ||
2008 | // It's perfectly okay when the object is not an active physical body though. | ||
2009 | // So, part.ParentGroup.ResetChildPrimPhysicsPositions(); does the thing that Kitto is warning against | ||
2010 | // but only if the object is not physial and active. This is important for rotating doors. | ||
2011 | // without the absoluteposition = absoluteposition happening, the doors do not move in the physics | ||
2012 | // scene | ||
2013 | if (part.PhysActor != null && !part.PhysActor.IsPhysical) | ||
2014 | { | ||
2015 | part.ParentGroup.ResetChildPrimPhysicsPositions(); | ||
2016 | } | ||
2005 | } | 2017 | } |
2006 | 2018 | ||
2007 | /// <summary> | 2019 | /// <summary> |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs index 0f4a9ad..8333a27 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs | |||
@@ -1018,10 +1018,5 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
1018 | { | 1018 | { |
1019 | get { return m_RegionID; } | 1019 | get { return m_RegionID; } |
1020 | } | 1020 | } |
1021 | |||
1022 | public bool CanBeDeleted() | ||
1023 | { | ||
1024 | return true; | ||
1025 | } | ||
1026 | } | 1021 | } |
1027 | } | 1022 | } |
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index 4dc6cb8..2fc2ea1 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | |||
@@ -1328,6 +1328,19 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1328 | } | 1328 | } |
1329 | } | 1329 | } |
1330 | 1330 | ||
1331 | string map = String.Empty; | ||
1332 | |||
1333 | if (File.Exists(fn + ".map")) | ||
1334 | { | ||
1335 | FileStream mfs = File.Open(fn + ".map", FileMode.Open, FileAccess.Read); | ||
1336 | StreamReader msr = new StreamReader(mfs); | ||
1337 | |||
1338 | map = msr.ReadToEnd(); | ||
1339 | |||
1340 | msr.Close(); | ||
1341 | mfs.Close(); | ||
1342 | } | ||
1343 | |||
1331 | XmlElement assemblyData = doc.CreateElement("", "Assembly", ""); | 1344 | XmlElement assemblyData = doc.CreateElement("", "Assembly", ""); |
1332 | XmlAttribute assemblyName = doc.CreateAttribute("", "Filename", ""); | 1345 | XmlAttribute assemblyName = doc.CreateAttribute("", "Filename", ""); |
1333 | 1346 | ||
@@ -1338,21 +1351,116 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1338 | 1351 | ||
1339 | stateData.AppendChild(assemblyData); | 1352 | stateData.AppendChild(assemblyData); |
1340 | 1353 | ||
1341 | return doc.InnerXml; | 1354 | XmlElement mapData = doc.CreateElement("", "LineMap", ""); |
1342 | } | 1355 | XmlAttribute mapName = doc.CreateAttribute("", "Filename", ""); |
1343 | 1356 | ||
1344 | public bool CanBeDeleted(UUID itemID) | 1357 | mapName.Value = fn + ".map"; |
1345 | { | 1358 | mapData.Attributes.Append(mapName); |
1346 | IScriptInstance instance = GetInstance(itemID); | ||
1347 | if (instance == null) | ||
1348 | return true; | ||
1349 | 1359 | ||
1350 | return instance.CanBeDeleted(); | 1360 | mapData.InnerText = map; |
1361 | |||
1362 | stateData.AppendChild(mapData); | ||
1363 | return doc.InnerXml; | ||
1351 | } | 1364 | } |
1352 | 1365 | ||
1353 | private bool ShowScriptSaveResponse(UUID ownerID, UUID assetID, string text, bool compiled) | 1366 | private bool ShowScriptSaveResponse(UUID ownerID, UUID assetID, string text, bool compiled) |
1354 | { | 1367 | { |
1355 | return false; | 1368 | return false; |
1356 | } | 1369 | } |
1370 | |||
1371 | public void SetXMLState(UUID itemID, string xml) | ||
1372 | { | ||
1373 | if (xml == String.Empty) | ||
1374 | return; | ||
1375 | |||
1376 | XmlDocument doc = new XmlDocument(); | ||
1377 | |||
1378 | try | ||
1379 | { | ||
1380 | doc.LoadXml(xml); | ||
1381 | } | ||
1382 | catch (Exception) | ||
1383 | { | ||
1384 | m_log.Error("[XEngine]: Exception decoding XML data from region transfer"); | ||
1385 | return; | ||
1386 | } | ||
1387 | |||
1388 | XmlNodeList rootL = doc.GetElementsByTagName("State"); | ||
1389 | if (rootL.Count < 1) | ||
1390 | return; | ||
1391 | |||
1392 | XmlElement rootE = (XmlElement)rootL[0]; | ||
1393 | |||
1394 | if (rootE.GetAttribute("UUID") != itemID.ToString()) | ||
1395 | return; | ||
1396 | |||
1397 | string assetID = rootE.GetAttribute("Asset"); | ||
1398 | |||
1399 | XmlNodeList stateL = rootE.GetElementsByTagName("ScriptState"); | ||
1400 | |||
1401 | if (stateL.Count != 1) | ||
1402 | return; | ||
1403 | |||
1404 | XmlElement stateE = (XmlElement)stateL[0]; | ||
1405 | |||
1406 | if (World.m_trustBinaries) | ||
1407 | { | ||
1408 | XmlNodeList assemL = rootE.GetElementsByTagName("Assembly"); | ||
1409 | |||
1410 | if (assemL.Count != 1) | ||
1411 | return; | ||
1412 | |||
1413 | XmlElement assemE = (XmlElement)assemL[0]; | ||
1414 | |||
1415 | string fn = assemE.GetAttribute("Filename"); | ||
1416 | string base64 = assemE.InnerText; | ||
1417 | |||
1418 | string path = Path.Combine("ScriptEngines", World.RegionInfo.RegionID.ToString()); | ||
1419 | path = Path.Combine(path, fn); | ||
1420 | |||
1421 | if (!File.Exists(path)) | ||
1422 | { | ||
1423 | Byte[] filedata = Convert.FromBase64String(base64); | ||
1424 | |||
1425 | FileStream fs = File.Create(path); | ||
1426 | fs.Write(filedata, 0, filedata.Length); | ||
1427 | fs.Close(); | ||
1428 | |||
1429 | fs = File.Create(path + ".text"); | ||
1430 | StreamWriter sw = new StreamWriter(fs); | ||
1431 | |||
1432 | sw.Write(base64); | ||
1433 | |||
1434 | sw.Close(); | ||
1435 | fs.Close(); | ||
1436 | } | ||
1437 | } | ||
1438 | |||
1439 | string statepath = Path.Combine("ScriptEngines", World.RegionInfo.RegionID.ToString()); | ||
1440 | statepath = Path.Combine(statepath, itemID.ToString() + ".state"); | ||
1441 | |||
1442 | FileStream sfs = File.Create(statepath); | ||
1443 | StreamWriter ssw = new StreamWriter(sfs); | ||
1444 | |||
1445 | ssw.Write(stateE.OuterXml); | ||
1446 | |||
1447 | ssw.Close(); | ||
1448 | sfs.Close(); | ||
1449 | |||
1450 | XmlNodeList mapL = rootE.GetElementsByTagName("LineMap"); | ||
1451 | |||
1452 | XmlElement mapE = (XmlElement)mapL[0]; | ||
1453 | |||
1454 | string mappath = Path.Combine("ScriptEngines", World.RegionInfo.RegionID.ToString()); | ||
1455 | mappath = Path.Combine(mappath, mapE.GetAttribute("Filename")); | ||
1456 | |||
1457 | FileStream mfs = File.Create(mappath); | ||
1458 | StreamWriter msw = new StreamWriter(mfs); | ||
1459 | |||
1460 | msw.Write(mapE.InnerText); | ||
1461 | |||
1462 | msw.Close(); | ||
1463 | mfs.Close(); | ||
1464 | } | ||
1357 | } | 1465 | } |
1358 | } | 1466 | } |