SceneObjectGroup.Inventory.cs 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625
  1. /*
  2. * Copyright (c) Contributors, http://opensimulator.org/
  3. * See CONTRIBUTORS.TXT for a full list of copyright holders.
  4. *
  5. * Redistribution and use in source and binary forms, with or without
  6. * modification, are permitted provided that the following conditions are met:
  7. * * Redistributions of source code must retain the above copyright
  8. * notice, this list of conditions and the following disclaimer.
  9. * * Redistributions in binary form must reproduce the above copyright
  10. * notice, this list of conditions and the following disclaimer in the
  11. * documentation and/or other materials provided with the distribution.
  12. * * Neither the name of the OpenSimulator Project nor the
  13. * names of its contributors may be used to endorse or promote products
  14. * derived from this software without specific prior written permission.
  15. *
  16. * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
  17. * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  18. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  19. * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
  20. * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  21. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  22. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  23. * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  24. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  25. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  26. */
  27. using System;
  28. using System.IO;
  29. using System.Reflection;
  30. using OpenMetaverse;
  31. using log4net;
  32. using OpenSim.Framework;
  33. using OpenSim.Region.Framework.Interfaces;
  34. using System.Collections.Generic;
  35. using System.Xml;
  36. using PermissionMask = OpenSim.Framework.PermissionMask;
  37. namespace OpenSim.Region.Framework.Scenes
  38. {
  39. public partial class SceneObjectGroup : EntityBase
  40. {
  41. private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
  42. /// <summary>
  43. /// Force all task inventories of prims in the scene object to persist
  44. /// </summary>
  45. public void ForceInventoryPersistence()
  46. {
  47. SceneObjectPart[] parts = m_parts.GetArray();
  48. for (int i = 0; i < parts.Length; i++)
  49. parts[i].Inventory.ForceInventoryPersistence();
  50. }
  51. /// <summary>
  52. /// Start the scripts contained in all the prims in this group.
  53. /// </summary>
  54. /// <param name="startParam"></param>
  55. /// <param name="postOnRez"></param>
  56. /// <param name="engine"></param>
  57. /// <param name="stateSource"></param>
  58. /// <returns>
  59. /// Number of scripts that were valid for starting. This does not guarantee that all these scripts
  60. /// were actually started, but just that the start could be attempt (e.g. the asset data for the script could be found)
  61. /// </returns>
  62. public int CreateScriptInstances(int startParam, bool postOnRez, string engine, int stateSource)
  63. {
  64. int scriptsStarted = 0;
  65. if (m_scene == null)
  66. {
  67. m_log.DebugFormat("[PRIM INVENTORY]: m_scene is null. Unable to create script instances");
  68. return 0;
  69. }
  70. // Don't start scripts if they're turned off in the region!
  71. if (!m_scene.RegionInfo.RegionSettings.DisableScripts)
  72. {
  73. SceneObjectPart[] parts = m_parts.GetArray();
  74. for (int i = 0; i < parts.Length; i++)
  75. scriptsStarted
  76. += parts[i].Inventory.CreateScriptInstances(startParam, postOnRez, engine, stateSource);
  77. }
  78. return scriptsStarted;
  79. }
  80. /// <summary>
  81. /// Stop and remove the scripts contained in all the prims in this group
  82. /// </summary>
  83. public void RemoveScriptInstances(bool sceneObjectBeingDeleted)
  84. {
  85. SceneObjectPart[] parts = m_parts.GetArray();
  86. for (int i = 0; i < parts.Length; i++)
  87. parts[i].Inventory.RemoveScriptInstances(sceneObjectBeingDeleted);
  88. }
  89. /// <summary>
  90. /// Stop the scripts contained in all the prims in this group
  91. /// </summary>
  92. public void StopScriptInstances()
  93. {
  94. SceneObjectPart[] parts = m_parts.GetArray();
  95. for(int i = 0; i < parts.Length; ++i)
  96. parts[i].Inventory.StopScriptInstances();
  97. }
  98. public void SendReleaseScriptsControl()
  99. {
  100. SceneObjectPart[] parts = m_parts.GetArray();
  101. for (int i = 0; i < parts.Length; i++)
  102. parts[i].Inventory.SendReleaseScriptsControl();
  103. }
  104. public void RemoveScriptsPermissions(int permissions)
  105. {
  106. SceneObjectPart[] parts = m_parts.GetArray();
  107. for (int i = 0; i < parts.Length; i++)
  108. parts[i].Inventory.RemoveScriptsPermissions(permissions);
  109. }
  110. public void RemoveScriptsPermissions(ScenePresence sp, int permissions)
  111. {
  112. SceneObjectPart[] parts = m_parts.GetArray();
  113. for (int i = 0; i < parts.Length; i++)
  114. parts[i].Inventory.RemoveScriptsPermissions(sp, permissions);
  115. }
  116. /// <summary>
  117. /// Add an inventory item from a user's inventory to a prim in this scene object.
  118. /// </summary>
  119. /// <param name="agentID">The agent adding the item.</param>
  120. /// <param name="localID">The local ID of the part receiving the add.</param>
  121. /// <param name="item">The user inventory item being added.</param>
  122. /// <param name="copyItemID">The item UUID that should be used by the new item.</param>
  123. /// <returns></returns>
  124. public bool AddInventoryItem(UUID agentID, uint localID, InventoryItemBase item, UUID copyItemID, bool withModRights = true)
  125. {
  126. // m_log.DebugFormat(
  127. // "[PRIM INVENTORY]: Adding inventory item {0} from {1} to part with local ID {2}",
  128. // item.Name, remoteClient.Name, localID);
  129. UUID newItemId = (copyItemID != UUID.Zero) ? copyItemID : item.ID;
  130. SceneObjectPart part = GetPart(localID);
  131. if (part == null)
  132. {
  133. m_log.ErrorFormat(
  134. "[PRIM INVENTORY]: " +
  135. "Couldn't find prim local ID {0} in group {1}, {2} to add inventory item ID {3}",
  136. localID, Name, UUID, newItemId);
  137. return false;
  138. }
  139. TaskInventoryItem taskItem = new TaskInventoryItem();
  140. taskItem.ItemID = newItemId;
  141. taskItem.AssetID = item.AssetID;
  142. taskItem.Name = item.Name;
  143. taskItem.Description = item.Description;
  144. taskItem.OwnerID = part.OwnerID; // Transfer ownership
  145. taskItem.CreatorID = item.CreatorIdAsUuid;
  146. taskItem.Type = item.AssetType;
  147. taskItem.InvType = item.InvType;
  148. taskItem.Flags = item.Flags;
  149. if (agentID != part.OwnerID && m_scene.Permissions.PropagatePermissions())
  150. {
  151. taskItem.BasePermissions = item.BasePermissions &
  152. item.NextPermissions;
  153. taskItem.CurrentPermissions = item.CurrentPermissions &
  154. item.NextPermissions;
  155. taskItem.EveryonePermissions = item.EveryOnePermissions &
  156. item.NextPermissions;
  157. taskItem.GroupPermissions = item.GroupPermissions &
  158. item.NextPermissions;
  159. taskItem.NextPermissions = item.NextPermissions;
  160. // We're adding this to a prim we don't own. Force
  161. // owner change
  162. taskItem.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm;
  163. taskItem.LastOwnerID = item.Owner;
  164. }
  165. else
  166. {
  167. taskItem.BasePermissions = item.BasePermissions;
  168. taskItem.CurrentPermissions = item.CurrentPermissions;
  169. taskItem.EveryonePermissions = item.EveryOnePermissions;
  170. taskItem.GroupPermissions = item.GroupPermissions;
  171. taskItem.NextPermissions = item.NextPermissions;
  172. }
  173. // m_log.DebugFormat(
  174. // "[PRIM INVENTORY]: Flags are 0x{0:X} for item {1} added to part {2} by {3}",
  175. // taskItem.Flags, taskItem.Name, localID, remoteClient.Name);
  176. // TODO: These are pending addition of those fields to TaskInventoryItem
  177. // taskItem.SalePrice = item.SalePrice;
  178. // taskItem.SaleType = item.SaleType;
  179. taskItem.CreationDate = (uint)item.CreationDate;
  180. bool addFromAllowedDrop;
  181. if(withModRights)
  182. addFromAllowedDrop = false;
  183. else
  184. addFromAllowedDrop = (part.ParentGroup.RootPart.GetEffectiveObjectFlags() & (uint)PrimFlags.AllowInventoryDrop) != 0;
  185. part.Inventory.AddInventoryItem(taskItem, addFromAllowedDrop);
  186. part.ParentGroup.InvalidateDeepEffectivePerms();
  187. return true;
  188. }
  189. /// <summary>
  190. /// Returns an existing inventory item. Returns the original, so any changes will be live.
  191. /// </summary>
  192. /// <param name="primID"></param>
  193. /// <param name="itemID"></param>
  194. /// <returns>null if the item does not exist</returns>
  195. public TaskInventoryItem GetInventoryItem(uint primID, UUID itemID)
  196. {
  197. SceneObjectPart part = GetPart(primID);
  198. if (part != null)
  199. {
  200. return part.Inventory.GetInventoryItem(itemID);
  201. }
  202. else
  203. {
  204. m_log.ErrorFormat(
  205. "[PRIM INVENTORY]: " +
  206. "Couldn't find prim local ID {0} in prim {1}, {2} to get inventory item ID {3}",
  207. primID, part.Name, part.UUID, itemID);
  208. }
  209. return null;
  210. }
  211. /// <summary>
  212. /// Update an existing inventory item.
  213. /// </summary>
  214. /// <param name="item">The updated item. An item with the same id must already exist
  215. /// in this prim's inventory</param>
  216. /// <returns>false if the item did not exist, true if the update occurred succesfully</returns>
  217. public bool UpdateInventoryItem(TaskInventoryItem item)
  218. {
  219. SceneObjectPart part = GetPart(item.ParentPartID);
  220. if (part != null)
  221. {
  222. part.Inventory.UpdateInventoryItem(item);
  223. return true;
  224. }
  225. else
  226. {
  227. m_log.ErrorFormat(
  228. "[PRIM INVENTORY]: " +
  229. "Couldn't find prim ID {0} to update item {1}, {2}",
  230. item.ParentPartID, item.Name, item.ItemID);
  231. }
  232. return false;
  233. }
  234. public int RemoveInventoryItem(uint localID, UUID itemID)
  235. {
  236. SceneObjectPart part = GetPart(localID);
  237. if (part != null)
  238. {
  239. int type = part.Inventory.RemoveInventoryItem(itemID);
  240. return type;
  241. }
  242. return -1;
  243. }
  244. // new test code, to place in better place later
  245. private object m_PermissionsLock = new object();
  246. private bool m_EffectivePermsInvalid = true;
  247. private bool m_DeepEffectivePermsInvalid = true;
  248. // should called when parts chanced by their contents did not, so we know their cacche is valid
  249. // in case of doubt call InvalidateDeepEffectivePerms(), it only costs a bit more cpu time
  250. public void InvalidateEffectivePerms()
  251. {
  252. lock(m_PermissionsLock)
  253. m_EffectivePermsInvalid = true;
  254. }
  255. // should called when parts chanced and their contents where accounted for
  256. public void InvalidateDeepEffectivePerms()
  257. {
  258. lock(m_PermissionsLock)
  259. {
  260. m_DeepEffectivePermsInvalid = true;
  261. m_EffectivePermsInvalid = true;
  262. }
  263. }
  264. private uint m_EffectiveEveryOnePerms;
  265. public uint EffectiveEveryOnePerms
  266. {
  267. get
  268. {
  269. lock(m_PermissionsLock)
  270. {
  271. if(m_EffectivePermsInvalid)
  272. AggregatePerms();
  273. return m_EffectiveEveryOnePerms;
  274. }
  275. }
  276. }
  277. private uint m_EffectiveGroupPerms;
  278. public uint EffectiveGroupPerms
  279. {
  280. get
  281. {
  282. lock(m_PermissionsLock)
  283. {
  284. if(m_EffectivePermsInvalid)
  285. AggregatePerms();
  286. return m_EffectiveGroupPerms;
  287. }
  288. }
  289. }
  290. private uint m_EffectiveGroupOrEveryOnePerms;
  291. public uint EffectiveGroupOrEveryOnePerms
  292. {
  293. get
  294. {
  295. lock(m_PermissionsLock)
  296. {
  297. if(m_EffectivePermsInvalid)
  298. AggregatePerms();
  299. return m_EffectiveGroupOrEveryOnePerms;
  300. }
  301. }
  302. }
  303. private uint m_EffectiveOwnerPerms;
  304. public uint EffectiveOwnerPerms
  305. {
  306. get
  307. {
  308. lock(m_PermissionsLock)
  309. {
  310. if(m_EffectivePermsInvalid)
  311. AggregatePerms();
  312. return m_EffectiveOwnerPerms;
  313. }
  314. }
  315. }
  316. public void AggregatePerms()
  317. {
  318. lock(m_PermissionsLock)
  319. {
  320. // aux
  321. const uint allmask = (uint)PermissionMask.AllEffective;
  322. const uint movemodmask = (uint)(PermissionMask.Move | PermissionMask.Modify);
  323. const uint copytransfermast = (uint)(PermissionMask.Copy | PermissionMask.Transfer);
  324. uint basePerms = (RootPart.BaseMask & allmask) | (uint)PermissionMask.Move;
  325. bool noBaseTransfer = (basePerms & (uint)PermissionMask.Transfer) == 0;
  326. uint rootOwnerPerms = RootPart.OwnerMask;
  327. uint owner = rootOwnerPerms;
  328. uint rootGroupPerms = RootPart.GroupMask;
  329. uint group = rootGroupPerms;
  330. uint rootEveryonePerms = RootPart.EveryoneMask;
  331. uint everyone = rootEveryonePerms;
  332. bool needUpdate = false;
  333. // date is time of writing april 30th 2017
  334. bool newobj = (RootPart.CreationDate == 0 || RootPart.CreationDate > 1493574994);
  335. SceneObjectPart[] parts = m_parts.GetArray();
  336. for (int i = 0; i < parts.Length; i++)
  337. {
  338. SceneObjectPart part = parts[i];
  339. if(m_DeepEffectivePermsInvalid)
  340. part.AggregatedInnerPermsForGroup();
  341. owner &= part.AggregatedInnerOwnerPerms;
  342. group &= part.AggregatedInnerGroupPerms;
  343. if(newobj)
  344. group &= part.AggregatedInnerGroupPerms;
  345. if(newobj)
  346. everyone &= part.AggregatedInnerEveryonePerms;
  347. }
  348. // recover modify and move
  349. rootOwnerPerms &= movemodmask;
  350. owner |= rootOwnerPerms;
  351. if((owner & copytransfermast) == 0)
  352. owner |= (uint)PermissionMask.Transfer;
  353. owner &= basePerms;
  354. if(owner != m_EffectiveOwnerPerms)
  355. {
  356. needUpdate = true;
  357. m_EffectiveOwnerPerms = owner;
  358. }
  359. uint ownertransfermask = owner & (uint)PermissionMask.Transfer;
  360. // recover modify and move
  361. rootGroupPerms &= movemodmask;
  362. group |= rootGroupPerms;
  363. if(noBaseTransfer)
  364. group &=~(uint)PermissionMask.Copy;
  365. else
  366. group |= ownertransfermask;
  367. uint groupOrEveryone = group;
  368. uint tmpPerms = group & owner;
  369. if(tmpPerms != m_EffectiveGroupPerms)
  370. {
  371. needUpdate = true;
  372. m_EffectiveGroupPerms = tmpPerms;
  373. }
  374. // recover move
  375. rootEveryonePerms &= (uint)PermissionMask.Move;
  376. everyone |= rootEveryonePerms;
  377. everyone &= ~(uint)PermissionMask.Modify;
  378. if(noBaseTransfer)
  379. everyone &=~(uint)PermissionMask.Copy;
  380. else
  381. everyone |= ownertransfermask;
  382. groupOrEveryone |= everyone;
  383. tmpPerms = everyone & owner;
  384. if(tmpPerms != m_EffectiveEveryOnePerms)
  385. {
  386. needUpdate = true;
  387. m_EffectiveEveryOnePerms = tmpPerms;
  388. }
  389. tmpPerms = groupOrEveryone & owner;
  390. if(tmpPerms != m_EffectiveGroupOrEveryOnePerms)
  391. {
  392. needUpdate = true;
  393. m_EffectiveGroupOrEveryOnePerms = tmpPerms;
  394. }
  395. m_DeepEffectivePermsInvalid = false;
  396. m_EffectivePermsInvalid = false;
  397. if(needUpdate)
  398. RootPart.ScheduleFullUpdate();
  399. }
  400. }
  401. public uint CurrentAndFoldedNextPermissions()
  402. {
  403. uint perms=(uint)(PermissionMask.Modify |
  404. PermissionMask.Copy |
  405. PermissionMask.Move |
  406. PermissionMask.Transfer |
  407. PermissionMask.FoldedMask);
  408. uint ownerMask = RootPart.OwnerMask;
  409. SceneObjectPart[] parts = m_parts.GetArray();
  410. for (int i = 0; i < parts.Length; i++)
  411. {
  412. SceneObjectPart part = parts[i];
  413. ownerMask &= part.BaseMask;
  414. perms &= part.Inventory.MaskEffectivePermissions();
  415. }
  416. if ((ownerMask & (uint)PermissionMask.Modify) == 0)
  417. perms &= ~(uint)PermissionMask.Modify;
  418. if ((ownerMask & (uint)PermissionMask.Copy) == 0)
  419. perms &= ~(uint)PermissionMask.Copy;
  420. if ((ownerMask & (uint)PermissionMask.Transfer) == 0)
  421. perms &= ~(uint)PermissionMask.Transfer;
  422. if ((ownerMask & (uint)PermissionMask.Export) == 0)
  423. perms &= ~(uint)PermissionMask.Export;
  424. return perms;
  425. }
  426. public void ApplyNextOwnerPermissions()
  427. {
  428. // m_log.DebugFormat("[PRIM INVENTORY]: Applying next owner permissions to {0} {1}", Name, UUID);
  429. SceneObjectPart[] parts = m_parts.GetArray();
  430. for (int i = 0; i < parts.Length; i++)
  431. parts[i].ApplyNextOwnerPermissions();
  432. }
  433. public string GetStateSnapshot()
  434. {
  435. Dictionary<UUID, string> states = new Dictionary<UUID, string>();
  436. SceneObjectPart[] parts = m_parts.GetArray();
  437. for (int i = 0; i < parts.Length; i++)
  438. {
  439. SceneObjectPart part = parts[i];
  440. foreach (KeyValuePair<UUID, string> s in part.Inventory.GetScriptStates())
  441. states[s.Key] = s.Value;
  442. }
  443. if (states.Count < 1)
  444. return String.Empty;
  445. XmlDocument xmldoc = new XmlDocument();
  446. XmlNode xmlnode = xmldoc.CreateNode(XmlNodeType.XmlDeclaration,
  447. String.Empty, String.Empty);
  448. xmldoc.AppendChild(xmlnode);
  449. XmlElement rootElement = xmldoc.CreateElement("", "ScriptData",
  450. String.Empty);
  451. xmldoc.AppendChild(rootElement);
  452. XmlElement wrapper = xmldoc.CreateElement("", "ScriptStates",
  453. String.Empty);
  454. rootElement.AppendChild(wrapper);
  455. foreach (KeyValuePair<UUID, string> state in states)
  456. {
  457. XmlDocument sdoc = new XmlDocument();
  458. sdoc.LoadXml(state.Value);
  459. XmlNodeList rootL = sdoc.GetElementsByTagName("State");
  460. XmlNode rootNode = rootL[0];
  461. XmlNode newNode = xmldoc.ImportNode(rootNode, true);
  462. wrapper.AppendChild(newNode);
  463. }
  464. return xmldoc.InnerXml;
  465. }
  466. public void SetState(string objXMLData, IScene ins)
  467. {
  468. if (!(ins is Scene))
  469. return;
  470. Scene s = (Scene)ins;
  471. if (objXMLData == String.Empty)
  472. return;
  473. IScriptModule scriptModule = null;
  474. foreach (IScriptModule sm in s.RequestModuleInterfaces<IScriptModule>())
  475. {
  476. if (sm.ScriptEngineName == s.DefaultScriptEngine)
  477. scriptModule = sm;
  478. else if (scriptModule == null)
  479. scriptModule = sm;
  480. }
  481. if (scriptModule == null)
  482. return;
  483. XmlDocument doc = new XmlDocument();
  484. try
  485. {
  486. doc.LoadXml(objXMLData);
  487. }
  488. catch (Exception) // (System.Xml.XmlException)
  489. {
  490. // We will get here if the XML is invalid or in unit
  491. // tests. Really should determine which it is and either
  492. // fail silently or log it
  493. // Fail silently, for now.
  494. // TODO: Fix this
  495. //
  496. return;
  497. }
  498. XmlNodeList rootL = doc.GetElementsByTagName("ScriptData");
  499. if (rootL.Count != 1)
  500. return;
  501. XmlElement rootE = (XmlElement)rootL[0];
  502. XmlNodeList dataL = rootE.GetElementsByTagName("ScriptStates");
  503. if (dataL.Count != 1)
  504. return;
  505. XmlElement dataE = (XmlElement)dataL[0];
  506. foreach (XmlNode n in dataE.ChildNodes)
  507. {
  508. XmlElement stateE = (XmlElement)n;
  509. UUID itemID = new UUID(stateE.GetAttribute("UUID"));
  510. scriptModule.SetXMLState(itemID, n.OuterXml);
  511. }
  512. }
  513. public void ResumeScripts()
  514. {
  515. if (m_scene.RegionInfo.RegionSettings.DisableScripts)
  516. return;
  517. SceneObjectPart[] parts = m_parts.GetArray();
  518. for (int i = 0; i < parts.Length; i++)
  519. parts[i].Inventory.ResumeScripts();
  520. }
  521. /// <summary>
  522. /// Returns true if any part in the scene object contains scripts, false otherwise.
  523. /// </summary>
  524. /// <returns></returns>
  525. public bool ContainsScripts()
  526. {
  527. foreach (SceneObjectPart part in Parts)
  528. if (part.Inventory.ContainsScripts())
  529. return true;
  530. return false;
  531. }
  532. }
  533. }