SceneExternalChecks.cs 44 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084
  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 OpenSim 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.Collections.Generic;
  29. using System.Text;
  30. using libsecondlife;
  31. using OpenSim.Framework;
  32. using OpenSim.Region.Environment.Interfaces;
  33. namespace OpenSim.Region.Environment.Scenes
  34. {
  35. public class SceneExternalChecks
  36. {
  37. private Scene m_scene;
  38. public SceneExternalChecks(Scene scene)
  39. {
  40. m_scene = scene;
  41. }
  42. #region Object Permission Checks
  43. public delegate uint GenerateClientFlags(LLUUID userID, LLUUID objectIDID);
  44. private List<GenerateClientFlags> GenerateClientFlagsCheckFunctions = new List<GenerateClientFlags>();
  45. public void addGenerateClientFlags(GenerateClientFlags delegateFunc)
  46. {
  47. if (!GenerateClientFlagsCheckFunctions.Contains(delegateFunc))
  48. GenerateClientFlagsCheckFunctions.Add(delegateFunc);
  49. }
  50. public void removeGenerateClientFlags(GenerateClientFlags delegateFunc)
  51. {
  52. if (GenerateClientFlagsCheckFunctions.Contains(delegateFunc))
  53. GenerateClientFlagsCheckFunctions.Remove(delegateFunc);
  54. }
  55. public uint ExternalChecksGenerateClientFlags(LLUUID userID, LLUUID objectID)
  56. {
  57. SceneObjectPart part=m_scene.GetSceneObjectPart(objectID);
  58. uint perms=part.GetEffectiveObjectFlags() |
  59. (uint)LLObject.ObjectFlags.ObjectModify |
  60. (uint)LLObject.ObjectFlags.ObjectCopy |
  61. (uint)LLObject.ObjectFlags.ObjectMove |
  62. (uint)LLObject.ObjectFlags.ObjectTransfer |
  63. (uint)LLObject.ObjectFlags.ObjectYouOwner |
  64. (uint)LLObject.ObjectFlags.ObjectOwnerModify |
  65. (uint)LLObject.ObjectFlags.ObjectYouOfficer;
  66. foreach (GenerateClientFlags check in GenerateClientFlagsCheckFunctions)
  67. {
  68. perms &= check(userID, objectID);
  69. }
  70. return perms;
  71. }
  72. public delegate void SetBypassPermissions(bool value);
  73. private List<SetBypassPermissions> SetBypassPermissionsCheckFunctions = new List<SetBypassPermissions>();
  74. public void addSetBypassPermissions(SetBypassPermissions delegateFunc)
  75. {
  76. if (!SetBypassPermissionsCheckFunctions.Contains(delegateFunc))
  77. SetBypassPermissionsCheckFunctions.Add(delegateFunc);
  78. }
  79. public void removeSetBypassPermissions(SetBypassPermissions delegateFunc)
  80. {
  81. if (SetBypassPermissionsCheckFunctions.Contains(delegateFunc))
  82. SetBypassPermissionsCheckFunctions.Remove(delegateFunc);
  83. }
  84. public void ExternalChecksSetBypassPermissions(bool value)
  85. {
  86. foreach (SetBypassPermissions check in SetBypassPermissionsCheckFunctions)
  87. {
  88. check(value);
  89. }
  90. }
  91. public delegate bool BypassPermissions();
  92. private List<BypassPermissions> BypassPermissionsCheckFunctions = new List<BypassPermissions>();
  93. public void addBypassPermissions(BypassPermissions delegateFunc)
  94. {
  95. if (!BypassPermissionsCheckFunctions.Contains(delegateFunc))
  96. BypassPermissionsCheckFunctions.Add(delegateFunc);
  97. }
  98. public void removeBypassPermissions(BypassPermissions delegateFunc)
  99. {
  100. if (BypassPermissionsCheckFunctions.Contains(delegateFunc))
  101. BypassPermissionsCheckFunctions.Remove(delegateFunc);
  102. }
  103. public bool ExternalChecksBypassPermissions()
  104. {
  105. foreach (BypassPermissions check in BypassPermissionsCheckFunctions)
  106. {
  107. if (check() == false)
  108. {
  109. return false;
  110. }
  111. }
  112. return true;
  113. }
  114. public delegate bool PropagatePermissions();
  115. private List<PropagatePermissions> PropagatePermissionsCheckFunctions = new List<PropagatePermissions>();
  116. public void addPropagatePermissions(PropagatePermissions delegateFunc)
  117. {
  118. if (!PropagatePermissionsCheckFunctions.Contains(delegateFunc))
  119. PropagatePermissionsCheckFunctions.Add(delegateFunc);
  120. }
  121. public void removePropagatePermissions(PropagatePermissions delegateFunc)
  122. {
  123. if (PropagatePermissionsCheckFunctions.Contains(delegateFunc))
  124. PropagatePermissionsCheckFunctions.Remove(delegateFunc);
  125. }
  126. public bool ExternalChecksPropagatePermissions()
  127. {
  128. foreach (PropagatePermissions check in PropagatePermissionsCheckFunctions)
  129. {
  130. if (check() == false)
  131. {
  132. return false;
  133. }
  134. }
  135. return true;
  136. }
  137. #region REZ OBJECT
  138. public delegate bool CanRezObject(int objectCount, LLUUID owner, LLVector3 objectPosition, Scene scene);
  139. private List<CanRezObject> CanRezObjectCheckFunctions = new List<CanRezObject>();
  140. public void addCheckRezObject(CanRezObject delegateFunc)
  141. {
  142. if (!CanRezObjectCheckFunctions.Contains(delegateFunc))
  143. CanRezObjectCheckFunctions.Add(delegateFunc);
  144. }
  145. public void removeCheckRezObject(CanRezObject delegateFunc)
  146. {
  147. if (CanRezObjectCheckFunctions.Contains(delegateFunc))
  148. CanRezObjectCheckFunctions.Remove(delegateFunc);
  149. }
  150. public bool ExternalChecksCanRezObject(int objectCount, LLUUID owner, LLVector3 objectPosition)
  151. {
  152. foreach (CanRezObject check in CanRezObjectCheckFunctions)
  153. {
  154. if (check(objectCount, owner,objectPosition, m_scene) == false)
  155. {
  156. return false;
  157. }
  158. }
  159. return true;
  160. }
  161. #endregion
  162. #region DELETE OBJECT
  163. public delegate bool CanDeleteObject(LLUUID objectID, LLUUID deleter, Scene scene);
  164. private List<CanDeleteObject> CanDeleteObjectCheckFunctions = new List<CanDeleteObject>();
  165. public void addCheckDeleteObject(CanDeleteObject delegateFunc)
  166. {
  167. if (!CanDeleteObjectCheckFunctions.Contains(delegateFunc))
  168. CanDeleteObjectCheckFunctions.Add(delegateFunc);
  169. }
  170. public void removeCheckDeleteObject(CanDeleteObject delegateFunc)
  171. {
  172. if (CanDeleteObjectCheckFunctions.Contains(delegateFunc))
  173. CanDeleteObjectCheckFunctions.Remove(delegateFunc);
  174. }
  175. public bool ExternalChecksCanDeleteObject(LLUUID objectID, LLUUID deleter)
  176. {
  177. foreach (CanDeleteObject check in CanDeleteObjectCheckFunctions)
  178. {
  179. if (check(objectID,deleter,m_scene) == false)
  180. {
  181. return false;
  182. }
  183. }
  184. return true;
  185. }
  186. #endregion
  187. #region TAKE OBJECT
  188. public delegate bool CanTakeObject(LLUUID objectID, LLUUID stealer, Scene scene);
  189. private List<CanTakeObject> CanTakeObjectCheckFunctions = new List<CanTakeObject>();
  190. public void addCheckTakeObject(CanTakeObject delegateFunc)
  191. {
  192. if (!CanTakeObjectCheckFunctions.Contains(delegateFunc))
  193. CanTakeObjectCheckFunctions.Add(delegateFunc);
  194. }
  195. public void removeCheckTakeObject(CanTakeObject delegateFunc)
  196. {
  197. if (CanTakeObjectCheckFunctions.Contains(delegateFunc))
  198. CanTakeObjectCheckFunctions.Remove(delegateFunc);
  199. }
  200. public bool ExternalChecksCanTakeObject(LLUUID objectID, LLUUID AvatarTakingUUID)
  201. {
  202. foreach (CanTakeObject check in CanTakeObjectCheckFunctions)
  203. {
  204. if (check(objectID, AvatarTakingUUID, m_scene) == false)
  205. {
  206. return false;
  207. }
  208. }
  209. return true;
  210. }
  211. #endregion
  212. #region TAKE COPY OBJECT
  213. public delegate bool CanTakeCopyObject(LLUUID objectID, LLUUID userID, Scene inScene);
  214. private List<CanTakeCopyObject> CanTakeCopyObjectCheckFunctions = new List<CanTakeCopyObject>();
  215. public void addCheckTakeCopyObject(CanTakeCopyObject delegateFunc)
  216. {
  217. if (!CanTakeCopyObjectCheckFunctions.Contains(delegateFunc))
  218. CanTakeCopyObjectCheckFunctions.Add(delegateFunc);
  219. }
  220. public void removeCheckTakeCopyObject(CanTakeCopyObject delegateFunc)
  221. {
  222. if (CanTakeCopyObjectCheckFunctions.Contains(delegateFunc))
  223. CanTakeCopyObjectCheckFunctions.Remove(delegateFunc);
  224. }
  225. public bool ExternalChecksCanTakeCopyObject(LLUUID objectID, LLUUID userID)
  226. {
  227. foreach (CanTakeCopyObject check in CanTakeCopyObjectCheckFunctions)
  228. {
  229. if (check(objectID,userID,m_scene) == false)
  230. {
  231. return false;
  232. }
  233. }
  234. return true;
  235. }
  236. #endregion
  237. #region DUPLICATE OBJECT
  238. public delegate bool CanDuplicateObject(int objectCount, LLUUID objectID, LLUUID owner, Scene scene, LLVector3 objectPosition);
  239. private List<CanDuplicateObject> CanDuplicateObjectCheckFunctions = new List<CanDuplicateObject>();
  240. public void addCheckDuplicateObject(CanDuplicateObject delegateFunc)
  241. {
  242. if (!CanDuplicateObjectCheckFunctions.Contains(delegateFunc))
  243. CanDuplicateObjectCheckFunctions.Add(delegateFunc);
  244. }
  245. public void removeCheckDuplicateObject(CanDuplicateObject delegateFunc)
  246. {
  247. if (CanDuplicateObjectCheckFunctions.Contains(delegateFunc))
  248. CanDuplicateObjectCheckFunctions.Remove(delegateFunc);
  249. }
  250. public bool ExternalChecksCanDuplicateObject(int objectCount, LLUUID objectID, LLUUID owner, LLVector3 objectPosition)
  251. {
  252. foreach (CanDuplicateObject check in CanDuplicateObjectCheckFunctions)
  253. {
  254. if (check(objectCount, objectID, owner, m_scene, objectPosition) == false)
  255. {
  256. return false;
  257. }
  258. }
  259. return true;
  260. }
  261. #endregion
  262. #region EDIT OBJECT
  263. public delegate bool CanEditObject(LLUUID objectID, LLUUID editorID, Scene scene);
  264. private List<CanEditObject> CanEditObjectCheckFunctions = new List<CanEditObject>();
  265. public void addCheckEditObject(CanEditObject delegateFunc)
  266. {
  267. if (!CanEditObjectCheckFunctions.Contains(delegateFunc))
  268. CanEditObjectCheckFunctions.Add(delegateFunc);
  269. }
  270. public void removeCheckEditObject(CanEditObject delegateFunc)
  271. {
  272. if (CanEditObjectCheckFunctions.Contains(delegateFunc))
  273. CanEditObjectCheckFunctions.Remove(delegateFunc);
  274. }
  275. public bool ExternalChecksCanEditObject(LLUUID objectID, LLUUID editorID)
  276. {
  277. foreach (CanEditObject check in CanEditObjectCheckFunctions)
  278. {
  279. if (check(objectID, editorID, m_scene) == false)
  280. {
  281. return false;
  282. }
  283. }
  284. return true;
  285. }
  286. #endregion
  287. #region MOVE OBJECT
  288. public delegate bool CanMoveObject(LLUUID objectID, LLUUID moverID, Scene scene);
  289. private List<CanMoveObject> CanMoveObjectCheckFunctions = new List<CanMoveObject>();
  290. public void addCheckMoveObject(CanMoveObject delegateFunc)
  291. {
  292. if (!CanMoveObjectCheckFunctions.Contains(delegateFunc))
  293. CanMoveObjectCheckFunctions.Add(delegateFunc);
  294. }
  295. public void removeCheckMoveObject(CanMoveObject delegateFunc)
  296. {
  297. if (CanMoveObjectCheckFunctions.Contains(delegateFunc))
  298. CanMoveObjectCheckFunctions.Remove(delegateFunc);
  299. }
  300. public bool ExternalChecksCanMoveObject(LLUUID objectID, LLUUID moverID)
  301. {
  302. foreach (CanMoveObject check in CanMoveObjectCheckFunctions)
  303. {
  304. if (check(objectID,moverID,m_scene) == false)
  305. {
  306. return false;
  307. }
  308. }
  309. return true;
  310. }
  311. #endregion
  312. #region OBJECT ENTRY
  313. public delegate bool CanObjectEntry(LLUUID objectID, LLVector3 newPoint, Scene scene);
  314. private List<CanObjectEntry> CanObjectEntryCheckFunctions = new List<CanObjectEntry>();
  315. public void addCheckObjectEntry(CanObjectEntry delegateFunc)
  316. {
  317. if (!CanObjectEntryCheckFunctions.Contains(delegateFunc))
  318. CanObjectEntryCheckFunctions.Add(delegateFunc);
  319. }
  320. public void removeCheckObjectEntry(CanObjectEntry delegateFunc)
  321. {
  322. if (CanObjectEntryCheckFunctions.Contains(delegateFunc))
  323. CanObjectEntryCheckFunctions.Remove(delegateFunc);
  324. }
  325. public bool ExternalChecksCanObjectEntry(LLUUID objectID, LLVector3 newPoint)
  326. {
  327. foreach (CanObjectEntry check in CanObjectEntryCheckFunctions)
  328. {
  329. if (check(objectID, newPoint, m_scene) == false)
  330. {
  331. return false;
  332. }
  333. }
  334. return true;
  335. }
  336. #endregion
  337. #region RETURN OBJECT
  338. public delegate bool CanReturnObject(LLUUID objectID, LLUUID returnerID, Scene scene);
  339. private List<CanReturnObject> CanReturnObjectCheckFunctions = new List<CanReturnObject>();
  340. public void addCheckReturnObject(CanReturnObject delegateFunc)
  341. {
  342. if (!CanReturnObjectCheckFunctions.Contains(delegateFunc))
  343. CanReturnObjectCheckFunctions.Add(delegateFunc);
  344. }
  345. public void removeCheckReturnObject(CanReturnObject delegateFunc)
  346. {
  347. if (CanReturnObjectCheckFunctions.Contains(delegateFunc))
  348. CanReturnObjectCheckFunctions.Remove(delegateFunc);
  349. }
  350. public bool ExternalChecksCanReturnObject(LLUUID objectID, LLUUID returnerID)
  351. {
  352. foreach (CanReturnObject check in CanReturnObjectCheckFunctions)
  353. {
  354. if (check(objectID,returnerID,m_scene) == false)
  355. {
  356. return false;
  357. }
  358. }
  359. return true;
  360. }
  361. #endregion
  362. #region INSTANT MESSAGE
  363. public delegate bool CanInstantMessage(LLUUID user, LLUUID target, Scene startScene);
  364. private List<CanInstantMessage> CanInstantMessageCheckFunctions = new List<CanInstantMessage>();
  365. public void addCheckInstantMessage(CanInstantMessage delegateFunc)
  366. {
  367. if (!CanInstantMessageCheckFunctions.Contains(delegateFunc))
  368. CanInstantMessageCheckFunctions.Add(delegateFunc);
  369. }
  370. public void removeCheckInstantMessage(CanInstantMessage delegateFunc)
  371. {
  372. if (CanInstantMessageCheckFunctions.Contains(delegateFunc))
  373. CanInstantMessageCheckFunctions.Remove(delegateFunc);
  374. }
  375. public bool ExternalChecksCanInstantMessage(LLUUID user, LLUUID target)
  376. {
  377. foreach (CanInstantMessage check in CanInstantMessageCheckFunctions)
  378. {
  379. if (check(user, target, m_scene) == false)
  380. {
  381. return false;
  382. }
  383. }
  384. return true;
  385. }
  386. #endregion
  387. #region INVENTORY TRANSFER
  388. public delegate bool CanInventoryTransfer(LLUUID user, LLUUID target, Scene startScene);
  389. private List<CanInventoryTransfer> CanInventoryTransferCheckFunctions = new List<CanInventoryTransfer>();
  390. public void addCheckInventoryTransfer(CanInventoryTransfer delegateFunc)
  391. {
  392. if (!CanInventoryTransferCheckFunctions.Contains(delegateFunc))
  393. CanInventoryTransferCheckFunctions.Add(delegateFunc);
  394. }
  395. public void removeCheckInventoryTransfer(CanInventoryTransfer delegateFunc)
  396. {
  397. if (CanInventoryTransferCheckFunctions.Contains(delegateFunc))
  398. CanInventoryTransferCheckFunctions.Remove(delegateFunc);
  399. }
  400. public bool ExternalChecksCanInventoryTransfer(LLUUID user, LLUUID target)
  401. {
  402. foreach (CanInventoryTransfer check in CanInventoryTransferCheckFunctions)
  403. {
  404. if (check(user, target, m_scene) == false)
  405. {
  406. return false;
  407. }
  408. }
  409. return true;
  410. }
  411. #endregion
  412. #region VIEW SCRIPT
  413. public delegate bool CanViewScript(LLUUID script, LLUUID objectID, LLUUID user, Scene scene);
  414. private List<CanViewScript> CanViewScriptCheckFunctions = new List<CanViewScript>();
  415. public void addCheckViewScript(CanViewScript delegateFunc)
  416. {
  417. if (!CanViewScriptCheckFunctions.Contains(delegateFunc))
  418. CanViewScriptCheckFunctions.Add(delegateFunc);
  419. }
  420. public void removeCheckViewScript(CanViewScript delegateFunc)
  421. {
  422. if (CanViewScriptCheckFunctions.Contains(delegateFunc))
  423. CanViewScriptCheckFunctions.Remove(delegateFunc);
  424. }
  425. public bool ExternalChecksCanViewScript(LLUUID script, LLUUID objectID, LLUUID user)
  426. {
  427. foreach (CanViewScript check in CanViewScriptCheckFunctions)
  428. {
  429. if (check(script, objectID, user, m_scene) == false)
  430. {
  431. return false;
  432. }
  433. }
  434. return true;
  435. }
  436. public delegate bool CanViewNotecard(LLUUID script, LLUUID objectID, LLUUID user, Scene scene);
  437. private List<CanViewNotecard> CanViewNotecardCheckFunctions = new List<CanViewNotecard>();
  438. public void addCheckViewNotecard(CanViewNotecard delegateFunc)
  439. {
  440. if (!CanViewNotecardCheckFunctions.Contains(delegateFunc))
  441. CanViewNotecardCheckFunctions.Add(delegateFunc);
  442. }
  443. public void removeCheckViewNotecard(CanViewNotecard delegateFunc)
  444. {
  445. if (CanViewNotecardCheckFunctions.Contains(delegateFunc))
  446. CanViewNotecardCheckFunctions.Remove(delegateFunc);
  447. }
  448. public bool ExternalChecksCanViewNotecard(LLUUID script, LLUUID objectID, LLUUID user)
  449. {
  450. foreach (CanViewNotecard check in CanViewNotecardCheckFunctions)
  451. {
  452. if (check(script, objectID, user, m_scene) == false)
  453. {
  454. return false;
  455. }
  456. }
  457. return true;
  458. }
  459. #endregion
  460. #region EDIT SCRIPT
  461. public delegate bool CanEditScript(LLUUID script, LLUUID objectID, LLUUID user, Scene scene);
  462. private List<CanEditScript> CanEditScriptCheckFunctions = new List<CanEditScript>();
  463. public void addCheckEditScript(CanEditScript delegateFunc)
  464. {
  465. if (!CanEditScriptCheckFunctions.Contains(delegateFunc))
  466. CanEditScriptCheckFunctions.Add(delegateFunc);
  467. }
  468. public void removeCheckEditScript(CanEditScript delegateFunc)
  469. {
  470. if (CanEditScriptCheckFunctions.Contains(delegateFunc))
  471. CanEditScriptCheckFunctions.Remove(delegateFunc);
  472. }
  473. public bool ExternalChecksCanEditScript(LLUUID script, LLUUID objectID, LLUUID user)
  474. {
  475. foreach (CanEditScript check in CanEditScriptCheckFunctions)
  476. {
  477. if (check(script, objectID, user, m_scene) == false)
  478. {
  479. return false;
  480. }
  481. }
  482. return true;
  483. }
  484. public delegate bool CanEditNotecard(LLUUID notecard, LLUUID objectID, LLUUID user, Scene scene);
  485. private List<CanEditNotecard> CanEditNotecardCheckFunctions = new List<CanEditNotecard>();
  486. public void addCheckEditNotecard(CanEditNotecard delegateFunc)
  487. {
  488. if (!CanEditNotecardCheckFunctions.Contains(delegateFunc))
  489. CanEditNotecardCheckFunctions.Add(delegateFunc);
  490. }
  491. public void removeCheckEditNotecard(CanEditNotecard delegateFunc)
  492. {
  493. if (CanEditNotecardCheckFunctions.Contains(delegateFunc))
  494. CanEditNotecardCheckFunctions.Remove(delegateFunc);
  495. }
  496. public bool ExternalChecksCanEditNotecard(LLUUID script, LLUUID objectID, LLUUID user)
  497. {
  498. foreach (CanEditNotecard check in CanEditNotecardCheckFunctions)
  499. {
  500. if (check(script, objectID, user, m_scene) == false)
  501. {
  502. return false;
  503. }
  504. }
  505. return true;
  506. }
  507. #endregion
  508. #region RUN SCRIPT (When Script Placed in Object)
  509. public delegate bool CanRunScript(LLUUID script, LLUUID objectID, LLUUID user, Scene scene);
  510. private List<CanRunScript> CanRunScriptCheckFunctions = new List<CanRunScript>();
  511. public void addCheckRunScript(CanRunScript delegateFunc)
  512. {
  513. if (!CanRunScriptCheckFunctions.Contains(delegateFunc))
  514. CanRunScriptCheckFunctions.Add(delegateFunc);
  515. }
  516. public void removeCheckRunScript(CanRunScript delegateFunc)
  517. {
  518. if (CanRunScriptCheckFunctions.Contains(delegateFunc))
  519. CanRunScriptCheckFunctions.Remove(delegateFunc);
  520. }
  521. public bool ExternalChecksCanRunScript(LLUUID script, LLUUID objectID, LLUUID user)
  522. {
  523. foreach (CanRunScript check in CanRunScriptCheckFunctions)
  524. {
  525. if (check(script, objectID, user, m_scene) == false)
  526. {
  527. return false;
  528. }
  529. }
  530. return true;
  531. }
  532. #endregion
  533. #region START SCRIPT (When Script run box is Checked after placed in object)
  534. public delegate bool CanStartScript(LLUUID script, LLUUID user, Scene scene);
  535. private List<CanStartScript> CanStartScriptCheckFunctions = new List<CanStartScript>();
  536. public void addCheckStartScript(CanStartScript delegateFunc)
  537. {
  538. if (!CanStartScriptCheckFunctions.Contains(delegateFunc))
  539. CanStartScriptCheckFunctions.Add(delegateFunc);
  540. }
  541. public void removeCheckStartScript(CanStartScript delegateFunc)
  542. {
  543. if (CanStartScriptCheckFunctions.Contains(delegateFunc))
  544. CanStartScriptCheckFunctions.Remove(delegateFunc);
  545. }
  546. public bool ExternalChecksCanStartScript(LLUUID script, LLUUID user)
  547. {
  548. foreach (CanStartScript check in CanStartScriptCheckFunctions)
  549. {
  550. if (check(script, user, m_scene) == false)
  551. {
  552. return false;
  553. }
  554. }
  555. return true;
  556. }
  557. #endregion
  558. #region STOP SCRIPT (When Script run box is unchecked after placed in object)
  559. public delegate bool CanStopScript(LLUUID script, LLUUID user, Scene scene);
  560. private List<CanStopScript> CanStopScriptCheckFunctions = new List<CanStopScript>();
  561. public void addCheckStopScript(CanStopScript delegateFunc)
  562. {
  563. if (!CanStopScriptCheckFunctions.Contains(delegateFunc))
  564. CanStopScriptCheckFunctions.Add(delegateFunc);
  565. }
  566. public void removeCheckStopScript(CanStopScript delegateFunc)
  567. {
  568. if (CanStopScriptCheckFunctions.Contains(delegateFunc))
  569. CanStopScriptCheckFunctions.Remove(delegateFunc);
  570. }
  571. public bool ExternalChecksCanStopScript(LLUUID script, LLUUID user)
  572. {
  573. foreach (CanStopScript check in CanStopScriptCheckFunctions)
  574. {
  575. if (check(script, user, m_scene) == false)
  576. {
  577. return false;
  578. }
  579. }
  580. return true;
  581. }
  582. #endregion
  583. #region RESET SCRIPT
  584. public delegate bool CanResetScript(LLUUID script, LLUUID user, Scene scene);
  585. private List<CanResetScript> CanResetScriptCheckFunctions = new List<CanResetScript>();
  586. public void addCheckResetScript(CanResetScript delegateFunc)
  587. {
  588. if (!CanResetScriptCheckFunctions.Contains(delegateFunc))
  589. CanResetScriptCheckFunctions.Add(delegateFunc);
  590. }
  591. public void removeCheckResetScript(CanResetScript delegateFunc)
  592. {
  593. if (CanResetScriptCheckFunctions.Contains(delegateFunc))
  594. CanResetScriptCheckFunctions.Remove(delegateFunc);
  595. }
  596. public bool ExternalChecksCanResetScript(LLUUID script, LLUUID user)
  597. {
  598. foreach (CanResetScript check in CanResetScriptCheckFunctions)
  599. {
  600. if (check(script, user, m_scene) == false)
  601. {
  602. return false;
  603. }
  604. }
  605. return true;
  606. }
  607. #endregion
  608. #region TERRAFORM LAND
  609. public delegate bool CanTerraformLand(LLUUID user, LLVector3 position, Scene requestFromScene);
  610. private List<CanTerraformLand> CanTerraformLandCheckFunctions = new List<CanTerraformLand>();
  611. public void addCheckTerraformLand(CanTerraformLand delegateFunc)
  612. {
  613. if (!CanTerraformLandCheckFunctions.Contains(delegateFunc))
  614. CanTerraformLandCheckFunctions.Add(delegateFunc);
  615. }
  616. public void removeCheckTerraformLand(CanTerraformLand delegateFunc)
  617. {
  618. if (CanTerraformLandCheckFunctions.Contains(delegateFunc))
  619. CanTerraformLandCheckFunctions.Remove(delegateFunc);
  620. }
  621. public bool ExternalChecksCanTerraformLand(LLUUID user, LLVector3 pos)
  622. {
  623. foreach (CanTerraformLand check in CanTerraformLandCheckFunctions)
  624. {
  625. if (check(user, pos, m_scene) == false)
  626. {
  627. return false;
  628. }
  629. }
  630. return true;
  631. }
  632. #endregion
  633. #region RUN CONSOLE COMMAND
  634. public delegate bool CanRunConsoleCommand(LLUUID user, Scene requestFromScene);
  635. private List<CanRunConsoleCommand> CanRunConsoleCommandCheckFunctions = new List<CanRunConsoleCommand>();
  636. public void addCheckRunConsoleCommand(CanRunConsoleCommand delegateFunc)
  637. {
  638. if (!CanRunConsoleCommandCheckFunctions.Contains(delegateFunc))
  639. CanRunConsoleCommandCheckFunctions.Add(delegateFunc);
  640. }
  641. public void removeCheckRunConsoleCommand(CanRunConsoleCommand delegateFunc)
  642. {
  643. if (CanRunConsoleCommandCheckFunctions.Contains(delegateFunc))
  644. CanRunConsoleCommandCheckFunctions.Remove(delegateFunc);
  645. }
  646. public bool ExternalChecksCanRunConsoleCommand(LLUUID user)
  647. {
  648. foreach (CanRunConsoleCommand check in CanRunConsoleCommandCheckFunctions)
  649. {
  650. if (check(user, m_scene) == false)
  651. {
  652. return false;
  653. }
  654. }
  655. return true;
  656. }
  657. #endregion
  658. #region CAN ISSUE ESTATE COMMAND
  659. public delegate bool CanIssueEstateCommand(LLUUID user, Scene requestFromScene);
  660. private List<CanIssueEstateCommand> CanIssueEstateCommandCheckFunctions = new List<CanIssueEstateCommand>();
  661. public void addCheckIssueEstateCommand(CanIssueEstateCommand delegateFunc)
  662. {
  663. if (!CanIssueEstateCommandCheckFunctions.Contains(delegateFunc))
  664. CanIssueEstateCommandCheckFunctions.Add(delegateFunc);
  665. }
  666. public void removeCheckIssueEstateCommand(CanIssueEstateCommand delegateFunc)
  667. {
  668. if (CanIssueEstateCommandCheckFunctions.Contains(delegateFunc))
  669. CanIssueEstateCommandCheckFunctions.Remove(delegateFunc);
  670. }
  671. public bool ExternalChecksCanIssueEstateCommand(LLUUID user)
  672. {
  673. foreach (CanIssueEstateCommand check in CanIssueEstateCommandCheckFunctions)
  674. {
  675. if (check(user, m_scene) == false)
  676. {
  677. return false;
  678. }
  679. }
  680. return true;
  681. }
  682. #endregion
  683. #region CAN BE GODLIKE
  684. public delegate bool CanBeGodLike(LLUUID user, Scene requestFromScene);
  685. private List<CanBeGodLike> CanBeGodLikeCheckFunctions = new List<CanBeGodLike>();
  686. public void addCheckBeGodLike(CanBeGodLike delegateFunc)
  687. {
  688. if (!CanBeGodLikeCheckFunctions.Contains(delegateFunc))
  689. CanBeGodLikeCheckFunctions.Add(delegateFunc);
  690. }
  691. public void removeCheckBeGodLike(CanBeGodLike delegateFunc)
  692. {
  693. if (CanBeGodLikeCheckFunctions.Contains(delegateFunc))
  694. CanBeGodLikeCheckFunctions.Remove(delegateFunc);
  695. }
  696. public bool ExternalChecksCanBeGodLike(LLUUID user)
  697. {
  698. foreach (CanBeGodLike check in CanBeGodLikeCheckFunctions)
  699. {
  700. if (check(user, m_scene) == false)
  701. {
  702. return false;
  703. }
  704. }
  705. return true;
  706. }
  707. #endregion
  708. #region EDIT PARCEL
  709. public delegate bool CanEditParcel(LLUUID user, ILandObject parcel, Scene scene);
  710. private List<CanEditParcel> CanEditParcelCheckFunctions = new List<CanEditParcel>();
  711. public void addCheckEditParcel(CanEditParcel delegateFunc)
  712. {
  713. if (!CanEditParcelCheckFunctions.Contains(delegateFunc))
  714. CanEditParcelCheckFunctions.Add(delegateFunc);
  715. }
  716. public void removeCheckEditParcel(CanEditParcel delegateFunc)
  717. {
  718. if (CanEditParcelCheckFunctions.Contains(delegateFunc))
  719. CanEditParcelCheckFunctions.Remove(delegateFunc);
  720. }
  721. public bool ExternalChecksCanEditParcel(LLUUID user, ILandObject parcel)
  722. {
  723. foreach (CanEditParcel check in CanEditParcelCheckFunctions)
  724. {
  725. if (check(user, parcel, m_scene) == false)
  726. {
  727. return false;
  728. }
  729. }
  730. return true;
  731. }
  732. #endregion
  733. #region SELL PARCEL
  734. public delegate bool CanSellParcel(LLUUID user, ILandObject parcel, Scene scene);
  735. private List<CanSellParcel> CanSellParcelCheckFunctions = new List<CanSellParcel>();
  736. public void addCheckSellParcel(CanSellParcel delegateFunc)
  737. {
  738. if (!CanSellParcelCheckFunctions.Contains(delegateFunc))
  739. CanSellParcelCheckFunctions.Add(delegateFunc);
  740. }
  741. public void removeCheckSellParcel(CanSellParcel delegateFunc)
  742. {
  743. if (CanSellParcelCheckFunctions.Contains(delegateFunc))
  744. CanSellParcelCheckFunctions.Remove(delegateFunc);
  745. }
  746. public bool ExternalChecksCanSellParcel(LLUUID user, ILandObject parcel)
  747. {
  748. foreach (CanSellParcel check in CanSellParcelCheckFunctions)
  749. {
  750. if (check(user, parcel, m_scene) == false)
  751. {
  752. return false;
  753. }
  754. }
  755. return true;
  756. }
  757. #endregion
  758. #region ABANDON PARCEL
  759. public delegate bool CanAbandonParcel(LLUUID user, ILandObject parcel, Scene scene);
  760. private List<CanAbandonParcel> CanAbandonParcelCheckFunctions = new List<CanAbandonParcel>();
  761. public void addCheckAbandonParcel(CanAbandonParcel delegateFunc)
  762. {
  763. if (!CanAbandonParcelCheckFunctions.Contains(delegateFunc))
  764. CanAbandonParcelCheckFunctions.Add(delegateFunc);
  765. }
  766. public void removeCheckAbandonParcel(CanAbandonParcel delegateFunc)
  767. {
  768. if (CanAbandonParcelCheckFunctions.Contains(delegateFunc))
  769. CanAbandonParcelCheckFunctions.Remove(delegateFunc);
  770. }
  771. public bool ExternalChecksCanAbandonParcel(LLUUID user, ILandObject parcel)
  772. {
  773. foreach (CanAbandonParcel check in CanAbandonParcelCheckFunctions)
  774. {
  775. if (check(user, parcel, m_scene) == false)
  776. {
  777. return false;
  778. }
  779. }
  780. return true;
  781. }
  782. #endregion
  783. public delegate bool CanBuyLand(LLUUID user, ILandObject parcel, Scene scene);
  784. private List<CanBuyLand> CanBuyLandCheckFunctions = new List<CanBuyLand>();
  785. public void addCheckCanBuyLand(CanBuyLand delegateFunc)
  786. {
  787. if (!CanBuyLandCheckFunctions.Contains(delegateFunc))
  788. CanBuyLandCheckFunctions.Add(delegateFunc);
  789. }
  790. public void removeCheckCanBuyLand(CanBuyLand delegateFunc)
  791. {
  792. if (CanBuyLandCheckFunctions.Contains(delegateFunc))
  793. CanBuyLandCheckFunctions.Remove(delegateFunc);
  794. }
  795. public bool ExternalChecksCanBuyLand(LLUUID user, ILandObject parcel)
  796. {
  797. foreach (CanBuyLand check in CanBuyLandCheckFunctions)
  798. {
  799. if (check(user, parcel, m_scene) == false)
  800. {
  801. return false;
  802. }
  803. }
  804. return true;
  805. }
  806. public delegate bool CanLinkObject(LLUUID user, LLUUID objectID);
  807. private List<CanLinkObject> CanLinkObjectCheckFunctions = new List<CanLinkObject>();
  808. public void addCheckCanLinkObject(CanLinkObject delegateFunc)
  809. {
  810. if (!CanLinkObjectCheckFunctions.Contains(delegateFunc))
  811. CanLinkObjectCheckFunctions.Add(delegateFunc);
  812. }
  813. public void removeCheckCanLinkObject(CanLinkObject delegateFunc)
  814. {
  815. if (CanLinkObjectCheckFunctions.Contains(delegateFunc))
  816. CanLinkObjectCheckFunctions.Remove(delegateFunc);
  817. }
  818. public bool ExternalChecksCanLinkObject(LLUUID user, LLUUID objectID)
  819. {
  820. foreach (CanLinkObject check in CanLinkObjectCheckFunctions)
  821. {
  822. if (check(user, objectID) == false)
  823. {
  824. return false;
  825. }
  826. }
  827. return true;
  828. }
  829. public delegate bool CanDelinkObject(LLUUID user, LLUUID objectID);
  830. private List<CanDelinkObject> CanDelinkObjectCheckFunctions = new List<CanDelinkObject>();
  831. public void addCheckCanDelinkObject(CanDelinkObject delegateFunc)
  832. {
  833. if (!CanDelinkObjectCheckFunctions.Contains(delegateFunc))
  834. CanDelinkObjectCheckFunctions.Add(delegateFunc);
  835. }
  836. public void removeCheckCanDelinkObject(CanDelinkObject delegateFunc)
  837. {
  838. if (CanDelinkObjectCheckFunctions.Contains(delegateFunc))
  839. CanDelinkObjectCheckFunctions.Remove(delegateFunc);
  840. }
  841. public bool ExternalChecksCanDelinkObject(LLUUID user, LLUUID objectID)
  842. {
  843. foreach (CanDelinkObject check in CanDelinkObjectCheckFunctions)
  844. {
  845. if (check(user, objectID) == false)
  846. {
  847. return false;
  848. }
  849. }
  850. return true;
  851. }
  852. #endregion
  853. public delegate bool CanCreateInventory(uint invType, LLUUID objectID, LLUUID userID);
  854. private List<CanCreateInventory> CanCreateInventoryCheckFunctions = new List<CanCreateInventory>();
  855. public void addCheckCanCreateInventory(CanCreateInventory delegateFunc)
  856. {
  857. if (!CanCreateInventoryCheckFunctions.Contains(delegateFunc))
  858. CanCreateInventoryCheckFunctions.Add(delegateFunc);
  859. }
  860. public void removeCheckCanCreateInventory(CanCreateInventory delegateFunc)
  861. {
  862. if (CanCreateInventoryCheckFunctions.Contains(delegateFunc))
  863. CanCreateInventoryCheckFunctions.Remove(delegateFunc);
  864. }
  865. public bool ExternalChecksCanCreateInventory(uint invType, LLUUID objectID, LLUUID userID)
  866. {
  867. foreach (CanCreateInventory check in CanCreateInventoryCheckFunctions)
  868. {
  869. if (check(invType, objectID, userID) == false)
  870. {
  871. return false;
  872. }
  873. }
  874. return true;
  875. }
  876. public delegate bool CanCopyInventory(LLUUID itemID, LLUUID objectID, LLUUID userID);
  877. private List<CanCopyInventory> CanCopyInventoryCheckFunctions = new List<CanCopyInventory>();
  878. public void addCheckCanCopyInventory(CanCopyInventory delegateFunc)
  879. {
  880. if (!CanCopyInventoryCheckFunctions.Contains(delegateFunc))
  881. CanCopyInventoryCheckFunctions.Add(delegateFunc);
  882. }
  883. public void removeCheckCanCopyInventory(CanCopyInventory delegateFunc)
  884. {
  885. if (CanCopyInventoryCheckFunctions.Contains(delegateFunc))
  886. CanCopyInventoryCheckFunctions.Remove(delegateFunc);
  887. }
  888. public bool ExternalChecksCanCopyInventory(LLUUID itemID, LLUUID objectID, LLUUID userID)
  889. {
  890. foreach (CanCopyInventory check in CanCopyInventoryCheckFunctions)
  891. {
  892. if (check(itemID, objectID, userID) == false)
  893. {
  894. return false;
  895. }
  896. }
  897. return true;
  898. }
  899. public delegate bool CanDeleteInventory(LLUUID itemID, LLUUID objectID, LLUUID userID);
  900. private List<CanDeleteInventory> CanDeleteInventoryCheckFunctions = new List<CanDeleteInventory>();
  901. public void addCheckCanDeleteInventory(CanDeleteInventory delegateFunc)
  902. {
  903. if (!CanDeleteInventoryCheckFunctions.Contains(delegateFunc))
  904. CanDeleteInventoryCheckFunctions.Add(delegateFunc);
  905. }
  906. public void removeCheckCanDeleteInventory(CanDeleteInventory delegateFunc)
  907. {
  908. if (CanDeleteInventoryCheckFunctions.Contains(delegateFunc))
  909. CanDeleteInventoryCheckFunctions.Remove(delegateFunc);
  910. }
  911. public bool ExternalChecksCanDeleteInventory(LLUUID itemID, LLUUID objectID, LLUUID userID)
  912. {
  913. foreach (CanDeleteInventory check in CanDeleteInventoryCheckFunctions)
  914. {
  915. if (check(itemID, objectID, userID) == false)
  916. {
  917. return false;
  918. }
  919. }
  920. return true;
  921. }
  922. public delegate bool CanTeleport(LLUUID userID);
  923. private List<CanTeleport> CanTeleportCheckFunctions = new List<CanTeleport>();
  924. public void addCheckCanTeleport(CanTeleport delegateFunc)
  925. {
  926. if (!CanTeleportCheckFunctions.Contains(delegateFunc))
  927. CanTeleportCheckFunctions.Add(delegateFunc);
  928. }
  929. public void removeCheckCanTeleport(CanTeleport delegateFunc)
  930. {
  931. if (CanTeleportCheckFunctions.Contains(delegateFunc))
  932. CanTeleportCheckFunctions.Remove(delegateFunc);
  933. }
  934. public bool ExternalChecksCanTeleport(LLUUID userID)
  935. {
  936. foreach (CanTeleport check in CanTeleportCheckFunctions)
  937. {
  938. if (check(userID) == false)
  939. {
  940. return false;
  941. }
  942. }
  943. return true;
  944. }
  945. }
  946. }